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.
static struct {
uchar addr;
pmic_setup_func *init;
static struct {
uchar addr;
pmic_setup_func *init;
printf("%s\n", i == ARRAY_SIZE(i2c_addrs) ? "N/A" : i2c_addrs[i].name);
return ret;
}
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
#define TX6UL_LCD_RST_GPIO IMX_GPIO_NR(3, 4)
#define TX6UL_LCD_BACKLIGHT_GPIO IMX_GPIO_NR(4, 16)
#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
#define TX6UL_I2C1_SCL_GPIO CONFIG_SOFT_I2C_GPIO_SCL
#define TX6UL_I2C1_SDA_GPIO CONFIG_SOFT_I2C_GPIO_SDA
#define TX6UL_SD1_CD_GPIO IMX_GPIO_NR(4, 14)
#define TX6UL_SD1_CD_GPIO IMX_GPIO_NR(4, 14)
};
static const struct gpio const tx6ul_gpios[] = {
};
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", },
/* 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", },
{ 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", },
{ 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", },
#define GPIO_PSR 8
/* run with default environment */
#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;
static void tx6_i2c_recover(void)
{
int i;
+#else
+static inline void tx6_i2c_recover(void)
+{
+}
+#endif
/* placed in section '.data' to prevent overwriting relocation info
* overlayed with bss
/* placed in section '.data' to prevent overwriting relocation info
* overlayed with bss
/* PMIC settings */
#define VDD_RTC_VAL rn5t_mV_to_regval_rtc(3000)
#define VDD_CORE_VAL rn5t_mV_to_regval(1300) /* DCDC1 */
/* PMIC settings */
#define VDD_RTC_VAL rn5t_mV_to_regval_rtc(3000)
#define VDD_CORE_VAL rn5t_mV_to_regval(1300) /* DCDC1 */
};
static int pmic_addr __maybe_unused = 0x33;
};
static int pmic_addr __maybe_unused = 0x33;
#else /* CONFIG_TX6_REV */
/* autodetect which PMIC is present to derive TX6_REV */
#ifdef CONFIG_SOC_MX6UL
#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
#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
+#endif /* CONFIG_TX6_UBOOT_NOENV */
+#else /* !CONFIG_SOC_MX6UL */
#define CONFIG_LTC3676 /* TX6_REV == 1 */
#define CONFIG_LTC3676 /* TX6_REV == 1 */
+#endif /* CONFIG_SOC_MX6UL */
#define CONFIG_RN5T567 /* TX6_REV == 3 */
#endif /* CONFIG_TX6_REV */
#define CONFIG_RN5T567 /* TX6_REV == 3 */
#endif /* CONFIG_TX6_REV */