.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Rockchip Generic Register Files setup |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2016 Heiko Stuebner <heiko@sntech.de> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #include <linux/bitfield.h> |
---|
.. | .. |
---|
198 | 195 | }; |
---|
199 | 196 | |
---|
200 | 197 | #define RK3308_GRF_SOC_CON3 0x30c |
---|
| 198 | +#define RK3308_GRF_SOC_CON13 0x608 |
---|
201 | 199 | |
---|
202 | 200 | static const struct rockchip_grf_value rk3308_defaults[] __initconst = { |
---|
203 | 201 | { "uart dma mask", RK3308_GRF_SOC_CON3, HIWORD_UPDATE(0, 0x1f, 10) }, |
---|
| 202 | + { "uart2 auto switching", RK3308_GRF_SOC_CON13, HIWORD_UPDATE(0, 0x1, 12) }, |
---|
204 | 203 | }; |
---|
205 | 204 | |
---|
206 | 205 | static const struct rockchip_grf_info rk3308_grf __initconst = { |
---|
.. | .. |
---|
228 | 227 | static const struct rockchip_grf_info rk3399_grf __initconst = { |
---|
229 | 228 | .values = rk3399_defaults, |
---|
230 | 229 | .num_values = ARRAY_SIZE(rk3399_defaults), |
---|
| 230 | +}; |
---|
| 231 | + |
---|
| 232 | +#define RK3588_SYS_GRF_SOC_CON7 0x031c |
---|
| 233 | + |
---|
| 234 | +static const struct rockchip_grf_value rk3588_sys_grf_defaults[] __initconst = { |
---|
| 235 | + { "Connect EDP hpd to IO", RK3588_SYS_GRF_SOC_CON7, HIWORD_UPDATE(0x3, 0x3, 14) }, |
---|
| 236 | +}; |
---|
| 237 | + |
---|
| 238 | +static const struct rockchip_grf_info rk3588_sys_grf __initconst = { |
---|
| 239 | + .values = rk3588_sys_grf_defaults, |
---|
| 240 | + .num_values = ARRAY_SIZE(rk3588_sys_grf_defaults), |
---|
231 | 241 | }; |
---|
232 | 242 | |
---|
233 | 243 | #define DELAY_ONE_SECOND 0x16E3600 |
---|
.. | .. |
---|
285 | 295 | .compatible = "rockchip,rk3399-grf", |
---|
286 | 296 | .data = (void *)&rk3399_grf, |
---|
287 | 297 | }, { |
---|
| 298 | + .compatible = "rockchip,rk3588-sys-grf", |
---|
| 299 | + .data = (void *)&rk3588_sys_grf, |
---|
| 300 | + }, { |
---|
288 | 301 | .compatible = "rockchip,rv1126-grf", |
---|
289 | 302 | .data = (void *)&rv1126_grf, |
---|
290 | 303 | }, |
---|
.. | .. |
---|
306 | 319 | np = of_find_matching_node_and_match(NULL, rockchip_grf_dt_match, |
---|
307 | 320 | &match); |
---|
308 | 321 | if (!np) |
---|
309 | | - return -ENODEV; |
---|
| 322 | + return 0; |
---|
310 | 323 | if (!match || !match->data) { |
---|
311 | 324 | pr_err("%s: missing grf data\n", __func__); |
---|
| 325 | + of_node_put(np); |
---|
312 | 326 | return -EINVAL; |
---|
313 | 327 | } |
---|
314 | 328 | |
---|
315 | 329 | grf_info = match->data; |
---|
316 | 330 | |
---|
317 | 331 | grf = syscon_node_to_regmap(np); |
---|
| 332 | + of_node_put(np); |
---|
318 | 333 | if (IS_ERR(grf)) { |
---|
319 | 334 | pr_err("%s: could not get grf syscon\n", __func__); |
---|
320 | 335 | return PTR_ERR(grf); |
---|