static void __init m28evk_init(void) { mxs_iomux_setup_multiple_pads(m28evk_pads, ARRAY_SIZE(m28evk_pads)); mx28_add_duart(); mx28_add_auart0(); mx28_add_auart3(); if (!m28evk_fec_get_mac()) { mx28_add_fec(0, &mx28_fec_pdata[0]); mx28_add_fec(1, &mx28_fec_pdata[1]); } mx28_add_flexcan(0, NULL); mx28_add_flexcan(1, NULL); mx28_add_mxsfb(&m28evk_mxsfb_pdata); mx28_add_mxs_mmc(0, &m28evk_mmc_pdata[0]); mx28_add_mxs_mmc(1, &m28evk_mmc_pdata[1]); gpio_led_register_device(0, &m28evk_led_data); /* I2C */ mx28_add_mxs_i2c(0); i2c_register_board_info(0, m28_stk5v3_i2c_boardinfo, ARRAY_SIZE(m28_stk5v3_i2c_boardinfo)); }
static void __init mx23evk_init(void) { int ret; mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads)); mx23_add_duart(); mx23_add_auart0(); /* power on mmc slot by writing 0 to the gpio */ ret = gpio_request_one(MX23EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc0-slot-power"); if (ret) pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); mx23_add_mxs_mmc(0, &mx23evk_mmc_pdata); ret = gpio_request_one(MX23EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); if (ret) pr_warn("failed to request gpio lcd-enable: %d\n", ret); else gpio_set_value(MX23EVK_LCD_ENABLE, 1); ret = gpio_request_one(MX23EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable"); if (ret) pr_warn("failed to request gpio bl-enable: %d\n", ret); else gpio_set_value(MX23EVK_BL_ENABLE, 1); mx23_add_mxsfb(&mx23evk_mxsfb_pdata); mx23_add_rtc_stmp3xxx(); }
void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, const iomux_cfg_t *iomux_setup, const unsigned int iomux_size) { struct mxs_spl_data *data = MXS_SPL_DATA; uint8_t bootmode = mxs_get_bootmode_index(); gd = &gdata; mxs_spl_fixup_vectors(); mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size); mxs_spl_console_init(); debug("SPL: Serial Console Initialised\n"); mxs_power_init(); mxs_mem_init(); data->mem_dram_size = mxs_mem_get_size(); data->boot_mode_idx = bootmode; mxs_power_wait_pswitch(); if (mxs_boot_modes[data->boot_mode_idx].boot_pads == MXS_BM_JTAG) { debug("SPL: Waiting for JTAG user\n"); asm volatile ("x: b x"); }
static uint8_t mxs_get_bootmode_index(void) { uint8_t bootmode = 0; int i; uint8_t masked; /* Setup IOMUX of bootmode pads to GPIO */ mxs_iomux_setup_multiple_pads(iomux_boot, ARRAY_SIZE(iomux_boot)); /* Setup bootmode pins as GPIO input */ gpio_direction_input(MX28_PAD_LCD_D00__GPIO_1_0); gpio_direction_input(MX28_PAD_LCD_D01__GPIO_1_1); gpio_direction_input(MX28_PAD_LCD_D02__GPIO_1_2); gpio_direction_input(MX28_PAD_LCD_D03__GPIO_1_3); gpio_direction_input(MX28_PAD_LCD_D04__GPIO_1_4); gpio_direction_input(MX28_PAD_LCD_D05__GPIO_1_5); /* Read bootmode pads */ bootmode |= (gpio_get_value(MX28_PAD_LCD_D00__GPIO_1_0) ? 1 : 0) << 0; bootmode |= (gpio_get_value(MX28_PAD_LCD_D01__GPIO_1_1) ? 1 : 0) << 1; bootmode |= (gpio_get_value(MX28_PAD_LCD_D02__GPIO_1_2) ? 1 : 0) << 2; bootmode |= (gpio_get_value(MX28_PAD_LCD_D03__GPIO_1_3) ? 1 : 0) << 3; bootmode |= (gpio_get_value(MX28_PAD_LCD_D04__GPIO_1_4) ? 1 : 0) << 4; bootmode |= (gpio_get_value(MX28_PAD_LCD_D05__GPIO_1_5) ? 1 : 0) << 5; for (i = 0; i < ARRAY_SIZE(mxs_boot_modes); i++) { masked = bootmode & mxs_boot_modes[i].boot_mask; if (masked == mxs_boot_modes[i].boot_pads) break; } return i; }
static void __init mx28evk_init(void) { int ret; mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); mx28_add_duart(); mx28_add_auart0(); mx28_add_auart3(); if (mx28evk_fec_get_mac()) pr_warn("%s: failed on fec mac setup\n", __func__); mx28evk_fec_reset(); mx28_add_fec(0, &mx28_fec_pdata[0]); mx28_add_fec(1, &mx28_fec_pdata[1]); ret = gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, "flexcan-switch"); if (ret) { pr_err("failed to request gpio flexcan-switch: %d\n", ret); } else { mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); } ret = gpio_request_one(MX28EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); if (ret) pr_warn("failed to request gpio lcd-enable: %d\n", ret); else gpio_set_value(MX28EVK_LCD_ENABLE, 1); ret = gpio_request_one(MX28EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable"); if (ret) pr_warn("failed to request gpio bl-enable: %d\n", ret); else gpio_set_value(MX28EVK_BL_ENABLE, 1); mx28_add_mxsfb(&mx28evk_mxsfb_pdata); /* power on mmc slot by writing 0 to the gpio */ ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc0-slot-power"); if (ret) pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]); ret = gpio_request_one(MX28EVK_MMC1_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc1-slot-power"); if (ret) pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret); mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); gpio_led_register_device(0, &mx28evk_led_data); }
static void __init mx28evk_init(void) { int ret; mx28_soc_init(); mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); mx28_add_duart(); mx28_add_auart0(); mx28_add_auart3(); if (mx28evk_fec_get_mac()) pr_warn("%s: failed on fec mac setup\n", __func__); ret = gpio_request_array(mx28evk_gpios, ARRAY_SIZE(mx28evk_gpios)); if (ret) pr_err("One or more GPIOs failed to be requested: %d\n", ret); mx28evk_fec_reset(); mx28_add_fec(0, &mx28_fec_pdata[0]); mx28_add_fec(1, &mx28_fec_pdata[1]); mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); mx28_add_mxsfb(&mx28evk_mxsfb_pdata); mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]); mx28_add_saif(1, &mx28evk_mxs_saif_pdata[1]); mx28_add_mxs_i2c(0); i2c_register_board_info(0, mxs_i2c0_board_info, ARRAY_SIZE(mxs_i2c0_board_info)); mx28evk_add_regulators(); mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, NULL, 0); mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]); mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); mx28_add_rtc_stmp3xxx(); gpio_led_register_device(0, &mx28evk_led_data); }
/* * Functions */ int board_early_init_f(void) { /* IO0 clock at 480MHz */ mx28_set_ioclk(MXC_IOCLK0, 480000); /* IO1 clock at 480MHz */ mx28_set_ioclk(MXC_IOCLK1, 480000); /* SSP0 clock at 96MHz */ mx28_set_sspclk(MXC_SSPCLK0, 96000, 0); /* SSP2 clock at 96MHz */ mx28_set_sspclk(MXC_SSPCLK2, 96000, 0); gpio_request_array(tx28_gpios, ARRAY_SIZE(tx28_gpios)); mxs_iomux_setup_multiple_pads(tx28_pads, ARRAY_SIZE(tx28_pads)); return 0; }
void mxs_common_spl_init(const iomux_cfg_t *iomux_setup, const unsigned int iomux_size) { struct mxs_spl_data *data = (struct mxs_spl_data *) ((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf); uint8_t bootmode = mxs_get_bootmode_index(); mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size); mxs_power_init(); mxs_mem_init(); data->mem_dram_size = mxs_mem_get_size(); data->boot_mode_idx = bootmode; mxs_power_wait_pswitch(); }
static void __init tx28_stk5v3_init(void) { mxs_iomux_setup_multiple_pads(tx28_stk5v3_pads, ARRAY_SIZE(tx28_stk5v3_pads)); mx28_add_duart(); /* UART1 */ mx28_add_auart(1); /* UART2 */ tx28_add_fec0(); /* spi via ssp will be added when available */ spi_register_board_info(tx28_spi_board_info, ARRAY_SIZE(tx28_spi_board_info)); mxs_add_platform_device("leds-gpio", 0, NULL, 0, &tx28_stk5v3_led_data, sizeof(tx28_stk5v3_led_data)); mx28_add_mxs_i2c(0); i2c_register_board_info(0, tx28_stk5v3_i2c_boardinfo, ARRAY_SIZE(tx28_stk5v3_i2c_boardinfo)); }
static void __init stmp378x_dvb_init(void) { int ret; mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads, ARRAY_SIZE(stmp378x_dvb_pads)); mx23_add_duart(); mx23_add_auart0(); /* power on mmc slot */ ret = gpio_request_one(STMP378X_DEVB_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc0-slot-power"); if (ret) pr_warn("could not power mmc (%d)\n", ret); mx23_add_mxs_mmc(0, &stmp378x_dvb_mmc_pdata); spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); }
static void __init mx28evk_init(void) { int ret; mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); mx28_add_duart(); mx28_add_auart0(); mx28_add_auart3(); if (mx28evk_fec_get_mac()) pr_warn("%s: failed on fec mac setup\n", __func__); mx28evk_fec_reset(); mx28_add_fec(0, &mx28_fec_pdata[0]); mx28_add_fec(1, &mx28_fec_pdata[1]); ret = gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, "flexcan-switch"); if (ret) { pr_err("failed to request gpio flexcan-switch: %d\n", ret); } else { mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); } ret = gpio_request_one(MX28EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); if (ret) pr_warn("failed to request gpio lcd-enable: %d\n", ret); else gpio_set_value(MX28EVK_LCD_ENABLE, 1); ret = gpio_request_one(MX28EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable"); if (ret) pr_warn("failed to request gpio bl-enable: %d\n", ret); else gpio_set_value(MX28EVK_BL_ENABLE, 1); mx28_add_gpmi_nfc(&mx28evk_gpmi_nfc_data); mx28_add_mxsfb(&mx28evk_mxsfb_pdata); }
static uint8_t mxs_get_bootmode_index(void) { uint8_t bootmode = 0; int i; uint8_t masked; #if defined(CONFIG_MX23) /* Setup IOMUX of bootmode pads to GPIO */ mxs_iomux_setup_multiple_pads(iomux_boot, ARRAY_SIZE(iomux_boot)); /* Setup bootmode pins as GPIO input */ gpio_direction_input(MX23_PAD_LCD_D00__GPIO_1_0); gpio_direction_input(MX23_PAD_LCD_D01__GPIO_1_1); gpio_direction_input(MX23_PAD_LCD_D02__GPIO_1_2); gpio_direction_input(MX23_PAD_LCD_D03__GPIO_1_3); gpio_direction_input(MX23_PAD_LCD_D05__GPIO_1_5); /* Read bootmode pads */ bootmode |= (gpio_get_value(MX23_PAD_LCD_D00__GPIO_1_0) ? 1 : 0) << 0; bootmode |= (gpio_get_value(MX23_PAD_LCD_D01__GPIO_1_1) ? 1 : 0) << 1; bootmode |= (gpio_get_value(MX23_PAD_LCD_D02__GPIO_1_2) ? 1 : 0) << 2; bootmode |= (gpio_get_value(MX23_PAD_LCD_D03__GPIO_1_3) ? 1 : 0) << 3; bootmode |= (gpio_get_value(MX23_PAD_LCD_D05__GPIO_1_5) ? 1 : 0) << 5; #elif defined(CONFIG_MX28) /* The global boot mode will be detected by ROM code and its value * is stored at the fixed address 0x00019BF0 in OCRAM. */ #define GLOBAL_BOOT_MODE_ADDR 0x00019BF0 bootmode = __raw_readl(GLOBAL_BOOT_MODE_ADDR); #endif for (i = 0; i < ARRAY_SIZE(mxs_boot_modes); i++) { masked = bootmode & mxs_boot_modes[i].boot_mask; if (masked == mxs_boot_modes[i].boot_pads) break; } return i; }
static void __init mx23evk_init(void) { int ret; mxs_iomux_setup_multiple_pads(mx23evk_pads, ARRAY_SIZE(mx23evk_pads)); mx23_add_duart(); mx23_add_auart0(); ret = gpio_request_one(MX23EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); if (ret) pr_warn("failed to request gpio lcd-enable: %d\n", ret); else gpio_set_value(MX23EVK_LCD_ENABLE, 1); ret = gpio_request_one(MX23EVK_BL_ENABLE, GPIOF_DIR_OUT, "bl-enable"); if (ret) pr_warn("failed to request gpio bl-enable: %d\n", ret); else gpio_set_value(MX23EVK_BL_ENABLE, 1); mx23_add_gpmi_nfc(&mx23evk_gpmi_nfc_data); mx23_add_mxsfb(&mx23evk_mxsfb_pdata); }
static void __init apx4devkit_init(void) { mxs_iomux_setup_multiple_pads(apx4devkit_pads, ARRAY_SIZE(apx4devkit_pads)); mx28_add_duart(); mx28_add_auart0(); mx28_add_auart1(); mx28_add_auart2(); mx28_add_auart3(); /* * Register fixup for the Micrel KS8031 PHY clock * (shares same ID with KS8051) */ phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, apx4devkit_phy_fixup); mx28_add_fec(0, &mx28_fec_pdata); mx28_add_mxs_mmc(0, &apx4devkit_mmc_pdata); gpio_led_register_device(0, &apx4devkit_led_data); mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); mx28_add_saif(0, &apx4devkit_mxs_saif_pdata[0]); mx28_add_saif(1, &apx4devkit_mxs_saif_pdata[1]); apx4devkit_add_regulators(); mx28_add_mxs_i2c(0); i2c_register_board_info(0, apx4devkit_i2c_boardinfo, ARRAY_SIZE(apx4devkit_i2c_boardinfo)); mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, NULL, 0); }
static int mx28evk_gpmi_nfc_platform_init(void) { return mxs_iomux_setup_multiple_pads(mx28evk_gpmi_nfc_pads, ARRAY_SIZE(mx28evk_gpmi_nfc_pads)); }
void lcd_ctrl_init(void *lcdbase) { int color_depth = 24; char *vm; unsigned long val; int refresh = 60; struct fb_videomode *p = &tx28_fb_modes[0]; int xres_set = 0, yres_set = 0, bpp_set = 0, refresh_set = 0; if (!lcd_enabled) { debug("LCD disabled\n"); return; } if (tstc()) { debug("Disabling LCD\n"); lcd_enabled = 0; return; } vm = getenv("video_mode"); if (vm == NULL) { debug("Disabling LCD\n"); lcd_enabled = 0; return; } while (p->name != NULL) { if (strcmp(p->name, vm) == 0) { printf("Using video mode: '%s'\n", p->name); vm += strlen(vm); break; } p++; } while (*vm != '\0') { if (*vm >= '0' && *vm <= '9') { char *end; val = simple_strtoul(vm, &end, 0); if (end > vm) { if (!xres_set) { if (val > panel_info.vl_col) val = panel_info.vl_col; p->xres = val; xres_set = 1; } else if (!yres_set) { if (val > panel_info.vl_row) val = panel_info.vl_row; p->yres = val; yres_set = 1; } else if (!bpp_set) { switch (val) { case 8: case 16: case 18: case 24: color_depth = val; break; default: printf("Invalid color depth: '%.*s' in video_mode; using default: '%u'\n", end - vm, vm, color_depth); } bpp_set = 1; } else if (!refresh_set) { refresh = val; refresh_set = 1; } } vm = end; } switch (*vm) { case '@': bpp_set = 1; /* fallthru */ case '-': yres_set = 1; /* fallthru */ case 'x': xres_set = 1; /* fallthru */ case 'M': case 'R': vm++; break; default: if (*vm != '\0') vm++; } } if (p->xres == 0 || p->yres == 0) { printf("Invalid video mode: %s\n", getenv("video_mode")); lcd_enabled = 0; printf("Supported video modes are:"); for (p = &tx28_fb_modes[0]; p->name != NULL; p++) { printf(" %s", p->name); } printf("\n"); return; } p->pixclock = KHZ2PICOS(refresh * (p->xres + p->left_margin + p->right_margin + p->hsync_len) * (p->yres + p->upper_margin + p->lower_margin + p->vsync_len) / 1000); debug("Pixel clock set to %lu.%03lu MHz\n", PICOS2KHZ(p->pixclock) / 1000, PICOS2KHZ(p->pixclock) % 1000); gpio_request_array(stk5_lcd_gpios, ARRAY_SIZE(stk5_lcd_gpios)); mxs_iomux_setup_multiple_pads(stk5_lcd_pads, ARRAY_SIZE(stk5_lcd_pads)); debug("video format: %ux%u-%u@%u\n", p->xres, p->yres, color_depth, refresh); if (karo_load_splashimage(0) == 0) { debug("Initializing LCD controller\n"); mxsfb_init(p, PIX_FMT_RGB24, color_depth); video_hw_init(lcdbase); } else { debug("Skipping initialization of LCD controller\n"); } }
static void stk5_board_init(void) { gpio_request_array(stk5_gpios, ARRAY_SIZE(stk5_gpios)); mxs_iomux_setup_multiple_pads(stk5_pads, ARRAY_SIZE(stk5_pads)); }
void coloured_LED_init(void) { mxs_iomux_setup_multiple_pads(led_pads, ARRAY_SIZE(led_pads)); }
int board_eth_init(bd_t *bis) { int ret; /* Reset the external phy */ gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0); /* Power on the external phy */ gpio_direction_output(MX28_PAD_PWM4__GPIO_3_29, 1); /* Pull strap pins to high */ gpio_direction_output(MX28_PAD_ENET0_RX_EN__GPIO_4_2, 1); gpio_direction_output(MX28_PAD_ENET0_RXD0__GPIO_4_3, 1); gpio_direction_output(MX28_PAD_ENET0_RXD1__GPIO_4_4, 1); gpio_direction_input(MX28_PAD_ENET0_TX_CLK__GPIO_4_5); udelay(25000); gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1); udelay(100); mxs_iomux_setup_multiple_pads(tx28_fec_pads, ARRAY_SIZE(tx28_fec_pads)); ret = cpu_eth_init(bis); if (ret) { printf("cpu_eth_init() failed: %d\n", ret); return ret; } ret = fec_get_mac_addr(0); if (ret < 0) { printf("Failed to read FEC0 MAC address from OCOTP\n"); return ret; } #ifdef CONFIG_FEC_MXC_MULTI if (getenv("ethaddr")) { ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE); if (ret) { printf("FEC MXS: Unable to init FEC0\n"); return ret; } } ret = fec_get_mac_addr(1); if (ret < 0) { printf("Failed to read FEC1 MAC address from OCOTP\n"); return ret; } if (getenv("eth1addr")) { ret = fecmxc_initialize_multi(bis, 1, 1, MXS_ENET1_BASE); if (ret) { printf("FEC MXS: Unable to init FEC1\n"); return ret; } } return 0; #else if (getenv("ethaddr")) { ret = fecmxc_initialize(bis); } return ret; #endif }