blob: e1d8f5fb8d7cd684399fc6c3b3006cbb49d95896 [file] [log] [blame]
Tristan Shiehbb684e02018-06-19 16:07:54 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2018 MediaTek 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#include <device/device.h>
Tristan Shieh8db79c12018-09-07 17:26:21 +080017#include <soc/gpio.h>
Tristan Shiehbb684e02018-06-19 16:07:54 +080018#include <soc/mmu_operations.h>
Tristan Shieh71ae5822018-09-26 14:33:54 +080019#include <soc/usb.h>
Tristan Shiehbb684e02018-06-19 16:07:54 +080020
Tristan Shieh8db79c12018-09-07 17:26:21 +080021static void configure_emmc(void)
22{
23 const gpio_t emmc_pin[] = {
24 GPIO(MSDC0_DAT0), GPIO(MSDC0_DAT1),
25 GPIO(MSDC0_DAT2), GPIO(MSDC0_DAT3),
26 GPIO(MSDC0_DAT4), GPIO(MSDC0_DAT5),
27 GPIO(MSDC0_DAT6), GPIO(MSDC0_DAT7),
28 GPIO(MSDC0_CMD), GPIO(MSDC0_RSTB),
29 };
30
31 for (size_t i = 0; i < ARRAY_SIZE(emmc_pin); i++)
32 gpio_set_pull(emmc_pin[i], GPIO_PULL_ENABLE, GPIO_PULL_UP);
33}
34
Tristan Shieh71ae5822018-09-26 14:33:54 +080035static void configure_usb(void)
36{
37 setup_usb_host();
38}
39
Tristan Shiehbb684e02018-06-19 16:07:54 +080040static void mainboard_init(struct device *dev)
41{
Tristan Shieh8db79c12018-09-07 17:26:21 +080042 configure_emmc();
Tristan Shieh71ae5822018-09-26 14:33:54 +080043 configure_usb();
Tristan Shiehbb684e02018-06-19 16:07:54 +080044}
45
46static void mainboard_enable(struct device *dev)
47{
48 dev->ops->init = &mainboard_init;
49}
50
51struct chip_operations mainboard_ops = {
52 .name = CONFIG_MAINBOARD_PART_NUMBER,
53 .enable_dev = mainboard_enable,
54};