mtd: rawnand: denali-spl: Add missing hardware init
Subsystems (3)
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
While the Denali NAND is initialized by the BootROM in SPL, there are still a couple of settings which are missing. These can trigger subtle corruption of the data read out of the NAND. Fill these settings in just like they are filled in by the full Denali NAND driver in denali_hw_init().
--- drivers/mtd/nand/raw/denali_spl.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mtd/nand/raw/denali_spl.c +7 -0
@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES ); +writel (0x0F , denali_flash_reg +RB_PIN_ENABLED ); +writel (CHIP_EN_DONT_CARE__FLAG , denali_flash_reg +CHIP_ENABLE_DONT_CARE ); +writel (0xffff , denali_flash_reg +SPARE_AREA_MARKER ); }int nand_spl_load_image (uint32_t offs,unsigned int size,void *dst)
Signature · 1 line
2.24.0.432.g9d3f5f5b63
PATCH 2/3 mtd: rawnand: denali: Allow operation without clock driver
The SoCFPGA Gen5 does not have a clock driver yet, let the NAND driver work without a clock driver by falling back to the default frequencies.
--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/denali_dt.c +8 -4
@@ -62,7 +62,6 @@ static int denali_dt_probe(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);const struct denali_dt_data *data; -struct clk clk, clk_x, clk_ecc;struct resource res;int ret;
@@ -87,11 +86,14 @@ static int denali_dt_probe(struct udevice *dev) denali->host =devm_ioremap (dev, res.start,resource_size (&res)); +#if CONFIG_IS_ENABLED (CLK ) +struct clk clk, clk_x, clk_ecc; + ret =clk_get_by_name (dev,"nand" , &clk);if (ret) ret =clk_get_by_index (dev,0 , &clk);if (ret) -return ret; + clk.dev =NULL ; ret =clk_get_by_name (dev,"nand_x" , &clk_x);if (ret)
@@ -117,10 +119,12 @@ static int denali_dt_probe(struct udevice *dev)return ret; } -if (clk_x.dev) { +if (clk.dev && clk_x.dev) { denali->clk_rate =clk_get_rate (&clk); denali->clk_x_rate =clk_get_rate (&clk_x); - }else { + } else +#endif + {/* * Hardcode the clock rates for the backward compatibility. * This works for both SOCFPGA and UniPhier.
Signature · 1 line
2.24.0.432.g9d3f5f5b63
PATCH 2/3 mtd: rawnand: denali: Allow operation without clock driver
Quoted 25 lines · Marek Vasut
The SoCFPGA Gen5 does not have a clock driver yet, let the NAND driver work without a clock driver by falling back to the default frequencies.
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/denali_dt.c +0
-1@@ -62,7 +62,6 @@ static int denali_dt_probe(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);const struct denali_dt_data *data; -struct clk clk, clk_x, clk_ecc;struct resource res;int ret;@@ -87,11 +86,14 @@ static int denali_dt_probe(struct udevice *dev) denali->host =devm_ioremap (dev, res.start,resource_size (&res));
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 96
Quoted 10 lines
drivers/mtd/nand/raw/denali_dt.c +4
-1+#if CONFIG_IS_ENABLED (CLK ) +struct clk clk, clk_x, clk_ecc; + ret =clk_get_by_name (dev,"nand" , &clk);if (ret) ret =clk_get_by_index (dev,0 , &clk);if (ret) -return ret; + clk.dev =NULL ;
This line changes the 'clk' optional.
Do you need additional #if CONFIG_IS_ENABLED(CLK) ?
BTW, in Linux, clk_get() and clk_enable() are no-op when CONFIG_HAVE_CLK is unset.
The U-Boot's clk_get() returns -ENOSYS, hence
drivers tend to be ugly.
I already stopped caring the U-Boot code, though.
Quoted 20 lines
drivers/mtd/nand/raw/denali_dt.c +4
-3ret =clk_get_by_name (dev,"nand_x" , &clk_x);if (ret)@@ -117,10 +119,12 @@ static int denali_dt_probe(struct udevice *dev)return ret; } -if (clk_x.dev) { +if (clk.dev && clk_x.dev) { denali->clk_rate =clk_get_rate (&clk); denali->clk_x_rate =clk_get_rate (&clk_x); - }else { + } else +#endif + {/* * Hardcode the clock rates for the backward compatibility. * This works for both SOCFPGA and UniPhier. -- 2.24.0.432.g9d3f5f5b63
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
--
Best Regards
Masahiro Yamada
PATCH 2/3 mtd: rawnand: denali: Allow operation without clock driver
Quoted 27 lines · Masahiro Yamada
Quoted 26 lines · Marek Vasut
The SoCFPGA Gen5 does not have a clock driver yet, let the NAND driver work without a clock driver by falling back to the default frequencies.
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/denali_dt.c +0
-1@@ -62,7 +62,6 @@ static int denali_dt_probe(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);const struct denali_dt_data *data; -struct clk clk, clk_x, clk_ecc;struct resource res;int ret;@@ -87,11 +86,14 @@ static int denali_dt_probe(struct udevice *dev) denali->host =devm_ioremap (dev, res.start,resource_size (&res));
Quoted 12 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_probe(struct udevice *dev) · line 96
Quoted 9 lines
drivers/mtd/nand/raw/denali_dt.c +4
-1+#if CONFIG_IS_ENABLED (CLK ) +struct clk clk, clk_x, clk_ecc; + ret =clk_get_by_name (dev,"nand" , &clk);if (ret) ret =clk_get_by_index (dev,0 , &clk);if (ret) -return ret; + clk.dev =NULL ;This line changes the 'clk' optional.
Do you need additional #ifCONFIG_IS_ENABLED(CLK)?
This whole block is in such ifdef.
Quoted 6 lines
BTW, in Linux,
clk_get()andclk_enable()are no-op whenCONFIG_HAVE_CLKis unset.The U-Boot's
clk_get()returns-ENOSYS, hence
drivers tend to be ugly.
I already stopped caring the U-Boot code, though.
Because of the DM ?
[...]
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
In reply to Marek VasutLegacy kernel versions for SoCFPGA may not implement proper reset handling. Apply the same approach as SoCFPGA reset driver, check environment variable "socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot.
--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/mtd/nand/raw/denali_dt.c +12 -0
@@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev); +#if CONFIG_IS_ENABLED (ARCH_SOCFPGA ) +/* +* Legacy kernel versions do not implement proper reset handling on +* SoCFPGA. To let those older kernel versions work, reuse the same +* approach as the SoCFPGA reset driver does -- check environment +* variable socfpga_legacy_reset_compat and avoid resetting the IP +* before booting the kernel if it is set to 1. +*/ +if (env_get_ulong ("socfpga_legacy_reset_compat" ,10 ,0 )) +return 0 ; +#endif +return reset_release_bulk (&denali->resets); }
Signature · 1 line
2.24.0.432.g9d3f5f5b63
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
What is "legacy kernel versions" ?
Quoted 21 lines
Apply the same approach as SoCFPGA reset driver, check environment variable "
socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot.Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/nand/raw/denali_dt.c +2
-0@@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev); +#if CONFIG_IS_ENABLED (ARCH_SOCFPGA ) +/*
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_remove(struct udevice *dev) · line 162
Quoted 10 lines
drivers/mtd/nand/raw/denali_dt.c +10
-0+* Legacy kernel versions do not implement proper reset handling on +* SoCFPGA. To let those older kernel versions work, reuse the same +* approach as the SoCFPGA reset driver does -- check environment +* variable socfpga_legacy_reset_compat and avoid resetting the IP +* before booting the kernel if it is set to 1. +*/ +if (env_get_ulong ("socfpga_legacy_reset_compat" ,10 ,0 )) +return 0 ; +#endif +
How about removing denali_dt_remove() entirely ?
Not only SOCFPGA, but also my boards are broken.
I am really annoyed since the following commit:
commit ed784ac3822b7d7019679a41a17907296e2dadbe
Author: Simon Goldschmidt <[email protected]> AuthorDate: Fri Mar 1 20:12:34 2019 +0100 Commit: Marek Vasut <[email protected]> CommitDate: Wed Apr 17 22:20:16 2019 +0200
mtd: rawnand: denali: add reset handling
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.
Quoted 10 lines
drivers/mtd/nand/raw/denali_dt.c +0
-1return reset_release_bulk (&denali->resets); } --2.24.0.432.g9d3f5f5b63
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 6 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Quoted 19 lines
Quoted 19 lines
Apply the same approach as SoCFPGA reset driver, check environment variable "
socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot.Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/nand/raw/denali_dt.c +0
-0@@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);
Quoted 15 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_remove(struct udevice *dev) · line 162
Quoted 12 lines
drivers/mtd/nand/raw/denali_dt.c +12
-0+#if CONFIG_IS_ENABLED (ARCH_SOCFPGA ) +/* +* Legacy kernel versions do not implement proper reset handling on +* SoCFPGA. To let those older kernel versions work, reuse the same +* approach as the SoCFPGA reset driver does -- check environment +* variable socfpga_legacy_reset_compat and avoid resetting the IP +* before booting the kernel if it is set to 1. +*/ +if (env_get_ulong ("socfpga_legacy_reset_compat" ,10 ,0 )) +return 0 ; +#endif +How about removing
denali_dt_remove()entirely ?
Fine by me.
Quoted 1 line
Not only SOCFPGA, but also my boards are broken.
How come ?
Quoted 11 lines
I am really annoyed since the following commit:
commit
ed784ac3822b7d7019679a41a17907296e2dadbeAuthor: Simon Goldschmidt <[email protected]> AuthorDate: Fri Mar 1 20:12:34 2019 +0100 Commit: Marek Vasut <[email protected]> CommitDate: Wed Apr 17 22:20:16 2019 +0200
Quoted 13 lines
mtd: rawnand: denali: add reset handling
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.
Signed-off-by Simon Goldschmidt <[email protected]>Quoted 2 lines
drivers/mtd/nand/raw/denali_dt.c +0
-0return reset_release_bulk (&denali->resets); }
CCing Simon.
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 10 lines · Marek Vasut
Quoted 6 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Really?
Could you tell the commit ID?
Quoted 36 lines
Quoted 20 lines
Quoted 20 lines
Apply the same approach as SoCFPGA reset driver, check environment variable "
socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot.Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/nand/raw/denali_dt.c +0
-0@@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);Quoted 15 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_remove(struct udevice *dev) · line 162
Quoted 12 lines
drivers/mtd/nand/raw/denali_dt.c +12
-0+#if CONFIG_IS_ENABLED (ARCH_SOCFPGA ) +/* +* Legacy kernel versions do not implement proper reset handling on +* SoCFPGA. To let those older kernel versions work, reuse the same +* approach as the SoCFPGA reset driver does -- check environment +* variable socfpga_legacy_reset_compat and avoid resetting the IP +* before booting the kernel if it is set to 1. +*/ +if (env_get_ulong ("socfpga_legacy_reset_compat" ,10 ,0 )) +return 0 ; +#endif +How about removing
denali_dt_remove()entirely ?
Quoted 5 lines
Fine by me.
Quoted 1 line
Not only SOCFPGA, but also my boards are broken.
How come ?
Because the Linux kernel version I am using does not have the reset handling for the Denali driver.
Quoted 31 lines
Quoted 12 lines
I am really annoyed since the following commit:
commit
ed784ac3822b7d7019679a41a17907296e2dadbeAuthor: Simon Goldschmidt <[email protected]> AuthorDate: Fri Mar 1 20:12:34 2019 +0100 Commit: Marek Vasut <[email protected]> CommitDate: Wed Apr 17 22:20:16 2019 +0200Quoted 13 lines
mtd: rawnand: denali: add reset handling
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.
Signed-off-by Simon Goldschmidt <[email protected]>Quoted 2 lines
drivers/mtd/nand/raw/denali_dt.c +0
-0return reset_release_bulk (&denali->resets); }CCing Simon.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 8 lines · Masahiro Yamada
Quoted 7 lines · Marek Vasut
Quoted 5 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Really?
Could you tell the commit ID?
commit 37f7453a4b7aa3e1d1608edeb500b105257ee945
ARM: dts: socfpga: update missing reset property peripherals
commit 1c909b2dfe6a21de2c24dc1c1405593e40e3a88c
ARM: dts: socfpga: update more missing reset properties
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Masahiro Yamada
Quoted 10 lines · Marek Vasut
Quoted 6 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Quoted 8 lines
Quoted 2 lines
Really?
Could you tell the commit ID?commit
37f7453a4b7aa3e1d1608edeb500b105257ee945
ARM: dts: socfpga: update missing reset property peripheralscommit
1c909b2dfe6a21de2c24dc1c1405593e40e3a88c
ARM: dts: socfpga: update more missing reset properties
These are just DT updates.
I do not see any proper reset handling in drivers/mtd/nand/raw/denali*.c
I am curious how the NAND reset is working in your kernel.
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
--
Best Regards
Masahiro Yamada
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 22 lines · Masahiro Yamada
Quoted 21 lines · Marek Vasut
Quoted 8 lines · Masahiro Yamada
Quoted 7 lines · Marek Vasut
Quoted 5 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Really?
Could you tell the commit ID?commit
37f7453a4b7aa3e1d1608edeb500b105257ee945
ARM: dts: socfpga: update missing reset property peripherals
Quoted 7 lines
Quoted 2 lines
commit
1c909b2dfe6a21de2c24dc1c1405593e40e3a88c
ARM: dts: socfpga: update more missing reset propertiesThese are just DT updates.
I do not see any proper reset handling in
drivers/mtd/nand/raw/denali*.c
Yes, DT updates which actually wire the reset to the IP so it can be toggled.
Quoted 1 line
I am curious how the NAND reset is working in your kernel.
It was not working at all until those patches were in.
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 28 lines · Marek Vasut
Quoted 26 lines · Masahiro Yamada
Quoted 23 lines · Marek Vasut
Quoted 8 lines · Masahiro Yamada
Quoted 7 lines · Marek Vasut
Quoted 5 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Really?
Could you tell the commit ID?commit
37f7453a4b7aa3e1d1608edeb500b105257ee945
ARM: dts: socfpga: update missing reset property peripheralscommit
1c909b2dfe6a21de2c24dc1c1405593e40e3a88c
ARM: dts: socfpga: update more missing reset properties
Quoted 6 lines
Quoted 3 lines
These are just DT updates.
I do not see any proper reset handling in
drivers/mtd/nand/raw/denali*.cYes, DT updates which actually wire the reset to the IP so it can be toggled.
I am asking where the reset _consumer_ code is.
I'd like to find where
reset_control_get*
reset_control_deassert()
are called for the NAND reset.
Quoted 7 lines
Quoted 1 line
I am curious how the NAND reset is working in your kernel.
It was not working at all until those patches were in.
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
Quoted 37 lines · Masahiro Yamada
Quoted 28 lines · Marek Vasut
Quoted 26 lines · Masahiro Yamada
Quoted 23 lines · Marek Vasut
Quoted 8 lines · Masahiro Yamada
Quoted 7 lines · Marek Vasut
Quoted 5 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Really?
Could you tell the commit ID?commit
37f7453a4b7aa3e1d1608edeb500b105257ee945
ARM: dts: socfpga: update missing reset property peripheralscommit
1c909b2dfe6a21de2c24dc1c1405593e40e3a88c
ARM: dts: socfpga: update more missing reset propertiesQuoted 6 lines
Quoted 3 lines
These are just DT updates.
I do not see any proper reset handling in
drivers/mtd/nand/raw/denali*.cYes, DT updates which actually wire the reset to the IP so it can be toggled.
Quoted 6 lines
I am asking where the reset _consumer_ code is.
I'd like to find where
reset_control_get*
reset_control_deassert()
are called for the NAND reset.
Clearly nowhere if the old kernels do not implement the reset properly.
PATCH 3/3 mtd: rawnand: denali: Do not reset the block on SoCFPGA
In reply to Marek VasutQuoted 46 lines · Marek Vasut
Quoted 6 lines · Masahiro Yamada
Quoted 3 lines · Marek Vasut
Legacy kernel versions for SoCFPGA may not implement proper reset handling.
What is "legacy kernel versions" ?
Anything older than 5.x , which got proper reset handling, finally.
Quoted 19 lines
Quoted 19 lines
Apply the same approach as SoCFPGA reset driver, check environment variable "
socfpga_legacy_reset_compat", and if it is set, do not reset the IP before booting Linux. This way, even the older kernel versions can be booted by up to date U-Boot.Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_dt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/mtd/nand/raw/denali_dt.c +0
-0@@ -148,6 +148,18 @@ static int denali_dt_remove(struct udevice *dev) {struct denali_nand_info *denali =dev_get_priv (dev);Quoted 15 lines
drivers/mtd/nand/raw/denali_dt.c static int denali_dt_remove(struct udevice *dev) · line 162
Quoted 12 lines
drivers/mtd/nand/raw/denali_dt.c +12
-0+#if CONFIG_IS_ENABLED (ARCH_SOCFPGA ) +/* +* Legacy kernel versions do not implement proper reset handling on +* SoCFPGA. To let those older kernel versions work, reuse the same +* approach as the SoCFPGA reset driver does -- check environment +* variable socfpga_legacy_reset_compat and avoid resetting the IP +* before booting the kernel if it is set to 1. +*/ +if (env_get_ulong ("socfpga_legacy_reset_compat" ,10 ,0 )) +return 0 ; +#endif +How about removing
denali_dt_remove()entirely ?
Quoted 7 lines
Fine by me.
Quoted 1 line
Not only SOCFPGA, but also my boards are broken.
How come ?
Quoted 1 line
I am really annoyed since the following commit:
Sorry to break anything there. I fail to see what's wrong with that commit, could you tell me more details so we can fix this?
Regards,
Simon
Quoted 25 lines
Quoted 10 lines
commit
ed784ac3822b7d7019679a41a17907296e2dadbeAuthor: Simon Goldschmidt <[email protected]> AuthorDate: Fri Mar 1 20:12:34 2019 +0100 Commit: Marek Vasut <[email protected]> CommitDate: Wed Apr 17 22:20:16 2019 +0200Quoted 13 lines
mtd: rawnand: denali: add reset handling
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.
Signed-off-by Simon Goldschmidt <[email protected]>Quoted 2 lines
drivers/mtd/nand/raw/denali_dt.c +0
-0return reset_release_bulk (&denali->resets); }CCing Simon.
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
In reply to Marek VasutQuoted 6 lines · Marek Vasut
While the Denali NAND is initialized by the BootROM in SPL, there are still a couple of settings which are missing. These can trigger subtle corruption of the data read out of the NAND. Fill these settings in just like they are filled in by the full Denali NAND driver in
denali_hw_init().
I'd like to know this in more detailed.
I assume these registers are set up by the BootROM,
and SPL is supposed to read data in the same manner as the Boot ROM.
In which situation does the data get corrupted?
Quoted 11 lines
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_spl.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/mtd/nand/raw/denali_spl.c +0
-0
drivers/mtd/nand/raw/denali_spl.c void nand_init(void) · line 179
Quoted 7 lines
drivers/mtd/nand/raw/denali_spl.c +4
-0@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES );
I guess you tested this for SOCFPGA.
Please tell me the value of CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES.
Quoted 9 lines
drivers/mtd/nand/raw/denali_spl.c +3
-1+writel (0x0F , denali_flash_reg +RB_PIN_ENABLED ); +writel (CHIP_EN_DONT_CARE__FLAG , denali_flash_reg +CHIP_ENABLE_DONT_CARE ); +writel (0xffff , denali_flash_reg +SPARE_AREA_MARKER ); }int nand_spl_load_image (uint32_t offs,unsigned int size,void *dst) --2.24.0.432.g9d3f5f5b63
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
--
Best Regards
Masahiro Yamada
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
Quoted 8 lines · Masahiro Yamada
Quoted 6 lines · Marek Vasut
While the Denali NAND is initialized by the BootROM in SPL, there are still a couple of settings which are missing. These can trigger subtle corruption of the data read out of the NAND. Fill these settings in just like they are filled in by the full Denali NAND driver in
denali_hw_init().
Quoted 6 lines
I'd like to know this in more detailed.
I assume these registers are set up by the BootROM,
and SPL is supposed to read data in the same manner as the Boot ROM.In which situation does the data get corrupted?
When I boot the board, these registers are not set up correctly. The bootrom reads the SPL fine, but the SPL cannot read U-Boot anymore, probably because the bootrom does something funny to the controller settings.
Quoted 21 lines
Quoted 11 lines
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_spl.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/mtd/nand/raw/denali_spl.c +0
-0drivers/mtd/nand/raw/denali_spl.c void nand_init(void) · line 179
Quoted 7 lines
drivers/mtd/nand/raw/denali_spl.c +4
-0@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES );I guess you tested this for SOCFPGA.
Quoted 1 line
Please tell me the value of
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES.
2
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Masahiro Yamada
Quoted 6 lines · Marek Vasut
While the Denali NAND is initialized by the BootROM in SPL, there are still a couple of settings which are missing. These can trigger subtle corruption of the data read out of the NAND. Fill these settings in just like they are filled in by the full Denali NAND driver in
denali_hw_init().I'd like to know this in more detailed.
I assume these registers are set up by the BootROM,
and SPL is supposed to read data in the same manner as the Boot ROM.
Quoted 6 lines
Quoted 1 line
In which situation does the data get corrupted?
When I boot the board, these registers are not set up correctly. The bootrom reads the SPL fine, but the SPL cannot read U-Boot anymore, probably because the bootrom does something funny to the controller settings.
Interesting.
The boot ROM can load SPL from a NAND device, but SPL cannot load U-Boot from it in the same manner.
How did you burn SPL, U-Boot proper, respectively? Were they written in different ways?
Quoted 24 lines
Quoted 22 lines
Quoted 12 lines
Signed-off-by Marek Vasut <[email protected]>Cc Masahiro Yamada <[email protected]>--- drivers/mtd/nand/raw/denali_spl.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/mtd/nand/raw/denali_spl.c +0
-0drivers/mtd/nand/raw/denali_spl.c void nand_init(void) · line 179
Quoted 7 lines
drivers/mtd/nand/raw/denali_spl.c +4
-0@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES );I guess you tested this for SOCFPGA.
Quoted 1 line
Please tell me the value of
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES.2
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
Quoted 23 lines · Masahiro Yamada
Quoted 15 lines · Marek Vasut
Quoted 13 lines · Masahiro Yamada
Quoted 6 lines · Marek Vasut
While the Denali NAND is initialized by the BootROM in SPL, there are still a couple of settings which are missing. These can trigger subtle corruption of the data read out of the NAND. Fill these settings in just like they are filled in by the full Denali NAND driver in
denali_hw_init().I'd like to know this in more detailed.
I assume these registers are set up by the BootROM,
and SPL is supposed to read data in the same manner as the Boot ROM.Quoted 6 lines
Quoted 1 line
In which situation does the data get corrupted?
When I boot the board, these registers are not set up correctly. The bootrom reads the SPL fine, but the SPL cannot read U-Boot anymore, probably because the bootrom does something funny to the controller settings.
Quoted 7 lines
Interesting.
The boot ROM can load SPL from a NAND device, but SPL cannot load U-Boot from it in the same manner.How did you burn SPL, U-Boot proper, respectively? Were they written in different ways?
U-Boot proper, all of it.
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
In reply to Marek VasutQuoted 15 lines · Marek Vasut
Quoted 15 lines
drivers/mtd/nand/raw/denali_spl.c void nand_init(void) · line 179
Quoted 12 lines
drivers/mtd/nand/raw/denali_spl.c +4
-0@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES );I guess you tested this for SOCFPGA.
Quoted 2 lines
Quoted 1 line
Please tell me the value of
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES.2
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=2 is the only value that works with the Boot ROM, right?
How did you find the correct value is 2 ?
Is it documented in the SOCFPGA datasheet or somewhere? Or, did you repeat try-and-error?
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/3 mtd: rawnand: denali-spl: Add missing hardware init
Quoted 20 lines · Masahiro Yamada
Quoted 15 lines · Marek Vasut
Quoted 15 lines
drivers/mtd/nand/raw/denali_spl.c void nand_init(void) · line 179
Quoted 12 lines
drivers/mtd/nand/raw/denali_spl.c +4
-0@@ -173,6 +173,13 @@ void nand_init(void) page_size =readl (denali_flash_reg +DEVICE_MAIN_AREA_SIZE ); oob_size =readl (denali_flash_reg +DEVICE_SPARE_AREA_SIZE ); pages_per_block =readl (denali_flash_reg +PAGES_PER_BLOCK ); + +/* Do as denali_hw_init() does. */ +writel (CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES , + denali_flash_reg +SPARE_AREA_SKIP_BYTES );I guess you tested this for SOCFPGA.
Quoted 2 lines
Quoted 1 line
Please tell me the value of
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES.2
Quoted 7 lines
CONFIG_NAND_DENALI_SPARE_AREA_SKIP_BYTES=2is the only value that works with the Boot ROM, right?How did you find the correct value is 2 ?
Is it documented in the SOCFPGA datasheet or somewhere? Or, did you repeat try-and-error?
I took it from the old vendoruboot port.