bcma: drop unneeded fields from bcma_pflash struct
Rafał Miłecki
maintainerPATCH 1/3 bcma: drop unneeded fields from bcma_pflash struct
Most of info stored in this struct wasn't really used anywhere as we put all that data in platform data & resource as well.
--- drivers/bcma/driver_mips.c | 11 ++++------- include/linux/bcma/bcma_driver_chipcommon.h | 3 --- 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/bcma/driver_mips.c +4 -7
@@ -288,18 +288,15 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)case BCMA_CC_FLASHT_PARA :bcma_debug (bus,"Found parallel flash\n" ); pflash->present = true; - pflash->window =BCMA_SOC_FLASH2 ; - pflash->window_size =BCMA_SOC_FLASH2_SZ ;if ((bcma_read32 (cc->core,BCMA_CC_FLASH_CFG ) &BCMA_CC_FLASH_CFG_DS ) ==0 ) - pflash->buswidth =1 ; + bcma_pflash_data.width =1 ;else - pflash->buswidth =2 ; + bcma_pflash_data.width =2 ; - bcma_pflash_data.width = pflash->buswidth; - bcma_pflash_resource.start = pflash->window; - bcma_pflash_resource.end = pflash->window + pflash->window_size; + bcma_pflash_resource.start =BCMA_SOC_FLASH2 ; + bcma_pflash_resource.end =BCMA_SOC_FLASH2 +BCMA_SOC_FLASH2_SZ ;break ;default :
include/linux/bcma/bcma_driver_chipcommon.h +0 -3
@@ -579,9 +579,6 @@ struct bcma_chipcommon_pmu {#ifdef CONFIG_BCMA_DRIVER_MIPS struct bcma_pflash {bool present; -u8 buswidth; -u32 window; -u32 window_size; };#ifdef CONFIG_BCMA_SFLASH
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerPATCH 2/3 bcma: move parallel flash support to separated file
This follows the way of handling other flashes and cleans code a bit. As next task we will want to move flash code to ChipCommon driver as:
1) Flash controllers are accesible using ChipCommon registers
2) This code isn't MIPS specific
This change prepares bcma for that.
--- drivers/bcma/Kconfig | 5 +++ drivers/bcma/Makefile | 1 + drivers/bcma/bcma_private.h | 18 +++++++++-- drivers/bcma/driver_chipcommon_pflash.c | 49 +++++++++++++++++++++++++++++ drivers/bcma/driver_mips.c | 35 +-------------------- drivers/bcma/main.c | 2 +- include/linux/bcma/bcma_driver_chipcommon.h | 8 +++-- 7 files changed, 78 insertions(+), 40 deletions(-) create mode 100644 drivers/bcma/driver_chipcommon_pflash.c
drivers/bcma/Kconfig +5 -0
@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS If unsure, say N +config BCMA_PFLASH + bool + depends on BCMA_DRIVER_MIPS + default y + config BCMA_SFLASH bool depends on BCMA_DRIVER_MIPS
drivers/bcma/Makefile +1 -0
@@ -1,6 +1,7 @@ bcma-y += main.o scan.o core.o sprom.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_chipcommon_b.o +bcma-$(CONFIG_BCMA_PFLASH) += driver_chipcommon_pflash.o bcma-$(CONFIG_BCMA_SFLASH) += driver_chipcommon_sflash.o bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o
drivers/bcma/bcma_private.h +15 -3
@@ -47,9 +47,6 @@ int bcma_sprom_get(struct bcma_bus *bus);void bcma_core_chipcommon_early_init (struct bcma_drv_cc *cc);void bcma_core_chipcommon_init (struct bcma_drv_cc *cc);void bcma_chipco_bcm4331_ext_pa_lines_ctl (struct bcma_drv_cc *cc,bool enable); -#ifdef CONFIG_BCMA_DRIVER_MIPS -extern struct platform_device bcma_pflash_dev; -#endif /* CONFIG_BCMA_DRIVER_MIPS */ /* driver_chipcommon_b.c */ int bcma_core_chipcommon_b_init (struct bcma_drv_cc_b *ccb);
@@ -61,6 +58,21 @@ void bcma_pmu_init(struct bcma_drv_cc *cc);u32 bcma_pmu_get_alp_clock (struct bcma_drv_cc *cc);u32 bcma_pmu_get_cpu_clock (struct bcma_drv_cc *cc); +/************************************************** +* driver_chipcommon_sflash.c +**************************************************/ + +#ifdef CONFIG_BCMA_PFLASH +extern struct platform_device bcma_pflash_dev; +int bcma_pflash_init (struct bcma_drv_cc *cc); +#else +static inline int bcma_pflash_init (struct bcma_drv_cc *cc) +{ +bcma_err (cc->core->bus,"Parallel flash not supported\n" ); +return 0 ; +} +#endif /* CONFIG_BCMA_PFLASH */ +#ifdef CONFIG_BCMA_SFLASH /* driver_chipcommon_sflash.c */ int bcma_sflash_init (struct bcma_drv_cc *cc);
drivers/bcma/driver_chipcommon_pflash.c new file +49 -0
49 lines not on this page · raw message
drivers/bcma/driver_mips.c +1 -34
@@ -14,8 +14,6 @@#include <linux/bcma/bcma.h> -#include <linux/mtd/physmap.h> -#include <linux/platform_device.h> #include <linux/serial.h> #include <linux/serial_core.h> #include <linux/serial_reg.h>
@@ -32,26 +30,6 @@ enum bcma_boot_dev { BCMA_BOOT_DEV_NAND, }; -static const char *const part_probes[] = {"bcm47xxpart" ,NULL }; - -static struct physmap_flash_data bcma_pflash_data = { - .part_probe_types = part_probes, -}; - -static struct resource bcma_pflash_resource = { - .name ="bcma_pflash" , - .flags =IORESOURCE_MEM , -}; - -struct platform_device bcma_pflash_dev = { - .name ="physmap-flash" , - .dev = { - .platform_data = &bcma_pflash_data, - }, - .resource = &bcma_pflash_resource, - .num_resources =1 , -}; -/* The 47162a0 hangs when reading MIPS DMP registers registers */ static inline bool bcma_core_mips_bcm47162a0_quirk (struct bcma_device *dev) {
@@ -276,7 +254,6 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) {struct bcma_bus *bus = mcore->core->bus;struct bcma_drv_cc *cc = &bus->drv_cc; -struct bcma_pflash *pflash = &cc->pflash;enum bcma_boot_dev boot_dev;switch (cc->capabilities &BCMA_CC_CAP_FLASHT ) {
@@ -287,17 +264,7 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)break ;case BCMA_CC_FLASHT_PARA :bcma_debug (bus,"Found parallel flash\n" ); - pflash->present = true; - -if ((bcma_read32 (cc->core,BCMA_CC_FLASH_CFG ) & -BCMA_CC_FLASH_CFG_DS ) ==0 ) - bcma_pflash_data.width =1 ; -else - bcma_pflash_data.width =2 ; - - bcma_pflash_resource.start =BCMA_SOC_FLASH2 ; - bcma_pflash_resource.end =BCMA_SOC_FLASH2 +BCMA_SOC_FLASH2_SZ ; - +bcma_pflash_init (cc);break ;default :bcma_err (bus,"Flash type not supported\n" );
drivers/bcma/main.c +1 -1
@@ -350,7 +350,7 @@ static int bcma_register_devices(struct bcma_bus *bus)bcma_register_core (bus, core); } -#ifdef CONFIG_BCMA_DRIVER_MIPS +#ifdef CONFIG_BCMA_PFLASH if (bus->drv_cc.pflash.present) { err =platform_device_register (&bcma_pflash_dev);if (err)
include/linux/bcma/bcma_driver_chipcommon.h +6 -2
@@ -576,10 +576,11 @@ struct bcma_chipcommon_pmu {u32 crystalfreq;/* The active crystal frequency (in kHz) */ }; -#ifdef CONFIG_BCMA_DRIVER_MIPS +#ifdef CONFIG_BCMA_PFLASH struct bcma_pflash {bool present; }; +#endif #ifdef CONFIG_BCMA_SFLASH struct mtd_info ;
@@ -603,6 +604,7 @@ struct bcma_nflash { };#endif +#ifdef CONFIG_BCMA_DRIVER_MIPS struct bcma_serial_port { void *regs; unsigned long clockspeed;
@@ -622,8 +624,9 @@ struct bcma_drv_cc {/* Fast Powerup Delay constant */ u16 fast_pwrup_delay;struct bcma_chipcommon_pmu pmu; -#ifdef CONFIG_BCMA_DRIVER_MIPS +#ifdef CONFIG_BCMA_PFLASH struct bcma_pflash pflash; +#endif #ifdef CONFIG_BCMA_SFLASH struct bcma_sflash sflash;#endif
@@ -631,6 +634,7 @@ struct bcma_drv_cc {struct bcma_nflash nflash;#endif +#ifdef CONFIG_BCMA_DRIVER_MIPS int nr_serial_ports;struct bcma_serial_port serial_ports[4 ];#endif /* CONFIG_BCMA_DRIVER_MIPS */
Signature · 1 line
1.8.4.5
Rafał Miłecki
maintainerPATCH 3/3 bcma: move flash detection code to ChipCommon core driver
In reply to Rafał MiłeckiFlashes are attached and accessible through ChipCommon core, they aren't connected to MIPS one. Moreover some new ARM devices (e.g. BCM47189) may have serial flash accessibility using ChipCommon registers as well. To support them we can't keep this code in MIPS core driver.
--- drivers/bcma/driver_chipcommon.c | 30 ++++++++++++++++++++++++++++++ drivers/bcma/driver_mips.c | 27 ++------------------------- 2 files changed, 32 insertions(+), 25 deletions(-)
drivers/bcma/driver_chipcommon.c +30 -0
@@ -115,6 +115,33 @@ int bcma_chipco_watchdog_register(struct bcma_drv_cc *cc)return 0 ; } +static void bcma_core_chipcommon_flash_detect (struct bcma_drv_cc *cc) +{ +struct bcma_bus *bus = cc->core->bus; + +switch (cc->capabilities &BCMA_CC_CAP_FLASHT ) { +case BCMA_CC_FLASHT_STSER : +case BCMA_CC_FLASHT_ATSER : +bcma_debug (bus,"Found serial flash\n" ); +bcma_sflash_init (cc); +break ; +case BCMA_CC_FLASHT_PARA : +bcma_debug (bus,"Found parallel flash\n" ); +bcma_pflash_init (cc); +break ; +default : +bcma_err (bus,"Flash type not supported\n" ); + } + +if (cc->core->id.rev ==38 || + bus->chipinfo.id ==BCMA_CHIP_ID_BCM4706 ) { +if (cc->capabilities &BCMA_CC_CAP_NFLASH ) { +bcma_debug (bus,"Found NAND flash\n" ); +bcma_nflash_init (cc); + } + } +} +void bcma_core_chipcommon_early_init (struct bcma_drv_cc *cc) {struct bcma_bus *bus = cc->core->bus;
@@ -136,6 +163,9 @@ void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)if (IS_BUILTIN (CONFIG_BCM47XX ) && bus->hosttype ==BCMA_HOSTTYPE_SOC )bcma_chipco_serial_init (cc); +if (bus->hosttype ==BCMA_HOSTTYPE_SOC ) +bcma_core_chipcommon_flash_detect (cc); + cc->early_setup_done = true; }
drivers/bcma/driver_mips.c +2 -25
@@ -250,34 +250,11 @@ static enum bcma_boot_dev bcma_boot_dev(struct bcma_bus *bus)return BCMA_BOOT_DEV_SERIAL ; } -static void bcma_core_mips_flash_detect (struct bcma_drv_mips *mcore) +static void bcma_core_mips_nvram_init (struct bcma_drv_mips *mcore) {struct bcma_bus *bus = mcore->core->bus; -struct bcma_drv_cc *cc = &bus->drv_cc;enum bcma_boot_dev boot_dev; -switch (cc->capabilities &BCMA_CC_CAP_FLASHT ) { -case BCMA_CC_FLASHT_STSER : -case BCMA_CC_FLASHT_ATSER : -bcma_debug (bus,"Found serial flash\n" ); -bcma_sflash_init (cc); -break ; -case BCMA_CC_FLASHT_PARA : -bcma_debug (bus,"Found parallel flash\n" ); -bcma_pflash_init (cc); -break ; -default : -bcma_err (bus,"Flash type not supported\n" ); - } - -if (cc->core->id.rev ==38 || - bus->chipinfo.id ==BCMA_CHIP_ID_BCM4706 ) { -if (cc->capabilities &BCMA_CC_CAP_NFLASH ) { -bcma_debug (bus,"Found NAND flash\n" ); -bcma_nflash_init (cc); - } - } -/* Determine flash type this SoC boots from */ boot_dev =bcma_boot_dev (bus);switch (boot_dev) {
@@ -304,7 +281,7 @@ void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)if (mcore->early_setup_done)return ; -bcma_core_mips_flash_detect (mcore); +bcma_core_mips_nvram_init (mcore); mcore->early_setup_done = true; }
Signature · 1 line
1.8.4.5
Quoted 4 lines · Rafał Miłecki
Most of info stored in this struct wasn't really used anywhere as we put all that data in platform data & resource as well.
Signed-off-by Rafał Miłecki <[email protected]>
Manually applied to wireless-drivers-next, thanks.
Signature · 1 line
Kalle Valo