aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch87
1 files changed, 26 insertions, 61 deletions
diff --git a/target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch b/target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch
index 1148a489db..dcb70e87b9 100644
--- a/target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch
+++ b/target/linux/brcm47xx/patches-3.8/060-ssb-add-serial-flash-driver.patch
@@ -11,7 +11,7 @@
# Assumption: We are on embedded, if we compile the MIPS core.
--- a/drivers/ssb/driver_chipcommon_sflash.c
+++ b/drivers/ssb/driver_chipcommon_sflash.c
-@@ -1,14 +1,35 @@
+@@ -1,14 +1,22 @@
/*
* Sonics Silicon Backplane
* ChipCommon serial flash interface
@@ -31,50 +31,19 @@
+#define NUM_RETRIES 3
+
-+static struct resource ssb_sflash_resource = {
-+ .name = "ssb_sflash",
-+ .start = SSB_FLASH2,
-+ .end = 0,
-+ .flags = IORESOURCE_MEM | IORESOURCE_READONLY,
-+};
-+
-+struct platform_device ssb_sflash_dev = {
-+ .name = "bcm47xx-sflash",
-+ .resource = &ssb_sflash_resource,
-+ .num_resources = 1,
-+};
-+
- struct ssb_sflash_tbl_e {
- char *name;
- u32 id;
-@@ -16,7 +37,7 @@ struct ssb_sflash_tbl_e {
- u16 numblocks;
+ static struct resource ssb_sflash_resource = {
+ .name = "ssb_sflash",
+ .start = SSB_FLASH2,
+@@ -17,7 +25,7 @@ static struct resource ssb_sflash_resour
};
--static struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = {
-+static const struct ssb_sflash_tbl_e ssb_sflash_st_tbl[] = {
- { "M25P20", 0x11, 0x10000, 4, },
- { "M25P40", 0x12, 0x10000, 8, },
-
-@@ -27,7 +48,7 @@ static struct ssb_sflash_tbl_e ssb_sflas
- { 0 },
- };
-
--static struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = {
-+static const struct ssb_sflash_tbl_e ssb_sflash_sst_tbl[] = {
- { "SST25WF512", 1, 0x1000, 16, },
- { "SST25VF512", 0x48, 0x1000, 16, },
- { "SST25WF010", 2, 0x1000, 32, },
-@@ -45,7 +66,7 @@ static struct ssb_sflash_tbl_e ssb_sflas
- { 0 },
+ struct platform_device ssb_sflash_dev = {
+- .name = "ssb_sflash",
++ .name = "bcm47xx-sflash",
+ .resource = &ssb_sflash_resource,
+ .num_resources = 1,
};
-
--static struct ssb_sflash_tbl_e ssb_sflash_at_tbl[] = {
-+static const struct ssb_sflash_tbl_e ssb_sflash_at_tbl[] = {
- { "AT45DB011", 0xc, 256, 512, },
- { "AT45DB021", 0x14, 256, 1024, },
- { "AT45DB041", 0x1c, 256, 2048, },
-@@ -70,10 +91,186 @@ static void ssb_sflash_cmd(struct ssb_ch
+@@ -83,10 +91,185 @@ static void ssb_sflash_cmd(struct ssb_ch
pr_err("SFLASH control command failed (timeout)!\n");
}
@@ -256,25 +225,18 @@
/* Initialize serial flash access */
int ssb_sflash_init(struct ssb_chipcommon *cc)
{
-- struct ssb_sflash_tbl_e *e;
+- struct ssb_sflash *sflash = &cc->dev->bus->mipscore.sflash;
+ struct bcm47xxsflash *sflash = &cc->sflash;
-+ const struct ssb_sflash_tbl_e *e;
+ const struct ssb_sflash_tbl_e *e;
u32 id, id2;
- switch (cc->capabilities & SSB_CHIPCO_CAP_FLASHT) {
-@@ -131,10 +328,26 @@ int ssb_sflash_init(struct ssb_chipcommo
- return -ENOTSUPP;
- }
-
+@@ -150,17 +333,21 @@ int ssb_sflash_init(struct ssb_chipcommo
+ sflash->numblocks = e->numblocks;
+ sflash->size = sflash->blocksize * sflash->numblocks;
+ sflash->present = true;
+-
- pr_info("Found %s serial flash (blocksize: 0x%X, blocks: %d)\n",
- e->name, e->blocksize, e->numblocks);
--
-- pr_err("Serial flash support is not implemented yet!\n");
-+ sflash->window = SSB_FLASH2;
-+ sflash->blocksize = e->blocksize;
-+ sflash->numblocks = e->numblocks;
-+ sflash->size = sflash->blocksize * sflash->numblocks;
-+ sflash->present = true;
+ sflash->poll = ssb_sflash_poll;
+ sflash->write = ssb_sflash_write;
+ sflash->erase = ssb_sflash_erase;
@@ -284,13 +246,16 @@
+ pr_info("Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n",
+ e->name, sflash->size / 1024, sflash->blocksize,
+ sflash->numblocks);
-+
-+ /* Prepare platform device, but don't register it yet. It's too early,
-+ * malloc (required by device_private_init) is not available yet. */
-+ ssb_sflash_dev.resource[0].end = ssb_sflash_dev.resource[0].start +
+
+ /* Prepare platform device, but don't register it yet. It's too early,
+ * malloc (required by device_private_init) is not available yet. */
+ ssb_sflash_dev.resource[0].end = ssb_sflash_dev.resource[0].start +
+- sflash->size;
+ sflash->size;
-+ ssb_sflash_dev.dev.platform_data = sflash;
+ ssb_sflash_dev.dev.platform_data = sflash;
+- pr_err("Serial flash support is not implemented yet!\n");
+-
- return -ENOTSUPP;
+ return 0;
}