aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/google/veyron_pinky/mainboard.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2014-09-26 21:01:08 -0700
committerAaron Durbin <adurbin@google.com>2015-04-02 20:46:26 +0200
commit8f3883d5f444d3b72661d585e4671d0996771305 (patch)
tree9443ef37ec8e4cfd7e3f8e14838adf0b3dd00472 /src/mainboard/google/veyron_pinky/mainboard.c
parent5c2988c4616d8326f56037e7ef5e8280c134ef7d (diff)
veyron_pinky: Add rev2 support, clean up mainboard.c
This patch adds support for the board changes in rev2 (board_id = 0001). It also moves the existing mainboard.c code around a bit to group it by component. BUG=chrome-os-partner:32139 TEST=Booted on rev1. Confirmed SD card still works. Confirmed power button was still as broken as before. Original-Change-Id: Ifc4876687db64ca50e41d009d911446129d57b1b Original-Signed-off-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/220251 (cherry picked from commit 9428e0d1b784b27790b3b3dbbb18a769e51c6fd3) Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: I8d3479aa314f8c6f1591c1b69b0a3827234fc730 Reviewed-on: http://review.coreboot.org/9237 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/mainboard/google/veyron_pinky/mainboard.c')
-rw-r--r--src/mainboard/google/veyron_pinky/mainboard.c133
1 files changed, 71 insertions, 62 deletions
diff --git a/src/mainboard/google/veyron_pinky/mainboard.c b/src/mainboard/google/veyron_pinky/mainboard.c
index 0bbd496c64..22c9b0e0f3 100644
--- a/src/mainboard/google/veyron_pinky/mainboard.c
+++ b/src/mainboard/google/veyron_pinky/mainboard.c
@@ -32,97 +32,106 @@
#include <soc/rockchip/rk3288/rk808.h>
#include <soc/rockchip/rk3288/spi.h>
-#define DRAM_START (CONFIG_SYS_SDRAM_BASE >> 20)
-#define DRAM_SIZE CONFIG_DRAM_SIZE_MB
-#define DRAM_END (DRAM_START + DRAM_SIZE)
+#include "board.h"
-static void setup_gpio(void)
+static void configure_usb(void)
{
- /*SOC and TPM reset GPIO, active high.*/
- gpio_output(GPIO(0, B, 2), 0);
+ gpio_output(GPIO(0, B, 3), 1); /* HOST1_PWR_EN */
+ gpio_output(GPIO(0, B, 4), 1); /* USBOTG_PWREN_H */
+
+ switch (board_id()) {
+ case 0:
+ gpio_output(GPIO(7, B, 3), 1); /* 5V_DRV */
+ break;
+ default:
+ break; /* 5V_DRV moved to EC after rev1 */
+ }
+}
- /* Configure GPIO for lcd_bl_en */
- gpio_output(GPIO(7, A, 2), 1);
+static void configure_sdmmc(void)
+{
+ writel(IOMUX_SDMMC0, &rk3288_grf->iomux_sdmmc0);
- /*Configure backlight PWM 100% brightness*/
- gpio_output(GPIO(7, A, 0), 0);
+ /* use sdmmc0 io, disable JTAG function */
+ writel(RK_CLRBITS(1 << 12), &rk3288_grf->soc_con0);
- /* Configure GPIO for lcd_en */
- gpio_output(GPIO(7, B, 7), 1);
+ switch (board_id()) {
+ case 0:
+ rk808_configure_ldo(PMIC_BUS, 8, 3300); /* VCCIO_SD */
+ gpio_output(GPIO(7, C, 5), 1); /* SD_EN */
+ break;
+ default:
+ rk808_configure_ldo(PMIC_BUS, 4, 3300); /* VCCIO_SD */
+ rk808_configure_ldo(PMIC_BUS, 5, 3300); /* VCC33_SD */
+ break;
+ }
+
+ gpio_input(GPIO(7, A, 5)); /* SD_DET */
}
-static void setup_iomux(void)
+static void configure_emmc(void)
{
- /*i2c0 for pmic*/
- setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL);
- setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA);
-
- /*i2c2 for codec*/
- writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2);
-
- writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
- writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
- writel(IOMUX_LCDC, &rk3288_grf->iomux_lcdc);
- writel(IOMUX_SDMMC0, &rk3288_grf->iomux_sdmmc0);
writel(IOMUX_EMMCDATA, &rk3288_grf->iomux_emmcdata);
writel(IOMUX_EMMCPWREN, &rk3288_grf->iomux_emmcpwren);
writel(IOMUX_EMMCCMD, &rk3288_grf->iomux_emmccmd);
-}
-
-static void setup_usb_poweron(void)
-{
- /* Configure GPIO for usb1_pwr_en */
- gpio_output(GPIO(0, B, 3), 1);
- /* Configure GPIO for usb2_pwr_en */
- gpio_output(GPIO(0, B, 4), 1);
-
- /* Configure GPIO for 5v_drv */
- gpio_output(GPIO(7, B, 3), 1);
+ gpio_output(GPIO(7, B, 4), 1); /* EMMC_RST_L */
}
-static void configure_sdmmc(void)
+static void configure_codec(void)
{
- /* Configure GPIO for sd_en */
- gpio_output(GPIO(7, C, 5), 1);
+ writel(IOMUX_I2C2, &rk3288_grf->iomux_i2c2); /* CODEC I2C */
- /* Configure GPIO for sd_detec */
- gpio_input_pullup(GPIO(7, A, 5));
+ writel(IOMUX_I2S, &rk3288_grf->iomux_i2s);
+ writel(IOMUX_I2SCLK, &rk3288_grf->iomux_i2sclk);
- /*use sdmmc0 io, disable JTAG function*/
- writel(RK_CLRBITS(1 << 12), &rk3288_grf->soc_con0);
-}
+ switch (board_id()) {
+ case 0:
+ rk808_configure_ldo(PMIC_BUS, 5, 1800); /* VCC18_CODEC */
+ break;
+ default:
+ rk808_configure_ldo(PMIC_BUS, 6, 1800); /* VCC18_CODEC */
+ break;
+ }
-static void configure_emmc(void)
-{
- /* Configure GPIO for emmc_pwrctrl */
- gpio_output(GPIO(7, B, 4), 1);
-}
-
-static void configure_i2s(void)
-{
- /*AUDIO IO domain 1.8V voltage selection*/
+ /* AUDIO IO domain 1.8V voltage selection */
writel(RK_SETBITS(1 << 6), &rk3288_grf->io_vsel);
rkclk_configure_i2s(12288000);
}
-static void pmic_init(unsigned int bus)
+static void configure_lcd(void)
{
- rk808_configure_ldo(bus, 4, 1800); /* VCC18_LCD */
- rk808_configure_ldo(bus, 5, 1800); /* VCC18_CODEC */
- rk808_configure_ldo(bus, 6, 1000); /* VCC10_LCD */
- rk808_configure_ldo(bus, 8, 3300); /* VCCIO_SD */
+ writel(IOMUX_LCDC, &rk3288_grf->iomux_lcdc);
+
+ switch (board_id()) {
+ case 0:
+ rk808_configure_ldo(PMIC_BUS, 4, 1800); /* VCC18_LCD */
+ rk808_configure_ldo(PMIC_BUS, 6, 1000); /* VCC10_LCD */
+ gpio_output(GPIO(7, B, 7), 1); /* LCD_EN */
+ break;
+ default:
+ rk808_configure_switch(PMIC_BUS, 2, 1); /* VCC18_LCD */
+ rk808_configure_ldo(PMIC_BUS, 7, 3300); /* VCC10_LCD_PWREN_H */
+ rk808_configure_switch(PMIC_BUS, 1, 1); /* VCC33_LCD */
+ break;
+ }
+
+ gpio_output(GPIO(7, A, 0), 0); /* LCDC_BL */
+ gpio_output(GPIO(7, A, 2), 1); /* BL_EN */
}
static void mainboard_init(device_t dev)
{
- setup_iomux();
- pmic_init(0);
- setup_gpio();
- setup_usb_poweron();
+ setbits_le32(&rk3288_pmu->iomux_i2c0scl, IOMUX_I2C0SCL); /* PMIC I2C */
+ setbits_le32(&rk3288_pmu->iomux_i2c0sda, IOMUX_I2C0SDA); /* PMIC I2C */
+
+ gpio_output(GPIO_RESET, 0);
+
+ configure_usb();
configure_sdmmc();
configure_emmc();
- configure_i2s();
+ configure_codec();
+ configure_lcd();
}
static void mainboard_enable(device_t dev)