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