static int board_setup(void) { sysinfo_install_flags(); Exynos5420Gpio *lid_switch = new_exynos5420_gpio_input(GPIO_X, 3, 4); Exynos5420Gpio *ec_in_rw = new_exynos5420_gpio_input(GPIO_X, 2, 3); flag_replace(FLAG_LIDSW, &lid_switch->ops); flag_install(FLAG_ECINRW, &ec_in_rw->ops); // The power switch is active low and needs to be inverted. Exynos5420Gpio *power_switch_l = new_exynos5420_gpio_input(GPIO_X, 1, 2); flag_replace(FLAG_PWRSW, new_gpio_not(&power_switch_l->ops)); Exynos5UsiI2c *i2c9 = new_exynos5_usi_i2c(0x12e10000, 400000); tpm_set_ops(&new_slb9635_i2c(&i2c9->ops, 0x20)->base.ops); Exynos5Spi *spi1 = new_exynos5_spi(0x12d30000); Exynos5Spi *spi2 = new_exynos5_spi(0x12d40000); CrosEcSpiBus *cros_ec_spi_bus = new_cros_ec_spi_bus(&spi2->ops); cros_ec_set_bus(&cros_ec_spi_bus->ops); flash_set_ops(&new_spi_flash(&spi1->ops, 0x400000)->ops); Exynos5I2s *i2s0 = new_exynos5_i2s_multi(0x03830000, 16, 2, 256); I2sSource *i2s_source = new_i2s_source(&i2s0->ops, 48000, 2, 16000); sound_set_ops(&new_sound_route(&i2s_source->ops)->ops); DwmciHost *emmc = new_dwmci_host(0x12200000, 100000000, 8, 0, DWMCI_SET_SAMPLE_CLK(1) | DWMCI_SET_DRV_CLK(3) | DWMCI_SET_DIV_RATIO(3)); DwmciHost *sd_card = new_dwmci_host(0x12220000, 100000000, 4, 1, DWMCI_SET_SAMPLE_CLK(1) | DWMCI_SET_DRV_CLK(2) | DWMCI_SET_DIV_RATIO(3)); list_insert_after(&emmc->mmc.ctrlr.list_node, &fixed_block_dev_controllers); list_insert_after(&sd_card->mmc.ctrlr.list_node, &removable_block_dev_controllers); power_set_ops(&exynos_power_ops); UsbHostController *usb_drd0 = new_usb_hc(XHCI, 0x12000000); UsbHostController *usb_drd1 = new_usb_hc(XHCI, 0x12400000); set_usb_init_callback(usb_drd0, exynos5420_usbss_phy_tune); /* DRD1 port has no SuperSpeed lines anyway */ list_insert_after(&usb_drd0->list_node, &usb_host_controllers); list_insert_after(&usb_drd1->list_node, &usb_host_controllers); return 0; }
static int board_setup(void) { sysinfo_install_flags(new_tegra_gpio_input_from_coreboot); choose_devicetree_by_boardid(); void *dma_channel_bases[32]; for (int i = 0; i < ARRAY_SIZE(dma_channel_bases); i++) dma_channel_bases[i] = (void *)((unsigned long)0x60021000 + 0x40 * i); TegraApbDmaController *dma_controller = new_tegra_apb_dma((void *)0x60020000, dma_channel_bases, ARRAY_SIZE(dma_channel_bases)); TegraSpi *spi4 = new_tegra_spi(0x7000da00, dma_controller, APBDMA_SLAVE_SL2B4); flash_set_ops(&new_spi_flash(&spi4->ops)->ops); TegraI2c *cam_i2c = new_tegra_i2c((void *)0x7000c500, 3, (void *)CLK_RST_U_RST_SET, (void *)CLK_RST_U_RST_CLR, CLK_U_I2C3); tpm_set_ops(&new_slb9635_i2c(&cam_i2c->ops, 0x20)->base.ops); TegraSpi *spi1 = new_tegra_spi(0x7000d400, dma_controller, APBDMA_SLAVE_SL2B1); TegraAudioHubXbar *xbar = new_tegra_audio_hub_xbar(0x70300800); TegraAudioHubApbif *apbif = new_tegra_audio_hub_apbif(0x70300000, 8); TegraI2s *i2s1 = new_tegra_i2s(0x70301100, &apbif->ops, 1, 16, 2, 1536000, 48000); TegraAudioHub *ahub = new_tegra_audio_hub(xbar, apbif, i2s1); I2sSource *i2s_source = new_i2s_source(&i2s1->ops, 48000, 2, 16000); SoundRoute *sound_route = new_sound_route(&i2s_source->ops); TegraI2c *i2c1 = new_tegra_i2c((void *)0x7000c000, 1, (void *)CLK_RST_L_RST_SET, (void *)CLK_RST_L_RST_CLR, CLK_L_I2C1); Max98090Codec *codec = new_max98090_codec(&i2c1->ops, 0x10, 16, 48000, 256, 1); list_insert_after(&ahub->component.list_node, &sound_route->components); list_insert_after(&codec->component.list_node, &sound_route->components); sound_set_ops(&sound_route->ops); CrosEcSpiBus *cros_ec_spi_bus = new_cros_ec_spi_bus(&spi1->ops); CrosEc *cros_ec = new_cros_ec(&cros_ec_spi_bus->ops, 0, NULL); register_vboot_ec(&cros_ec->vboot, 0); TegraI2c *pwr_i2c = new_tegra_i2c((void *)0x7000d000, 5, (void *)CLK_RST_H_RST_SET, (void *)CLK_RST_H_RST_CLR, CLK_H_I2C5); As3722Pmic *pmic = new_as3722_pmic(&pwr_i2c->ops, 0x40); SysinfoResetPowerOps *power = new_sysinfo_reset_power_ops(&pmic->ops, new_tegra_gpio_output_from_coreboot); power_set_ops(&power->ops); // sdmmc4 TegraMmcHost *emmc = new_tegra_mmc_host(0x700b0600, 8, 0, NULL, NULL); // sdmmc3 TegraGpio *enable_vdd_sd = new_tegra_gpio_output(GPIO(R, 0)); // The params in mmc_power set AS3722_LDO6 to 3.3V. VirtualMmcPowerGpio *mmc_power = new_virtual_mmc_power( &enable_vdd_sd->ops, pmic, 0x16, 0x3F, 0); TegraGpio *card_detect = new_tegra_gpio_input(GPIO(V, 2)); GpioOps *card_detect_ops = &card_detect->ops; card_detect_ops = new_gpio_not(card_detect_ops); TegraMmcHost *sd_card = new_tegra_mmc_host(0x700b0400, 4, 1, card_detect_ops, &mmc_power->ops); list_insert_after(&emmc->mmc.ctrlr.list_node, &fixed_block_dev_controllers); list_insert_after(&sd_card->mmc.ctrlr.list_node, &removable_block_dev_controllers); /* Careful: the EHCI base is at offset 0x100 from the SoC's IP base */ UsbHostController *usbd = new_usb_hc(EHCI, 0x7d000100); /* USB2 is connected to the camera, not needed in firmware */ UsbHostController *usb3 = new_usb_hc(EHCI, 0x7d008100); list_insert_after(&usbd->list_node, &usb_host_controllers); list_insert_after(&usb3->list_node, &usb_host_controllers); return 0; }