int board_init(void) { struct udevice *pinctrl, *regulator; int ret; /* * The PWM do not have decicated interrupt number in dts and can * not get periph_id by pinctrl framework, so let's init them here. * The PWM2 and PWM3 are for pwm regulater. */ ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); goto out; } /* Enable pwm0 for panel backlight */ ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM0); if (ret) { debug("%s PWM0 pinctrl init fail! (ret=%d)\n", __func__, ret); goto out; } ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM2); if (ret) { debug("%s PWM2 pinctrl init fail!\n", __func__); goto out; } ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_PWM3); if (ret) { debug("%s PWM3 pinctrl init fail!\n", __func__); goto out; } ret = regulators_enable_boot_on(false); if (ret) debug("%s: Cannot enable boot on regulator\n", __func__); ret = regulator_get_by_platname("vcc5v0_host", ®ulator); if (ret) { debug("%s vcc5v0_host init fail! ret %d\n", __func__, ret); goto out; } ret = regulator_set_enable(regulator, true); if (ret) { debug("%s vcc5v0-host-en set fail!\n", __func__); goto out; } out: return 0; }
void spl_board_init(void) { struct udevice *pinctrl; int ret; ret = setup_led(); if (ret) { debug("LED ret=%d\n", ret); hang(); } ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); goto err; } #ifdef CONFIG_SPL_MMC_SUPPORT ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD); if (ret) { debug("%s: Failed to set up SD card\n", __func__); goto err; } ret = configure_emmc(pinctrl); if (ret) { debug("%s: Failed to set up eMMC\n", __func__); goto err; } #endif /* Enable debug UART */ ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG); if (ret) { debug("%s: Failed to set up console UART\n", __func__); goto err; } preloader_console_init(); #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) back_to_bootrom(BROM_BOOT_NEXTSTAGE); #endif return; err: printf("spl_board_init: Error %d\n", ret); /* No way to report error here */ hang(); }
int board_init(void) { #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) struct udevice *pinctrl; int ret; /* * We need to implement sdcard iomux here for the further * initialization, otherwise, it'll hit sdcard command sending * timeout exception. */ ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); goto err; } ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD); if (ret) { debug("%s: Failed to set up SD card\n", __func__); goto err; } return 0; err: printf("board_init: Error %d\n", ret); /* No way to report error here */ hang(); return -1; #else return 0; #endif }
void spl_board_init(void) { struct udevice *pinctrl; int ret; ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); goto err; } /* Enable debug UART */ ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG); if (ret) { debug("%s: Failed to set up console UART\n", __func__); goto err; } preloader_console_init(); return; err: printf("%s: Error %d\n", __func__, ret); /* No way to report error here */ hang(); }
void board_init_f(ulong dummy) { struct udevice *pinctrl; struct udevice *dev; int ret; ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); hang(); } /* Set up our preloader console */ ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { pr_err("%s: pinctrl init failed: %d\n", __func__, ret); hang(); } ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0); if (ret) { pr_err("%s: failed to set up console UART\n", __func__); hang(); } preloader_console_init(); ret = uclass_get_device(UCLASS_RAM, 0, &dev); if (ret) { debug("DRAM init failed: %d\n", ret); return; } }
int board_init(void) { #ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM struct udevice *pinctrl; int ret; /* * We need to implement sdcard iomux here for the further * initlization, otherwise, it'll hit sdcard command sending * timeout exception. */ ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); goto err; } ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD); if (ret) { debug("%s: Failed to set up SD card\n", __func__); goto err; } return 0; err: printf("board_init: Error %d\n", ret); /* No way to report error here */ hang(); return -1; #else int ret; /* We do some SoC one time setting here */ if (!fdt_node_check_compatible(gd->fdt_blob, 0, "google,veyron")) { ret = veyron_init(); if (ret) return ret; } return 0; #endif }
static int rockchip_i2c_probe(struct udevice *bus) { struct rk_i2c *priv = dev_get_priv(bus); struct rk_i2c_soc_data *soc_data; struct udevice *pinctrl; int bus_nr; int ret; priv->regs = dev_read_addr_ptr(bus); soc_data = (struct rk_i2c_soc_data*)dev_get_driver_data(bus); if (soc_data->controller_type == RK_I2C_LEGACY) { ret = dev_read_alias_seq(bus, &bus_nr); if (ret < 0) { debug("%s: Could not get alias for %s: %d\n", __func__, bus->name, ret); return ret; } ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); if (ret) { debug("%s: Cannot find pinctrl device\n", __func__); return ret; } /* pinctrl will switch I2C to new type */ ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_I2C0 + bus_nr); if (ret) { debug("%s: Failed to switch I2C to new type %s: %d\n", __func__, bus->name, ret); return ret; } } return 0; }
static int configure_emmc(struct udevice *pinctrl) { #if defined(CONFIG_TARGET_CHROMEBOOK_JERRY) struct gpio_desc desc; int ret; pinctrl_request_noflags(pinctrl, PERIPH_ID_EMMC); /* * TODO([email protected]): Pick this up from device tree or perhaps * use the EMMC_PWREN setting. */ ret = dm_gpio_lookup_name("D9", &desc); if (ret) { debug("gpio ret=%d\n", ret); return ret; } ret = dm_gpio_request(&desc, "emmc_pwren"); if (ret) { debug("gpio_request ret=%d\n", ret); return ret; } ret = dm_gpio_set_dir_flags(&desc, GPIOD_IS_OUT); if (ret) { debug("gpio dir ret=%d\n", ret); return ret; } ret = dm_gpio_set_value(&desc, 1); if (ret) { debug("gpio value ret=%d\n", ret); return ret; } #endif return 0; }