diff options
Diffstat (limited to 'board/compulab')
-rw-r--r-- | board/compulab/cm_fx6/Kconfig | 3 | ||||
-rw-r--r-- | board/compulab/cm_fx6/cm_fx6.c | 22 | ||||
-rw-r--r-- | board/compulab/cm_t35/cm_t35.c | 2 | ||||
-rw-r--r-- | board/compulab/cm_t3517/mux.c | 12 | ||||
-rw-r--r-- | board/compulab/common/eeprom.c | 40 | ||||
-rw-r--r-- | board/compulab/common/eeprom.h | 10 |
6 files changed, 72 insertions, 17 deletions
diff --git a/board/compulab/cm_fx6/Kconfig b/board/compulab/cm_fx6/Kconfig index 508c21f..59070c5 100644 --- a/board/compulab/cm_fx6/Kconfig +++ b/board/compulab/cm_fx6/Kconfig @@ -6,9 +6,6 @@ config SYS_BOARD config SYS_VENDOR default "compulab" -config SYS_SOC - default "mx6" - config SYS_CONFIG_NAME default "cm_fx6" diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index e3db9d5..01871e1 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -561,9 +561,14 @@ int cm_fx6_setup_ecspi(void) { return 0; } #endif #ifdef CONFIG_OF_BOARD_SETUP +#define USDHC3_PATH "/soc/aips-bus@02100000/usdhc@02198000/" int ft_board_setup(void *blob, bd_t *bd) { + u32 baseboard_rev; + int nodeoffset; uint8_t enetaddr[6]; + char baseboard_name[16]; + int err; /* MAC addr */ if (eth_getenv_enetaddr("ethaddr", enetaddr)) { @@ -577,6 +582,21 @@ int ft_board_setup(void *blob, bd_t *bd) enetaddr, 6, 1); } + baseboard_rev = cl_eeprom_get_board_rev(0); + err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0); + if (err || baseboard_rev == 0) + return 0; /* Assume not an early revision SB-FX6m baseboard */ + + if (!strncmp("SB-FX6m", baseboard_name, 7) && baseboard_rev <= 120) { + fdt_shrink_to_minimum(blob); /* Make room for new properties */ + nodeoffset = fdt_path_offset(blob, USDHC3_PATH); + fdt_delprop(blob, nodeoffset, "cd-gpios"); + fdt_find_and_setprop(blob, USDHC3_PATH, "non-removable", + NULL, 0, 1); + fdt_find_and_setprop(blob, USDHC3_PATH, "keep-power-in-suspend", + NULL, 0, 1); + } + return 0; } #endif @@ -689,7 +709,7 @@ int dram_init(void) u32 get_board_rev(void) { - return cl_eeprom_get_board_rev(); + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); } static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = { diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c index 374edbc..8f17b97 100644 --- a/board/compulab/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -104,7 +104,7 @@ int board_init(void) */ u32 get_board_rev(void) { - return cl_eeprom_get_board_rev(); + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); }; int misc_init_r(void) diff --git a/board/compulab/cm_t3517/mux.c b/board/compulab/cm_t3517/mux.c index 88ce2cc..f31f19e 100644 --- a/board/compulab/cm_t3517/mux.c +++ b/board/compulab/cm_t3517/mux.c @@ -121,12 +121,12 @@ void set_muxconf_regs(void) MUX_VAL(CP(UART2_RX), (IEN | PTD | EN | M4)); /*GPIO_147*/ /* MMC1 */ - MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)); - MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)); - MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)); - MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)); - MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)); - MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)); + MUX_VAL(CP(MMC1_CLK), (IEN | PTU | EN | M0)); + MUX_VAL(CP(MMC1_CMD), (IEN | PTU | DIS | M0)); + MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | DIS | M0)); + MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | DIS | M0)); + MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | DIS | M0)); + MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | DIS | M0)); /* DSS */ MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)); diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c index 77bcea4..6304468 100644 --- a/board/compulab/common/eeprom.c +++ b/board/compulab/common/eeprom.c @@ -9,6 +9,7 @@ #include <common.h> #include <i2c.h> +#include "eeprom.h" #ifndef CONFIG_SYS_I2C_EEPROM_ADDR # define CONFIG_SYS_I2C_EEPROM_ADDR 0x50 @@ -25,6 +26,8 @@ #define BOARD_REV_OFFSET 0 #define BOARD_REV_OFFSET_LEGACY 6 #define BOARD_REV_SIZE 2 +#define PRODUCT_NAME_OFFSET 128 +#define PRODUCT_NAME_SIZE 16 #define MAC_ADDR_OFFSET 4 #define MAC_ADDR_OFFSET_LEGACY 0 @@ -105,9 +108,11 @@ void get_board_serial(struct tag_serialnr *serialnr) int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) { uint offset; + int err; - if (cl_eeprom_setup(eeprom_bus)) - return 0; + err = cl_eeprom_setup(eeprom_bus); + if (err) + return err; offset = (cl_eeprom_layout != LAYOUT_LEGACY) ? MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY; @@ -121,7 +126,7 @@ static u32 board_rev; * Routine: cl_eeprom_get_board_rev * Description: read system revision from eeprom */ -u32 cl_eeprom_get_board_rev(void) +u32 cl_eeprom_get_board_rev(uint eeprom_bus) { char str[5]; /* Legacy representation can contain at most 4 digits */ uint offset = BOARD_REV_OFFSET_LEGACY; @@ -129,7 +134,7 @@ u32 cl_eeprom_get_board_rev(void) if (board_rev) return board_rev; - if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS)) + if (cl_eeprom_setup(eeprom_bus)) return 0; if (cl_eeprom_layout != LAYOUT_LEGACY) @@ -149,3 +154,30 @@ u32 cl_eeprom_get_board_rev(void) return board_rev; }; + +/* + * Routine: cl_eeprom_get_board_rev + * Description: read system revision from eeprom + * + * @buf: buffer to store the product name + * @eeprom_bus: i2c bus num of the eeprom + * + * @return: 0 on success, < 0 on failure + */ +int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus) +{ + int err; + + if (buf == NULL) + return -EINVAL; + + err = cl_eeprom_setup(eeprom_bus); + if (err) + return err; + + err = cl_eeprom_read(PRODUCT_NAME_OFFSET, buf, PRODUCT_NAME_SIZE); + if (!err) /* Protect ourselves from invalid data (unterminated str) */ + buf[PRODUCT_NAME_SIZE - 1] = '\0'; + + return err; +} diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h index 50c6b02..c0b4739 100644 --- a/board/compulab/common/eeprom.h +++ b/board/compulab/common/eeprom.h @@ -9,19 +9,25 @@ #ifndef _EEPROM_ #define _EEPROM_ +#include <errno.h> #ifdef CONFIG_SYS_I2C int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus); -u32 cl_eeprom_get_board_rev(void); +u32 cl_eeprom_get_board_rev(uint eeprom_bus); +int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus); #else static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) { return 1; } -static inline u32 cl_eeprom_get_board_rev(void) +static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus) { return 0; } +static inline int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus) +{ + return -ENOSYS; +} #endif #endif |