/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ void pin_mux_mmc(void) { uchar val; int ret; /* Turn on MAX8907B LDO12 to 2.8V for J40 power */ ret = i2c_set_bus_num(0); if (ret) printf("i2c_set_bus_num failed: %d\n", ret); val = 0x29; ret = i2c_write(0x3c, 0x46, 1, &val, 1); if (ret) printf("i2c_write 0 0x3c 0x46 failed: %d\n", ret); val = 0x00; ret = i2c_write(0x3c, 0x45, 1, &val, 1); if (ret) printf("i2c_write 0 0x3c 0x45 failed: %d\n", ret); val = 0x1f; ret = i2c_write(0x3c, 0x44, 1, &val, 1); if (ret) printf("i2c_write 0 0x3c 0x44 failed: %d\n", ret); funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_SLXA_8BIT); funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATC_ATD_8BIT); }
/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ static void pin_mux_mmc(void) { funcmux_select(PERIPH_ID_SDMMC1, FUNCMUX_SDMMC1_SDIO1_4BIT); funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_4_BIT); /* For CD GPIO PP1 */ pinmux_tristate_disable(PINGRP_DAP3); }
/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ void pin_mux_mmc(void) { funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_4BIT); /* For power GPIO PI6 */ pinmux_tristate_disable(PMUX_PINGRP_ATA); /* For CD GPIO PI5 */ pinmux_tristate_disable(PMUX_PINGRP_ATC); }
/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ void pin_mux_mmc(void) { funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); funcmux_select(PERIPH_ID_SDMMC2, FUNCMUX_SDMMC2_DTA_DTD_8BIT); /* For power GPIO PI6 */ pinmux_tristate_disable(PINGRP_ATA); /* For CD GPIO PH2 */ pinmux_tristate_disable(PINGRP_ATD); /* For power GPIO PT3 */ pinmux_tristate_disable(PINGRP_DTB); /* For CD GPIO PI5 */ pinmux_tristate_disable(PINGRP_ATC); }
void pin_mux_usb(void) { funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); pinmux_set_func(PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); pinmux_tristate_disable(PINGRP_CDEV2); /* USB2 PHY reset GPIO */ pinmux_tristate_disable(PINGRP_UAC); }
/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ void pin_mux_mmc(void) { funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); /* for write-protect GPIO PI6 */ pinmux_tristate_disable(PINGRP_ATA); /* for CD GPIO PH2 */ pinmux_tristate_disable(PINGRP_ATD); }
/** * Handle the next stage of device init */ static int handle_stage(const void *blob, struct tegra_lcd_priv *priv) { debug("%s: stage %d\n", __func__, priv->stage); /* do the things for this stage */ switch (priv->stage) { case STAGE_START: /* * It is possible that the FDT has requested that the LCD be * disabled. We currently don't support this. It would require * changes to U-Boot LCD subsystem to have LCD support * compiled in but not used. An easier option might be to * still have a frame buffer, but leave the backlight off and * remove all mention of lcd in the stdout environment * variable. */ funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT); break; case STAGE_PANEL_VDD: if (dm_gpio_is_valid(&priv->panel_vdd)) dm_gpio_set_value(&priv->panel_vdd, 1); break; case STAGE_LVDS: if (dm_gpio_is_valid(&priv->lvds_shutdown)) dm_gpio_set_value(&priv->lvds_shutdown, 1); break; case STAGE_BACKLIGHT_VDD: if (dm_gpio_is_valid(&priv->backlight_vdd)) dm_gpio_set_value(&priv->backlight_vdd, 1); break; case STAGE_PWM: /* Enable PWM at 15/16 high, 32768 Hz with divider 1 */ pinmux_set_func(PMUX_PINGRP_GPU, PMUX_FUNC_PWM); pinmux_tristate_disable(PMUX_PINGRP_GPU); pwm_set_config(priv->pwm, priv->pwm_channel, 0xdf, 0xff); pwm_set_enable(priv->pwm, priv->pwm_channel, true); break; case STAGE_BACKLIGHT_EN: if (dm_gpio_is_valid(&priv->backlight_en)) dm_gpio_set_value(&priv->backlight_en, 1); break; case STAGE_DONE: break; } /* set up timer for next stage */ priv->timer_next = timer_get_us(); if (priv->stage < FDT_LCD_TIMINGS) priv->timer_next += priv->panel_timings[priv->stage] * 1000; /* move to next stage */ priv->stage++; return 0; }
void pin_mux_usb(void) { /* For USB0's GPIO PD0. For now, since we have no pinmux in fdt */ pinmux_tristate_disable(PMUX_PINGRP_SLXK); /* For USB1's ULPI signals */ funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); pinmux_set_func(PMUX_PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); pinmux_tristate_disable(PMUX_PINGRP_CDEV2); /* USB1 PHY reset GPIO */ pinmux_tristate_disable(PMUX_PINGRP_UAC); }
void colibri_t20_common_pin_mux_usb(void) { /* module internal USB bus to connect ethernet chipset */ funcmux_select(PERIPH_ID_USB2, FUNCMUX_USB2_ULPI); /* ULPI reference clock output */ pinmux_set_func(PMUX_PINGRP_CDEV2, PMUX_FUNC_PLLP_OUT4); pinmux_tristate_disable(PMUX_PINGRP_CDEV2); /* PHY reset GPIO */ pinmux_tristate_disable(PMUX_PINGRP_UAC); /* VBus GPIO */ pinmux_tristate_disable(PMUX_PINGRP_DTE); }
/** * Set up the specified uarts * * @param uarts_ids Mask containing UARTs to init (UARTx) */ static void setup_uarts(int uart_ids) { static enum periph_id id_for_uart[] = { PERIPH_ID_UART1, PERIPH_ID_UART2, PERIPH_ID_UART3, PERIPH_ID_UART4, }; size_t i; for (i = 0; i < UART_COUNT; i++) { if (uart_ids & (1 << i)) { enum periph_id id = id_for_uart[i]; funcmux_select(id, uart_configs[i]); clock_ll_start_uart(id); } } }
static void i2c_init_controller(struct i2c_bus *i2c_bus) { /* * Use PLLP - DP-04508-001_v06 datasheet indicates a divisor of 8 * here, in section 23.3.1, but in fact we seem to need a factor of * 16 to get the right frequency. */ clock_start_periph_pll(i2c_bus->periph_id, CLOCK_ID_PERIPH, i2c_bus->speed * 2 * 8); /* Reset I2C controller. */ i2c_reset_controller(i2c_bus); /* Configure I2C controller. */ if (i2c_bus->is_dvc) { /* only for DVC I2C */ struct dvc_ctlr *dvc = (struct dvc_ctlr *)i2c_bus->regs; setbits_le32(&dvc->ctrl3, DVC_CTRL_REG3_I2C_HW_SW_PROG_MASK); } funcmux_select(i2c_bus->periph_id, i2c_bus->pinmux_config); }
/** * Handle the next stage of device init */ static int handle_stage(const void *blob) { debug("%s: stage %d\n", __func__, stage); /* do the things for this stage */ switch (stage) { case STAGE_START: /* Initialize the Tegra display controller */ if (tegra_display_probe(gd->fdt_blob, (void *)gd->fb_base)) { printf("%s: Failed to probe display driver\n", __func__); return -1; } /* get panel details */ if (fdt_decode_lcd(blob, &config)) { printf("No valid LCD information in device tree\n"); return -1; } /* * It is possible that the FDT has requested that the LCD be * disabled. We currently don't support this. It would require * changes to U-Boot LCD subsystem to have LCD support * compiled in but not used. An easier option might be to * still have a frame buffer, but leave the backlight off and * remove all mention of lcd in the stdout environment * variable. */ funcmux_select(PERIPH_ID_DISP1, FUNCMUX_DEFAULT); fdtdec_setup_gpio(&config.panel_vdd); fdtdec_setup_gpio(&config.lvds_shutdown); fdtdec_setup_gpio(&config.backlight_vdd); fdtdec_setup_gpio(&config.backlight_en); /* * TODO: If fdt includes output flag we can omit this code * since fdtdec_setup_gpio will do it for us. */ if (fdt_gpio_isvalid(&config.panel_vdd)) gpio_direction_output(config.panel_vdd.gpio, 0); if (fdt_gpio_isvalid(&config.lvds_shutdown)) gpio_direction_output(config.lvds_shutdown.gpio, 0); if (fdt_gpio_isvalid(&config.backlight_vdd)) gpio_direction_output(config.backlight_vdd.gpio, 0); if (fdt_gpio_isvalid(&config.backlight_en)) gpio_direction_output(config.backlight_en.gpio, 0); break; case STAGE_PANEL_VDD: if (fdt_gpio_isvalid(&config.panel_vdd)) gpio_direction_output(config.panel_vdd.gpio, 1); break; case STAGE_LVDS: if (fdt_gpio_isvalid(&config.lvds_shutdown)) gpio_set_value(config.lvds_shutdown.gpio, 1); break; case STAGE_BACKLIGHT_VDD: if (fdt_gpio_isvalid(&config.backlight_vdd)) gpio_set_value(config.backlight_vdd.gpio, 1); break; case STAGE_PWM: /* Enable PWM at 15/16 high, 32768 Hz with divider 1 */ pinmux_set_func(PINGRP_GPU, PMUX_FUNC_PWM); pinmux_tristate_disable(PINGRP_GPU); pwm_enable(config.pwm_channel, 32768, 0xdf, 1); break; case STAGE_BACKLIGHT_EN: if (fdt_gpio_isvalid(&config.backlight_en)) gpio_set_value(config.backlight_en.gpio, 1); break; case STAGE_DONE: break; } /* set up timer for next stage */ timer_next = timer_get_us(); if (stage < FDT_LCD_TIMINGS) timer_next += config.panel_timings[stage] * 1000; /* move to next stage */ stage++; return 0; }
__weak void pin_mux_nand(void) { funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_DEFAULT); }
/* * Routine: pin_mux_mmc * Description: setup the pin muxes/tristate values for the SDMMC(s) */ static void pin_mux_mmc(void) { funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT); }
void pin_mux_spi(void) { funcmux_select(PERIPH_ID_SPI1, FUNCMUX_SPI1_GMC_GMD); }
void pin_mux_nand(void) { funcmux_select(PERIPH_ID_NDFLASH, FUNCMUX_NDFLASH_KBC_8_BIT); }