| 1 |
|
| 2 |
|
| 3 |
#include <device/mmio.h> |
| 4 |
#include <boot/coreboot_tables.h> |
| 5 |
#include <console/console.h> |
| 6 |
#include <device/device.h> |
| 7 |
#include <device/i2c_simple.h> |
| 8 |
#include <gpio.h> |
| 9 |
#include <soc/display.h> |
| 10 |
#include <soc/grf.h> |
| 11 |
#include <soc/soc.h> |
| 12 |
#include <soc/pmu.h> |
| 13 |
#include <soc/clock.h> |
| 14 |
#include <soc/rk808.h> |
| 15 |
#include <soc/spi.h> |
| 16 |
#include <soc/i2c.h> |
| 17 |
#include <symbols.h> |
| 18 |
#include <security/vboot/vboot_common.h> |
| 19 |
|
| 20 |
#include "board.h" |
| 21 |
|
| 22 |
static void configure_usb(void) |
| 23 |
{ |
| 24 |
gpio_output(GPIO(0, B, 4), 1); |
| 25 |
} |
| 26 |
|
| 27 |
static void configure_emmc(void) |
| 28 |
{ |
| 29 |
write32(&rk3288_grf->iomux_emmcdata, IOMUX_EMMCDATA); |
| 30 |
write32(&rk3288_grf->iomux_emmcpwren, IOMUX_EMMCPWREN); |
| 31 |
write32(&rk3288_grf->iomux_emmccmd, IOMUX_EMMCCMD); |
| 32 |
|
| 33 |
gpio_output(GPIO(2, B, 1), 1); |
| 34 |
} |
| 35 |
|
| 36 |
static void configure_codec(void) |
| 37 |
{ |
| 38 |
write32(&rk3288_grf->iomux_i2c2, IOMUX_I2C2); |
| 39 |
i2c_init(2, 400*KHz); |
| 40 |
|
| 41 |
write32(&rk3288_grf->iomux_i2s, IOMUX_I2S); |
| 42 |
write32(&rk3288_grf->iomux_i2sclk, IOMUX_I2SCLK); |
| 43 |
|
| 44 |
rk808_configure_ldo(6, 1800); |
| 45 |
|
| 46 |
|
| 47 |
write32(&rk3288_grf->io_vsel, RK_SETBITS(1 << 6)); |
| 48 |
rkclk_configure_i2s(12288000); |
| 49 |
} |
| 50 |
|
| 51 |
static void configure_3g(void) |
| 52 |
{ |
| 53 |
|
| 54 |
|
| 55 |
gpio_output(GPIO(5, C, 1), 1); |
| 56 |
gpio_output(GPIO(4, D, 2), 0); |
| 57 |
} |
| 58 |
|
| 59 |
static void mainboard_init(struct device *dev) |
| 60 |
{ |
| 61 |
gpio_output(GPIO_RESET, 0); |
| 62 |
|
| 63 |
configure_usb(); |
| 64 |
configure_emmc(); |
| 65 |
configure_codec(); |
| 66 |
configure_3g(); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
if (vboot_recovery_mode_enabled()) { |
| 72 |
printk(BIOS_DEBUG, "Reducing APLL freq for recovery mode.\n"); |
| 73 |
rkclk_configure_cpu(APLL_600_MHZ); |
| 74 |
rk808_configure_buck(1, 900); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
static void mainboard_enable(struct device *dev) |
| 79 |
{ |
| 80 |
dev->ops->init = &mainboard_init; |
| 81 |
} |
| 82 |
|
| 83 |
struct chip_operations mainboard_ops = { |
| 84 |
.enable_dev = mainboard_enable, |
| 85 |
}; |
| 86 |
|
| 87 |
void lb_board(struct lb_header *header) |
| 88 |
{ |
| 89 |
struct lb_range *dma; |
| 90 |
|
| 91 |
dma = (struct lb_range *)lb_new_record(header); |
| 92 |
dma->tag = LB_TAG_DMA; |
| 93 |
dma->size = sizeof(*dma); |
| 94 |
dma->range_start = (uintptr_t)_dma_coherent; |
| 95 |
dma->range_size = REGION_SIZE(dma_coherent); |
| 96 |
} |
| 97 |
|
| 98 |
void mainboard_power_on_backlight(void) |
| 99 |
{ |
| 100 |
} |