Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Klaus Goger | 8103993 | 2017-04-07 19:13:38 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH |
Klaus Goger | 8103993 | 2017-04-07 19:13:38 +0200 | [diff] [blame] | 4 | */ |
Philipp Tomsich | 3df6626 | 2017-09-29 19:27:54 +0200 | [diff] [blame] | 5 | |
Klaus Goger | 8103993 | 2017-04-07 19:13:38 +0200 | [diff] [blame] | 6 | #include <dm.h> |
Jakob Unterwurzacher | b072063 | 2017-12-15 16:23:14 +0100 | [diff] [blame] | 7 | #include <syscon.h> |
Klaus Goger | 8103993 | 2017-04-07 19:13:38 +0200 | [diff] [blame] | 8 | #include <dm/pinctrl.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 9 | #include <asm/arch-rockchip/clock.h> |
Kever Yang | 9fbe17c | 2019-03-28 11:01:23 +0800 | [diff] [blame] | 10 | #include <asm/arch-rockchip/hardware.h> |
| 11 | #include <asm/arch-rockchip/grf_rk3399.h> |
Quentin Schulz | 1e1a92b | 2024-01-17 18:59:10 +0100 | [diff] [blame] | 12 | #include "../common/common.h" |
Klaus Goger | 8103993 | 2017-04-07 19:13:38 +0200 | [diff] [blame] | 13 | |
Jakob Unterwurzacher | b072063 | 2017-12-15 16:23:14 +0100 | [diff] [blame] | 14 | static void setup_iodomain(void) |
| 15 | { |
| 16 | const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3; |
| 17 | struct rk3399_grf_regs *grf = |
| 18 | syscon_get_first_range(ROCKCHIP_SYSCON_GRF); |
| 19 | |
| 20 | /* |
| 21 | * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6). |
| 22 | * Linux assumes that PCIE_RST# works out of the box as it probes |
| 23 | * PCIe before loading the iodomain driver. |
| 24 | */ |
| 25 | rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT); |
| 26 | } |
| 27 | |
Quentin Schulz | 1418625 | 2024-03-11 13:01:50 +0100 | [diff] [blame] | 28 | int rockchip_early_misc_init_r(void) |
Philipp Tomsich | 2ebe289 | 2017-05-05 19:21:39 +0200 | [diff] [blame] | 29 | { |
Jakob Unterwurzacher | b072063 | 2017-12-15 16:23:14 +0100 | [diff] [blame] | 30 | setup_iodomain(); |
Klaus Goger | 810182f | 2018-05-24 17:15:53 +0200 | [diff] [blame] | 31 | setup_boottargets(); |
Philipp Tomsich | 2ebe289 | 2017-05-05 19:21:39 +0200 | [diff] [blame] | 32 | |
| 33 | return 0; |
| 34 | } |