ls1012ardb.c (4a47bf8a2ba61e21b022b81e2234fdb47570ad22) | ls1012ardb.c (6aaa539f47fc9305de5af64c02b076136852cc3b) |
---|---|
1/* 2 * Copyright 2016 Freescale Semiconductor, Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7#include <common.h> 8#include <i2c.h> --- 138 unchanged lines hidden (view full) --- 147#ifdef CONFIG_FSL_LS_PPA 148 ppa_init(); 149#endif 150 return 0; 151} 152 153int esdhc_status_fixup(void *blob, const char *compat) 154{ | 1/* 2 * Copyright 2016 Freescale Semiconductor, Inc. 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7#include <common.h> 8#include <i2c.h> --- 138 unchanged lines hidden (view full) --- 147#ifdef CONFIG_FSL_LS_PPA 148 ppa_init(); 149#endif 150 return 0; 151} 152 153int esdhc_status_fixup(void *blob, const char *compat) 154{ |
155 char esdhc0_path[] = "/soc/esdhc@1560000"; | |
156 char esdhc1_path[] = "/soc/esdhc@1580000"; | 155 char esdhc1_path[] = "/soc/esdhc@1580000"; |
157 u8 io = 0; | 156 bool sdhc2_en = false; |
158 u8 mux_sdhc2; | 157 u8 mux_sdhc2; |
158 u8 io = 0; |
|
159 | 159 |
160 do_fixup_by_path(blob, esdhc0_path, "status", "okay", 161 sizeof("okay"), 1); 162 | |
163 i2c_set_bus_num(0); 164 | 160 i2c_set_bus_num(0); 161 |
165 /* 166 * The I2C IO-expander for mux select is used to control the muxing 167 * of various onboard interfaces. 168 * 169 * IO1[3:2] indicates SDHC2 interface demultiplexer select lines. 170 * 00 - SDIO wifi 171 * 01 - GPIO (to Arduino) 172 * 10 - eMMC Memory 173 * 11 - SPI 174 */ 175 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_0, 1, &io, 1) < 0) { | 162 /* IO1[7:3] is the field of board revision info. */ 163 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_1, 1, &io, 1) < 0) { |
176 printf("Error reading i2c boot information!\n"); | 164 printf("Error reading i2c boot information!\n"); |
177 return 0; /* Don't want to hang() on this error */ | 165 return 0; |
178 } 179 | 166 } 167 |
180 mux_sdhc2 = (io & 0x0c) >> 2; 181 /* Enable SDHC2 only when use SDIO wifi and eMMC */ 182 if (mux_sdhc2 == 2 || mux_sdhc2 == 0) | 168 /* hwconfig method is used for RevD and later versions. */ 169 if ((io & SW_REV_MASK) <= SW_REV_D) { 170#ifdef CONFIG_HWCONFIG 171 if (hwconfig("esdhc1")) 172 sdhc2_en = true; 173#endif 174 } else { 175 /* 176 * The I2C IO-expander for mux select is used to control 177 * the muxing of various onboard interfaces. 178 * 179 * IO0[3:2] indicates SDHC2 interface demultiplexer 180 * select lines. 181 * 00 - SDIO wifi 182 * 01 - GPIO (to Arduino) 183 * 10 - eMMC Memory 184 * 11 - SPI 185 */ 186 if (i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_0, 1, &io, 1) < 0) { 187 printf("Error reading i2c boot information!\n"); 188 return 0; 189 } 190 191 mux_sdhc2 = (io & 0x0c) >> 2; 192 /* Enable SDHC2 only when use SDIO wifi and eMMC */ 193 if (mux_sdhc2 == 2 || mux_sdhc2 == 0) 194 sdhc2_en = true; 195 } 196 197 if (sdhc2_en) |
183 do_fixup_by_path(blob, esdhc1_path, "status", "okay", 184 sizeof("okay"), 1); 185 else 186 do_fixup_by_path(blob, esdhc1_path, "status", "disabled", 187 sizeof("disabled"), 1); 188 return 0; 189} 190 191int ft_board_setup(void *blob, bd_t *bd) 192{ 193 arch_fixup_fdt(blob); 194 195 ft_cpu_setup(blob, bd); 196 197 return 0; 198} | 198 do_fixup_by_path(blob, esdhc1_path, "status", "okay", 199 sizeof("okay"), 1); 200 else 201 do_fixup_by_path(blob, esdhc1_path, "status", "disabled", 202 sizeof("disabled"), 1); 203 return 0; 204} 205 206int ft_board_setup(void *blob, bd_t *bd) 207{ 208 arch_fixup_fdt(blob); 209 210 ft_cpu_setup(blob, bd); 211 212 return 0; 213} |