rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
Subsystems (3)
Heiko Stuebner
maintainerPATCH v2 1/2 rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
From: Heiko Stuebner <[email protected]>
Rockchips dwmmc controllers can't do dma to non-ddr addresses, like for example the soc-internal sram but during boot parts of TrustedFirmware need to be placed there from the read FIT image.
So add handling for a u-boot,spl-fifo-mode to not put the mmc controllers into fifo mode for all time.
The regular fifo-mode property still takes precedent and only if not set do we check for the spl-specific property.
--- drivers/mmc/rockchip_dw_mmc.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/rockchip_dw_mmc.c +5 -0
@@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)return -EINVAL ; priv->fifo_mode =dev_read_bool (dev,"fifo-mode" ); +#ifdef CONFIG_SPL_BUILD +if (!priv->fifo_mode) + priv->fifo_mode =dev_read_bool (dev,"u-boot,spl-fifo-mode" ); +#endif +/* * 'clock-freq-min-max' is deprecated * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)
Signature · 1 line
2.24.0
Heiko Stuebner
maintainerPATCH v2 2/2 rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
From: Heiko Stuebner <[email protected]>
As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram.
The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux.
There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now.
---
changes in v2:
- moved to a spl-specific property, as suggested by Philipp
arch/arm/dts/px30-evb-u-boot.dtsi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/dts/px30-evb-u-boot.dtsi +5 -2
@@ -31,12 +31,15 @@ &sdmmc { u-boot,dm-pre-reloc; - /* temporary till I find out why dma mode doesn't work */ - fifo-mode; + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &emmc { u-boot,dm-pre-reloc; + + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &grf {
Signature · 1 line
2.24.0
PATCH v2 2/2 rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
Quoted 9 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram.
The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux.
Quoted 6 lines
There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now.
Signed-off-by Heiko Stuebner <[email protected]>
Thanks,
- Kever
Quoted 29 lines
---
changes in v2:
- moved to a spl-specific property, as suggested by Philipparch/arm/dts/px30-evb-u-boot.dtsi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)arch/arm/dts/px30-evb-u-boot.dtsi +5
-2@@ -31,12 +31,15 @@ &sdmmc { u-boot,dm-pre-reloc; - /* temporary till I find out why dma mode doesn't work */ - fifo-mode; + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &emmc { u-boot,dm-pre-reloc; + + /* mmc to sram can't do dma, prevent aborts transfering TF-A parts */ + u-boot,spl-fifo-mode; }; &grf {
PATCH v2 2/2 rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
In reply to Heiko StuebnerQuoted 12 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram.
The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux.
Quoted 6 lines
There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now.
Signed-off-by Heiko Stuebner <[email protected]>
PATCH v2 2/2 rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
In reply to Heiko StuebnerQuoted 9 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram.
The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux.
Quoted 6 lines
There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now.
Signed-off-by Heiko Stuebner <[email protected]>
Hi,
is this also needed on RK3399 based machines? I have a NanoPC-T4, where the eMMC is on the Arasan controller and the SD card on the dwmmc. So if I boot from SD card I need this as well?
Patrick
Heiko Stübner
maintainerPATCH v2 2/2 rockchip: px30: enable spl-fifo-mode for both emmc and sdmmc on evb
Hi Patrick,
Am Donnerstag, 28. November 2019, 00:38:45 CET schrieb Patrick Wildt:
Quoted 15 lines · Heiko Stuebner
Quoted 14 lines
From: Heiko Stuebner <[email protected]>
As part of loading trustedfirmware, the SPL is required to place portions of code into the socs sram but the mmc controllers can only do dma transfers into the regular memory, not sram.
The results of this are not directly visible in u-boot itself, but manifest as security-relate cpu aborts during boot of for example Linux.
There were a number of attempts to solve this elegantly but so far discussion is still ongoing, so to make the board at least boot correctly put both mmc controllers into fifo-mode, which also circumvents the issue for now.
Quoted 7 lines
Quoted 1 line
Signed-off-by Heiko Stuebner <[email protected]>Hi,
is this also needed on RK3399 based machines? I have a NanoPC-T4, where the eMMC is on the Arasan controller and the SD card on the dwmmc. So if I boot from SD card I need this as well?
I think so. That dma-to-sram issue is supposed to be present on a lot (maybe all?) Rockchip SoCs. And I think I remember running into that issue on rk3399 as well already in the past.
Not sure if that is limited to the dw-mmc only though or the arasan is also affected - maybe Kever knows :-)
Heiko
PATCH v2 1/2 rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
In reply to Heiko StuebnerHeiko,
Quoted 6 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Rockchips dwmmc controllers can't do dma to non-ddr addresses, like for example the soc-internal sram but during boot parts of TrustedFirmware need to be placed there from the read FIT image.
Quoted 8 lines
So add handling for a u-boot,spl-fifo-mode to not put the mmc controllers into fifo mode for all time.
The regular fifo-mode property still takes precedent and only if not set do we check for the spl-specific property.
Suggested-by Philipp Tomsich <[email protected]>Signed-off-by Heiko Stuebner <[email protected]>
Well, this is a alternative solution of using bounce buffer for MMC in SPL.
Thanks,
- Kever
Quoted 20 lines
--- drivers/mmc/rockchip_dw_mmc.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mmc/rockchip_dw_mmc.c +5
-0@@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)return -EINVAL ; priv->fifo_mode =dev_read_bool (dev,"fifo-mode" ); +#ifdef CONFIG_SPL_BUILD +if (!priv->fifo_mode) + priv->fifo_mode =dev_read_bool (dev,"u-boot,spl-fifo-mode" ); +#endif +/* * 'clock-freq-min-max' is deprecated * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b)
PATCH v2 1/2 rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
In reply to Heiko StuebnerQuoted 10 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Rockchips dwmmc controllers can't do dma to non-ddr addresses, like for example the soc-internal sram but during boot parts of TrustedFirmware need to be placed there from the read FIT image.
Quoted 8 lines
So add handling for a u-boot,spl-fifo-mode to not put the mmc controllers into fifo mode for all time.
The regular fifo-mode property still takes precedent and only if not set do we check for the spl-specific property.
Suggested-by Philipp Tomsich <[email protected]>Signed-off-by Heiko Stuebner <[email protected]>
Quoted 9 lines
---
drivers/mmc/rockchip_dw_mmc.c| 5 +++++1 file changed, 5 insertions(+)drivers/mmc/rockchip_dw_mmc.c +0
-0
drivers/mmc/rockchip_dw_mmc.c static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev) · line 78
Quoted 7 lines
drivers/mmc/rockchip_dw_mmc.c +4
-0@@ -72,6 +72,11 @@ static int rockchip_dwmmc_ofdata_to_platdata(struct udevice *dev)return -EINVAL ; priv->fifo_mode =dev_read_bool (dev,"fifo-mode" ); +#ifdef CONFIG_SPL_BUILD +if (!priv->fifo_mode) + priv->fifo_mode =dev_read_bool (dev,"u-boot,spl-fifo-mode" ); +#endif
Nitpick: I would have used an “|=" instead of the "if(…)”.
Quoted 7 lines
drivers/mmc/rockchip_dw_mmc.c +1
-0+/* * 'clock-freq-min-max' is deprecated * (see https://github.com/torvalds/linux/commit/b023030f10573de738bbe8df63d43acab64c9f7b) Signature · 1 line
2.24.0
PATCH v2 1/2 rockchip: dwmmc: add handling for u-boot, spl-fifo-mode
Sorry, I was confused and meant...
Quoted 15 lines · Philipp Tomsich
Quoted 14 lines · Heiko Stuebner
From: Heiko Stuebner <[email protected]>
Rockchips dwmmc controllers can't do dma to non-ddr addresses, like for example the soc-internal sram but during boot parts of TrustedFirmware need to be placed there from the read FIT image.
So add handling for a u-boot,spl-fifo-mode to not put the mmc controllers into fifo mode for all time.
Quoted 7 lines
Quoted 5 lines
The regular fifo-mode property still takes precedent and only if not set do we check for the spl-specific property.
Suggested-by Philipp Tomsich <[email protected]>Signed-off-by Heiko Stuebner <[email protected]>Signed-off-by Philipp Tomsich <[email protected]>