blob: c24584e1b5082b94e17f21704755090ff77bab73 [file] [log] [blame]
huang lina6dbfb52016-03-02 18:38:40 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2016 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.
14 *
15 */
16
huang lina6dbfb52016-03-02 18:38:40 +080017#include <device/device.h>
Vadim Bendebury1e80ab32016-03-28 00:44:54 -070018#include <gpio.h>
19#include <soc/clock.h>
20#include <soc/grf.h>
21
22static void configure_sdmmc(void)
23{
24 gpio_output(GPIO(4, D, 5), 1); /* SDMMC_PWR_EN */
25 gpio_output(GPIO(2, A, 2), 1); /* SDMMC_SDIO_PWR_EN */
26 gpio_input(GPIO(4, D, 2)); /* SDMMC_DET_L */
27 gpio_output(GPIO(2, D, 4), 0); /* Keep the max voltage */
28 write32(&rk3399_grf->iomux_sdmmc, IOMUX_SDMMC);
29}
huang lina6dbfb52016-03-02 18:38:40 +080030
31static void mainboard_init(device_t dev)
32{
Vadim Bendebury1e80ab32016-03-28 00:44:54 -070033 configure_sdmmc();
huang lina6dbfb52016-03-02 18:38:40 +080034}
35
36static void mainboard_enable(device_t dev)
37{
38 dev->ops->init = &mainboard_init;
39}
40
41struct chip_operations mainboard_ops = {
42 .name = CONFIG_MAINBOARD_PART_NUMBER,
43 .enable_dev = mainboard_enable,
44};