Add Gateworks System Controller driver
cover Add Gateworks System Controller driver
This series Adds a driver for the Gateworks System Controller (GSC) present on boards from Gateworks Corporation.
Patches 1-4 are gw_ventana cleanups to prepare for using the DM_I2C based driver.
Patch 5 is for the driver itself
Patch 6 moves gw_ventana over to using the GSC driver Patch 7 moves venice over to using the GSC driver
Tim
Tim Harvey (7):
board: gateworks: gw_ventana: convert to DM_I2C
board: gateworks: gw_ventana: move SPL uart config out of common
board: gateworks: gw_ventana: move GPIO config out of common
board: gateworks: gw_ventana: move ft_early_fixups out of common
drivers: misc: add Gateworks System Controller driver
board: gateworks: gw_ventana: use comomn GSC driver
board: gateworks: venice: use common GSC driver
MAINTAINERS | 6 +
arch/arm/dts/imx8mm-venice-u-boot.dtsi | 4 +
arch/arm/dts/imx8mm-venice.dts | 7 +
arch/arm/dts/imx8mn-venice-u-boot.dtsi | 4 +
arch/arm/dts/imx8mn-venice.dts | 7 +
arch/arm/mach-imx/imx8m/Kconfig | 4 +
arch/arm/mach-imx/mx6/Kconfig | 2 +
board/gateworks/gw_ventana/Kconfig | 8 -
board/gateworks/gw_ventana/Makefile | 2 +-
board/gateworks/gw_ventana/common.c | 527 +------------
board/gateworks/gw_ventana/common.h | 14 +-
board/gateworks/gw_ventana/eeprom.c | 224 +++++-
.../gw_ventana/{ventana_eeprom.h => eeprom.h} | 16 +-
board/gateworks/gw_ventana/gsc.c | 425 -----------
board/gateworks/gw_ventana/gsc.h | 71 --
board/gateworks/gw_ventana/gw_ventana.c | 290 ++++++--
board/gateworks/gw_ventana/gw_ventana_spl.c | 311 +++++++-
board/gateworks/venice/Makefile | 2 +-
board/gateworks/venice/eeprom.c | 353 +++++++++
board/gateworks/venice/{gsc.h => eeprom.h} | 26 +-
board/gateworks/venice/gsc.c | 700 ------------------
board/gateworks/venice/spl.c | 53 +-
board/gateworks/venice/venice.c | 27 +-
configs/gwventana_emmc_defconfig | 4 +-
configs/gwventana_gw5904_defconfig | 4 +-
configs/gwventana_nand_defconfig | 4 +-
configs/imx8mm_venice_defconfig | 1 +
configs/imx8mn_venice_defconfig | 3 +-
drivers/misc/Kconfig | 8 +
drivers/misc/Makefile | 1 +
drivers/misc/gsc.c | 633 ++++++++++++++++
include/configs/gw_ventana.h | 3 -
include/gsc.h | 21 +
scripts/config_whitelist.txt | 1 -
34 files changed, 1866 insertions(+), 1900 deletions(-)
rename board/gateworks/gw_ventana/{ventana_eeprom.h => eeprom.h} (82%)
delete mode 100644 board/gateworks/gw_ventana/gsc.c
delete mode 100644 board/gateworks/gw_ventana/gsc.h
create mode 100644 board/gateworks/venice/eeprom.c
rename board/gateworks/venice/{gsc.h => eeprom.h} (55%)
delete mode 100644 board/gateworks/venice/gsc.c
create mode 100644 drivers/misc/gsc.c
create mode 100644 include/gsc.hSignature · 1 line
2.17.1
PATCH 1/7 board: gateworks: gw_ventana: convert to DM_I2C
convert to DM_I2C for U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- add DM_I2C support to eeprom/gsc functions shared by SPL and U-Boot
--- board/gateworks/gw_ventana/common.c | 266 -------------------- board/gateworks/gw_ventana/common.h | 4 - board/gateworks/gw_ventana/eeprom.c | 9 + board/gateworks/gw_ventana/gsc.c | 60 ++++- board/gateworks/gw_ventana/gsc.h | 1 + board/gateworks/gw_ventana/gw_ventana.c | 17 +- board/gateworks/gw_ventana/gw_ventana_spl.c | 266 ++++++++++++++++++++ configs/gwventana_emmc_defconfig | 2 +- configs/gwventana_gw5904_defconfig | 2 +- configs/gwventana_nand_defconfig | 2 +- 10 files changed, 334 insertions(+), 295 deletions(-)
board/gateworks/gw_ventana/common.c +0 -266
@@ -16,10 +16,6 @@#include <fsl_esdhc_imx.h> #include <hwconfig.h> #include <linux/delay.h> -#include <power/pmic.h> -#include <power/ltc3676_pmic.h> -#include <power/pfuze100_pmic.h> -#include <power/mp5416.h> #include "common.h"
@@ -83,98 +79,6 @@ static iomux_v3_cfg_t const usdhc3_pads[] = { IOMUX_PADS(PAD_SD3_DAT5__GPIO7_IO00 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), }; -/* -* I2C pad configs: -* I2C1: GSC -* I2C2: PMIC,PCIe Switch,Clock,Mezz -* I2C3: Multimedia/Expansion -*/ -static struct i2c_pads_info mx6q_i2c_pad_info[] = { - { - .scl = { - .i2c_mode =MX6Q_PAD_EIM_D21__I2C1_SCL |PC , - .gpio_mode =MX6Q_PAD_EIM_D21__GPIO3_IO21 |PC , - .gp =IMX_GPIO_NR (3 ,21 ) - }, - .sda = { - .i2c_mode =MX6Q_PAD_EIM_D28__I2C1_SDA |PC , - .gpio_mode =MX6Q_PAD_EIM_D28__GPIO3_IO28 |PC , - .gp =IMX_GPIO_NR (3 ,28 ) - } - }, { - .scl = { - .i2c_mode =MX6Q_PAD_KEY_COL3__I2C2_SCL |PC , - .gpio_mode =MX6Q_PAD_KEY_COL3__GPIO4_IO12 |PC , - .gp =IMX_GPIO_NR (4 ,12 ) - }, - .sda = { - .i2c_mode =MX6Q_PAD_KEY_ROW3__I2C2_SDA |PC , - .gpio_mode =MX6Q_PAD_KEY_ROW3__GPIO4_IO13 |PC , - .gp =IMX_GPIO_NR (4 ,13 ) - } - }, { - .scl = { - .i2c_mode =MX6Q_PAD_GPIO_3__I2C3_SCL |PC , - .gpio_mode =MX6Q_PAD_GPIO_3__GPIO1_IO03 |PC , - .gp =IMX_GPIO_NR (1 ,3 ) - }, - .sda = { - .i2c_mode =MX6Q_PAD_GPIO_6__I2C3_SDA |PC , - .gpio_mode =MX6Q_PAD_GPIO_6__GPIO1_IO06 |PC , - .gp =IMX_GPIO_NR (1 ,6 ) - } - } -}; - -static struct i2c_pads_info mx6dl_i2c_pad_info[] = { - { - .scl = { - .i2c_mode =MX6DL_PAD_EIM_D21__I2C1_SCL |PC , - .gpio_mode =MX6DL_PAD_EIM_D21__GPIO3_IO21 |PC , - .gp =IMX_GPIO_NR (3 ,21 ) - }, - .sda = { - .i2c_mode =MX6DL_PAD_EIM_D28__I2C1_SDA |PC , - .gpio_mode =MX6DL_PAD_EIM_D28__GPIO3_IO28 |PC , - .gp =IMX_GPIO_NR (3 ,28 ) - } - }, { - .scl = { - .i2c_mode =MX6DL_PAD_KEY_COL3__I2C2_SCL |PC , - .gpio_mode =MX6DL_PAD_KEY_COL3__GPIO4_IO12 |PC , - .gp =IMX_GPIO_NR (4 ,12 ) - }, - .sda = { - .i2c_mode =MX6DL_PAD_KEY_ROW3__I2C2_SDA |PC , - .gpio_mode =MX6DL_PAD_KEY_ROW3__GPIO4_IO13 |PC , - .gp =IMX_GPIO_NR (4 ,13 ) - } - }, { - .scl = { - .i2c_mode =MX6DL_PAD_GPIO_3__I2C3_SCL |PC , - .gpio_mode =MX6DL_PAD_GPIO_3__GPIO1_IO03 |PC , - .gp =IMX_GPIO_NR (1 ,3 ) - }, - .sda = { - .i2c_mode =MX6DL_PAD_GPIO_6__I2C3_SDA |PC , - .gpio_mode =MX6DL_PAD_GPIO_6__GPIO1_IO06 |PC , - .gp =IMX_GPIO_NR (1 ,6 ) - } - } -}; - -void setup_ventana_i2c (int i2c) -{ -struct i2c_pads_info *p; - -if (is_cpu_type (MXC_CPU_MX6Q )) - p = &mx6q_i2c_pad_info[i2c]; -else - p = &mx6dl_i2c_pad_info[i2c]; - -setup_i2c (i2c,CONFIG_SYS_I2C_SPEED ,0x7f , p); -} -/* * Baseboard specific GPIO */
@@ -1402,176 +1306,6 @@ void setup_board_gpio(int board, struct ventana_board_info *info) } } -/* setup board specific PMIC */ -void setup_pmic (void ) -{ -struct pmic *p; -struct ventana_board_info ventana_info; -int board =read_eeprom (CONFIG_I2C_GSC , &ventana_info); -const int i2c_pmic =1 ; -u32 reg; -char rev; -int i; - -/* determine board revision */ - rev ='A' ; -for (i =sizeof (ventana_info.model) -1 ; i >0 ; i--) { -if (ventana_info.model[i] >='A' ) { - rev = ventana_info.model[i]; -break ; - } - } - -i2c_set_bus_num (i2c_pmic); - -/* configure PFUZE100 PMIC */ -if (!i2c_probe (CONFIG_POWER_PFUZE100_I2C_ADDR )) { -debug ("probed PFUZE100@0x%x\n" ,CONFIG_POWER_PFUZE100_I2C_ADDR ); -power_pfuze100_init (i2c_pmic); - p =pmic_get ("PFUZE100" ); -if (p && !pmic_probe (p)) { -pmic_reg_read (p,PFUZE100_DEVICEID , ®); -printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); - -/* Set VGEN1 to 1.5V and enable */ -pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); - reg &= ~(LDO_VOL_MASK ); - reg |= (LDOA_1_50V |LDO_EN ); -pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); - -/* Set SWBST to 5.0V and enable */ -pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); - reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); - reg |= (SWBST_5_00V | (SWBST_MODE_AUTO <<SWBST_MODE_SHIFT )); -pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); - -if (board == GW54xx && (rev =='G' )) { -/* Disable VGEN5 */ -pmic_reg_write (p,PFUZE100_VGEN5VOL ,0 ); - -/* Set VGEN6 to 2.5V and enable */ -pmic_reg_read (p,PFUZE100_VGEN6VOL , ®); - reg &= ~(LDO_VOL_MASK ); - reg |= (LDOB_2_50V |LDO_EN ); -pmic_reg_write (p,PFUZE100_VGEN6VOL , reg); - } - } - -/* put all switchers in continuous mode */ -pmic_reg_read (p,PFUZE100_SW1ABMODE , ®); - reg &= ~(SW_MODE_MASK ); - reg |=PWM_PWM ; -pmic_reg_write (p,PFUZE100_SW1ABMODE , reg); - -pmic_reg_read (p,PFUZE100_SW2MODE , ®); - reg &= ~(SW_MODE_MASK ); - reg |=PWM_PWM ; -pmic_reg_write (p,PFUZE100_SW2MODE , reg); - -pmic_reg_read (p,PFUZE100_SW3AMODE , ®); - reg &= ~(SW_MODE_MASK ); - reg |=PWM_PWM ; -pmic_reg_write (p,PFUZE100_SW3AMODE , reg); - -pmic_reg_read (p,PFUZE100_SW3BMODE , ®); - reg &= ~(SW_MODE_MASK ); - reg |=PWM_PWM ; -pmic_reg_write (p,PFUZE100_SW3BMODE , reg); - -pmic_reg_read (p,PFUZE100_SW4MODE , ®); - reg &= ~(SW_MODE_MASK ); - reg |=PWM_PWM ; -pmic_reg_write (p,PFUZE100_SW4MODE , reg); - } - -/* configure LTC3676 PMIC */ -else if (!i2c_probe (CONFIG_POWER_LTC3676_I2C_ADDR )) { -debug ("probed LTC3676@0x%x\n" ,CONFIG_POWER_LTC3676_I2C_ADDR ); -power_ltc3676_init (i2c_pmic); - p =pmic_get ("LTC3676_PMIC" ); -if (!p ||pmic_probe (p)) -return ; -puts ("PMIC: LTC3676\n" ); -/* -* set board-specific scalar for max CPU frequency -* per CPU based on the LDO enabled Operating Ranges -* defined in the respective IMX6DQ and IMX6SDL -* datasheets. The voltage resulting from the R1/R2 -* feedback inputs on Ventana is 1308mV. Note that this -* is a bit shy of the Vmin of 1350mV in the datasheet -* for LDO enabled mode but is as high as we can go. -*/ -switch (board) { -case GW560x: -/* mask PGOOD during SW3 transition */ -pmic_reg_write (p,LTC3676_DVB3B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW3 (VDD_ARM) */ -pmic_reg_write (p,LTC3676_DVB3A ,0x1f ); -break ; -case GW5903 : -/* mask PGOOD during SW3 transition */ -pmic_reg_write (p,LTC3676_DVB3B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW3 (VDD_ARM) */ -pmic_reg_write (p,LTC3676_DVB3A ,0x1f ); - -/* mask PGOOD during SW4 transition */ -pmic_reg_write (p,LTC3676_DVB4B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW4 (VDD_SOC) */ -pmic_reg_write (p,LTC3676_DVB4A ,0x1f ); -break ; -case GW5905 : -/* mask PGOOD during SW1 transition */ -pmic_reg_write (p,LTC3676_DVB1B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW1 (VDD_ARM) */ -pmic_reg_write (p,LTC3676_DVB1A ,0x1f ); - -/* mask PGOOD during SW3 transition */ -pmic_reg_write (p,LTC3676_DVB3B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW3 (VDD_SOC) */ -pmic_reg_write (p,LTC3676_DVB3A ,0x1f ); -break ; -default : -/* mask PGOOD during SW1 transition */ -pmic_reg_write (p,LTC3676_DVB1B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW1 (VDD_SOC) */ -pmic_reg_write (p,LTC3676_DVB1A ,0x1f ); - -/* mask PGOOD during SW3 transition */ -pmic_reg_write (p,LTC3676_DVB3B , -0x1f |LTC3676_PGOOD_MASK ); -/* set SW3 (VDD_ARM) */ -pmic_reg_write (p,LTC3676_DVB3A ,0x1f ); - } - -/* put all switchers in continuous mode */ -pmic_reg_write (p,LTC3676_BUCK1 ,0xc0 ); -pmic_reg_write (p,LTC3676_BUCK2 ,0xc0 ); -pmic_reg_write (p,LTC3676_BUCK3 ,0xc0 ); -pmic_reg_write (p,LTC3676_BUCK4 ,0xc0 ); - } - -/* configure MP5416 PMIC */ -else if (!i2c_probe (0x69 )) { -puts ("PMIC: MP5416\n" ); -switch (board) { -case GW5910 : -/* SW1: VDD_ARM 1.2V -> (1.275 to 1.475) */ - reg =MP5416_VSET_EN |MP5416_VSET_SW1_SVAL (1475000 ); -i2c_write (0x69 ,MP5416_VSET_SW1 ,1 , (uint8_t *)®,1 ); -/* SW4: VDD_SOC 1.2V -> (1.350 to 1.475) */ - reg =MP5416_VSET_EN |MP5416_VSET_SW4_SVAL (1475000 ); -i2c_write (0x69 ,MP5416_VSET_SW4 ,1 , (uint8_t *)®,1 ); -break ; - } - } -} -#include <fdt_support.h> #define WDOG1_ADDR 0x20bc000#define WDOG2_ADDR 0x20c0000
board/gateworks/gw_ventana/common.h +0 -4
@@ -79,12 +79,8 @@ struct ventana {extern struct ventana gpio_cfg[GW_UNKNOWN ]; -/* configure i2c iomux */ -void setup_ventana_i2c (int );/* configure uart iomux */ void setup_iomux_uart (void ); -/* conifgure PMIC */ -void setup_pmic (void );/* configure gpio iomux/defaults */ void setup_iomux_gpio (int board,struct ventana_board_info *);/* late setup of GPIO (configuration per baseboard and env) */
board/gateworks/gw_ventana/eeprom.c +9 -0
@@ -13,6 +13,7 @@#include <malloc.h> #include <asm/bitops.h> #include <linux/delay.h> +#include <dm/uclass.h> #include "gsc.h" #include "ventana_eeprom.h"
@@ -34,12 +35,20 @@ read_eeprom(int bus, struct ventana_board_info *info)* board may be ready to probe the GSC before its firmware is * running. We will wait here indefinately for the GSC/EEPROM. */ +#if CONFIG_IS_ENABLED (DM_I2C ) +while (1 ) { +if (i2c_get_dev (bus,GSC_EEPROM_ADDR )) +break ; +mdelay (1 ); + } +#else while (1 ) {if (0 ==i2c_set_bus_num (bus) &&0 ==i2c_probe (GSC_EEPROM_ADDR ))break ;mdelay (1 ); } +#endif /* read eeprom config section */ mdelay (10 );
board/gateworks/gw_ventana/gsc.c +53 -7
132 lines not on this page · raw message
board/gateworks/gw_ventana/gsc.h +1 -0
@@ -68,4 +68,5 @@ int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len);int gsc_info (int verbose);int gsc_boot_wd_disable (void );const char *gsc_get_dtb_name (int level,char *buf,int sz); +struct udevice *i2c_get_dev (int busno,int slave);#endif
board/gateworks/gw_ventana/gw_ventana.c +2 -15
@@ -138,8 +138,7 @@ static int detect_lvds(struct display_info_t const *dev)return 0 ; } -return i2c_set_bus_num (dev->bus) ==0 && -i2c_probe (dev->addr) ==0 ; +return (i2c_get_dev (dev->bus, dev->addr) ?1 :0 ); }static void enable_lvds (struct display_info_t const *dev)
@@ -355,13 +354,6 @@ static void setup_display(void) }#endif /* CONFIG_VIDEO_IPUV3 */ -/* setup board specific PMIC */ -int power_init_board (void ) -{ -setup_pmic (); -return 0 ; -} -/* * Most Ventana boards have a PLX PEX860x PCIe switch onboard and use its * GPIO's as PERST# signals for its downstream ports - configure the GPIO's
@@ -490,12 +482,8 @@ int board_init(void) gd->bd->bi_boot_params =PHYS_SDRAM +0x100 ;/* read Gateworks EEPROM into global struct (used later) */ -setup_ventana_i2c (0 ); board_type =read_eeprom (CONFIG_I2C_GSC , &ventana_info); -setup_ventana_i2c (1 ); -setup_ventana_i2c (2 ); -setup_iomux_gpio (board_type, &ventana_info);return 0 ;
@@ -925,8 +913,7 @@ void ft_board_pci_fixup(void *blob, struct bd_info *bd)*/ if ((dev->vendor ==PCI_VENDOR_ID_TI ) && (dev->device ==0x8240 ) && - (i2c_set_bus_num (1 ) ==0 ) && - (i2c_probe (0x50 ) ==0 )) +i2c_get_dev (1 ,0x50 )) { np =fdt_add_pci_path (blob, dev);if (np >0 )
board/gateworks/gw_ventana/gw_ventana_spl.c +266 -0
278 lines not on this page · raw message
configs/gwventana_emmc_defconfig +1 -1
@@ -92,7 +92,7 @@ CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y CONFIG_DWC_AHSATA=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MXC=y CONFIG_LED=y
configs/gwventana_gw5904_defconfig +1 -1
@@ -92,7 +92,7 @@ CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y CONFIG_DWC_AHSATA=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MXC=y CONFIG_LED=y
configs/gwventana_nand_defconfig +1 -1
@@ -94,7 +94,7 @@ CONFIG_NETCONSOLE=y CONFIG_DM=y CONFIG_BOUNCE_BUFFER=y CONFIG_DWC_AHSATA=y -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MXC=y CONFIG_LED=y
Signature · 1 line
2.17.1
PATCH 1/7 board: gateworks: gw_ventana: convert to DM_I2C
Quoted 5 lines
convert to
DM_I2Cfor U-Boot while leaving SPL legacy I2C:
- Move I2C config from common to SPL
- Move PMIC config from common to SPL (no need to re-configure pmic)
- addDM_I2Csupport to eeprom/gsc functions shared by SPL and U-BootSigned-off-by Tim Harvey <[email protected]>
Applied to u-boot-imx, master, 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: [email protected] =====================================================================
PATCH 2/7 board: gateworks: gw_ventana: move SPL uart config out of common
In reply to Tim HarveySince DM_SERIAL is used for U-Boot we no longer need legacy UART code in common.c shared by the SPL and U-Boot. Move the legacy UART config to the non-DM SPL.
--- board/gateworks/gw_ventana/common.c | 11 ----------- board/gateworks/gw_ventana/common.h | 2 -- board/gateworks/gw_ventana/gw_ventana_spl.c | 11 +++++++++++ 3 files changed, 11 insertions(+), 13 deletions(-)
board/gateworks/gw_ventana/common.c +0 -11
@@ -19,17 +19,6 @@#include "common.h" -/* UART2: Serial Console */ -static iomux_v3_cfg_t const uart2_pads[] = { -IOMUX_PADS (PAD_SD4_DAT7__UART2_TX_DATA |MUX_PAD_CTRL (UART_PAD_CTRL )), -IOMUX_PADS (PAD_SD4_DAT4__UART2_RX_DATA |MUX_PAD_CTRL (UART_PAD_CTRL )), -}; - -void setup_iomux_uart (void ) -{ -SETUP_IOMUX_PADS (uart2_pads); -} -/* MMC */ static iomux_v3_cfg_t const gw5904_emmc_pads[] = {IOMUX_PADS (PAD_SD3_DAT0__SD3_DATA0 |MUX_PAD_CTRL (USDHC_PAD_CTRL )),
board/gateworks/gw_ventana/common.h +0 -2
@@ -79,8 +79,6 @@ struct ventana {extern struct ventana gpio_cfg[GW_UNKNOWN ]; -/* configure uart iomux */ -void setup_iomux_uart (void );/* configure gpio iomux/defaults */ void setup_iomux_gpio (int board,struct ventana_board_info *);/* late setup of GPIO (configuration per baseboard and env) */
board/gateworks/gw_ventana/gw_ventana_spl.c +11 -0
@@ -671,6 +671,17 @@ static void ccgr_init(void)writel (0x000003FF , &ccm->CCGR6); } +/* UART2: Serial Console */ +static const iomux_v3_cfg_t uart2_pads[] = { +IOMUX_PADS (PAD_SD4_DAT7__UART2_TX_DATA |MUX_PAD_CTRL (UART_PAD_CTRL )), +IOMUX_PADS (PAD_SD4_DAT4__UART2_RX_DATA |MUX_PAD_CTRL (UART_PAD_CTRL )), +}; + +void setup_iomux_uart (void ) +{ +SETUP_IOMUX_PADS (uart2_pads); +} +/* * I2C pad configs: * I2C1: GSC
Signature · 1 line
2.17.1
PATCH 3/7 board: gateworks: gw_ventana: move GPIO config out of common
In reply to Tim HarveyMove gpio configuration out of common and into u-boot code as it is not used by the SPL.
--- board/gateworks/gw_ventana/common.c | 86 ------------------------- board/gateworks/gw_ventana/common.h | 2 - board/gateworks/gw_ventana/gw_ventana.c | 85 ++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 88 deletions(-)
board/gateworks/gw_ventana/common.c +0 -86
@@ -1209,92 +1209,6 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info) } } -/* setup GPIO pinmux and default configuration per baseboard and env */ -void setup_board_gpio (int board,struct ventana_board_info *info) -{ -const char *s; -char arg[10 ]; -size_t len; -int i; -int quiet =simple_strtol (env_get ("quiet" ),NULL ,10 ); - -if (board >=GW_UNKNOWN ) -return ; - -/* RS232_EN# */ -if (gpio_cfg[board].rs232_en) { -gpio_direction_output (gpio_cfg[board].rs232_en, - (hwconfig ("rs232" )) ?0 :1 ); - } - -/* MSATA Enable */ -if (gpio_cfg[board].msata_en &&is_cpu_type (MXC_CPU_MX6Q )) { -gpio_direction_output (GP_MSATA_SEL , - (hwconfig ("msata" )) ?1 :0 ); - } - -/* USBOTG Select (PCISKT or FrontPanel) */ -if (gpio_cfg[board].usb_sel) { -gpio_direction_output (gpio_cfg[board].usb_sel, - (hwconfig ("usb_pcisel" )) ?1 :0 ); - } - -/* -* Configure DIO pinmux/padctl registers -* see IMX6DQRM/IMX6SDLRM IOMUXC_SW_PAD_CTL_PAD_* register definitions -*/ -for (i =0 ; i < gpio_cfg[board].dio_num; 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 ; - -if (!cfg->gpio_padmux[0 ] && !cfg->gpio_padmux[1 ]) -continue ; -sprintf (arg,"dio%d" , i); -if (!hwconfig (arg)) -continue ; - s =hwconfig_subarg (arg,"padctrl" , &len); -if (s) { - ctrl =MUX_PAD_CTRL (hextoul (s,NULL ) - &0x1ffff ) |MUX_MODE_SION ; - } -if (hwconfig_subarg_cmp (arg,"mode" ,"gpio" )) { -if (!quiet) { -printf ("DIO%d: GPIO%d_IO%02d (gpio-%d)\n" , i, - (cfg->gpio_param/32 )+1 , - cfg->gpio_param%32 , - cfg->gpio_param); - } -imx_iomux_v3_setup_pad (cfg->gpio_padmux[cputype] | - ctrl); -gpio_requestf (cfg->gpio_param,"dio%d" , i); -gpio_direction_input (cfg->gpio_param); - }else if (hwconfig_subarg_cmp (arg,"mode" ,"pwm" ) && - cfg->pwm_padmux) { -if (!cfg->pwm_param) { -printf ("DIO%d: Error: pwm config invalid\n" , - i); -continue ; - } -if (!quiet) -printf ("DIO%d: pwm%d\n" , i, cfg->pwm_param); -imx_iomux_v3_setup_pad (cfg->pwm_padmux[cputype] | -MUX_PAD_CTRL (ctrl)); - } - } - -if (!quiet) { -if (gpio_cfg[board].msata_en &&is_cpu_type (MXC_CPU_MX6Q )) { -printf ("MSATA: %s\n" , (hwconfig ("msata" ) ? -"enabled" :"disabled" )); - } -if (gpio_cfg[board].rs232_en) { -printf ("RS232: %s\n" , (hwconfig ("rs232" )) ? -"enabled" :"disabled" ); - } - } -} -#include <fdt_support.h> #define WDOG1_ADDR 0x20bc000#define WDOG2_ADDR 0x20c0000
board/gateworks/gw_ventana/common.h +0 -2
@@ -81,8 +81,6 @@ extern struct ventana gpio_cfg[GW_UNKNOWN];/* configure gpio iomux/defaults */ void setup_iomux_gpio (int board,struct ventana_board_info *); -/* late setup of GPIO (configuration per baseboard and env) */ -void setup_board_gpio (int board,struct ventana_board_info *);/* early model/revision ft fixups */ void ft_early_fixup (void *fdt,int board_type);
board/gateworks/gw_ventana/gw_ventana.c +85 -0
91 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 4/7 board: gateworks: gw_ventana: move ft_early_fixups out of common
In reply to Tim HarveyDM is not used for the SPL and a generic DT is used in the SPL which requires no fixups. Remove the call in the SPL and move the function into the U-Boot code.
--- board/gateworks/gw_ventana/common.c | 148 -------------------- board/gateworks/gw_ventana/common.h | 2 - board/gateworks/gw_ventana/gw_ventana.c | 146 +++++++++++++++++++ board/gateworks/gw_ventana/gw_ventana_spl.c | 5 - 4 files changed, 146 insertions(+), 155 deletions(-)
board/gateworks/gw_ventana/common.c +0 -148
@@ -1209,154 +1209,6 @@ void setup_iomux_gpio(int board, struct ventana_board_info *info) } } -#include <fdt_support.h> -#define WDOG1_ADDR 0x20bc000 -#define WDOG2_ADDR 0x20c0000 -#define GPIO3_ADDR 0x20a4000 -#define USDHC3_ADDR 0x2198000 - -static void ft_board_wdog_fixup (void *blob,phys_addr_t addr) -{ -int off =fdt_node_offset_by_compat_reg (blob,"fsl,imx6q-wdt" , addr); - -if (off) { -fdt_delprop (blob, off,"ext-reset-output" ); -fdt_delprop (blob, off,"fsl,ext-reset-output" ); - } -} - -void ft_early_fixup (void *blob,int board_type) -{ -struct ventana_board_info *info = &ventana_info; -char rev =0 ; -int i; - -/* determine board revision */ -for (i =sizeof (ventana_info.model) -1 ; i >0 ; i--) { -if (ventana_info.model[i] >='A' ) { - rev = ventana_info.model[i]; -break ; - } - } - -/* -* Board model specific fixups -*/ -switch (board_type) { -case GW51xx: -/* -* disable wdog node for GW51xx-A/B to work around -* errata causing wdog timer to be unreliable. -*/ -if (rev >='A' && rev <'C' ) { - i =fdt_node_offset_by_compat_reg (blob,"fsl,imx6q-wdt" , -WDOG1_ADDR ); -if (i) -fdt_status_disabled (blob, i); - } - -/* GW51xx-E adds WDOG1_B external reset */ -if (rev <'E' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); -break ; - -case GW52xx: -/* GW522x Uses GPIO3_IO23 instead of GPIO1_IO29 */ -if (info->model[4 ] =='2' ) { -u32 handle =0 ; -u32 *range =NULL ; - - i =fdt_node_offset_by_compatible (blob,-1 , -"fsl,imx6q-pcie" ); -if (i) - range = (u32 *)fdt_getprop (blob, i, -"reset-gpio" ,NULL ); - -if (range) { - i =fdt_node_offset_by_compat_reg (blob, -"fsl,imx6q-gpio" ,GPIO3_ADDR ); -if (i) - handle =fdt_get_phandle (blob, i); -if (handle) { - range[0 ] =cpu_to_fdt32 (handle); - range[1 ] =cpu_to_fdt32 (23 ); - } - } - -/* these have broken usd_vsel */ -if (strstr ((const char *)info->model,"SP318-B" ) || -strstr ((const char *)info->model,"SP331-B" )) - gpio_cfg[board_type].usd_vsel =0 ; - -/* GW522x-B adds WDOG1_B external reset */ -if (rev <'B' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); - } - -/* GW520x-E adds WDOG1_B external reset */ -else if (info->model[4 ] =='0' && rev <'E' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); -break ; - -case GW53xx: -/* GW53xx-E adds WDOG1_B external reset */ -if (rev <'E' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); - -/* GW53xx-G has an adv7280 instead of an adv7180 */ -else if (rev >'F' ) { - i =fdt_node_offset_by_compatible (blob,-1 ,"adi,adv7180" ); -if (i) { -fdt_setprop_string (blob, i,"compatible" ,"adi,adv7280" ); -fdt_setprop_empty (blob, i,"adv,force-bt656-4" ); - } - } -break ; - -case GW54xx: -/* -* disable serial2 node for GW54xx for compatibility with older -* 3.10.x kernel that improperly had this node enabled in the DT -*/ -fdt_set_status_by_alias (blob,"serial2" ,FDT_STATUS_DISABLED ); - -/* GW54xx-E adds WDOG2_B external reset */ -if (rev <'E' ) -ft_board_wdog_fixup (blob,WDOG2_ADDR ); - -/* GW54xx-G has an adv7280 instead of an adv7180 */ -else if (rev >'F' ) { - i =fdt_node_offset_by_compatible (blob,-1 ,"adi,adv7180" ); -if (i) { -fdt_setprop_string (blob, i,"compatible" ,"adi,adv7280" ); -fdt_setprop_empty (blob, i,"adv,force-bt656-4" ); - } - } -break ; - -case GW551x: -/* GW551x-C adds WDOG1_B external reset */ -if (rev <'C' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); -break ; -case GW5901 : -case GW5902 : -/* GW5901/GW5901 revB adds WDOG1_B as an external reset */ -if (rev <'B' ) -ft_board_wdog_fixup (blob,WDOG1_ADDR ); -break ; - } - -/* remove no-1-8-v if UHS-I support is present */ -if (gpio_cfg[board_type].usd_vsel) { -debug ("Enabling UHS-I support\n" ); - i =fdt_node_offset_by_compat_reg (blob,"fsl,imx6q-usdhc" , -USDHC3_ADDR ); -if (i) -fdt_delprop (blob, i,"no-1-8-v" ); - } -} -#ifdef CONFIG_FSL_ESDHC_IMX static struct fsl_esdhc_cfg usdhc_cfg[2 ];
board/gateworks/gw_ventana/common.h +0 -2
@@ -81,7 +81,5 @@ extern struct ventana gpio_cfg[GW_UNKNOWN];/* configure gpio iomux/defaults */ void setup_iomux_gpio (int board,struct ventana_board_info *); -/* early model/revision ft fixups */ -void ft_early_fixup (void *fdt,int board_type);#endif /* #ifndef _GWVENTANA_COMMON_H_ */
board/gateworks/gw_ventana/gw_ventana.c +146 -0
152 lines not on this page · raw message
board/gateworks/gw_ventana/gw_ventana_spl.c +0 -5
@@ -1062,8 +1062,3 @@ int spl_start_uboot(void) return ret; }#endif - -void spl_perform_fixups (struct spl_image_info *spl_image) -{ -ft_early_fixup (spl_image->fdt_addr, board_type); -}
Signature · 1 line
2.17.1
PATCH 5/7 drivers: misc: add Gateworks System Controller driver
In reply to Tim HarveyAdd a driver for the Gateworks System Controller used on Gateworks boards which provides a boot watchdog, power control, temperature monitor, and voltage ADCs.
--- MAINTAINERS | 6 + drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/gsc.c | 633 ++++++++++++++++++++++++++++++++++++++++++ include/gsc.h | 21 ++ 5 files changed, 669 insertions(+) create mode 100644 drivers/misc/gsc.c create mode 100644 include/gsc.h
MAINTAINERS +6 -0
@@ -853,6 +853,12 @@ T: git https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq.git F: drivers/watchdog/sp805_wdt.c F: drivers/watchdog/sbsa_gwdt.c +GATEWORKS_SC +M: Tim Harvey <[email protected]> +S: Maintained +F: drivers/misc/gsc.c +F: include/gsc.h + I2C M: Heiko Schocher <[email protected]> S: Maintained
drivers/misc/Kconfig +8 -0
@@ -46,6 +46,14 @@ config ATSHA204A CryptoAuthentication module found for example on the Turris Omnia board. +config GATEWORKS_SC + bool "Gateworks System Controller Support" + depends on MISC + help + Enable access for the Gateworks System Controller used on Gateworks + boards to provide a boot watchdog, power control, temperature monitor, + voltage ADCs, and EEPROM. + config ROCKCHIP_EFUSE bool "Rockchip e-fuse support" depends on MISC
drivers/misc/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_FSL_IIM) += fsl_iim.o obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o obj-$(CONFIG_FSL_SEC_MON) += fsl_sec_mon.o obj-$(CONFIG_$(SPL_)FS_LOADER) += fs_loader.o +obj-$(CONFIG_GATEWORKS_SC) += gsc.o obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
drivers/misc/gsc.c new file +633 -0
633 lines not on this page · raw message
include/gsc.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2022 Gateworks Corporation +*/ + +#ifndef _GSC_H_ +#define _GSC_H_ + +/* +* board_gsc_info - Display additional board info +*/ +void board_gsc_info (void ); + +/* +* gsc_boot_wd_disable - disable the BOOT watchdog +* +* Return: 0 on success or negative error on failure +*/ +int gsc_boot_wd_disable (void ); + +#endif
Signature · 1 line
2.17.1
PATCH 5/7 drivers: misc: add Gateworks System Controller driver
Quoted 4 lines
Add a driver for the Gateworks System Controller used on Gateworks boards which provides a boot watchdog, power control, temperature monitor, and voltage ADCs.
Signed-off-by Tim Harvey <[email protected]>
Applied to u-boot-imx, master, 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: [email protected] =====================================================================
PATCH 6/7 board: gateworks: gw_ventana: use comomn GSC driver
In reply to Tim HarveyUse the common GSC driver.
This allows us to do some additional cleanup:
- use the GSC driver functions
- move waiting for the EEPROM to the SPL int (it will always be ready after this)
- move eeprom functions into eeprom file and elimate GSC_I2C_BUS
- eliminate some redundant EEPROM reads (the EEPROM must be read in SPL before relocation, in SPL after relocation, and in U-Boot init. All subsequent uses can use the global structure)
- remove unnecessary header files and alphabatize includes
---
arch/arm/mach-imx/mx6/Kconfig | 2 +
board/gateworks/gw_ventana/Kconfig | 8 -
board/gateworks/gw_ventana/Makefile | 2 +-
board/gateworks/gw_ventana/common.c | 16 +-
board/gateworks/gw_ventana/common.h | 4 +-
board/gateworks/gw_ventana/eeprom.c | 233 +++++++--
.../gw_ventana/{ventana_eeprom.h => eeprom.h} | 16 +-
board/gateworks/gw_ventana/gsc.c | 471 ------------------
board/gateworks/gw_ventana/gsc.h | 72 ---
board/gateworks/gw_ventana/gw_ventana.c | 44 +-
board/gateworks/gw_ventana/gw_ventana_spl.c | 43 +-
configs/gwventana_emmc_defconfig | 2 +-
configs/gwventana_gw5904_defconfig | 2 +-
configs/gwventana_nand_defconfig | 2 +-
include/configs/gw_ventana.h | 3 -
scripts/config_whitelist.txt | 1 -
16 files changed, 266 insertions(+), 655 deletions(-)
rename board/gateworks/gw_ventana/{ventana_eeprom.h => eeprom.h} (82%)
delete mode 100644 board/gateworks/gw_ventana/gsc.c
delete mode 100644 board/gateworks/gw_ventana/gsc.harch/arm/mach-imx/mx6/Kconfig +2 -0
@@ -227,6 +227,8 @@ config TARGET_GW_VENTANA bool "gw_ventana" depends on MX6QDL select SUPPORT_SPL + select GATEWORKS_SC + select MISC imply CMD_SATA imply CMD_SPL
board/gateworks/gw_ventana/Kconfig +0 -8
@@ -17,12 +17,4 @@ config CMD_EECONFIG help Provides access to EEPROM configuration on Gateworks Ventana -config CMD_GSC - bool "Enable the 'gsc' command" - help - Provides access to the GSC configuration: - - gsc sleep - sleeps for a period of seconds - gsc wd - enables / disables the watchdog - endif
board/gateworks/gw_ventana/Makefile +1 -1
@@ -6,5 +6,5 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y := gw_ventana.o gsc.o eeprom.o common.o +obj-y := gw_ventana.o eeprom.o common.o obj-$(CONFIG_SPL_BUILD) += gw_ventana_spl.o
board/gateworks/gw_ventana/common.c +6 -10
@@ -6,15 +6,15 @@*/ #include <common.h> +#include <env.h> +#include <fsl_esdhc_imx.h> +#include <hwconfig.h> #include <log.h> #include <asm/arch/clock.h> #include <asm/arch/mx6-pins.h> #include <asm/arch/sys_proto.h> #include <asm/gpio.h> #include <asm/mach-imx/mxc_i2c.h> -#include <env.h> -#include <fsl_esdhc_imx.h> -#include <hwconfig.h> #include <linux/delay.h> #include "common.h"
@@ -1045,7 +1045,7 @@ struct ventana gpio_cfg[GW_UNKNOWN] = {#define SETUP_GPIO_INPUT (gpio, name) \ gpio_request(gpio, name); \ gpio_direction_input(gpio); -void setup_iomux_gpio (int board,struct ventana_board_info *info) +void setup_iomux_gpio (int board) {if (board >=GW_UNKNOWN )return ;
@@ -1214,8 +1214,6 @@ static struct fsl_esdhc_cfg usdhc_cfg[2];int board_mmc_init (struct bd_info *bis) { -struct ventana_board_info ventana_info; -int board_type =read_eeprom (CONFIG_I2C_GSC , &ventana_info);int ret;switch (board_type) {
@@ -1279,13 +1277,11 @@ int board_mmc_init(struct bd_info *bis)int board_mmc_getcd (struct mmc *mmc) { -struct ventana_board_info ventana_info;struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; -int board =read_eeprom (CONFIG_I2C_GSC , &ventana_info); -int gpio = gpio_cfg[board].mmc_cd; +int gpio = gpio_cfg[board_type].mmc_cd;/* Card Detect */ -switch (board) { +switch (board_type) {case GW560x:/* emmc is always present */ if (cfg->esdhc_base ==USDHC2_BASE_ADDR )
board/gateworks/gw_ventana/common.h +2 -2
@@ -8,7 +8,7 @@#ifndef _GWVENTANA_COMMON_H_#define _GWVENTANA_COMMON_H_ -#include "ventana_eeprom.h" +#include "eeprom.h" /* GPIO's common to all baseboards */ #define GP_RS232_EN IMX_GPIO_NR(2, 11)
@@ -80,6 +80,6 @@ struct ventana {extern struct ventana gpio_cfg[GW_UNKNOWN ];/* configure gpio iomux/defaults */ -void setup_iomux_gpio (int board,struct ventana_board_info *); +void setup_iomux_gpio (int board);#endif /* #ifndef _GWVENTANA_COMMON_H_ */
board/gateworks/gw_ventana/eeprom.c +200 -33
266 lines not on this page · raw message
board/gateworks/gw_ventana/eeprom.h renamed from board/gateworks/gw_ventana/ventana_eeprom.h +15 -1
@@ -6,6 +6,9 @@ #ifndef _VENTANA_EEPROM_ #define _VENTANA_EEPROM_ +#define BOARD_EEPROM_BUSNO 0 +#define BOARD_EEPROM_ADDR 0x51 + struct ventana_board_info { u8 mac0[6]; /* 0x00: MAC1 */ u8 mac1[6]; /* 0x06: MAC2 */
@@ -137,7 +140,18 @@ struct ventana_eeprom_config {extern struct ventana_eeprom_config econfig[];extern struct ventana_board_info ventana_info; +extern int board_type; + +int read_eeprom (struct ventana_board_info *info); -int read_eeprom (int bus,struct ventana_board_info *); +/* +* I2C transactions to the GSC are done via these functions which +* perform retries in the case of a busy GSC NAK'ing the transaction +*/ +int gsc_i2c_read (uchar chip,uint addr,int alen,uchar *buf,int len); +int gsc_i2c_write (uchar chip,uint addr,int alen,uchar *buf,int len); +const char *gsc_get_dtb_name (int level,char *buf,int sz); +struct udevice *i2c_get_dev (int busno,int slave); +const char *eeprom_get_model (void );#endif
board/gateworks/gw_ventana/gsc.c deleted +0 -471
471 lines not on this page · raw message
board/gateworks/gw_ventana/gsc.h deleted +0 -72
72 lines not on this page · raw message
board/gateworks/gw_ventana/gw_ventana.c +13 -31
84 lines not on this page · raw message
board/gateworks/gw_ventana/gw_ventana_spl.c +24 -19
104 lines not on this page · raw message
configs/gwventana_emmc_defconfig +1 -1
@@ -14,11 +14,11 @@ CONFIG_SYS_I2C_MXC_I2C1=y CONFIG_SYS_I2C_MXC_I2C2=y CONFIG_SYS_I2C_MXC_I2C3=y CONFIG_CMD_EECONFIG=y -CONFIG_CMD_GSC=y CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx" CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK_R_ADDR=0x18000000 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0xD1400
configs/gwventana_gw5904_defconfig +1 -1
@@ -14,11 +14,11 @@ CONFIG_SYS_I2C_MXC_I2C1=y CONFIG_SYS_I2C_MXC_I2C2=y CONFIG_SYS_I2C_MXC_I2C3=y CONFIG_CMD_EECONFIG=y -CONFIG_CMD_GSC=y CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx" CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK_R_ADDR=0x18000000 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0xD1400
configs/gwventana_nand_defconfig +1 -1
@@ -14,11 +14,11 @@ CONFIG_SYS_I2C_MXC_I2C1=y CONFIG_SYS_I2C_MXC_I2C2=y CONFIG_SYS_I2C_MXC_I2C3=y CONFIG_CMD_EECONFIG=y -CONFIG_CMD_GSC=y CONFIG_DEFAULT_DEVICE_TREE="imx6q-gw54xx" CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SPL_MMC=y CONFIG_SPL_SERIAL=y +CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK_R_ADDR=0x18000000 CONFIG_SPL=y CONFIG_ENV_OFFSET_REDUND=0x1080000
include/configs/gw_ventana.h +0 -3
@@ -31,9 +31,6 @@#undef CONFIG_SYS_BOOTM_LEN#define CONFIG_SYS_BOOTM_LEN (64 << 20) -/* I2C Configs */ -#define CONFIG_I2C_GSC 0 -/* MMC Configs */ #define CONFIG_SYS_FSL_ESDHC_ADDR 0
scripts/config_whitelist.txt +0 -1
@@ -429,7 +429,6 @@ CONFIG_HUSH_INIT_VAR CONFIG_HWCONFIG CONFIG_HW_ENV_SETTINGS CONFIG_I2C_ENV_EEPROM_BUS -CONFIG_I2C_GSC CONFIG_I2C_MULTI_BUS CONFIG_I2C_MVTWSI CONFIG_I2C_MVTWSI_BASE
Signature · 1 line
2.17.1
PATCH 7/7 board: gateworks: venice: use common GSC driver
In reply to Tim HarveyUse the common GSC driver.
This allows us to do some additional cleanup:
- rename gsc{.c,.h} to eeprom{.c.h} for clarity
- collapse eeprom_get_dev
- remove unnecessary header files and alphabatize includes
---
arch/arm/dts/imx8mm-venice-u-boot.dtsi | 4 +
arch/arm/dts/imx8mm-venice.dts | 7 +
arch/arm/dts/imx8mn-venice-u-boot.dtsi | 4 +
arch/arm/dts/imx8mn-venice.dts | 7 +
arch/arm/mach-imx/imx8m/Kconfig | 4 +
board/gateworks/venice/Makefile | 2 +-
board/gateworks/venice/eeprom.c | 353 +++++++++++
board/gateworks/venice/{gsc.h => eeprom.h} | 26 +-
board/gateworks/venice/gsc.c | 700 ---------------------
board/gateworks/venice/spl.c | 53 +-
board/gateworks/venice/venice.c | 27 +-
configs/imx8mm_venice_defconfig | 1 +
configs/imx8mn_venice_defconfig | 3 +-
13 files changed, 426 insertions(+), 765 deletions(-)
create mode 100644 board/gateworks/venice/eeprom.c
rename board/gateworks/venice/{gsc.h => eeprom.h} (55%)
delete mode 100644 board/gateworks/venice/gsc.carch/arm/dts/imx8mm-venice-u-boot.dtsi +4 -0
@@ -57,6 +57,10 @@ u-boot,dm-spl; }; +&gsc { + u-boot,dm-spl; +}; + &i2c2 { u-boot,dm-spl; };
arch/arm/dts/imx8mm-venice.dts +7 -0
@@ -27,6 +27,13 @@ pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; + gsc: gsc@20 { + compatible = "gw,gsc"; + reg = <0x20>; + #address-cells = <1>; + #size-cells = <0>; + }; + eeprom@51 { compatible = "atmel,24c02"; reg = <0x51>;
arch/arm/dts/imx8mn-venice-u-boot.dtsi +4 -0
@@ -94,6 +94,10 @@ u-boot,dm-spl; }; +&gsc { + u-boot,dm-spl; +}; + &i2c2 { u-boot,dm-spl; };
arch/arm/dts/imx8mn-venice.dts +7 -0
@@ -27,6 +27,13 @@ pinctrl-0 = <&pinctrl_i2c1>; status = "okay"; + gsc: gsc@20 { + compatible = "gw,gsc"; + reg = <0x20>; + #address-cells = <1>; + #size-cells = <0>; + }; + eeprom@51 { compatible = "atmel,24c02"; reg = <0x51>;
arch/arm/mach-imx/imx8m/Kconfig +4 -0
@@ -77,6 +77,8 @@ config TARGET_IMX8MM_VENICE select IMX8MM select SUPPORT_SPL select IMX8M_LPDDR4 + select GATEWORKS_SC + select MISC config TARGET_KONTRON_MX8MM bool "Kontron Electronics N80xx"
@@ -105,6 +107,8 @@ config TARGET_IMX8MN_VENICE select IMX8MN select SUPPORT_SPL select IMX8M_LPDDR4 + select GATEWORKS_SC + select MISC config TARGET_IMX8MP_EVK bool "imx8mp LPDDR4 EVK board"
board/gateworks/venice/Makefile +1 -1
@@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y += venice.o gsc.o +obj-y += venice.o eeprom.o ifdef CONFIG_SPL_BUILD obj-y += spl.o
board/gateworks/venice/eeprom.c new file +353 -0
353 lines not on this page · raw message
board/gateworks/venice/eeprom.h renamed from board/gateworks/venice/gsc.h +7 -19
@@ -3,19 +3,8 @@* Copyright 2021 Gateworks Corporation */ -#ifndef _GSC_H_ -#define _GSC_H_ - -/* I2C bus numbers */ -#define GSC_BUSNO 0 -#define BASEBOARD_EEPROM_BUSNO 1 - -/* I2C slave addresses */ -#define GSC_SC_ADDR 0x20 -#define GSC_RTC_ADDR 0x68 -#define GSC_HWMON_ADDR 0x29 -#define GSC_EEPROM_ADDR 0x51 -#define BASEBOARD_EEPROM_ADDR 0x52 +#ifndef _VENICE_EEPROM_H_ +#define _VENICE_EEPROM_H_ struct venice_board_info { u8 mac[6]; /* 0x00: MAC base */
@@ -35,11 +24,10 @@ struct venice_board_info { u8 chksum[2]; /* 0x4E */ }; -int gsc_init (int quiet); -int gsc_hwmon (void ); -const char *gsc_get_model (void ); -const char *gsc_get_dtb_name (int level,char *buf,int len); -int gsc_getmac (int index,uint8_t *enetaddr); -uint32_t gsc_get_serial (void ); +int eeprom_init (int quiet); +const char *eeprom_get_model (void ); +const char *eeprom_get_dtb_name (int level,char *buf,int len); +int eeprom_getmac (int index,uint8_t *enetaddr); +uint32_t eeprom_get_serial (void );#endif
board/gateworks/venice/gsc.c deleted +0 -700
700 lines not on this page · raw message
board/gateworks/venice/spl.c +29 -24
101 lines not on this page · raw message
board/gateworks/venice/venice.c +8 -19
@@ -3,21 +3,12 @@* Copyright 2021 Gateworks Corporation */ -#include <common.h> #include <init.h> #include <led.h> -#include <linux/delay.h> #include <miiphy.h> -#include <netdev.h> - -#include <asm/arch/clock.h> #include <asm/arch/sys_proto.h> -#include <asm/io.h> -#include <asm/unaligned.h> - -#include "gsc.h" -DECLARE_GLOBAL_DATA_PTR ; +#include "eeprom.h" int board_phys_sdram_size (phys_size_t *size) {
@@ -37,7 +28,7 @@ int board_fit_config_name_match(const char *name)char buf[32 ]; do { - dtb = gsc_get_dtb_name(i++, buf, sizeof(buf)); + dtb = eeprom_get_dtb_name(i++, buf, sizeof(buf)); if (!strcmp(dtb, name)) { if (!init++) printf("DTB : %s\n", name);
@@ -100,13 +91,11 @@ int board_phy_config(struct phy_device *phydev)int board_init (void ) { -gsc_init (1 ); +eeprom_init (1 );if (IS_ENABLED (CONFIG_FEC_MXC ))setup_fec (); -gsc_hwmon (); -return 0 ; }
@@ -122,13 +111,13 @@ int board_late_init(void)/* Set board serial/model */ if (!env_get ("serial#" )) -env_set_ulong ("serial#" ,gsc_get_serial ()); -env_set ("model" ,gsc_get_model ()); +env_set_ulong ("serial#" ,eeprom_get_serial ()); +env_set ("model" ,eeprom_get_model ());/* Set fdt_file vars */ i =0 ; do { - str = gsc_get_dtb_name(i, fdt, sizeof(fdt)); + str = eeprom_get_dtb_name(i, fdt, sizeof(fdt)); if (str) { sprintf(env, "fdt_file%d", i + 1); strcat(fdt, ".dtb");
@@ -146,7 +135,7 @@ int board_late_init(void)sprintf (env,"ethaddr" ); str =env_get (env);if (!str) { - ret =gsc_getmac (i, enetaddr); + ret =eeprom_getmac (i, enetaddr);if (!ret)eth_env_set_enetaddr (env, enetaddr); }
@@ -166,7 +155,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)int off;/* set board model dt prop */ -fdt_setprop_string (blob,0 ,"board" ,gsc_get_model ()); +fdt_setprop_string (blob,0 ,"board" ,eeprom_get_model ());/* update temp thresholds */ off =fdt_path_offset (blob,"/thermal-zones/cpu-thermal/trips" );
configs/imx8mm_venice_defconfig +1 -0
@@ -77,6 +77,7 @@ CONFIG_DM_I2C=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y +CONFIG_MISC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_SPL_MMC_IO_VOLTAGE=y
configs/imx8mn_venice_defconfig +1 -2
@@ -70,8 +70,6 @@ CONFIG_NET_RANDOM_ETHADDR=y CONFIG_IP_DEFRAG=y CONFIG_TFTP_BLOCKSIZE=4096 CONFIG_SPL_DM=y -CONFIG_SPL_CLK_COMPOSITE_CCF=y -CONFIG_CLK_COMPOSITE_CCF=y CONFIG_SPL_CLK_IMX8MN=y CONFIG_CLK_IMX8MN=y CONFIG_MXC_GPIO=y
@@ -79,6 +77,7 @@ CONFIG_DM_I2C=y CONFIG_LED=y CONFIG_LED_BLINK=y CONFIG_LED_GPIO=y +CONFIG_SPL_MISC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_SPL_MMC_IO_VOLTAGE=y
Signature · 1 line
2.17.1
Quoted 65 lines · Tim Harvey
This series Adds a driver for the Gateworks System Controller (GSC) present on boards from Gateworks Corporation.
Patches 1-4 are
gw_ventanacleanups to prepare for using theDM_I2Cbased driver.
Patch 5 is for the driver itself
Patch 6 movesgw_ventanaover to using the GSC driver Patch 7 moves venice over to using the GSC driverTim
Tim Harvey (7):
board: gateworks:gw_ventana: convert toDM_I2C
board: gateworks:gw_ventana: move SPL uart config out of common
board: gateworks:gw_ventana: move GPIO config out of common
board: gateworks:gw_ventana: moveft_early_fixupsout of common
drivers: misc: add Gateworks System Controller driver
board: gateworks:gw_ventana: use comomn GSC driver
board: gateworks: venice: use common GSC driverMAINTAINERS | 6 + arch/arm/dts/imx8mm-venice-u-boot.dtsi | 4 + arch/arm/dts/imx8mm-venice.dts | 7 + arch/arm/dts/imx8mn-venice-u-boot.dtsi | 4 + arch/arm/dts/imx8mn-venice.dts | 7 + arch/arm/mach-imx/imx8m/Kconfig | 4 + arch/arm/mach-imx/mx6/Kconfig | 2 + board/gateworks/gw_ventana/Kconfig | 8 - board/gateworks/gw_ventana/Makefile | 2 +- board/gateworks/gw_ventana/common.c | 527 +------------ board/gateworks/gw_ventana/common.h | 14 +- board/gateworks/gw_ventana/eeprom.c | 224 +++++- .../gw_ventana/{ventana_eeprom.h => eeprom.h} | 16 +- board/gateworks/gw_ventana/gsc.c | 425 ----------- board/gateworks/gw_ventana/gsc.h | 71 -- board/gateworks/gw_ventana/gw_ventana.c | 290 ++++++-- board/gateworks/gw_ventana/gw_ventana_spl.c | 311 +++++++- board/gateworks/venice/Makefile | 2 +- board/gateworks/venice/eeprom.c | 353 +++++++++ board/gateworks/venice/{gsc.h => eeprom.h} | 26 +- board/gateworks/venice/gsc.c | 700 ------------------ board/gateworks/venice/spl.c | 53 +- board/gateworks/venice/venice.c | 27 +- configs/gwventana_emmc_defconfig | 4 +- configs/gwventana_gw5904_defconfig | 4 +- configs/gwventana_nand_defconfig | 4 +- configs/imx8mm_venice_defconfig | 1 + configs/imx8mn_venice_defconfig | 3 +- drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/gsc.c | 633 ++++++++++++++++ include/configs/gw_ventana.h | 3 - include/gsc.h | 21 + scripts/config_whitelist.txt | 1 - 34 files changed, 1866 insertions(+), 1900 deletions(-) rename board/gateworks/gw_ventana/{ventana_eeprom.h => eeprom.h} (82%) delete mode 100644 board/gateworks/gw_ventana/gsc.c delete mode 100644 board/gateworks/gw_ventana/gsc.h create mode 100644 board/gateworks/venice/eeprom.c rename board/gateworks/venice/{gsc.h => eeprom.h} (55%) delete mode 100644 board/gateworks/venice/gsc.c create mode 100644 drivers/misc/gsc.c create mode 100644 include/gsc.h
Quoted 3 lines
--
2.17.1
Added [email protected] and Peng to list.
Would anyone have time to review this series [1]? I would like to get any issues resolved by the time the next merge window opens up.
Best Regards,
Tim
[1] https://patchwork.ozlabs.org/project/uboot/list/?series=289400