diff options
author | John W. Linville <linville@tuxdriver.com> | 2013-06-21 15:42:30 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-21 15:42:30 -0400 |
commit | 7d2a47aab2a511c87a96238977e04e6378969d45 (patch) | |
tree | e3765af6d4b292d8f3c013a5962324eab683a931 /drivers/ssb | |
parent | fedaf4ffc224a194e2d13a3ec2abe5df0bc94258 (diff) | |
parent | b887664d882ee4f6a67e0bf05e5f141d32fcc067 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Conflicts:
net/wireless/nl80211.c
Diffstat (limited to 'drivers/ssb')
-rw-r--r-- | drivers/ssb/driver_chipcommon_sflash.c | 34 | ||||
-rw-r--r-- | drivers/ssb/main.c | 8 | ||||
-rw-r--r-- | drivers/ssb/ssb_private.h | 4 |
3 files changed, 42 insertions, 4 deletions
diff --git a/drivers/ssb/driver_chipcommon_sflash.c b/drivers/ssb/driver_chipcommon_sflash.c index 720665ca2bb1..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; |
@@ -16,7 +29,7 @@ struct ssb_sflash_tbl_e { | |||
16 | u16 numblocks; | 29 | u16 numblocks; |
17 | }; | 30 | }; |
18 | 31 | ||
19 | static struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = { | 32 | static const struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = { |
20 | { "M25P20", 0x11, 0x10000, 4, }, | 33 | { "M25P20", 0x11, 0x10000, 4, }, |
21 | { "M25P40", 0x12, 0x10000, 8, }, | 34 | { "M25P40", 0x12, 0x10000, 8, }, |
22 | 35 | ||
@@ -27,7 +40,7 @@ static struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = { | |||
27 | { 0 }, | 40 | { 0 }, |
28 | }; | 41 | }; |
29 | 42 | ||
30 | static struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = { | 43 | static const struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = { |
31 | { "SST25WF512", 1, 0x1000, 16, }, | 44 | { "SST25WF512", 1, 0x1000, 16, }, |
32 | { "SST25VF512", 0x48, 0x1000, 16, }, | 45 | { "SST25VF512", 0x48, 0x1000, 16, }, |
33 | { "SST25WF010", 2, 0x1000, 32, }, | 46 | { "SST25WF010", 2, 0x1000, 32, }, |
@@ -45,7 +58,7 @@ static struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = { | |||
45 | { 0 }, | 58 | { 0 }, |
46 | }; | 59 | }; |
47 | 60 | ||
48 | static struct ssb_sflash_tbl_e ssb_sflash_at_tbl[] = { | 61 | static const struct ssb_sflash_tbl_e ssb_sflash_at_tbl[] = { |
49 | { "AT45DB011", 0xc, 256, 512, }, | 62 | { "AT45DB011", 0xc, 256, 512, }, |
50 | { "AT45DB021", 0x14, 256, 1024, }, | 63 | { "AT45DB021", 0x14, 256, 1024, }, |
51 | { "AT45DB041", 0x1c, 256, 2048, }, | 64 | { "AT45DB041", 0x1c, 256, 2048, }, |
@@ -73,7 +86,8 @@ static void ssb_sflash_cmd(struct ssb_chipcommon *cc, u32 opcode) | |||
73 | /* Initialize serial flash access */ | 86 | /* Initialize serial flash access */ |
74 | int ssb_sflash_init(struct ssb_chipcommon *cc) | 87 | int ssb_sflash_init(struct ssb_chipcommon *cc) |
75 | { | 88 | { |
76 | struct ssb_sflash_tbl_e *e; | 89 | struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash; |
90 | const struct ssb_sflash_tbl_e *e; | ||
77 | u32 id, id2; | 91 | u32 id, id2; |
78 | 92 | ||
79 | switch (cc->capabilities & SSB_CHIPCO_CAP_FLASHT) { | 93 | switch (cc->capabilities & SSB_CHIPCO_CAP_FLASHT) { |
@@ -131,9 +145,21 @@ int ssb_sflash_init(struct ssb_chipcommon *cc) | |||
131 | return -ENOTSUPP; | 145 | return -ENOTSUPP; |
132 | } | 146 | } |
133 | 147 | ||
148 | sflash->window = SSB_FLASH2; | ||
149 | sflash->blocksize = e->blocksize; | ||
150 | sflash->numblocks = e->numblocks; | ||
151 | sflash->size = sflash->blocksize * sflash->numblocks; | ||
152 | sflash->present = true; | ||
153 | |||
134 | 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", |
135 | e->name, e->blocksize, e->numblocks); | 155 | e->name, e->blocksize, e->numblocks); |
136 | 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 | |||
137 | pr_err("Serial flash support is not implemented yet!\n"); | 163 | pr_err("Serial flash support is not implemented yet!\n"); |
138 | 164 | ||
139 | 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); |