1 From 0536fa6e6fa3e48f4ca11855b586c277be524fbe Mon Sep 17 00:00:00 2001
2 From: David Wu <david.wu@rock-chips.com>
3 Date: Tue, 21 May 2024 21:10:13 +0000
4 Subject: [PATCH] soc: rockchip: io-domain: Add RK3308 IO voltage domains
6 Add IO voltage domains support for the RK3308 SoC.
8 Signed-off-by: David Wu <david.wu@rock-chips.com>
9 Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
10 Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
11 Link: https://lore.kernel.org/r/20240521211029.1236094-11-jonas@kwiboo.se
12 Signed-off-by: Heiko Stuebner <heiko@sntech.de>
14 drivers/soc/rockchip/io-domain.c | 40 ++++++++++++++++++++++++++++++++
15 1 file changed, 40 insertions(+)
17 --- a/drivers/soc/rockchip/io-domain.c
18 +++ b/drivers/soc/rockchip/io-domain.c
20 #define RK3288_SOC_CON2_FLASH0 BIT(7)
21 #define RK3288_SOC_FLASH_SUPPLY_NUM 2
23 +#define RK3308_SOC_CON0 0x300
24 +#define RK3308_SOC_CON0_VCCIO3 BIT(8)
25 +#define RK3308_SOC_VCCIO3_SUPPLY_NUM 3
27 #define RK3328_SOC_CON4 0x410
28 #define RK3328_SOC_CON4_VCCIO2 BIT(7)
29 #define RK3328_SOC_VCCIO2_SUPPLY_NUM 1
30 @@ -229,6 +233,25 @@ static void rk3288_iodomain_init(struct
31 dev_warn(iod->dev, "couldn't update flash0 ctrl\n");
34 +static void rk3308_iodomain_init(struct rockchip_iodomain *iod)
39 + /* if no vccio3 supply we should leave things alone */
40 + if (!iod->supplies[RK3308_SOC_VCCIO3_SUPPLY_NUM].reg)
44 + * set vccio3 iodomain to also use this framework
45 + * instead of a special gpio.
47 + val = RK3308_SOC_CON0_VCCIO3 | (RK3308_SOC_CON0_VCCIO3 << 16);
48 + ret = regmap_write(iod->grf, RK3308_SOC_CON0, val);
50 + dev_warn(iod->dev, "couldn't update vccio3 vsel ctrl\n");
53 static void rk3328_iodomain_init(struct rockchip_iodomain *iod)
56 @@ -376,6 +399,19 @@ static const struct rockchip_iodomain_so
57 .init = rk3288_iodomain_init,
60 +static const struct rockchip_iodomain_soc_data soc_data_rk3308 = {
61 + .grf_offset = 0x300,
70 + .init = rk3308_iodomain_init,
73 static const struct rockchip_iodomain_soc_data soc_data_rk3328 = {
76 @@ -529,6 +565,10 @@ static const struct of_device_id rockchi
77 .data = &soc_data_rk3288
80 + .compatible = "rockchip,rk3308-io-voltage-domain",
81 + .data = &soc_data_rk3308
84 .compatible = "rockchip,rk3328-io-voltage-domain",
85 .data = &soc_data_rk3328