projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ar71xx: add defines for the AR934X GMAC interface
[openwrt.git]
/
target
/
linux
/
brcm47xx
/
patches-3.0
/
0013-bcma-add-serial-flash-support-to-bcma.patch
diff --git
a/target/linux/brcm47xx/patches-3.0/0013-bcma-add-serial-flash-support-to-bcma.patch
b/target/linux/brcm47xx/patches-3.0/0013-bcma-add-serial-flash-support-to-bcma.patch
index
bcaf85b
..
14e5a3b
100644
(file)
--- a/
target/linux/brcm47xx/patches-3.0/0013-bcma-add-serial-flash-support-to-bcma.patch
+++ b/
target/linux/brcm47xx/patches-3.0/0013-bcma-add-serial-flash-support-to-bcma.patch
@@
-1,7
+1,7
@@
-From
b5be6e3037650ff5615cb869f1972dea5a49bcb6
Mon Sep 17 00:00:00 2001
+From
a62940e988526c881966a8c72cc28c95fca89f3c
Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 17 Jul 2011 14:53:07 +0200
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 17 Jul 2011 14:53:07 +0200
-Subject: [PATCH 13/2
2
] bcma: add serial flash support to bcma
+Subject: [PATCH 13/2
6
] bcma: add serial flash support to bcma
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
@@
-9,10
+9,10
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
drivers/bcma/Kconfig | 5 +
drivers/bcma/Makefile | 1 +
drivers/bcma/bcma_private.h | 5 +
drivers/bcma/Kconfig | 5 +
drivers/bcma/Makefile | 1 +
drivers/bcma/bcma_private.h | 5 +
- drivers/bcma/driver_chipcommon_sflash.c | 55
4
+++++++++++++++++++++++++++
+ drivers/bcma/driver_chipcommon_sflash.c | 55
5
+++++++++++++++++++++++++++
drivers/bcma/driver_mips.c | 8 +-
include/linux/bcma/bcma_driver_chipcommon.h | 24 ++
drivers/bcma/driver_mips.c | 8 +-
include/linux/bcma/bcma_driver_chipcommon.h | 24 ++
- 6 files changed, 59
6
insertions(+), 1 deletions(-)
+ 6 files changed, 59
7
insertions(+), 1 deletions(-)
create mode 100644 drivers/bcma/driver_chipcommon_sflash.c
--- a/drivers/bcma/Kconfig
create mode 100644 drivers/bcma/driver_chipcommon_sflash.c
--- a/drivers/bcma/Kconfig
@@
-54,7
+54,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
extern int __init bcma_host_pci_init(void);
--- /dev/null
+++ b/drivers/bcma/driver_chipcommon_sflash.c
extern int __init bcma_host_pci_init(void);
--- /dev/null
+++ b/drivers/bcma/driver_chipcommon_sflash.c
-@@ -0,0 +1,55
4
@@
+@@ -0,0 +1,55
5
@@
+/*
+ * Broadcom SiliconBackplane chipcommon serial flash interface
+ *
+/*
+ * Broadcom SiliconBackplane chipcommon serial flash interface
+ *
@@
-78,8
+78,8
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+{
+ bcma_cc_write32(cc, BCMA_CC_FLASHCTL,
+ BCMA_CC_FLASHCTL_START | opcode);
+{
+ bcma_cc_write32(cc, BCMA_CC_FLASHCTL,
+ BCMA_CC_FLASHCTL_START | opcode);
-+ while (bcma_cc_read32(cc, BCMA_CC_FLASHCTL)
-+
& BCMA_CC_FLASHCTL_BUSY)
;
++ while (bcma_cc_read32(cc, BCMA_CC_FLASHCTL)
& BCMA_CC_FLASHCTL_BUSY)
++ ;
+}
+
+
+}
+
+
@@
-95,7
+95,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+{
+ u32 id, id2;
+
+{
+ u32 id, id2;
+
-+ memset(&cc->
flash.
sflash, 0, sizeof(struct bcma_sflash));
++ memset(&cc->sflash, 0, sizeof(struct bcma_sflash));
+
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
@@
-104,35
+104,35
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 0);
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
+ id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 0);
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
+ id = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
-+ cc->
flash.
sflash.blocksize = 64 * 1024;
++ cc->sflash.blocksize = 64 * 1024;
+ switch (id) {
+ case 0x11:
+ /* ST M25P20 2 Mbit Serial Flash */
+ switch (id) {
+ case 0x11:
+ /* ST M25P20 2 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 4;
++ cc->sflash.numblocks = 4;
+ break;
+ case 0x12:
+ /* ST M25P40 4 Mbit Serial Flash */
+ break;
+ case 0x12:
+ /* ST M25P40 4 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 8;
++ cc->sflash.numblocks = 8;
+ break;
+ case 0x13:
+ /* ST M25P80 8 Mbit Serial Flash */
+ break;
+ case 0x13:
+ /* ST M25P80 8 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 16;
++ cc->sflash.numblocks = 16;
+ break;
+ case 0x14:
+ /* ST M25P16 16 Mbit Serial Flash */
+ break;
+ case 0x14:
+ /* ST M25P16 16 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 32;
++ cc->sflash.numblocks = 32;
+ break;
+ case 0x15:
+ /* ST M25P32 32 Mbit Serial Flash */
+ break;
+ case 0x15:
+ /* ST M25P32 32 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 64;
++ cc->sflash.numblocks = 64;
+ break;
+ case 0x16:
+ /* ST M25P64 64 Mbit Serial Flash */
+ break;
+ case 0x16:
+ /* ST M25P64 64 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 128;
++ cc->sflash.numblocks = 128;
+ break;
+ case 0x17:
+ /* ST M25FL128 128 Mbit Serial Flash */
+ break;
+ case 0x17:
+ /* ST M25FL128 128 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 256;
++ cc->sflash.numblocks = 256;
+ break;
+ case 0xbf:
+ /* All of the following flashes are SST with
+ break;
+ case 0xbf:
+ /* All of the following flashes are SST with
@@
-140,7
+140,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ * We'll have to revamp the way we identify them
+ * since RES is not eough to disambiguate them.
+ */
+ * We'll have to revamp the way we identify them
+ * since RES is not eough to disambiguate them.
+ */
-+ cc->
flash.
sflash.blocksize = 4 * 1024;
++ cc->sflash.blocksize = 4 * 1024;
+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 1);
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
+ id2 = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
+ bcma_cc_write32(cc, BCMA_CC_FLASHADDR, 1);
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_RES);
+ id2 = bcma_cc_read32(cc, BCMA_CC_FLASHDATA);
@@
-149,19
+149,19
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ /* SST25WF512 512 Kbit Serial Flash */
+ case 0x48:
+ /* SST25VF512 512 Kbit Serial Flash */
+ /* SST25WF512 512 Kbit Serial Flash */
+ case 0x48:
+ /* SST25VF512 512 Kbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 16;
++ cc->sflash.numblocks = 16;
+ break;
+ case 2:
+ /* SST25WF010 1 Mbit Serial Flash */
+ case 0x49:
+ /* SST25VF010 1 Mbit Serial Flash */
+ break;
+ case 2:
+ /* SST25WF010 1 Mbit Serial Flash */
+ case 0x49:
+ /* SST25VF010 1 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 32;
++ cc->sflash.numblocks = 32;
+ break;
+ case 3:
+ /* SST25WF020 2 Mbit Serial Flash */
+ case 0x43:
+ /* SST25VF020 2 Mbit Serial Flash */
+ break;
+ case 3:
+ /* SST25WF020 2 Mbit Serial Flash */
+ case 0x43:
+ /* SST25VF020 2 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 64;
++ cc->sflash.numblocks = 64;
+ break;
+ case 4:
+ /* SST25WF040 4 Mbit Serial Flash */
+ break;
+ case 4:
+ /* SST25WF040 4 Mbit Serial Flash */
@@
-169,25
+169,25
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ /* SST25VF040 4 Mbit Serial Flash */
+ case 0x8d:
+ /* SST25VF040B 4 Mbit Serial Flash */
+ /* SST25VF040 4 Mbit Serial Flash */
+ case 0x8d:
+ /* SST25VF040B 4 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 128;
++ cc->sflash.numblocks = 128;
+ break;
+ case 5:
+ /* SST25WF080 8 Mbit Serial Flash */
+ case 0x8e:
+ /* SST25VF080B 8 Mbit Serial Flash */
+ break;
+ case 5:
+ /* SST25WF080 8 Mbit Serial Flash */
+ case 0x8e:
+ /* SST25VF080B 8 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 256;
++ cc->sflash.numblocks = 256;
+ break;
+ case 0x41:
+ /* SST25VF016 16 Mbit Serial Flash */
+ break;
+ case 0x41:
+ /* SST25VF016 16 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 512;
++ cc->sflash.numblocks = 512;
+ break;
+ case 0x4a:
+ /* SST25VF032 32 Mbit Serial Flash */
+ break;
+ case 0x4a:
+ /* SST25VF032 32 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 1024;
++ cc->sflash.numblocks = 1024;
+ break;
+ case 0x4b:
+ /* SST25VF064 64 Mbit Serial Flash */
+ break;
+ case 0x4b:
+ /* SST25VF064 64 Mbit Serial Flash */
-+ cc->
flash.
sflash.numblocks = 2048;
++ cc->sflash.numblocks = 2048;
+ break;
+ }
+ break;
+ break;
+ }
+ break;
@@
-201,46
+201,46
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ switch (id) {
+ case 0xc:
+ /* Atmel AT45DB011 1Mbit Serial Flash */
+ switch (id) {
+ case 0xc:
+ /* Atmel AT45DB011 1Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 256;
-+ cc->
flash.
sflash.numblocks = 512;
++ cc->sflash.blocksize = 256;
++ cc->sflash.numblocks = 512;
+ break;
+ case 0x14:
+ /* Atmel AT45DB021 2Mbit Serial Flash */
+ break;
+ case 0x14:
+ /* Atmel AT45DB021 2Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 256;
-+ cc->
flash.
sflash.numblocks = 1024;
++ cc->sflash.blocksize = 256;
++ cc->sflash.numblocks = 1024;
+ break;
+ case 0x1c:
+ /* Atmel AT45DB041 4Mbit Serial Flash */
+ break;
+ case 0x1c:
+ /* Atmel AT45DB041 4Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 256;
-+ cc->
flash.
sflash.numblocks = 2048;
++ cc->sflash.blocksize = 256;
++ cc->sflash.numblocks = 2048;
+ break;
+ case 0x24:
+ /* Atmel AT45DB081 8Mbit Serial Flash */
+ break;
+ case 0x24:
+ /* Atmel AT45DB081 8Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 256;
-+ cc->
flash.
sflash.numblocks = 4096;
++ cc->sflash.blocksize = 256;
++ cc->sflash.numblocks = 4096;
+ break;
+ case 0x2c:
+ /* Atmel AT45DB161 16Mbit Serial Flash */
+ break;
+ case 0x2c:
+ /* Atmel AT45DB161 16Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 512;
-+ cc->
flash.
sflash.numblocks = 4096;
++ cc->sflash.blocksize = 512;
++ cc->sflash.numblocks = 4096;
+ break;
+ case 0x34:
+ /* Atmel AT45DB321 32Mbit Serial Flash */
+ break;
+ case 0x34:
+ /* Atmel AT45DB321 32Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 512;
-+ cc->
flash.
sflash.numblocks = 8192;
++ cc->sflash.blocksize = 512;
++ cc->sflash.numblocks = 8192;
+ break;
+ case 0x3c:
+ /* Atmel AT45DB642 64Mbit Serial Flash */
+ break;
+ case 0x3c:
+ /* Atmel AT45DB642 64Mbit Serial Flash */
-+ cc->
flash.
sflash.blocksize = 1024;
-+ cc->
flash.
sflash.numblocks = 8192;
++ cc->sflash.blocksize = 1024;
++ cc->sflash.numblocks = 8192;
+ break;
+ }
+ break;
+ }
+
+ break;
+ }
+ break;
+ }
+
-+ cc->
flash.sflash.size = cc->flash.sflash.blocksize * cc->flash.
sflash.numblocks;
++ cc->
sflash.size = cc->sflash.blocksize * cc->
sflash.numblocks;
+
+
-+ return cc->
flash.
sflash.size ? 0 : -ENODEV;
++ return cc->sflash.size ? 0 : -ENODEV;
+}
+
+/* Read len bytes starting at offset into buf. Returns number of bytes read. */
+}
+
+/* Read len bytes starting at offset into buf. Returns number of bytes read. */
@@
-253,7
+253,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ if (!len)
+ return 0;
+
+ if (!len)
+ return 0;
+
-+ if ((offset + len) > cc->
flash.
sflash.size)
++ if ((offset + len) > cc->sflash.size)
+ return -EINVAL;
+
+ if ((len >= 4) && (offset & 3))
+ return -EINVAL;
+
+ if ((len >= 4) && (offset & 3))
@@
-293,7
+293,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+/* Poll for command completion. Returns zero when complete. */
+int bcma_sflash_poll(struct bcma_drv_cc *cc, u32 offset)
+{
+/* Poll for command completion. Returns zero when complete. */
+int bcma_sflash_poll(struct bcma_drv_cc *cc, u32 offset)
+{
-+ if (offset >= cc->
flash.
sflash.size)
++ if (offset >= cc->sflash.size)
+ return -22;
+
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ return -22;
+
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
@@
-407,7
+407,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+static int sflash_at_write(struct bcma_drv_cc *cc, u32 offset, u32 len,
+ const u8 *buf)
+{
+static int sflash_at_write(struct bcma_drv_cc *cc, u32 offset, u32 len,
+ const u8 *buf)
+{
-+ struct bcma_sflash *sfl = &cc->
flash.
sflash;
++ struct bcma_sflash *sfl = &cc->sflash;
+ u32 page, byte, mask;
+ int ret = 0;
+ mask = sfl->blocksize - 1;
+ u32 page, byte, mask;
+ int ret = 0;
+ mask = sfl->blocksize - 1;
@@
-450,10
+450,10
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ if (!len)
+ return 0;
+
+ if (!len)
+ return 0;
+
-+ if ((offset + len) > cc->
flash.
sflash.size)
++ if ((offset + len) > cc->sflash.size)
+ return -EINVAL;
+
+ return -EINVAL;
+
-+ sfl = &cc->
flash.
sflash;
++ sfl = &cc->sflash;
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+ do {
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+ do {
@@
-481,10
+481,10
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+{
+ struct bcma_sflash *sfl;
+
+{
+ struct bcma_sflash *sfl;
+
-+ if (offset >= cc->
flash.
sflash.size)
++ if (offset >= cc->sflash.size)
+ return -EINVAL;
+
+ return -EINVAL;
+
-+ sfl = &cc->
flash.
sflash;
++ sfl = &cc->sflash;
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_WREN);
+ switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
+ case BCMA_CC_FLASHT_STSER:
+ bcma_sflash_cmd(cc, BCMA_CC_FLASHCTL_ST_WREN);
@@
-521,7
+521,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ if (len <= 0)
+ return 0;
+
+ if (len <= 0)
+ return 0;
+
-+ sfl = &cc->
flash.
sflash;
++ sfl = &cc->sflash;
+ if ((offset + len) > sfl->size)
+ return -EINVAL;
+
+ if ((offset + len) > sfl->size)
+ return -EINVAL;
+
@@
-592,7
+592,8
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ goto done;
+ }
+
+ goto done;
+ }
+
-+ while (bcma_sflash_poll(cc, cur_offset));
++ while (bcma_sflash_poll(cc, cur_offset))
++ ;
+
+ cur_offset += bytes;
+ cur_length -= bytes;
+
+ cur_offset += bytes;
+ cur_length -= bytes;
@@
-636,7
+637,7
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
};
struct bcma_pflash {
};
struct bcma_pflash {
-@@ -366,
8 +367,19
@@ struct bcma_pflash {
+@@ -366,
6 +367,14
@@ struct bcma_pflash {
u32 window_size;
};
u32 window_size;
};
@@
-648,15
+649,20
@@
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+};
+#endif /* CONFIG_BCMA_SFLASH */
+
+};
+#endif /* CONFIG_BCMA_SFLASH */
+
- union bcma_flash {
- struct bcma_pflash pflash;
+ struct bcma_serial_port {
+ void *regs;
+ unsigned long clockspeed;
+@@ -388,6 +397,9 @@ struct bcma_drv_cc {
+ enum bcma_flash_type flash_type;
+ union {
+ struct bcma_pflash pflash;
+#ifdef CONFIG_BCMA_SFLASH
+#ifdef CONFIG_BCMA_SFLASH
-+ struct bcma_sflash sflash;
++
struct bcma_sflash sflash;
+#endif /* CONFIG_BCMA_SFLASH */
+#endif /* CONFIG_BCMA_SFLASH */
- };
+
};
- struct bcma_serial_port {
-@@ -43
3,4 +445
,16 @@ u32 bcma_chipco_gpio_polarity(struct bcm
+ int nr_serial_ports;
+@@ -43
1,4 +443
,16 @@ u32 bcma_chipco_gpio_polarity(struct bcm
/* PMU support */
extern void bcma_pmu_init(struct bcma_drv_cc *cc);
/* PMU support */
extern void bcma_pmu_init(struct bcma_drv_cc *cc);
This page took
0.042496 seconds
and
4
git commands to generate.