blob: 9190ee7e6e3fcd392d4781bd4f4c8d206a5952e8 [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>
19
Tristan Shieh8db79c12018-09-07 17:26:21 +080020static void configure_emmc(void)
21{
22 const gpio_t emmc_pin[] = {
23 GPIO(MSDC0_DAT0), GPIO(MSDC0_DAT1),
24 GPIO(MSDC0_DAT2), GPIO(MSDC0_DAT3),
25 GPIO(MSDC0_DAT4), GPIO(MSDC0_DAT5),
26 GPIO(MSDC0_DAT6), GPIO(MSDC0_DAT7),
27 GPIO(MSDC0_CMD), GPIO(MSDC0_RSTB),
28 };
29
30 for (size_t i = 0; i < ARRAY_SIZE(emmc_pin); i++)
31 gpio_set_pull(emmc_pin[i], GPIO_PULL_ENABLE, GPIO_PULL_UP);
32}
33
Tristan Shiehbb684e02018-06-19 16:07:54 +080034static void mainboard_init(struct device *dev)
35{
Tristan Shieh8db79c12018-09-07 17:26:21 +080036 configure_emmc();
Tristan Shiehbb684e02018-06-19 16:07:54 +080037}
38
39static void mainboard_enable(struct device *dev)
40{
41 dev->ops->init = &mainboard_init;
42}
43
44struct chip_operations mainboard_ops = {
45 .name = CONFIG_MAINBOARD_PART_NUMBER,
46 .enable_dev = mainboard_enable,
47};