]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/tx53/tx53.c
karo: tx53: make adjust_core-voltage() less verbose
[karo-tx-uboot.git] / board / karo / tx53 / tx53.c
index e877b2c44cbb44e7b796ee694ea6af45ee08f846..f67f770ae9b6d8f006409ab5cabf9683dcf7d199 100644 (file)
@@ -58,6 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TX53_SDHC_PAD_CTRL     MUX_PAD_CTRL(PAD_CTL_HYS | PAD_CTL_DSE_HIGH |   \
                                PAD_CTL_SRE_FAST | PAD_CTL_PUS_47K_UP)
 
+char __uboot_img_end[0] __attribute__((section(".__uboot_img_end")));
+
 static iomux_v3_cfg_t tx53_pads[] = {
        /* NAND flash pads are set up in lowlevel_init.S */
 
@@ -173,9 +175,31 @@ static void print_reset_cause(void)
        printf("\n");
 }
 
+#define pr_lpgr_val(v, n, b, c) do {                                   \
+       u32 __v = ((v) >> (b)) & ((1 << (c)) - 1);                      \
+       if (__v)                                                        \
+               printf(" %s=%0*x", #n, DIV_ROUND_UP(c, 4), __v);        \
+} while (0)
+
+static inline void print_lpgr(u32 lpgr)
+{
+       if (!lpgr)
+               return;
+
+       printf("LPGR=%08x:", lpgr);
+       pr_lpgr_val(lpgr, SW_ISO, 31, 1);
+       pr_lpgr_val(lpgr, SECONDARY_BOOT, 30, 1);
+       pr_lpgr_val(lpgr, BLOCK_REWRITE, 29, 1);
+       pr_lpgr_val(lpgr, WDOG_BOOT, 28, 1);
+       pr_lpgr_val(lpgr, SBMR_SHADOW, 0, 26);
+       printf("\n");
+}
+
 static void tx53_print_cpuinfo(void)
 {
        u32 cpurev;
+       struct srtc_regs *srtc_regs = (void *)SRTC_BASE_ADDR;
+       u32 lpgr = readl(&srtc_regs->lpgr);
 
        cpurev = get_cpu_rev();
 
@@ -185,6 +209,20 @@ static void tx53_print_cpuinfo(void)
                mxc_get_clock(MXC_ARM_CLK) / 1000000);
 
        print_reset_cause();
+
+       print_lpgr(lpgr);
+
+       if (lpgr & (1 << 30))
+               printf("WARNING: U-Boot started from secondary bootstrap image\n");
+
+       if (lpgr) {
+               struct mxc_ccm_reg *ccm_regs = (void *)CCM_BASE_ADDR;
+               u32 ccgr4 = readl(&ccm_regs->CCGR4);
+
+               writel(ccgr4 | MXC_CCM_CCGR4_SRTC(3), &ccm_regs->CCGR4);
+               writel(0, &srtc_regs->lpgr);
+               writel(ccgr4, &ccm_regs->CCGR4);
+       }
 }
 
 enum LTC3589_REGS {
@@ -339,7 +377,7 @@ int adjust_core_voltage(u32 freq)
                        u8 val = mV_to_regval(vout_to_vref(mV * 10, 3));
                        u8 v;
 
-                       printf("regval[%umV]=%02x\n", mV, val);
+                       debug("regval[%umV]=%02x\n", mV, val);
 
                        ret = i2c_read(CONFIG_SYS_I2C_SLAVE, LTC3589_B1DTV1, 1,
                                &v, 1);
@@ -348,7 +386,7 @@ int adjust_core_voltage(u32 freq)
                                        __func__, LTC3589_B1DTV1, ret);
                                return ret;
                        }
-                       printf("Changing reg %02x from %02x to %02x\n",
+                       debug("Changing reg %02x from %02x to %02x\n",
                                LTC3589_B1DTV1, v, (v & ~0x1f) |
                                mV_to_regval(vout_to_vref(mV * 10, 3)));
                        v &= ~0x1f;
@@ -428,7 +466,7 @@ int board_early_init_f(void)
        writel(0x00000000, AIPS2_BASE_ADDR + 0x50);
 
        writel(0xffcf0fff, &ccm_regs->CCGR0);
-       writel(0x000fffc3, &ccm_regs->CCGR1);
+       writel(0x000fffcf, &ccm_regs->CCGR1);
        writel(0x033c0000, &ccm_regs->CCGR2);
        writel(0x000000ff, &ccm_regs->CCGR3);
        writel(0x00000000, &ccm_regs->CCGR4);
@@ -1369,7 +1407,7 @@ void ft_board_setup(void *blob, bd_t *bd)
 
        karo_fdt_fixup_touchpanel(blob, tx53_touchpanels,
                                ARRAY_SIZE(tx53_touchpanels));
-       karo_fdt_fixup_usb_otg(blob, "usbotg", "fsl,usbphy");
+       karo_fdt_fixup_usb_otg(blob, "usbotg", "fsl,usbphy", "vbus-supply");
        karo_fdt_fixup_flexcan(blob, stk5_v5);
        tx53_fixup_rtc(blob);
        karo_fdt_update_fb_mode(blob, video_mode);