Skip to contentSkip to conversation

arm: socfpga: implement proper peripheral reset handling

PATCH Superseded Simon Goldschmidt 2 participants 47 messages Feb 21, 2019 – Feb 26, 2019

Subsystems (8)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover arm: socfpga: implement proper peripheral reset handling

This series implements peripheral reset handling for socfpga gen5.

It moves from enabling all peripherals during SPL startup to using the socfpga reset driver from all peripherals and enabling peripherals when they are used.

As Linux cannot even handle this in 4.20, the reset driver implements a compatibility mode where it takes all peripherals out of reset before jumpint to the OS if an environment variable "socfpga_permodrst_ungate=1" is found. This is enabled by default for socfpga gen5 boards, but should be moved to default off in the near future once a Linux kernel supports reset handling for all drivers.

Changes in v2:
- cleanly merged Linux dts (moved change of SDR controller base address to a separate patch)
- port DDR driver to DM UCLASS_RAM
- don't change DDR calibration training driver (code got too big)
- use reset.h code instead of socfpga_per_reset()
- fix copy/paste issues
- add .remove callback to release the resets
- add .remove callback to release the resets
- moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment variable "socfpga_permodrst_ungate"
- this patch is new in v2
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

Simon Goldschmidt (8):
arm: socfpga: gen5: sync devicetrees to Linux
arm: socfpga: gen5: add reset & sdr node to SPL devicetrees
arm: socfpga: move gen5 SDR driver to DM
mtd: rawnand: denali: add reset handling
spi: cadence_qspi: add reset handling
reset: socfpga: add reset handling for old kernels
arm: socfpga: gen5: deassert peripheral reset by default
arm: socfpga: implement proper peripheral reset

 arch/arm/Kconfig                              |   2 +
 arch/arm/dts/socfpga.dtsi                     |  23 ++-
 arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi |   8 +
 arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts    |   8 +
 .../socfpga_cyclone5_de0_nano_soc-u-boot.dtsi |   8 +
 arch/arm/dts/socfpga_cyclone5_de10_nano.dts   |   8 +
 arch/arm/dts/socfpga_cyclone5_de1_soc.dts     |   8 +
 arch/arm/dts/socfpga_cyclone5_is1.dts         |   8 +
 .../dts/socfpga_cyclone5_socdk-u-boot.dtsi    |   8 +
 .../dts/socfpga_cyclone5_sockit-u-boot.dtsi   |   8 +
 .../dts/socfpga_cyclone5_socrates-u-boot.dtsi |   8 +
 arch/arm/dts/socfpga_cyclone5_socrates.dts    |   2 -
 arch/arm/dts/socfpga_cyclone5_sr1500.dts      |   8 +
 .../socfpga_cyclone5_vining_fpga-u-boot.dtsi  |   8 +
 .../mach-socfpga/include/mach/sdram_gen5.h    |   4 -
 arch/arm/mach-socfpga/misc_gen5.c             |  10 --
 arch/arm/mach-socfpga/spl_gen5.c              |  39 ++---
 drivers/ddr/altera/Kconfig                    |   1 +
 drivers/ddr/altera/sdram_gen5.c               | 143 ++++++++++++++++--
 drivers/ddr/altera/sequencer.c                |   9 +-
 drivers/ddr/altera/sequencer.h                |  35 +++++
 drivers/mtd/nand/raw/denali.h                 |   2 +
 drivers/mtd/nand/raw/denali_dt.c              |  14 ++
 drivers/reset/reset-socfpga.c                 |  34 +++++
 drivers/spi/cadence_qspi.c                    |  16 ++
 drivers/spi/cadence_qspi.h                    |   4 +
 include/configs/socfpga_common.h              |  14 ++
 27 files changed, 374 insertions(+), 66 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/8 arm: socfpga: gen5: sync devicetrees to Linux

This is again a sync to linux-next + pending patches in Dinh's tree at commit 1c909b2dfe6a ("ARM: dts: socfpga: update more missing reset properties")'

It adds missing peripheral reset properties to socfpga.dtsi and removes U-Boot specific leftovers from socfpga_cyclone5_socrates.dts.

---

Changes in v2:
- cleanly merged Linux dts (moved change of SDR controller base address to a separate patch)

 arch/arm/dts/socfpga.dtsi                  | 19 +++++++++++++++++--
 arch/arm/dts/socfpga_cyclone5_socrates.dts |  2 --
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/dts/socfpga.dtsi +17 -2
index 2458d6707d..ec1966480f 100644
@@ -84,6 +84,7 @@
 				#dma-requests = <32>;
 				clocks = <&l4_main_clk>;
 				clock-names = "apb_pclk";
+				resets = <&rst DMA_RESET>;
 			};
 		};
 
@@ -100,6 +101,7 @@
 			reg = <0xffc00000 0x1000>;
 			interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0 134 4>;
 			clocks = <&can0_clk>;
+			resets = <&rst CAN0_RESET>;
 			status = "disabled";
 		};
 
@@ -108,6 +110,7 @@
 			reg = <0xffc01000 0x1000>;
 			interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0 138 4>;
 			clocks = <&can1_clk>;
+			resets = <&rst CAN1_RESET>;
 			status = "disabled";
 		};
 
@@ -585,6 +588,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff708000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO0_RESET>;
 			status = "disabled";
 
 			porta: gpio-controller at 0 {
@@ -605,6 +609,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff709000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO1_RESET>;
 			status = "disabled";
 
 			portb: gpio-controller at 0 {
@@ -625,6 +630,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff70a000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO2_RESET>;
 			status = "disabled";
 
 			portc: gpio-controller at 0 {
@@ -735,6 +741,7 @@
 			#size-cells = <0>;
 			clocks = <&l4_mp_clk>, <&sdmmc_clk_divided>;
 			clock-names = "biu", "ciu";
+			resets = <&rst SDMMC_RESET>;
 			status = "disabled";
 		};
 
@@ -746,9 +753,9 @@
 			      <0xffb80000 0x10000>;
 			reg-names = "nand_data", "denali_reg";
 			interrupts = <0x0 0x90 0x4>;
-			dma-mask = <0xffffffff>;
 			clocks = <&nand_clk>, <&nand_x_clk>, <&nand_ecc_clk>;
 			clock-names = "nand", "nand_x", "ecc";
+			resets = <&rst NAND_RESET>;
 			status = "disabled";
 		};
 
@@ -759,7 +766,7 @@
 
 		qspi: spi at ff705000 {
 			compatible = "cdns,qspi-nor";
-                        #address-cells = <1>;
+			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <0xff705000 0x1000>,
 			      <0xffa00000 0x1000>;
@@ -768,6 +775,7 @@
 			cdns,fifo-width = <4>;
 			cdns,trigger-address = <0x00000000>;
 			clocks = <&qspi_clk>;
+			resets = <&rst QSPI_RESET>;
 			status = "disabled";
 		};
 
@@ -786,6 +794,7 @@
 		sdr: sdr at ffc25000 {
 			compatible = "altr,sdr-ctl", "syscon";
 			reg = <0xffc25000 0x1000>;
+			resets = <&rst SDR_RESET>;
 		};
 
 		sdramedac {
@@ -802,6 +811,7 @@
 			interrupts = <0 154 4>;
 			num-cs = <4>;
 			clocks = <&spi_m_clk>;
+			resets = <&rst SPIM0_RESET>;
 			status = "disabled";
 		};
 
@@ -813,6 +823,7 @@
 			interrupts = <0 155 4>;
 			num-cs = <4>;
 			clocks = <&spi_m_clk>;
+			resets = <&rst SPIM1_RESET>;
 			status = "disabled";
 		};
 
@@ -879,6 +890,7 @@
 			dmas = <&pdma 28>,
 			       <&pdma 29>;
 			dma-names = "tx", "rx";
+			resets = <&rst UART0_RESET>;
 		};
 
 		uart1: serial1 at ffc03000 {
@@ -891,6 +903,7 @@
 			dmas = <&pdma 30>,
 			       <&pdma 31>;
 			dma-names = "tx", "rx";
+			resets = <&rst UART1_RESET>;
 		};
 
 		usbphy0: usbphy {
@@ -930,6 +943,7 @@
 			reg = <0xffd02000 0x1000>;
 			interrupts = <0 171 4>;
 			clocks = <&osc1>;
+			resets = <&rst L4WD0_RESET>;
 			status = "disabled";
 		};
 
@@ -938,6 +952,7 @@
 			reg = <0xffd03000 0x1000>;
 			interrupts = <0 172 4>;
 			clocks = <&osc1>;
+			resets = <&rst L4WD1_RESET>;
 			status = "disabled";
 		};
 	};
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -2
index 93c3fa4a48..8d5d3996f6 100644
@@ -76,7 +76,6 @@
 
 &qspi {
 	status = "okay";
-	u-boot,dm-pre-reloc;
 
 	flash: flash at 0 {
 		#address-cells = <1>;
@@ -91,6 +90,5 @@
 		cdns,tchsh-ns = <4>;
 		cdns,tslch-ns = <4>;
 		status = "okay";
-		u-boot,dm-pre-reloc;
 	};
 };
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 1/8 arm: socfpga: gen5: sync devicetrees to Linux

Quoted 175 lines · Simon Goldschmidt

This is again a sync to linux-next + pending patches in Dinh's tree at commit 1c909b2dfe6a ("ARM: dts: socfpga: update more missing reset properties")'

It adds missing peripheral reset properties to socfpga.dtsi and removes U-Boot specific leftovers from socfpga_cyclone5_socrates.dts.

---

Changes in v2:
- cleanly merged Linux dts (moved change of SDR controller base address to a separate patch)

 arch/arm/dts/socfpga.dtsi                  | 19 +++++++++++++++++--
 arch/arm/dts/socfpga_cyclone5_socrates.dts |  2 --
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/dts/socfpga.dtsi +17 -2
index 2458d6707d..ec1966480f 100644
@@ -84,6 +84,7 @@
 				#dma-requests = <32>;
 				clocks = <&l4_main_clk>;
 				clock-names = "apb_pclk";
+				resets = <&rst DMA_RESET>;
 			};
 		};
 
@@ -100,6 +101,7 @@
 			reg = <0xffc00000 0x1000>;
 			interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0 134 4>;
 			clocks = <&can0_clk>;
+			resets = <&rst CAN0_RESET>;
 			status = "disabled";
 		};
 
@@ -108,6 +110,7 @@
 			reg = <0xffc01000 0x1000>;
 			interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0 138 4>;
 			clocks = <&can1_clk>;
+			resets = <&rst CAN1_RESET>;
 			status = "disabled";
 		};
 
@@ -585,6 +588,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff708000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO0_RESET>;
 			status = "disabled";
 
 			porta: gpio-controller at 0 {
@@ -605,6 +609,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff709000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO1_RESET>;
 			status = "disabled";
 
 			portb: gpio-controller at 0 {
@@ -625,6 +630,7 @@
 			compatible = "snps,dw-apb-gpio";
 			reg = <0xff70a000 0x1000>;
 			clocks = <&l4_mp_clk>;
+			resets = <&rst GPIO2_RESET>;
 			status = "disabled";
 
 			portc: gpio-controller at 0 {
@@ -735,6 +741,7 @@
 			#size-cells = <0>;
 			clocks = <&l4_mp_clk>, <&sdmmc_clk_divided>;
 			clock-names = "biu", "ciu";
+			resets = <&rst SDMMC_RESET>;
 			status = "disabled";
 		};
 
@@ -746,9 +753,9 @@
 			      <0xffb80000 0x10000>;
 			reg-names = "nand_data", "denali_reg";
 			interrupts = <0x0 0x90 0x4>;
-			dma-mask = <0xffffffff>;
 			clocks = <&nand_clk>, <&nand_x_clk>, <&nand_ecc_clk>;
 			clock-names = "nand", "nand_x", "ecc";
+			resets = <&rst NAND_RESET>;
 			status = "disabled";
 		};
 
@@ -759,7 +766,7 @@
 
 		qspi: spi at ff705000 {
 			compatible = "cdns,qspi-nor";
-                        #address-cells = <1>;
+			#address-cells = <1>;
 			#size-cells = <0>;
 			reg = <0xff705000 0x1000>,
 			      <0xffa00000 0x1000>;
@@ -768,6 +775,7 @@
 			cdns,fifo-width = <4>;
 			cdns,trigger-address = <0x00000000>;
 			clocks = <&qspi_clk>;
+			resets = <&rst QSPI_RESET>;
 			status = "disabled";
 		};
 
@@ -786,6 +794,7 @@
 		sdr: sdr at ffc25000 {
 			compatible = "altr,sdr-ctl", "syscon";
 			reg = <0xffc25000 0x1000>;
+			resets = <&rst SDR_RESET>;
 		};
 
 		sdramedac {
@@ -802,6 +811,7 @@
 			interrupts = <0 154 4>;
 			num-cs = <4>;
 			clocks = <&spi_m_clk>;
+			resets = <&rst SPIM0_RESET>;
 			status = "disabled";
 		};
 
@@ -813,6 +823,7 @@
 			interrupts = <0 155 4>;
 			num-cs = <4>;
 			clocks = <&spi_m_clk>;
+			resets = <&rst SPIM1_RESET>;
 			status = "disabled";
 		};
 
@@ -879,6 +890,7 @@
 			dmas = <&pdma 28>,
 			       <&pdma 29>;
 			dma-names = "tx", "rx";
+			resets = <&rst UART0_RESET>;
 		};
 
 		uart1: serial1 at ffc03000 {
@@ -891,6 +903,7 @@
 			dmas = <&pdma 30>,
 			       <&pdma 31>;
 			dma-names = "tx", "rx";
+			resets = <&rst UART1_RESET>;
 		};
 
 		usbphy0: usbphy {
@@ -930,6 +943,7 @@
 			reg = <0xffd02000 0x1000>;
 			interrupts = <0 171 4>;
 			clocks = <&osc1>;
+			resets = <&rst L4WD0_RESET>;
 			status = "disabled";
 		};
 
@@ -938,6 +952,7 @@
 			reg = <0xffd03000 0x1000>;
 			interrupts = <0 172 4>;
 			clocks = <&osc1>;
+			resets = <&rst L4WD1_RESET>;
 			status = "disabled";
 		};
 	};
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -1
index 93c3fa4a48..8d5d3996f6 100644
@@ -76,7 +76,6 @@
 
 &qspi {
 	status = "okay";
-	u-boot,dm-pre-reloc;
 
 	flash: flash at 0 {
 		#address-cells = <1>;

arch/arm/dts/socfpga_cyclone5_socrates.dts line 94

Quoted 4 lines
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -1
@@ -91,6 +90,5 @@
 		cdns,tchsh-ns = <4>;
 		cdns,tslch-ns = <4>;
 		status = "okay";
-		u-boot,dm-pre-reloc;

Is this intended ?

Quoted 3 lines
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -0
 	};
 };
Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH v2 1/8 arm: socfpga: gen5: sync devicetrees to Linux

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]> geschrieben:

Quoted 177 lines · Simon Goldschmidt
Quoted 31 lines

This is again a sync to linux-next + pending patches in Dinh's tree at commit 1c909b2dfe6a ("ARM: dts: socfpga: update more missing reset properties")'

It adds missing peripheral reset properties to socfpga.dtsi and removes U-Boot specific leftovers from socfpga_cyclone5_socrates.dts.

---

Changes in v2:
- cleanly merged Linux dts (moved change of SDR controller base address to a separate patch)

 arch/arm/dts/socfpga.dtsi                  | 19 +++++++++++++++++--
 arch/arm/dts/socfpga_cyclone5_socrates.dts |  2 --
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/dts/socfpga.dtsi +1 -0
index 2458d6707d..ec1966480f 100644
@@ -84,6 +84,7 @@
                              #dma-requests = <32>;
                              clocks = <&l4_main_clk>;
                              clock-names = "apb_pclk";
+                             resets = <&rst DMA_RESET>;
                      };
              };
 

arch/arm/dts/socfpga.dtsi line 102

Quoted 2 lines
arch/arm/dts/socfpga.dtsi +0 -0
@@ -100,6 +101,7 @@
                      reg = <0xffc00000 0x1000>;
                      interrupts = <0 131 4>, <0 132 4>, <0 133 4>, <0

134 4>;

arch/arm/dts/socfpga.dtsi line 111

Quoted 8 lines
arch/arm/dts/socfpga.dtsi +1 -0
                      clocks = <&can0_clk>;
+                     resets = <&rst CAN0_RESET>;
                      status = "disabled";
              };
 
@@ -108,6 +110,7 @@
                      reg = <0xffc01000 0x1000>;
                      interrupts = <0 135 4>, <0 136 4>, <0 137 4>, <0

138 4>;

Quoted 38 lines
arch/arm/dts/socfpga.dtsi +5 -0
                      clocks = <&can1_clk>;
+                     resets = <&rst CAN1_RESET>;
                      status = "disabled";
              };
 
@@ -585,6 +588,7 @@
                      compatible = "snps,dw-apb-gpio";
                      reg = <0xff708000 0x1000>;
                      clocks = <&l4_mp_clk>;
+                     resets = <&rst GPIO0_RESET>;
                      status = "disabled";
 
                      porta: gpio-controller at 0 {
@@ -605,6 +609,7 @@
                      compatible = "snps,dw-apb-gpio";
                      reg = <0xff709000 0x1000>;
                      clocks = <&l4_mp_clk>;
+                     resets = <&rst GPIO1_RESET>;
                      status = "disabled";
 
                      portb: gpio-controller at 0 {
@@ -625,6 +630,7 @@
                      compatible = "snps,dw-apb-gpio";
                      reg = <0xff70a000 0x1000>;
                      clocks = <&l4_mp_clk>;
+                     resets = <&rst GPIO2_RESET>;
                      status = "disabled";
 
                      portc: gpio-controller at 0 {
@@ -735,6 +741,7 @@
                      #size-cells = <0>;
                      clocks = <&l4_mp_clk>, <&sdmmc_clk_divided>;
                      clock-names = "biu", "ciu";
+                     resets = <&rst SDMMC_RESET>;
                      status = "disabled";
              };
 

arch/arm/dts/socfpga.dtsi line 756

Quoted 5 lines
arch/arm/dts/socfpga.dtsi +0 -1
@@ -746,9 +753,9 @@
                            <0xffb80000 0x10000>;
                      reg-names = "nand_data", "denali_reg";
                      interrupts = <0x0 0x90 0x4>;
-                     dma-mask = <0xffffffff>;
                      clocks = <&nand_clk>, <&nand_x_clk>,

<&nand_ecc_clk>;

Review

Quoted 79 lines
arch/arm/dts/socfpga.dtsi +10 -1
                      clock-names = "nand", "nand_x", "ecc";
+                     resets = <&rst NAND_RESET>;
                      status = "disabled";
              };
 
@@ -759,7 +766,7 @@
 
              qspi: spi at ff705000 {
                      compatible = "cdns,qspi-nor";
-                        #address-cells = <1>;
+                     #address-cells = <1>;
                      #size-cells = <0>;
                      reg = <0xff705000 0x1000>,
                            <0xffa00000 0x1000>;
@@ -768,6 +775,7 @@
                      cdns,fifo-width = <4>;
                      cdns,trigger-address = <0x00000000>;
                      clocks = <&qspi_clk>;
+                     resets = <&rst QSPI_RESET>;
                      status = "disabled";
              };
 
@@ -786,6 +794,7 @@
              sdr: sdr at ffc25000 {
                      compatible = "altr,sdr-ctl", "syscon";
                      reg = <0xffc25000 0x1000>;
+                     resets = <&rst SDR_RESET>;
              };
 
              sdramedac {
@@ -802,6 +811,7 @@
                      interrupts = <0 154 4>;
                      num-cs = <4>;
                      clocks = <&spi_m_clk>;
+                     resets = <&rst SPIM0_RESET>;
                      status = "disabled";
              };
 
@@ -813,6 +823,7 @@
                      interrupts = <0 155 4>;
                      num-cs = <4>;
                      clocks = <&spi_m_clk>;
+                     resets = <&rst SPIM1_RESET>;
                      status = "disabled";
              };
 
@@ -879,6 +890,7 @@
                      dmas = <&pdma 28>,
                             <&pdma 29>;
                      dma-names = "tx", "rx";
+                     resets = <&rst UART0_RESET>;
              };
 
              uart1: serial1 at ffc03000 {
@@ -891,6 +903,7 @@
                      dmas = <&pdma 30>,
                             <&pdma 31>;
                      dma-names = "tx", "rx";
+                     resets = <&rst UART1_RESET>;
              };
 
              usbphy0: usbphy {
@@ -930,6 +943,7 @@
                      reg = <0xffd02000 0x1000>;
                      interrupts = <0 171 4>;
                      clocks = <&osc1>;
+                     resets = <&rst L4WD0_RESET>;
                      status = "disabled";
              };
 
@@ -938,6 +952,7 @@
                      reg = <0xffd03000 0x1000>;
                      interrupts = <0 172 4>;
                      clocks = <&osc1>;
+                     resets = <&rst L4WD1_RESET>;
                      status = "disabled";
              };
      };
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_cyclone5_socrates.dts

Quoted 9 lines

index 93c3fa4a48..8d5d3996f6 100644

arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -1
@@ -76,7 +76,6 @@
 
 &qspi {
      status = "okay";
-     u-boot,dm-pre-reloc;
 
Quoted 10 lines

arch/arm/dts/socfpga_cyclone5_socrates.dts line 94

Quoted 7 lines
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -1
      flash: flash at 0 {
              #address-cells = <1>;
@@ -91,6 +90,5 @@
              cdns,tchsh-ns = <4>;
              cdns,tslch-ns = <4>;
              status = "okay";
-             u-boot,dm-pre-reloc;

Is this intended ?

Yes, see the commit message. We have it in a U-Boot specific overlay and this is a sync to Linux patch.

Regards,
Simon

Quoted 5 lines
Quoted 3 lines
arch/arm/dts/socfpga_cyclone5_socrates.dts +0 -0
      };
 };
#4 lore raw

PATCH v2 1/8 arm: socfpga: gen5: sync devicetrees to Linux

Quoted 196 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This is again a sync to linux-next + pending patches in Dinh's tree at
    > commit 1c909b2dfe6a ("ARM: dts: socfpga: update more missing reset
    > properties")'
    >
    > It adds missing peripheral reset properties to socfpga.dtsi and
    removes
    > U-Boot specific leftovers from socfpga_cyclone5_socrates.dts.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - cleanly merged Linux dts (moved change of SDR controller base
    address
    >   to a separate patch)
    >
    >  arch/arm/dts/socfpga.dtsi                  | 19 +++++++++++++++++--
    >  arch/arm/dts/socfpga_cyclone5_socrates.dts |  2 --
    >  2 files changed, 17 insertions(+), 4 deletions(-)
    >
    > diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi
    > index 2458d6707d..ec1966480f 100644
    > --- a/arch/arm/dts/socfpga.dtsi
    > +++ b/arch/arm/dts/socfpga.dtsi
    > @@ -84,6 +84,7 @@
    >                               #dma-requests = <32>;
    >                               clocks = <&l4_main_clk>;
    >                               clock-names = "apb_pclk";
    > +                             resets = <&rst DMA_RESET>;
    >                       };
    >               };
    > 
    > @@ -100,6 +101,7 @@
    >                       reg = <0xffc00000 0x1000>;
    >                       interrupts = <0 131 4>, <0 132 4>, <0 133
    4>, <0 134 4>;
    >                       clocks = <&can0_clk>;
    > +                     resets = <&rst CAN0_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -108,6 +110,7 @@
    >                       reg = <0xffc01000 0x1000>;
    >                       interrupts = <0 135 4>, <0 136 4>, <0 137
    4>, <0 138 4>;
    >                       clocks = <&can1_clk>;
    > +                     resets = <&rst CAN1_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -585,6 +588,7 @@
    >                       compatible = "snps,dw-apb-gpio";
    >                       reg = <0xff708000 0x1000>;
    >                       clocks = <&l4_mp_clk>;
    > +                     resets = <&rst GPIO0_RESET>;
    >                       status = "disabled";
    > 
    >                       porta: gpio-controller at 0 {
    > @@ -605,6 +609,7 @@
    >                       compatible = "snps,dw-apb-gpio";
    >                       reg = <0xff709000 0x1000>;
    >                       clocks = <&l4_mp_clk>;
    > +                     resets = <&rst GPIO1_RESET>;
    >                       status = "disabled";
    > 
    >                       portb: gpio-controller at 0 {
    > @@ -625,6 +630,7 @@
    >                       compatible = "snps,dw-apb-gpio";
    >                       reg = <0xff70a000 0x1000>;
    >                       clocks = <&l4_mp_clk>;
    > +                     resets = <&rst GPIO2_RESET>;
    >                       status = "disabled";
    > 
    >                       portc: gpio-controller at 0 {
    > @@ -735,6 +741,7 @@
    >                       #size-cells = <0>;
    >                       clocks = <&l4_mp_clk>, <&sdmmc_clk_divided>;
    >                       clock-names = "biu", "ciu";
    > +                     resets = <&rst SDMMC_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -746,9 +753,9 @@
    >                             <0xffb80000 0x10000>;
    >                       reg-names = "nand_data", "denali_reg";
    >                       interrupts = <0x0 0x90 0x4>;
    > -                     dma-mask = <0xffffffff>;
    >                       clocks = <&nand_clk>, <&nand_x_clk>,
    <&nand_ecc_clk>;
    >                       clock-names = "nand", "nand_x", "ecc";
    > +                     resets = <&rst NAND_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -759,7 +766,7 @@
    > 
    >               qspi: spi at ff705000 {
    >                       compatible = "cdns,qspi-nor";
    > -                        #address-cells = <1>;
    > +                     #address-cells = <1>;
    >                       #size-cells = <0>;
    >                       reg = <0xff705000 0x1000>,
    >                             <0xffa00000 0x1000>;
    > @@ -768,6 +775,7 @@
    >                       cdns,fifo-width = <4>;
    >                       cdns,trigger-address = <0x00000000>;
    >                       clocks = <&qspi_clk>;
    > +                     resets = <&rst QSPI_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -786,6 +794,7 @@
    >               sdr: sdr at ffc25000 {
    >                       compatible = "altr,sdr-ctl", "syscon";
    >                       reg = <0xffc25000 0x1000>;
    > +                     resets = <&rst SDR_RESET>;
    >               };
    > 
    >               sdramedac {
    > @@ -802,6 +811,7 @@
    >                       interrupts = <0 154 4>;
    >                       num-cs = <4>;
    >                       clocks = <&spi_m_clk>;
    > +                     resets = <&rst SPIM0_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -813,6 +823,7 @@
    >                       interrupts = <0 155 4>;
    >                       num-cs = <4>;
    >                       clocks = <&spi_m_clk>;
    > +                     resets = <&rst SPIM1_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -879,6 +890,7 @@
    >                       dmas = <&pdma 28>,
    >                              <&pdma 29>;
    >                       dma-names = "tx", "rx";
    > +                     resets = <&rst UART0_RESET>;
    >               };
    > 
    >               uart1: serial1 at ffc03000 {
    > @@ -891,6 +903,7 @@
    >                       dmas = <&pdma 30>,
    >                              <&pdma 31>;
    >                       dma-names = "tx", "rx";
    > +                     resets = <&rst UART1_RESET>;
    >               };
    > 
    >               usbphy0: usbphy {
    > @@ -930,6 +943,7 @@
    >                       reg = <0xffd02000 0x1000>;
    >                       interrupts = <0 171 4>;
    >                       clocks = <&osc1>;
    > +                     resets = <&rst L4WD0_RESET>;
    >                       status = "disabled";
    >               };
    > 
    > @@ -938,6 +952,7 @@
    >                       reg = <0xffd03000 0x1000>;
    >                       interrupts = <0 172 4>;
    >                       clocks = <&osc1>;
    > +                     resets = <&rst L4WD1_RESET>;
    >                       status = "disabled";
    >               };
    >       };
    > diff --git a/arch/arm/dts/socfpga_cyclone5_socrates.dts
    b/arch/arm/dts/socfpga_cyclone5_socrates.dts
    > index 93c3fa4a48..8d5d3996f6 100644
    > --- a/arch/arm/dts/socfpga_cyclone5_socrates.dts
    > +++ b/arch/arm/dts/socfpga_cyclone5_socrates.dts
    > @@ -76,7 +76,6 @@
    > 
    >  &qspi {
    >       status = "okay";
    > -     u-boot,dm-pre-reloc;
    > 
    >       flash: flash at 0 {
    >               #address-cells = <1>;
    > @@ -91,6 +90,5 @@
    >               cdns,tchsh-ns = <4>;
    >               cdns,tslch-ns = <4>;
    >               status = "okay";
    > -             u-boot,dm-pre-reloc;

    Is this intended ?
Quoted 2 lines

Yes, see the commit message. We have it in a U-Boot specific overlay and this is a sync to Linux patch.

OK

Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

In reply to Simon Goldschmidt

The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals, the reset node has to be provided with the SPL dts.

In preparation to move the DDR driver to DM, the sdr node is required in SPL, too.

This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon files so that the reset manager and SDR driver correctly probe in SPL.

---

Changes in v2: None

 arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 ++++++++
 11 files changed, 88 insertions(+)
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +8 -0
index c44d1ee2fa..8aaec56285 100644
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &watchdog0 {
 	status = "disabled";
 };
arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts +8 -0
index a387071674..61907771e0 100644
@@ -30,6 +30,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &gmac1 {
 	status = "okay";
 	phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi +8 -0
index 08d81da169..00434185f6 100644
@@ -16,6 +16,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &watchdog0 {
 	status = "disabled";
 };
arch/arm/dts/socfpga_cyclone5_de10_nano.dts +8 -0
index e9105743ea..dc84f3de26 100644
@@ -32,6 +32,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &gmac1 {
 	status = "okay";
 	phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_de1_soc.dts +8 -0
index 4f076bce93..585d914e30 100644
@@ -30,6 +30,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &gmac1 {
 	status = "okay";
 	phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_is1.dts +8 -0
index b7054bfd5a..8947128be9 100644
@@ -37,6 +37,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &gmac1 {
 	status = "okay";
 	phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi +8 -0
index 9436e0fa8b..13d44072f4 100644
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &can0 {
 	status = "okay";
 };
arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi +8 -0
index 648f1bd01d..07564a9f13 100644
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &watchdog0 {
 	status = "disabled";
 };
arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi +8 -0
index 31bd1dba0f..cf0eb8bb8c 100644
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &watchdog0 {
 	status = "disabled";
 };
arch/arm/dts/socfpga_cyclone5_sr1500.dts +8 -0
index 6a6c29be79..8a1678ed72 100644
@@ -33,6 +33,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &gmac1 {
 	status = "okay";
 	phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi +8 -0
index 360b946ba2..90d1fd8858 100644
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};
+
 &watchdog0 {
 	status = "disabled";
 };
Signature · 1 line
2.17.1
#6 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 33 lines · Simon Goldschmidt

The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals, the reset node has to be provided with the SPL dts.

In preparation to move the DDR driver to DM, the sdr node is required in SPL, too.

This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon files so that the reset manager and SDR driver correctly probe in SPL.

---

Changes in v2: None

 arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 ++++++++
 11 files changed, 88 insertions(+)
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +0 -0
index c44d1ee2fa..8aaec56285 100644

arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi line 26

Quoted 10 lines
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +7 -0
@@ -17,6 +17,14 @@
 	};
 };
 
+&rst {
+	u-boot,dm-pre-reloc;
+};
+
+&sdr {
+	u-boot,dm-pre-reloc;
+};

What about some socfpga-common-u-boot.dtsi to avoid duplication ?

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]> geschrieben:

Quoted 38 lines · Simon Goldschmidt
Quoted 28 lines

The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals, the reset node has to be provided with the SPL dts.

In preparation to move the DDR driver to DM, the sdr node is required in SPL, too.

This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon files so that the reset manager and SDR driver correctly probe in SPL.

---

Changes in v2: None

 arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8 ++++++++
 arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 ++++++++
 11 files changed, 88 insertions(+)

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi

Quoted 7 lines

index c44d1ee2fa..8aaec56285 100644

arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +0 -0
@@ -17,6 +17,14 @@
      };
 };
 
Quoted 10 lines

arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi line 26

Quoted 7 lines
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +7 -0
+&rst {
+     u-boot,dm-pre-reloc;
+};
+
+&sdr {
+     u-boot,dm-pre-reloc;
+};

What about some socfpga-common-u-boot.dtsi to avoid duplication ?

Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for gen10 as well. But your suggested name should work fine I guess.

Regards,
Simon

Quoted 1 line
#8 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 55 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > The SPL for socfpga gen5 currently takes all peripherals out of reset
    > unconditionally. To implement proper reset handling for peripherals,
    > the reset node has to be provided with the SPL dts.
    >
    > In preparation to move the DDR driver to DM, the sdr node is required
    > in SPL, too.
    >
    > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon
    > files so that the reset manager and SDR driver correctly probe in SPL.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2: None
    >
    >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8 ++++++++
    >  arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 ++++++++
    >  11 files changed, 88 insertions(+)
    >
    > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > index c44d1ee2fa..8aaec56285 100644
    > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > @@ -17,6 +17,14 @@
    >       };
    >  };
    > 
    > +&rst {
    > +     u-boot,dm-pre-reloc;
    > +};
    > +
    > +&sdr {
    > +     u-boot,dm-pre-reloc;
    > +};

    What about some socfpga-common-u-boot.dtsi to avoid duplication ?
Quoted 2 lines

Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for gen10 as well.

hot included ? I don't think I understand.

Quoted 5 lines

But your suggested name should work fine I guess.

Regards,
Simon

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected]> geschrieben:

Quoted 68 lines · Simon Goldschmidt
Quoted 7 lines

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> The SPL for socfpga gen5 currently takes all peripherals out of

reset

Quoted 1 line
Quoted 1 line

unconditionally. To implement proper reset handling for

peripherals,

Quoted 3 lines
Quoted 3 lines

the reset node has to be provided with the SPL dts.

In preparation to move the DDR driver to DM, the sdr node is

required

Quoted 4 lines
Quoted 4 lines

in SPL, too.

This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon files so that the reset manager and SDR driver correctly probe in

SPL.

Quoted 8 lines
Quoted 2 lines
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2: None
    >
    >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8

++++++++

Quoted 1 line
Quoted 1 line
 arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8

++++++++

Quoted 19 lines

Review

Quoted 3 lines
 11 files changed, 88 insertions(+)
(quoted diff) +0 -0
    b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > index c44d1ee2fa..8aaec56285 100644
    > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    > @@ -17,6 +17,14 @@
    >       };
    >  };
    >
    > +&rst {
    > +     u-boot,dm-pre-reloc;
    > +};
    > +
    > +&sdr {
    > +     u-boot,dm-pre-reloc;
    > +};
Quoted 8 lines
Quoted 5 lines

What about some socfpga-common-u-boot.dtsi to avoid duplication ?

Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for gen10 as well.

hot included ? I don't think I understand.

Argh. I'm writing from my mobile...

What I meant was that file got included by the automatism so I couldn't use it.

Regards,
Simon

Quoted 7 lines
Quoted 5 lines

But your suggested name should work fine I guess.

Regards,
Simon

#10 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 81 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
>
>
> Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>
> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>
>     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>     > The SPL for socfpga gen5 currently takes all peripherals out of reset
>     > unconditionally. To implement proper reset handling for peripherals,
>     > the reset node has to be provided with the SPL dts. >     >
>     > In preparation to move the DDR driver to DM, the sdr node is required
>     > in SPL, too.
>     >
>     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific dtsi addon
>     > files so that the reset manager and SDR driver correctly probe in SPL.
>     >
>     > Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>>
>     > ---
>     >
>     > Changes in v2: None
>     >
>     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8
++++++++
>     >  arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8
++++++++
>     >  11 files changed, 88 insertions(+)
>     >
>     > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>     > index c44d1ee2fa..8aaec56285 100644
>     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >     > @@ -17,6 +17,14 @@
>     >       };
>     >  };
>     >
>     > +&rst {
>     > +     u-boot,dm-pre-reloc;
>     > +};
>     > +
>     > +&sdr {
>     > +     u-boot,dm-pre-reloc;
>     > +};
>
>     What about some socfpga-common-u-boot.dtsi to avoid duplication ? >
>

Quoted 7 lines

> Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for > gen10 as well.

hot included ? I don't think I understand.

Argh. I'm writing from my mobile...

It can wait till tomorrow ...

Quoted 2 lines

What I meant was that file got included by the automatism so I couldn't use it.

Errr, which file ? What automatism ? Really, wait till tomorrow with a reply, please.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 89 lines · Marek Vasut
Quoted 87 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
    >
    >
    > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]
    <mailto:[email protected]>
    > <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
    >
    >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >     > The SPL for socfpga gen5 currently takes all peripherals out
    of reset
    >     > unconditionally. To implement proper reset handling for
    peripherals,
    >     > the reset node has to be provided with the SPL dts.
    >     >
    >     > In preparation to move the DDR driver to DM, the sdr node is
    required
    >     > in SPL, too.
    >     >
    >     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific
    dtsi addon
    >     > files so that the reset manager and SDR driver correctly
    probe in SPL.
    >     >
    >     > Signed-off-by: Simon Goldschmidt
    <[email protected]
    <mailto:[email protected]>
    >     <mailto:[email protected]
    <mailto:[email protected]>>>
    >     > ---
    >     >
    >     > Changes in v2: None
    >     >
    >     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8
    ++++++++
    >     >  11 files changed, 88 insertions(+)
    >     >
    >     > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > index c44d1ee2fa..8aaec56285 100644
    >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > @@ -17,6 +17,14 @@
    >     >       };
    >     >  };
    >     >
    >     > +&rst {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >     > +
    >     > +&sdr {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >
    >     What about some socfpga-common-u-boot.dtsi to avoid duplication ?
    >
    >
    > Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for
    > gen10 as well.

    hot included ? I don't think I understand.
Quoted 8 lines
Quoted 1 line

Argh. I'm writing from my mobile...

It can wait till tomorrow ...

Quoted 2 lines

What I meant was that file got included by the automatism so I couldn't use it.

Errr, which file ? What automatism ? Really, wait till tomorrow with a reply, please.

Let me try again: I started this patch with trying to centralize the "u-boot,dm-pre-reloc"
lines in one file named "socfpga-u-boot.dtsi" since it is valid for all gen5 devices
and including it automatically would be OK.

However, the automatism to search for a "-u-boot.dtsi" file caught that file also for
a10 and even s10 due to the lack of a more specific match.

In the end I dropped that idea and added it to all board dtsi files.

However, by using a name that doesn't match the automatism rules, I can centralize
these settings. I'll do that for V3.

Regards,
Simon

#12 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 109 lines · Simon Goldschmidt
Quoted 89 lines · Marek Vasut
Quoted 87 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
    >
    >
    > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]
    <mailto:[email protected]>
    > <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
    >
    >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >     > The SPL for socfpga gen5 currently takes all peripherals out
    of reset
    >     > unconditionally. To implement proper reset handling for
    peripherals,
    >     > the reset node has to be provided with the SPL dts.
    >     >
    >     > In preparation to move the DDR driver to DM, the sdr node is
    required
    >     > in SPL, too.
    >     >
    >     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific
    dtsi addon
    >     > files so that the reset manager and SDR driver correctly
    probe in SPL.
    >     >
    >     > Signed-off-by: Simon Goldschmidt
    <[email protected]
    <mailto:[email protected]>
    >     <mailto:[email protected]
    <mailto:[email protected]>>>
    >     > ---
    >     >
    >     > Changes in v2: None
    >     >
    >     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8
    ++++++++
    >     >  11 files changed, 88 insertions(+)
    >     >
    >     > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > index c44d1ee2fa..8aaec56285 100644
    >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > @@ -17,6 +17,14 @@
    >     >       };
    >     >  };
    >     >
    >     > +&rst {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >     > +
    >     > +&sdr {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >
    >     What about some socfpga-common-u-boot.dtsi to avoid duplication ?
    >
    >
    > Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for
    > gen10 as well.

    hot included ? I don't think I understand.
Quoted 8 lines
Quoted 1 line

Argh. I'm writing from my mobile...

It can wait till tomorrow ...

Quoted 2 lines

What I meant was that file got included by the automatism so I couldn't use it.

Errr, which file ? What automatism ? Really, wait till tomorrow with a reply, please.

Let me try again: I started this patch with trying to centralize the "u-boot,dm-pre-reloc"
lines in one file named "socfpga-u-boot.dtsi" since it is valid for all gen5 devices
and including it automatically would be OK.

However, the automatism to search for a "-u-boot.dtsi" file caught that file also for
a10 and even s10 due to the lack of a more specific match.

Quoted 5 lines

In the end I dropped that idea and added it to all board dtsi files.

However, by using a name that doesn't match the automatism rules, I can centralize
these settings. I'll do that for V3.

I think applying it on A10 would be fine too, dunno about S10.

Signature · 2 lines
Best regards,
Marek Vasut
#13 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected]> geschrieben:

Quoted 114 lines · Simon Goldschmidt
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Simon Goldschmidt
Quoted 8 lines

Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
    >
    >
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]

<mailto:[email protected]>
> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>
> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> > The SPL for socfpga gen5 currently takes all peripherals

out

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

of reset
> > unconditionally. To implement proper reset handling for
peripherals,
> > the reset node has to be provided with the SPL dts.
> >
> > In preparation to move the DDR driver to DM, the sdr node

is

Quoted 58 lines
Quoted 58 lines
Quoted 58 lines
    required
    >     > in SPL, too.
    >     >
    >     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific
    dtsi addon
    >     > files so that the reset manager and SDR driver correctly
    probe in SPL.
    >     >
    >     > Signed-off-by: Simon Goldschmidt
    <[email protected]
    <mailto:[email protected]>
    >     <mailto:[email protected]
    <mailto:[email protected]>>>
    >     > ---
    >     >
    >     > Changes in v2: None
    >     >
    >     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi          | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts             | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts            | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts              | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_is1.dts                  | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi        | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi       | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi     | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts               | 8
    ++++++++
    >     >  arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8
    ++++++++
    >     >  11 files changed, 88 insertions(+)
    >     >
    >     > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > index c44d1ee2fa..8aaec56285 100644
    >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >     > @@ -17,6 +17,14 @@
    >     >       };
    >     >  };
    >     >
    >     > +&rst {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >     > +
    >     > +&sdr {
    >     > +     u-boot,dm-pre-reloc;
    >     > +};
    >
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

What about some socfpga-common-u-boot.dtsi to avoid

duplication ?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Right. I tested with 'socfpga-u-boot.dtsi' but the hot included

for

Quoted 24 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

gen10 as well.

hot included ? I don't think I understand.

Quoted 8 lines
Quoted 1 line

Argh. I'm writing from my mobile...

It can wait till tomorrow ...

Quoted 2 lines

What I meant was that file got included by the automatism so I couldn't use it.

Errr, which file ? What automatism ? Really, wait till tomorrow with a reply, please.

Let me try again: I started this patch with trying to centralize the "u-boot,dm-pre-reloc"
lines in one file named "socfpga-u-boot.dtsi" since it is valid for all gen5 devices
and including it automatically would be OK.

However, the automatism to search for a "-u-boot.dtsi" file caught that file also for
a10 and even s10 due to the lack of a more specific match.

Quoted 8 lines
Quoted 5 lines

In the end I dropped that idea and added it to all board dtsi files.

However, by using a name that doesn't match the automatism rules, I can centralize
these settings. I'll do that for V3.

I think applying it on A10 would be fine too, dunno about S10.

S10 is where it failed compiling for me. A10 compiled OK but i could not test it. I guess going the safe way and applying for Gen5 only would be better.

Regards,
Simon

#14 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 147 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/22/19 7:20 AM, Simon Goldschmidt wrote:
> On Thu, Feb 21, 2019 at 11:13 PM Marek Vasut <[email protected] <mailto:[email protected]>> wrote:
>>
>> On 2/21/19 11:11 PM, Simon Goldschmidt wrote:
>>>
>>>
>>> Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected] <mailto:[email protected]>
>>> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>>>
>>>     On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
>>>     >
>>>     >
>>>     > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <marex at denx.de <mailto:[email protected]>
>>>     <mailto:marex at denx.de <mailto:[email protected]>>
>>>     > <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> geschrieben:
>>>     >
>>>     >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>>>     >     > The SPL for socfpga gen5 currently takes all peripherals out
>>>     of reset
>>>     >     > unconditionally. To implement proper reset handling for >>>     peripherals,
>>>     >     > the reset node has to be provided with the SPL dts. >>>     >     >
>>>     >     > In preparation to move the DDR driver to DM, the sdr node is
>>>     required
>>>     >     > in SPL, too.
>>>     >     >
>>>     >     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific >>>     dtsi addon
>>>     >     > files so that the reset manager and SDR driver correctly >>>     probe in SPL.
>>>     >     >
>>>     >     > Signed-off-by: Simon Goldschmidt
>>>     <[email protected] <mailto:[email protected]>
>>>     <mailto:[email protected] <mailto:[email protected]>>
>>>     >     <mailto:[email protected] <mailto:[email protected]>
>>>     <mailto:[email protected] <mailto:[email protected]>>>>
>>>     >     > ---
>>>     >     >
>>>     >     > Changes in v2: None
>>>     >     >
>>>     >     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 8
>>>     ++++++++
>>>     >     > arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 >>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts
    | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_is1.dts
    | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi | 8
>>>     ++++++++
>>>     >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts
   | 8
>>>     ++++++++
>>>     >     > arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 >>>     ++++++++
>>>     >     >  11 files changed, 88 insertions(+)
>>>     >     >
>>>     >     > diff --git a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>>>     >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >>>     >     > index c44d1ee2fa..8aaec56285 100644
>>>     >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >>>     >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >>>     >     > @@ -17,6 +17,14 @@
>>>     >     >       };
>>>     >     >  };
>>>     >     >
>>>     >     > +&rst {
>>>     >     > +     u-boot,dm-pre-reloc;
>>>     >     > +};
>>>     >     > +
>>>     >     > +&sdr {
>>>     >     > +     u-boot,dm-pre-reloc;
>>>     >     > +};
>>>     >
>>>     >     What about some socfpga-common-u-boot.dtsi to avoid duplication ?
>>>     >
>>>     >
>>>     > Right. I tested with 'socfpga-u-boot.dtsi' but the hot included for
>>>     > gen10 as well.
>>>
>>>     hot included ? I don't think I understand.
>>>
>>>
>>> Argh. I'm writing from my mobile...
>>
>> It can wait till tomorrow ...
>>
>>> What I meant was that file got included by the automatism so I couldn't
>>> use it.
>> Errr, which file ? What automatism ? Really, wait till tomorrow with a
>> reply, please.
>
> Let me try again: I started this patch with trying to centralize the > "u-boot,dm-pre-reloc"
> lines in one file named "socfpga-u-boot.dtsi" since it is valid for > all gen5 devices
> and including it automatically would be OK.
>
> However, the automatism to search for a "-u-boot.dtsi" file caught > that file also for
> a10 and even s10 due to the lack of a more specific match. >
> In the end I dropped that idea and added it to all board dtsi files. >
> However, by using a name that doesn't match the automatism rules, I > can centralize
> these settings. I'll do that for V3.

Quoted 6 lines

I think applying it on A10 would be fine too, dunno about S10.

S10 is where it failed compiling for me. A10 compiled OK but i could not test it. I guess going the safe way and applying for Gen5 only would be better.

Chee can test A10 for you.

What's the problem with S10 ?

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Am Fr., 22. Feb. 2019, 20:36 hat Marek Vasut <[email protected]> geschrieben:

Quoted 156 lines · Simon Goldschmidt
Quoted 22 lines

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/22/19 7:20 AM, Simon Goldschmidt wrote:
    > On Thu, Feb 21, 2019 at 11:13 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 2/21/19 11:11 PM, Simon Goldschmidt wrote:
    >>>
    >>>
    >>> Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <[email protected]
    <mailto:[email protected]>
    >>> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
    >>>
    >>>     On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
    >>>     >
    >>>     >
    >>>     > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut
    <marex at denx.de <mailto:[email protected]>
    >>>     <mailto:marex at denx.de <mailto:[email protected]>>
Quoted 8 lines
    >>>     > <mailto:marex at denx.de <mailto:[email protected]>
    <mailto:marex at denx.de <mailto:[email protected]>>>> geschrieben:
    >>>     >
    >>>     >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >>>     >     > The SPL for socfpga gen5 currently takes all
    peripherals out
    >>>     of reset
    >>>     >     > unconditionally. To implement proper reset handling

for

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

peripherals,
> > the reset node has to be provided with the SPL dts.
> >
> > In preparation to move the DDR driver to DM, the sdr

node is
>>> required
>>> > > in SPL, too.
>>> > >
>>> > > This patch adds "u-boot,dm-pre-reloc" to U-Boot

specific

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

dtsi addon
> > files so that the reset manager and SDR driver

correctly

Quoted 83 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

probe in SPL.
> >
> > Signed-off-by: Simon Goldschmidt
<[email protected]

    <mailto:[email protected]>
    >>>     <mailto:[email protected]
    <mailto:[email protected]>>
    >>>     >     <mailto:[email protected]
    <mailto:[email protected]>
    >>>     <mailto:[email protected]
    <mailto:[email protected]>>>>
    >>>     >     > ---
    >>>     >     >
    >>>     >     > Changes in v2: None
    >>>     >     >
    >>>     >     >  arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
        | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts
       | 8
    >>>     ++++++++
    >>>     >     >
    arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts
        | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts
        | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_is1.dts
        | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi
        | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi
       | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi
       | 8
    >>>     ++++++++
    >>>     >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts
       | 8
    >>>     ++++++++
    >>>     >     >
    arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8
    >>>     ++++++++
    >>>     >     >  11 files changed, 88 insertions(+)
    >>>     >     >
    >>>     >     > diff --git
    a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >>>     >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >>>     >     > index c44d1ee2fa..8aaec56285 100644
    >>>     >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >>>     >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
    >>>     >     > @@ -17,6 +17,14 @@
    >>>     >     >       };
    >>>     >     >  };
    >>>     >     >
    >>>     >     > +&rst {
    >>>     >     > +     u-boot,dm-pre-reloc;
    >>>     >     > +};
    >>>     >     > +
    >>>     >     > +&sdr {
    >>>     >     > +     u-boot,dm-pre-reloc;
    >>>     >     > +};
    >>>     >
    >>>     >     What about some socfpga-common-u-boot.dtsi to avoid
    duplication ?
    >>>     >
    >>>     >
    >>>     > Right. I tested with 'socfpga-u-boot.dtsi' but the hot
    included for
    >>>     > gen10 as well.
    >>>
    >>>     hot included ? I don't think I understand.
    >>>
    >>>
    >>> Argh. I'm writing from my mobile...
    >>
    >> It can wait till tomorrow ...
    >>
Quoted 8 lines
    >>> What I meant was that file got included by the automatism so I
    couldn't
    >>> use it.
    >> Errr, which file ? What automatism ? Really, wait till tomorrow
    with a
    >> reply, please.
    >
    > Let me try again: I started this patch with trying to centralize

the

Quoted 10 lines
Quoted 10 lines

"u-boot,dm-pre-reloc"
lines in one file named "socfpga-u-boot.dtsi" since it is valid for all gen5 devices
and including it automatically would be OK.

However, the automatism to search for a "-u-boot.dtsi" file caught that file also for
a10 and even s10 due to the lack of a more specific match.

In the end I dropped that idea and added it to all board dtsi

files.

Quoted 8 lines
Quoted 4 lines

However, by using a name that doesn't match the automatism rules, I can centralize
these settings. I'll do that for V3.

I think applying it on A10 would be fine too, dunno about S10.

Quoted 8 lines
Quoted 3 lines

S10 is where it failed compiling for me. A10 compiled OK but i could not test it. I guess going the safe way and applying for Gen5 only would be better.

Chee can test A10 for you.

What's the problem with S10 ?

I really can't remember. However, That would mean converting all socfpga drivers to UCLASS_RAM and moving them to drivers/ram. That would be a good thing, but I don't know when I would find the time for that...

Regards,
Simon

#16 lore raw

PATCH v2 2/8 arm: socfpga: gen5: add reset & sdr node to SPL devicetrees

Quoted 199 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 20:36 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/22/19 8:12 PM, Simon Goldschmidt wrote:
>
>
> Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>
> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>
>     On 2/22/19 7:20 AM, Simon Goldschmidt wrote:
>     > On Thu, Feb 21, 2019 at 11:13 PM Marek Vasut <[email protected] <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>> wrote:
>     >>
>     >> On 2/21/19 11:11 PM, Simon Goldschmidt wrote:
>     >>>
>     >>>
>     >>> Am Do., 21. Feb. 2019, 23:05 hat Marek Vasut <marex at denx.de <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>
>     >>> <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> geschrieben:
>     >>>
>     >>>     On 2/21/19 11:03 PM, Simon Goldschmidt wrote:
>     >>>     >
>     >>>     >
>     >>>     > Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut >     <marex at denx.de <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>
>     >>>     <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>
>     >>>     > <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>
>     <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>>> geschrieben:
>     >>>     >
>     >>>     >     On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>     >>>     >     > The SPL for socfpga gen5 currently takes all >     peripherals out
>     >>>     of reset
>     >>>     >     > unconditionally. To implement proper reset handling for
>     >>>     peripherals,
>     >>>     >     > the reset node has to be provided with the SPL dts.
>     >>>     >     >
>     >>>     >     > In preparation to move the DDR driver to DM, the sdr
>     node is
>     >>>     required
>     >>>     >     > in SPL, too.
>     >>>     >     >
>     >>>     >     > This patch adds "u-boot,dm-pre-reloc" to U-Boot specific
>     >>>     dtsi addon
>     >>>     >     > files so that the reset manager and SDR driver correctly
>     >>>     probe in SPL.
>     >>>     >     >
>     >>>     >     > Signed-off-by: Simon Goldschmidt
>     >>>     <[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>
>     >>>     <mailto:[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>>
>     >>>     >     <mailto:[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>
>     >>>     <mailto:[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>>>>
>     >>>     >     > ---
>     >>>     >     >
>     >>>     >     > Changes in v2: None
>     >>>     >     >
>     >>>     >     > arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>         | 8
>     >>>     ++++++++
>     >>>     >     >  arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts

>        | 8
>     >>>     ++++++++
>     >>>     >     >
>     arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 8 >     >>>     ++++++++
>     >>>     >     >  arch/arm/dts/socfpga_cyclone5_de10_nano.dts

>         | 8
>     >>>     ++++++++
>     >>>     >     >  arch/arm/dts/socfpga_cyclone5_de1_soc.dts

>         | 8
>     >>>     ++++++++
>     >>>     >     >  arch/arm/dts/socfpga_cyclone5_is1.dts

>         | 8
>     >>>     ++++++++
>     >>>     >     > arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi
>         | 8
>     >>>     ++++++++
>     >>>     >     > arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi
>        | 8
>     >>>     ++++++++
>     >>>     >     > arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi
>        | 8
>     >>>     ++++++++
>     >>>     >     >  arch/arm/dts/socfpga_cyclone5_sr1500.dts

>        | 8
>     >>>     ++++++++
>     >>>     >     >
>     arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi  | 8 >     >>>     ++++++++
>     >>>     >     >  11 files changed, 88 insertions(+)
>     >>>     >     >
>     >>>     >     > diff --git
>     a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>     >>>     >     b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi >     >>>     >     > index c44d1ee2fa..8aaec56285 100644
>     >>>     >     > --- a/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>     >>>     >     > +++ b/arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi
>     >>>     >     > @@ -17,6 +17,14 @@
>     >>>     >     >       };
>     >>>     >     >  };
>     >>>     >     >
>     >>>     >     > +&rst {
>     >>>     >     > +     u-boot,dm-pre-reloc;
>     >>>     >     > +};
>     >>>     >     > +
>     >>>     >     > +&sdr {
>     >>>     >     > +     u-boot,dm-pre-reloc;
>     >>>     >     > +};
>     >>>     >
>     >>>     >     What about some socfpga-common-u-boot.dtsi to avoid >     duplication ?
>     >>>     >
>     >>>     >
>     >>>     > Right. I tested with 'socfpga-u-boot.dtsi' but the hot >     included for
>     >>>     > gen10 as well.
>     >>>
>     >>>     hot included ? I don't think I understand.
>     >>>
>     >>>
>     >>> Argh. I'm writing from my mobile...
>     >>
>     >> It can wait till tomorrow ...
>     >>
>     >>> What I meant was that file got included by the automatism so I >     couldn't
>     >>> use it.
>     >> Errr, which file ? What automatism ? Really, wait till tomorrow >     with a
>     >> reply, please.
>     >
>     > Let me try again: I started this patch with trying to centralize the
>     > "u-boot,dm-pre-reloc"
>     > lines in one file named "socfpga-u-boot.dtsi" since it is valid for
>     > all gen5 devices
>     > and including it automatically would be OK.
>     >
>     > However, the automatism to search for a "-u-boot.dtsi" file caught
>     > that file also for
>     > a10 and even s10 due to the lack of a more specific match. >     >
>     > In the end I dropped that idea and added it to all board dtsi files.
>     >
>     > However, by using a name that doesn't match the automatism rules, I
>     > can centralize
>     > these settings. I'll do that for V3.
>
>     I think applying it on A10 would be fine too, dunno about S10. >
>
> S10 is where it failed compiling for me. A10 compiled OK but i could not
> test it. I guess going the safe way and applying for Gen5 only would be
> better.

Quoted 8 lines

Chee can test A10 for you.

What's the problem with S10 ?

I really can't remember. However, That would mean converting all socfpga drivers to UCLASS_RAM and moving them to drivers/ram. That would be a good thing, but I don't know when I would find the time for that...

Ah ... OK, then let's skip it for now. I'd like this series to land after 2019.04.

Signature · 2 lines
Best regards,
Marek Vasut
#17 lore raw

PATCH v2 3/8 arm: socfpga: move gen5 SDR driver to DM

In reply to Simon Goldschmidt

To clean up reset handling for socfpga gen5, port the DDR driver to DM using UCLASS_RAM and implement proper reset handling.

This gets us rid of one ad-hoc call to socfpga_per_reset().

The gen5 driver is implemented in 2 distinct files. One of it (containing the calibration training) is not touched much and is kept at using hard coded addresses since the code grows even more otherwise.

SPL is changed from calling hard into the DDR driver code to just probing UCLASS_RESET and UCLASS_RAM. It is happy after finding a RAM driver after that.

---

Changes in v2:
- port DDR driver to DM UCLASS_RAM
- don't change DDR calibration training driver (code got too big)
- use reset.h code instead of socfpga_per_reset()

 arch/arm/Kconfig                              |   2 +
 arch/arm/dts/socfpga.dtsi                     |   4 +-
 .../mach-socfpga/include/mach/sdram_gen5.h    |   4 -
 arch/arm/mach-socfpga/spl_gen5.c              |  29 ++--
 drivers/ddr/altera/Kconfig                    |   1 +
 drivers/ddr/altera/sdram_gen5.c               | 143 ++++++++++++++++--
 drivers/ddr/altera/sequencer.c                |   9 +-
 drivers/ddr/altera/sequencer.h                |  35 +++++
 8 files changed, 185 insertions(+), 42 deletions(-)
arch/arm/Kconfig +2 -0
index 455f06cfee..8ff4529095 100644
@@ -821,12 +821,14 @@ config ARCH_SOCFPGA
 	select DM_SERIAL
 	select ENABLE_ARM_SOC_BOOT0_HOOK if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select OF_CONTROL
+	select RAM if TARGET_SOCFPGA_GEN5
 	select SPL_DM_RESET if DM_RESET
 	select SPL_DM_SERIAL
 	select SPL_LIBCOMMON_SUPPORT
 	select SPL_LIBGENERIC_SUPPORT
 	select SPL_NAND_SUPPORT if SPL_NAND_DENALI
 	select SPL_OF_CONTROL
+	select SPL_RAM if TARGET_SOCFPGA_GEN5
 	select SPL_SEPARATE_BSS if TARGET_SOCFPGA_STRATIX10
 	select SPL_SERIAL_SUPPORT
 	select SPL_WATCHDOG_SUPPORT
arch/arm/dts/socfpga.dtsi +2 -2
index ec1966480f..51a6a51b53 100644
@@ -791,9 +791,9 @@
 			reg = <0xfffec000 0x100>;
 		};
 
-		sdr: sdr at ffc25000 {
+		sdr: sdr at ffc20000 {
 			compatible = "altr,sdr-ctl", "syscon";
-			reg = <0xffc25000 0x1000>;
+			reg = <0xffc20000 0x6000>;
 			resets = <&rst SDR_RESET>;
 		};
 
arch/arm/mach-socfpga/include/mach/sdram_gen5.h +0 -4
index a238d5d17f..c41208591a 100644
@@ -7,10 +7,6 @@
 
 #ifndef __ASSEMBLY__
 
-unsigned long sdram_calculate_size(void);
-int sdram_mmr_init_full(unsigned int sdr_phy_reg);
-int sdram_calibration_full(void);
-
 const struct socfpga_sdram_config *socfpga_get_sdram_config(void);
 
 void socfpga_get_seq_ac_init(const u32 **init, unsigned int *nelem);
arch/arm/mach-socfpga/spl_gen5.c +9 -20
index 4c9f7997be..1bff8cbfcf 100644
@@ -20,6 +20,7 @@
 #include <debug_uart.h>
 #include <fdtdec.h>
 #include <watchdog.h>
+#include <dm/uclass.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -66,9 +67,9 @@ u32 spl_boot_mode(const u32 boot_device)
 void board_init_f(ulong dummy)
 {
 	const struct cm_config *cm_default_cfg = cm_get_default_config();
-	unsigned long sdram_size;
 	unsigned long reg;
 	int ret;
+	struct udevice *dev;
 
 	/*
 	 * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -98,7 +99,6 @@ void board_init_f(ulong dummy)
 		socfpga_bridges_reset(1);
 	}
 
-	socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
 	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
 	socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
 
@@ -142,27 +142,16 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 
+	ret = uclass_get_device(UCLASS_RESET, 0, &dev);
+	if (ret)
+		debug("Reset init failed: %d\n", ret);
+
 	/* enable console uart printing */
 	preloader_console_init();
 
-	if (sdram_mmr_init_full(0xffffffff) != 0) {
-		puts("SDRAM init failed.\n");
-		hang();
-	}
-
-	debug("SDRAM: Calibrating PHY\n");
-	/* SDRAM calibration */
-	if (sdram_calibration_full() == 0) {
-		puts("SDRAM calibration failed.\n");
-		hang();
-	}
-
-	sdram_size = sdram_calculate_size();
-	debug("SDRAM: %ld MiB\n", sdram_size >> 20);
-
-	/* Sanity check ensure correct SDRAM size specified */
-	if (get_ram_size(0, sdram_size) != sdram_size) {
-		puts("SDRAM size check failed!\n");
+	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
+	if (ret) {
+		debug("DRAM init failed: %d\n", ret);
 		hang();
 	}
 
drivers/ddr/altera/Kconfig +1 -0
index 2b28a97f6e..7370d4133a 100644
@@ -1,5 +1,6 @@
 config ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver"
+	depends on RAM
 	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	help
 	  Enable DDR SDRAM controller for the SoCFPGA devices.
drivers/ddr/altera/sdram_gen5.c +128 -15

238 lines not on this page · raw message

drivers/ddr/altera/sequencer.c +8 -1
index 5e7a943b68..0e4526288e 100644
@@ -3705,12 +3705,19 @@ static void initialize_tracking(void)
 	       &sdr_reg_file->trk_rfsh);
 }
 
-int sdram_calibration_full(void)
+int sdram_calibration_full(struct socfpga_sdr *sdr)
 {
 	struct param_type my_param;
 	struct gbl_type my_gbl;
 	u32 pass;
 
+	/*
+	 * For size reasons, this file uses hard coded addresses.
+	 * Check if we are called with the correct address.
+	 */
+	if (sdr != (struct socfpga_sdr *)SOCFPGA_SDR_ADDRESS)
+		return -ENODEV;
+
 	memset(&my_param, 0, sizeof(my_param));
 	memset(&my_gbl, 0, sizeof(my_gbl));
 
drivers/ddr/altera/sequencer.h +35 -0
index a5760b03a5..d7f6935201 100644
@@ -223,4 +223,39 @@ struct socfpga_data_mgr {
 	u32	mem_t_add;
 	u32	t_rl_add;
 };
+
+/* This struct describes the controller @ SOCFPGA_SDR_ADDRESS */
+struct socfpga_sdr {
+	/* SDR_PHYGRP_SCCGRP_ADDRESS */
+	u8 _align1[0xe00];
+	/* SDR_PHYGRP_SCCGRP_ADDRESS | 0xe00 */
+	struct socfpga_sdr_scc_mgr sdr_scc_mgr;
+	u8 _align2[0x1bc];
+	/* SDR_PHYGRP_PHYMGRGRP_ADDRESS */
+	struct socfpga_phy_mgr_cmd phy_mgr_cmd;
+	u8 _align3[0x2c];
+	/* SDR_PHYGRP_PHYMGRGRP_ADDRESS | 0x40 */
+	struct socfpga_phy_mgr_cfg phy_mgr_cfg;
+	u8 _align4[0xfa0];
+	/* SDR_PHYGRP_RWMGRGRP_ADDRESS */
+	u8 rwmgr_grp[0x800];
+	/* SDR_PHYGRP_RWMGRGRP_ADDRESS | 0x800 */
+	struct socfpga_sdr_rw_load_manager sdr_rw_load_mgr_regs;
+	u8 _align5[0x3f0];
+	/* SDR_PHYGRP_RWMGRGRP_ADDRESS | 0xC00 */
+	struct socfpga_sdr_rw_load_jump_manager sdr_rw_load_jump_mgr_regs;
+	u8 _align6[0x13f0];
+	/* SDR_PHYGRP_DATAMGRGRP_ADDRESS */
+	struct socfpga_data_mgr data_mgr;
+	u8 _align7[0x7f0];
+	/* SDR_PHYGRP_REGFILEGRP_ADDRESS */
+	struct socfpga_sdr_reg_file sdr_reg_file;
+	u8 _align8[0x7c8];
+	/* SDR_CTRLGRP_ADDRESS */
+	struct socfpga_sdr_ctrl sdr_ctrl;
+	u8 _align9[0xea4];
+};
+
+int sdram_calibration_full(struct socfpga_sdr *sdr);
+
 #endif /* _SEQUENCER_H_ */
Signature · 1 line
2.17.1
#18 lore raw

PATCH v2 4/8 mtd: rawnand: denali: add reset handling

In reply to Simon Goldschmidt

This adds reset handling to the devicetree-enabled Denali NAND driver.

For backwards compatibility, only a warning is printed when failing to get reset handles.

---

Changes in v2:
- fix copy/paste issues
- add .remove callback to release the resets

 drivers/mtd/nand/raw/denali.h    |  2 ++
 drivers/mtd/nand/raw/denali_dt.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
drivers/mtd/nand/raw/denali.h +2 -0
index 019deda094..63ae828768 100644
@@ -10,6 +10,7 @@
 #include <linux/bitops.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/types.h>
+#include <reset.h>
 
 #define DEVICE_RESET				0x0
 #define     DEVICE_RESET__BANK(bank)			BIT(bank)
@@ -315,6 +316,7 @@ struct denali_nand_info {
 	void (*host_write)(struct denali_nand_info *denali, u32 addr, u32 data);
 	void (*setup_dma)(struct denali_nand_info *denali, dma_addr_t dma_addr,
 			  int page, int write);
+	struct reset_ctl_bulk resets;
 };
 
 #define DENALI_CAP_HW_ECC_FIXUP			BIT(0)
drivers/mtd/nand/raw/denali_dt.c +14 -0
index d384b974df..a92abca022 100644
@@ -131,15 +131,29 @@ static int denali_dt_probe(struct udevice *dev)
 		denali->clk_x_rate = 200000000;
 	}
 
+	ret = reset_get_bulk(dev, &denali->resets);
+	if (ret)
+		dev_warn(dev, "Can't get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&denali->resets);
+
 	return denali_init(denali);
 }
 
+static int denali_dt_remove(struct udevice *dev)
+{
+	struct denali_nand_info *denali = dev_get_priv(dev);
+
+	return reset_release_bulk(&denali->resets);
+}
+
 U_BOOT_DRIVER(denali_nand_dt) = {
 	.name = "denali-nand-dt",
 	.id = UCLASS_MISC,
 	.of_match = denali_nand_dt_ids,
 	.probe = denali_dt_probe,
 	.priv_auto_alloc_size = sizeof(struct denali_nand_info),
+	.remove = denali_dt_remove,
 };
 
 void board_nand_init(void)
Signature · 1 line
2.17.1
#19 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

In reply to Simon Goldschmidt

This adds reset handling to the cadence qspi driver.

For backwards compatibility, only a warning is printed when failing to get reset handles.

---

Changes in v2:
- add .remove callback to release the resets

 drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
 drivers/spi/cadence_qspi.h |  4 ++++
 2 files changed, 20 insertions(+)
drivers/spi/cadence_qspi.c +16 -0
index 11fce9c4fe..3bfa0201c4 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <malloc.h>
+#include <reset.h>
 #include <spi.h>
 #include <linux/errno.h>
 #include "cadence_qspi.h"
@@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice *bus)
 {
 	struct cadence_spi_platdata *plat = bus->platdata;
 	struct cadence_spi_priv *priv = dev_get_priv(bus);
+	int ret;
 
 	priv->regbase = plat->regbase;
 	priv->ahbbase = plat->ahbbase;
 
+	ret = reset_get_bulk(bus, &priv->resets);
+	if (ret)
+		dev_warn(bus, "Can't get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&priv->resets);
+
 	if (!priv->qspi_is_init) {
 		cadence_qspi_apb_controller_init(plat);
 		priv->qspi_is_init = 1;
@@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
 	return 0;
 }
 
+static int cadence_spi_remove(struct udevice *dev)
+{
+	struct cadence_spi_priv *priv = dev_get_priv(dev);
+
+	return reset_release_bulk(&priv->resets);
+}
+
 static int cadence_spi_set_mode(struct udevice *bus, uint mode)
 {
 	struct cadence_spi_priv *priv = dev_get_priv(bus);
@@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
 	.platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
 	.priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
 	.probe = cadence_spi_probe,
+	.remove = cadence_spi_remove,
 };
drivers/spi/cadence_qspi.h +4 -0
index 055900def0..d4ede6e15e 100644
@@ -7,6 +7,8 @@
 #ifndef __CADENCE_QSPI_H__
 #define __CADENCE_QSPI_H__
 
+#include <reset.h>
+
 #define CQSPI_IS_ADDR(cmd_len)		(cmd_len > 1 ? 1 : 0)
 
 #define CQSPI_NO_DECODER_MAX_CS		4
@@ -42,6 +44,8 @@ struct cadence_spi_priv {
 	unsigned int	qspi_calibrated_hz;
 	unsigned int	qspi_calibrated_cs;
 	unsigned int	previous_hz;
+
+	struct reset_ctl_bulk resets;
 };
 
 /* Functions call declaration */
Signature · 1 line
2.17.1
#20 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

Quoted 60 lines · Simon Goldschmidt

This adds reset handling to the cadence qspi driver.

For backwards compatibility, only a warning is printed when failing to get reset handles.

---

Changes in v2:
- add .remove callback to release the resets

 drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
 drivers/spi/cadence_qspi.h |  4 ++++
 2 files changed, 20 insertions(+)
drivers/spi/cadence_qspi.c +15 -0
index 11fce9c4fe..3bfa0201c4 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <malloc.h>
+#include <reset.h>
 #include <spi.h>
 #include <linux/errno.h>
 #include "cadence_qspi.h"
@@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice *bus)
 {
 	struct cadence_spi_platdata *plat = bus->platdata;
 	struct cadence_spi_priv *priv = dev_get_priv(bus);
+	int ret;
 
 	priv->regbase = plat->regbase;
 	priv->ahbbase = plat->ahbbase;
 
+	ret = reset_get_bulk(bus, &priv->resets);
+	if (ret)
+		dev_warn(bus, "Can't get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&priv->resets);
+
 	if (!priv->qspi_is_init) {
 		cadence_qspi_apb_controller_init(plat);
 		priv->qspi_is_init = 1;
@@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
 	return 0;
 }
 
+static int cadence_spi_remove(struct udevice *dev)
+{
+	struct cadence_spi_priv *priv = dev_get_priv(dev);
+
+	return reset_release_bulk(&priv->resets);
+}
+
 static int cadence_spi_set_mode(struct udevice *bus, uint mode)
 {
 	struct cadence_spi_priv *priv = dev_get_priv(bus);

drivers/spi/cadence_qspi.c U_BOOT_DRIVER(cadence_spi) = { · line 360

Quoted 4 lines
drivers/spi/cadence_qspi.c +1 -0
@@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
 	.platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
 	.priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
 	.probe = cadence_spi_probe,
+	.remove = cadence_spi_remove,

.remove() only ever gets executed for drivers setting DM_FLAG_OS_PREPARE flag. Fix this in the other drivers too.

Signature · 2 lines
Best regards,
Marek Vasut
#21 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]> geschrieben:

Quoted 60 lines · Simon Goldschmidt
Quoted 59 lines

This adds reset handling to the cadence qspi driver.

For backwards compatibility, only a warning is printed when failing to get reset handles.

---

Changes in v2:
- add .remove callback to release the resets

 drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
 drivers/spi/cadence_qspi.h |  4 ++++
 2 files changed, 20 insertions(+)
drivers/spi/cadence_qspi.c +15 -0
index 11fce9c4fe..3bfa0201c4 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <malloc.h>
+#include <reset.h>
 #include <spi.h>
 #include <linux/errno.h>
 #include "cadence_qspi.h"
@@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice *bus)
 {
      struct cadence_spi_platdata *plat = bus->platdata;
      struct cadence_spi_priv *priv = dev_get_priv(bus);
+     int ret;
 
      priv->regbase = plat->regbase;
      priv->ahbbase = plat->ahbbase;
 
+     ret = reset_get_bulk(bus, &priv->resets);
+     if (ret)
+             dev_warn(bus, "Can't get reset: %d\n", ret);
+     else
+             reset_deassert_bulk(&priv->resets);
+
      if (!priv->qspi_is_init) {
              cadence_qspi_apb_controller_init(plat);
              priv->qspi_is_init = 1;
@@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
      return 0;
 }
 
+static int cadence_spi_remove(struct udevice *dev)
+{
+     struct cadence_spi_priv *priv = dev_get_priv(dev);
+
+     return reset_release_bulk(&priv->resets);
+}
+
 static int cadence_spi_set_mode(struct udevice *bus, uint mode)
 {
      struct cadence_spi_priv *priv = dev_get_priv(bus);
Quoted 9 lines

drivers/spi/cadence_qspi.c U_BOOT_DRIVER(cadence_spi) = { · line 360

Quoted 5 lines
drivers/spi/cadence_qspi.c +1 -0
@@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
      .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
      .priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
      .probe = cadence_spi_probe,
+     .remove = cadence_spi_remove,

.remove() only ever gets executed for drivers setting DM_FLAG_OS_PREPARE flag. Fix this in the other drivers too.

Ehrm, I haven't checked, but is this common practice? Why doesn't it always get called?

Regards,
Simon

Quoted 1 line
#22 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

Quoted 77 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This adds reset handling to the cadence qspi driver.
    >
    > For backwards compatibility, only a warning is printed when failing to
    > get reset handles.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - add .remove callback to release the resets
    >
    >  drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
    >  drivers/spi/cadence_qspi.h |  4 ++++
    >  2 files changed, 20 insertions(+)
    >
    > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
    > index 11fce9c4fe..3bfa0201c4 100644
    > --- a/drivers/spi/cadence_qspi.c
    > +++ b/drivers/spi/cadence_qspi.c
    > @@ -8,6 +8,7 @@
    >  #include <dm.h>
    >  #include <fdtdec.h>
    >  #include <malloc.h>
    > +#include <reset.h>
    >  #include <spi.h>
    >  #include <linux/errno.h>
    >  #include "cadence_qspi.h"
    > @@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice
    *bus)
    >  {
    >       struct cadence_spi_platdata *plat = bus->platdata;
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > +     int ret;
    > 
    >       priv->regbase = plat->regbase;
    >       priv->ahbbase = plat->ahbbase;
    > 
    > +     ret = reset_get_bulk(bus, &priv->resets);
    > +     if (ret)
    > +             dev_warn(bus, "Can't get reset: %d\n", ret);
    > +     else
    > +             reset_deassert_bulk(&priv->resets);
    > +
    >       if (!priv->qspi_is_init) {
    >               cadence_qspi_apb_controller_init(plat);
    >               priv->qspi_is_init = 1;
    > @@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
    >       return 0;
    >  }
    > 
    > +static int cadence_spi_remove(struct udevice *dev)
    > +{
    > +     struct cadence_spi_priv *priv = dev_get_priv(dev);
    > +
    > +     return reset_release_bulk(&priv->resets);
    > +}
    > +
    >  static int cadence_spi_set_mode(struct udevice *bus, uint mode)
    >  {
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > @@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
    >       .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
    >       .priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
    >       .probe = cadence_spi_probe,
    > +     .remove = cadence_spi_remove,

    .remove() only ever gets executed for drivers setting DM_FLAG_OS_PREPARE
    flag. Fix this in the other drivers too.
Quoted 2 lines

Ehrm, I haven't checked, but is this common practice? Why doesn't it always get called?

That's how the code behaves. Probably to speed up booting the kernel on devices which don't need to be torn down.

Signature · 2 lines
Best regards,
Marek Vasut
#23 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

Quoted 79 lines · Marek Vasut
Quoted 77 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This adds reset handling to the cadence qspi driver.
    >
    > For backwards compatibility, only a warning is printed when failing to
    > get reset handles.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - add .remove callback to release the resets
    >
    >  drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
    >  drivers/spi/cadence_qspi.h |  4 ++++
    >  2 files changed, 20 insertions(+)
    >
    > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
    > index 11fce9c4fe..3bfa0201c4 100644
    > --- a/drivers/spi/cadence_qspi.c
    > +++ b/drivers/spi/cadence_qspi.c
    > @@ -8,6 +8,7 @@
    >  #include <dm.h>
    >  #include <fdtdec.h>
    >  #include <malloc.h>
    > +#include <reset.h>
    >  #include <spi.h>
    >  #include <linux/errno.h>
    >  #include "cadence_qspi.h"
    > @@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice
    *bus)
    >  {
    >       struct cadence_spi_platdata *plat = bus->platdata;
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > +     int ret;
    >
    >       priv->regbase = plat->regbase;
    >       priv->ahbbase = plat->ahbbase;
    >
    > +     ret = reset_get_bulk(bus, &priv->resets);
    > +     if (ret)
    > +             dev_warn(bus, "Can't get reset: %d\n", ret);
    > +     else
    > +             reset_deassert_bulk(&priv->resets);
    > +
    >       if (!priv->qspi_is_init) {
    >               cadence_qspi_apb_controller_init(plat);
    >               priv->qspi_is_init = 1;
    > @@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
    >       return 0;
    >  }
    >
    > +static int cadence_spi_remove(struct udevice *dev)
    > +{
    > +     struct cadence_spi_priv *priv = dev_get_priv(dev);
    > +
    > +     return reset_release_bulk(&priv->resets);
    > +}
    > +
    >  static int cadence_spi_set_mode(struct udevice *bus, uint mode)
    >  {
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > @@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
    >       .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
    >       .priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
    >       .probe = cadence_spi_probe,
    > +     .remove = cadence_spi_remove,

    .remove() only ever gets executed for drivers setting DM_FLAG_OS_PREPARE
    flag. Fix this in the other drivers too.
Quoted 5 lines
Quoted 2 lines

Ehrm, I haven't checked, but is this common practice? Why doesn't it always get called?

That's how the code behaves. Probably to speed up booting the kernel on devices which don't need to be torn down.

What surprises me is that the OS_PREPARE flag is used only for one spi driver and for 'mmc_blk' (but this is really new). Is it still the right thing to do? How could
this be one of the first drivers releasing its reset before boot? :-)

Regards,
Simon

#24 lore raw

PATCH v2 5/8 spi: cadence_qspi: add reset handling

Quoted 83 lines · Simon Goldschmidt
Quoted 82 lines · Marek Vasut
Quoted 79 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This adds reset handling to the cadence qspi driver.
    >
    > For backwards compatibility, only a warning is printed when failing to
    > get reset handles.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - add .remove callback to release the resets
    >
    >  drivers/spi/cadence_qspi.c | 16 ++++++++++++++++
    >  drivers/spi/cadence_qspi.h |  4 ++++
    >  2 files changed, 20 insertions(+)
    >
    > diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
    > index 11fce9c4fe..3bfa0201c4 100644
    > --- a/drivers/spi/cadence_qspi.c
    > +++ b/drivers/spi/cadence_qspi.c
    > @@ -8,6 +8,7 @@
    >  #include <dm.h>
    >  #include <fdtdec.h>
    >  #include <malloc.h>
    > +#include <reset.h>
    >  #include <spi.h>
    >  #include <linux/errno.h>
    >  #include "cadence_qspi.h"
    > @@ -154,10 +155,17 @@ static int cadence_spi_probe(struct udevice
    *bus)
    >  {
    >       struct cadence_spi_platdata *plat = bus->platdata;
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > +     int ret;
    >
    >       priv->regbase = plat->regbase;
    >       priv->ahbbase = plat->ahbbase;
    >
    > +     ret = reset_get_bulk(bus, &priv->resets);
    > +     if (ret)
    > +             dev_warn(bus, "Can't get reset: %d\n", ret);
    > +     else
    > +             reset_deassert_bulk(&priv->resets);
    > +
    >       if (!priv->qspi_is_init) {
    >               cadence_qspi_apb_controller_init(plat);
    >               priv->qspi_is_init = 1;
    > @@ -166,6 +174,13 @@ static int cadence_spi_probe(struct udevice *bus)
    >       return 0;
    >  }
    >
    > +static int cadence_spi_remove(struct udevice *dev)
    > +{
    > +     struct cadence_spi_priv *priv = dev_get_priv(dev);
    > +
    > +     return reset_release_bulk(&priv->resets);
    > +}
    > +
    >  static int cadence_spi_set_mode(struct udevice *bus, uint mode)
    >  {
    >       struct cadence_spi_priv *priv = dev_get_priv(bus);
    > @@ -342,4 +357,5 @@ U_BOOT_DRIVER(cadence_spi) = {
    >       .platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
    >       .priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
    >       .probe = cadence_spi_probe,
    > +     .remove = cadence_spi_remove,

    .remove() only ever gets executed for drivers setting DM_FLAG_OS_PREPARE
    flag. Fix this in the other drivers too.

Ehrm, I haven't checked, but is this common practice? Why doesn't it always get called?

Quoted 7 lines
Quoted 2 lines

That's how the code behaves. Probably to speed up booting the kernel on devices which don't need to be torn down.

What surprises me is that the OS_PREPARE flag is used only for one spi driver and for 'mmc_blk' (but this is really new). Is it still the right thing to do? How could
this be one of the first drivers releasing its reset before boot? :-)

I suspect this might be an area for improvement :)

Signature · 2 lines
Best regards,
Marek Vasut
#25 lore raw

PATCH v2 6/8 reset: socfpga: add reset handling for old kernels

In reply to Simon Goldschmidt

This adds code to take peripherals out of reset based on an environment variable. This is in preparation for removing the code that does this from SPL.

However, some drivers even in current Linux cannot handle peripheral reset, so until this works, we need a compatibility workaround.

This workaround is implemented in the 'remove' callback of this reset driver, which is called on OS_PREPARE: it checks if the environment variable "socfpga_permodrst_ungate" - if it is set to 1, it deasserts all peripheral resets, which is what the gen5 SPL did up to now.

This is in preparation to clean up the SPL and implementing proper reset handling for U-Boot.

---

Changes in v2:
- moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment variable "socfpga_permodrst_ungate"

 drivers/reset/reset-socfpga.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/reset/reset-socfpga.c +34 -0
index b2acfcd2ec..749f671e05 100644
@@ -89,6 +89,36 @@ static int socfpga_reset_probe(struct udevice *dev)
 	return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
+/*
+ * This remove function is called before starting OS to deassert peripheral
+ * resets for Kernels that don't support this.
+ *
+ * The reset driver checks the environment variable "socfpga_permodrst_ungate"
+ * when it is removed. If this variable is '1', all peripherals in 'permodrst'
+ * are taken out of reset before booting into the OS.
+ * This should be required for gen5 systems only that are running Linux kernels
+ * without proper peripheral reset support for all drivers used.
+ */
+static int socfpga_reset_remove(struct udevice *dev)
+{
+	struct socfpga_reset_data *data = dev_get_priv(dev);
+	const char *env_str;
+	long val;
+
+	env_str = env_get("socfpga_permodrst_ungate");
+	if (env_str) {
+		val = simple_strtol(env_str, NULL, 0);
+		if (val == 1) {
+			puts("Deasserting all peripheral resets\n");
+			writel(0, data->membase + 4);
+		}
+	}
+
+	return 0;
+}
+#endif
+
 static const struct udevice_id socfpga_reset_match[] = {
 	{ .compatible = "altr,rst-mgr" },
 	{ /* sentinel */ },
@@ -101,4 +131,8 @@ U_BOOT_DRIVER(socfpga_reset) = {
 	.probe = socfpga_reset_probe,
 	.priv_auto_alloc_size = sizeof(struct socfpga_reset_data),
 	.ops = &socfpga_reset_ops,
+#ifndef CONFIG_SPL_BUILD
+	.remove = socfpga_reset_remove,
+	.flags	= DM_FLAG_OS_PREPARE,
+#endif
 };
Signature · 1 line
2.17.1
#26 lore raw

PATCH v2 6/8 reset: socfpga: add reset handling for old kernels

Quoted 67 lines · Simon Goldschmidt

This adds code to take peripherals out of reset based on an environment variable. This is in preparation for removing the code that does this from SPL.

However, some drivers even in current Linux cannot handle peripheral reset, so until this works, we need a compatibility workaround.

This workaround is implemented in the 'remove' callback of this reset driver, which is called on OS_PREPARE: it checks if the environment variable "socfpga_permodrst_ungate" - if it is set to 1, it deasserts all peripheral resets, which is what the gen5 SPL did up to now.

This is in preparation to clean up the SPL and implementing proper reset handling for U-Boot.

---

Changes in v2:
- moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment variable "socfpga_permodrst_ungate"

 drivers/reset/reset-socfpga.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/reset/reset-socfpga.c +30 -0
index b2acfcd2ec..749f671e05 100644
@@ -89,6 +89,36 @@ static int socfpga_reset_probe(struct udevice *dev)
 	return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
+/*
+ * This remove function is called before starting OS to deassert peripheral
+ * resets for Kernels that don't support this.
+ *
+ * The reset driver checks the environment variable "socfpga_permodrst_ungate"
+ * when it is removed. If this variable is '1', all peripherals in 'permodrst'
+ * are taken out of reset before booting into the OS.
+ * This should be required for gen5 systems only that are running Linux kernels
+ * without proper peripheral reset support for all drivers used.
+ */
+static int socfpga_reset_remove(struct udevice *dev)
+{
+	struct socfpga_reset_data *data = dev_get_priv(dev);
+	const char *env_str;
+	long val;
+
+	env_str = env_get("socfpga_permodrst_ungate");
+	if (env_str) {
+		val = simple_strtol(env_str, NULL, 0);
+		if (val == 1) {
+			puts("Deasserting all peripheral resets\n");
+			writel(0, data->membase + 4);
+		}
+	}
+
+	return 0;
+}
+#endif
+
 static const struct udevice_id socfpga_reset_match[] = {
 	{ .compatible = "altr,rst-mgr" },
 	{ /* sentinel */ },

drivers/reset/reset-socfpga.c U_BOOT_DRIVER(socfpga_reset) = { · line 138

Quoted 8 lines
drivers/reset/reset-socfpga.c +4 -0
@@ -101,4 +131,8 @@ U_BOOT_DRIVER(socfpga_reset) = {
 	.probe = socfpga_reset_probe,
 	.priv_auto_alloc_size = sizeof(struct socfpga_reset_data),
 	.ops = &socfpga_reset_ops,
+#ifndef CONFIG_SPL_BUILD
+	.remove = socfpga_reset_remove,
+	.flags	= DM_FLAG_OS_PREPARE,
+#endif
 };

Does this work if you use Falcon mode ? :)

Signature · 2 lines
Best regards,
Marek Vasut
#27 lore raw

PATCH v2 6/8 reset: socfpga: add reset handling for old kernels

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]> geschrieben:

Quoted 77 lines · Simon Goldschmidt
Quoted 2 lines

This adds code to take peripherals out of reset based on an environment variable. This is in preparation for removing the code that does this

from

Quoted 3 lines

SPL.

However, some drivers even in current Linux cannot handle peripheral

reset,

Quoted 13 lines

so until this works, we need a compatibility workaround.

This workaround is implemented in the 'remove' callback of this reset driver, which is called on OS_PREPARE: it checks if the environment variable "socfpga_permodrst_ungate" - if it is set to 1, it deasserts all peripheral resets, which is what the gen5 SPL did up to now.

This is in preparation to clean up the SPL and implementing proper reset handling for U-Boot.

---

Review

Quoted 8 lines

Changes in v2:
- moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment variable "socfpga_permodrst_ungate"

 drivers/reset/reset-socfpga.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
(quoted diff) +0 -0

b/drivers/reset/reset-socfpga.c

drivers/reset/reset-socfpga.c static int socfpga_reset_probe(struct udevice *dev) · line 94

Quoted 10 lines

index b2acfcd2ec..749f671e05 100644

drivers/reset/reset-socfpga.c +3 -0
@@ -89,6 +89,36 @@ static int socfpga_reset_probe(struct udevice *dev)
      return 0;
 }
 
+#ifndef CONFIG_SPL_BUILD
+/*
+ * This remove function is called before starting OS to deassert

peripheral

drivers/reset/reset-socfpga.c static int socfpga_reset_probe(struct udevice *dev)

Quoted 3 lines
drivers/reset/reset-socfpga.c +3 -0
+ * resets for Kernels that don't support this.
+ *
+ * The reset driver checks the environment variable

"socfpga_permodrst_ungate"

drivers/reset/reset-socfpga.c static int socfpga_reset_probe(struct udevice *dev) · line 98

Quoted 1 line
drivers/reset/reset-socfpga.c +1 -0
+ * when it is removed. If this variable is '1', all peripherals in

'permodrst'

drivers/reset/reset-socfpga.c static int socfpga_reset_probe(struct udevice *dev) · line 100

Quoted 2 lines
drivers/reset/reset-socfpga.c +2 -0
+ * are taken out of reset before booting into the OS.
+ * This should be required for gen5 systems only that are running Linux

kernels

Quoted 27 lines
drivers/reset/reset-socfpga.c +21 -0
+ * without proper peripheral reset support for all drivers used.
+ */
+static int socfpga_reset_remove(struct udevice *dev)
+{
+     struct socfpga_reset_data *data = dev_get_priv(dev);
+     const char *env_str;
+     long val;
+
+     env_str = env_get("socfpga_permodrst_ungate");
+     if (env_str) {
+             val = simple_strtol(env_str, NULL, 0);
+             if (val == 1) {
+                     puts("Deasserting all peripheral resets\n");
+                     writel(0, data->membase + 4);
+             }
+     }
+
+     return 0;
+}
+#endif
+
 static const struct udevice_id socfpga_reset_match[] = {
      { .compatible = "altr,rst-mgr" },
      { /* sentinel */ },
@@ -101,4 +131,8 @@ U_BOOT_DRIVER(socfpga_reset) = {
      .probe = socfpga_reset_probe,
      .priv_auto_alloc_size = sizeof(struct socfpga_reset_data),
Quoted 9 lines

drivers/reset/reset-socfpga.c U_BOOT_DRIVER(socfpga_reset) = { · line 138

Quoted 6 lines
drivers/reset/reset-socfpga.c +4 -0
      .ops = &socfpga_reset_ops,
+#ifndef CONFIG_SPL_BUILD
+     .remove = socfpga_reset_remove,
+     .flags  = DM_FLAG_OS_PREPARE,
+#endif
 };

Does this work if you use Falcon mode ? :)

Probably not, but would anyone be able to use falcon mode in socfpga gen5 given the current SPL size? I think it didn't fit for,a last time I checked.

And if it fits in the future, we probably don't need this workaraound any more...

I did it like that since env_get() broke compilation of SPL. But if you insist of making this work even for SPL, I'll check again.

Regards,
Simon

Quoted 1 line
#28 lore raw

PATCH v2 6/8 reset: socfpga: add reset handling for old kernels

Quoted 96 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This adds code to take peripherals out of reset based on an
    environment
    > variable. This is in preparation for removing the code that does
    this from
    > SPL.
    >
    > However, some drivers even in current Linux cannot handle
    peripheral reset,
    > so until this works, we need a compatibility workaround.
    >
    > This workaround is implemented in the 'remove' callback of this reset
    > driver, which is called on OS_PREPARE: it checks if the environment
    > variable "socfpga_permodrst_ungate" - if it is set to 1, it
    deasserts all
    > peripheral resets, which is what the gen5 SPL did up to now.
    >
    > This is in preparation to clean up the SPL and implementing proper
    reset
    > handling for U-Boot.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment
    >   variable "socfpga_permodrst_ungate"
    >
    >  drivers/reset/reset-socfpga.c | 34 ++++++++++++++++++++++++++++++++++
    >  1 file changed, 34 insertions(+)
    >
    > diff --git a/drivers/reset/reset-socfpga.c
    b/drivers/reset/reset-socfpga.c
    > index b2acfcd2ec..749f671e05 100644
    > --- a/drivers/reset/reset-socfpga.c
    > +++ b/drivers/reset/reset-socfpga.c
    > @@ -89,6 +89,36 @@ static int socfpga_reset_probe(struct udevice *dev)
    >       return 0;
    >  }
    > 
    > +#ifndef CONFIG_SPL_BUILD
    > +/*
    > + * This remove function is called before starting OS to deassert
    peripheral
    > + * resets for Kernels that don't support this.
    > + *
    > + * The reset driver checks the environment variable
    "socfpga_permodrst_ungate"
    > + * when it is removed. If this variable is '1', all peripherals
    in 'permodrst'
    > + * are taken out of reset before booting into the OS.
    > + * This should be required for gen5 systems only that are running
    Linux kernels
    > + * without proper peripheral reset support for all drivers used.
    > + */
    > +static int socfpga_reset_remove(struct udevice *dev)
    > +{
    > +     struct socfpga_reset_data *data = dev_get_priv(dev);
    > +     const char *env_str;
    > +     long val;
    > +
    > +     env_str = env_get("socfpga_permodrst_ungate");
    > +     if (env_str) {
    > +             val = simple_strtol(env_str, NULL, 0);
    > +             if (val == 1) {
    > +                     puts("Deasserting all peripheral resets\n");
    > +                     writel(0, data->membase + 4);
    > +             }
    > +     }
    > +
    > +     return 0;
    > +}
    > +#endif
    > +
    >  static const struct udevice_id socfpga_reset_match[] = {
    >       { .compatible = "altr,rst-mgr" },
    >       { /* sentinel */ },
    > @@ -101,4 +131,8 @@ U_BOOT_DRIVER(socfpga_reset) = {
    >       .probe = socfpga_reset_probe,
    >       .priv_auto_alloc_size = sizeof(struct socfpga_reset_data),
    >       .ops = &socfpga_reset_ops,
    > +#ifndef CONFIG_SPL_BUILD
    > +     .remove = socfpga_reset_remove,
    > +     .flags  = DM_FLAG_OS_PREPARE,
    > +#endif
    >  };

    Does this work if you use Falcon mode ? :)
Quoted 3 lines

Probably not, but would anyone be able to use falcon mode in socfpga gen5 given the current SPL size? I think it didn't fit for,a last time I checked.

If you cut it down, why not ?

Quoted 5 lines

And if it fits in the future, we probably don't need this workaraound any more...

I did it like that since env_get() broke compilation of SPL. But if you insist of making this work even for SPL, I'll check again.

SPL can also check env, so some more conditionals need to be added. Should be a matter of some CONFIG_IS_ENABLED()

Signature · 2 lines
Best regards,
Marek Vasut
#29 lore raw

PATCH v2 6/8 reset: socfpga: add reset handling for old kernels

Quoted 104 lines · Marek Vasut
Quoted 96 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    > This adds code to take peripherals out of reset based on an
    environment
    > variable. This is in preparation for removing the code that does
    this from
    > SPL.
    >
    > However, some drivers even in current Linux cannot handle
    peripheral reset,
    > so until this works, we need a compatibility workaround.
    >
    > This workaround is implemented in the 'remove' callback of this reset
    > driver, which is called on OS_PREPARE: it checks if the environment
    > variable "socfpga_permodrst_ungate" - if it is set to 1, it
    deasserts all
    > peripheral resets, which is what the gen5 SPL did up to now.
    >
    > This is in preparation to clean up the SPL and implementing proper
    reset
    > handling for U-Boot.
    >
    > Signed-off-by: Simon Goldschmidt <[email protected]
    <mailto:[email protected]>>
    > ---
    >
    > Changes in v2:
    > - moved from Kernel option "OLD_SOCFPGA_KERNEL_COMPAT" to environment
    >   variable "socfpga_permodrst_ungate"
    >
    >  drivers/reset/reset-socfpga.c | 34 ++++++++++++++++++++++++++++++++++
    >  1 file changed, 34 insertions(+)
    >
    > diff --git a/drivers/reset/reset-socfpga.c
    b/drivers/reset/reset-socfpga.c
    > index b2acfcd2ec..749f671e05 100644
    > --- a/drivers/reset/reset-socfpga.c
    > +++ b/drivers/reset/reset-socfpga.c
    > @@ -89,6 +89,36 @@ static int socfpga_reset_probe(struct udevice *dev)
    >       return 0;
    >  }
    >
    > +#ifndef CONFIG_SPL_BUILD
    > +/*
    > + * This remove function is called before starting OS to deassert
    peripheral
    > + * resets for Kernels that don't support this.
    > + *
    > + * The reset driver checks the environment variable
    "socfpga_permodrst_ungate"
    > + * when it is removed. If this variable is '1', all peripherals
    in 'permodrst'
    > + * are taken out of reset before booting into the OS.
    > + * This should be required for gen5 systems only that are running
    Linux kernels
    > + * without proper peripheral reset support for all drivers used.
    > + */
    > +static int socfpga_reset_remove(struct udevice *dev)
    > +{
    > +     struct socfpga_reset_data *data = dev_get_priv(dev);
    > +     const char *env_str;
    > +     long val;
    > +
    > +     env_str = env_get("socfpga_permodrst_ungate");
    > +     if (env_str) {
    > +             val = simple_strtol(env_str, NULL, 0);
    > +             if (val == 1) {
    > +                     puts("Deasserting all peripheral resets\n");
    > +                     writel(0, data->membase + 4);
    > +             }
    > +     }
    > +
    > +     return 0;
    > +}
    > +#endif
    > +
    >  static const struct udevice_id socfpga_reset_match[] = {
    >       { .compatible = "altr,rst-mgr" },
    >       { /* sentinel */ },
    > @@ -101,4 +131,8 @@ U_BOOT_DRIVER(socfpga_reset) = {
    >       .probe = socfpga_reset_probe,
    >       .priv_auto_alloc_size = sizeof(struct socfpga_reset_data),
    >       .ops = &socfpga_reset_ops,
    > +#ifndef CONFIG_SPL_BUILD
    > +     .remove = socfpga_reset_remove,
    > +     .flags  = DM_FLAG_OS_PREPARE,
    > +#endif
    >  };

    Does this work if you use Falcon mode ? :)
Quoted 3 lines

Probably not, but would anyone be able to use falcon mode in socfpga gen5 given the current SPL size? I think it didn't fit for,a last time I checked.

If you cut it down, why not ?

Quoted 8 lines
Quoted 5 lines

And if it fits in the future, we probably don't need this workaraound any more...

I did it like that since env_get() broke compilation of SPL. But if you insist of making this work even for SPL, I'll check again.

SPL can also check env, so some more conditionals need to be added. Should be a matter of some CONFIG_IS_ENABLED()

OK, I'll try that for V3.

Regards,
Simon

#30 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

In reply to Simon Goldschmidt

To keep the current behaviour of taking all peripherals out of reset before booting the OS before removing that code from socfpga gen5 SPL, this enables the new behaviour by default for all gen5 boards by adding the environment variable "socfpga_permodrst_ungate=1" to the default environment.

This can be overridden in board config files or by saving an environment without this variable enabled.

---

Changes in v2:
- this patch is new in v2

 include/configs/socfpga_common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
include/configs/socfpga_common.h +14 -0
index c9cbf8f5e3..2510c6fd7b 100644
@@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 
 #include <config_distro_bootcmd.h>
 
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
+/*
+ * Handle compatibility for peripheral reset for Linux kernels that haven't
+ * implemented peripheral reset for all drivers.
+ * Define this to "" disable this compatibility.
+ */
+#ifndef SOCFPGA_PERMODRST_UNGATE
+#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
+#endif
+#else
+#define SOCFPGA_PERMODRST_UNGATE ""
+#endif
+
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
@@ -330,6 +343,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 	"scriptaddr=0x02100000\0" \
 	"pxefile_addr_r=0x02200000\0" \
 	"ramdisk_addr_r=0x02300000\0" \
+	SOCFPGA_PERMODRST_UNGATE \
 	BOOTENV
 
 #endif
Signature · 1 line
2.17.1
#31 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

Quoted 28 lines · Simon Goldschmidt

To keep the current behaviour of taking all peripherals out of reset before booting the OS before removing that code from socfpga gen5 SPL, this enables the new behaviour by default for all gen5 boards by adding the environment variable "socfpga_permodrst_ungate=1" to the default environment.

This can be overridden in board config files or by saving an environment without this variable enabled.

---

Changes in v2:
- this patch is new in v2

 include/configs/socfpga_common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
include/configs/socfpga_common.h +2 -0
index c9cbf8f5e3..2510c6fd7b 100644
@@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 
 #include <config_distro_bootcmd.h>
 
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
+/*

include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 335

Quoted 10 lines
include/configs/socfpga_common.h +10 -0
+ * Handle compatibility for peripheral reset for Linux kernels that haven't
+ * implemented peripheral reset for all drivers.
+ * Define this to "" disable this compatibility.
+ */
+#ifndef SOCFPGA_PERMODRST_UNGATE
+#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
+#endif
+#else
+#define SOCFPGA_PERMODRST_UNGATE ""
+#endif

Just add this socfpga_permodrst_ungate to the default end and drop all those macros/Kconfig options.

I think it'd be better to call it socfpga_legacy_reset_compat or something.

Quoted 12 lines
include/configs/socfpga_common.h +1 -0
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
@@ -330,6 +343,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 	"scriptaddr=0x02100000\0" \
 	"pxefile_addr_r=0x02200000\0" \
 	"ramdisk_addr_r=0x02300000\0" \
+	SOCFPGA_PERMODRST_UNGATE \
 	BOOTENV
 
 #endif
Signature · 2 lines
Best regards,
Marek Vasut
#32 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected]> geschrieben:

Quoted 32 lines · Simon Goldschmidt
Quoted 12 lines

To keep the current behaviour of taking all peripherals out of reset before booting the OS before removing that code from socfpga gen5 SPL, this enables the new behaviour by default for all gen5 boards by adding the environment variable "socfpga_permodrst_ungate=1" to the default environment.

This can be overridden in board config files or by saving an environment without this variable enabled.

---

Review

Quoted 7 lines

Changes in v2:
- this patch is new in v2

 include/configs/socfpga_common.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
(quoted diff) +0 -0

b/include/configs/socfpga_common.h

include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 326

Quoted 10 lines

index c9cbf8f5e3..2510c6fd7b 100644

include/configs/socfpga_common.h +3 -0
@@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 
 #include <config_distro_bootcmd.h>
 
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
+/*
+ * Handle compatibility for peripheral reset for Linux kernels that

haven't

Quoted 13 lines

include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 335

Quoted 9 lines
include/configs/socfpga_common.h +9 -0
+ * implemented peripheral reset for all drivers.
+ * Define this to "" disable this compatibility.
+ */
+#ifndef SOCFPGA_PERMODRST_UNGATE
+#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0"
+#endif
+#else
+#define SOCFPGA_PERMODRST_UNGATE ""
+#endif

Just add this socfpga_permodrst_ungate to the default end and drop all those macros/Kconfig options.

But how would it then be overridden?

I think it'd be better to call it socfpga_legacy_reset_compat or something.

Quoted 1 line

Ok.

Regards,
Simon

Quoted 14 lines
Quoted 12 lines
include/configs/socfpga_common.h +1 -0
 #ifndef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS \
      "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
@@ -330,6 +343,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
      "scriptaddr=0x02100000\0" \
      "pxefile_addr_r=0x02200000\0" \
      "ramdisk_addr_r=0x02300000\0" \
+     SOCFPGA_PERMODRST_UNGATE \
      BOOTENV
 
 #endif
#33 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

Quoted 50 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> To keep the current behaviour of taking all peripherals out of reset > before booting the OS before removing that code from socfpga gen5 SPL, > this enables the new behaviour by default for all gen5 boards by adding
> the environment variable "socfpga_permodrst_ungate=1" to the default > environment.
>
> This can be overridden in board config files or by saving an environment
> without this variable enabled.
>
> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>>
> ---
>
> Changes in v2:
> - this patch is new in v2
>
>  include/configs/socfpga_common.h | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index c9cbf8f5e3..2510c6fd7b 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void); >
>  #include <config_distro_bootcmd.h>
>
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +/*
> + * Handle compatibility for peripheral reset for Linux kernels that haven't
> + * implemented peripheral reset for all drivers.
> + * Define this to "" disable this compatibility.
> + */
> +#ifndef SOCFPGA_PERMODRST_UNGATE
> +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0" > +#endif
> +#else
> +#define SOCFPGA_PERMODRST_UNGATE ""
> +#endif

Quoted 5 lines

Just add this socfpga_permodrst_ungate to the default end and drop all those macros/Kconfig options.

But how would it then be overridden?

User would setenv it to "" and saveenv ? I might be missing something obvious.

Signature · 2 lines
Best regards,
Marek Vasut
#34 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

Quoted 52 lines · Marek Vasut
Quoted 50 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> To keep the current behaviour of taking all peripherals out of reset > before booting the OS before removing that code from socfpga gen5 SPL, > this enables the new behaviour by default for all gen5 boards by adding
> the environment variable "socfpga_permodrst_ungate=1" to the default > environment.
>
> This can be overridden in board config files or by saving an environment
> without this variable enabled.
>
> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>>
> ---
>
> Changes in v2:
> - this patch is new in v2
>
> include/configs/socfpga_common.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index c9cbf8f5e3..2510c6fd7b 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void); >
> #include <config_distro_bootcmd.h>
>
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +/*
> + * Handle compatibility for peripheral reset for Linux kernels that haven't
> + * implemented peripheral reset for all drivers.
> + * Define this to "" disable this compatibility.
> + */
> +#ifndef SOCFPGA_PERMODRST_UNGATE
> +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0" > +#endif
> +#else
> +#define SOCFPGA_PERMODRST_UNGATE ""
> +#endif

Quoted 8 lines
Quoted 5 lines

Just add this socfpga_permodrst_ungate to the default end and drop all those macros/Kconfig options.

But how would it then be overridden?

User would setenv it to "" and saveenv ? I might be missing something obvious.

Of course. I meant how to override it for the default env. E.g. to test on some boards.

But it's probably enough that CONFIG_EXTRA_ENV_SETTINGS is overridable.

Regards,
Simon

#35 lore raw

PATCH v2 7/8 arm: socfpga: gen5: deassert peripheral reset by default

Quoted 59 lines · Simon Goldschmidt
Quoted 58 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt

Am Do., 21. Feb. 2019, 22:56 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
> To keep the current behaviour of taking all peripherals out of reset > before booting the OS before removing that code from socfpga gen5 SPL, > this enables the new behaviour by default for all gen5 boards by adding
> the environment variable "socfpga_permodrst_ungate=1" to the default > environment.
>
> This can be overridden in board config files or by saving an environment
> without this variable enabled.
>
> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>>
> ---
>
> Changes in v2:
> - this patch is new in v2
>
> include/configs/socfpga_common.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index c9cbf8f5e3..2510c6fd7b 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -321,6 +321,19 @@ unsigned int cm_get_qspi_controller_clk_hz(void); >
> #include <config_distro_bootcmd.h>
>
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +/*
> + * Handle compatibility for peripheral reset for Linux kernels that haven't
> + * implemented peripheral reset for all drivers.
> + * Define this to "" disable this compatibility.
> + */
> +#ifndef SOCFPGA_PERMODRST_UNGATE
> +#define SOCFPGA_PERMODRST_UNGATE "socfpga_permodrst_ungate=1\0" > +#endif
> +#else
> +#define SOCFPGA_PERMODRST_UNGATE ""
> +#endif

Just add this socfpga_permodrst_ungate to the default end and drop all those macros/Kconfig options.

But how would it then be overridden?

Quoted 7 lines
Quoted 2 lines

User would setenv it to "" and saveenv ? I might be missing something obvious.

Of course. I meant how to override it for the default env. E.g. to test on some boards.

But it's probably enough that CONFIG_EXTRA_ENV_SETTINGS is overridable.

I think so ... or ?

Signature · 2 lines
Best regards,
Marek Vasut
#36 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

In reply to Simon Goldschmidt

This commit removes ad-hoc reset handling for peripheral resets from SPL for socfpga gen5.

This is done because as U-Boot drivers support reset handling by now.

---

Changes in v2:
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

 arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
 arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
 2 files changed, 20 deletions(-)
arch/arm/mach-socfpga/misc_gen5.c +0 -10
index 6e11ba6cb2..9865f5b5b1 100644
@@ -201,16 +201,6 @@ int arch_early_init_r(void)
 	/* Add device descriptor to FPGA device table */
 	socfpga_fpga_add(&altera_fpga[0]);
 
-#ifdef CONFIG_DESIGNWARE_SPI
-	/* Get Designware SPI controller out of reset */
-	socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
-	socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
-#endif
-
-#ifdef CONFIG_NAND_DENALI
-	socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
-#endif
-
 	return 0;
 }
 
arch/arm/mach-socfpga/spl_gen5.c +0 -10
index 1bff8cbfcf..e1e65261eb 100644
@@ -36,16 +36,12 @@ u32 spl_boot_device(void)
 		return BOOT_DEVICE_RAM;
 	case 0x2:	/* NAND Flash (1.8V) */
 	case 0x3:	/* NAND Flash (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
 		return BOOT_DEVICE_NAND;
 	case 0x4:	/* SD/MMC External Transceiver (1.8V) */
 	case 0x5:	/* SD/MMC Internal Transceiver (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-		socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
 		return BOOT_DEVICE_MMC1;
 	case 0x6:	/* QSPI Flash (1.8V) */
 	case 0x7:	/* QSPI Flash (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
 		return BOOT_DEVICE_SPI;
 	default:
 		printf("Invalid boot device (bsel=%08x)!\n", bsel);
@@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
 		socfpga_bridges_reset(1);
 	}
 
-	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
 	socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
-
 	timer_init();
 
 	debug("Reconfigure Clock Manager\n");
@@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
 	sysmgr_pinmux_init();
 	sysmgr_config_warmrstcfgio(0);
 
-	/* De-assert reset for peripherals and bridges based on handoff */
-	reset_deassert_peripherals_handoff();
-	socfpga_bridges_reset(0);
-
 	debug("Unfreezing/Thaw all I/O banks\n");
 	/* unfreeze / thaw all IO banks */
 	sys_mgr_frzctrl_thaw_req();
Signature · 1 line
2.17.1
#37 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 70 lines · Simon Goldschmidt

This commit removes ad-hoc reset handling for peripheral resets from SPL for socfpga gen5.

This is done because as U-Boot drivers support reset handling by now.

---

Changes in v2:
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

 arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
 arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
 2 files changed, 20 deletions(-)
arch/arm/mach-socfpga/misc_gen5.c +0 -10
index 6e11ba6cb2..9865f5b5b1 100644
@@ -201,16 +201,6 @@ int arch_early_init_r(void)
 	/* Add device descriptor to FPGA device table */
 	socfpga_fpga_add(&altera_fpga[0]);
 
-#ifdef CONFIG_DESIGNWARE_SPI
-	/* Get Designware SPI controller out of reset */
-	socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
-	socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
-#endif
-
-#ifdef CONFIG_NAND_DENALI
-	socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
-#endif
-
 	return 0;
 }
 
arch/arm/mach-socfpga/spl_gen5.c +0 -6
index 1bff8cbfcf..e1e65261eb 100644
@@ -36,16 +36,12 @@ u32 spl_boot_device(void)
 		return BOOT_DEVICE_RAM;
 	case 0x2:	/* NAND Flash (1.8V) */
 	case 0x3:	/* NAND Flash (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
 		return BOOT_DEVICE_NAND;
 	case 0x4:	/* SD/MMC External Transceiver (1.8V) */
 	case 0x5:	/* SD/MMC Internal Transceiver (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-		socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
 		return BOOT_DEVICE_MMC1;
 	case 0x6:	/* QSPI Flash (1.8V) */
 	case 0x7:	/* QSPI Flash (3.0V) */
-		socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
 		return BOOT_DEVICE_SPI;
 	default:
 		printf("Invalid boot device (bsel=%08x)!\n", bsel);
@@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
 		socfpga_bridges_reset(1);
 	}
 
-	socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
 	socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
-
 	timer_init();
 
 	debug("Reconfigure Clock Manager\n");

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 122

Quoted 10 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -4
@@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
 	sysmgr_pinmux_init();
 	sysmgr_config_warmrstcfgio(0);
 
-	/* De-assert reset for peripherals and bridges based on handoff */
-	reset_deassert_peripherals_handoff();
-	socfpga_bridges_reset(0);
-
 	debug("Unfreezing/Thaw all I/O banks\n");
 	/* unfreeze / thaw all IO banks */
 	sys_mgr_frzctrl_thaw_req();

Nice!

Signature · 2 lines
Best regards,
Marek Vasut
#38 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 69 lines · Marek Vasut
Quoted 67 lines · Simon Goldschmidt

This commit removes ad-hoc reset handling for peripheral resets from SPL for socfpga gen5.

This is done because as U-Boot drivers support reset handling by now.

---

Changes in v2:
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

 arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
 arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
 2 files changed, 20 deletions(-)
arch/arm/mach-socfpga/misc_gen5.c +0 -10
index 6e11ba6cb2..9865f5b5b1 100644
@@ -201,16 +201,6 @@ int arch_early_init_r(void)
      /* Add device descriptor to FPGA device table */
      socfpga_fpga_add(&altera_fpga[0]);
 
-#ifdef CONFIG_DESIGNWARE_SPI
-     /* Get Designware SPI controller out of reset */
-     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
-     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
-#endif
-
-#ifdef CONFIG_NAND_DENALI
-     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
-#endif
-
      return 0;
 }
 
arch/arm/mach-socfpga/spl_gen5.c +0 -6
index 1bff8cbfcf..e1e65261eb 100644
@@ -36,16 +36,12 @@ u32 spl_boot_device(void)
              return BOOT_DEVICE_RAM;
      case 0x2:       /* NAND Flash (1.8V) */
      case 0x3:       /* NAND Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
              return BOOT_DEVICE_NAND;
      case 0x4:       /* SD/MMC External Transceiver (1.8V) */
      case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
              return BOOT_DEVICE_MMC1;
      case 0x6:       /* QSPI Flash (1.8V) */
      case 0x7:       /* QSPI Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
              return BOOT_DEVICE_SPI;
      default:
              printf("Invalid boot device (bsel=%08x)!\n", bsel);
@@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
              socfpga_bridges_reset(1);
      }
 
-     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
      socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
-
      timer_init();
 
Quoted 8 lines

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 128

Quoted 8 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -3
      debug("Reconfigure Clock Manager\n");
@@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
      sysmgr_pinmux_init();
      sysmgr_config_warmrstcfgio(0);
 
-     /* De-assert reset for peripherals and bridges based on handoff */
-     reset_deassert_peripherals_handoff();
-     socfpga_bridges_reset(0);

I just saw that this line might have unwanted side effects in that it does not write the enabled bridges bitmask to the 'iswgrp_handoff' registers. So the 'bridge enable' command might not work.

This whole handoff thing looks somewhat broken to me anyway: the original Altera U-Boot did it because it obeyed Quartus output, while we now just always write a constant bitmask here (see socfpga_bridges_reset()).

Regards,
Simon

Quoted 11 lines

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 122

Quoted 5 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -1
-
      debug("Unfreezing/Thaw all I/O banks\n");
      /* unfreeze / thaw all IO banks */
      sys_mgr_frzctrl_thaw_req();

Nice!

--
Best regards,
Marek Vasut

#39 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 83 lines · Simon Goldschmidt
Quoted 69 lines · Marek Vasut
Quoted 67 lines · Simon Goldschmidt

This commit removes ad-hoc reset handling for peripheral resets from SPL for socfpga gen5.

This is done because as U-Boot drivers support reset handling by now.

---

Changes in v2:
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

 arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
 arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
 2 files changed, 20 deletions(-)
arch/arm/mach-socfpga/misc_gen5.c +0 -10
index 6e11ba6cb2..9865f5b5b1 100644
@@ -201,16 +201,6 @@ int arch_early_init_r(void)
      /* Add device descriptor to FPGA device table */
      socfpga_fpga_add(&altera_fpga[0]);
 
-#ifdef CONFIG_DESIGNWARE_SPI
-     /* Get Designware SPI controller out of reset */
-     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
-     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
-#endif
-
-#ifdef CONFIG_NAND_DENALI
-     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
-#endif
-
      return 0;
 }
 
arch/arm/mach-socfpga/spl_gen5.c +0 -6
index 1bff8cbfcf..e1e65261eb 100644
@@ -36,16 +36,12 @@ u32 spl_boot_device(void)
              return BOOT_DEVICE_RAM;
      case 0x2:       /* NAND Flash (1.8V) */
      case 0x3:       /* NAND Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
              return BOOT_DEVICE_NAND;
      case 0x4:       /* SD/MMC External Transceiver (1.8V) */
      case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
              return BOOT_DEVICE_MMC1;
      case 0x6:       /* QSPI Flash (1.8V) */
      case 0x7:       /* QSPI Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
              return BOOT_DEVICE_SPI;
      default:
              printf("Invalid boot device (bsel=%08x)!\n", bsel);
@@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
              socfpga_bridges_reset(1);
      }
 
-     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
      socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
-
      timer_init();
 
Quoted 8 lines

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 128

Quoted 8 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -3
      debug("Reconfigure Clock Manager\n");
@@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
      sysmgr_pinmux_init();
      sysmgr_config_warmrstcfgio(0);
 
-     /* De-assert reset for peripherals and bridges based on handoff */
-     reset_deassert_peripherals_handoff();
-     socfpga_bridges_reset(0);

I just saw that this line might have unwanted side effects in that it does not write the enabled bridges bitmask to the 'iswgrp_handoff' registers. So the 'bridge enable' command might not work.

Quoted 6 lines

This whole handoff thing looks somewhat broken to me anyway: the original Altera U-Boot did it because it obeyed Quartus output, while we now just always write a constant bitmask here (see socfpga_bridges_reset()).

Regards,
Simon

Might make sense to finally clean it up ?

Signature · 2 lines
Best regards,
Marek Vasut
#40 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected]> geschrieben:

Quoted 92 lines · Simon Goldschmidt
Quoted 4 lines · Marek Vasut
Quoted 3 lines · Simon Goldschmidt
Quoted 1 line

This commit removes ad-hoc reset handling for peripheral resets from

SPL

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

for socfpga gen5.

This is done because as U-Boot drivers support reset handling by now.

---

Changes in v2:
- removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since compatibility now uses an environment variable

Quoted 5 lines
Quoted 5 lines

Review

Quoted 5 lines
 arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
 arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
 2 files changed, 20 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/misc_gen5.c

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

index 6e11ba6cb2..9865f5b5b1 100644

arch/arm/mach-socfpga/misc_gen5.c +0 -10
@@ -201,16 +201,6 @@ int arch_early_init_r(void)
      /* Add device descriptor to FPGA device table */
      socfpga_fpga_add(&altera_fpga[0]);
 
-#ifdef CONFIG_DESIGNWARE_SPI
-     /* Get Designware SPI controller out of reset */
-     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
-     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
-#endif
-
-#ifdef CONFIG_NAND_DENALI
-     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
-#endif
-
      return 0;
 }
 
Quoted 1 line
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/spl_gen5.c

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines

index 1bff8cbfcf..e1e65261eb 100644

arch/arm/mach-socfpga/spl_gen5.c +0 -6
@@ -36,16 +36,12 @@ u32 spl_boot_device(void)
              return BOOT_DEVICE_RAM;
      case 0x2:       /* NAND Flash (1.8V) */
      case 0x3:       /* NAND Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
              return BOOT_DEVICE_NAND;
      case 0x4:       /* SD/MMC External Transceiver (1.8V) */
      case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
              return BOOT_DEVICE_MMC1;
      case 0x6:       /* QSPI Flash (1.8V) */
      case 0x7:       /* QSPI Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
              return BOOT_DEVICE_SPI;
      default:
              printf("Invalid boot device (bsel=%08x)!\n", bsel);
@@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
              socfpga_bridges_reset(1);
      }
 
-     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
      socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
-
      timer_init();
 
Quoted 6 lines
Quoted 6 lines

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 126

Quoted 6 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -1
      debug("Reconfigure Clock Manager\n");
@@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
      sysmgr_pinmux_init();
      sysmgr_config_warmrstcfgio(0);
 
-     /* De-assert reset for peripherals and bridges based on handoff

*/

Quoted 4 lines
Quoted 2 lines

arch/arm/mach-socfpga/spl_gen5.c void board_init_f(ulong dummy) · line 128

Quoted 2 lines
arch/arm/mach-socfpga/spl_gen5.c +0 -2
-     reset_deassert_peripherals_handoff();
-     socfpga_bridges_reset(0);

I just saw that this line might have unwanted side effects in that it

does

Quoted 6 lines

not write the enabled bridges bitmask to the 'iswgrp_handoff' registers. So the 'bridge enable' command might not work.

This whole handoff thing looks somewhat broken to me anyway: the original Altera U-Boot did it because it obeyed Quartus output, while we now just always write a constant bitmask here (see

Quoted 7 lines

socfpga_bridges_reset()).

Quoted 3 lines

Regards,
Simon

Might make sense to finally clean it up ?

Yeah, well the problem is that for some things, handoff from Quartus is required while for other things, devicetree information like it is now is enough.

I'll set that in my list *g*

Regards,
Simon

Quoted 1 line
#41 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 112 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
    > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >>> This commit removes ad-hoc reset handling for peripheral resets
    from SPL
    >>> for socfpga gen5.
    >>>
    >>> This is done because as U-Boot drivers support reset handling by
    now.
    >>>
    >>> Signed-off-by: Simon Goldschmidt
    <[email protected]
    <mailto:[email protected]>>
    >>> ---
    >>>
    >>> Changes in v2:
    >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since
    compatibility
    >>>   now uses an environment variable
    >>>
    >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
    >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
    >>>  2 files changed, 20 deletions(-)
    >>>
    >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c
    b/arch/arm/mach-socfpga/misc_gen5.c
    >>> index 6e11ba6cb2..9865f5b5b1 100644
    >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
    >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
    >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void)
    >>>       /* Add device descriptor to FPGA device table */
    >>>       socfpga_fpga_add(&altera_fpga[0]);
    >>>
    >>> -#ifdef CONFIG_DESIGNWARE_SPI
    >>> -     /* Get Designware SPI controller out of reset */
    >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
    >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
    >>> -#endif
    >>> -
    >>> -#ifdef CONFIG_NAND_DENALI
    >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >>> -#endif
    >>> -
    >>>       return 0;
    >>>  }
    >>>
    >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c
    b/arch/arm/mach-socfpga/spl_gen5.c
    >>> index 1bff8cbfcf..e1e65261eb 100644
    >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
    >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
    >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void)
    >>>               return BOOT_DEVICE_RAM;
    >>>       case 0x2:       /* NAND Flash (1.8V) */
    >>>       case 0x3:       /* NAND Flash (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >>>               return BOOT_DEVICE_NAND;
    >>>       case 0x4:       /* SD/MMC External Transceiver (1.8V) */
    >>>       case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
    >>> -             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
    >>>               return BOOT_DEVICE_MMC1;
    >>>       case 0x6:       /* QSPI Flash (1.8V) */
    >>>       case 0x7:       /* QSPI Flash (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
    >>>               return BOOT_DEVICE_SPI;
    >>>       default:
    >>>               printf("Invalid boot device (bsel=%08x)!\n", bsel);
    >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
    >>>               socfpga_bridges_reset(1);
    >>>       }
    >>>
    >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
    >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
    >>> -
    >>>       timer_init();
    >>>
    >>>       debug("Reconfigure Clock Manager\n");
    >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
    >>>       sysmgr_pinmux_init();
    >>>       sysmgr_config_warmrstcfgio(0);
    >>>
    >>> -     /* De-assert reset for peripherals and bridges based on
    handoff */
    >>> -     reset_deassert_peripherals_handoff();
    >>> -     socfpga_bridges_reset(0);
    >
    > I just saw that this line might have unwanted side effects in that
    it does
    > not write the enabled bridges bitmask to the 'iswgrp_handoff'
    registers.
    > So the 'bridge enable' command might not work.
    >
    > This whole handoff thing looks somewhat broken to me anyway: the
    > original Altera U-Boot did it because it obeyed Quartus output,
    while we
    > now just always write a constant bitmask here (see
    socfpga_bridges_reset()).
    >
    > Regards,
    > Simon

    Might make sense to finally clean it up ?
Quoted 3 lines

Yeah, well the problem is that for some things, handoff from Quartus is required while for other things, devicetree information like it is now is enough.

Might be just about the right time to convert quartus handoff files to DT ?

Signature · 2 lines
Best regards,
Marek Vasut
#42 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Am Fr., 22. Feb. 2019, 20:37 hat Marek Vasut <[email protected]> geschrieben:

Quoted 110 lines · Simon Goldschmidt
Quoted 109 lines

Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
    > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <[email protected]
    <mailto:[email protected]>> wrote:
    >>
    >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >>> This commit removes ad-hoc reset handling for peripheral resets
    from SPL
    >>> for socfpga gen5.
    >>>
    >>> This is done because as U-Boot drivers support reset handling by
    now.
    >>>
    >>> Signed-off-by: Simon Goldschmidt
    <[email protected]
    <mailto:[email protected]>>
    >>> ---
    >>>
    >>> Changes in v2:
    >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since
    compatibility
    >>>   now uses an environment variable
    >>>
    >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
    >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
    >>>  2 files changed, 20 deletions(-)
    >>>
    >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c
    b/arch/arm/mach-socfpga/misc_gen5.c
    >>> index 6e11ba6cb2..9865f5b5b1 100644
    >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
    >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
    >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void)
    >>>       /* Add device descriptor to FPGA device table */
    >>>       socfpga_fpga_add(&altera_fpga[0]);
    >>>
    >>> -#ifdef CONFIG_DESIGNWARE_SPI
    >>> -     /* Get Designware SPI controller out of reset */
    >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
    >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
    >>> -#endif
    >>> -
    >>> -#ifdef CONFIG_NAND_DENALI
    >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >>> -#endif
    >>> -
    >>>       return 0;
    >>>  }
    >>>
    >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c
    b/arch/arm/mach-socfpga/spl_gen5.c
    >>> index 1bff8cbfcf..e1e65261eb 100644
    >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
    >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
    >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void)
    >>>               return BOOT_DEVICE_RAM;
    >>>       case 0x2:       /* NAND Flash (1.8V) */
    >>>       case 0x3:       /* NAND Flash (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >>>               return BOOT_DEVICE_NAND;
    >>>       case 0x4:       /* SD/MMC External Transceiver (1.8V) */
    >>>       case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
    >>> -             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
    >>>               return BOOT_DEVICE_MMC1;
    >>>       case 0x6:       /* QSPI Flash (1.8V) */
    >>>       case 0x7:       /* QSPI Flash (3.0V) */
    >>> -             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
    >>>               return BOOT_DEVICE_SPI;
    >>>       default:
    >>>               printf("Invalid boot device (bsel=%08x)!\n", bsel);
    >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
    >>>               socfpga_bridges_reset(1);
    >>>       }
    >>>
    >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
    >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
    >>> -
    >>>       timer_init();
    >>>
    >>>       debug("Reconfigure Clock Manager\n");
    >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
    >>>       sysmgr_pinmux_init();
    >>>       sysmgr_config_warmrstcfgio(0);
    >>>
    >>> -     /* De-assert reset for peripherals and bridges based on
    handoff */
    >>> -     reset_deassert_peripherals_handoff();
    >>> -     socfpga_bridges_reset(0);
    >
    > I just saw that this line might have unwanted side effects in that
    it does
    > not write the enabled bridges bitmask to the 'iswgrp_handoff'
    registers.
    > So the 'bridge enable' command might not work.
    >
    > This whole handoff thing looks somewhat broken to me anyway: the
    > original Altera U-Boot did it because it obeyed Quartus output,
    while we
    > now just always write a constant bitmask here (see
    socfpga_bridges_reset()).
    >
    > Regards,
    > Simon
Quoted 9 lines
Quoted 6 lines

Might make sense to finally clean it up ?

Yeah, well the problem is that for some things, handoff from Quartus is required while for other things, devicetree information like it is now is enough.

Might be just about the right time to convert quartus handoff files to DT ?

That would be great: I do have a use case where the pin description should be changeable after SPL.

But that again would require more time than I currently have... :-(

Regards,
Simon

#43 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 135 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 20:37 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/22/19 8:10 PM, Simon Goldschmidt wrote:
    >
    >
    > Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected]
    <mailto:[email protected]>
    > <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
    >
    >     On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
    >     > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <[email protected]
    <mailto:[email protected]>
    >     <mailto:marex at denx.de <mailto:[email protected]>>> wrote:
    >     >>
    >     >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >     >>> This commit removes ad-hoc reset handling for peripheral
    resets
    >     from SPL
    >     >>> for socfpga gen5.
    >     >>>
    >     >>> This is done because as U-Boot drivers support reset
    handling by
    >     now.
    >     >>>
    >     >>> Signed-off-by: Simon Goldschmidt
    >     <[email protected]
    <mailto:[email protected]>
    >     <mailto:[email protected]
    <mailto:[email protected]>>>
    >     >>> ---
    >     >>>
    >     >>> Changes in v2:
    >     >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since
    >     compatibility
    >     >>>   now uses an environment variable
    >     >>>
    >     >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
    >     >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
    >     >>>  2 files changed, 20 deletions(-)
    >     >>>
    >     >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c
    >     b/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> index 6e11ba6cb2..9865f5b5b1 100644
    >     >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void)
    >     >>>       /* Add device descriptor to FPGA device table */
    >     >>>       socfpga_fpga_add(&altera_fpga[0]);
    >     >>>
    >     >>> -#ifdef CONFIG_DESIGNWARE_SPI
    >     >>> -     /* Get Designware SPI controller out of reset */
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
    >     >>> -#endif
    >     >>> -
    >     >>> -#ifdef CONFIG_NAND_DENALI
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >     >>> -#endif
    >     >>> -
    >     >>>       return 0;
    >     >>>  }
    >     >>>
    >     >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c
    >     b/arch/arm/mach-socfpga/spl_gen5.c
    >     >>> index 1bff8cbfcf..e1e65261eb 100644
    >     >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
    >     >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
    >     >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void)
    >     >>>               return BOOT_DEVICE_RAM;
    >     >>>       case 0x2:       /* NAND Flash (1.8V) */
    >     >>>       case 0x3:       /* NAND Flash (3.0V) */
    >     >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >     >>>               return BOOT_DEVICE_NAND;
    >     >>>       case 0x4:       /* SD/MMC External Transceiver (1.8V) */
    >     >>>       case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
    >     >>> -             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
    >     >>> -             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
    >     >>>               return BOOT_DEVICE_MMC1;
    >     >>>       case 0x6:       /* QSPI Flash (1.8V) */
    >     >>>       case 0x7:       /* QSPI Flash (3.0V) */
    >     >>> -             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
    >     >>>               return BOOT_DEVICE_SPI;
    >     >>>       default:
    >     >>>               printf("Invalid boot device (bsel=%08x)!\n",
    bsel);
    >     >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
    >     >>>               socfpga_bridges_reset(1);
    >     >>>       }
    >     >>>
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
    >     >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
    >     >>> -
    >     >>>       timer_init();
    >     >>>
    >     >>>       debug("Reconfigure Clock Manager\n");
    >     >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
    >     >>>       sysmgr_pinmux_init();
    >     >>>       sysmgr_config_warmrstcfgio(0);
    >     >>>
    >     >>> -     /* De-assert reset for peripherals and bridges based on
    >     handoff */
    >     >>> -     reset_deassert_peripherals_handoff();
    >     >>> -     socfpga_bridges_reset(0);
    >     >
    >     > I just saw that this line might have unwanted side effects
    in that
    >     it does
    >     > not write the enabled bridges bitmask to the 'iswgrp_handoff'
    >     registers.
    >     > So the 'bridge enable' command might not work.
    >     >
    >     > This whole handoff thing looks somewhat broken to me anyway: the
    >     > original Altera U-Boot did it because it obeyed Quartus output,
    >     while we
    >     > now just always write a constant bitmask here (see
    >     socfpga_bridges_reset()).
    >     >
    >     > Regards,
    >     > Simon
    >
    >     Might make sense to finally clean it up ?
    >
    >
    > Yeah, well the problem is that for some things, handoff from
    Quartus is
    > required while for other things, devicetree information like it is now
    > is enough.

    Might be just about the right time to convert quartus handoff files
    to DT ?
Quoted 2 lines

That would be great: I do have a use case where the pin description should be changeable after SPL.

Well, we don't have the pin control documentation, so unless we "observe" what quartus generates real hard ...

Quoted 1 line

But that again would require more time than I currently have... :-(

Right, I'm not asking you to do it to get this series in.

Signature · 2 lines
Best regards,
Marek Vasut
#44 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Am Fr., 22. Feb. 2019, 20:47 hat Marek Vasut <[email protected]> geschrieben:

Quoted 142 lines · Simon Goldschmidt
Quoted 69 lines

Am Fr., 22. Feb. 2019, 20:37 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

    On 2/22/19 8:10 PM, Simon Goldschmidt wrote:
    >
    >
    > Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected]
    <mailto:[email protected]>
    > <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
    >
    >     On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
    >     > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <[email protected]
    <mailto:[email protected]>
    >     <mailto:marex at denx.de <mailto:[email protected]>>> wrote:
    >     >>
    >     >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
    >     >>> This commit removes ad-hoc reset handling for peripheral
    resets
    >     from SPL
    >     >>> for socfpga gen5.
    >     >>>
    >     >>> This is done because as U-Boot drivers support reset
    handling by
    >     now.
    >     >>>
    >     >>> Signed-off-by: Simon Goldschmidt
    >     <[email protected]
    <mailto:[email protected]>
    >     <mailto:[email protected]
    <mailto:[email protected]>>>
    >     >>> ---
    >     >>>
    >     >>> Changes in v2:
    >     >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since
    >     compatibility
    >     >>>   now uses an environment variable
    >     >>>
    >     >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ----------
    >     >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ----------
    >     >>>  2 files changed, 20 deletions(-)
    >     >>>
    >     >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c
    >     b/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> index 6e11ba6cb2..9865f5b5b1 100644
    >     >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
    >     >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void)
    >     >>>       /* Add device descriptor to FPGA device table */
    >     >>>       socfpga_fpga_add(&altera_fpga[0]);
    >     >>>
    >     >>> -#ifdef CONFIG_DESIGNWARE_SPI
    >     >>> -     /* Get Designware SPI controller out of reset */
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0);
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0);
    >     >>> -#endif
    >     >>> -
    >     >>> -#ifdef CONFIG_NAND_DENALI
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >     >>> -#endif
    >     >>> -
    >     >>>       return 0;
    >     >>>  }
    >     >>>
    >     >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c
    >     b/arch/arm/mach-socfpga/spl_gen5.c
    >     >>> index 1bff8cbfcf..e1e65261eb 100644
    >     >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
Quoted 8 lines
    >     >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
    >     >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void)
    >     >>>               return BOOT_DEVICE_RAM;
    >     >>>       case 0x2:       /* NAND Flash (1.8V) */
    >     >>>       case 0x3:       /* NAND Flash (3.0V) */
    >     >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0);
    >     >>>               return BOOT_DEVICE_NAND;
    >     >>>       case 0x4:       /* SD/MMC External Transceiver

(1.8V) */

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
      case 0x5:       /* SD/MMC Internal Transceiver

(3.0V) */

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Review

Quoted 9 lines
(quoted diff) +0 -3
-             socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
-             socfpga_per_reset(SOCFPGA_RESET(DMA), 0);
              return BOOT_DEVICE_MMC1;
      case 0x6:       /* QSPI Flash (1.8V) */
      case 0x7:       /* QSPI Flash (3.0V) */
-             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0);
              return BOOT_DEVICE_SPI;
      default:
              printf("Invalid boot device (bsel=%08x)!\n",
Quoted 16 lines
    bsel);
    >     >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy)
    >     >>>               socfpga_bridges_reset(1);
    >     >>>       }
    >     >>>
    >     >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0);
    >     >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0);
    >     >>> -
    >     >>>       timer_init();
    >     >>>
    >     >>>       debug("Reconfigure Clock Manager\n");
    >     >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy)
    >     >>>       sysmgr_pinmux_init();
    >     >>>       sysmgr_config_warmrstcfgio(0);
    >     >>>
    >     >>> -     /* De-assert reset for peripherals and bridges based

on

Quoted 4 lines
Quoted 4 lines
    handoff */
    >>> -     reset_deassert_peripherals_handoff();
    >>> -     socfpga_bridges_reset(0);
    >
Quoted 8 lines
Quoted 1 line
Quoted 1 line

I just saw that this line might have unwanted side effects

in that
> it does
> > not write the enabled bridges bitmask to the 'iswgrp_handoff'
> registers.
> > So the 'bridge enable' command might not work.
> >
> > This whole handoff thing looks somewhat broken to me anyway:

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

original Altera U-Boot did it because it obeyed Quartus

output,

Quoted 7 lines
Quoted 7 lines

while we
> now just always write a constant bitmask here (see socfpga_bridges_reset()).
>
> Regards,
> Simon

Quoted 6 lines
Quoted 4 lines

Might make sense to finally clean it up ?

Yeah, well the problem is that for some things, handoff from

Quartus is
> required while for other things, devicetree information like it is

now

Quoted 6 lines
Quoted 1 line

is enough.

Might be just about the right time to convert quartus handoff files to DT ?

Quoted 6 lines
Quoted 2 lines

That would be great: I do have a use case where the pin description should be changeable after SPL.

Well, we don't have the pin control documentation, so unless we "observe" what quartus generates real hard ...

Sadly, yes. However, I would think it would still be better to embed those u32 arrays we have now into the device tree. That would give us the possibility to apply them from SPL, U-Boot or even Linux.

My use case is that the pin settings change depending on the FPGA image (e.g. hps pins routed to FPGA etc.). With the current code, I have to update SPL to match the FPGA...

Quoted 4 lines
Quoted 1 line

But that again would require more time than I currently have... :-(

Right, I'm not asking you to do it to get this series in.

I didn't mean to say that. But I'd like to have that better sooner than later. Only I can't find the time to do it ...

Regards,
Simon

#45 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 163 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 20:47 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/22/19 8:42 PM, Simon Goldschmidt wrote:
>
>
> Am Fr., 22. Feb. 2019, 20:37 hat Marek Vasut <[email protected] <mailto:[email protected]>
> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>
>     On 2/22/19 8:10 PM, Simon Goldschmidt wrote:
>     >
>     >
>     > Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>
>     > <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> geschrieben:
>     >
>     >     On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
>     >     > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <marex at denx.de <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>
>     >     <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> wrote:
>     >     >>
>     >     >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>     >     >>> This commit removes ad-hoc reset handling for peripheral >     resets
>     >     from SPL
>     >     >>> for socfpga gen5.
>     >     >>>
>     >     >>> This is done because as U-Boot drivers support reset >     handling by
>     >     now.
>     >     >>>
>     >     >>> Signed-off-by: Simon Goldschmidt
>     >     <[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>
>     >     <mailto:[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>>>
>     >     >>> ---
>     >     >>>
>     >     >>> Changes in v2:
>     >     >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since >     >     compatibility
>     >     >>>   now uses an environment variable
>     >     >>>
>     >     >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ---------- >     >     >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ---------- >     >     >>>  2 files changed, 20 deletions(-)
>     >     >>>
>     >     >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c >     >     b/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> index 6e11ba6cb2..9865f5b5b1 100644
>     >     >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void) >     >     >>>       /* Add device descriptor to FPGA device table */ >     >     >>>       socfpga_fpga_add(&altera_fpga[0]);
>     >     >>>
>     >     >>> -#ifdef CONFIG_DESIGNWARE_SPI
>     >     >>> -     /* Get Designware SPI controller out of reset */ >     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0); >     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0); >     >     >>> -#endif
>     >     >>> -
>     >     >>> -#ifdef CONFIG_NAND_DENALI
>     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0); >     >     >>> -#endif
>     >     >>> -
>     >     >>>       return 0;
>     >     >>>  }
>     >     >>>
>     >     >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c >     >     b/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> index 1bff8cbfcf..e1e65261eb 100644
>     >     >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void) >     >     >>>               return BOOT_DEVICE_RAM;
>     >     >>>       case 0x2:       /* NAND Flash (1.8V) */ >     >     >>>       case 0x3:       /* NAND Flash (3.0V) */ >     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0); >     >     >>>               return BOOT_DEVICE_NAND;
>     >     >>>       case 0x4:       /* SD/MMC External Transceiver (1.8V) */
>     >     >>>       case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
>     >     >>> -
 socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
>     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(DMA), 0); >     >     >>>               return BOOT_DEVICE_MMC1;
>     >     >>>       case 0x6:       /* QSPI Flash (1.8V) */ >     >     >>>       case 0x7:       /* QSPI Flash (3.0V) */ >     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0); >     >     >>>               return BOOT_DEVICE_SPI;
>     >     >>>       default:
>     >     >>>               printf("Invalid boot device (bsel=%08x)!\n",
>     bsel);
>     >     >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy) >     >     >>>               socfpga_bridges_reset(1);
>     >     >>>       }
>     >     >>>
>     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0); >     >     >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0); >     >     >>> -
>     >     >>>       timer_init();
>     >     >>>
>     >     >>>       debug("Reconfigure Clock Manager\n"); >     >     >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy) >     >     >>>       sysmgr_pinmux_init();
>     >     >>>       sysmgr_config_warmrstcfgio(0);
>     >     >>>
>     >     >>> -     /* De-assert reset for peripherals and bridges based on
>     >     handoff */
>     >     >>> -     reset_deassert_peripherals_handoff(); >     >     >>> -     socfpga_bridges_reset(0);
>     >     >
>     >     > I just saw that this line might have unwanted side effects >     in that
>     >     it does
>     >     > not write the enabled bridges bitmask to the 'iswgrp_handoff'
>     >     registers.
>     >     > So the 'bridge enable' command might not work. >     >     >
>     >     > This whole handoff thing looks somewhat broken to me
anyway: the
>     >     > original Altera U-Boot did it because it obeyed Quartus output,
>     >     while we
>     >     > now just always write a constant bitmask here (see >     >     socfpga_bridges_reset()).
>     >     >
>     >     > Regards,
>     >     > Simon
>     >
>     >     Might make sense to finally clean it up ?
>     >
>     >
>     > Yeah, well the problem is that for some things, handoff from >     Quartus is
>     > required while for other things, devicetree information like it is now
>     > is enough.
>
>     Might be just about the right time to convert quartus handoff files
>     to DT ?
>
>
> That would be great: I do have a use case where the pin description > should be changeable after SPL.

Quoted 7 lines

Well, we don't have the pin control documentation, so unless we "observe" what quartus generates real hard ...

Sadly, yes. However, I would think it would still be better to embed those u32 arrays we have now into the device tree. That would give us the possibility to apply them from SPL, U-Boot or even Linux.

Well, it's SPL only, it's highly un-recommended to fiddle with the pin configuration at runtime. Although, I suspect that might be just altera being cautious.

Quoted 3 lines

My use case is that the pin settings change depending on the FPGA image (e.g. hps pins routed to FPGA etc.). With the current code, I have to update SPL to match the FPGA...

Right, having it in DT, we could have one SPL for multiple systems. Would be nice.

Quoted 7 lines
Quoted 1 line

But that again would require more time than I currently have... :-(

Right, I'm not asking you to do it to get this series in.

I didn't mean to say that. But I'd like to have that better sooner than later. Only I can't find the time to do it ...

Right, that's what I meant.

btw you gonna be at EW next week ?

Signature · 2 lines
Best regards,
Marek Vasut
#46 lore raw

PATCH v2 8/8 arm: socfpga: implement proper peripheral reset

Quoted 167 lines · Marek Vasut
Quoted 166 lines · Simon Goldschmidt

Am Fr., 22. Feb. 2019, 20:47 hat Marek Vasut <[email protected] <mailto:[email protected]>> geschrieben:

On 2/22/19 8:42 PM, Simon Goldschmidt wrote:
>
>
> Am Fr., 22. Feb. 2019, 20:37 hat Marek Vasut <[email protected] <mailto:[email protected]>
> <mailto:marex at denx.de <mailto:[email protected]>>> geschrieben:
>
>     On 2/22/19 8:10 PM, Simon Goldschmidt wrote:
>     >
>     >
>     > Am Fr., 22. Feb. 2019, 18:34 hat Marek Vasut <[email protected] <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>
>     > <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> geschrieben:
>     >
>     >     On 2/22/19 7:35 AM, Simon Goldschmidt wrote:
>     >     > On Thu, Feb 21, 2019 at 10:56 PM Marek Vasut <marex at denx.de <mailto:[email protected]>
>     <mailto:marex at denx.de <mailto:[email protected]>>
>     >     <mailto:marex at denx.de <mailto:[email protected]> <mailto:marex at denx.de <mailto:[email protected]>>>> wrote:
>     >     >>
>     >     >> On 2/21/19 10:43 PM, Simon Goldschmidt wrote:
>     >     >>> This commit removes ad-hoc reset handling for peripheral >     resets
>     >     from SPL
>     >     >>> for socfpga gen5.
>     >     >>>
>     >     >>> This is done because as U-Boot drivers support reset >     handling by
>     >     now.
>     >     >>>
>     >     >>> Signed-off-by: Simon Goldschmidt
>     >     <[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>
>     >     <mailto:[email protected] <mailto:[email protected]>
>     <mailto:[email protected] <mailto:[email protected]>>>>
>     >     >>> ---
>     >     >>>
>     >     >>> Changes in v2:
>     >     >>> - removed Kconfig option OLD_SOCFPGA_KERNEL_COMPAT since >     >     compatibility
>     >     >>>   now uses an environment variable
>     >     >>>
>     >     >>>  arch/arm/mach-socfpga/misc_gen5.c | 10 ---------- >     >     >>>  arch/arm/mach-socfpga/spl_gen5.c  | 10 ---------- >     >     >>>  2 files changed, 20 deletions(-)
>     >     >>>
>     >     >>> diff --git a/arch/arm/mach-socfpga/misc_gen5.c >     >     b/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> index 6e11ba6cb2..9865f5b5b1 100644
>     >     >>> --- a/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> +++ b/arch/arm/mach-socfpga/misc_gen5.c
>     >     >>> @@ -201,16 +201,6 @@ int arch_early_init_r(void) >     >     >>>       /* Add device descriptor to FPGA device table */ >     >     >>>       socfpga_fpga_add(&altera_fpga[0]);
>     >     >>>
>     >     >>> -#ifdef CONFIG_DESIGNWARE_SPI
>     >     >>> -     /* Get Designware SPI controller out of reset */ >     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM0), 0); >     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(SPIM1), 0); >     >     >>> -#endif
>     >     >>> -
>     >     >>> -#ifdef CONFIG_NAND_DENALI
>     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(NAND), 0); >     >     >>> -#endif
>     >     >>> -
>     >     >>>       return 0;
>     >     >>>  }
>     >     >>>
>     >     >>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c >     >     b/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> index 1bff8cbfcf..e1e65261eb 100644
>     >     >>> --- a/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
>     >     >>> @@ -36,16 +36,12 @@ u32 spl_boot_device(void) >     >     >>>               return BOOT_DEVICE_RAM;
>     >     >>>       case 0x2:       /* NAND Flash (1.8V) */ >     >     >>>       case 0x3:       /* NAND Flash (3.0V) */ >     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(NAND), 0); >     >     >>>               return BOOT_DEVICE_NAND;
>     >     >>>       case 0x4:       /* SD/MMC External Transceiver (1.8V) */
>     >     >>>       case 0x5:       /* SD/MMC Internal Transceiver (3.0V) */
>     >     >>> -
 socfpga_per_reset(SOCFPGA_RESET(SDMMC), 0);
>     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(DMA), 0); >     >     >>>               return BOOT_DEVICE_MMC1;
>     >     >>>       case 0x6:       /* QSPI Flash (1.8V) */ >     >     >>>       case 0x7:       /* QSPI Flash (3.0V) */ >     >     >>> -             socfpga_per_reset(SOCFPGA_RESET(QSPI), 0); >     >     >>>               return BOOT_DEVICE_SPI;
>     >     >>>       default:
>     >     >>>               printf("Invalid boot device (bsel=%08x)!\n",
>     bsel);
>     >     >>> @@ -99,9 +95,7 @@ void board_init_f(ulong dummy) >     >     >>>               socfpga_bridges_reset(1);
>     >     >>>       }
>     >     >>>
>     >     >>> -     socfpga_per_reset(SOCFPGA_RESET(UART0), 0); >     >     >>>       socfpga_per_reset(SOCFPGA_RESET(OSC1TIMER0), 0); >     >     >>> -
>     >     >>>       timer_init();
>     >     >>>
>     >     >>>       debug("Reconfigure Clock Manager\n"); >     >     >>> @@ -123,10 +117,6 @@ void board_init_f(ulong dummy) >     >     >>>       sysmgr_pinmux_init();
>     >     >>>       sysmgr_config_warmrstcfgio(0);
>     >     >>>
>     >     >>> -     /* De-assert reset for peripherals and bridges based on
>     >     handoff */
>     >     >>> -     reset_deassert_peripherals_handoff(); >     >     >>> -     socfpga_bridges_reset(0);
>     >     >
>     >     > I just saw that this line might have unwanted side effects >     in that
>     >     it does
>     >     > not write the enabled bridges bitmask to the 'iswgrp_handoff'
>     >     registers.
>     >     > So the 'bridge enable' command might not work. >     >     >
>     >     > This whole handoff thing looks somewhat broken to me
anyway: the
>     >     > original Altera U-Boot did it because it obeyed Quartus output,
>     >     while we
>     >     > now just always write a constant bitmask here (see >     >     socfpga_bridges_reset()).
>     >     >
>     >     > Regards,
>     >     > Simon
>     >
>     >     Might make sense to finally clean it up ?
>     >
>     >
>     > Yeah, well the problem is that for some things, handoff from >     Quartus is
>     > required while for other things, devicetree information like it is now
>     > is enough.
>
>     Might be just about the right time to convert quartus handoff files
>     to DT ?
>
>
> That would be great: I do have a use case where the pin description > should be changeable after SPL.

Well, we don't have the pin control documentation, so unless we "observe" what quartus generates real hard ...

Quoted 6 lines
Quoted 3 lines

Sadly, yes. However, I would think it would still be better to embed those u32 arrays we have now into the device tree. That would give us the possibility to apply them from SPL, U-Boot or even Linux.

Well, it's SPL only, it's highly un-recommended to fiddle with the pin configuration at runtime. Although, I suspect that might be just altera being cautious.

Yeah, I would have guesses as long as we change the pin settings without accessing the pins in between, we should probably be good...

Quoted 6 lines
Quoted 4 lines

My use case is that the pin settings change depending on the FPGA image (e.g. hps pins routed to FPGA etc.). With the current code, I have to update SPL to match the FPGA...

Right, having it in DT, we could have one SPL for multiple systems. Would be nice.

I'll try if I can test that. That would probably result in a pinctrl driver that only supports one preset pin set...

Quoted 10 lines
Quoted 7 lines

> But that again would require more time than I currently have... :-(

Right, I'm not asking you to do it to get this series in.

I didn't mean to say that. But I'd like to have that better sooner than later. Only I can't find the time to do it ...

Right, that's what I meant.

btw you gonna be at EW next week ?

No, unfortunately not.

Regards,

Simon