diff mbox series

[10/11] rockchip: theobroma-systems: puma: Migrate to use IO-domain driver

Message ID 20240217183610.2621132-11-jonas@kwiboo.se
State Superseded
Delegated to: Kever Yang
Headers show
Series rockchip: rk3399: Migrate to use IO-domain driver | expand

Commit Message

Jonas Karlman Feb. 17, 2024, 6:35 p.m. UTC
Switch to use the IO-domain driver to configure IO-domain based on
device tree instead of a setup_iodomain() function.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
This should be runtime tested by someone with a puma device. All DT
props and driver seem to be enabled and I expect the io_vsel to be
configured with correct value.
---
 .../puma_rk3399/puma-rk3399.c                 | 21 -------------------
 configs/puma-rk3399_defconfig                 |  1 +
 2 files changed, 1 insertion(+), 21 deletions(-)

Comments

Kever Yang March 11, 2024, 9:39 a.m. UTC | #1
On 2024/2/18 02:35, Jonas Karlman wrote:
> Switch to use the IO-domain driver to configure IO-domain based on
> device tree instead of a setup_iodomain() function.
>
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
> This should be runtime tested by someone with a puma device. All DT
> props and driver seem to be enabled and I expect the io_vsel to be
> configured with correct value.
> ---
>   .../puma_rk3399/puma-rk3399.c                 | 21 -------------------
>   configs/puma-rk3399_defconfig                 |  1 +
>   2 files changed, 1 insertion(+), 21 deletions(-)
>
> diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> index 8b998ef45565..eeb8a99231e4 100644
> --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
> @@ -3,31 +3,10 @@
>    * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
>    */
>   
> -#include <dm.h>
> -#include <syscon.h>
> -#include <dm/pinctrl.h>
> -#include <asm/arch-rockchip/clock.h>
> -#include <asm/arch-rockchip/hardware.h>
> -#include <asm/arch-rockchip/grf_rk3399.h>
>   #include "../common/common.h"
>   
> -static void setup_iodomain(void)
> -{
> -	const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
> -	struct rk3399_grf_regs *grf =
> -	    syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> -
> -	/*
> -	 * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
> -	 * Linux assumes that PCIE_RST# works out of the box as it probes
> -	 * PCIe before loading the iodomain driver.
> -	 */
> -	rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
> -}
> -
>   int rockchip_early_misc_init_r(void)
>   {
> -	setup_iodomain();
>   	setup_boottargets();
>   
>   	return 0;
> diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
> index 818bfdf9aa9b..e30305abfafd 100644
> --- a/configs/puma-rk3399_defconfig
> +++ b/configs/puma-rk3399_defconfig
> @@ -66,6 +66,7 @@ CONFIG_GPIO_HOG=y
>   CONFIG_SPL_GPIO_HOG=y
>   CONFIG_ROCKCHIP_GPIO=y
>   CONFIG_SYS_I2C_ROCKCHIP=y
> +CONFIG_ROCKCHIP_IODOMAIN=y
>   CONFIG_MMC_DW=y
>   CONFIG_MMC_DW_ROCKCHIP=y
>   CONFIG_MMC_SDHCI=y
diff mbox series

Patch

diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 8b998ef45565..eeb8a99231e4 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -3,31 +3,10 @@ 
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
 
-#include <dm.h>
-#include <syscon.h>
-#include <dm/pinctrl.h>
-#include <asm/arch-rockchip/clock.h>
-#include <asm/arch-rockchip/hardware.h>
-#include <asm/arch-rockchip/grf_rk3399.h>
 #include "../common/common.h"
 
-static void setup_iodomain(void)
-{
-	const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
-	struct rk3399_grf_regs *grf =
-	    syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-
-	/*
-	 * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
-	 * Linux assumes that PCIE_RST# works out of the box as it probes
-	 * PCIe before loading the iodomain driver.
-	 */
-	rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
-}
-
 int rockchip_early_misc_init_r(void)
 {
-	setup_iodomain();
 	setup_boottargets();
 
 	return 0;
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 818bfdf9aa9b..e30305abfafd 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -66,6 +66,7 @@  CONFIG_GPIO_HOG=y
 CONFIG_SPL_GPIO_HOG=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_ROCKCHIP_IODOMAIN=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y