]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
karo: tx6ul: disable the PMIC for '_noenv' U-Boot KARO-TX6-2016-04-26
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 26 Apr 2016 13:33:34 +0000 (15:33 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 26 Apr 2016 13:33:34 +0000 (15:33 +0200)
The I2C access to the PMIC requires the TAMPER pins of the i.MX6UL to
be useable as GPIOs. This is only possible after the TAMPER_PIN_DISABLE
fuses are programmed which is usually done via U-Boot.
Resolve this catch 22 situation by disabling the PMIC in the '_noenv'
U-Boot variant which is usually used in the manufacturing
environment.

board/karo/tx6/pmic.c
board/karo/tx6/tx6ul.c
include/configs/tx6.h

index 3e4acda19063b1bd91a17a72f12dd34124f80997..75a0bf96c429adc197aca9e3af7e39c516211272 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "pmic.h"
 
+#ifdef CONFIG_SYS_I2C
 static struct {
        uchar addr;
        pmic_setup_func *init;
@@ -61,3 +62,10 @@ int tx6_pmic_init(int addr, struct pmic_regs *regs, size_t num_regs)
        printf("%s\n", i == ARRAY_SIZE(i2c_addrs) ? "N/A" : i2c_addrs[i].name);
        return ret;
 }
+#else
+int tx6_pmic_init(int addr, struct pmic_regs *regs, size_t num_regs)
+{
+       printf("PMIC: N/A\n");
+       return 0;
+}
+#endif
index 52ac588db9d4813b91ecc1bd92dd635adabf8f2e..0fc9876098ea9db6fa72541cf20f6d0af599cd48 100644 (file)
 #define TX6UL_LCD_RST_GPIO             IMX_GPIO_NR(3, 4)
 #define TX6UL_LCD_BACKLIGHT_GPIO       IMX_GPIO_NR(4, 16)
 
+#ifdef CONFIG_SYS_I2C_SOFT
 #define TX6UL_I2C1_SCL_GPIO            CONFIG_SOFT_I2C_GPIO_SCL
 #define TX6UL_I2C1_SDA_GPIO            CONFIG_SOFT_I2C_GPIO_SDA
+#endif
 
 #define TX6UL_SD1_CD_GPIO              IMX_GPIO_NR(4, 14)
 
@@ -161,10 +163,11 @@ static const iomux_v3_cfg_t const tx6_i2c_gpio_pads[] = {
 };
 
 static const struct gpio const tx6ul_gpios[] = {
+#ifdef CONFIG_SYS_I2C_SOFT
        /* These two entries are used to forcefully reinitialize the I2C bus */
        { TX6UL_I2C1_SCL_GPIO, GPIOFLAG_INPUT, "I2C1 SCL", },
        { TX6UL_I2C1_SDA_GPIO, GPIOFLAG_INPUT, "I2C1 SDA", },
-
+#endif
        { TX6UL_FEC_PWR_GPIO, GPIOFLAG_OUTPUT_INIT_HIGH, "FEC PHY PWR", },
        { TX6UL_FEC_RST_GPIO, GPIOFLAG_OUTPUT_INIT_LOW, "FEC PHY RESET", },
        { TX6UL_FEC_INT_GPIO, GPIOFLAG_INPUT, "FEC PHY INT", },
@@ -180,6 +183,7 @@ static const struct gpio const tx6ul_fec2_gpios[] = {
 #define GPIO_PSR 8
 
 /* run with default environment */
+#if defined(TX6UL_I2C1_SCL_GPIO) && defined(TX6UL_I2C1_SDA_GPIO)
 static void tx6_i2c_recover(void)
 {
        int i;
@@ -239,6 +243,11 @@ static void tx6_i2c_recover(void)
                }
        }
 }
+#else
+static inline void tx6_i2c_recover(void)
+{
+}
+#endif
 
 /* placed in section '.data' to prevent overwriting relocation info
  * overlayed with bss
@@ -404,6 +413,7 @@ static inline u8 tx6ul_mem_suffix(void)
 #endif
 }
 
+#ifdef CONFIG_RN5T567
 /* PMIC settings */
 #define VDD_RTC_VAL            rn5t_mV_to_regval_rtc(3000)
 #define VDD_CORE_VAL           rn5t_mV_to_regval(1300)         /* DCDC1 */
@@ -433,6 +443,7 @@ static struct pmic_regs rn5t567_regs[] = {
 };
 
 static int pmic_addr __maybe_unused = 0x33;
+#endif
 
 int board_init(void)
 {
index 9c755ddf03326d20775fde6a96b5feacd9a78494..d8ab70c31e92af68878c0aeee18ca5a15ac0f59d 100644 (file)
 #else /* CONFIG_TX6_REV */
 /* autodetect which PMIC is present to derive TX6_REV */
 #ifdef CONFIG_SOC_MX6UL
+#ifndef CONFIG_TX6_UBOOT_NOENV
+/* NOENV U-Boot is used for initial bootstrap.
+ * Since the TAMPER_PIN_DISABLE fuses have to be programmed
+ * to be able to use the TAMPER pins as GPIO to access the
+ * PMIC I2C bus, this is not possible on virgin hardware.
+ */
 #define CONFIG_SYS_I2C
 #define CONFIG_SYS_I2C_SOFT
 #define CONFIG_SYS_I2C_SOFT_SPEED      400000
 #define CONFIG_SOFT_I2C_GPIO_SCL       IMX_GPIO_NR(5, 0)
 #define CONFIG_SOFT_I2C_GPIO_SDA       IMX_GPIO_NR(5, 1)
 #define CONFIG_SOFT_I2C_READ_REPEATED_START
-#else
+#endif /* CONFIG_TX6_UBOOT_NOENV */
+#else /* !CONFIG_SOC_MX6UL */
 #define CONFIG_LTC3676                 /* TX6_REV == 1 */
-#endif
+#endif /*  CONFIG_SOC_MX6UL */
 #define CONFIG_RN5T567                 /* TX6_REV == 3 */
 #endif /* CONFIG_TX6_REV */