From 7c32bfa6453590d50939849069c44b0f360b1893 Mon Sep 17 00:00:00 2001 From: Jose Alberto Meza Date: Wed, 25 Sep 2019 11:05:03 -0700 Subject: [PATCH] boards: mchp: Add option to switch GPIO bank voltage Add KConfig board support to match board jumper settings Failing to update bank selection will affect GPIOs tied to VTR3 Signed-off-by: Jose Alberto Meza --- .../mec1501modular_assy6885_defconfig | 1 + boards/arm/mec1501modular_assy6885/pinmux.c | 7 +++++++ boards/arm/mec15xxevb_assy6853/pinmux.c | 7 +++++++ soc/arm/microchip_mec/mec1501/Kconfig.soc | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/boards/arm/mec1501modular_assy6885/mec1501modular_assy6885_defconfig b/boards/arm/mec1501modular_assy6885/mec1501modular_assy6885_defconfig index 1159ed66392..e90552a8f2b 100644 --- a/boards/arm/mec1501modular_assy6885/mec1501modular_assy6885_defconfig +++ b/boards/arm/mec1501modular_assy6885/mec1501modular_assy6885_defconfig @@ -7,6 +7,7 @@ CONFIG_ARM=y CONFIG_SOC_MEC1501_HSZ=y CONFIG_SOC_SERIES_MEC1501X=y +CONFIG_SOC_MEC1501_VTR3_1_8V=y CONFIG_BOARD_MEC1501MODULAR_ASSY6885=y CONFIG_RTOS_TIMER=n diff --git a/boards/arm/mec1501modular_assy6885/pinmux.c b/boards/arm/mec1501modular_assy6885/pinmux.c index 576b4e9e646..f8dfc4629b5 100644 --- a/boards/arm/mec1501modular_assy6885/pinmux.c +++ b/boards/arm/mec1501modular_assy6885/pinmux.c @@ -40,6 +40,13 @@ static int board_pinmux_init(struct device *dev) device_get_binding(CONFIG_PINMUX_XEC_GPIO240_276_NAME); #endif + /* Configure GPIO bank before usage + * VTR1 is not configurable + * VTR2 doesn't need configuration if setting VTR2_STRAP + */ +#ifdef CONFIG_SOC_MEC1501_VTR3_1_8V + ECS_REGS->GPIO_BANK_PWR |= MCHP_ECS_VTR3_LVL_18; +#endif /* Release JTAG TDI and JTAG TDO pins so they can be * controlled by their respective PCR register (UART2). * For more details see table 44-1 diff --git a/boards/arm/mec15xxevb_assy6853/pinmux.c b/boards/arm/mec15xxevb_assy6853/pinmux.c index 0ddd4679249..2fee09288f3 100644 --- a/boards/arm/mec15xxevb_assy6853/pinmux.c +++ b/boards/arm/mec15xxevb_assy6853/pinmux.c @@ -40,6 +40,13 @@ static int board_pinmux_init(struct device *dev) device_get_binding(CONFIG_PINMUX_XEC_GPIO240_276_NAME); #endif + /* Configure GPIO bank before usage + * VTR1 is not configurable + * VTR2 doesn't need configuration if setting VTR2_STRAP + */ +#ifdef CONFIG_SOC_MEC1501_VTR3_1_8V + ECS_REGS->GPIO_BANK_PWR |= MCHP_ECS_VTR3_LVL_18; +#endif /* Release JTAG TDI and JTAG TDO pins so they can be * controlled by their respective PCR register (UART2). * For more details see table 44-1 diff --git a/soc/arm/microchip_mec/mec1501/Kconfig.soc b/soc/arm/microchip_mec/mec1501/Kconfig.soc index a04ddfe223a..55d0259fe30 100644 --- a/soc/arm/microchip_mec/mec1501/Kconfig.soc +++ b/soc/arm/microchip_mec/mec1501/Kconfig.soc @@ -66,3 +66,8 @@ config SOC_MEC1501_EXT_32K_PARALLEL_CRYSTAL Say n if the crystal is connected single ended to the XTAL2 pin or a 32KHz square wave is on XTAL2. + +config SOC_MEC1501_VTR3_1_8V + bool "VTR3 power rail is tied to 1.8V" + help + Set this is if VTR3 power sourcejumper in the board is changed.