Skip to contentSkip to conversation

ARM: shmobile: alt: Add QSPI device to DT

PATCH Superseded Simon Horman 3 participants 9 messages Nov 30, 2015 – Jan 4, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>

---
Testedon top of renesas-devel-20151126-v4.4-rc2. Read /dev/mtd0 with 512K blocks at 6.5Mb/s

---
 arch/arm/boot/dts/r8a7794-alt.dts | 45 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
arch/arm/boot/dts/r8a7794-alt.dts +45 -0
index 767d9224d6cc..0dae87639328 100644
@@ -138,6 +138,13 @@
 	status = "okay";
 };
 
+&pfc {
+	qspi_pins: spi0 {
+		renesas,groups = "qspi_ctrl", "qspi_data4";
+		renesas,function = "qspi";
+	};
+};
+
 &ether {
 	pinctrl-0 = <&ether_pins &phy1_pins>;
 	pinctrl-names = "default";
@@ -197,3 +204,41 @@
 
 	status = "okay";
 };
+
+&qspi {
+	pinctrl-0 = <&qspi_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+
+	flash at 0 {
+		compatible = "spansion,s25fl512s", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <30000000>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
+		spi-cpol;
+		spi-cpha;
+		m25p,fast-read;
+
+		partitions {
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "loader";
+				reg = <0x00000000 0x00040000>;
+				read-only;
+			};
+			partition at 40000 {
+				label = "user";
+				reg = <0x00040000 0x00400000>;
+				read-only;
+			};
+			partition at 440000 {
+				label = "flash";
+				reg = <0x00440000 0x03bc0000>;
+			};
+		};
+	};
+};
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

		partition at 0 {
			label = "loader";
			reg = <0x00000000 0x00080000>;
			read-only;
		};
		partition at 40000 {
			label = "user";
			reg = <0x00080000 0x00580000>;
			read-only;
		};
		partition at 440000 {
			label = "flash";
			reg = <0x00600000 0x03a00000>;
		};

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

#3 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Hi Simon,

Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,
- SA1: System area, 16 KiB,
- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Quoted 45 lines · Geert Uytterhoeven

Hi Simon,

Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

Quoted 7 lines

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,
- SA1: System area, 16 KiB,
- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

My feeling is that we should follow the documentation. Does this reflect the scheme it describes?

                partitions {
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition at 0 {
                                label = "loader";
                                reg = <0x00000000 0x00004000>;
                                read-only;
                        };
                        partition at 4000 {
                                label = "system";
                                reg = <0x00004000 0x00004000>;
                                read-only;
                        };
                        partition at 8000 {
                                label = "user";
                                reg = <0x00008000 0x03ff8000>;
                        };
                };
#5 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Hi Simon,

Quoted 42 lines · Simon Horman
Quoted 41 lines · Geert Uytterhoeven
Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,

Sorry, I missed a "Not used" part after that, and started miscounting zeroes on top of that :-(

So the loader consumes 16 KiB out of the 256 KiB SA0 partition.

Quoted 1 line
Quoted 1 line

- SA1: System area, 16 KiB,

Should be 256 KiB.

Quoted 9 lines
Quoted 4 lines

- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

My feeling is that we should follow the documentation. Does this reflect the scheme it describes?

Quoted 7 lines
                partitions {
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition at 0 {
                                label = "loader";
                                reg = <0x00000000 0x00004000>;

reg = <0x00000000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 4000 {

partition at 40000

Quoted 2 lines
                                label = "system";
                                reg = <0x00004000 0x00004000>;

reg = <0x00040000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 8000 {

partition at 80000

Quoted 2 lines
                                label = "user";
                                reg = <0x00008000 0x03ff8000>;

reg = <0x00080000 0x03f80000>;

Quoted 2 lines
                        };
                };

I don't have an ALT. Does this match with the actual FLASH contents?

Sorry for the wreck on my side.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#6 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Quoted 98 lines · Geert Uytterhoeven

Hi Simon,

Quoted 42 lines · Simon Horman
Quoted 41 lines · Geert Uytterhoeven
Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,

Sorry, I missed a "Not used" part after that, and started miscounting zeroes on top of that :-(

So the loader consumes 16 KiB out of the 256 KiB SA0 partition.

Quoted 1 line
Quoted 1 line

- SA1: System area, 16 KiB,

Should be 256 KiB.

Quoted 9 lines
Quoted 4 lines

- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

My feeling is that we should follow the documentation. Does this reflect the scheme it describes?

Quoted 7 lines
                partitions {
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition at 0 {
                                label = "loader";
                                reg = <0x00000000 0x00004000>;

reg = <0x00000000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 4000 {

partition at 40000

Quoted 2 lines
                                label = "system";
                                reg = <0x00004000 0x00004000>;

reg = <0x00040000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 8000 {

partition at 80000

Quoted 2 lines
                                label = "user";
                                reg = <0x00008000 0x03ff8000>;
Quoted 6 lines

reg = <0x00080000 0x03f80000>;

Quoted 2 lines
                        };
                };

I don't have an ALT. Does this match with the actual FLASH contents?

I'm a little unsure how to verify that.

Quoted 1 line

Sorry for the wreck on my side.

No problem.

#7 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Hi Simon,

Quoted 97 lines · Simon Horman
Quoted 96 lines · Geert Uytterhoeven
Quoted 42 lines · Simon Horman
Quoted 41 lines · Geert Uytterhoeven
Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,

Sorry, I missed a "Not used" part after that, and started miscounting zeroes on top of that :-(

So the loader consumes 16 KiB out of the 256 KiB SA0 partition.

Quoted 1 line
Quoted 1 line

- SA1: System area, 16 KiB,

Should be 256 KiB.

Quoted 9 lines
Quoted 4 lines

- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

My feeling is that we should follow the documentation. Does this reflect the scheme it describes?

Quoted 7 lines
                partitions {
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition at 0 {
                                label = "loader";
                                reg = <0x00000000 0x00004000>;

reg = <0x00000000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 4000 {

partition at 40000

Quoted 2 lines
                                label = "system";
                                reg = <0x00004000 0x00004000>;

reg = <0x00040000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 8000 {

partition at 80000

Quoted 2 lines
                                label = "user";
                                reg = <0x00008000 0x03ff8000>;
Quoted 8 lines
Quoted 6 lines

reg = <0x00080000 0x03f80000>;

Quoted 2 lines
                        };
                };

I don't have an ALT. Does this match with the actual FLASH contents?

I'm a little unsure how to verify that.

Usually the FLASH is empty (all ones) at the end of each partition.

Hence "dd if=/dev/mtd0 bs=16M | hd | less" should report lots of identical lines of
data.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#8 lore raw

PATCH 1/1 ARM: shmobile: alt: Add QSPI device to DT

Quoted 107 lines · Geert Uytterhoeven

Hi Simon,

Quoted 104 lines · Simon Horman
Quoted 102 lines · Geert Uytterhoeven
Quoted 42 lines · Simon Horman
Quoted 41 lines · Geert Uytterhoeven
Quoted 40 lines · Simon Horman
Quoted 11 lines · Geert Uytterhoeven
Quoted 8 lines · Simon Horman

Enable the QSPI controller in the alt device tree.

Based similar work for the silk board by by Vladimir Barinov and Sergei Shtylyov.

Cc Vladimir Barinov <[email protected]>
Cc Sergei Shtylyov <[email protected]>
Quoted 7 lines

Verified against Alt schematics and r8a7794 datasheet.

I can't verify the FLASH layout. Note that p.11 of ALT_MiniMonitor_Manual(SPI_Boot)_Rev0.01_e.pdf shows a different FLASH layout for the second and third partition.

Thanks. I see the following in v1.9.6 of the BSP[1]. Is it the same as the document you referred to above?

                partition at 0 {
                        label = "loader";
                        reg = <0x00000000 0x00080000>;
                        read-only;
                };
                partition at 40000 {
                        label = "user";
                        reg = <0x00080000 0x00580000>;
                        read-only;
                };
                partition at 440000 {
                        label = "flash";
                        reg = <0x00600000 0x03a00000>;
                };
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

[1] https://git.kernel.org/cgit/linux/kernel/git/horms/renesas-backport.git/tree/arch/arm/boot/dts/r8a7794-alt.dts?h=rcar-gen2/v1.9.6&id=e1acbe074f36d96e901bf5346c50ee51da2ced42#n379

No, the document specifies 3 partitions:
- SA0: loader program area, 16 KiB,

Sorry, I missed a "Not used" part after that, and started miscounting zeroes on top of that :-(

So the loader consumes 16 KiB out of the 256 KiB SA0 partition.

Quoted 1 line
Quoted 1 line

- SA1: System area, 16 KiB,

Should be 256 KiB.

Quoted 9 lines
Quoted 4 lines

- SA2: User program area, remainder.

FWIW, the unit addresses in the device nodes above are not consistent with their reg properties.

My feeling is that we should follow the documentation. Does this reflect the scheme it describes?

Quoted 7 lines
                partitions {
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition at 0 {
                                label = "loader";
                                reg = <0x00000000 0x00004000>;

reg = <0x00000000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 4000 {

partition at 40000

Quoted 2 lines
                                label = "system";
                                reg = <0x00004000 0x00004000>;

reg = <0x00040000 0x00040000>;

Quoted 3 lines
                                read-only;
                        };
                        partition at 8000 {

partition at 80000

Quoted 2 lines
                                label = "user";
                                reg = <0x00008000 0x03ff8000>;

reg = <0x00080000 0x03f80000>;

Quoted 2 lines
                        };
                };

I don't have an ALT. Does this match with the actual FLASH contents?

Quoted 7 lines
Quoted 1 line

I'm a little unsure how to verify that.

Usually the FLASH is empty (all ones) at the end of each partition.

Hence "dd if=/dev/mtd0 bs=16M | hd | less" should report lots of identical lines of
data.

Thanks. I do see some non-ones followed by ones at the end of the partition.

I will post v2 with the above partitioning scheme.