diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2013-06-18 01:33:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-18 14:46:46 -0400 |
commit | 7b5d6043de31290de98e9232cbd9a07968aef5bd (patch) | |
tree | 228e02ecbbe6b22041b8f6a5e7eba43bb852f5f9 /drivers/ssb | |
parent | e861ef523cd91270d108edc394e648b1f9e6fbd5 (diff) |
ssb: register serial flash as platform device
This allows writing MTD driver working as a platform driver. In
platform_data it will receive struct ssb_sflash, which contains all
important data about flash (window, size).
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_chipcommon_sflash.c | 19 | ||||
-rw-r--r-- | drivers/ssb/main.c | 8 | ||||
-rw-r--r-- | drivers/ssb/ssb_private.h | 4 |
3 files changed, 31 insertions, 0 deletions
diff --git a/drivers/ssb/driver_chipcommon_sflash.c b/drivers/ssb/driver_chipcommon_sflash.c index 205f1c499c46..e84cf04f4416 100644 --- a/drivers/ssb/driver_chipcommon_sflash.c +++ b/drivers/ssb/driver_chipcommon_sflash.c | |||
@@ -9,6 +9,19 @@ | |||
9 | 9 | ||
10 | #include "ssb_private.h" | 10 | #include "ssb_private.h" |
11 | 11 | ||
12 | static struct resource ssb_sflash_resource = { | ||
13 | .name = "ssb_sflash", | ||
14 | .start = SSB_FLASH2, | ||
15 | .end = 0, | ||
16 | .flags = IORESOURCE_MEM | IORESOURCE_READONLY, | ||
17 | }; | ||
18 | |||
19 | struct platform_device ssb_sflash_dev = { | ||
20 | .name = "ssb_sflash", | ||
21 | .resource = &ssb_sflash_resource, | ||
22 | .num_resources = 1, | ||
23 | }; | ||
24 | |||
12 | struct ssb_sflash_tbl_e { | 25 | struct ssb_sflash_tbl_e { |
13 | char *name; | 26 | char *name; |
14 | u32 id; | 27 | u32 id; |
@@ -141,6 +154,12 @@ int ssb_sflash_init(struct ssb_chipcommon *cc) | |||
141 | pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n", | 154 | pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n", |
142 | e->name, e->blocksize, e->numblocks); | 155 | e->name, e->blocksize, e->numblocks); |
143 | 156 | ||
157 | /* Prepare platform device, but don't register it yet. It's too early, | ||
158 | * malloc (required by device_private_init) is not available yet. */ | ||
159 | ssb_sflash_dev.resource[0].end = ssb_sflash_dev.resource[0].start + | ||
160 | sflash->size; | ||
161 | ssb_sflash_dev.dev.platform_data = sflash; | ||
162 | |||
144 | pr_err("Serial flash support is not implemented yet!\n"); | 163 | pr_err("Serial flash support is not implemented yet!\n"); |
145 | 164 | ||
146 | return -ENOTSUPP; | 165 | return -ENOTSUPP; |
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 812775a4bfb6..e55ddf7cd7c2 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c | |||
@@ -553,6 +553,14 @@ static int ssb_devices_register(struct ssb_bus *bus) | |||
553 | } | 553 | } |
554 | #endif | 554 | #endif |
555 | 555 | ||
556 | #ifdef CONFIG_SSB_SFLASH | ||
557 | if (bus->mipscore.sflash.present) { | ||
558 | err = platform_device_register(&ssb_sflash_dev); | ||
559 | if (err) | ||
560 | pr_err("Error registering serial flash\n"); | ||
561 | } | ||
562 | #endif | ||
563 | |||
556 | return 0; | 564 | return 0; |
557 | error: | 565 | error: |
558 | /* Unwind the already registered devices. */ | 566 | /* Unwind the already registered devices. */ |
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h index 4671f17f09af..eb507a50a564 100644 --- a/drivers/ssb/ssb_private.h +++ b/drivers/ssb/ssb_private.h | |||
@@ -243,6 +243,10 @@ static inline int ssb_sflash_init(struct ssb_chipcommon *cc) | |||
243 | extern struct platform_device ssb_pflash_dev; | 243 | extern struct platform_device ssb_pflash_dev; |
244 | #endif | 244 | #endif |
245 | 245 | ||
246 | #ifdef CONFIG_SSB_SFLASH | ||
247 | extern struct platform_device ssb_sflash_dev; | ||
248 | #endif | ||
249 | |||
246 | #ifdef CONFIG_SSB_DRIVER_EXTIF | 250 | #ifdef CONFIG_SSB_DRIVER_EXTIF |
247 | extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); | 251 | extern u32 ssb_extif_watchdog_timer_set_wdt(struct bcm47xx_wdt *wdt, u32 ticks); |
248 | extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); | 252 | extern u32 ssb_extif_watchdog_timer_set_ms(struct bcm47xx_wdt *wdt, u32 ms); |