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-sx1-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: Carlos Eduardo Aguiar <carlos.aguiar@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-omap1/board-h2-mmc.c, which is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <mach/hardware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "board-sx1.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "mmc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #if IS_ENABLED(CONFIG_MMC_OMAP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static int mmc_set_power(struct device *dev, int slot, int power_on,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 				int vdd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	u8 dat = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (power_on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		dat |= SOFIA_MMC_POWER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		dat &= ~SOFIA_MMC_POWER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Cover switch is at OMAP_MPUIO(3) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static struct omap_mmc_platform_data mmc1_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	.nr_slots                       = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	.slots[0]       = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 		.set_power              = mmc_set_power,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		.ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		.name                   = "mmcblk",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) static struct omap_mmc_platform_data *mmc_data[OMAP15XX_NR_MMC];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) void __init sx1_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	mmc_data[0] = &mmc1_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	omap1_init_mmc(mmc_data, OMAP15XX_NR_MMC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void __init sx1_mmc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif