armv8/ls2080ardb: Enable VID support
authorRai Harninder <harninder.rai@nxp.com>
Wed, 23 Mar 2016 11:34:38 +0000 (17:04 +0530)
committerYork Sun <york.sun@nxp.com>
Tue, 29 Mar 2016 15:46:24 +0000 (08:46 -0700)
This patch enable VID support for ls2080ardb platform.
It uses the common VID driver.

Signed-off-by: Rai Harninder <harninder.rai@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
board/freescale/common/vid.c
board/freescale/ls2080ardb/ls2080ardb.c
include/configs/ls2080ardb.h

index 4f0fdfd4b13acc8510ca988cdcfe888f8860ffd0..1d3b33671f414265f4740224c36d616434b94d8c 100644 (file)
@@ -180,6 +180,10 @@ struct ccsr_gur {
        u8      res_008[0x20-0x8];
        u32     gpporcr1;       /* General-purpose POR configuration */
        u32     gpporcr2;       /* General-purpose POR configuration 2 */
+#define FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT     25
+#define FSL_CHASSIS3_DCFG_FUSESR_VID_MASK      0x1F
+#define FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT  20
+#define FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK   0x1F
        u32     dcfg_fusesr;    /* Fuse status register */
        u32     gpporcr3;
        u32     gpporcr4;
index a6a132ab191f4bdf88db5838ce4717907ee2cca1..2f297951373d6f7b647eb04e1ca903b784955e8f 100644 (file)
@@ -10,6 +10,8 @@
 #include <asm/io.h>
 #ifdef CONFIG_LS1043A
 #include <asm/arch/immap_lsch2.h>
+#elif defined(CONFIG_FSL_LSCH3)
+#include <asm/arch/immap_lsch3.h>
 #else
 #include <asm/immap_85xx.h>
 #endif
@@ -285,7 +287,7 @@ static int set_voltage(int i2caddress, int vdd)
 int adjust_vdd(ulong vdd_override)
 {
        int re_enable = disable_interrupts();
-#ifdef CONFIG_LS1043A
+#if defined(CONFIG_LS1043A) || defined(CONFIG_FSL_LSCH3)
        struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
 #else
        ccsr_gur_t __iomem *gur =
@@ -362,7 +364,11 @@ int adjust_vdd(ulong vdd_override)
        }
 
        /* get the voltage ID from fuse status register */
+#ifdef CONFIG_FSL_LSCH3
+       fusesr = in_le32(&gur->dcfg_fusesr);
+#else
        fusesr = in_be32(&gur->dcfg_fusesr);
+#endif
        /*
         * VID is used according to the table below
         *                ---------------------------------------
@@ -387,6 +393,13 @@ int adjust_vdd(ulong vdd_override)
                vid = (fusesr >> FSL_CHASSIS2_DCFG_FUSESR_VID_SHIFT) &
                        FSL_CHASSIS2_DCFG_FUSESR_VID_MASK;
        }
+#elif defined(CONFIG_FSL_LSCH3)
+       vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_ALTVID_SHIFT) &
+               FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK;
+       if ((vid == 0) || (vid == FSL_CHASSIS3_DCFG_FUSESR_ALTVID_MASK)) {
+               vid = (fusesr >> FSL_CHASSIS3_DCFG_FUSESR_VID_SHIFT) &
+                       FSL_CHASSIS3_DCFG_FUSESR_VID_MASK;
+       }
 #else
        vid = (fusesr >> FSL_CORENET_DCFG_FUSESR_ALTVID_SHIFT) &
                FSL_CORENET_DCFG_FUSESR_ALTVID_MASK;
index ec4b74c2726e76cb00a18a7d8d8559d1df19fc21..82010481934780e33f9b36602394987f8e7c5854 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "../common/qixis.h"
 #include "ls2080ardb_qixis.h"
+#include "../common/vid.h"
 
 #define PIN_MUX_SEL_SDHC       0x00
 #define PIN_MUX_SEL_DSPI       0x0a
@@ -123,6 +124,11 @@ int select_i2c_ch_pca9547(u8 ch)
        return 0;
 }
 
+int i2c_multiplexer_select_vid_channel(u8 channel)
+{
+       return select_i2c_ch_pca9547(channel);
+}
+
 int config_board_mux(int ctrl_type)
 {
        u8 reg5;
@@ -189,6 +195,9 @@ int misc_init_r(void)
        if (hwconfig("sdhc"))
                config_board_mux(MUX_TYPE_SDHC);
 
+       if (adjust_vdd(0))
+               printf("Warning: Adjusting core voltage failed.\n");
+
        return 0;
 }
 
index ce1d90098f7c766b2bd3b5613cc4d04e50ce0f43..15a11723b0eb593337b5e354d1a0de82724b5d30 100644 (file)
 
 #define CONFIG_DISPLAY_BOARDINFO
 
+#define I2C_MUX_CH_VOL_MONITOR         0xa
+#define I2C_VOL_MONITOR_ADDR           0x38
+#define CONFIG_VOL_MONITOR_IR36021_READ
+#define CONFIG_VOL_MONITOR_IR36021_SET
+
+#define CONFIG_VID_FLS_ENV             "ls2080ardb_vdd_mv"
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_VID
+#endif
+/* step the IR regulator in 5mV increments */
+#define IR_VDD_STEP_DOWN               5
+#define IR_VDD_STEP_UP                 5
+/* The lowest and highest voltage allowed for LS2080ARDB */
+#define VDD_MV_MIN                     819
+#define VDD_MV_MAX                     1212
+
 #ifndef __ASSEMBLY__
 unsigned long get_board_sys_clk(void);
 #endif