Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * linux/arch/arm/mach-omap1/board-h2-mmc.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Author: Felipe Balbi <felipe.lima@indt.org.br>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (C) 2006 Nokia Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_data/gpio-omap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mfd/tps65010.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "board-h2.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "mmc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #if IS_ENABLED(CONFIG_MMC_OMAP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static int mmc_set_power(struct device *dev, int slot, int power_on,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 				int vdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	gpio_set_value(H2_TPS_GPIO_MMC_PWR_EN, power_on);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static int mmc_late_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	int ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static void mmc_cleanup(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	gpio_free(H2_TPS_GPIO_MMC_PWR_EN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  * H2 could use the following functions tested:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  * - mmc_get_cover_state that uses OMAP_MPUIO(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  * - mmc_get_wp that uses OMAP_MPUIO(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static struct omap_mmc_platform_data mmc1_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	.nr_slots                       = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	.init				= mmc_late_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	.cleanup			= mmc_cleanup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	.slots[0]       = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		.set_power              = mmc_set_power,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		.name                   = "mmcblk",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) void __init h2_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	mmc_data[0] = &mmc1_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) void __init h2_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #endif