]> git.sur5r.net Git - u-boot/blobdiff - board/theobroma-systems/puma_rk3399/puma-rk3399.c
rockchip: rk3399-puma: set gpio4cd iodomain to 1.8V
[u-boot] / board / theobroma-systems / puma_rk3399 / puma-rk3399.c
index 0ad267cdd07b5db5a04fe1e138be69d9484cec16..c6690fa06900844439589a74a3c1a71e4d1b4181 100644 (file)
@@ -8,13 +8,17 @@
 #include <dm.h>
 #include <misc.h>
 #include <spl.h>
+#include <syscon.h>
 #include <usb.h>
 #include <dm/pinctrl.h>
 #include <dm/uclass-internal.h>
+#include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/setup.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/cru_rk3399.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/grf_rk3399.h>
 #include <asm/arch/periph.h>
 #include <power/regulator.h>
 #include <u-boot/sha256.h>
@@ -173,17 +177,32 @@ static void setup_serial(void)
 
        serialno = crc32_no_comp(0, low, 8);
        serialno |= (u64)crc32_no_comp(serialno, high, 8) << 32;
-       snprintf(serialno_str, sizeof(serialno_str), "%llx", serialno);
+       snprintf(serialno_str, sizeof(serialno_str), "%016llx", serialno);
 
        env_set("cpuid#", cpuid_str);
        env_set("serial#", serialno_str);
 #endif
 }
 
+static void setup_iodomain(void)
+{
+       const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
+       struct rk3399_grf_regs *grf =
+           syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+
+       /*
+        * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
+        * Linux assumes that PCIE_RST# works out of the box as it probes
+        * PCIe before loading the iodomain driver.
+        */
+       rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
+}
+
 int misc_init_r(void)
 {
        setup_serial();
        setup_macaddr();
+       setup_iodomain();
 
        return 0;
 }