blob: 9f9d419e58d7fa6dcb0a44e81962991e3fa410fe [file] [log] [blame]
Krzysztof Kozlowski4490e3c2017-12-25 20:54:35 +01001/* SPDX-License-Identifier: GPL-2.0 */
2/*
Kukjin Kim3db3ae52011-02-14 16:22:36 +09003 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Ben Dooks5cc7fd82008-10-31 16:14:38 +00005 *
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * S3C Platform - SDHCI (HSMMC) platform data definitions
Krzysztof Kozlowski4490e3c2017-12-25 20:54:35 +010012 */
Ben Dooks5cc7fd82008-10-31 16:14:38 +000013
14#ifndef __PLAT_S3C_SDHCI_H
15#define __PLAT_S3C_SDHCI_H __FILE__
16
Arnd Bergmanncc014f32013-03-04 18:28:21 +010017#include <linux/platform_data/mmc-sdhci-s3c.h>
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020018#include "devs.h"
Thomas Abraham8482c812012-04-14 08:04:46 -070019
Banajit Goswami5e8e0a12011-08-18 20:32:01 +090020/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
21 * @pd: The default platform data for this device.
22 * @set: Pointer to the platform data to fill in.
23 */
24extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
25 struct s3c_sdhci_platdata *set);
26
Ben Dooks5cc7fd82008-10-31 16:14:38 +000027/**
28 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
29 * @pd: Platform data to register to device.
30 *
31 * Register the given platform data for use withe S3C SDHCI device.
32 * The call will copy the platform data, so the board definitions can
33 * make the structure itself __initdata.
34 */
35extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooksa2205cd2008-10-31 16:14:39 +000036extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
Kyungmin Park86cd4f52009-11-17 08:41:23 +010037extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
Hyuk Leeb3c674b2010-06-10 15:22:16 +090038extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooks5cc7fd82008-10-31 16:14:38 +000039
40/* Default platform data, exported so that per-cpu initialisation can
41 * set the correct one when there are more than one cpu type selected.
42*/
43
Ben Dooksa2205cd2008-10-31 16:14:39 +000044extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
45extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010046extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
Hyuk Leeb3c674b2010-06-10 15:22:16 +090047extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
Ben Dooks5cc7fd82008-10-31 16:14:38 +000048
Lucas De Marchi25985ed2011-03-30 22:57:33 -030049/* Helper function availability */
Ben Dooks5cc7fd82008-10-31 16:14:38 +000050
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090051extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
52extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
Ben Dooks4faf68672009-03-25 11:01:24 +000053extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
54extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +010055extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Ben Dooks4faf68672009-03-25 11:01:24 +000056
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090057/* S3C2416 SDHCI setup */
58
59#ifdef CONFIG_S3C2416_SETUP_SDHCI
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090060static inline void s3c2416_default_sdhci0(void)
61{
62#ifdef CONFIG_S3C_DEV_HSMMC
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090063 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090064#endif /* CONFIG_S3C_DEV_HSMMC */
65}
66
67static inline void s3c2416_default_sdhci1(void)
68{
69#ifdef CONFIG_S3C_DEV_HSMMC1
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090070 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090071#endif /* CONFIG_S3C_DEV_HSMMC1 */
72}
73
74#else
75static inline void s3c2416_default_sdhci0(void) { }
76static inline void s3c2416_default_sdhci1(void) { }
77
78#endif /* CONFIG_S3C2416_SETUP_SDHCI */
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +090079
Kukjin Kim88eb7152010-07-29 22:18:45 +090080/* S3C64XX SDHCI setup */
Ben Dooks4faf68672009-03-25 11:01:24 +000081
Ben Dooks2f6c2ac2010-01-26 10:38:52 +090082#ifdef CONFIG_S3C64XX_SETUP_SDHCI
Ben Dooks4faf68672009-03-25 11:01:24 +000083static inline void s3c6400_default_sdhci0(void)
84{
Kukjin Kim88eb7152010-07-29 22:18:45 +090085#ifdef CONFIG_S3C_DEV_HSMMC
Ben Dooks4faf68672009-03-25 11:01:24 +000086 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +090087#endif
Ben Dooks4faf68672009-03-25 11:01:24 +000088}
89
Ben Dooks4faf68672009-03-25 11:01:24 +000090static inline void s3c6400_default_sdhci1(void)
91{
Kukjin Kim88eb7152010-07-29 22:18:45 +090092#ifdef CONFIG_S3C_DEV_HSMMC1
Ben Dooks4faf68672009-03-25 11:01:24 +000093 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +090094#endif
Ben Dooks4faf68672009-03-25 11:01:24 +000095}
Ben Dooks4faf68672009-03-25 11:01:24 +000096
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +010097static inline void s3c6400_default_sdhci2(void)
98{
Kukjin Kim88eb7152010-07-29 22:18:45 +090099#ifdef CONFIG_S3C_DEV_HSMMC2
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100100 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900101#endif
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100102}
Ben Dooks4faf68672009-03-25 11:01:24 +0000103
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000104static inline void s3c6410_default_sdhci0(void)
105{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900106#ifdef CONFIG_S3C_DEV_HSMMC
Ben Dooks4faf68672009-03-25 11:01:24 +0000107 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900108#endif
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000109}
Ben Dooksa2205cd2008-10-31 16:14:39 +0000110
111static inline void s3c6410_default_sdhci1(void)
112{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900113#ifdef CONFIG_S3C_DEV_HSMMC1
Ben Dooks4faf68672009-03-25 11:01:24 +0000114 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900115#endif
Ben Dooksa2205cd2008-10-31 16:14:39 +0000116}
Ben Dooks713e9de2008-10-31 16:29:19 +0000117
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100118static inline void s3c6410_default_sdhci2(void)
119{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900120#ifdef CONFIG_S3C_DEV_HSMMC2
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100121 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900122#endif
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100123}
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100124
Ben Dooks713e9de2008-10-31 16:29:19 +0000125#else
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000126static inline void s3c6410_default_sdhci0(void) { }
Ben Dooksa2205cd2008-10-31 16:14:39 +0000127static inline void s3c6410_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900128static inline void s3c6410_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900129static inline void s3c6400_default_sdhci0(void) { }
130static inline void s3c6400_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900131static inline void s3c6400_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900132
133#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000134
Thomas Abraham8482c812012-04-14 08:04:46 -0700135static inline void s3c_sdhci_setname(int id, char *name)
136{
137 switch (id) {
138#ifdef CONFIG_S3C_DEV_HSMMC
139 case 0:
140 s3c_device_hsmmc0.name = name;
141 break;
142#endif
143#ifdef CONFIG_S3C_DEV_HSMMC1
144 case 1:
145 s3c_device_hsmmc1.name = name;
146 break;
147#endif
148#ifdef CONFIG_S3C_DEV_HSMMC2
149 case 2:
150 s3c_device_hsmmc2.name = name;
151 break;
152#endif
153#ifdef CONFIG_S3C_DEV_HSMMC3
154 case 3:
155 s3c_device_hsmmc3.name = name;
156 break;
157#endif
Sachin Kamat8d67ec82013-02-12 10:27:52 -0800158 default:
159 break;
Thomas Abraham8482c812012-04-14 08:04:46 -0700160 }
161}
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000162#endif /* __PLAT_S3C_SDHCI_H */