board: gateworks: gw_ventana: use comomn GSC driver
Subsystems (3)
PATCH v2 1/1 board: gateworks: gw_ventana: use comomn GSC driver
Use 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
---
v2: rebase on imx/master
---
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.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 -
15 files changed, 266 insertions(+), 184 deletions(-)
rename board/gateworks/gw_ventana/{ventana_eeprom.h => eeprom.h} (82%)
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.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
@@ -317,7 +317,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 v2 1/1 board: gateworks: gw_ventana: use comomn GSC driver
Quoted 11 lines
Use 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 elimateGSC_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 includesSigned-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] =====================================================================