diff options
| author | Rafał Miłecki <zajec5@gmail.com> | 2013-01-25 05:36:26 -0500 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2013-01-30 15:06:46 -0500 |
| commit | c7a4a9e3880cc8cdc1f2958796e517d9d96ff7e0 (patch) | |
| tree | 1304991d04dc516c590320b996f976cf61e1f893 /drivers/ssb | |
| parent | f1ab57e3a114173fdb94219937191f0c673e87dd (diff) | |
ssb: register platform device for parallel flash
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb')
| -rw-r--r-- | drivers/ssb/driver_mipscore.c | 29 | ||||
| -rw-r--r-- | drivers/ssb/main.c | 8 | ||||
| -rw-r--r-- | drivers/ssb/ssb_private.h | 4 |
3 files changed, 40 insertions, 1 deletions
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c index 77bc8d4c1d5f..33b37dac40bd 100644 --- a/drivers/ssb/driver_mipscore.c +++ b/drivers/ssb/driver_mipscore.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <linux/ssb/ssb.h> | 11 | #include <linux/ssb/ssb.h> |
| 12 | 12 | ||
| 13 | #include <linux/mtd/physmap.h> | ||
| 13 | #include <linux/serial.h> | 14 | #include <linux/serial.h> |
| 14 | #include <linux/serial_core.h> | 15 | #include <linux/serial_core.h> |
| 15 | #include <linux/serial_reg.h> | 16 | #include <linux/serial_reg.h> |
| @@ -17,6 +18,25 @@ | |||
| 17 | 18 | ||
| 18 | #include "ssb_private.h" | 19 | #include "ssb_private.h" |
| 19 | 20 | ||
| 21 | static const char *part_probes[] = { "bcm47xxpart", NULL }; | ||
| 22 | |||
| 23 | static struct physmap_flash_data ssb_pflash_data = { | ||
| 24 | .part_probe_types = part_probes, | ||
| 25 | }; | ||
| 26 | |||
| 27 | static struct resource ssb_pflash_resource = { | ||
| 28 | .name = "ssb_pflash", | ||
| 29 | .flags = IORESOURCE_MEM, | ||
| 30 | }; | ||
| 31 | |||
| 32 | struct platform_device ssb_pflash_dev = { | ||
| 33 | .name = "physmap-flash", | ||
| 34 | .dev = { | ||
| 35 | .platform_data = &ssb_pflash_data, | ||
| 36 | }, | ||
| 37 | .resource = &ssb_pflash_resource, | ||
| 38 | .num_resources = 1, | ||
| 39 | }; | ||
| 20 | 40 | ||
| 21 | static inline u32 mips_read32(struct ssb_mipscore *mcore, | 41 | static inline u32 mips_read32(struct ssb_mipscore *mcore, |
| 22 | u16 offset) | 42 | u16 offset) |
| @@ -197,7 +217,7 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore) | |||
| 197 | pflash->buswidth = 2; | 217 | pflash->buswidth = 2; |
| 198 | pflash->window = SSB_FLASH1; | 218 | pflash->window = SSB_FLASH1; |
| 199 | pflash->window_size = SSB_FLASH1_SZ; | 219 | pflash->window_size = SSB_FLASH1_SZ; |
| 200 | return; | 220 | goto ssb_pflash; |
| 201 | } | 221 | } |
| 202 | 222 | ||
| 203 | /* There is ChipCommon, so use it to read info about flash */ | 223 | /* 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 | pflash->buswidth = 2; | 239 | pflash->buswidth = 2; |
| 220 | break; | 240 | break; |
| 221 | } | 241 | } |
| 242 | |||
| 243 | ssb_pflash: | ||
| 244 | if (pflash->present) { | ||
| 245 | ssb_pflash_data.width = pflash->buswidth; | ||
| 246 | ssb_pflash_resource.start = pflash->window; | ||
| 247 | ssb_pflash_resource.end = pflash->window + pflash->window_size; | ||
| 248 | } | ||
| 222 | } | 249 | } |
| 223 | 250 | ||
| 224 | u32 ssb_cpu_clock(struct ssb_mipscore *mcore) | 251 | u32 ssb_cpu_clock(struct ssb_mipscore *mcore) |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index c82c5c95fe85..db7705743a8f 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
| @@ -540,6 +540,14 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
| 540 | dev_idx++; | 540 | dev_idx++; |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | #ifdef CONFIG_SSB_DRIVER_MIPS | ||
| 544 | if (bus->mipscore.pflash.present) { | ||
| 545 | err = platform_device_register(&ssb_pflash_dev); | ||
| 546 | if (err) | ||
| 547 | pr_err("Error registering parallel flash\n"); | ||
| 548 | } | ||
| 549 | #endif | ||
| 550 | |||
| 543 | return 0; | 551 | return 0; |
| 544 | error: | 552 | error: |
| 545 | /* Unwind the already registered devices. */ | 553 | /* Unwind the already registered devices. */ |
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h index 77d942630750..53198dcec90e 100644 --- a/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h | |||
| @@ -228,6 +228,10 @@ static inline int ssb_sflash_init(struct ssb_chipcommon *cc) | |||
| 228 | } | 228 | } |
| 229 | #endif /* CONFIG_SSB_SFLASH */ | 229 | #endif /* CONFIG_SSB_SFLASH */ |
| 230 | 230 | ||
| 231 | #ifdef CONFIG_SSB_DRIVER_MIPS | ||
| 232 | extern struct platform_device ssb_pflash_dev; | ||
| 233 | #endif | ||
| 234 | |||
| 231 | #ifdef CONFIG_SSB_DRIVER_EXTIF | 235 | #ifdef CONFIG_SSB_DRIVER_EXTIF |
| 232 | extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); | 236 | extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); |
| 233 | extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); | 237 | extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); |
