bcma: expose cc sprom for read/write in sysfs
v2 cover bcma: expose cc sprom for read/write in sysfs
The ssb driver exposes the device SPROM to sysfs, which allows users to modify various device settings using ssb-sprom from the b43-tools package.
These patches implement similar functionality in bcma, so that ssb-sprom can be used with newer Broadcom devices.
Saul St. John (2):
bcma: register cc core driver, device
bcma: expose cc sprom to sysfs
drivers/bcma/bcma_private.h | 5 + drivers/bcma/driver_chipcommon.c | 212 ++++++++++++++++++++++++--- drivers/bcma/main.c | 79 +++++----- drivers/bcma/sprom.c | 47 +++++- include/linux/bcma/bcma_driver_chipcommon.h | 4 +- 5 files changed, 287 insertions(+), 60 deletions(-)
Signature · 1 line
1.7.10.4
RFC v2 1/2 bcma: register cc core driver, device
This patch adds a device driver for the ChipCommon core ("bcma-cc-core"), registers that driver during module initialization, and registers the CC device if present with device_register().
Tested on a MacBookPro8,2 with BCM4331. Suspend/resume works for me.
--- drivers/bcma/bcma_private.h | 1 + drivers/bcma/driver_chipcommon.c | 51 +++++++++++------ drivers/bcma/main.c | 79 ++++++++++++++------------- include/linux/bcma/bcma_driver_chipcommon.h | 2 - 4 files changed, 75 insertions(+), 58 deletions(-)
drivers/bcma/bcma_private.h +1 -0
@@ -46,6 +46,7 @@ int bcma_sprom_get(struct bcma_bus *bus);#ifdef CONFIG_BCMA_DRIVER_MIPS void bcma_chipco_serial_init (struct bcma_drv_cc *cc);#endif /* CONFIG_BCMA_DRIVER_MIPS */ +extern struct bcma_driver bcma_core_cc_driver;/* driver_chipcommon_pmu.c */ u32 bcma_pmu_alp_clock (struct bcma_drv_cc *cc);
drivers/bcma/driver_chipcommon.c +34 -17
77 lines not on this page · raw message
drivers/bcma/main.c +40 -39
132 lines not on this page · raw message
include/linux/bcma/bcma_driver_chipcommon.h +0 -2
@@ -469,8 +469,6 @@ struct bcma_drv_cc {#define bcma_cc_maskset32 (cc, offset, mask, set) \ bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) -extern void bcma_core_chipcommon_init (struct bcma_drv_cc *cc); -extern void bcma_chipco_suspend (struct bcma_drv_cc *cc);extern void bcma_chipco_resume (struct bcma_drv_cc *cc);
Signature · 1 line
1.7.10.4
RFC v2 2/2 bcma: expose cc sprom to sysfs
In reply to Saul St. JohnOn BCMA devices with a ChipCommon core of revision 31 or higher, the device SPROM can be accessed through CC core registers. This patch exposes the SPROM on such devices for read/write access as a sysfs attribute.
Tested on a MacBookPro8,2 with BCM4331.
--- drivers/bcma/bcma_private.h | 4 + drivers/bcma/driver_chipcommon.c | 163 ++++++++++++++++++++++++++- drivers/bcma/sprom.c | 47 +++++++- include/linux/bcma/bcma_driver_chipcommon.h | 2 + 4 files changed, 213 insertions(+), 3 deletions(-)
drivers/bcma/bcma_private.h +4 -0
@@ -41,6 +41,10 @@ void bcma_init_bus(struct bcma_bus *bus);/* sprom.c */ int bcma_sprom_get (struct bcma_bus *bus); +int bcma_sprom_valid (const u16 *sprom); +void bcma_sprom_extract_r8 (struct bcma_bus *bus,const u16 *sprom); +int bcma_sprom_fromhex (u16 *sprom,const char *dump,size_t len); +int bcma_sprom_tohex (const u16 *sprom,char *buf,size_t buf_len);/* driver_chipcommon.c */ #ifdef CONFIG_BCMA_DRIVER_MIPS
drivers/bcma/driver_chipcommon.c +162 -1
182 lines not on this page · raw message
drivers/bcma/sprom.c +45 -2
68 lines not on this page · raw message
include/linux/bcma/bcma_driver_chipcommon.h +2 -0
@@ -251,6 +251,8 @@#define BCMA_CC_FLASH_CFG_DS 0x0010/* Data size, 0=8bit, 1=16bit */ #define BCMA_CC_FLASH_WAITCNT 0x012C#define BCMA_CC_SROM_CONTROL 0x0190 +#define BCMA_CC_SROM_ADDRESS 0x0194 +#define BCMA_CC_SROM_DATA 0x0198#define BCMA_CC_SROM_CONTROL_START 0x80000000#define BCMA_CC_SROM_CONTROL_BUSY 0x80000000#define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000
Signature · 1 line
1.7.10.4