Commit c7a4a9e3 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

ssb: register platform device for parallel flash

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f1ab57e3
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/ssb/ssb.h> #include <linux/ssb/ssb.h>
#include <linux/mtd/physmap.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>
...@@ -17,6 +18,25 @@ ...@@ -17,6 +18,25 @@
#include "ssb_private.h" #include "ssb_private.h"
static const char *part_probes[] = { "bcm47xxpart", NULL };
static struct physmap_flash_data ssb_pflash_data = {
.part_probe_types = part_probes,
};
static struct resource ssb_pflash_resource = {
.name = "ssb_pflash",
.flags = IORESOURCE_MEM,
};
struct platform_device ssb_pflash_dev = {
.name = "physmap-flash",
.dev = {
.platform_data = &ssb_pflash_data,
},
.resource = &ssb_pflash_resource,
.num_resources = 1,
};
static inline u32 mips_read32(struct ssb_mipscore *mcore, static inline u32 mips_read32(struct ssb_mipscore *mcore,
u16 offset) u16 offset)
...@@ -197,7 +217,7 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore) ...@@ -197,7 +217,7 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
pflash->buswidth = 2; pflash->buswidth = 2;
pflash->window = SSB_FLASH1; pflash->window = SSB_FLASH1;
pflash->window_size = SSB_FLASH1_SZ; pflash->window_size = SSB_FLASH1_SZ;
return; goto ssb_pflash;
} }
/* There is ChipCommon, so use it to read info about flash */ /* There is ChipCommon, so use it to read info about flash */
...@@ -219,6 +239,13 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore) ...@@ -219,6 +239,13 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
pflash->buswidth = 2; pflash->buswidth = 2;
break; break;
} }
ssb_pflash:
if (pflash->present) {
ssb_pflash_data.width = pflash->buswidth;
ssb_pflash_resource.start = pflash->window;
ssb_pflash_resource.end = pflash->window + pflash->window_size;
}
} }
u32 ssb_cpu_clock(struct ssb_mipscore *mcore) u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
......
...@@ -540,6 +540,14 @@ static int ssb_devices_register(struct ssb_bus *bus) ...@@ -540,6 +540,14 @@ static int ssb_devices_register(struct ssb_bus *bus)
dev_idx++; dev_idx++;
} }
#ifdef CONFIG_SSB_DRIVER_MIPS
if (bus->mipscore.pflash.present) {
err = platform_device_register(&ssb_pflash_dev);
if (err)
pr_err("Error registering parallel flash\n");
}
#endif
return 0; return 0;
error: error:
/* Unwind the already registered devices. */ /* Unwind the already registered devices. */
......
...@@ -228,6 +228,10 @@ static inline int ssb_sflash_init(struct ssb_chipcommon *cc) ...@@ -228,6 +228,10 @@ static inline int ssb_sflash_init(struct ssb_chipcommon *cc)
} }
#endif /* CONFIG_SSB_SFLASH */ #endif /* CONFIG_SSB_SFLASH */
#ifdef CONFIG_SSB_DRIVER_MIPS
extern struct platform_device ssb_pflash_dev;
#endif
#ifdef CONFIG_SSB_DRIVER_EXTIF #ifdef CONFIG_SSB_DRIVER_EXTIF
extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks);
extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment