summaryrefslogtreecommitdiff
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2020-08-06 20:20:46 +0200
committerKrzysztof Kozlowski <krzk@kernel.org>2020-08-20 17:42:21 +0200
commitf67f6c00c7f367fe90f2bc01b9a977aa13de870e (patch)
treec35c2781d4c8320f022dcaec2cd53dc3a146d831 /arch/arm/plat-samsung
parent673085f450b218f51793af7ca7614c4149ab38a9 (diff)
ARM: s3c24xx: move s3cmci pinctrl handling into board files
Rather than call the internal s3c_gpio_cfgall_range() function through a platform header, move the code into the set_power callback that is already exported by the board, and add a default implementation. In DT mode, the code already does not set the pin config, so nothing changes there. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20200806182059.2431-29-krzk@kernel.org [krzk: Rebase and correct set_power in mach-h1940.c] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/devs.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c
index c42e4a272cc7..b16be04c0169 100644
--- a/arch/arm/plat-samsung/devs.c
+++ b/arch/arm/plat-samsung/devs.c
@@ -5,6 +5,7 @@
//
// Base Samsung platform device definitions
+#include <linux/gpio.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
@@ -39,6 +40,7 @@
#include <mach/irqs.h>
#include <mach/map.h>
+#include <mach/gpio-samsung.h>
#ifdef CONFIG_PLAT_S3C24XX
#include <mach/regs-s3c2443-clock.h>
@@ -46,6 +48,7 @@
#include <plat/cpu.h>
#include <plat/devs.h>
+#include <plat/gpio-cfg.h>
#include <linux/soc/samsung/s3c-adc.h>
#include <linux/platform_data/ata-samsung_cf.h>
#include <plat/fb.h>
@@ -835,16 +838,42 @@ struct platform_device s3c_device_rtc = {
/* SDI */
#ifdef CONFIG_PLAT_S3C24XX
+void s3c24xx_mci_def_set_power(unsigned char power_mode, unsigned short vdd)
+{
+ switch (power_mode) {
+ case MMC_POWER_ON:
+ case MMC_POWER_UP:
+ /* Configure GPE5...GPE10 pins in SD mode */
+ s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2),
+ S3C_GPIO_PULL_NONE);
+ break;
+
+ case MMC_POWER_OFF:
+ default:
+ gpio_direction_output(S3C2410_GPE(5), 0);
+ break;
+ }
+}
+
static struct resource s3c_sdi_resource[] = {
[0] = DEFINE_RES_MEM(S3C24XX_PA_SDI, S3C24XX_SZ_SDI),
[1] = DEFINE_RES_IRQ(IRQ_SDI),
};
+static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
+ /* This is currently here to avoid a number of if (host->pdata)
+ * checks. Any zero fields to ensure reasonable defaults are picked. */
+ .no_wprotect = 1,
+ .no_detect = 1,
+ .set_power = s3c24xx_mci_def_set_power,
+};
+
struct platform_device s3c_device_sdi = {
.name = "s3c2410-sdi",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_sdi_resource),
.resource = s3c_sdi_resource,
+ .dev.platform_data = &s3cmci_def_pdata,
};
void __init s3c24xx_mci_set_platdata(struct s3c24xx_mci_pdata *pdata)