summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2015-08-25 22:04:53 +0000
committerJonas Gorski <jogo@openwrt.org>2015-08-25 22:04:53 +0000
commit77a70a071619c12b71990180f3440dfdcd5962bd (patch)
treeee8f61919c1c952ef08ab11d5ca58e7767e5abf1 /target/linux
parent7a68c31a819ee640e529b629f1457ab0b87add6b (diff)
downloadmtk-20170518-77a70a071619c12b71990180f3440dfdcd5962bd.zip
mtk-20170518-77a70a071619c12b71990180f3440dfdcd5962bd.tar.gz
mtk-20170518-77a70a071619c12b71990180f3440dfdcd5962bd.tar.bz2
brcm63xx: enable dual rx/tx spi support for hsspi
should improve flash access times. Should be harmless to gnerally enable regardless if a flash supporting dual reads is attached. In doubt, spi-nor will just fall back to serial reads. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 46725
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/brcm63xx/patches-4.1/010-4.3-01-spi-bcm63xx-hsspi-add-support-for-dual-spi-read-writ.patch68
-rw-r--r--target/linux/brcm63xx/patches-4.1/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch8
-rw-r--r--target/linux/brcm63xx/patches-4.1/415-MIPS-BCM63XX-export-the-attached-flash-type.patch2
3 files changed, 74 insertions, 4 deletions
diff --git a/target/linux/brcm63xx/patches-4.1/010-4.3-01-spi-bcm63xx-hsspi-add-support-for-dual-spi-read-writ.patch b/target/linux/brcm63xx/patches-4.1/010-4.3-01-spi-bcm63xx-hsspi-add-support-for-dual-spi-read-writ.patch
new file mode 100644
index 0000000..1be40eb
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.1/010-4.3-01-spi-bcm63xx-hsspi-add-support-for-dual-spi-read-writ.patch
@@ -0,0 +1,68 @@
+From 61dc388f577b6f984797949f32c30021d9ea73dc Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Sun, 23 Aug 2015 12:16:02 +0200
+Subject: [PATCH V2] spi/bcm63xx-hsspi: add support for dual spi read/write
+
+Add support for dual read/writes on spi-bcm63xx-hsspi. This has been
+tested with a s25fl129p1 dual read capable spi flash, with a nice speed
+improvement:
+
+serial read:
+
+root@OpenWrt:/# time dd if=/dev/mtd4 of=/dev/null bs=8192
+2032+0 records in
+2032+0 records out
+real 0m 4.39s
+user 0m 0.00s
+sys 0m 1.55s
+
+dual read:
+
+root@OpenWrt:/# time dd if=/dev/mtd4 of=/dev/null bs=8192
+2032+0 records in
+2032+0 records out
+real 0m 3.09s
+user 0m 0.00s
+sys 0m 1.56s
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ drivers/spi/spi-bcm63xx-hsspi.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+--- a/drivers/spi/spi-bcm63xx-hsspi.c
++++ b/drivers/spi/spi-bcm63xx-hsspi.c
+@@ -76,6 +76,7 @@
+ #define HSSPI_FIFO_REG(x) (0x200 + (x) * 0x200)
+
+
++#define HSSPI_OP_MULTIBIT BIT(11)
+ #define HSSPI_OP_CODE_SHIFT 13
+ #define HSSPI_OP_SLEEP (0 << HSSPI_OP_CODE_SHIFT)
+ #define HSSPI_OP_READ_WRITE (1 << HSSPI_OP_CODE_SHIFT)
+@@ -171,9 +172,12 @@ static int bcm63xx_hsspi_do_txrx(struct
+ if (opcode != HSSPI_OP_READ)
+ step_size -= HSSPI_OPCODE_LEN;
+
+- __raw_writel(0 << MODE_CTRL_PREPENDBYTE_CNT_SHIFT |
+- 2 << MODE_CTRL_MULTIDATA_WR_STRT_SHIFT |
+- 2 << MODE_CTRL_MULTIDATA_RD_STRT_SHIFT | 0xff,
++ if ((opcode == HSSPI_OP_READ && t->rx_nbits == SPI_NBITS_DUAL) ||
++ (opcode == HSSPI_OP_WRITE && t->tx_nbits == SPI_NBITS_DUAL))
++ opcode |= HSSPI_OP_MULTIBIT;
++
++ __raw_writel(1 << MODE_CTRL_MULTIDATA_WR_SIZE_SHIFT |
++ 1 << MODE_CTRL_MULTIDATA_RD_SIZE_SHIFT | 0xff,
+ bs->regs + HSSPI_PROFILE_MODE_CTRL_REG(chip_select));
+
+ while (pending > 0) {
+@@ -374,7 +378,8 @@ static int bcm63xx_hsspi_probe(struct pl
+ master->num_chipselect = 8;
+ master->setup = bcm63xx_hsspi_setup;
+ master->transfer_one_message = bcm63xx_hsspi_transfer_one;
+- master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
++ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH |
++ SPI_RX_DUAL | SPI_TX_DUAL;
+ master->bits_per_word_mask = SPI_BPW_MASK(8);
+ master->auto_runtime_pm = true;
+
diff --git a/target/linux/brcm63xx/patches-4.1/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch b/target/linux/brcm63xx/patches-4.1/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch
index 3a09563..0c317cb 100644
--- a/target/linux/brcm63xx/patches-4.1/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch
+++ b/target/linux/brcm63xx/patches-4.1/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch
@@ -5,7 +5,7 @@ Subject: [PATCH 29/60] MIPS: BCM63XX: Register SPI flash if present
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
- arch/mips/bcm63xx/dev-flash.c | 33 +++++++++++++++++++-
+ arch/mips/bcm63xx/dev-flash.c | 35 +++++++++++++++++++-
arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 +
2 files changed, 33 insertions(+), 2 deletions(-)
@@ -95,15 +95,17 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
if (val & STRAPBUS_63268_BOOT_SEL_SERIAL)
return BCM63XX_FLASH_TYPE_SERIAL;
else
-@@ -195,8 +232,15 @@ int __init bcm63xx_flash_register(void)
+@@ -195,8 +232,17 @@ int __init bcm63xx_flash_register(void)
return platform_device_register(&mtd_dev);
case BCM63XX_FLASH_TYPE_SERIAL:
- pr_warn("unsupported serial flash detected\n");
- return -ENODEV;
+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() ||
-+ BCMCPU_IS_63268())
++ BCMCPU_IS_63268()) {
+ bcm63xx_spi_flash_info[0].bus_num = 1;
++ bcm63xx_spi_flash_info[0].mode = SPI_RX_DUAL;
++ }
+
+ if (BCMCPU_IS_6358() || BCMCPU_IS_6368())
+ bcm63xx_flash_data.max_transfer_len = SPI_6358_MSG_DATA_SIZE;
diff --git a/target/linux/brcm63xx/patches-4.1/415-MIPS-BCM63XX-export-the-attached-flash-type.patch b/target/linux/brcm63xx/patches-4.1/415-MIPS-BCM63XX-export-the-attached-flash-type.patch
index 44763bb..d874059 100644
--- a/target/linux/brcm63xx/patches-4.1/415-MIPS-BCM63XX-export-the-attached-flash-type.patch
+++ b/target/linux/brcm63xx/patches-4.1/415-MIPS-BCM63XX-export-the-attached-flash-type.patch
@@ -11,7 +11,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
--- a/arch/mips/bcm63xx/dev-flash.c
+++ b/arch/mips/bcm63xx/dev-flash.c
-@@ -250,3 +250,8 @@ int __init bcm63xx_flash_register(void)
+@@ -252,3 +252,8 @@ int __init bcm63xx_flash_register(void)
return -ENODEV;
}
}