arm: socfpga: implement proper peripheral reset handling
Subsystems (7)
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, a Kconfig option is added to keep the old behaviour of just enabling all peripherals from SPL. This option is default 'y' for now but should be moved to default 'n' in the near future once a Linux kernel supports reset handling for all drivers.
Simon Goldschmidt (5):
arm: socfpga: gen5: add reset handles to devicetrees
arm: socfpga: move SDR reset handling to driver
mtd: rawnand: denali: add reset handling
spi: cadence_qspi: add reset handling
arm: socfpga: implement proper peripheral reset
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 ++ .../socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 ++ arch/arm/dts/socfpga_cyclone5_de1_soc.dts | 5 ++ arch/arm/dts/socfpga_cyclone5_is1.dts | 5 ++ .../dts/socfpga_cyclone5_socdk-u-boot.dtsi | 6 ++ .../dts/socfpga_cyclone5_sockit-u-boot.dtsi | 6 ++ .../dts/socfpga_cyclone5_socrates-u-boot.dtsi | 10 +++ arch/arm/dts/socfpga_cyclone5_sr1500.dts | 5 ++ .../socfpga_cyclone5_vining_fpga-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_u-boot.dtsi | 61 +++++++++++++++++++ arch/arm/mach-socfpga/Kconfig | 10 +++ arch/arm/mach-socfpga/misc_gen5.c | 2 + arch/arm/mach-socfpga/spl_gen5.c | 11 +++- drivers/ddr/altera/sdram_gen5.c | 4 ++ drivers/mtd/nand/raw/denali_dt.c | 8 +++ drivers/spi/cadence_qspi.c | 9 +++ 18 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/socfpga_u-boot.dtsi
Signature · 1 line
2.17.1
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals,
some device tree nodes are missing reset handles.
Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20, and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.
This adds a new file socfpga_u-boot.dtsi (note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.
---
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 ++ .../socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 ++ arch/arm/dts/socfpga_cyclone5_de1_soc.dts | 5 ++ arch/arm/dts/socfpga_cyclone5_is1.dts | 5 ++ .../dts/socfpga_cyclone5_socdk-u-boot.dtsi | 6 ++ .../dts/socfpga_cyclone5_sockit-u-boot.dtsi | 6 ++ .../dts/socfpga_cyclone5_socrates-u-boot.dtsi | 10 +++ arch/arm/dts/socfpga_cyclone5_sr1500.dts | 5 ++ .../socfpga_cyclone5_vining_fpga-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_u-boot.dtsi | 61 +++++++++++++++++++ 12 files changed, 126 insertions(+) create mode 100644 arch/arm/dts/socfpga_u-boot.dtsi
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi +6 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { spi0 = "/soc/spi at ff705000";
@@ -17,6 +19,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &watchdog0 { status = "disabled"; };
arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts +5 -0
@@ -4,6 +4,7 @@ */ #include "socfpga_cyclone5.dtsi" +#include "socfpga_u-boot.dtsi" / { model = "Devboards.de DBM-SoC1";
@@ -30,6 +31,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &gmac1 { status = "okay"; phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_de0_nano_soc-u-boot.dtsi +6 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { udc0 = &usb1;
@@ -16,6 +18,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &watchdog0 { status = "disabled"; };
arch/arm/dts/socfpga_cyclone5_de10_nano.dts +5 -0
@@ -6,6 +6,7 @@ */ #include "socfpga_cyclone5.dtsi" +#include "socfpga_u-boot.dtsi" / { model = "Terasic DE10-Nano";
@@ -32,6 +33,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &gmac1 { status = "okay"; phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_de1_soc.dts +5 -0
@@ -4,6 +4,7 @@ */ #include "socfpga_cyclone5.dtsi" +#include "socfpga_u-boot.dtsi" / { model = "Terasic DE1-SoC";
@@ -30,6 +31,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &gmac1 { status = "okay"; phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_is1.dts +5 -0
@@ -4,6 +4,7 @@ */ #include "socfpga_cyclone5.dtsi" +#include "socfpga_u-boot.dtsi" / { model = "SoCFPGA Cyclone V IS1";
@@ -37,6 +38,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &gmac1 { status = "okay"; phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_socdk-u-boot.dtsi +6 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { spi0 = "/soc/spi at ff705000";
@@ -17,6 +19,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &can0 { status = "okay"; };
arch/arm/dts/socfpga_cyclone5_sockit-u-boot.dtsi +6 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { spi0 = "/soc/spi at ff705000";
@@ -17,6 +19,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &watchdog0 { status = "disabled"; };
arch/arm/dts/socfpga_cyclone5_socrates-u-boot.dtsi +10 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { spi0 = "/soc/spi at ff705000";
@@ -17,10 +19,18 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &watchdog0 { status = "disabled"; }; +&rst { + u-boot,dm-pre-reloc; +}; + &mmc { u-boot,dm-pre-reloc; };
arch/arm/dts/socfpga_cyclone5_sr1500.dts +5 -0
@@ -4,6 +4,7 @@ */ #include "socfpga_cyclone5.dtsi" +#include "socfpga_u-boot.dtsi" / { model = "SoCFPGA Cyclone V SR1500";
@@ -33,6 +34,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &gmac1 { status = "okay"; phy-mode = "rgmii";
arch/arm/dts/socfpga_cyclone5_vining_fpga-u-boot.dtsi +6 -0
@@ -6,6 +6,8 @@ * Copyright (c) 2018 Simon Goldschmidt */ +#include "socfpga_u-boot.dtsi" + /{ aliases { spi0 = "/soc/spi at ff705000";
@@ -17,6 +19,10 @@ }; }; +&rst { + u-boot,dm-pre-reloc; +}; + &watchdog0 { status = "disabled"; };
arch/arm/dts/socfpga_u-boot.dtsi new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
Quoted 8 lines · Simon Goldschmidt
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals,
some device tree nodes are missing reset handles.Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20, and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.
Quoted 5 lines
This adds a new file
socfpga_u-boot.dtsi(note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.Signed-off-by Simon Goldschmidt <[email protected]>
Shouldn't all this be in u-boot specific DTs, instead of the ones imported from Linux ?
Quoted 6 lines
---
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 ++ .../socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 ++
[...]
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
Am 26.01.2019 um 09:57 schrieb Marek Vasut:
Quoted 9 lines · Simon Goldschmidt
Quoted 8 lines
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals,
some device tree nodes are missing reset handles.Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20, and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.
Quoted 8 lines
Quoted 5 lines
This adds a new file
socfpga_u-boot.dtsi(note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.Signed-off-by Simon Goldschmidt <[email protected]>Shouldn't all this be in u-boot specific DTs, instead of the ones imported from Linux ?
The "u-boot,dm-pre-reloc" thing should of course stay in u-boot specific DTs. But I had to add many missing "resets = " references that are yet missing in upstream Linux DTs. Dinh is in the process of adding them and I'll make sure to sync that back to U-Boot once it's in Linux mainline git. I just did not want to wait until that happens...
Regards,
Simon
Quoted 9 lines
Quoted 7 lines
---
arch/arm/dts/socfpga_arria5_socdk-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 ++ .../socfpga_cyclone5_de0_nano_soc-u-boot.dtsi | 6 ++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 ++[...]
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
Quoted 17 lines · Simon Goldschmidt
Am 26.01.2019 um 09:57 schrieb Marek Vasut:
Quoted 16 lines · Simon Goldschmidt
Quoted 14 lines
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals, Â some device tree nodes are missing reset handles.
Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20,
and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.This adds a new file
socfpga_u-boot.dtsi(note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.Signed-off-by Simon Goldschmidt <[email protected]>
Quoted 8 lines
Quoted 2 lines
Shouldn't all this be in u-boot specific DTs, instead of the ones imported from Linux ?
The "u-boot,dm-pre-reloc" thing should of course stay in u-boot specific DTs. But I had to add many missing "resets = " references that are yet missing in upstream Linux DTs. Dinh is in the process of adding them and I'll make sure to sync that back to U-Boot once it's in Linux mainline git. I just did not want to wait until that happens...
Maybe you can just submit this patch to Linux too ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
Quoted 22 lines · Marek Vasut
Quoted 20 lines · Simon Goldschmidt
Am 26.01.2019 um 09:57 schrieb Marek Vasut:
Quoted 18 lines · Simon Goldschmidt
Quoted 9 lines
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals,
some device tree nodes are missing reset handles.Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20,
and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.Quoted 5 lines
This adds a new file
socfpga_u-boot.dtsi(note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.Signed-off-by Simon Goldschmidt <[email protected]>Shouldn't all this be in u-boot specific DTs, instead of the ones imported from Linux ?
Quoted 7 lines
Quoted 5 lines
The "u-boot,dm-pre-reloc" thing should of course stay in u-boot specific DTs. But I had to add many missing "resets = " references that are yet missing in upstream Linux DTs. Dinh is in the process of adding them and I'll make sure to sync that back to U-Boot once it's in Linux mainline git. I just did not want to wait until that happens...
Maybe you can just submit this patch to Linux too ?
Dinh has already done that, that's why I have him in the loop here. But his patch was missing some reset pins, so this would need another update.
Regards,
Simon
PATCH 1/5 arm: socfpga: gen5: add reset handles to devicetrees
Quoted 29 lines · Simon Goldschmidt
Quoted 28 lines · Marek Vasut
Quoted 25 lines · Simon Goldschmidt
Am 26.01.2019 um 09:57 schrieb Marek Vasut:
Quoted 10 lines · Simon Goldschmidt
Quoted 9 lines
The SPL for socfpga gen5 currently takes all peripherals out of reset unconditionally. To implement proper reset handling for peripherals,
some device tree nodes are missing reset handles.Since the socfpga gen5 devicetrees are currently in sync with Linux 4.20,
and these reset handles are not added to Linux, yet, let's add them to U-Boot specific dtsi files to ease future merging.Quoted 8 lines
Quoted 5 lines
This adds a new file
socfpga_u-boot.dtsi(note the '_' - if using a '-' this file gets pulled in for some a10/s10 devicetrees) that adds the missing reset handles.Signed-off-by Simon Goldschmidt <[email protected]>Shouldn't all this be in u-boot specific DTs, instead of the ones imported from Linux ?
The "u-boot,dm-pre-reloc" thing should of course stay in u-boot specific DTs. But I had to add many missing "resets = " references that are yet missing in upstream Linux DTs. Dinh is in the process of adding them and I'll make sure to sync that back to U-Boot once it's in Linux mainline git. I just did not want to wait until that happens...
Quoted 4 lines
Quoted 1 line
Maybe you can just submit this patch to Linux too ?
Dinh has already done that, that's why I have him in the loop here. But his patch was missing some reset pins, so this would need another update.
OK, just make sure the DTs stay in sync.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
In reply to Simon GoldschmidtTo clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/spl_gen5.c +0 -1
@@ -98,7 +98,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 );
drivers/ddr/altera/sdram_gen5.c +4 -0
@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h>
@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +writel (rows, &sysmgr_regs->iswgrp_handoff[4 ]);sdr_load_regs (cfg);
Signature · 1 line
2.17.1
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 35 lines · Simon Goldschmidt
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-1@@ -98,7 +98,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 );drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h>
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 440
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +3
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +
Can the reset framework do this ?
Quoted 4 lines
drivers/ddr/altera/sdram_gen5.c +0
-0writel (rows, &sysmgr_regs->iswgrp_handoff[4 ]);sdr_load_regs (cfg);
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 39 lines · Simon Goldschmidt
Quoted 38 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-1@@ -98,7 +98,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 );drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> @@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret;
Quoted 5 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 440
Quoted 3 lines
drivers/ddr/altera/sdram_gen5.c +3
-0+/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
Regards,
Simon
Quoted 7 lines
Quoted 5 lines
drivers/ddr/altera/sdram_gen5.c +0
-0writel (rows, &sysmgr_regs->iswgrp_handoff[4 ]);sdr_load_regs (cfg);
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 45 lines · Simon Goldschmidt
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 35 lines · Simon Goldschmidt
Quoted 34 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c| 1 -
drivers/ddr/altera/sdram_gen5.c | 4 ++++2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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);diff --git
a/drivers/ddr/altera/sdram_gen5.cb/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@ #include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h>Quoted 8 lines
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +0
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg) SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB; int ret;+ /* release DDR from reset */
+socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
+Can the reset framework do this ?
Quoted 5 lines
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 47 lines · Marek Vasut
Quoted 45 lines · Simon Goldschmidt
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 43 lines · Simon Goldschmidt
Quoted 35 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 439
Quoted 5 lines
drivers/ddr/altera/sdram_gen5.c +2
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Quoted 7 lines
Quoted 5 lines
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
I really don't know. Searching through drivers/ddr does not seem to give me an example of a DTS-enabled ddr driver. Given that, I'd rather just push this patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.
Regards,
Simon
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 54 lines · Simon Goldschmidt
Quoted 53 lines · Marek Vasut
Quoted 50 lines · Simon Goldschmidt
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 35 lines · Simon Goldschmidt
Quoted 34 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> Quoted 8 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 439
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +2
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
Quoted 7 lines
Quoted 1 line
How much effort is it to switch this driver over to DM ?
I really don't know. Searching through
drivers/ddrdoes not seem to give me an example of a DTS-enabled ddr driver. Given that, I'd rather just push this patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 64 lines · Marek Vasut
Quoted 54 lines · Simon Goldschmidt
Quoted 53 lines · Marek Vasut
Quoted 50 lines · Simon Goldschmidt
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 35 lines · Simon Goldschmidt
Quoted 34 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> Quoted 8 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 439
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +2
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
Quoted 7 lines
Quoted 1 line
How much effort is it to switch this driver over to DM ?
I really don't know. Searching through
drivers/ddrdoes not seem to give me an example of a DTS-enabled ddr driver. Given that, I'd rather just push this patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.
Quoted 4 lines
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there any reason those are separated from 'drivers/ddr'?
Regards,
Simon
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 65 lines · Simon Goldschmidt
Quoted 64 lines · Marek Vasut
Quoted 61 lines · Simon Goldschmidt
Quoted 47 lines · Marek Vasut
Quoted 45 lines · Simon Goldschmidt
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 43 lines · Simon Goldschmidt
Quoted 35 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 439
Quoted 5 lines
drivers/ddr/altera/sdram_gen5.c +2
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Quoted 7 lines
Quoted 5 lines
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
I really don't know. Searching through
drivers/ddrdoes not seem to give me an example of a DTS-enabled ddr driver. Given that, I'd rather just push this patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.
Quoted 7 lines
Quoted 4 lines
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a
UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there any reason those are separated from 'drivers/ddr'?
I don't think so, seems like these two directories should be merged.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Am 28.01.2019 um 20:02 schrieb Marek Vasut:
Quoted 68 lines · Simon Goldschmidt
Quoted 67 lines · Marek Vasut
Quoted 66 lines · Simon Goldschmidt
Quoted 54 lines · Marek Vasut
Quoted 53 lines · Simon Goldschmidt
Quoted 50 lines
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 35 lines · Simon Goldschmidt
Quoted 34 lines
To clean up reset handling for socfpga gen5, let's move the code snippet taking the DDR controller out of reset from SPL to the DDR driver.
Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> Quoted 8 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int sdr_phy_reg) · line 439
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +2
-0@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned int sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera DDR driver currently does not work with devicetree, so using the reset framework here would be a bigger patch, I think.
Can we do that later and clean up this by just moving the code?
Quoted 7 lines
Quoted 1 line
How much effort is it to switch this driver over to DM ?
I really don't know. Searching through
drivers/ddrdoes not seem to give me an example of a DTS-enabled ddr driver. Given that, I'd rather just push this patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.That's a valid point.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a
UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there any reason those are separated from 'drivers/ddr'?I don't think so, seems like these two directories should be merged.
Yes, I think so too by now.
I'll see if I can change this patch to use UCLASS_RAM. A patch/series to merge drivers/ddr wih drivers/ram should be separate.
Regads,
Simon
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 82 lines · Simon Goldschmidt
Am 28.01.2019 um 20:02 schrieb Marek Vasut:
Quoted 81 lines · Simon Goldschmidt
Quoted 79 lines · Marek Vasut
Quoted 70 lines · Simon Goldschmidt
Quoted 60 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt
Quoted 53 lines
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 37 lines · Simon Goldschmidt
Quoted 36 lines
To clean up reset handling for socfpga gen5, let's move the code snippet
taking the DDR controller out of reset from SPL to the DDR driver.Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c| 1 -
drivers/ddr/altera/sdram_gen5.c | 4 ++++2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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);diff --git
a/drivers/ddr/altera/sdram_gen5.cb/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@ #include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h>@@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned intQuoted 8 lines
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +0
-0sdr_phy_reg) SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB; int ret;+ /* release DDR from reset */
+socfpga_per_reset(SOCFPGA_RESET(SDR), 0);
+Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera
DDR driver currently does not work with devicetree, so using the reset
framework here would be a bigger patch, I think.Quoted 3 lines
Quoted 1 line
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
Quoted 7 lines
I really don't know. Searching through
drivers/ddrdoes not seem to give me
an example of a DTS-enabled ddr driver. Given that, I'd rather just push this
patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.Quoted 4 lines
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a
UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there
any reason those are separated from 'drivers/ddr'?
Quoted 6 lines
Quoted 1 line
I don't think so, seems like these two directories should be merged.
Yes, I think so too by now.
I'll see if I can change this patch to use
UCLASS_RAM. A patch/series to mergedrivers/ddrwihdrivers/ramshould be separate.
Sounds good.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 84 lines · Marek Vasut
Quoted 82 lines · Simon Goldschmidt
Am 28.01.2019 um 20:02 schrieb Marek Vasut:
Quoted 81 lines · Simon Goldschmidt
Quoted 79 lines · Marek Vasut
Quoted 70 lines · Simon Goldschmidt
Quoted 60 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt
Quoted 53 lines
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 37 lines · Simon Goldschmidt
Quoted 36 lines
To clean up reset handling for socfpga gen5, let's move the code snippet
taking the DDR controller out of reset from SPL to the DDR driver.Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> @@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned intQuoted 8 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int · line 440
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +2
-0sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera
DDR driver currently does not work with devicetree, so using the reset
framework here would be a bigger patch, I think.Quoted 3 lines
Quoted 1 line
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
Quoted 7 lines
I really don't know. Searching through
drivers/ddrdoes not seem to give me
an example of a DTS-enabled ddr driver. Given that, I'd rather just push this
patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.Quoted 4 lines
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a
UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there
any reason those are separated from 'drivers/ddr'?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I don't think so, seems like these two directories should be merged.
Yes, I think so too by now.
I'll see if I can change this patch to use
UCLASS_RAM. A patch/series to mergedrivers/ddrwihdrivers/ramshould be separate.Sounds good.
It kind of works with UCLASS_RAM, but there's a problem with the devicetree:
it describes the SDR controller starting at 0xffc25000 where the official memory map from Intel says it starts at 0xffc20000, but describes its registers starting
from offset 0x5000. However, in U-Boot, the file 'drivers/ddr/altera/sequencer.c'
uses those lower addresses.
So now I can either change the dts to let SDR registers start at 0xffc20000 instead of 0xffc25000 (and in consequence adapt Linux, too) or add a new driver for the sequencer that occupies this lower range (and make sdram_gen5.c use it somehow).
Before I spin another round, what would be the preferred way to take?
Anyway, I failed to find public documentation for this sequencer thing. Do you happen to know why it's done like this?
Regards,
Simon
PATCH 2/5 arm: socfpga: move SDR reset handling to driver
Quoted 102 lines · Simon Goldschmidt
Quoted 84 lines · Marek Vasut
Quoted 82 lines · Simon Goldschmidt
Am 28.01.2019 um 20:02 schrieb Marek Vasut:
Quoted 81 lines · Simon Goldschmidt
Quoted 79 lines · Marek Vasut
Quoted 70 lines · Simon Goldschmidt
Quoted 60 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt
Quoted 53 lines
Am 26.01.2019 um 09:58 schrieb Marek Vasut:
Quoted 37 lines · Simon Goldschmidt
Quoted 36 lines
To clean up reset handling for socfpga gen5, let's move the code snippet
taking the DDR controller out of reset from SPL to the DDR driver.Signed-off-by Simon Goldschmidt <[email protected]>---
arch/arm/mach-socfpga/spl_gen5.c | 1 - drivers/ddr/altera/sdram_gen5.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)arch/arm/mach-socfpga/spl_gen5.c +0
-0@@ -98,7 +98,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 ); diff --git a/drivers/ddr/altera/sdram_gen5.c
b/drivers/ddr/altera/sdram_gen5.c
index821060459c..bd54c420f8100644drivers/ddr/altera/sdram_gen5.c +1
-0@@ -7,6 +7,7 @@#include <div64.h> #include <watchdog.h> #include <asm/arch/fpga_manager.h> +#include <asm/arch/reset_manager.h> #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> @@ -434,6 +435,9 @@ int sdram_mmr_init_full(unsigned intQuoted 8 lines
drivers/ddr/altera/sdram_gen5.c int sdram_mmr_init_full(unsigned int · line 440
Quoted 6 lines
drivers/ddr/altera/sdram_gen5.c +2
-0sdr_phy_reg)SDR_CTRLGRP_DRAMADDRW_ROWBITS_LSB ;int ret; +/* release DDR from reset */ +socfpga_per_reset (SOCFPGA_RESET (SDR ),0 ); +Can the reset framework do this ?
Hmm, it probably could, but I see that as a diferent patch. The altera
DDR driver currently does not work with devicetree, so using the reset
framework here would be a bigger patch, I think.Quoted 3 lines
Quoted 1 line
Can we do that later and clean up this by just moving the code?
How much effort is it to switch this driver over to DM ?
Quoted 7 lines
I really don't know. Searching through
drivers/ddrdoes not seem to give me
an example of a DTS-enabled ddr driver. Given that, I'd rather just push this
patch now. While it's true that it doesn't clean up everything, it's not as if it
would make things worse.Quoted 4 lines
That's a valid point.
I guess you can add DRAM uclass and just probe the driver, which should be all that's needed.
Hmm, there *is* a
UCLASS_RAM, but its drivers are in 'drivers/ram'. Is there
any reason those are separated from 'drivers/ddr'?Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I don't think so, seems like these two directories should be merged.
Yes, I think so too by now.
I'll see if I can change this patch to use
UCLASS_RAM. A patch/series to mergedrivers/ddrwihdrivers/ramshould be separate.Sounds good.
It kind of works with
UCLASS_RAM, but there's a problem with the devicetree:
it describes the SDR controller starting at0xffc25000where the official memory map from Intel says it starts at0xffc20000, but describes its registers starting
from offset0x5000. However, in U-Boot, the file 'drivers/ddr/altera/sequencer.c'
uses those lower addresses.
Quoted 4 lines
So now I can either change the dts to let SDR registers start at
0xffc20000instead of0xffc25000(and in consequence adapt Linux, too) or add a new driver for the sequencer that occupies this lower range (and makesdram_gen5.cuse it somehow).
Fix the DT, I think the DT is buggy. The DRAM controller probably starts at 0xffc2_0000 and the various 4k chunks above 0xffc2_0000 are various subcomponents of the DDR controller.
Quoted 4 lines
Before I spin another round, what would be the preferred way to take?
Anyway, I failed to find public documentation for this sequencer thing. Do you happen to know why it's done like this?
I don't have one, but I _think_ it's a HW instance of the altera DDR3 controller which you can also put into the FPGA, and that one is in quartus.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 3/5 mtd: rawnand: denali: add reset handling
In reply to Simon GoldschmidtThis adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mtd/nand/raw/denali_dt.c +8 -0
@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h"
@@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);
@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; } + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk); +return denali_init (denali); }
Signature · 1 line
2.17.1
PATCH 3/5 mtd: rawnand: denali: add reset handling
Quoted 32 lines · Simon Goldschmidt
This adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 138
Quoted 6 lines
drivers/mtd/nand/raw/denali_dt.c +3
-0@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; } + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret);
Can't , misplaced "'"
Quoted 7 lines
drivers/mtd/nand/raw/denali_dt.c +3
-0+else +reset_deassert_bulk (&reset_bulk); +return denali_init (denali); }
Signature · 2 lines
Best regards, Marek Vasut
Miquel Raynal
maintainerPATCH 3/5 mtd: rawnand: denali: add reset handling
In reply to Simon GoldschmidtHi Simon,
Simon Goldschmidt <[email protected]> wrote on Fri, 25 Jan 2019 21:30:49 +0100:
Quoted 1 line
This adds reset handling to the devicetree-enabled denalid nand driver.
"Denali NAND driver"
Quoted 31 lines
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 140
Quoted 8 lines
drivers/mtd/nand/raw/denali_dt.c +5
-0@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; } + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk);
Where are reset_get_bulk/reset_deassert_bulk() defined?
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 144
Quoted 4 lines
drivers/mtd/nand/raw/denali_dt.c +1
-0+return denali_init (denali); }
Thanks,
Miquèl
PATCH 3/5 mtd: rawnand: denali: add reset handling
Hi Miquel,
Quoted 9 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Fri, 25 Jan 2019 21:30:49 +0100:
Quoted 1 line
This adds reset handling to the devicetree-enabled denalid nand driver.
"Denali NAND driver"
Right.
Quoted 35 lines
Quoted 35 lines
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; }
Quoted 7 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 140
Quoted 5 lines
drivers/mtd/nand/raw/denali_dt.c +5
-0+ ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk);Where are reset_get_bulk/reset_deassert_bulk() defined?
In reset.h. That's why I added this include (see above)...
Regards,
Simon
Quoted 8 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 144
Quoted 5 lines
drivers/mtd/nand/raw/denali_dt.c +1
-0+return denali_init (denali); }Thanks,
Miquèl
Miquel Raynal
maintainerPATCH 3/5 mtd: rawnand: denali: add reset handling
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Mon, 28 Jan 2019 10:16:28 +0100:
Quoted 59 lines
Hi Miquel,
Quoted 9 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Fri, 25 Jan 2019 21:30:49 +0100:
Quoted 1 line
This adds reset handling to the devicetree-enabled denalid nand driver.
"Denali NAND driver"
Right.
Quoted 35 lines
Quoted 35 lines
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; }Quoted 7 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 140
Quoted 5 lines
drivers/mtd/nand/raw/denali_dt.c +5
-0+ ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk);Where are reset_get_bulk/reset_deassert_bulk() defined?
Quoted 1 line
In
reset.h. That's why I added this include (see above)...
Yes but I guess it is something that will be merged in 5.1? Maybe I will wait for the next release to take this one.
Thanks,
Miquèl
PATCH 3/5 mtd: rawnand: denali: add reset handling
Hi Miquel,
Quoted 65 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Mon, 28 Jan 2019 10:16:28 +0100:
Quoted 59 lines
Hi Miquel,
Quoted 9 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Fri, 25 Jan 2019 21:30:49 +0100:
Quoted 1 line
This adds reset handling to the devicetree-enabled denalid nand driver.
"Denali NAND driver"
Right.
Quoted 42 lines
Quoted 32 lines
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 140
Quoted 8 lines
drivers/mtd/nand/raw/denali_dt.c +5
-0@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; } + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk);Where are reset_get_bulk/reset_deassert_bulk() defined?
Quoted 4 lines
Quoted 1 line
In
reset.h. That's why I added this include (see above)...Yes but I guess it is something that will be merged in 5.1? Maybe I will wait for the next release to take this one.
You mean Linux 5.1, right? This patch is for U-Boot, not Linux.
Regards,
Simon
Miquel Raynal
maintainerPATCH 3/5 mtd: rawnand: denali: add reset handling
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Mon, 28 Jan 2019 10:30:12 +0100:
Quoted 69 lines
Hi Miquel,
Quoted 65 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Mon, 28 Jan 2019 10:16:28 +0100:
Quoted 59 lines
Hi Miquel,
Quoted 9 lines · Miquel Raynal
Hi Simon,
Simon Goldschmidt <[email protected]> wrote on Fri, 25 Jan 2019 21:30:49 +0100:
Quoted 1 line
This adds reset handling to the devicetree-enabled denalid nand driver.
"Denali NAND driver"
Right.
Quoted 42 lines
Quoted 32 lines
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/mtd/nand/raw/denali_dt.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -9,6 +9,7 @@#include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> +#include <reset.h> #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev)const struct denali_dt_data *data;struct clk clk, clk_x, clk_ecc;struct resource res; +struct reset_ctl_bulk reset_bulk;int ret; data = (void *)dev_get_driver_data (dev);drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 140
Quoted 8 lines
drivers/mtd/nand/raw/denali_dt.c +5
-0@@ -131,6 +133,12 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate =200000000 ; } + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk);Where are reset_get_bulk/reset_deassert_bulk() defined?
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
In
reset.h. That's why I added this include (see above)...Yes but I guess it is something that will be merged in 5.1? Maybe I will wait for the next release to take this one.
You mean Linux 5.1, right? This patch is for U-Boot, not Linux.
My bad, I had SIEVE rules issues, the patch did not got flagged for "U-Boot". Sorry for the misunderstanding.
Thanks,
Miquèl
PATCH 4/5 spi: cadence_qspi: add reset handling
In reply to Simon GoldschmidtThis adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
---
drivers/spi/cadence_qspi.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/spi/cadence_qspi.c +9 -0
@@ -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,18 @@ static int cadence_spi_probe(struct udevice *bus) {struct cadence_spi_platdata *plat = bus->platdata;struct cadence_spi_priv *priv =dev_get_priv (bus); +struct reset_ctl_bulk reset_bulk; +int ret; priv->regbase = plat->regbase; priv->ahbbase = plat->ahbbase; + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret); +else +reset_deassert_bulk (&reset_bulk); +if (!priv->qspi_is_init) {cadence_qspi_apb_controller_init (plat); priv->qspi_is_init =1 ;
Signature · 1 line
2.17.1
PATCH 4/5 spi: cadence_qspi: add reset handling
Quoted 26 lines · Simon Goldschmidt
This adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/spi/cadence_qspi.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/spi/cadence_qspi.c +1
-0@@ -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,18 @@ static int cadence_spi_probe(struct udevice *bus) {struct cadence_spi_platdata *plat = bus->platdata;
drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 166
Quoted 10 lines
drivers/spi/cadence_qspi.c +5
-0struct cadence_spi_priv *priv =dev_get_priv (bus); +struct reset_ctl_bulk reset_bulk; +int ret; priv->regbase = plat->regbase; priv->ahbbase = plat->ahbbase; + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret);
Can't
Also, shouldn't there be some reset_release or reset_free somewhere ? What about .remove(), shouldn't that release the reset ?
Quoted 7 lines
drivers/spi/cadence_qspi.c +3
-0+else +reset_deassert_bulk (&reset_bulk); +if (!priv->qspi_is_init) {cadence_qspi_apb_controller_init (plat); priv->qspi_is_init =1 ;
Signature · 2 lines
Best regards, Marek Vasut
PATCH 4/5 spi: cadence_qspi: add reset handling
Am 26.01.2019 um 09:59 schrieb Marek Vasut:
Quoted 31 lines · Simon Goldschmidt
Quoted 30 lines
This adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/spi/cadence_qspi.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/spi/cadence_qspi.c +3
-0@@ -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,18 @@ static int cadence_spi_probe(struct udevice *bus) {struct cadence_spi_platdata *plat = bus->platdata;struct cadence_spi_priv *priv =dev_get_priv (bus); +struct reset_ctl_bulk reset_bulk; +int ret;
Quoted 8 lines
drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 166
Quoted 6 lines
drivers/spi/cadence_qspi.c +3
-0priv->regbase = plat->regbase; priv->ahbbase = plat->ahbbase; + ret =reset_get_bulk (bus, &reset_bulk); +if (ret) +dev_warn (bus,"Cant' get reset: %d\n" , ret);Can't
Right. Copy & paste from 3/5...
Quoted 3 lines
Also, shouldn't there be some
reset_releaseorreset_freesomewhere ? What about .remove(), shouldn't that release the reset ?
Ehrm, well... this is my first driver using the reset framework. I haven't though of remove. I'll do a V2 for that soon.
Regards,
Simon
Quoted 10 lines
Quoted 8 lines
drivers/spi/cadence_qspi.c +3
-0+else +reset_deassert_bulk (&reset_bulk); +if (!priv->qspi_is_init) {cadence_qspi_apb_controller_init (plat); priv->qspi_is_init =1 ;
PATCH 4/5 spi: cadence_qspi: add reset handling
Quoted 39 lines · Simon Goldschmidt
Am 26.01.2019 um 09:59 schrieb Marek Vasut:
Quoted 29 lines · Simon Goldschmidt
Quoted 28 lines
This adds reset handling to the devicetree-enabled denalid nand driver.
For backwards compatibility, only a warning is printed when failing to get reset handles.
Signed-off-by Simon Goldschmidt <[email protected]>---
drivers/spi/cadence_qspi.c| 9 +++++++++1 file changed, 9 insertions(+)drivers/spi/cadence_qspi.c +2
-0@@ -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,18 @@ static int cadence_spi_probe(struct udevice *bus) { struct cadence_spi_platdata *plat = bus->platdata; struct cadence_spi_priv *priv = dev_get_priv(bus); + struct reset_ctl_bulk reset_bulk;Quoted 8 lines
drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 166
Quoted 6 lines
drivers/spi/cadence_qspi.c +3
-0+ int ret; priv->regbase = plat->regbase; priv->ahbbase = plat->ahbbase; + ret = reset_get_bulk(bus, &reset_bulk); + if (ret) + dev_warn(bus, "Cant' get reset: %d\n", ret);Can't
Quoted 8 lines
Right. Copy & paste from 3/5...
Quoted 3 lines
Also, shouldn't there be some
reset_releaseorreset_freesomewhere ? What about .remove(), shouldn't that release the reset ?Ehrm, well... this is my first driver using the reset framework. I haven't though of remove. I'll do a V2 for that soon.
Thanks
Signature · 2 lines
Best regards, Marek Vasut
PATCH 5/5 arm: socfpga: implement proper peripheral reset
In reply to Simon GoldschmidtThis 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.
For kernels that don't support taking peripherals out of reset that are not enabled by U-Boot, a new Kconfig option "OLD_SOCFPGA_KERNEL_COMPAT" is added, which keeps the old behaviour of just enabling all peripherals.
This new option is enabled by default for now, as even Linux 4.20 does not support reset handling on all peripherals.
---
arch/arm/mach-socfpga/Kconfig | 10 ++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 2 ++ arch/arm/mach-socfpga/spl_gen5.c | 10 ++++++++++ 3 files changed, 22 insertions(+)
arch/arm/mach-socfpga/Kconfig +10 -0
@@ -142,4 +142,14 @@ config SYS_CONFIG_NAME default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA +config OLD_SOCFPGA_KERNEL_COMPAT + bool "Enable workarounds for booting old kernels" + depends on TARGET_SOCFPGA_GEN5 + default y + help + Set this to enable various workarounds for old kernels (e.g. take all + peripherals out of reset because old kernels cannot handle reset). + This results in sub-optimal settings for newer kernels, only enable + if needed. + endif
arch/arm/mach-socfpga/misc_gen5.c +2 -0
@@ -243,6 +243,7 @@ int arch_early_init_r(void)/* Add device descriptor to FPGA device table */ socfpga_fpga_add (&altera_fpga[0 ]); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT #ifdef CONFIG_DESIGNWARE_SPI /* Get Designware SPI controller out of reset */ socfpga_per_reset (SOCFPGA_RESET (SPIM0 ),0 );
@@ -252,6 +253,7 @@ int arch_early_init_r(void)#ifdef CONFIG_NAND_DENALI socfpga_per_reset (SOCFPGA_RESET (NAND ),0 );#endif +#endif /* CONFIG_OLD_SOCFPGA_KERNEL_COMPAT */ return 0 ; }
arch/arm/mach-socfpga/spl_gen5.c +10 -0
@@ -35,16 +35,22 @@ u32 spl_boot_device(void)return BOOT_DEVICE_RAM ;case 0x2 :/* NAND Flash (1.8V) */ case 0x3 :/* NAND Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (NAND ),0 ); +#endif return BOOT_DEVICE_NAND ;case 0x4 :/* SD/MMC External Transceiver (1.8V) */ case 0x5 :/* SD/MMC Internal Transceiver (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (SDMMC ),0 );socfpga_per_reset (SOCFPGA_RESET (DMA ),0 ); +#endif return BOOT_DEVICE_MMC1 ;case 0x6 :/* QSPI Flash (1.8V) */ case 0x7 :/* QSPI Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (QSPI ),0 ); +#endif return BOOT_DEVICE_SPI ;default :printf ("Invalid boot device (bsel=%08x)!\n" , bsel);
@@ -98,7 +104,9 @@ void board_init_f(ulong dummy)socfpga_bridges_reset (1 ); } +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 ); +#endif socfpga_per_reset (SOCFPGA_RESET (OSC1TIMER0 ),0 );timer_init ();
@@ -122,9 +130,11 @@ void board_init_f(ulong dummy)sysmgr_pinmux_init ();sysmgr_config_warmrstcfgio (0 ); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT /* De-assert reset for peripherals and bridges based on handoff */ reset_deassert_peripherals_handoff ();socfpga_bridges_reset (0 ); +#endif debug ("Unfreezing/Thaw all I/O banks\n" );/* unfreeze / thaw all IO banks */
Signature · 1 line
2.17.1
PATCH 5/5 arm: socfpga: implement proper peripheral reset
Quoted 5 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.
Quoted 8 lines
For kernels that don't support taking peripherals out of reset that are not enabled by U-Boot, a new
Kconfigoption "OLD_SOCFPGA_KERNEL_COMPAT" is added, which keeps the old behaviour of just enabling all peripherals.This new option is enabled by default for now, as even Linux 4.20 does not support reset handling on all peripherals.
Signed-off-by Simon Goldschmidt <[email protected]>
Well ew, don't we have some pre-linux-boot hook which could just flip the reset register bits in one place ? And also, I'd prefer this to be runtime-configurable, not compile-time configurable.
Quoted 96 lines
---
arch/arm/mach-socfpga/Kconfig | 10 ++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 2 ++ arch/arm/mach-socfpga/spl_gen5.c | 10 ++++++++++ 3 files changed, 22 insertions(+)arch/arm/mach-socfpga/Kconfig +10
-0@@ -142,4 +142,14 @@ config SYS_CONFIG_NAME default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA +config OLD_SOCFPGA_KERNEL_COMPAT + bool "Enable workarounds for booting old kernels" + depends on TARGET_SOCFPGA_GEN5 + default y + help + Set this to enable various workarounds for old kernels (e.g. take all + peripherals out of reset because old kernels cannot handle reset). + This results in sub-optimal settings for newer kernels, only enable + if needed. + endifarch/arm/mach-socfpga/misc_gen5.c +2
-0@@ -243,6 +243,7 @@ int arch_early_init_r(void)/* Add device descriptor to FPGA device table */ socfpga_fpga_add (&altera_fpga[0 ]); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT #ifdef CONFIG_DESIGNWARE_SPI /* Get Designware SPI controller out of reset */ socfpga_per_reset (SOCFPGA_RESET (SPIM0 ),0 );@@ -252,6 +253,7 @@ int arch_early_init_r(void)#ifdef CONFIG_NAND_DENALI socfpga_per_reset (SOCFPGA_RESET (NAND ),0 );#endif +#endif /* CONFIG_OLD_SOCFPGA_KERNEL_COMPAT */ return 0 ; }arch/arm/mach-socfpga/spl_gen5.c +10
-0@@ -35,16 +35,22 @@ u32 spl_boot_device(void)return BOOT_DEVICE_RAM ;case 0x2 :/* NAND Flash (1.8V) */ case 0x3 :/* NAND Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (NAND ),0 ); +#endif return BOOT_DEVICE_NAND ;case 0x4 :/* SD/MMC External Transceiver (1.8V) */ case 0x5 :/* SD/MMC Internal Transceiver (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (SDMMC ),0 );socfpga_per_reset (SOCFPGA_RESET (DMA ),0 ); +#endif return BOOT_DEVICE_MMC1 ;case 0x6 :/* QSPI Flash (1.8V) */ case 0x7 :/* QSPI Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (QSPI ),0 ); +#endif return BOOT_DEVICE_SPI ;default :printf ("Invalid boot device (bsel=%08x)!\n" , bsel);@@ -98,7 +104,9 @@ void board_init_f(ulong dummy)socfpga_bridges_reset (1 ); } +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 ); +#endif socfpga_per_reset (SOCFPGA_RESET (OSC1TIMER0 ),0 );timer_init ();@@ -122,9 +130,11 @@ void board_init_f(ulong dummy)sysmgr_pinmux_init ();sysmgr_config_warmrstcfgio (0 ); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT /* De-assert reset for peripherals and bridges based on handoff */ reset_deassert_peripherals_handoff ();socfpga_bridges_reset (0 ); +#endif debug ("Unfreezing/Thaw all I/O banks\n" );/* unfreeze / thaw all IO banks */
Signature · 2 lines
Best regards, Marek Vasut
PATCH 5/5 arm: socfpga: implement proper peripheral reset
Am 26.01.2019 um 10:00 schrieb Marek Vasut:
Quoted 10 lines · Simon Goldschmidt
Quoted 9 lines
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.
For kernels that don't support taking peripherals out of reset that are not enabled by U-Boot, a new
Kconfigoption "OLD_SOCFPGA_KERNEL_COMPAT" is added, which keeps the old behaviour of just enabling all peripherals.
Quoted 8 lines
Quoted 4 lines
This new option is enabled by default for now, as even Linux 4.20 does not support reset handling on all peripherals.
Signed-off-by Simon Goldschmidt <[email protected]>Well ew, don't we have some pre-linux-boot hook which could just flip the reset register bits in one place ? And also, I'd prefer this to be runtime-configurable, not compile-time configurable.
And this will be the biggest change for v2. It's also why I needed so long to send this series. What I sent in this version is how Tom said the same thing is being handled for mach-sunxi (Kconfig "OLD_SUNXI_KERNEL_COMPAT").
So if I remember your last mails about this topic, you'd prefer an environment variable with a callback that leads to enabling all peripherals just before jumping to Linux (yes, I'll find a hook for that).
I see two problems here:
- enabling all peripherals will need to be the default for some time, until Linux supports reset handling in all drivers. How do you want to deal with that?
- is this scheme used somewhere else for compatibility? I think it would make sense for multiple architectures to use the same way to handle such compatibility issues...
Regards,
Simon
Quoted 99 lines
Quoted 97 lines
---
arch/arm/mach-socfpga/Kconfig | 10 ++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 2 ++ arch/arm/mach-socfpga/spl_gen5.c | 10 ++++++++++ 3 files changed, 22 insertions(+)arch/arm/mach-socfpga/Kconfig +10
-0@@ -142,4 +142,14 @@ config SYS_CONFIG_NAME default "socfpga_stratix10_socdk" if TARGET_SOCFPGA_STRATIX10_SOCDK default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA +config OLD_SOCFPGA_KERNEL_COMPAT + bool "Enable workarounds for booting old kernels" + depends on TARGET_SOCFPGA_GEN5 + default y + help + Set this to enable various workarounds for old kernels (e.g. take all + peripherals out of reset because old kernels cannot handle reset). + This results in sub-optimal settings for newer kernels, only enable + if needed. + endifarch/arm/mach-socfpga/misc_gen5.c +2
-0@@ -243,6 +243,7 @@ int arch_early_init_r(void)/* Add device descriptor to FPGA device table */ socfpga_fpga_add (&altera_fpga[0 ]); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT #ifdef CONFIG_DESIGNWARE_SPI /* Get Designware SPI controller out of reset */ socfpga_per_reset (SOCFPGA_RESET (SPIM0 ),0 );@@ -252,6 +253,7 @@ int arch_early_init_r(void)#ifdef CONFIG_NAND_DENALI socfpga_per_reset (SOCFPGA_RESET (NAND ),0 );#endif +#endif /* CONFIG_OLD_SOCFPGA_KERNEL_COMPAT */ return 0 ; }arch/arm/mach-socfpga/spl_gen5.c +10
-0@@ -35,16 +35,22 @@ u32 spl_boot_device(void)return BOOT_DEVICE_RAM ;case 0x2 :/* NAND Flash (1.8V) */ case 0x3 :/* NAND Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (NAND ),0 ); +#endif return BOOT_DEVICE_NAND ;case 0x4 :/* SD/MMC External Transceiver (1.8V) */ case 0x5 :/* SD/MMC Internal Transceiver (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (SDMMC ),0 );socfpga_per_reset (SOCFPGA_RESET (DMA ),0 ); +#endif return BOOT_DEVICE_MMC1 ;case 0x6 :/* QSPI Flash (1.8V) */ case 0x7 :/* QSPI Flash (3.0V) */ +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (QSPI ),0 ); +#endif return BOOT_DEVICE_SPI ;default :printf ("Invalid boot device (bsel=%08x)!\n" , bsel);@@ -98,7 +104,9 @@ void board_init_f(ulong dummy)socfpga_bridges_reset (1 ); } +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 ); +#endif socfpga_per_reset (SOCFPGA_RESET (OSC1TIMER0 ),0 );timer_init ();@@ -122,9 +130,11 @@ void board_init_f(ulong dummy)sysmgr_pinmux_init ();sysmgr_config_warmrstcfgio (0 ); +#ifdef CONFIG_OLD_SOCFPGA_KERNEL_COMPAT /* De-assert reset for peripherals and bridges based on handoff */ reset_deassert_peripherals_handoff ();socfpga_bridges_reset (0 ); +#endif debug ("Unfreezing/Thaw all I/O banks\n" );/* unfreeze / thaw all IO banks */
PATCH 5/5 arm: socfpga: implement proper peripheral reset
Quoted 22 lines · Simon Goldschmidt
Am 26.01.2019 um 10:00 schrieb Marek Vasut:
Quoted 11 lines · Simon Goldschmidt
Quoted 10 lines
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.
For kernels that don't support taking peripherals out of reset that are not enabled by U-Boot, a new
Kconfigoption "OLD_SOCFPGA_KERNEL_COMPAT" is added, which keeps the old behaviour of just enabling all peripherals.Quoted 8 lines
Quoted 4 lines
This new option is enabled by default for now, as even Linux 4.20 does not support reset handling on all peripherals.
Signed-off-by Simon Goldschmidt <[email protected]>Well ew, don't we have some pre-linux-boot hook which could just flip the reset register bits in one place ? And also, I'd prefer this to be runtime-configurable, not compile-time configurable.
Quoted 8 lines
And this will be the biggest change for v2. It's also why I needed so long to send this series. What I sent in this version is how Tom said the same thing is being handled for mach-sunxi (
Kconfig"OLD_SUNXI_KERNEL_COMPAT").So if I remember your last mails about this topic, you'd prefer an environment variable with a callback that leads to enabling all peripherals just before jumping to Linux (yes, I'll find a hook for that).
Rather, I'd prefer some .remove() code in the SoCFPGA reset driver which would check an environment variable to determine whether it should ungate the resets before booting Linux or not.
Quoted 4 lines
I see two problems here:
- enabling all peripherals will need to be the default for some time, until Linux supports reset handling in all drivers. How do you want to deal with that?
Set the env variable to default=1 for all socfpga boards ?
Quoted 3 lines
- is this scheme used somewhere else for compatibility? I think it would make sense for multiple architectures to use the same way to handle such compatibility issues...
I don't think so, however it's better than compile-time setting.
[...]
Signature · 2 lines
Best regards, Marek Vasut
PATCH 5/5 arm: socfpga: implement proper peripheral reset
Quoted 29 lines · Marek Vasut
Quoted 27 lines · Simon Goldschmidt
Am 26.01.2019 um 10:00 schrieb Marek Vasut:
Quoted 11 lines · Simon Goldschmidt
Quoted 10 lines
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.
For kernels that don't support taking peripherals out of reset that are not enabled by U-Boot, a new
Kconfigoption "OLD_SOCFPGA_KERNEL_COMPAT" is added, which keeps the old behaviour of just enabling all peripherals.Quoted 8 lines
Quoted 4 lines
This new option is enabled by default for now, as even Linux 4.20 does not support reset handling on all peripherals.
Signed-off-by Simon Goldschmidt <[email protected]>Well ew, don't we have some pre-linux-boot hook which could just flip the reset register bits in one place ? And also, I'd prefer this to be runtime-configurable, not compile-time configurable.
And this will be the biggest change for v2. It's also why I needed so long to send this series. What I sent in this version is how Tom said the same thing is being handled for mach-sunxi (
Kconfig"OLD_SUNXI_KERNEL_COMPAT").
Quoted 7 lines
Quoted 3 lines
So if I remember your last mails about this topic, you'd prefer an environment variable with a callback that leads to enabling all peripherals just before jumping to Linux (yes, I'll find a hook for that).
Rather, I'd prefer some .remove() code in the SoCFPGA reset driver which would check an environment variable to determine whether it should ungate the resets before booting Linux or not.
OK, that should work. I'll work on that for v2.
Regards,
Simon
Quoted 19 lines
Quoted 5 lines
I see two problems here:
- enabling all peripherals will need to be the default for some time, until Linux supports reset handling in all drivers. How do you want to deal with that?Set the env variable to default=1 for all socfpga boards ?
Quoted 3 lines
- is this scheme used somewhere else for compatibility? I think it would make sense for multiple architectures to use the same way to handle such compatibility issues...
I don't think so, however it's better than compile-time setting.
[...]
--
Best regards,
Marek Vasut