From 2052672908389b65ea68fe319d6a644f5f96ada9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 24 Apr 2016 19:20:10 +0000 Subject: [PATCH] CC: kernel: Support for new Archer C7 with gd25q128 chip Archer C7 V2.0 units from December 2015 onwards ( serials starting 215C ) have changed flash chips to the gd25q128 chip, this is supported in trunk but not presently in 15.05. I would like stable support for this version so I've back ported the required fix from trunk and removed a conflicting patch from bcm53xx I've tested the patch it and I'm able to install a build of 15.05.1 on a new Archer C7 device with this patch. Signed-off-by: John Marrett Signed-off-by: Hauke Mehrtens git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@49220 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-3.18/003-mtd-spi-nor-from-3.19.patch | 44 +++++++++++----------- .../patches-3.18/004-mtd-spi-nor-from-3.20.patch | 14 ++----- ...-mtd_GD25Q128B_support_backport_from_3.19.patch | 10 +++++ ...462-m25p80-mx-disable-software-protection.patch | 2 +- ...5p80-add-support-for-Winbond-W25X05-flash.patch | 2 +- ...-add-support-for-the-Macronix-MX25L512E-S.patch | 2 +- ...-add-support-for-the-ISSI-SI25CD512-SPI-f.patch | 2 +- 7 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch diff --git a/target/linux/bcm53xx/patches-3.18/003-mtd-spi-nor-from-3.19.patch b/target/linux/bcm53xx/patches-3.18/003-mtd-spi-nor-from-3.19.patch index e120973aa5..e7e84433ca 100644 --- a/target/linux/bcm53xx/patches-3.18/003-mtd-spi-nor-from-3.19.patch +++ b/target/linux/bcm53xx/patches-3.18/003-mtd-spi-nor-from-3.19.patch @@ -333,7 +333,7 @@ /* GigaDevice */ { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, -@@ -536,6 +564,7 @@ static const struct spi_device_id spi_no +@@ -537,6 +565,7 @@ static const struct spi_device_id spi_no { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, /* Micron */ @@ -341,7 +341,7 @@ { "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) }, { "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) }, { "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) }, -@@ -560,6 +589,7 @@ static const struct spi_device_id spi_no +@@ -561,6 +590,7 @@ static const struct spi_device_id spi_no { "s70fl01gs", INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) }, { "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) }, { "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) }, @@ -349,7 +349,7 @@ { "s25fl129p0", INFO(0x012018, 0x4d00, 256 * 1024, 64, 0) }, { "s25fl129p1", INFO(0x012018, 0x4d01, 64 * 1024, 256, 0) }, { "s25sl004a", INFO(0x010212, 0, 64 * 1024, 8, 0) }, -@@ -581,6 +611,7 @@ static const struct spi_device_id spi_no +@@ -582,6 +612,7 @@ static const struct spi_device_id spi_no { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, SECT_4K | SST_WRITE) }, { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, SECT_4K | SST_WRITE) }, { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, SECT_4K | SST_WRITE) }, @@ -357,7 +357,7 @@ /* ST Microelectronics -- newer production may have feature updates */ { "m25p05", INFO(0x202010, 0, 32 * 1024, 2, 0) }, -@@ -592,7 +623,6 @@ static const struct spi_device_id spi_no +@@ -593,7 +624,6 @@ static const struct spi_device_id spi_no { "m25p32", INFO(0x202016, 0, 64 * 1024, 64, 0) }, { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, @@ -365,7 +365,7 @@ { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, -@@ -648,32 +678,24 @@ static const struct spi_device_id spi_no +@@ -649,32 +679,24 @@ static const struct spi_device_id spi_no static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) { int tmp; @@ -404,7 +404,7 @@ return ERR_PTR(-ENODEV); } -@@ -708,11 +730,6 @@ static int sst_write(struct mtd_info *mt +@@ -709,11 +731,6 @@ static int sst_write(struct mtd_info *mt if (ret) return ret; @@ -416,7 +416,7 @@ write_enable(nor); nor->sst_write_second = false; -@@ -724,7 +741,7 @@ static int sst_write(struct mtd_info *mt +@@ -725,7 +742,7 @@ static int sst_write(struct mtd_info *mt /* write one byte. */ nor->write(nor, to, 1, retlen, buf); @@ -425,7 +425,7 @@ if (ret) goto time_out; } -@@ -736,7 +753,7 @@ static int sst_write(struct mtd_info *mt +@@ -737,7 +754,7 @@ static int sst_write(struct mtd_info *mt /* write two bytes. */ nor->write(nor, to, 2, retlen, buf + actual); @@ -434,7 +434,7 @@ if (ret) goto time_out; to += 2; -@@ -745,7 +762,7 @@ static int sst_write(struct mtd_info *mt +@@ -746,7 +763,7 @@ static int sst_write(struct mtd_info *mt nor->sst_write_second = false; write_disable(nor); @@ -443,7 +443,7 @@ if (ret) goto time_out; -@@ -756,7 +773,7 @@ static int sst_write(struct mtd_info *mt +@@ -757,7 +774,7 @@ static int sst_write(struct mtd_info *mt nor->program_opcode = SPINOR_OP_BP; nor->write(nor, to, 1, retlen, buf + actual); @@ -452,7 +452,7 @@ if (ret) goto time_out; write_disable(nor); -@@ -784,11 +801,6 @@ static int spi_nor_write(struct mtd_info +@@ -785,11 +802,6 @@ static int spi_nor_write(struct mtd_info if (ret) return ret; @@ -464,7 +464,7 @@ write_enable(nor); page_offset = to & (nor->page_size - 1); -@@ -807,16 +819,20 @@ static int spi_nor_write(struct mtd_info +@@ -808,16 +820,20 @@ static int spi_nor_write(struct mtd_info if (page_size > nor->page_size) page_size = nor->page_size; @@ -487,7 +487,7 @@ } static int macronix_quad_enable(struct spi_nor *nor) -@@ -829,7 +845,7 @@ static int macronix_quad_enable(struct s +@@ -830,7 +846,7 @@ static int macronix_quad_enable(struct s nor->cmd_buf[0] = val | SR_QUAD_EN_MX; nor->write_reg(nor, SPINOR_OP_WRSR, nor->cmd_buf, 1, 0); @@ -496,7 +496,7 @@ return 1; ret = read_sr(nor); -@@ -879,11 +895,11 @@ static int spansion_quad_enable(struct s +@@ -880,11 +896,11 @@ static int spansion_quad_enable(struct s return 0; } @@ -510,7 +510,7 @@ case CFI_MFR_MACRONIX: status = macronix_quad_enable(nor); if (status) { -@@ -909,11 +925,6 @@ static int spi_nor_check(struct spi_nor +@@ -910,11 +926,6 @@ static int spi_nor_check(struct spi_nor return -EINVAL; } @@ -522,7 +522,7 @@ return 0; } -@@ -931,16 +942,24 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -932,16 +943,24 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; @@ -551,7 +551,7 @@ if (IS_ERR(jid)) { return PTR_ERR(jid); } else if (jid != id) { -@@ -965,10 +984,10 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -966,10 +985,10 @@ int spi_nor_scan(struct spi_nor *nor, co * up with the software protection bits set */ @@ -566,7 +566,7 @@ write_enable(nor); write_sr(nor, 0); } -@@ -983,7 +1002,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -984,7 +1003,7 @@ int spi_nor_scan(struct spi_nor *nor, co mtd->_read = spi_nor_read; /* nor protection support for STmicro chips */ @@ -575,7 +575,7 @@ mtd->_lock = spi_nor_lock; mtd->_unlock = spi_nor_unlock; } -@@ -994,9 +1013,8 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -995,9 +1014,8 @@ int spi_nor_scan(struct spi_nor *nor, co else mtd->_write = spi_nor_write; @@ -587,7 +587,7 @@ #ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS /* prefer "small sector" erase if possible */ -@@ -1037,7 +1055,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1038,7 +1056,7 @@ int spi_nor_scan(struct spi_nor *nor, co /* Quad/Dual-read mode takes precedence over fast/normal */ if (mode == SPI_NOR_QUAD && info->flags & SPI_NOR_QUAD_READ) { @@ -596,7 +596,7 @@ if (ret) { dev_err(dev, "quad mode not supported\n"); return ret; -@@ -1073,7 +1091,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1074,7 +1092,7 @@ int spi_nor_scan(struct spi_nor *nor, co else if (mtd->size > 0x1000000) { /* enable 4-byte addressing if the device exceeds 16MiB */ nor->addr_width = 4; @@ -605,7 +605,7 @@ /* Dedicated 4-byte command set */ switch (nor->flash_read) { case SPI_NOR_QUAD: -@@ -1094,7 +1112,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -1095,7 +1113,7 @@ int spi_nor_scan(struct spi_nor *nor, co nor->erase_opcode = SPINOR_OP_SE_4B; mtd->erasesize = info->sector_size; } else diff --git a/target/linux/bcm53xx/patches-3.18/004-mtd-spi-nor-from-3.20.patch b/target/linux/bcm53xx/patches-3.18/004-mtd-spi-nor-from-3.20.patch index ab7b0bb573..1238785e47 100644 --- a/target/linux/bcm53xx/patches-3.18/004-mtd-spi-nor-from-3.20.patch +++ b/target/linux/bcm53xx/patches-3.18/004-mtd-spi-nor-from-3.20.patch @@ -1,14 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -538,6 +538,7 @@ static const struct spi_device_id spi_no - /* GigaDevice */ - { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, - { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, -+ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, - - /* Intel/Numonyx -- xxxs33b */ - { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, -@@ -564,14 +565,14 @@ static const struct spi_device_id spi_no +@@ -565,14 +565,14 @@ static const struct spi_device_id spi_no { "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) }, /* Micron */ @@ -31,7 +23,7 @@ /* PMC */ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, -@@ -895,6 +896,45 @@ static int spansion_quad_enable(struct s +@@ -896,6 +896,45 @@ static int spansion_quad_enable(struct s return 0; } @@ -77,7 +69,7 @@ static int set_quad_mode(struct spi_nor *nor, struct flash_info *info) { int status; -@@ -907,6 +947,13 @@ static int set_quad_mode(struct spi_nor +@@ -908,6 +947,13 @@ static int set_quad_mode(struct spi_nor return -EINVAL; } return status; diff --git a/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch b/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch new file mode 100644 index 0000000000..4d0403bfd8 --- /dev/null +++ b/target/linux/generic/patches-3.18/043-mtd_GD25Q128B_support_backport_from_3.19.patch @@ -0,0 +1,10 @@ +--- a/drivers/mtd/spi-nor/spi-nor.c ++++ b/drivers/mtd/spi-nor/spi-nor.c +@@ -510,6 +510,7 @@ static const struct spi_device_id spi_no + /* GigaDevice */ + { "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) }, + { "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) }, ++ { "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) }, + + /* Intel/Numonyx -- xxxs33b */ + { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, diff --git a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch index d7d7eeccc3..fef483a67d 100644 --- a/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch +++ b/target/linux/generic/patches-3.18/462-m25p80-mx-disable-software-protection.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -962,6 +962,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -963,6 +963,7 @@ int spi_nor_scan(struct spi_nor *nor, co if (JEDEC_MFR(info->jedec_id) == CFI_MFR_ATMEL || JEDEC_MFR(info->jedec_id) == CFI_MFR_INTEL || diff --git a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch b/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch index 6bf516c71b..dca6895c14 100644 --- a/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch +++ b/target/linux/generic/patches-3.18/472-mtd-m25p80-add-support-for-Winbond-W25X05-flash.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -616,6 +616,7 @@ static const struct spi_device_id spi_no +@@ -617,6 +617,7 @@ static const struct spi_device_id spi_no { "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) }, /* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */ diff --git a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch b/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch index 8082fa6c1e..9ba7a4ab2f 100644 --- a/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch +++ b/target/linux/generic/patches-3.18/473-mtd-spi-nor-add-support-for-the-Macronix-MX25L512E-S.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -517,6 +517,7 @@ static const struct spi_device_id spi_no +@@ -518,6 +518,7 @@ static const struct spi_device_id spi_no { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, /* Macronix */ diff --git a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch b/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch index f5722379d2..b06ac73fae 100644 --- a/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch +++ b/target/linux/generic/patches-3.18/474-mtd-spi-nor-add-support-for-the-ISSI-SI25CD512-SPI-f.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c -@@ -516,6 +516,9 @@ static const struct spi_device_id spi_no +@@ -517,6 +517,9 @@ static const struct spi_device_id spi_no { "320s33b", INFO(0x898912, 0, 64 * 1024, 64, 0) }, { "640s33b", INFO(0x898913, 0, 64 * 1024, 128, 0) }, -- 2.11.0