diff mbox

[U-Boot,7/7] rockchip: dm: convert fdt_get to dev_read

Message ID 1496853982-33469-8-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Commit 8f1034e627f1af3940d92cab3bc9cacc81df4779
Delegated to: Philipp Tomsich
Headers show

Commit Message

Philipp Tomsich June 7, 2017, 4:46 p.m. UTC
With the new dev_read functions available, we can convert the rockchip
architecture-specific drivers and common drivers used by these devices
over to the dev_read family of calls.

This covers the DRAM controller initialisation for the RK3188, RK3288
and RK3399... all of these read some of the tuning/setup/timing
parameters from the device-tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

 arch/arm/mach-rockchip/rk3188/sdram_rk3188.c | 20 +++++++++-----------
 arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 20 +++++++++-----------
 arch/arm/mach-rockchip/rk3399/sdram_rk3399.c |  8 +++-----
 3 files changed, 21 insertions(+), 27 deletions(-)

Comments

Simon Glass June 9, 2017, 12:28 p.m. UTC | #1
On 7 June 2017 at 10:46, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> With the new dev_read functions available, we can convert the rockchip
> architecture-specific drivers and common drivers used by these devices
> over to the dev_read family of calls.
>
> This covers the DRAM controller initialisation for the RK3188, RK3288
> and RK3399... all of these read some of the tuning/setup/timing
> parameters from the device-tree.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> ---
>
>  arch/arm/mach-rockchip/rk3188/sdram_rk3188.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3399/sdram_rk3399.c |  8 +++-----
>  3 files changed, 21 insertions(+), 27 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Philipp Tomsich June 25, 2017, 11:03 p.m. UTC | #2
> With the new dev_read functions available, we can convert the rockchip
> architecture-specific drivers and common drivers used by these devices
> over to the dev_read family of calls.
> 
> This covers the DRAM controller initialisation for the RK3188, RK3288
> and RK3399... all of these read some of the tuning/setup/timing
> parameters from the device-tree.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/arm/mach-rockchip/rk3188/sdram_rk3188.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3399/sdram_rk3399.c |  8 +++-----
>  3 files changed, 21 insertions(+), 27 deletions(-)
> 

Applied to u-boot-rockchip/next, thanks!
Philipp Tomsich June 25, 2017, 11:09 p.m. UTC | #3
> With the new dev_read functions available, we can convert the rockchip
> architecture-specific drivers and common drivers used by these devices
> over to the dev_read family of calls.
> 
> This covers the DRAM controller initialisation for the RK3188, RK3288
> and RK3399... all of these read some of the tuning/setup/timing
> parameters from the device-tree.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/arm/mach-rockchip/rk3188/sdram_rk3188.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3288/sdram_rk3288.c | 20 +++++++++-----------
>  arch/arm/mach-rockchip/rk3399/sdram_rk3399.c |  8 +++-----
>  3 files changed, 21 insertions(+), 27 deletions(-)
> 

Applied to u-boot-rockchip/next, thanks!
diff mbox

Patch

diff --git a/arch/arm/mach-rockchip/rk3188/sdram_rk3188.c b/arch/arm/mach-rockchip/rk3188/sdram_rk3188.c
index 946a9f1..981d1d6 100644
--- a/arch/arm/mach-rockchip/rk3188/sdram_rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188/sdram_rk3188.c
@@ -851,29 +851,27 @@  static int rk3188_dmc_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct rk3188_sdram_params *params = dev_get_platdata(dev);
-	const void *blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
 	int ret;
 
 	/* rk3188 supports only one-channel */
 	params->num_channels = 1;
-	ret = fdtdec_get_int_array(blob, node, "rockchip,pctl-timing",
-				   (u32 *)&params->pctl_timing,
-				   sizeof(params->pctl_timing) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,pctl-timing",
+				 (u32 *)&params->pctl_timing,
+				 sizeof(params->pctl_timing) / sizeof(u32));
 	if (ret) {
 		printf("%s: Cannot read rockchip,pctl-timing\n", __func__);
 		return -EINVAL;
 	}
-	ret = fdtdec_get_int_array(blob, node, "rockchip,phy-timing",
-				   (u32 *)&params->phy_timing,
-				   sizeof(params->phy_timing) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,phy-timing",
+				 (u32 *)&params->phy_timing,
+				 sizeof(params->phy_timing) / sizeof(u32));
 	if (ret) {
 		printf("%s: Cannot read rockchip,phy-timing\n", __func__);
 		return -EINVAL;
 	}
-	ret = fdtdec_get_int_array(blob, node, "rockchip,sdram-params",
-				   (u32 *)&params->base,
-				   sizeof(params->base) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,sdram-params",
+				 (u32 *)&params->base,
+				 sizeof(params->base) / sizeof(u32));
 	if (ret) {
 		printf("%s: Cannot read rockchip,sdram-params\n", __func__);
 		return -EINVAL;
diff --git a/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c b/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
index 2feda61..b3ed3f2 100644
--- a/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/sdram_rk3288.c
@@ -1018,29 +1018,27 @@  static int rk3288_dmc_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct rk3288_sdram_params *params = dev_get_platdata(dev);
-	const void *blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
 	int ret;
 
 	/* Rk3288 supports dual-channel, set default channel num to 2 */
 	params->num_channels = 2;
-	ret = fdtdec_get_int_array(blob, node, "rockchip,pctl-timing",
-				   (u32 *)&params->pctl_timing,
-				   sizeof(params->pctl_timing) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,pctl-timing",
+				 (u32 *)&params->pctl_timing,
+				 sizeof(params->pctl_timing) / sizeof(u32));
 	if (ret) {
 		debug("%s: Cannot read rockchip,pctl-timing\n", __func__);
 		return -EINVAL;
 	}
-	ret = fdtdec_get_int_array(blob, node, "rockchip,phy-timing",
-				   (u32 *)&params->phy_timing,
-				   sizeof(params->phy_timing) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,phy-timing",
+				 (u32 *)&params->phy_timing,
+				 sizeof(params->phy_timing) / sizeof(u32));
 	if (ret) {
 		debug("%s: Cannot read rockchip,phy-timing\n", __func__);
 		return -EINVAL;
 	}
-	ret = fdtdec_get_int_array(blob, node, "rockchip,sdram-params",
-				   (u32 *)&params->base,
-				   sizeof(params->base) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,sdram-params",
+				 (u32 *)&params->base,
+				 sizeof(params->base) / sizeof(u32));
 	if (ret) {
 		debug("%s: Cannot read rockchip,sdram-params\n", __func__);
 		return -EINVAL;
diff --git a/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c b/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
index db75eb1..683fa40 100644
--- a/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/sdram_rk3399.c
@@ -1140,13 +1140,11 @@  static int rk3399_dmc_ofdata_to_platdata(struct udevice *dev)
 {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct rockchip_dmc_plat *plat = dev_get_platdata(dev);
-	const void *blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
 	int ret;
 
-	ret = fdtdec_get_int_array(blob, node, "rockchip,sdram-params",
-			(u32 *)&plat->sdram_params,
-			sizeof(plat->sdram_params) / sizeof(u32));
+	ret = dev_read_u32_array(dev, "rockchip,sdram-params",
+				 (u32 *)&plat->sdram_params,
+				 sizeof(plat->sdram_params) / sizeof(u32));
 	if (ret) {
 		printf("%s: Cannot read rockchip,sdram-params %d\n",
 		       __func__, ret);