Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2015 Google, Inc |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 7 | #include <dm.h> |
Chris Morgan | b02712f | 2022-05-27 13:18:19 -0500 | [diff] [blame] | 8 | #include <dm/lists.h> |
Quentin Schulz | 106d04e | 2024-06-06 10:45:35 +0200 | [diff] [blame] | 9 | #include <bitfield.h> |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 10 | #include <errno.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 11 | #include <log.h> |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 12 | #include <linux/bitfield.h> |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 13 | #include <power/rk8xx_pmic.h> |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 14 | #include <power/pmic.h> |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 15 | #include <spi.h> |
Chris Morgan | b02712f | 2022-05-27 13:18:19 -0500 | [diff] [blame] | 16 | #include <sysreset.h> |
| 17 | |
| 18 | static int rk8xx_sysreset_request(struct udevice *dev, enum sysreset_t type) |
| 19 | { |
| 20 | struct rk8xx_priv *priv = dev_get_priv(dev->parent); |
| 21 | |
| 22 | if (type != SYSRESET_POWER_OFF) |
| 23 | return -EPROTONOSUPPORT; |
| 24 | |
| 25 | switch (priv->variant) { |
| 26 | case RK805_ID: |
| 27 | case RK808_ID: |
| 28 | case RK816_ID: |
| 29 | case RK818_ID: |
| 30 | pmic_clrsetbits(dev->parent, REG_DEVCTRL, 0, BIT(0)); |
| 31 | break; |
| 32 | case RK809_ID: |
| 33 | case RK817_ID: |
| 34 | pmic_clrsetbits(dev->parent, RK817_REG_SYS_CFG3, 0, |
| 35 | BIT(0)); |
| 36 | break; |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 37 | case RK806_ID: |
| 38 | pmic_clrsetbits(dev->parent, RK806_REG_SYS_CFG3, 0, |
| 39 | BIT(0)); |
| 40 | break; |
Chris Morgan | b02712f | 2022-05-27 13:18:19 -0500 | [diff] [blame] | 41 | default: |
| 42 | printf("Unknown PMIC RK%x: Cannot shutdown\n", |
| 43 | priv->variant); |
| 44 | return -EPROTONOSUPPORT; |
| 45 | }; |
| 46 | |
| 47 | return -EINPROGRESS; |
| 48 | } |
| 49 | |
| 50 | static struct sysreset_ops rk8xx_sysreset_ops = { |
| 51 | .request = rk8xx_sysreset_request, |
| 52 | }; |
| 53 | |
| 54 | U_BOOT_DRIVER(rk8xx_sysreset) = { |
| 55 | .name = "rk8xx_sysreset", |
| 56 | .id = UCLASS_SYSRESET, |
| 57 | .ops = &rk8xx_sysreset_ops, |
| 58 | }; |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 59 | |
Chris Morgan | 7c9de74 | 2022-05-27 13:18:20 -0500 | [diff] [blame] | 60 | /* In the event of a plug-in and the appropriate option has been |
| 61 | * selected, we simply shutdown instead of continue the normal boot |
| 62 | * process. Please note the rk808 is not supported as it doesn't |
| 63 | * have the appropriate register. |
| 64 | */ |
| 65 | void rk8xx_off_for_plugin(struct udevice *dev) |
| 66 | { |
| 67 | struct rk8xx_priv *priv = dev_get_priv(dev); |
| 68 | |
| 69 | switch (priv->variant) { |
| 70 | case RK805_ID: |
| 71 | case RK816_ID: |
| 72 | case RK818_ID: |
| 73 | if (pmic_reg_read(dev, RK8XX_ON_SOURCE) & RK8XX_ON_PLUG_IN) { |
| 74 | printf("Power Off due to plug-in event\n"); |
| 75 | pmic_clrsetbits(dev, REG_DEVCTRL, 0, BIT(0)); |
| 76 | } |
| 77 | break; |
| 78 | case RK809_ID: |
| 79 | case RK817_ID: |
| 80 | if (pmic_reg_read(dev, RK817_ON_SOURCE) & RK8XX_ON_PLUG_IN) { |
| 81 | printf("Power Off due to plug-in event\n"); |
| 82 | pmic_clrsetbits(dev, RK817_REG_SYS_CFG3, 0, |
| 83 | BIT(0)); |
| 84 | } |
| 85 | break; |
| 86 | default: |
| 87 | printf("PMIC RK%x: Cannot read boot reason.\n", |
| 88 | priv->variant); |
| 89 | } |
| 90 | } |
| 91 | |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 92 | static struct reg_data rk806_init_reg[] = { |
| 93 | /* RST_FUN */ |
| 94 | { RK806_REG_SYS_CFG3, GENMASK(7, 6), BIT(7)}, |
| 95 | }; |
| 96 | |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 97 | static struct reg_data rk817_init_reg[] = { |
| 98 | /* enable the under-voltage protection, |
| 99 | * the under-voltage protection will shutdown the LDO3 and reset the PMIC |
| 100 | */ |
| 101 | { RK817_BUCK4_CMIN, 0x60, 0x60}, |
| 102 | }; |
| 103 | |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 104 | static const struct pmic_child_info pmic_children_info[] = { |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 105 | { .prefix = "DCDC_REG", .driver = "rk8xx_buck"}, |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 106 | { .prefix = "dcdc-reg", .driver = "rk8xx_buck"}, |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 107 | { .prefix = "LDO_REG", .driver = "rk8xx_ldo"}, |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 108 | { .prefix = "nldo-reg", .driver = "rk8xx_nldo"}, |
| 109 | { .prefix = "pldo-reg", .driver = "rk8xx_pldo"}, |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 110 | { .prefix = "SWITCH_REG", .driver = "rk8xx_switch"}, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 111 | { }, |
| 112 | }; |
| 113 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 114 | static int rk8xx_reg_count(struct udevice *dev) |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 115 | { |
| 116 | return RK808_NUM_OF_REGS; |
| 117 | } |
| 118 | |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 119 | #if CONFIG_IS_ENABLED(SPI) && CONFIG_IS_ENABLED(DM_SPI) |
| 120 | struct rk806_cmd { |
| 121 | uint8_t len: 4; /* Payload size in bytes - 1 */ |
| 122 | uint8_t reserved: 2; |
| 123 | uint8_t crc_en: 1; |
| 124 | uint8_t op: 1; /* READ=0; WRITE=1; */ |
| 125 | uint8_t reg_l; |
| 126 | #define REG_L_MASK GENMASK(7, 0) |
| 127 | uint8_t reg_h; |
| 128 | #define REG_H_MASK GENMASK(15, 8) |
| 129 | }; |
| 130 | #endif |
| 131 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 132 | static int rk8xx_write(struct udevice *dev, uint reg, const uint8_t *buff, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 133 | int len) |
| 134 | { |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 135 | int ret; |
| 136 | |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 137 | #if CONFIG_IS_ENABLED(SPI) && CONFIG_IS_ENABLED(DM_SPI) |
| 138 | if (device_get_uclass_id(dev->parent) == UCLASS_SPI) { |
| 139 | struct spi_slave *spi = dev_get_parent_priv(dev); |
| 140 | struct rk806_cmd cmd = { |
| 141 | .op = 1, |
| 142 | .len = len - 1, |
| 143 | .reg_l = FIELD_GET(REG_L_MASK, reg), |
| 144 | .reg_h = FIELD_GET(REG_H_MASK, reg), |
| 145 | }; |
| 146 | |
| 147 | ret = dm_spi_claim_bus(dev); |
| 148 | if (ret) { |
| 149 | debug("Couldn't claim bus for device: %p!\n", dev); |
| 150 | return ret; |
| 151 | } |
| 152 | |
| 153 | ret = spi_write_then_read(spi, (u8 *)&cmd, sizeof(cmd), buff, NULL, len); |
| 154 | if (ret) |
| 155 | debug("write error to device: %p register: %#x!\n", |
| 156 | dev, reg); |
| 157 | |
| 158 | dm_spi_release_bus(dev); |
| 159 | |
| 160 | return ret; |
| 161 | } |
| 162 | #endif |
| 163 | |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 164 | ret = dm_i2c_write(dev, reg, buff, len); |
| 165 | if (ret) { |
Simon Glass | 73126ac | 2018-11-18 08:14:28 -0700 | [diff] [blame] | 166 | debug("write error to device: %p register: %#x!\n", dev, reg); |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 167 | return ret; |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 173 | static int rk8xx_read(struct udevice *dev, uint reg, uint8_t *buff, int len) |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 174 | { |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 175 | int ret; |
| 176 | |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 177 | #if CONFIG_IS_ENABLED(SPI) && CONFIG_IS_ENABLED(DM_SPI) |
| 178 | if (device_get_uclass_id(dev->parent) == UCLASS_SPI) { |
| 179 | struct spi_slave *spi = dev_get_parent_priv(dev); |
| 180 | struct rk806_cmd cmd = { |
| 181 | .op = 0, |
| 182 | .len = len - 1, |
| 183 | .reg_l = FIELD_GET(REG_L_MASK, reg), |
| 184 | .reg_h = FIELD_GET(REG_H_MASK, reg), |
| 185 | }; |
| 186 | |
| 187 | ret = dm_spi_claim_bus(dev); |
| 188 | if (ret) { |
| 189 | debug("Couldn't claim bus for device: %p!\n", dev); |
| 190 | return ret; |
| 191 | } |
| 192 | |
| 193 | ret = spi_write_then_read(spi, (u8 *)&cmd, sizeof(cmd), NULL, buff, len); |
| 194 | if (ret) |
| 195 | debug("read error to device: %p register: %#x!\n", |
| 196 | dev, reg); |
| 197 | |
| 198 | dm_spi_release_bus(dev); |
| 199 | |
| 200 | return ret; |
| 201 | } |
| 202 | #endif |
| 203 | |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 204 | ret = dm_i2c_read(dev, reg, buff, len); |
| 205 | if (ret) { |
Simon Glass | 73126ac | 2018-11-18 08:14:28 -0700 | [diff] [blame] | 206 | debug("read error from device: %p register: %#x!\n", dev, reg); |
Simon Glass | 46ad8cb | 2016-01-21 19:43:58 -0700 | [diff] [blame] | 207 | return ret; |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | return 0; |
| 211 | } |
| 212 | |
| 213 | #if CONFIG_IS_ENABLED(PMIC_CHILDREN) |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 214 | static int rk8xx_bind(struct udevice *dev) |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 215 | { |
Simon Glass | 2c2d2c2 | 2017-05-18 20:09:32 -0600 | [diff] [blame] | 216 | ofnode regulators_node; |
Chris Morgan | b02712f | 2022-05-27 13:18:19 -0500 | [diff] [blame] | 217 | int children, ret; |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 218 | |
Simon Glass | 2c2d2c2 | 2017-05-18 20:09:32 -0600 | [diff] [blame] | 219 | regulators_node = dev_read_subnode(dev, "regulators"); |
| 220 | if (!ofnode_valid(regulators_node)) { |
Simon Glass | 73126ac | 2018-11-18 08:14:28 -0700 | [diff] [blame] | 221 | debug("%s: %s regulators subnode not found!\n", __func__, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 222 | dev->name); |
| 223 | return -ENXIO; |
| 224 | } |
| 225 | |
| 226 | debug("%s: '%s' - found regulators subnode\n", __func__, dev->name); |
| 227 | |
Chris Morgan | b02712f | 2022-05-27 13:18:19 -0500 | [diff] [blame] | 228 | if (CONFIG_IS_ENABLED(SYSRESET)) { |
| 229 | ret = device_bind_driver_to_node(dev, "rk8xx_sysreset", |
| 230 | "rk8xx_sysreset", |
| 231 | dev_ofnode(dev), NULL); |
| 232 | if (ret) |
| 233 | return ret; |
| 234 | } |
| 235 | |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 236 | children = pmic_bind_children(dev, regulators_node, pmic_children_info); |
| 237 | if (!children) |
| 238 | debug("%s: %s - no child found\n", __func__, dev->name); |
| 239 | |
Jonas Karlman | b909066 | 2023-08-03 21:02:42 +0000 | [diff] [blame] | 240 | if (IS_ENABLED(CONFIG_SPL_BUILD) && |
| 241 | IS_ENABLED(CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON)) |
| 242 | dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND); |
| 243 | |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 244 | /* Always return success for this device */ |
| 245 | return 0; |
| 246 | } |
| 247 | #endif |
| 248 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 249 | static int rk8xx_probe(struct udevice *dev) |
Jacob Chen | 0234adb | 2017-05-02 14:54:49 +0800 | [diff] [blame] | 250 | { |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 251 | struct rk8xx_priv *priv = dev_get_priv(dev); |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 252 | struct reg_data *init_data = NULL; |
| 253 | int init_data_num = 0; |
| 254 | int ret = 0, i, show_variant; |
| 255 | u8 msb, lsb, id_msb, id_lsb; |
| 256 | u8 on_source = 0, off_source = 0; |
| 257 | u8 power_en0, power_en1, power_en2, power_en3; |
| 258 | u8 value; |
Jacob Chen | 0234adb | 2017-05-02 14:54:49 +0800 | [diff] [blame] | 259 | |
| 260 | /* read Chip variant */ |
Joseph Chen | d6b3e83 | 2019-09-26 15:45:07 +0800 | [diff] [blame] | 261 | if (device_is_compatible(dev, "rockchip,rk817") || |
| 262 | device_is_compatible(dev, "rockchip,rk809")) { |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 263 | id_msb = RK817_ID_MSB; |
| 264 | id_lsb = RK817_ID_LSB; |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 265 | } else if (device_is_compatible(dev, "rockchip,rk806")) { |
| 266 | id_msb = RK806_ID_MSB; |
| 267 | id_lsb = RK806_ID_LSB; |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 268 | } else { |
| 269 | id_msb = ID_MSB; |
| 270 | id_lsb = ID_LSB; |
| 271 | } |
| 272 | |
| 273 | ret = rk8xx_read(dev, id_msb, &msb, 1); |
| 274 | if (ret) |
| 275 | return ret; |
| 276 | ret = rk8xx_read(dev, id_lsb, &lsb, 1); |
| 277 | if (ret) |
| 278 | return ret; |
Jacob Chen | 0234adb | 2017-05-02 14:54:49 +0800 | [diff] [blame] | 279 | |
| 280 | priv->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK; |
Quentin Schulz | 106d04e | 2024-06-06 10:45:35 +0200 | [diff] [blame] | 281 | show_variant = bitfield_extract_by_mask(priv->variant, RK8XX_ID_MSK); |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 282 | switch (priv->variant) { |
| 283 | case RK808_ID: |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 284 | break; |
| 285 | case RK805_ID: |
| 286 | case RK816_ID: |
| 287 | case RK818_ID: |
| 288 | on_source = RK8XX_ON_SOURCE; |
| 289 | off_source = RK8XX_OFF_SOURCE; |
| 290 | break; |
Joseph Chen | d6b3e83 | 2019-09-26 15:45:07 +0800 | [diff] [blame] | 291 | case RK809_ID: |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 292 | case RK817_ID: |
| 293 | on_source = RK817_ON_SOURCE; |
| 294 | off_source = RK817_OFF_SOURCE; |
| 295 | init_data = rk817_init_reg; |
| 296 | init_data_num = ARRAY_SIZE(rk817_init_reg); |
| 297 | power_en0 = pmic_reg_read(dev, RK817_POWER_EN0); |
| 298 | power_en1 = pmic_reg_read(dev, RK817_POWER_EN1); |
| 299 | power_en2 = pmic_reg_read(dev, RK817_POWER_EN2); |
| 300 | power_en3 = pmic_reg_read(dev, RK817_POWER_EN3); |
| 301 | |
| 302 | value = (power_en0 & 0x0f) | ((power_en1 & 0x0f) << 4); |
| 303 | pmic_reg_write(dev, RK817_POWER_EN_SAVE0, value); |
| 304 | value = (power_en2 & 0x0f) | ((power_en3 & 0x0f) << 4); |
| 305 | pmic_reg_write(dev, RK817_POWER_EN_SAVE1, value); |
| 306 | break; |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 307 | case RK806_ID: |
| 308 | on_source = RK806_ON_SOURCE; |
| 309 | off_source = RK806_OFF_SOURCE; |
| 310 | init_data = rk806_init_reg; |
| 311 | init_data_num = ARRAY_SIZE(rk806_init_reg); |
| 312 | break; |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 313 | default: |
Quentin Schulz | 106d04e | 2024-06-06 10:45:35 +0200 | [diff] [blame] | 314 | printf("Unknown PMIC: RK%x!!\n", show_variant); |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 315 | return -EINVAL; |
| 316 | } |
| 317 | |
| 318 | for (i = 0; i < init_data_num; i++) { |
| 319 | ret = pmic_clrsetbits(dev, |
| 320 | init_data[i].reg, |
| 321 | init_data[i].mask, |
| 322 | init_data[i].val); |
| 323 | if (ret < 0) { |
| 324 | printf("%s: i2c set reg 0x%x failed, ret=%d\n", |
| 325 | __func__, init_data[i].reg, ret); |
| 326 | } |
| 327 | |
| 328 | debug("%s: reg[0x%x] = 0x%x\n", __func__, init_data[i].reg, |
| 329 | pmic_reg_read(dev, init_data[i].reg)); |
| 330 | } |
| 331 | |
Jonas Karlman | b909066 | 2023-08-03 21:02:42 +0000 | [diff] [blame] | 332 | if (!IS_ENABLED(CONFIG_SPL_BUILD)) { |
| 333 | printf("PMIC: RK%x ", show_variant); |
| 334 | if (on_source && off_source) |
| 335 | printf("(on=0x%02x, off=0x%02x)", |
| 336 | pmic_reg_read(dev, on_source), |
| 337 | pmic_reg_read(dev, off_source)); |
| 338 | printf("\n"); |
| 339 | } |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 340 | |
Jonas Karlman | b909066 | 2023-08-03 21:02:42 +0000 | [diff] [blame] | 341 | if (IS_ENABLED(CONFIG_ROCKCHIP_RK8XX_DISABLE_BOOT_ON_POWERON)) |
Chris Morgan | 7c9de74 | 2022-05-27 13:18:20 -0500 | [diff] [blame] | 342 | rk8xx_off_for_plugin(dev); |
Jacob Chen | 0234adb | 2017-05-02 14:54:49 +0800 | [diff] [blame] | 343 | |
| 344 | return 0; |
| 345 | } |
| 346 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 347 | static struct dm_pmic_ops rk8xx_ops = { |
| 348 | .reg_count = rk8xx_reg_count, |
| 349 | .read = rk8xx_read, |
| 350 | .write = rk8xx_write, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 351 | }; |
| 352 | |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 353 | static const struct udevice_id rk8xx_ids[] = { |
Elaine Zhang | 1d9077e | 2019-09-26 15:43:55 +0800 | [diff] [blame] | 354 | { .compatible = "rockchip,rk805" }, |
Quentin Schulz | f7c6da1 | 2024-03-14 10:36:18 +0100 | [diff] [blame] | 355 | { .compatible = "rockchip,rk806" }, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 356 | { .compatible = "rockchip,rk808" }, |
Joseph Chen | d6b3e83 | 2019-09-26 15:45:07 +0800 | [diff] [blame] | 357 | { .compatible = "rockchip,rk809" }, |
Elaine Zhang | 04e5a43 | 2019-09-26 15:43:54 +0800 | [diff] [blame] | 358 | { .compatible = "rockchip,rk816" }, |
Joseph Chen | 4a1ae18 | 2019-09-26 15:44:55 +0800 | [diff] [blame] | 359 | { .compatible = "rockchip,rk817" }, |
Jacob Chen | 0234adb | 2017-05-02 14:54:49 +0800 | [diff] [blame] | 360 | { .compatible = "rockchip,rk818" }, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 361 | { } |
| 362 | }; |
| 363 | |
Walter Lozano | 2901ac6 | 2020-06-25 01:10:04 -0300 | [diff] [blame] | 364 | U_BOOT_DRIVER(rockchip_rk805) = { |
| 365 | .name = "rockchip_rk805", |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 366 | .id = UCLASS_PMIC, |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 367 | .of_match = rk8xx_ids, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 368 | #if CONFIG_IS_ENABLED(PMIC_CHILDREN) |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 369 | .bind = rk8xx_bind, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 370 | #endif |
Simon Glass | 8a2b47f | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 371 | .priv_auto = sizeof(struct rk8xx_priv), |
Jacob Chen | 614704b | 2017-05-02 14:54:52 +0800 | [diff] [blame] | 372 | .probe = rk8xx_probe, |
| 373 | .ops = &rk8xx_ops, |
Simon Glass | a8bd2ac | 2016-01-21 19:43:29 -0700 | [diff] [blame] | 374 | }; |
Walter Lozano | 48e5b04 | 2020-06-25 01:10:06 -0300 | [diff] [blame] | 375 | |
Simon Glass | df65db8 | 2020-12-28 20:34:57 -0700 | [diff] [blame] | 376 | DM_DRIVER_ALIAS(rockchip_rk805, rockchip_rk808) |