mirror of
https://github.com/apache/nuttx.git
synced 2026-03-26 18:23:50 +08:00
wireless/cc1101: Add Kconfig option to bypass strict version check
Many third-party CC1101 modules (such as those populated on the Evil Crow RF V2) feature clone silicon that hardcodes the VERSION register to 0x00 instead of the official 0x14. Previously, the cc1101_checkpart() function strictly enforced VERSION == 0x14, which caused cc1101_register() to return -ENODEV (-19) and abort initialization on these compatible modules. This commit introduces the CONFIG_WL_CC1101_IGNORE_VERSION Kconfig option. - When disabled (default), the driver maintains strict official silicon validation. This preserves the diagnostic ability to catch hardware faults, such as a MISO line shorted to GND (which also reads as 0x00). - When enabled, the driver explicitly permits VERSION == 0x00, allowing successful initialization and interoperability with clone chips while printing a warning to the syslog. Signed-off-by: Chip L. <chplee@gmail.com>
This commit is contained in:
@@ -28,6 +28,19 @@ config CC1101_SPIDEV
|
||||
|
||||
endif
|
||||
|
||||
config WL_CC1101_IGNORE_VERSION
|
||||
bool "Ignore CC1101 Version Check (Allow Clone Chips)"
|
||||
default n
|
||||
depends on WL_CC1101
|
||||
---help---
|
||||
Some third-party CC1101 clone silicon hardcodes the VERSION
|
||||
register to 0x00. Enabling this option bypasses the strict
|
||||
version verification, allowing these compatible chips to
|
||||
initialize.
|
||||
|
||||
Warning: Enabling this may cause false-positives if the SPI
|
||||
MISO line is shorted to GND.
|
||||
|
||||
config WL_GS2200M
|
||||
bool "Telit GS2200M Wi-Fi support"
|
||||
default n
|
||||
|
||||
@@ -817,10 +817,27 @@ int cc1101_checkpart(struct cc1101_dev_s *dev)
|
||||
|
||||
wlinfo("CC1101 cc1101_checkpart 0x%X 0x%X\n", partnum, version);
|
||||
|
||||
#ifndef CONFIG_WL_CC1101_IGNORE_VERSION
|
||||
/* Strict official silicon validation */
|
||||
|
||||
if (partnum == CC1101_PARTNUM_VALUE && version == CC1101_VERSION_VALUE)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#else
|
||||
/* Bypass for third-party clone silicon (e.g., VERSION == 0x00) */
|
||||
|
||||
if (partnum == CC1101_PARTNUM_VALUE)
|
||||
{
|
||||
if (version != CC1101_VERSION_VALUE)
|
||||
{
|
||||
wlwarn("WARNING: Unofficial CC1101 version 0x%02x detected.\\n",
|
||||
version);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user