]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ARM64: zynqmp: Add support for USB ulpi phy reset via mode pins
authorMichal Simek <michal.simek@xilinx.com>
Mon, 15 Aug 2016 07:41:36 +0000 (09:41 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 18 Aug 2016 06:14:22 +0000 (08:14 +0200)
Mode pins can be used as output for reset. Xilinx boards are using
this feature as additional way how to reset USB phys and also others
chips on the boards.
Mode1 is used on all these boards for this feature.
Let SPL toggle reset on this pin by default.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
arch/arm/cpu/armv8/zynqmp/spl.c
arch/arm/include/asm/arch-zynqmp/hardware.h

index 867d2b25a88d67d86873f346a899f77f4fe2a0bb..165ae0c958d7a657aa63821847463353f11fed4b 100644 (file)
@@ -35,10 +35,33 @@ void board_init_f(ulong dummy)
        board_init_r(NULL, 0);
 }
 
+static void ps_mode_reset(ulong mode)
+{
+       writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT |
+              mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
+              &crlapb_base->boot_pin_ctrl);
+       udelay(1);
+       writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
+              &crlapb_base->boot_pin_ctrl);
+       udelay(5);
+       writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT |
+              mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
+              &crlapb_base->boot_pin_ctrl);
+}
+
+/*
+ * Set default PS_MODE1 which is used for USB ULPI phy reset
+ * Also other resets can be connected to this certain pin
+ */
+#ifndef MODE_RESET
+# define MODE_RESET    PS_MODE1
+#endif
+
 #ifdef CONFIG_SPL_BOARD_INIT
 void spl_board_init(void)
 {
        preloader_console_init();
+       ps_mode_reset(MODE_RESET);
        board_init();
 }
 #endif
index 2ce80147c42b34f756ce6a503e36e2bfd910fe46..f46dc31e3ac98fc8eef3fca62d7015da21573198 100644 (file)
 
 #define ZYNQMP_CRL_APB_BASEADDR        0xFF5E0000
 #define ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT       0x1000000
+#define ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT      0
+#define ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT     8
+
+#define PS_MODE0       BIT(0)
+#define PS_MODE1       BIT(1)
+#define PS_MODE2       BIT(2)
+#define PS_MODE3       BIT(3)
 
 struct crlapb_regs {
        u32 reserved0[36];
@@ -35,7 +42,9 @@ struct crlapb_regs {
        u32 boot_mode; /* 0x200 */
        u32 reserved3[14];
        u32 rst_lpd_top; /* 0x23C */
-       u32 reserved4[26];
+       u32 reserved4[4];
+       u32 boot_pin_ctrl; /* 0x250 */
+       u32 reserved5[21];
 };
 
 #define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR)