bb7f8339772f918fc6170ecc0a25d66242e5fa65
[openwrt/staging/xback.git] /
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
5
6 Add IO voltage domains support for the RK3308 SoC.
7
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>
13 ---
14 drivers/soc/rockchip/io-domain.c | 40 ++++++++++++++++++++++++++++++++
15 1 file changed, 40 insertions(+)
16
17 --- a/drivers/soc/rockchip/io-domain.c
18 +++ b/drivers/soc/rockchip/io-domain.c
19 @@ -39,6 +39,10 @@
20 #define RK3288_SOC_CON2_FLASH0 BIT(7)
21 #define RK3288_SOC_FLASH_SUPPLY_NUM 2
22
23 +#define RK3308_SOC_CON0 0x300
24 +#define RK3308_SOC_CON0_VCCIO3 BIT(8)
25 +#define RK3308_SOC_VCCIO3_SUPPLY_NUM 3
26 +
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");
32 }
33
34 +static void rk3308_iodomain_init(struct rockchip_iodomain *iod)
35 +{
36 + int ret;
37 + u32 val;
38 +
39 + /* if no vccio3 supply we should leave things alone */
40 + if (!iod->supplies[RK3308_SOC_VCCIO3_SUPPLY_NUM].reg)
41 + return;
42 +
43 + /*
44 + * set vccio3 iodomain to also use this framework
45 + * instead of a special gpio.
46 + */
47 + val = RK3308_SOC_CON0_VCCIO3 | (RK3308_SOC_CON0_VCCIO3 << 16);
48 + ret = regmap_write(iod->grf, RK3308_SOC_CON0, val);
49 + if (ret < 0)
50 + dev_warn(iod->dev, "couldn't update vccio3 vsel ctrl\n");
51 +}
52 +
53 static void rk3328_iodomain_init(struct rockchip_iodomain *iod)
54 {
55 int ret;
56 @@ -376,6 +399,19 @@ static const struct rockchip_iodomain_so
57 .init = rk3288_iodomain_init,
58 };
59
60 +static const struct rockchip_iodomain_soc_data soc_data_rk3308 = {
61 + .grf_offset = 0x300,
62 + .supply_names = {
63 + "vccio0",
64 + "vccio1",
65 + "vccio2",
66 + "vccio3",
67 + "vccio4",
68 + "vccio5",
69 + },
70 + .init = rk3308_iodomain_init,
71 +};
72 +
73 static const struct rockchip_iodomain_soc_data soc_data_rk3328 = {
74 .grf_offset = 0x410,
75 .supply_names = {
76 @@ -529,6 +565,10 @@ static const struct of_device_id rockchi
77 .data = &soc_data_rk3288
78 },
79 {
80 + .compatible = "rockchip,rk3308-io-voltage-domain",
81 + .data = &soc_data_rk3308
82 + },
83 + {
84 .compatible = "rockchip,rk3328-io-voltage-domain",
85 .data = &soc_data_rk3328
86 },