From: Lothar Waßmann Date: Tue, 26 Apr 2016 13:33:34 +0000 (+0200) Subject: karo: tx6ul: disable the PMIC for '_noenv' U-Boot X-Git-Tag: KARO-TX6-2016-04-26 X-Git-Url: https://git.kernelconcepts.de/?p=karo-tx-uboot.git;a=commitdiff_plain;h=b86a63c42e39f4eb501dc923d51d2f7703aa90c7 karo: tx6ul: disable the PMIC for '_noenv' U-Boot 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. --- diff --git a/board/karo/tx6/pmic.c b/board/karo/tx6/pmic.c index 3e4acda190..75a0bf96c4 100644 --- a/board/karo/tx6/pmic.c +++ b/board/karo/tx6/pmic.c @@ -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 diff --git a/board/karo/tx6/tx6ul.c b/board/karo/tx6/tx6ul.c index 52ac588db9..0fc9876098 100644 --- a/board/karo/tx6/tx6ul.c +++ b/board/karo/tx6/tx6ul.c @@ -44,8 +44,10 @@ #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) { diff --git a/include/configs/tx6.h b/include/configs/tx6.h index 9c755ddf03..d8ab70c31e 100644 --- a/include/configs/tx6.h +++ b/include/configs/tx6.h @@ -321,15 +321,22 @@ #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 */