Blame view
board/freescale/imx8qm_mek/imx8qm_mek.c
15.9 KB
f8b0b8964 MLK-18161-9 imx8q... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
/* * Copyright 2017-2018 NXP * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <malloc.h> #include <errno.h> #include <netdev.h> #include <fsl_ifc.h> #include <fdt_support.h> #include <linux/libfdt.h> #include <environment.h> #include <fsl_esdhc.h> #include <i2c.h> #include <asm/io.h> #include <asm/gpio.h> #include <asm/arch/clock.h> #include <asm/mach-imx/sci/sci.h> #include <asm/arch/imx8-pins.h> #include <dm.h> #include <imx8_hsio.h> #include <usb.h> #include <asm/arch/iomux.h> #include <asm/arch/sys_proto.h> #include <asm/mach-imx/video.h> #include <asm/arch/video_common.h> #include <power-domain.h> #include "../common/tcpc.h" |
3162e94d2 MLK-17821-3 imx8q... |
31 |
#include <cdns3-uboot.h> |
484104758 MLK-20528-2 imx8:... |
32 |
#include <asm/arch/lpcg.h> |
f8b0b8964 MLK-18161-9 imx8q... |
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
DECLARE_GLOBAL_DATA_PTR; #define ENET_INPUT_PAD_CTRL ((SC_PAD_CONFIG_OD_IN << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_18V_10MA << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) #define ENET_NORMAL_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_18V_10MA << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) #define FSPI_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) #define GPIO_PAD_CTRL ((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) #define I2C_PAD_CTRL ((SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_DV_LOW << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) #define UART_PAD_CTRL ((SC_PAD_CONFIG_OUT_IN << PADRING_CONFIG_SHIFT) | (SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) \ | (SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | (SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT)) static iomux_cfg_t uart0_pads[] = { SC_P_UART0_RX | MUX_PAD_CTRL(UART_PAD_CTRL), SC_P_UART0_TX | MUX_PAD_CTRL(UART_PAD_CTRL), }; static void setup_iomux_uart(void) { imx8_iomux_setup_multiple_pads(uart0_pads, ARRAY_SIZE(uart0_pads)); } int board_early_init_f(void) { sc_ipc_t ipcHndl = 0; sc_err_t sciErr = 0; |
a26de6e05 MLK-18577-7 imx8q... |
68 |
/* When start u-boot in XEN VM, directly return */ |
8132f6b58 MLK-20542 imx8qm:... |
69 70 |
if (IS_ENABLED(CONFIG_XEN)) { writel(0xF53535F5, (void __iomem *)0x80000000); |
a26de6e05 MLK-18577-7 imx8q... |
71 |
return 0; |
8132f6b58 MLK-20542 imx8qm:... |
72 |
} |
a26de6e05 MLK-18577-7 imx8q... |
73 |
|
f8b0b8964 MLK-18161-9 imx8q... |
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
ipcHndl = gd->arch.ipc_channel_handle; /* Power up UART0, this is very early while power domain is not working */ sciErr = sc_pm_set_resource_power_mode(ipcHndl, SC_R_UART_0, SC_PM_PW_MODE_ON); if (sciErr != SC_ERR_NONE) return 0; /* Set UART0 clock root to 80 MHz */ sc_pm_clock_rate_t rate = 80000000; sciErr = sc_pm_set_clock_rate(ipcHndl, SC_R_UART_0, 2, &rate); if (sciErr != SC_ERR_NONE) return 0; /* Enable UART0 clock root */ sciErr = sc_pm_clock_enable(ipcHndl, SC_R_UART_0, 2, true, false); if (sciErr != SC_ERR_NONE) return 0; |
484104758 MLK-20528-2 imx8:... |
91 |
LPCG_AllClockOn(LPUART_0_LPCG); |
f8b0b8964 MLK-18161-9 imx8q... |
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
setup_iomux_uart(); return 0; } #ifdef CONFIG_FEC_MXC #include <miiphy.h> static iomux_cfg_t pad_enet1[] = { SC_P_ENET1_RGMII_RX_CTL | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_RXD0 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_RXD1 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_RXD2 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_RXD3 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_RXC | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET1_RGMII_TX_CTL | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET1_RGMII_TXD0 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET1_RGMII_TXD1 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET1_RGMII_TXD2 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET1_RGMII_TXD3 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET1_RGMII_TXC | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), /* Shared MDIO */ SC_P_ENET0_MDC | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_MDIO | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), }; static iomux_cfg_t pad_enet0[] = { SC_P_ENET0_RGMII_RX_CTL | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_RXD0 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_RXD1 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_RXD2 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_RXD3 | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_RXC | MUX_PAD_CTRL(ENET_INPUT_PAD_CTRL), SC_P_ENET0_RGMII_TX_CTL | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_RGMII_TXD0 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_RGMII_TXD1 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_RGMII_TXD2 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_RGMII_TXD3 | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_RGMII_TXC | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), /* Shared MDIO */ SC_P_ENET0_MDC | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), SC_P_ENET0_MDIO | MUX_PAD_CTRL(ENET_NORMAL_PAD_CTRL), }; static void setup_iomux_fec(void) { if (0 == CONFIG_FEC_ENET_DEV) imx8_iomux_setup_multiple_pads(pad_enet0, ARRAY_SIZE(pad_enet0)); else imx8_iomux_setup_multiple_pads(pad_enet1, ARRAY_SIZE(pad_enet1)); } int board_eth_init(bd_t *bis) { int ret; struct power_domain pd; printf("[%s] %d ", __func__, __LINE__); if (CONFIG_FEC_ENET_DEV) { if (!power_domain_lookup_name("conn_enet1", &pd)) power_domain_on(&pd); } else { if (!power_domain_lookup_name("conn_enet0", &pd)) power_domain_on(&pd); } setup_iomux_fec(); ret = fecmxc_initialize_multi(bis, CONFIG_FEC_ENET_DEV, CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE); if (ret) printf("FEC1 MXC: %s:failed ", __func__); return ret; } int board_phy_config(struct phy_device *phydev) { phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8); phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee); phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); if (phydev->drv->config) phydev->drv->config(phydev); return 0; } #endif #ifdef CONFIG_MXC_GPIO #define LVDS_ENABLE IMX_GPIO_NR(1, 6) #define MIPI_ENABLE IMX_GPIO_NR(1, 7) #define BB_GPIO_3V3_1 IMX_GPIO_NR(4, 20) #define BB_GPIO_3V3_2 IMX_GPIO_NR(4, 24) #define BB_GPIO_3V3_3 IMX_GPIO_NR(4, 23) static void board_gpio_init(void) { /* Enable BB 3V3 */ gpio_request(BB_GPIO_3V3_1, "bb_3v3_1"); gpio_direction_output(BB_GPIO_3V3_1, 1); gpio_request(BB_GPIO_3V3_2, "bb_3v3_2"); gpio_direction_output(BB_GPIO_3V3_2, 1); gpio_request(BB_GPIO_3V3_3, "bb_3v3_3"); gpio_direction_output(BB_GPIO_3V3_3, 1); /* enable LVDS SAS boards */ gpio_request(LVDS_ENABLE, "lvds_enable"); gpio_direction_output(LVDS_ENABLE, 1); /* enable MIPI SAS boards */ gpio_request(MIPI_ENABLE, "mipi_enable"); gpio_direction_output(MIPI_ENABLE, 1); } #endif int checkboard(void) { puts("Board: iMX8QM MEK "); print_bootinfo(); /* Note: After reloc, ipcHndl will no longer be valid. If handle * returned by sc_ipc_open matches SC_IPC_CH, use this * macro (valid after reloc) for subsequent SCI calls. */ if (gd->arch.ipc_channel_handle != SC_IPC_CH) { printf(" SCI error! Invalid handle "); } return 0; } #ifdef CONFIG_FSL_HSIO #define PCIE_PAD_CTRL ((SC_PAD_CONFIG_OD_IN << PADRING_CONFIG_SHIFT)) static iomux_cfg_t board_pcie_pins[] = { SC_P_PCIE_CTRL0_CLKREQ_B | MUX_MODE_ALT(0) | MUX_PAD_CTRL(PCIE_PAD_CTRL), SC_P_PCIE_CTRL0_WAKE_B | MUX_MODE_ALT(0) | MUX_PAD_CTRL(PCIE_PAD_CTRL), SC_P_PCIE_CTRL0_PERST_B | MUX_MODE_ALT(0) | MUX_PAD_CTRL(PCIE_PAD_CTRL), }; static void imx8qm_hsio_initialize(void) { struct power_domain pd; int ret; if (!power_domain_lookup_name("hsio_sata0", &pd)) { ret = power_domain_on(&pd); if (ret) printf("hsio_sata0 Power up failed! (error = %d) ", ret); } if (!power_domain_lookup_name("hsio_pcie0", &pd)) { ret = power_domain_on(&pd); if (ret) printf("hsio_pcie0 Power up failed! (error = %d) ", ret); } if (!power_domain_lookup_name("hsio_pcie1", &pd)) { ret = power_domain_on(&pd); if (ret) printf("hsio_pcie1 Power up failed! (error = %d) ", ret); } |
a39d44763 MLK-18199: Power ... |
273 274 275 276 277 278 |
if (!power_domain_lookup_name("hsio_gpio", &pd)) { ret = power_domain_on(&pd); if (ret) printf("hsio_gpio Power up failed! (error = %d) ", ret); } |
484104758 MLK-20528-2 imx8:... |
279 280 281 282 283 284 285 286 287 288 289 290 |
LPCG_AllClockOn(HSIO_PCIE_X2_LPCG); LPCG_AllClockOn(HSIO_PCIE_X1_LPCG); LPCG_AllClockOn(HSIO_SATA_LPCG); LPCG_AllClockOn(HSIO_PHY_X2_LPCG); LPCG_AllClockOn(HSIO_PHY_X1_LPCG); LPCG_AllClockOn(HSIO_PHY_X2_CRR0_LPCG); LPCG_AllClockOn(HSIO_PHY_X1_CRR1_LPCG); LPCG_AllClockOn(HSIO_PCIE_X2_CRR2_LPCG); LPCG_AllClockOn(HSIO_PCIE_X1_CRR3_LPCG); LPCG_AllClockOn(HSIO_SATA_CRR4_LPCG); LPCG_AllClockOn(HSIO_MISC_LPCG); LPCG_AllClockOn(HSIO_GPIO_LPCG); |
f8b0b8964 MLK-18161-9 imx8q... |
291 292 293 294 295 296 297 298 299 |
imx8_iomux_setup_multiple_pads(board_pcie_pins, ARRAY_SIZE(board_pcie_pins)); } void pci_init_board(void) { /* test the 1 lane mode of the PCIe A controller */ mx8qm_pcie_init(); } #endif |
86d712e35 MLK-20160-2 imx8q... |
300 |
#ifdef CONFIG_USB |
f8b0b8964 MLK-18161-9 imx8q... |
301 |
|
74a78490d MA-12669 imx8qm/q... |
302 |
#ifdef CONFIG_USB_TCPC |
f8b0b8964 MLK-18161-9 imx8q... |
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 |
#define USB_TYPEC_SEL IMX_GPIO_NR(4, 6) #define USB_TYPEC_EN IMX_GPIO_NR(4, 19) static iomux_cfg_t ss_mux_gpio[] = { SC_P_USB_SS3_TC3 | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL), SC_P_QSPI1A_SS0_B | MUX_MODE_ALT(3) | MUX_PAD_CTRL(GPIO_PAD_CTRL), }; struct tcpc_port port; struct tcpc_port_config port_config = { .i2c_bus = 0, .addr = 0x51, .port_type = TYPEC_PORT_DFP, }; void ss_mux_select(enum typec_cc_polarity pol) { if (pol == TYPEC_POLARITY_CC1) gpio_direction_output(USB_TYPEC_SEL, 0); else gpio_direction_output(USB_TYPEC_SEL, 1); } static void setup_typec(void) { imx8_iomux_setup_multiple_pads(ss_mux_gpio, ARRAY_SIZE(ss_mux_gpio)); gpio_request(USB_TYPEC_SEL, "typec_sel"); gpio_request(USB_TYPEC_EN, "typec_en"); gpio_direction_output(USB_TYPEC_EN, 1); tcpc_init(&port, port_config, &ss_mux_select); } |
74a78490d MA-12669 imx8qm/q... |
336 |
#endif |
f8b0b8964 MLK-18161-9 imx8q... |
337 |
|
86d712e35 MLK-20160-2 imx8q... |
338 |
#ifdef CONFIG_USB_CDNS3_GADGET |
3162e94d2 MLK-17821-3 imx8q... |
339 340 341 342 343 344 345 346 347 |
static struct cdns3_device cdns3_device_data = { .none_core_base = 0x5B110000, .xhci_base = 0x5B130000, .dev_base = 0x5B140000, .phy_base = 0x5B160000, .otg_base = 0x5B120000, .dr_mode = USB_DR_MODE_PERIPHERAL, .index = 1, }; |
188aea748 MLK-20559-8 imx8q... |
348 |
int usb_gadget_handle_interrupts(int index) |
3162e94d2 MLK-17821-3 imx8q... |
349 |
{ |
188aea748 MLK-20559-8 imx8q... |
350 |
cdns3_uboot_handle_interrupt(index); |
3162e94d2 MLK-17821-3 imx8q... |
351 352 |
return 0; } |
86d712e35 MLK-20160-2 imx8q... |
353 |
#endif |
3162e94d2 MLK-17821-3 imx8q... |
354 |
|
f8b0b8964 MLK-18161-9 imx8q... |
355 356 357 358 359 360 |
int board_usb_init(int index, enum usb_init_type init) { int ret = 0; if (index == 1) { if (init == USB_INIT_HOST) { |
74a78490d MA-12669 imx8qm/q... |
361 |
#ifdef CONFIG_USB_TCPC |
f8b0b8964 MLK-18161-9 imx8q... |
362 |
ret = tcpc_setup_dfp_mode(&port); |
74a78490d MA-12669 imx8qm/q... |
363 |
#endif |
86d712e35 MLK-20160-2 imx8q... |
364 |
#ifdef CONFIG_USB_CDNS3_GADGET |
3162e94d2 MLK-17821-3 imx8q... |
365 |
} else { |
188aea748 MLK-20559-8 imx8q... |
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
#ifdef CONFIG_SPL_BUILD sc_ipc_t ipcHndl = 0; ipcHndl = gd->arch.ipc_channel_handle; ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2, SC_PM_PW_MODE_ON); if (ret != SC_ERR_NONE) printf("conn_usb2 Power up failed! (error = %d) ", ret); ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2_PHY, SC_PM_PW_MODE_ON); if (ret != SC_ERR_NONE) printf("conn_usb2_phy Power up failed! (error = %d) ", ret); #else |
3162e94d2 MLK-17821-3 imx8q... |
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
struct power_domain pd; int ret; /* Power on usb */ if (!power_domain_lookup_name("conn_usb2", &pd)) { ret = power_domain_on(&pd); if (ret) printf("conn_usb2 Power up failed! (error = %d) ", ret); } if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { ret = power_domain_on(&pd); if (ret) printf("conn_usb2_phy Power up failed! (error = %d) ", ret); } |
188aea748 MLK-20559-8 imx8q... |
398 |
#endif |
3162e94d2 MLK-17821-3 imx8q... |
399 |
|
74a78490d MA-12669 imx8qm/q... |
400 |
#ifdef CONFIG_USB_TCPC |
3162e94d2 MLK-17821-3 imx8q... |
401 402 403 |
ret = tcpc_setup_ufp_mode(&port); printf("%d setufp mode %d ", index, ret); |
74a78490d MA-12669 imx8qm/q... |
404 |
#endif |
3162e94d2 MLK-17821-3 imx8q... |
405 406 407 408 |
ret = cdns3_uboot_init(&cdns3_device_data); printf("%d cdns3_uboot_initmode %d ", index, ret); |
86d712e35 MLK-20160-2 imx8q... |
409 |
#endif |
f8b0b8964 MLK-18161-9 imx8q... |
410 411 412 413 414 415 416 417 418 419 420 |
} } return ret; } int board_usb_cleanup(int index, enum usb_init_type init) { int ret = 0; if (index == 1) { if (init == USB_INIT_HOST) { |
74a78490d MA-12669 imx8qm/q... |
421 |
#ifdef CONFIG_USB_TCPC |
f8b0b8964 MLK-18161-9 imx8q... |
422 |
ret = tcpc_disable_src_vbus(&port); |
74a78490d MA-12669 imx8qm/q... |
423 |
#endif |
86d712e35 MLK-20160-2 imx8q... |
424 |
#ifdef CONFIG_USB_CDNS3_GADGET |
3162e94d2 MLK-17821-3 imx8q... |
425 |
} else { |
188aea748 MLK-20559-8 imx8q... |
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
cdns3_uboot_exit(1); #ifdef CONFIG_SPL_BUILD sc_ipc_t ipcHndl = 0; ipcHndl = gd->arch.ipc_channel_handle; ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2, SC_PM_PW_MODE_OFF); if (ret != SC_ERR_NONE) printf("conn_usb2 Power down failed! (error = %d) ", ret); ret = sc_pm_set_resource_power_mode(ipcHndl, SC_R_USB_2_PHY, SC_PM_PW_MODE_OFF); if (ret != SC_ERR_NONE) printf("conn_usb2_phy Power down failed! (error = %d) ", ret); #else |
3162e94d2 MLK-17821-3 imx8q... |
443 444 |
struct power_domain pd; int ret; |
3162e94d2 MLK-17821-3 imx8q... |
445 446 447 448 |
/* Power off usb */ if (!power_domain_lookup_name("conn_usb2", &pd)) { ret = power_domain_off(&pd); if (ret) |
188aea748 MLK-20559-8 imx8q... |
449 450 |
printf("conn_usb2 Power down failed! (error = %d) ", ret); |
3162e94d2 MLK-17821-3 imx8q... |
451 452 453 454 455 |
} if (!power_domain_lookup_name("conn_usb2_phy", &pd)) { ret = power_domain_off(&pd); if (ret) |
188aea748 MLK-20559-8 imx8q... |
456 457 |
printf("conn_usb2_phy Power down failed! (error = %d) ", ret); |
3162e94d2 MLK-17821-3 imx8q... |
458 |
} |
86d712e35 MLK-20160-2 imx8q... |
459 |
#endif |
188aea748 MLK-20559-8 imx8q... |
460 |
#endif |
f8b0b8964 MLK-18161-9 imx8q... |
461 462 463 464 465 466 467 468 |
} } return ret; } #endif int board_init(void) { |
a26de6e05 MLK-18577-7 imx8q... |
469 470 |
if (IS_ENABLED(CONFIG_XEN)) return 0; |
f8b0b8964 MLK-18161-9 imx8q... |
471 472 473 474 475 476 477 478 479 480 |
#ifdef CONFIG_MXC_GPIO board_gpio_init(); #endif #ifdef CONFIG_FSL_HSIO imx8qm_hsio_initialize(); #ifdef CONFIG_SCSI_AHCI_PLAT sata_init(); #endif #endif |
74a78490d MA-12669 imx8qm/q... |
481 |
#if defined(CONFIG_USB_XHCI_IMX8) && defined(CONFIG_USB_TCPC) |
f8b0b8964 MLK-18161-9 imx8q... |
482 483 484 485 486 |
setup_typec(); #endif return 0; } |
3ab7cc265 MLK-18161-12 imx8... |
487 488 489 490 491 |
void board_quiesce_devices(void) { const char *power_on_devices[] = { "dma_lpuart0", }; |
8132f6b58 MLK-20542 imx8qm:... |
492 493 494 |
if (IS_ENABLED(CONFIG_XEN)) { /* Clear magic number to let xen know uboot is over */ writel(0x0, (void __iomem *)0x80000000); |
a26de6e05 MLK-18577-7 imx8q... |
495 |
return; |
8132f6b58 MLK-20542 imx8qm:... |
496 |
} |
a26de6e05 MLK-18577-7 imx8q... |
497 |
|
3ab7cc265 MLK-18161-12 imx8... |
498 499 |
power_off_pd_devices(power_on_devices, ARRAY_SIZE(power_on_devices)); } |
f8b0b8964 MLK-18161-9 imx8q... |
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
void detail_board_ddr_info(void) { puts(" DDR "); } /* * Board specific reset that is system reset. */ void reset_cpu(ulong addr) { puts("SCI reboot request"); sc_pm_reboot(SC_IPC_CH, SC_PM_RESET_TYPE_COLD); while (1) putc('.'); } #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup(void *blob, bd_t *bd) { return 0; } #endif int board_mmc_get_env_dev(int devno) { |
a26de6e05 MLK-18577-7 imx8q... |
526 527 528 |
/* Use EMMC */ if (IS_ENABLED(CONFIG_XEN)) return 0; |
f8b0b8964 MLK-18161-9 imx8q... |
529 530 531 532 533 |
return devno; } int mmc_map_to_kernel_blk(int dev_no) { |
a26de6e05 MLK-18577-7 imx8q... |
534 535 536 |
/* Use EMMC */ if (IS_ENABLED(CONFIG_XEN)) return 0; |
f8b0b8964 MLK-18161-9 imx8q... |
537 538 |
return dev_no; } |
1c7f8ef97 MLK-18591-8 andro... |
539 |
extern uint32_t _end_ofs; |
f8b0b8964 MLK-18161-9 imx8q... |
540 541 |
int board_late_init(void) { |
1fb976e83 MLK-20980 imx8qm/... |
542 543 |
char *fdt_file; bool m4_boot; |
f8b0b8964 MLK-18161-9 imx8q... |
544 545 546 547 |
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG env_set("board_name", "MEK"); env_set("board_rev", "iMX8QM"); #endif |
e469bf980 MLK-19064 imx8qm:... |
548 549 550 551 |
env_set("sec_boot", "no"); #ifdef CONFIG_AHAB_BOOT env_set("sec_boot", "yes"); #endif |
1fb976e83 MLK-20980 imx8qm/... |
552 553 554 555 556 557 558 559 560 |
fdt_file = env_get("fdt_file"); m4_boot = check_m4_parts_boot(); if (fdt_file && !strcmp(fdt_file, "undefined")) { if (m4_boot) env_set("fdt_file", "fsl-imx8qm-mek-rpmsg.dtb"); else env_set("fdt_file", "fsl-imx8qm-mek.dtb"); } |
f8b0b8964 MLK-18161-9 imx8q... |
561 562 563 |
#ifdef CONFIG_ENV_IS_IN_MMC board_late_mmc_env_init(); #endif |
1c7f8ef97 MLK-18591-8 andro... |
564 565 566 567 568 |
#ifdef IMX_LOAD_HDMI_FIMRWARE char *end_of_uboot; char command[256]; end_of_uboot = (char *)(ulong)(CONFIG_SYS_TEXT_BASE + _end_ofs + fdt_totalsize(gd->fdt_blob)); end_of_uboot += 9; |
b6c141b11 MA-12244-1 [Andro... |
569 |
/* load hdmitxfw.bin and hdmirxfw.bin*/ |
0d6d88077 MA-14629 fix buil... |
570 |
memcpy((void *)IMX_HDMI_FIRMWARE_LOAD_ADDR, end_of_uboot, |
b6c141b11 MA-12244-1 [Andro... |
571 |
IMX_HDMITX_FIRMWARE_SIZE + IMX_HDMIRX_FIRMWARE_SIZE); |
1c7f8ef97 MLK-18591-8 andro... |
572 573 574 |
sprintf(command, "hdp load 0x%x", IMX_HDMI_FIRMWARE_LOAD_ADDR); run_command(command, 0); |
b6c141b11 MA-12244-1 [Andro... |
575 576 577 578 |
sprintf(command, "hdprx load 0x%x", IMX_HDMI_FIRMWARE_LOAD_ADDR + IMX_HDMITX_FIRMWARE_SIZE); run_command(command, 0); |
1c7f8ef97 MLK-18591-8 andro... |
579 |
#endif |
f8b0b8964 MLK-18161-9 imx8q... |
580 581 |
return 0; } |
1c7f8ef97 MLK-18591-8 andro... |
582 583 584 585 586 587 588 589 |
#ifdef CONFIG_FSL_FASTBOOT #ifdef CONFIG_ANDROID_RECOVERY int is_recovery_key_pressing(void) { return 0; /*TODO*/ } #endif /*CONFIG_ANDROID_RECOVERY*/ #endif /*CONFIG_FSL_FASTBOOT*/ |
f8b0b8964 MLK-18161-9 imx8q... |
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
#if defined(CONFIG_VIDEO_IMXDPUV1) static void enable_lvds(struct display_info_t const *dev) { display_controller_setup((PS2KHZ(dev->mode.pixclock) * 1000)); lvds_soc_setup(dev->bus, (PS2KHZ(dev->mode.pixclock) * 1000)); lvds_configure(dev->bus); lvds2hdmi_setup(6); } struct display_info_t const displays[] = {{ .bus = 0, /* LVDS0 */ .addr = 0, /* Unused */ .pixfmt = IMXDPUV1_PIX_FMT_BGRA32, .detect = NULL, .enable = enable_lvds, .mode = { .name = "IT6263", /* 720P60 */ .refresh = 60, .xres = 1280, .yres = 720, .pixclock = 13468, /* 74250000 */ .left_margin = 110, .right_margin = 220, .upper_margin = 5, .lower_margin = 20, .hsync_len = 40, .vsync_len = 5, .sync = FB_SYNC_EXT, .vmode = FB_VMODE_NONINTERLACED } } }; size_t display_count = ARRAY_SIZE(displays); #endif /* CONFIG_VIDEO_IMXDPUV1 */ |