mtd:spi-nor: Add Altera Quad SPI Driver
Subsystems (3)
PATCH v5 1/1 mtd:spi-nor: Add Altera Quad SPI Driver
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
---
v5:
- Remove Micron support
- Add multiple flashes probe failure handle
v4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- Change EPCQ_OPCODE_ID to NON_EPCS_OPCODE_ID
- Replace get_flash_name to altera_quadspi_scan
- Remove clk related parts
- Remove altera_quadspi_plat
- Change device tree reg name and remove opcode-id
v3:
- Change altera_epcq driver name to altera_quadspi for more generic name
- Implement flash name searching in altera_quadspi.c instead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Remove wait_til_ready in all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 file
v2:
- Change to spi_nor structure
- Add lock and unlock functions for spi_nor
- Simplify the altera_epcq_lock function
- Replace reg by compatible in device tree
--- .../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557 ++++++++++++++++++++ drivers/mtd/spi-nor/spi-nor.c | 18 + 5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/altera-quadspi.txt create mode 100644 drivers/mtd/spi-nor/altera-quadspi.c
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +45 -0
@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the following fields: + - compatible: Should contain the flash name: + 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512, epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024 + - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to /mtd/partition.txt + +Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + }; + partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + }; + }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)
drivers/mtd/spi-nor/Kconfig +8 -0
@@ -28,4 +28,12 @@ config SPI_FSL_QUADSPI This enables support for the Quad SPI controller in master mode. We only connect the NOR to this controller now. +config SPI_ALTERA_QUADSPI + tristate "Altera Generic Quad SPI Controller" + depends on OF + help + This enables access to Altera EPCQ/EPCS flash chips, + used for data storage. See the driver source for the current list, + or to add other chips. + endif # MTD_SPI_NOR
drivers/mtd/spi-nor/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor.o obj-$(CONFIG_SPI_FSL_QUADSPI) += fsl-quadspi.o +obj-$(CONFIG_SPI_ALTERA_QUADSPI) += altera-quadspi.o
drivers/mtd/spi-nor/altera-quadspi.c new file +557 -0
557 lines not on this page · raw message
drivers/mtd/spi-nor/spi-nor.c +18 -0
@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { { "cat25c09", CAT25_INFO( 128, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, + +/* Altera EPCQ/EPCS Flashes are non-JEDEC */ + { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) }, + { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) }, + { }, };
Signature · 6 lines
1.7.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 86 lines · On Thursday, August 20, 2015 at 08:55:05 AM…
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 filev2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree--- .../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557 ++++++++++++++++++++ drivers/mtd/spi-nor/spi-nor.c | 18 + 5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644
Documentation/devicetree/bindings/mtd/altera-quadspi.txtcreate mode 100644drivers/mtd/spi-nor/altera-quadspi.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/mtd/altera-quadspi.txtnew file mode 100644
index 0000000..e1bcf18Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +12
-0@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the followingfields: + - compatible: Should contain the flash name:
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +20
-0+ 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512, epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024 + - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to /mtd/partition.txt + +Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>;
Documentation/devicetree/bindings/mtd/altera-quadspi.txt line 43
Quoted 10 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +10
-0+ partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + }; + partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + };
IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 2 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)
Remove this incorrect comment.
[...]
Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +8
-0+static struct flash_device flash_devices[] = { + FLASH_ID("epcs16", EPCS_OPCODE_ID, 0x14), + FLASH_ID("epcs64", EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcs128", EPCS_OPCODE_ID, 0x18), + + FLASH_ID("epcq16", NON_EPCS_OPCODE_ID, 0x15), + FLASH_ID("epcq32", NON_EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcq64", NON_EPCS_OPCODE_ID, 0x17),
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 10 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +10
-0+ FLASH_ID("epcq128", NON_EPCS_OPCODE_ID, 0x18), + FLASH_ID("epcq256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcq512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcq1024", NON_EPCS_OPCODE_ID, 0x21), + + FLASH_ID("epcql256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcql512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcql1024", NON_EPCS_OPCODE_ID, 0x21), + +};
I think it'd be better to wait until the IP block is fixed and can issue READID correctly.
drivers/mtd/spi-nor/spi-nor.c static const struct spi_device_id spi_nor_ids[] = { · line 691
Quoted 10 lines
drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { {"cat25c09" ,CAT25_INFO (128 ,8 ,32 ,2 ,SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8, 64,2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +drivers/mtd/spi-nor/spi-nor.c +1
-0+/* Altera EPCQ/EPCS Flashes are non-JEDEC */
Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Quoted 8 lines
drivers/mtd/spi-nor/spi-nor.c +8
-0+ { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) },
drivers/mtd/spi-nor/spi-nor.c static const struct spi_device_id spi_nor_ids[] = { · line 709
Quoted 10 lines
drivers/mtd/spi-nor/spi-nor.c +8
-0+ { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) }, + { }, };
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 101 lines · Marek Vasut
Quoted 86 lines · On Thursday, August 20, 2015 at 08:55:05 AM, [email protected] wrote:
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 filev2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree--- .../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557 ++++++++++++++++++++ drivers/mtd/spi-nor/spi-nor.c | 18 + 5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644
Documentation/devicetree/bindings/mtd/altera-quadspi.txtcreate mode 100644drivers/mtd/spi-nor/altera-quadspi.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/mtd/altera-quadspi.txtnew file mode 100644
index 0000000..e1bcf18Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +12
-0@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the followingfields: + - compatible: Should contain the flash name:
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +20
-0+ 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512, epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024 + - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to /mtd/partition.txt + +Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>;Documentation/devicetree/bindings/mtd/altera-quadspi.txt line 43
Quoted 10 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +10
-0+ partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + }; + partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 2 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)Remove this incorrect comment.
[...]
Do you mean the partition part below should not be in example?
partition@0 {
/* 16 MB for raw data. */
label = "EPCQ Flash 0 raw data";
reg = <0x0 0x1000000>;
};
partition@1000000 {
/* 16 MB for jffs2 data. */
label = "EPCQ Flash 0 JFFS 2";
reg = <0x1000000 0x1000000>;
};Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +13
-0+static struct flash_device flash_devices[] = { + FLASH_ID("epcs16", EPCS_OPCODE_ID, 0x14), + FLASH_ID("epcs64", EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcs128", EPCS_OPCODE_ID, 0x18), + + FLASH_ID("epcq16", NON_EPCS_OPCODE_ID, 0x15), + FLASH_ID("epcq32", NON_EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcq64", NON_EPCS_OPCODE_ID, 0x17), + FLASH_ID("epcq128", NON_EPCS_OPCODE_ID, 0x18), + FLASH_ID("epcq256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcq512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcq1024", NON_EPCS_OPCODE_ID, 0x21), +
Quoted 9 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ FLASH_ID("epcql256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcql512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcql1024", NON_EPCS_OPCODE_ID, 0x21), + +};I think it'd be better to wait until the IP block is fixed and can issue READID correctly.
The hardware IP fix will take time while there are lot of customer are waiting for this driver. That is why we decided to upstream the driver. If the hardware fix, there might not need to have any changes in driver to support or if yes, it will be just minor.
Quoted 32 lines
Quoted 10 lines
drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { {"cat25c09" ,CAT25_INFO (128 ,8 ,32 ,2 ,SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8, 64,2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +
+ /* Altera EPCQ/EPCS Flashes are non-JEDEC */Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Quoted 18 lines
drivers/mtd/spi-nor/spi-nor.c +16
-0+ { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) }, + { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) }, + { }, };
Signature · 1 line
Nga
Sorry for missing to reply the last question
Quoted 146 lines · Nga Chi
Quoted 101 lines · Marek Vasut
Quoted 86 lines · On Thursday, August 20, 2015 at 08:55:05 AM…
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 filev2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree--- .../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557 ++++++++++++++++++++ drivers/mtd/spi-nor/spi-nor.c | 18 + 5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644
Documentation/devicetree/bindings/mtd/altera-quadspi.txtcreate mode 100644drivers/mtd/spi-nor/altera-quadspi.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/mtd/altera-quadspi.txtnew file mode 100644
index 0000000..e1bcf18Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +12
-0@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. It contains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names + "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the followingfields: + - compatible: Should contain the flash name:
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +20
-0+ 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512, epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024 + - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to /mtd/partition.txt + +Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>;Documentation/devicetree/bindings/mtd/altera-quadspi.txt line 43
Quoted 10 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +10
-0+ partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + }; + partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 2 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)Remove this incorrect comment.
[...]
Do you mean the partition part below should not be in example?
partition@0 { /* 16 MB for raw data. */ label = "EPCQ Flash 0 raw data"; reg = <0x0 0x1000000>; }; partition@1000000 { /* 16 MB for jffs2 data. */ label = "EPCQ Flash 0 JFFS 2"; reg = <0x1000000 0x1000000>; };Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +13
-0+static struct flash_device flash_devices[] = { + FLASH_ID("epcs16", EPCS_OPCODE_ID, 0x14), + FLASH_ID("epcs64", EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcs128", EPCS_OPCODE_ID, 0x18), + + FLASH_ID("epcq16", NON_EPCS_OPCODE_ID, 0x15), + FLASH_ID("epcq32", NON_EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcq64", NON_EPCS_OPCODE_ID, 0x17), + FLASH_ID("epcq128", NON_EPCS_OPCODE_ID, 0x18), + FLASH_ID("epcq256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcq512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcq1024", NON_EPCS_OPCODE_ID, 0x21), +Quoted 9 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ FLASH_ID("epcql256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcql512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcql1024", NON_EPCS_OPCODE_ID, 0x21), + +};I think it'd be better to wait until the IP block is fixed and can issue READID correctly.
Quoted 19 lines
The hardware IP fix will take time while there are lot of customer are waiting for this driver. That is why we decided to upstream the driver. If the hardware fix, there might not need to have any changes in driver to support or if yes, it will be just minor.
Quoted 14 lines
Quoted 10 lines
drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { {"cat25c09" ,CAT25_INFO (128 ,8 ,32 ,2 ,SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8, 64,2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +
+ /* Altera EPCQ/EPCS Flashes are non-JEDEC */Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Altera EPCS flash is non-jedec device. And this new controller is not EPCS controller. If you look at the documentation i sent in another email, they are not the same.
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mtd/spi-nor/spi-nor.c +15
-0+ { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) }, + { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) },
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
+
{ },};
--
Nga
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 119 lines · Nga Chi
Quoted 106 lines · Marek Vasut
Quoted 98 lines · On Thursday, August 20, 2015 at 08:55:05 AM, [email protected] wrote:
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 filev2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree
---.../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557++++++++++++++++++++
drivers/mtd/spi-nor/spi-nor.c|18 +
5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644
Documentation/devicetree/bindings/mtd/altera-quadspi.txtcreate mode 100644drivers/mtd/spi-nor/altera-quadspi.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/mtd/altera-quadspi.txtnew file mode 100644
index 0000000..e1bcf18Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. Itcontains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the followingfields: + - compatible: Should contain the flash name:
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512,epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +3
-0+ - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to/mtd/partition.txt +
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +16
-0+Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 rawdata"; + reg = <
0x00x1000000>; + };Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ partition@1000000 { + /* 16 MB for jffs2 data.Quoted 3 lines
*/ + label = "EPCQ Flash 0
JFFS 2"; + reg = <0x10000000x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 7 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 2 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)Remove this incorrect comment.
[...]
Do you mean the partition part below should not be in example?
partition@0 {
/* 16 MB for raw data. */ label = "EPCQ Flash 0 raw
Quoted 6 lines
data"; reg = <0x0 0x1000000>; };
partition@1000000 {
/* 16 MB for jffs2 data. */
label = "EPCQ Flash 0 JFFS 2";
reg = <0x1000000 0x1000000>;
};Yes, it's not really relevant.
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +13
-0+static struct flash_device flash_devices[] = { + FLASH_ID("epcs16", EPCS_OPCODE_ID, 0x14), + FLASH_ID("epcs64", EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcs128", EPCS_OPCODE_ID, 0x18), + + FLASH_ID("epcq16", NON_EPCS_OPCODE_ID, 0x15), + FLASH_ID("epcq32", NON_EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcq64", NON_EPCS_OPCODE_ID, 0x17), + FLASH_ID("epcq128", NON_EPCS_OPCODE_ID, 0x18), + FLASH_ID("epcq256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcq512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcq1024", NON_EPCS_OPCODE_ID, 0x21), +Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ FLASH_ID("epcql256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcql512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcql1024", NON_EPCS_OPCODE_ID, 0x21), + +};I think it'd be better to wait until the IP block is fixed and can issue READID correctly.
Quoted 2 lines
The hardware IP fix will take time while there are lot of customer are waiting for this driver.
Does that justify pushing serious crap into mainline Linux in any way ?
Quoted 3 lines
That is why we decided to upstream the
driver. If the hardware fix, there might not need to have any changes in driver to support or if yes, it will be just minor.
If the hardware can do proper READID opcode, this entire nonsense table will go away and a proper integration into the SPI NOR framework will take place.
You might consider submitting this driver for staging, but I definitely am not a big fan of that.
Quoted 36 lines
Quoted 36 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/mtd/spi-nor/spi-nor.cindex 14a5d23..2ab7279 100644drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { {"cat25c09" ,CAT25_INFO (128 ,8 ,32 ,2 ,SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8,Quoted 2 lines
64, 2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +
+ /* Altera EPCQ/EPCS Flashes are non-JEDEC */Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Quoted 20 lines
drivers/mtd/spi-nor/spi-nor.c +16
-0+ { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) }, + { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) }, + { }, };
Quoted 1 line · Viet Nga Dao
Sorry for missing to reply the last question
Hi!
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
(quoted diff) +0
-0
b/drivers/mtd/spi-nor/spi-nor.cindex 14a5d23..2ab7279 100644drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { { "cat25c09", CAT25_INFO( 128, 8, 32, 2, SPI_NOR_NO_ERASE |Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
drivers/mtd/spi-nor/spi-nor.c +0
-0SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8,64, 2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +
+ /* Altera EPCQ/EPCS Flashes are non-JEDEC */Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Quoted 3 lines
Altera EPCS flash is non-jedec device. And this new controller is not EPCS controller. If you look at the documentation i sent in another email, they are not the same.
https://www.altera.com/content/dam/altera-
www/global/en_US/pdfs/literature/hb/cfg/cfg_cf52012.pdf page 15 ; seems like opcode 0x9f is supported. All the other opcodes seems compatible too. What is the problem ?
Best regards,
Marek Vasut
Quoted 127 lines · Marek Vasut
Quoted 119 lines · Nga Chi
Quoted 106 lines · Marek Vasut
Quoted 98 lines · On Thursday, August 20, 2015 at 08:55:05 AM, [email protected] wrote:
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 filev2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree
---.../devicetree/bindings/mtd/altera-quadspi.txt | 45 ++ drivers/mtd/spi-nor/Kconfig | 8 + drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/altera-quadspi.c | 557++++++++++++++++++++
drivers/mtd/spi-nor/spi-nor.c|18 +
5 files changed, 629 insertions(+), 0 deletions(-) create mode 100644
Documentation/devicetree/bindings/mtd/altera-quadspi.txtcreate mode 100644drivers/mtd/spi-nor/altera-quadspi.c(quoted diff) +0
-0
b/Documentation/devicetree/bindings/mtd/altera-quadspi.txtnew file mode 100644
index 0000000..e1bcf18Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0@@ -0,0 +1,45 @@ +* MTD Altera QUADSPI driver + +Required properties: +- compatible: Should be "altr,quadspi-1.0" +- reg: Address and length of the register set for the device. Itcontains + the information of registers in the same order as described by reg-names +- reg-names: Should contain the reg names
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ "avl_csr": Should contain the register configuration base address + "avl_mem": Should contain the data base address +- #address-cells: Must be <1>. +- #size-cells: Must be <0>. +- flash device tree subnode, there must be a node with the followingfields: + - compatible: Should contain the flash name:
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ 1. EPCS: epcs16, epcs64, epcs128 + 2. EPCQ: epcq16, epcq32, epcq64, epcq128, epcq256, epcq512,epcq1024 + 3. EPCQ-L: epcql256, epcql512, epcql1024
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +3
-0+ - #address-cells: please refer to /mtd/partition.txt + - #size-cells: please refer to /mtd/partition.txt + For partitions inside each flash, please refer to/mtd/partition.txt +
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +16
-0+Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 rawdata"; + reg = <
0x00x1000000>; + };Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ partition@1000000 { + /* 16 MB for jffs2 data.Quoted 3 lines
*/ + label = "EPCQ Flash 0
JFFS 2"; + reg = <0x10000000x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 7 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 2 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +2
-0+ }; + }; //end quadspi@0x180014a0 (quadspi_controller_0)Remove this incorrect comment.
[...]
Do you mean the partition part below should not be in example?
partition@0 {
/* 16 MB for raw data. */ label = "EPCQ Flash 0 rawQuoted 6 lines
data"; reg = <0x0 0x1000000>; }; partition@1000000 { /* 16 MB for jffs2 data. */ label = "EPCQ Flash 0 JFFS 2"; reg = <0x1000000 0x1000000>; };
Quoted 2 lines
Yes, it's not really relevant.
OK
Quoted 31 lines
Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +13
-0+static struct flash_device flash_devices[] = { + FLASH_ID("epcs16", EPCS_OPCODE_ID, 0x14), + FLASH_ID("epcs64", EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcs128", EPCS_OPCODE_ID, 0x18), + + FLASH_ID("epcq16", NON_EPCS_OPCODE_ID, 0x15), + FLASH_ID("epcq32", NON_EPCS_OPCODE_ID, 0x16), + FLASH_ID("epcq64", NON_EPCS_OPCODE_ID, 0x17), + FLASH_ID("epcq128", NON_EPCS_OPCODE_ID, 0x18), + FLASH_ID("epcq256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcq512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcq1024", NON_EPCS_OPCODE_ID, 0x21), +Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ FLASH_ID("epcql256", NON_EPCS_OPCODE_ID, 0x19), + FLASH_ID("epcql512", NON_EPCS_OPCODE_ID, 0x20), + FLASH_ID("epcql1024", NON_EPCS_OPCODE_ID, 0x21), + +};I think it'd be better to wait until the IP block is fixed and can issue READID correctly.
Quoted 2 lines
The hardware IP fix will take time while there are lot of customer are waiting for this driver.
Does that justify pushing serious crap into mainline Linux in any way ?
Quoted 3 lines
That is why we decided to upstream the
driver. If the hardware fix, there might not need to have any changes in driver to support or if yes, it will be just minor.
Quoted 7 lines
If the hardware can do proper READID opcode, this entire nonsense table will go away and a proper integration into the SPI NOR framework will take place.
You might consider submitting this driver for staging, but I definitely am not a big fan of that.
You might misunderstand the hardware problem i mention here. This soft IP controller is able to provide the ID for our Altera EPCS/EPCQ flash chips, which are non JEDEC chips. As from EPCQ device data sheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cfg/cfg_cf52012.pdf),
the device ID is 8 bit data. The remaining problem here is that this controller is able to support Micron chips but it currently has limitation in providing only 8 bit ID, which is not full JEDEC ID for Micron chips. Hence, we are asking hardware engineer to find out the solution so that the driver does not need to do any dirty hacking. And so, this table should still be here even hardware fix will take place or not.
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 10 lines
(quoted diff) +0
-0
b/drivers/mtd/spi-nor/spi-nor.cindex 14a5d23..2ab7279 100644drivers/mtd/spi-nor/spi-nor.c +0
-0@@ -687,6 +687,24 @@ static const struct spi_device_id spi_nor_ids[] = { {"cat25c09" ,CAT25_INFO (128 ,8 ,32 ,2 ,SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25c17", CAT25_INFO( 256, 8, 32, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, { "cat25128", CAT25_INFO(2048, 8,Quoted 2 lines
64, 2,
SPI_NOR_NO_ERASE|SPI_NOR_NO_FR) }, +
+ /* Altera EPCQ/EPCS Flashes are non-JEDEC */Are they really ? Last time I checked on CV SoC, I was able to read their JEDEC ID just fine ; though it's true I used that EPCS core.
Quoted 20 lines
drivers/mtd/spi-nor/spi-nor.c +16
-0+ { "epcs16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcs64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcs128", INFO(0, 0, 0x40000, 256, 0) }, + + { "epcq16", INFO(0, 0, 0x10000, 32, 0) }, + { "epcq32", INFO(0, 0, 0x10000, 64, 0) }, + { "epcq64", INFO(0, 0, 0x10000, 128, 0) }, + { "epcq128", INFO(0, 0, 0x10000, 256, 0) }, + { "epcq256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcq512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcq1024", INFO(0, 0, 0x10000, 2048, 0) }, + + { "epcql256", INFO(0, 0, 0x10000, 512, 0) }, + { "epcql512", INFO(0, 0, 0x10000, 1024, 0) }, + { "epcql1024", INFO(0, 0, 0x10000, 2048, 0) }, + { }, };
On Thursday, August 20, 2015 at 11:18:14 AM, Viet Nga Dao wrote:
Hi,
[...]
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
That is why we decided to upstream the
driver. If the hardware fix, there might not need to have any changes in driver to support or if yes, it will be just minor.If the hardware can do proper READID opcode, this entire nonsense table will go away and a proper integration into the SPI NOR framework will take place.
Quoted 8 lines
Quoted 2 lines
You might consider submitting this driver for staging, but I definitely am not a big fan of that.
You might misunderstand the hardware problem i mention here. This soft IP controller is able to provide the ID for our Altera EPCS/EPCQ flash chips, which are non JEDEC chips. As from EPCQ device data sheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature
/hb/cfg/cfg_cf52012.pdf), the device ID is 8 bit data.
So what exactly is the output of READID instruction followed by 6 Byte read on an EPCQ chip?
Quoted 5 lines
The remaining
problem here is that this controller is able to support Micron chips but it currently has
limitation in providing only 8 bit ID, which is not full JEDEC ID for Micron chips.
OK
Quoted 4 lines
Hence, we are asking hardware engineer to find out the solution so that the driver does not need to do any dirty hacking. And so, this table should still be here even hardware fix will take place or not.
[...]
Best regards,
Marek Vasut
Hello Marek,
Quoted 18 lines · Marek Vasut
Quoted 18 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +18
-0+Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + };
Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt line 43
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Do you mean specifying partitions in OF is deprecated in general? Is there any link for that? What would be an alternative to it?
Best regards,
Alexander
Signature · 22 lines
Dipl.-Inf. Alexander Stein SYS TEC electronic GmbH alexander.stein-93q1YBGzJSMe9JSWTWOYM3xStJ4P+DSV@public.gmane.org Legal and Commercial Address: Am Windrad 2 08468 Heinsdorfergrund Germany Office: +49 (0) 3765 38600-0 Fax: +49 (0) 3765 38600-4100 Managing Directors: Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt; Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp Commercial Registry: Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 28 lines · Alexander Stein
Quoted 18 lines · Marek Vasut
Quoted 18 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +18
-0+Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem"; + #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data. */ + label = "EPCQ Flash 0 raw data"; + reg = <0x0 0x1000000>; + };Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt line 43
Quoted 5 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +5
-0+ partition@1000000 { + /* 16 MB for jffs2 data. */ + label = "EPCQ Flash 0 JFFS 2"; + reg = <0x1000000 0x1000000>; + };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 2 lines
Do you mean specifying partitions in OF is deprecated in general? Is there any link for that? What would be an alternative to it?
This is the first I've heard of such a deprecation. I would argue that it's still probably one of the best ways to specify partitions. It's not exactly perfect (partitions aren't really "hardware", so may not belong in the "hardware description"), but IMO it's better than cmdlineparts, for instance. I also don't really know of any good-enough, generically useful on-flash partition formats, especially ones that can handle the complexities of NAND.
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Viet Nga Dao
You might misunderstand the hardware problem i mention here. This soft IP controller is able to provide the ID for our Altera EPCS/EPCQ flash chips, which are non JEDEC chips. As from EPCQ device data sheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cfg/cfg_cf52012.pdf),
the device ID is 8 bit data.
8 bits of data is vastly insufficient for uniquely identifying a flash. This is not extendible and is not really a candidate for inclusion in mainline, unless it's somehow guaranteed that these flash can only be used with your controller (and I'm not sure how you would do that). Otherwise, you need to augment every flash with more out-of-band device-tree information.
Quoted 4 lines
The remaining problem here is that this
controller is able to support Micron chips but it currently has limitation in providing only 8 bit ID, which is not full JEDEC ID for Micron chips.
You're just proving my point. I will not support "READ ID" detection that is based on only 8 bits of ID.
Quoted 2 lines
Hence, we are asking hardware engineer to find out the solution so that the driver does not need to do any dirty hacking.
OK, then I wish your hardware team great speed.
Quoted 3 lines
And
so, this table should still be here even hardware fix will take place or not.
I'm not sure how you come to this conclusion.
BTW, to reiterate one other question that I feel wasn't adequately
answered: what does the full ID string look like for these EPCS/EPCQ flash chips? Not the ID as seen by your limited controller, but the ID that can be reported by the flash chip. Is it really only an 8-bit number? Or does it have a longer string that your controller just can't read?
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Marek Vasut
Quoted 5 lines · Viet Nga Dao
You might misunderstand the hardware problem i mention here. This soft IP controller is able to provide the ID for our Altera EPCS/EPCQ flash chips, which are non JEDEC chips. As from EPCQ device data sheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature
/hb/cfg/cfg_cf52012.pdf), the device ID is 8 bit data.So what exactly is the output of READID instruction followed by 6 Byte read on an EPCQ chip?
+1 to this question
Quoted 17 lines · Brian Norris
Quoted 16 lines · Alexander Stein
Quoted 7 lines · Marek Vasut
Quoted 7 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +7
-0+Example: + + quadspi_controller_0: quadspi@0x180014a0 { + compatible = "altr,quadspi-1.0"; + reg = <0x180014a0 0x00000020>, + <0x14000000 0x04000000>; + reg-names = "avl_csr", "avl_mem";Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 8 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +8
-0+ #address-cells = <1>; + #size-cells = <0>; + flash0: epcq256@0 { + compatible = "altr,epcq256"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + /* 16 MB for raw data.
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +1
-0+ label = "EPCQ Flash 0
raw data";
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt
Quoted 4 lines
Documentation/devicetree/bindings/mtd/altera-quadspi.txt new file +4
-0+ reg = <0x0 0x1000000>; + }; + partition@1000000 { + /* 16 MB for jffs2 data.
*/
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +1
-0+ label = "EPCQ Flash 0
JFFS 2";
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +1
-0+ reg = <0x1000000
0x1000000>;
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ };IIRC, encoding partitions into OF is deprecated (and it shouldn't be part of the example anyway, so please remove this bit).
Quoted 7 lines
Quoted 2 lines
Do you mean specifying partitions in OF is deprecated in general? Is there any link for that? What would be an alternative to it?
This is the first I've heard of such a deprecation. I would argue that it's still probably one of the best ways to specify partitions. It's not exactly perfect (partitions aren't really "hardware", so may not belong in the "hardware description")
Which is the reasoning why I heard it was deprecated, but it seems my knowledge is not correct. I apologize for the misinformation, sorry.
Quoted 4 lines
, but IMO it's better than cmdlineparts,
for instance. I also don't really know of any good-enough, generically useful on-flash partition formats, especially ones that can handle the complexities of NAND.
Right.
Best regards,
Marek Vasut
Quoted 25 lines · Brian Norris
Quoted 5 lines · Viet Nga Dao
You might misunderstand the hardware problem i mention here. This soft IP controller is able to provide the ID for our Altera EPCS/EPCQ flash chips, which are non JEDEC chips. As from EPCQ device data sheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cfg/cfg_cf52012.pdf),
the device ID is 8 bit data.8 bits of data is vastly insufficient for uniquely identifying a flash. This is not extendible and is not really a candidate for inclusion in mainline, unless it's somehow guaranteed that these flash can only be used with your controller (and I'm not sure how you would do that). Otherwise, you need to augment every flash with more out-of-band device-tree information.
Quoted 4 lines
The remaining problem here is that this
controller is able to support Micron chips but it currently has limitation in providing only 8 bit ID, which is not full JEDEC ID for Micron chips.You're just proving my point. I will not support "READ ID" detection that is based on only 8 bits of ID.
Quoted 2 lines
Hence, we are asking hardware engineer to find out the solution so that the driver does not need to do any dirty hacking.
Quoted 8 lines
OK, then I wish your hardware team great speed.
Quoted 3 lines
And
so, this table should still be here even hardware fix will take place or not.I'm not sure how you come to this conclusion.
I have this conclusion is because Altera EPCQ/EPCS flashes are non JEDEC. Thus on the spi_device_id table,
the ID in the INFO struct must be filled up with zeros in order to matches the current framework.
However, since i still persist to have the device id check in my driver, as suggested by Rash,
I should implement it locally in my driver. And this table is the look up table for the device ID of supported flashes.
Or maybe you can give me any other better idea?
Quoted 7 lines
BTW, to reiterate one other question that I feel wasn't adequately
answered: what does the full ID string look like for these EPCS/EPCQ flash chips? Not the ID as seen by your limited controller, but the ID that can be reported by the flash chip. Is it really only an 8-bit number? Or does it have a longer string that your controller just can't read?
Yes, As you can refer to page 32 of EPCQ flash datasheet
(https://www.altera.com/content/dam/altera-www/global/en_US/pdfs/literature/hb/cfg/cfg_cf52012.pdf),
"This operation reads the 8-bit device identification of the EPCQ
device from the DATA1 output pin".
Table 29 lists the EPCQ device identifications
Nga
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines · On Thu, Aug 20, 2015 at 2:55 PM, <[email protected]> wrote:
From: VIET NGA DAO <[email protected]>
Altera Quad SPI Controller is a soft IP which enables access to Altera EPCS and EPCQ flash chips. This patch adds driver for these devices.
Signed-off-by VIET NGA DAO <[email protected]>---
v5:
- Remove Micron support
- Add multiple flashes probe failure handlev4:
- Add more flash devices support ( EPCQL and Micron)
- Remove redundant messages
- ChangeEPCQ_OPCODE_IDtoNON_EPCS_OPCODE_ID
- Replaceget_flash_nametoaltera_quadspi_scan
- Remove clk related parts
- Removealtera_quadspi_plat
- Change device tree reg name and remove opcode-idv3:
- Changealtera_epcqdriver name toaltera_quadspifor more generic name
- Implement flash name searching inaltera_quadspi.cinstead of spi-nor
- Edit the altra quadspi info table in spi-nor
- Removewait_til_readyin all read,write, erase, lock, unlock functions
- Merge .h and .c into 1 file
Quoted 6 lines
v2:
- Change tospi_norstructure
- Add lock and unlock functions forspi_nor
- Simplify thealtera_epcq_lockfunction
- Replace reg by compatible in device tree
---
Hi, i decided to wait for the hardware fixed and tested before submitting new patch.
Thanks for all for your reviews and comments.
Viet Nga