diff options
author | Manel Caro <mcaro@iseebcn.com> | 2019-11-13 13:46:50 +0100 |
---|---|---|
committer | Manel Caro <mcaro@iseebcn.com> | 2019-11-13 13:46:50 +0100 |
commit | 61efde520ba6caaa84c522cad5cec5252b1b5b9f (patch) | |
tree | b3b5e07e5ca86f49c231b7a23998fdc823c90157 | |
parent | c865b0e18639fbbcf530065f197d701219ab5ffe (diff) | |
download | u-boot-imx-61efde520ba6caaa84c522cad5cec5252b1b5b9f.zip u-boot-imx-61efde520ba6caaa84c522cad5cec5252b1b5b9f.tar.gz u-boot-imx-61efde520ba6caaa84c522cad5cec5252b1b5b9f.tar.bz2 |
IGEP0046: Update Revision Board
-rw-r--r-- | board/isee/igep0046/igep0046.c | 128 |
1 files changed, 48 insertions, 80 deletions
diff --git a/board/isee/igep0046/igep0046.c b/board/isee/igep0046/igep0046.c index cdb6174..d1997ed 100644 --- a/board/isee/igep0046/igep0046.c +++ b/board/isee/igep0046/igep0046.c @@ -82,10 +82,15 @@ DECLARE_GLOBAL_DATA_PTR; #define PCB_CFG_1 IMX_GPIO_NR(3, 23) #define PCB_CFG_2 IMX_GPIO_NR(3, 29) #define PCB_CFG_3 IMX_GPIO_NR(6, 31) -#define PCB_REV_A 1 -#define PCB_REV_B 2 -#define PCB_REV_C 3 -#define PCB_REV_D10 4 + +#define PCB_REV_D01 0 +#define PCB_REV_D04 12 /* (b1100) */ +#define PCB_REV_D10 8 /* (b1000) */ +#define PCB_REV_EXU2_4 1 +#define PCB_REV_EWU1_4 9 /* (b1001) */ + +unsigned char module_pcb_version = 0; +static inline void pcb_version (void); int dram_init(void) { @@ -135,8 +140,9 @@ iomux_v3_cfg_t const usdhc3_pads[] = MX6_PAD_SD3_DAT4__SD3_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), MX6_PAD_SD3_DAT5__SD3_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), MX6_PAD_SD3_DAT6__SD3_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX6_PAD_SD3_DAT7__SD3_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), }; + /* Ethernet MUX */ iomux_v3_cfg_t const enet_pads[] = { @@ -331,10 +337,11 @@ int board_mmc_init(bd_t *bis) gpio_direction_input(USDHC1_CD_GPIO); usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); break; - case 1: + case 1: imx_iomux_v3_setup_multiple_pads( usdhc3_pads, ARRAY_SIZE(usdhc3_pads)); usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); + usdhc_cfg[1].max_bus_width = 8; break; default: printf("Warning: you configured more USDHC controllers" @@ -413,11 +420,6 @@ int board_eth_init(bd_t *bis) return 0; } -int checkboard(void) -{ - return 0; -} - static int load_eeprom (void) { int result = -1; @@ -463,7 +465,10 @@ int board_early_init_f(void) } int board_init(void) -{ +{ + + pcb_version(); + #ifdef CONFIG_BASE0040 reset_audio(); #endif @@ -473,7 +478,6 @@ int board_init(void) setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); mdelay(1); #endif - /* load eeprom configuration */ load_eeprom(); @@ -489,80 +493,43 @@ int board_init(void) return 0; } -static inline unsigned int pcb_version(void) +static inline void pcb_version (void) { - unsigned int pcb_version_bit0, pcb_version_bit1, - pcb_version_bit2, pcb_version_bit3; - - pcb_version_bit0 = gpio_get_value(PCB_CFG_0); - pcb_version_bit1 = gpio_get_value(PCB_CFG_1); - pcb_version_bit2 = gpio_get_value(PCB_CFG_2); - pcb_version_bit3 = gpio_get_value(PCB_CFG_3); - - if (pcb_version_bit0 && pcb_version_bit1 \ - && pcb_version_bit2 && pcb_version_bit3) - /* RA revision: 0b1111*/ - return PCB_REV_A; - else if (!(pcb_version_bit0 || pcb_version_bit1 \ - || pcb_version_bit2 || pcb_version_bit3)) - /* RB revision: 0b0000*/ - return PCB_REV_B; - else if (!(!(pcb_version_bit0) || pcb_version_bit1 \ - || pcb_version_bit2 || pcb_version_bit3)) - /* RC revision: 0b0001*/ - return PCB_REV_C; - else if (!(pcb_version_bit0 || pcb_version_bit1 \ - || pcb_version_bit2 || !(pcb_version_bit3))) - /* RD10 revision: 0b1000*/ - return PCB_REV_D10; - else - return 0; + module_pcb_version = 0; + module_pcb_version = gpio_get_value(PCB_CFG_0); + module_pcb_version |= gpio_get_value(PCB_CFG_1) << 1; + module_pcb_version |= gpio_get_value(PCB_CFG_2) << 2; + module_pcb_version |= gpio_get_value(PCB_CFG_3) << 3; } int board_late_init(void) { + char str[12]; -#ifdef __notdef - u32 crc_value = 0; - u32 crc_save_value; - - if(check_eeprom() != 0){ - printf("EEPROM: not found\n"); - }else{ - /* Read configuration from eeprom */ - if(eeprom46_read_setup(0, (char*) &igep0046_eeprom_config, sizeof(struct igep_mf_setup))) - printf("EEPROM: read fail\n"); - /* Verify crc32 */ - - printf("EEPROM: read %d bytes \n", sizeof(struct igep_mf_setup)); - printf("---------------------------- |!| IGEP STRUCT |!| ----------------------------\n"); - printf("magic_id: 0x%x \n", igep0046_eeprom_config.magic_id); - printf("crc32: 0x%x \n", igep0046_eeprom_config.crc32); - printf("board_uuid: %.36s \n", igep0046_eeprom_config.board_uuid); - printf("board_pid: %.16s \n", igep0046_eeprom_config.board_pid); - printf("model: %.8s \n", igep0046_eeprom_config.model); - printf("variant: %.9s \n", igep0046_eeprom_config.variant); - printf("manf_of: %.6s \n", igep0046_eeprom_config.manf_of); - printf("manf_timestamp: %.19s \n", igep0046_eeprom_config.manf_timestamp); - printf("bmac0: %.17s \n", igep0046_eeprom_config.bmac0); - printf("bmac1: %.17s \n", igep0046_eeprom_config.bmac1); - printf("-----------------------------------------------------------------------------\n"); - - - crc_save_value = igep0046_eeprom_config.crc32; - igep0046_eeprom_config.crc32 = 0; - crc_value = crc32(0, (const unsigned char*) &igep0046_eeprom_config, sizeof(struct igep_mf_setup)); - printf("crc32 calculated: 0x%x \n", crc_value); - if(crc_save_value != crc_value){ - printf("EEPROM: CRC32 failed. Loading default MAC\n"); - }else{ - printf("EEPROM: CRC32 OK! Loading MAC from eeprom\n"); - igep_eeprom_valid = 1; - } - } -#endif + switch(module_pcb_version){ + case PCB_REV_D01: + printf("Board: MX6-IGEP0046 Rev D01 (0x%.2x)\n", module_pcb_version); + break; + case PCB_REV_D04: + printf("Board: MX6-IGEP0046 Rev D04 (0x%.2x)\n", module_pcb_version); + break; + case PCB_REV_EWU1_4: + printf("Board: MX6-IGEP0046 Rev E (0x%.2x)\n", module_pcb_version); + break; + case PCB_REV_D10: + printf("Board: MX6-IGEP0046 Rev D10 (0x%.2x)\n", module_pcb_version); + break; + case PCB_REV_EXU2_4: + printf("Board: MX6-IGEP0046 Rev E (0x%.2x)\n", module_pcb_version); + break; + default: + printf("Module Version (0x%.2x)\n", module_pcb_version); + break; + } + sprintf(str, "%d", module_pcb_version); + setenv("board_rev", str); - checkboard(); +#if 0 switch (pcb_version()) { case PCB_REV_A: puts("Board: MX6-IGEP0046 Rev A\n"); @@ -601,6 +568,7 @@ int board_late_init(void) setenv("fdt_file", ""); break; } +#endif return 0; } |