blob: ef085b2f07a672cdf7f110354058250fa19b9481 [file] [log] [blame]
David Hendricks113ef812015-05-13 13:58:24 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Rockchip Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
David Hendricks113ef812015-05-13 13:58:24 -070014 */
15
16#include <arch/cache.h>
17#include <arch/io.h>
18#include <boot/coreboot_tables.h>
19#include <console/console.h>
20#include <delay.h>
21#include <device/device.h>
22#include <device/i2c.h>
23#include <edid.h>
24#include <elog.h>
25#include <gpio.h>
26#include <soc/display.h>
27#include <soc/grf.h>
28#include <soc/soc.h>
29#include <soc/pmu.h>
30#include <soc/clock.h>
31#include <soc/rk808.h>
32#include <soc/spi.h>
33#include <soc/i2c.h>
34#include <symbols.h>
35#include <vbe.h>
36#include <vendorcode/google/chromeos/chromeos.h>
37
38#include "board.h"
39
40static void configure_usb(void)
41{
42 gpio_output(GPIO(0, B, 4), 1); /* USB2_PWR_EN */
43}
44
45static void configure_emmc(void)
46{
47 write32(&rk3288_grf->iomux_emmcdata, IOMUX_EMMCDATA);
48 write32(&rk3288_grf->iomux_emmcpwren, IOMUX_EMMCPWREN);
49 write32(&rk3288_grf->iomux_emmccmd, IOMUX_EMMCCMD);
50
51 gpio_output(GPIO(2, B, 1), 1); /* EMMC_RST_L */
52}
53
huang linad8382a2015-06-04 16:41:27 +080054static void configure_i2s(void)
David Hendricks113ef812015-05-13 13:58:24 -070055{
David Hendricks113ef812015-05-13 13:58:24 -070056 write32(&rk3288_grf->iomux_i2s, IOMUX_I2S);
57 write32(&rk3288_grf->iomux_i2sclk, IOMUX_I2SCLK);
58
David Hendricks113ef812015-05-13 13:58:24 -070059 /* AUDIO IO domain 1.8V voltage selection */
60 write32(&rk3288_grf->io_vsel, RK_SETBITS(1 << 6));
61 rkclk_configure_i2s(12288000);
62}
63
64static void configure_vop(void)
65{
66 write32(&rk3288_grf->iomux_lcdc, IOMUX_LCDC);
67
68 /* lcdc(vop) iodomain select 1.8V */
69 write32(&rk3288_grf->io_vsel, RK_SETBITS(1 << 0));
70
huang linad8382a2015-06-04 16:41:27 +080071 rk808_configure_ldo(8, 1800); /* VCC18_LCD (HDMI_AVDD_1V8) */
David Hendricks113ef812015-05-13 13:58:24 -070072 rk808_configure_ldo(7, 1000); /* VDD10_LCD (HDMI_AVDD_1V0) */
73 rk808_configure_switch(1, 1); /* VCC33_LCD */
74}
75
huang linad8382a2015-06-04 16:41:27 +080076static void configure_hdmi(void)
77{
huang linad8382a2015-06-04 16:41:27 +080078 gpio_output(GPIO(7, B, 3), 1); /* POWER_HDMI_ON */
79}
80
David Hendricks113ef812015-05-13 13:58:24 -070081static void mainboard_init(device_t dev)
82{
83 gpio_output(GPIO_RESET, 0);
84
85 configure_usb();
86 configure_emmc();
huang linad8382a2015-06-04 16:41:27 +080087 configure_i2s();
David Hendricks113ef812015-05-13 13:58:24 -070088 configure_vop();
huang linad8382a2015-06-04 16:41:27 +080089 configure_hdmi();
David Hendricks113ef812015-05-13 13:58:24 -070090}
91
92static void mainboard_enable(device_t dev)
93{
94 dev->ops->init = &mainboard_init;
95}
96
97struct chip_operations mainboard_ops = {
98 .enable_dev = mainboard_enable,
99};
100
101void lb_board(struct lb_header *header)
102{
103 struct lb_range *dma;
104
105 dma = (struct lb_range *)lb_new_record(header);
106 dma->tag = LB_TAB_DMA;
107 dma->size = sizeof(*dma);
108 dma->range_start = (uintptr_t)_dma_coherent;
109 dma->range_size = _dma_coherent_size;
110}
huang linad8382a2015-06-04 16:41:27 +0800111
112void mainboard_power_on_backlight(void)
113{
114 return;
115}