提交 d6a3b51a 编写于 作者: R Rafał Miłecki 提交者: Kalle Valo

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.
Signed-off-by: NRafał Miłecki <zajec5@gmail.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 2e62f9b2
...@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS ...@@ -70,6 +70,11 @@ config BCMA_DRIVER_MIPS
If unsure, say N If unsure, say N
config BCMA_PFLASH
bool
depends on BCMA_DRIVER_MIPS
default y
config BCMA_SFLASH config BCMA_SFLASH
bool bool
depends on BCMA_DRIVER_MIPS depends on BCMA_DRIVER_MIPS
......
bcma-y += main.o scan.o core.o sprom.o bcma-y += main.o scan.o core.o sprom.o
bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
bcma-y += driver_chipcommon_b.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_SFLASH) += driver_chipcommon_sflash.o
bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o bcma-$(CONFIG_BCMA_NFLASH) += driver_chipcommon_nflash.o
bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o bcma-$(CONFIG_BCMA_DRIVER_PCI) += driver_pci.o
......
...@@ -47,9 +47,6 @@ int bcma_sprom_get(struct bcma_bus *bus); ...@@ -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_early_init(struct bcma_drv_cc *cc);
void bcma_core_chipcommon_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); 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 */ /* driver_chipcommon_b.c */
int bcma_core_chipcommon_b_init(struct bcma_drv_cc_b *ccb); 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); ...@@ -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_alp_clock(struct bcma_drv_cc *cc);
u32 bcma_pmu_get_cpu_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 #ifdef CONFIG_BCMA_SFLASH
/* driver_chipcommon_sflash.c */ /* driver_chipcommon_sflash.c */
int bcma_sflash_init(struct bcma_drv_cc *cc); int bcma_sflash_init(struct bcma_drv_cc *cc);
......
/*
* Broadcom specific AMBA
* ChipCommon parallel flash
*
* Licensed under the GNU/GPL. See COPYING for details.
*/
#include "bcma_private.h"
#include <linux/bcma/bcma.h>
#include <linux/mtd/physmap.h>
#include <linux/platform_device.h>
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,
};
int bcma_pflash_init(struct bcma_drv_cc *cc)
{
struct bcma_pflash *pflash = &cc->pflash;
pflash->present = true;
if (!(bcma_read32(cc->core, BCMA_CC_FLASH_CFG) & BCMA_CC_FLASH_CFG_DS))
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;
return 0;
}
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include <linux/bcma/bcma.h> #include <linux/bcma/bcma.h>
#include <linux/mtd/physmap.h>
#include <linux/platform_device.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
...@@ -32,26 +30,6 @@ enum bcma_boot_dev { ...@@ -32,26 +30,6 @@ enum bcma_boot_dev {
BCMA_BOOT_DEV_NAND, 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 */ /* The 47162a0 hangs when reading MIPS DMP registers registers */
static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev) 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) ...@@ -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_bus *bus = mcore->core->bus;
struct bcma_drv_cc *cc = &bus->drv_cc; struct bcma_drv_cc *cc = &bus->drv_cc;
struct bcma_pflash *pflash = &cc->pflash;
enum bcma_boot_dev boot_dev; enum bcma_boot_dev boot_dev;
switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
...@@ -287,17 +264,7 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) ...@@ -287,17 +264,7 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
break; break;
case BCMA_CC_FLASHT_PARA: case BCMA_CC_FLASHT_PARA:
bcma_debug(bus, "Found parallel flash\n"); bcma_debug(bus, "Found parallel flash\n");
pflash->present = true; bcma_pflash_init(cc);
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;
break; break;
default: default:
bcma_err(bus, "Flash type not supported\n"); bcma_err(bus, "Flash type not supported\n");
......
...@@ -350,7 +350,7 @@ static int bcma_register_devices(struct bcma_bus *bus) ...@@ -350,7 +350,7 @@ static int bcma_register_devices(struct bcma_bus *bus)
bcma_register_core(bus, core); bcma_register_core(bus, core);
} }
#ifdef CONFIG_BCMA_DRIVER_MIPS #ifdef CONFIG_BCMA_PFLASH
if (bus->drv_cc.pflash.present) { if (bus->drv_cc.pflash.present) {
err = platform_device_register(&bcma_pflash_dev); err = platform_device_register(&bcma_pflash_dev);
if (err) if (err)
......
...@@ -576,10 +576,11 @@ struct bcma_chipcommon_pmu { ...@@ -576,10 +576,11 @@ struct bcma_chipcommon_pmu {
u32 crystalfreq; /* The active crystal frequency (in kHz) */ u32 crystalfreq; /* The active crystal frequency (in kHz) */
}; };
#ifdef CONFIG_BCMA_DRIVER_MIPS #ifdef CONFIG_BCMA_PFLASH
struct bcma_pflash { struct bcma_pflash {
bool present; bool present;
}; };
#endif
#ifdef CONFIG_BCMA_SFLASH #ifdef CONFIG_BCMA_SFLASH
struct mtd_info; struct mtd_info;
...@@ -603,6 +604,7 @@ struct bcma_nflash { ...@@ -603,6 +604,7 @@ struct bcma_nflash {
}; };
#endif #endif
#ifdef CONFIG_BCMA_DRIVER_MIPS
struct bcma_serial_port { struct bcma_serial_port {
void *regs; void *regs;
unsigned long clockspeed; unsigned long clockspeed;
...@@ -622,8 +624,9 @@ struct bcma_drv_cc { ...@@ -622,8 +624,9 @@ struct bcma_drv_cc {
/* Fast Powerup Delay constant */ /* Fast Powerup Delay constant */
u16 fast_pwrup_delay; u16 fast_pwrup_delay;
struct bcma_chipcommon_pmu pmu; struct bcma_chipcommon_pmu pmu;
#ifdef CONFIG_BCMA_DRIVER_MIPS #ifdef CONFIG_BCMA_PFLASH
struct bcma_pflash pflash; struct bcma_pflash pflash;
#endif
#ifdef CONFIG_BCMA_SFLASH #ifdef CONFIG_BCMA_SFLASH
struct bcma_sflash sflash; struct bcma_sflash sflash;
#endif #endif
...@@ -631,6 +634,7 @@ struct bcma_drv_cc { ...@@ -631,6 +634,7 @@ struct bcma_drv_cc {
struct bcma_nflash nflash; struct bcma_nflash nflash;
#endif #endif
#ifdef CONFIG_BCMA_DRIVER_MIPS
int nr_serial_ports; int nr_serial_ports;
struct bcma_serial_port serial_ports[4]; struct bcma_serial_port serial_ports[4];
#endif /* CONFIG_BCMA_DRIVER_MIPS */ #endif /* CONFIG_BCMA_DRIVER_MIPS */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册