Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * linux/arch/arm/mach-omap1/board-h3-mmc.c
0004  *
0005  * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
0006  * Author: Felipe Balbi <felipe.lima@indt.org.br>
0007  *
0008  * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is:
0009  * Copyright (C) 2006 Nokia Corporation
0010  */
0011 #include <linux/gpio.h>
0012 #include <linux/platform_device.h>
0013 
0014 #include <linux/mfd/tps65010.h>
0015 
0016 #include "common.h"
0017 #include "board-h3.h"
0018 #include "mmc.h"
0019 
0020 #if IS_ENABLED(CONFIG_MMC_OMAP)
0021 
0022 static int mmc_set_power(struct device *dev, int slot, int power_on,
0023                 int vdd)
0024 {
0025     gpio_set_value(H3_TPS_GPIO_MMC_PWR_EN, power_on);
0026     return 0;
0027 }
0028 
0029 /*
0030  * H3 could use the following functions tested:
0031  * - mmc_get_cover_state that uses OMAP_MPUIO(1)
0032  * - mmc_get_wp that maybe uses OMAP_MPUIO(3)
0033  */
0034 static struct omap_mmc_platform_data mmc1_data = {
0035     .nr_slots                       = 1,
0036     .slots[0]       = {
0037         .set_power              = mmc_set_power,
0038         .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
0039         .name                   = "mmcblk",
0040     },
0041 };
0042 
0043 static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
0044 
0045 void __init h3_mmc_init(void)
0046 {
0047     int ret;
0048 
0049     ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
0050     if (ret < 0)
0051         return;
0052     gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
0053 
0054     mmc_data[0] = &mmc1_data;
0055     omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
0056 }
0057 
0058 #else
0059 
0060 void __init h3_mmc_init(void)
0061 {
0062 }
0063 
0064 #endif