imx: ventana: various cleanups
cover imx: ventana: various cleanups
Here is another series of unrelated minor fixues and cleanups for Ventana
Tim Harvey (5):
imx: ventana: various board-specific GPIO config updates
imx: ventana: make model env var automatic and non-overridable
imx: ventana: make fdt_file1 and fdt_file2 automatic and
non-overridable
imx: ventana: hang if board model could not be determined
imx: ventana: skip mtdparts fixup if no flash
board/gateworks/gw_ventana/common.c | 56 ++++++++++++++++++++--------- board/gateworks/gw_ventana/common.h | 6 +--- board/gateworks/gw_ventana/gw_ventana.c | 41 +++++++++------------ board/gateworks/gw_ventana/gw_ventana_spl.c | 6 ++-- 4 files changed, 58 insertions(+), 51 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/5 imx: ventana: various board-specific GPIO config updates
- Added iomux for CAN_STBY and RS484_TEN (GW52xx/GW53xx/GW54xx/GW551x)
- Moved iomux of USBHUB_RST# out of board_ehci_hcd_init so that it is done regardless of USB being initialized in bootloader
- Added usb_sel iomux/hwconfig for GW552x
- Fixed mezzanine DIO for GW54xx
- Fixed PANLEDR# for GW54xx
- Fixed dio iomux/hwconfig for GW552x
- Fixed dio iomux for GW551x
- removed redundant #define
--- board/gateworks/gw_ventana/common.c | 56 +++++++++++++++++++++++---------- board/gateworks/gw_ventana/common.h | 6 +--- board/gateworks/gw_ventana/gw_ventana.c | 14 ++++----- 3 files changed, 46 insertions(+), 30 deletions(-)
board/gateworks/gw_ventana/common.c +39 -17
@@ -191,7 +191,8 @@ static iomux_v3_cfg_t const gw52xx_gpio_pads[] = {IOMUX_PADS (PAD_EIM_A19__GPIO2_IO19 |DIO_PAD_CFG ),/* IOEXP_IRQ# */ IOMUX_PADS (PAD_EIM_A20__GPIO2_IO18 |MUX_PAD_CTRL (IRQ_PAD_CTRL )), - +/* CAN_STBY */ +IOMUX_PADS (PAD_GPIO_9__GPIO1_IO09 |DIO_PAD_CFG ),/* MX6_LOCLED# */ IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | DIO_PAD_CFG),/* GPS_SHDN */
@@ -204,11 +205,17 @@ static iomux_v3_cfg_t const gw52xx_gpio_pads[] = {IOMUX_PADS (PAD_ENET_TXD1__GPIO1_IO29 |DIO_PAD_CFG ),/* PCI_RST# (GW522x) */ IOMUX_PADS (PAD_EIM_D23__GPIO3_IO23 |DIO_PAD_CFG ), +/* RS485_EN */ +IOMUX_PADS (PAD_SD3_DAT4__GPIO7_IO01 |DIO_PAD_CFG ),/* PCIESKT_WDIS# */ IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), };static iomux_v3_cfg_t const gw53xx_gpio_pads[] = { +/* CAN_STBY */ +IOMUX_PADS (PAD_GPIO_2__GPIO1_IO02 |DIO_PAD_CFG ), +/* USB_HUBRST# */ +IOMUX_PADS (PAD_GPIO_9__GPIO1_IO09 |DIO_PAD_CFG ),/* PANLEDG# */ IOMUX_PADS (PAD_KEY_COL0__GPIO4_IO06 |DIO_PAD_CFG ), /* PANLEDR# */
@@ -227,36 +234,46 @@ static iomux_v3_cfg_t const gw53xx_gpio_pads[] = {IOMUX_PADS (PAD_EIM_D31__GPIO3_IO31 |DIO_PAD_CFG ),/* PCI_RST# */ IOMUX_PADS (PAD_ENET_TXD1__GPIO1_IO29 |DIO_PAD_CFG ), +/* RS485_EN */ +IOMUX_PADS (PAD_SD3_DAT4__GPIO7_IO01 |DIO_PAD_CFG ),/* PCIESKT_WDIS# */ IOMUX_PADS(PAD_GPIO_17__GPIO7_IO12 | DIO_PAD_CFG), };static iomux_v3_cfg_t const gw54xx_gpio_pads[] = { +/* CAN_STBY */ +IOMUX_PADS (PAD_GPIO_2__GPIO1_IO02 |DIO_PAD_CFG ),/* PANLEDG# */ IOMUX_PADS (PAD_KEY_COL0__GPIO4_IO06 |DIO_PAD_CFG ),/* PANLEDR# */ -IOMUX_PADS (PAD_KEY_COL2__GPIO4_IO10 |DIO_PAD_CFG ), +IOMUX_PADS (PAD_KEY_ROW0__GPIO4_IO07 |DIO_PAD_CFG ),/* MX6_LOCLED# */ IOMUX_PADS (PAD_KEY_ROW4__GPIO4_IO15 |DIO_PAD_CFG ), +/* USB_HUBRST# */ +IOMUX_PADS (PAD_SD1_DAT0__GPIO1_IO16 |DIO_PAD_CFG ),/* MIPI_DIO */ IOMUX_PADS (PAD_SD1_DAT3__GPIO1_IO21 |DIO_PAD_CFG ),/* RS485_EN */ IOMUX_PADS (PAD_EIM_D24__GPIO3_IO24 |DIO_PAD_CFG ),/* IOEXP_PWREN# */ -IOMUX_PADS (PAD_KEY_ROW0__GPIO4_IO07 |DIO_PAD_CFG ), +IOMUX_PADS (PAD_EIM_A19__GPIO2_IO19 |DIO_PAD_CFG ),/* IOEXP_IRQ# */ -IOMUX_PADS (PAD_KEY_ROW1__GPIO4_IO09 |MUX_PAD_CTRL (IRQ_PAD_CTRL )), +IOMUX_PADS (PAD_EIM_A20__GPIO2_IO18 |MUX_PAD_CTRL (IRQ_PAD_CTRL )),/* DIOI2C_DIS# */ IOMUX_PADS (PAD_GPIO_19__GPIO4_IO05 |DIO_PAD_CFG ),/* PCI_RST# */ IOMUX_PADS (PAD_ENET_TXD1__GPIO1_IO29 |DIO_PAD_CFG ),/* VID_EN */ IOMUX_PADS (PAD_EIM_D31__GPIO3_IO31 |DIO_PAD_CFG ), +/* RS485_EN */ +IOMUX_PADS (PAD_SD3_DAT4__GPIO7_IO01 |DIO_PAD_CFG ),/* PCIESKT_WDIS# */ IOMUX_PADS (PAD_DISP0_DAT23__GPIO5_IO17 |DIO_PAD_CFG ), };static iomux_v3_cfg_t const gw551x_gpio_pads[] = { +/* CAN_STBY */ +IOMUX_PADS (PAD_GPIO_9__GPIO1_IO09 |DIO_PAD_CFG ),/* PANLED# */ IOMUX_PADS (PAD_KEY_ROW0__GPIO4_IO07 |DIO_PAD_CFG ), /* PCI_RST# */
@@ -266,6 +283,10 @@ static iomux_v3_cfg_t const gw551x_gpio_pads[] = { };static iomux_v3_cfg_t const gw552x_gpio_pads[] = { +/* USBOTG_SEL */ +IOMUX_PADS (PAD_GPIO_7__GPIO1_IO07 |DIO_PAD_CFG ), +/* USB_HUBRST# */ +IOMUX_PADS (PAD_GPIO_9__GPIO1_IO09 |DIO_PAD_CFG ),/* PANLEDG# */ IOMUX_PADS (PAD_KEY_COL0__GPIO4_IO06 |DIO_PAD_CFG ),/* PANLEDR# */
@@ -522,12 +543,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = { .num_pads = ARRAY_SIZE(gw551x_gpio_pads)/2, .dio_cfg = { { - { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, - IMX_GPIO_NR(1, 16), - { 0, 0 }, -0 - }, - { { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) }, IMX_GPIO_NR(1, 19), { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) },
@@ -539,12 +554,6 @@ struct ventana gpio_cfg[GW_UNKNOWN] = { { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) },3 }, - { - { IOMUX_PADS(PAD_SD1_CMD__GPIO1_IO18) }, - IMX_GPIO_NR(1, 18), - { IOMUX_PADS(PAD_SD1_CMD__PWM4_OUT) }, - 4 - }, }, .num_gpios = 2, .leds = {
@@ -560,6 +569,12 @@ struct ventana gpio_cfg[GW_UNKNOWN] = { .num_pads = ARRAY_SIZE(gw552x_gpio_pads)/2, .dio_cfg = { { + { IOMUX_PADS(PAD_SD1_DAT0__GPIO1_IO16) }, + IMX_GPIO_NR(1, 16), + { 0, 0 }, +0 + }, + { { IOMUX_PADS(PAD_SD1_DAT2__GPIO1_IO19) },IMX_GPIO_NR (1 ,19 ), { IOMUX_PADS(PAD_SD1_DAT2__PWM2_OUT) },
@@ -571,6 +586,12 @@ struct ventana gpio_cfg[GW_UNKNOWN] = { { IOMUX_PADS(PAD_SD1_DAT1__PWM3_OUT) }, 3 }, + { + {IOMUX_PADS(PAD_SD1_CLK__GPIO1_IO20) }, + IMX_GPIO_NR(1, 20), + { 0, 0 }, + 0 + }, }, .num_gpios = 4, .leds = {
@@ -579,6 +600,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = { IMX_GPIO_NR(4, 15), }, .pcie_rst = IMX_GPIO_NR(1, 29), + .usb_sel = IMX_GPIO_NR(1, 7), .wdis = IMX_GPIO_NR(7, 12), }, };
@@ -712,7 +734,7 @@ void setup_board_gpio(int board, struct ventana_board_info *info)* Configure DIO pinmux/padctl registers * see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions */ -for (i =0 ; i <4 ; i++) { +for (i =0 ; i < gpio_cfg[board].num_gpios; i++) {struct dio_cfg *cfg = &gpio_cfg[board].dio_cfg[i];iomux_v3_cfg_t ctrl =DIO_PAD_CFG ;unsigned cputype =is_cpu_type (MXC_CPU_MX6Q ) ?0 :1 ;
board/gateworks/gw_ventana/common.h +1 -5
@@ -34,10 +34,6 @@ PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST) -#define DIO_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \ - PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ - PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST) -#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \ PAD_CTL_ODE | PAD_CTL_SRE_FAST)
@@ -46,7 +42,7 @@ PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST) -#define DIO_PAD_CFG (MUX_PAD_CTRL(DIO_PAD_CTRL) | MUX_MODE_SION) +#define DIO_PAD_CFG (MUX_PAD_CTRL(IRQ_PAD_CTRL) | MUX_MODE_SION)#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
board/gateworks/gw_ventana/gw_ventana.c +6 -8
@@ -157,20 +157,18 @@ static iomux_v3_cfg_t const usb_pads[] = {int board_ehci_hcd_init (int port) { -struct ventana_board_info *info = &ventana_info;int gpio;SETUP_IOMUX_PADS (usb_pads); -/* Reset USB HUB (present on GW54xx/GW53xx) */ -switch (info->model[3 ]) { -case '3' :/* GW53xx */ -case '5' :/* GW552x */ -SETUP_IOMUX_PAD (PAD_GPIO_9__GPIO1_IO09 |DIO_PAD_CFG ); +/* Reset USB HUB */ +switch (board_type) { +case GW53xx: +case GW552x: gpio = (IMX_GPIO_NR (1 ,9 ));break ; -case '4' :/* GW54xx */ -SETUP_IOMUX_PAD (PAD_SD1_DAT0__GPIO1_IO16 |DIO_PAD_CFG ); +case GW54proto: +case GW54xx: gpio = (IMX_GPIO_NR (1 ,16 ));break ;default :
Signature · 1 line
1.9.1
PATCH 2/5 imx: ventana: make model env var automatic and non-overridable
In reply to Tim HarveyWe want to model env var to always reflect what was in the EEPROM. There is no point in allowing a user to override this.
--- board/gateworks/gw_ventana/gw_ventana.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +1 -6
@@ -685,8 +685,7 @@ int misc_init_r(void)memset (str,0 ,sizeof (str));for (i =0 ; i < (sizeof (str)-1 ) && info->model[i]; i++) str[i] =tolower (info->model[i]); -if (!getenv ("model" )) -setenv ("model" , str); +setenv ("model" , str);if (!getenv ("fdt_file" )) {sprintf (fdt,"%s-%s.dtb" , cputype, str);setenv ("fdt_file" , fdt);
@@ -827,10 +826,6 @@ int ft_board_setup(void *blob, bd_t *bd)printf (" Set display timings for %s...\n" , display); } -if (!model) { -puts ("invalid board info: Leaving FDT fully enabled\n" ); -return 0 ; - }printf (" Adjusting FDT per EEPROM for %s...\n" , model);/* board serial number */
Signature · 1 line
1.9.1
PATCH 3/5 imx: ventana: make fdt_file1 and fdt_file2 automatic and non-overridable
In reply to Tim HarveyThe fdt_file1 and fdt_file2 vars provide fallbacks for the fdt file loading script. There is no need to allow the user to override these as if they want to specify the fdt, they should do so in the first attempt which is the fdt_file var.
--- board/gateworks/gw_ventana/gw_ventana.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +4 -8
@@ -695,18 +695,14 @@ int misc_init_r(void) *p++ =0 ;setenv ("model_base" , str); -if (!getenv ("fdt_file1" )) { -sprintf (fdt,"%s-%s.dtb" , cputype, str); -setenv ("fdt_file1" , fdt); - } +sprintf (fdt,"%s-%s.dtb" , cputype, str); +setenv ("fdt_file1" , fdt);if (board_type != GW551x && board_type != GW552x) str[4 ] ='x' ; str[5 ] ='x' ; str[6 ] =0 ; -if (!getenv ("fdt_file2" )) { -sprintf (fdt,"%s-%s.dtb" , cputype, str); -setenv ("fdt_file2" , fdt); - } +sprintf (fdt,"%s-%s.dtb" , cputype, str); +setenv ("fdt_file2" , fdt); }/* initialize env from EEPROM */
Signature · 1 line
1.9.1
PATCH 4/5 imx: ventana: hang if board model could not be determined
In reply to Tim HarveyIf the EEPROM could not be read or is corrupt we always want to hang. Note that an error message will have been displayed by read_eeprom in this case.
--- board/gateworks/gw_ventana/gw_ventana_spl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
board/gateworks/gw_ventana/gw_ventana_spl.c +2 -4
@@ -515,10 +515,8 @@ void board_init_f(ulong dummy)setup_iomux_gpio (board_model, &ventana_info);/* provide some some default: 32bit 128MB */ -if (GW_UNKNOWN == board_model) { - ventana_info.sdram_width =2 ; - ventana_info.sdram_size =3 ; - } +if (GW_UNKNOWN == board_model) +hang ();/* configure MMDC for SDRAM width/size and per-model calibration */ spl_dram_init(8 << ventana_info.sdram_width,
Signature · 1 line
1.9.1
PATCH 5/5 imx: ventana: skip mtdparts fixup if no flash
In reply to Tim HarveyThis avoids an error message on NAND-less boards.
--- board/gateworks/gw_ventana/gw_ventana.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +5 -3
@@ -811,9 +811,11 @@ int ft_board_setup(void *blob, bd_t *bd)return 0 ; } -/* Update partition nodes using info from mtdparts env var */ -puts (" Updating MTD partitions...\n" ); -fdt_fixup_mtdparts (blob, nodes,ARRAY_SIZE (nodes)); +if (test_bit (EECONFIG_NAND , info->config)) { +/* Update partition nodes using info from mtdparts env var */ +puts (" Updating MTD partitions...\n" ); +fdt_fixup_mtdparts (blob, nodes,ARRAY_SIZE (nodes)); + }/* Update display timings from display env var */ if (display) {
Signature · 1 line
1.9.1
cover imx: ventana: various cleanups
In reply to Tim HarveyHi Tim,
Quoted 10 lines · Tim Harvey
Here is another series of unrelated minor fixues and cleanups for Ventana
Tim Harvey (5):
imx: ventana: various board-specific GPIO config updates
imx: ventana: make model env var automatic and non-overridable
imx: ventana: makefdt_file1andfdt_file2automatic and
non-overridable
imx: ventana: hang if board model could not be determined
imx: ventana: skip mtdparts fixup if no flash
Quoted 6 lines
board/gateworks/gw_ventana/common.c | 56 ++++++++++++++++++++--------- board/gateworks/gw_ventana/common.h | 6 +--- board/gateworks/gw_ventana/gw_ventana.c | 41 +++++++++------------ board/gateworks/gw_ventana/gw_ventana_spl.c | 6 ++-- 4 files changed, 58 insertions(+), 51 deletions(-)
Whole series applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================