Krzysztof Kozlowski | 4490e3c | 2017-12-25 20:54:35 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
Kukjin Kim | 3db3ae5 | 2011-02-14 16:22:36 +0900 | [diff] [blame] | 3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 5 | * |
| 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 Kozlowski | 4490e3c | 2017-12-25 20:54:35 +0100 | [diff] [blame] | 12 | */ |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 13 | |
| 14 | #ifndef __PLAT_S3C_SDHCI_H |
| 15 | #define __PLAT_S3C_SDHCI_H __FILE__ |
| 16 | |
Arnd Bergmann | cc014f3 | 2013-03-04 18:28:21 +0100 | [diff] [blame] | 17 | #include <linux/platform_data/mmc-sdhci-s3c.h> |
Arnd Bergmann | c6ff132 | 2019-09-02 18:37:30 +0200 | [diff] [blame] | 18 | #include "devs.h" |
Thomas Abraham | 8482c81 | 2012-04-14 08:04:46 -0700 | [diff] [blame] | 19 | |
Banajit Goswami | 5e8e0a1 | 2011-08-18 20:32:01 +0900 | [diff] [blame] | 20 | /* 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 | */ |
| 24 | extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, |
| 25 | struct s3c_sdhci_platdata *set); |
| 26 | |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 27 | /** |
| 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 | */ |
| 35 | extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); |
Ben Dooks | a2205cd | 2008-10-31 16:14:39 +0000 | [diff] [blame] | 36 | extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); |
Kyungmin Park | 86cd4f5 | 2009-11-17 08:41:23 +0100 | [diff] [blame] | 37 | extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd); |
Hyuk Lee | b3c674b | 2010-06-10 15:22:16 +0900 | [diff] [blame] | 38 | extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd); |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 39 | |
| 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 Dooks | a2205cd | 2008-10-31 16:14:39 +0000 | [diff] [blame] | 44 | extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; |
| 45 | extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; |
Kyungmin Park | 86cd4f5 | 2009-11-17 08:41:23 +0100 | [diff] [blame] | 46 | extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; |
Hyuk Lee | b3c674b | 2010-06-10 15:22:16 +0900 | [diff] [blame] | 47 | extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata; |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 48 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 49 | /* Helper function availability */ |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 50 | |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 51 | extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w); |
| 52 | extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w); |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 53 | extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); |
| 54 | extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 55 | extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 56 | |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 57 | /* S3C2416 SDHCI setup */ |
| 58 | |
| 59 | #ifdef CONFIG_S3C2416_SETUP_SDHCI |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 60 | static inline void s3c2416_default_sdhci0(void) |
| 61 | { |
| 62 | #ifdef CONFIG_S3C_DEV_HSMMC |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 63 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 64 | #endif /* CONFIG_S3C_DEV_HSMMC */ |
| 65 | } |
| 66 | |
| 67 | static inline void s3c2416_default_sdhci1(void) |
| 68 | { |
| 69 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 70 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio; |
Yauhen Kharuzhy | c29cfa6 | 2010-12-17 14:42:09 +0900 | [diff] [blame] | 71 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ |
| 72 | } |
| 73 | |
| 74 | #else |
| 75 | static inline void s3c2416_default_sdhci0(void) { } |
| 76 | static inline void s3c2416_default_sdhci1(void) { } |
| 77 | |
| 78 | #endif /* CONFIG_S3C2416_SETUP_SDHCI */ |
Rajeshwari Shinde | ebc433c | 2011-12-26 16:28:54 +0900 | [diff] [blame] | 79 | |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 80 | /* S3C64XX SDHCI setup */ |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 81 | |
Ben Dooks | 2f6c2ac | 2010-01-26 10:38:52 +0900 | [diff] [blame] | 82 | #ifdef CONFIG_S3C64XX_SETUP_SDHCI |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 83 | static inline void s3c6400_default_sdhci0(void) |
| 84 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 85 | #ifdef CONFIG_S3C_DEV_HSMMC |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 86 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 87 | #endif |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 90 | static inline void s3c6400_default_sdhci1(void) |
| 91 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 92 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 93 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 94 | #endif |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 95 | } |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 96 | |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 97 | static inline void s3c6400_default_sdhci2(void) |
| 98 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 99 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 100 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 101 | #endif |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 102 | } |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 103 | |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 104 | static inline void s3c6410_default_sdhci0(void) |
| 105 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 106 | #ifdef CONFIG_S3C_DEV_HSMMC |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 107 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 108 | #endif |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 109 | } |
Ben Dooks | a2205cd | 2008-10-31 16:14:39 +0000 | [diff] [blame] | 110 | |
| 111 | static inline void s3c6410_default_sdhci1(void) |
| 112 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 113 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
Ben Dooks | 4faf6867 | 2009-03-25 11:01:24 +0000 | [diff] [blame] | 114 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 115 | #endif |
Ben Dooks | a2205cd | 2008-10-31 16:14:39 +0000 | [diff] [blame] | 116 | } |
Ben Dooks | 713e9de | 2008-10-31 16:29:19 +0000 | [diff] [blame] | 117 | |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 118 | static inline void s3c6410_default_sdhci2(void) |
| 119 | { |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 120 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 121 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
Kukjin Kim | 88eb715 | 2010-07-29 22:18:45 +0900 | [diff] [blame] | 122 | #endif |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 123 | } |
Maurus Cuelenaere | 92b118f | 2009-11-23 13:34:46 +0100 | [diff] [blame] | 124 | |
Ben Dooks | 713e9de | 2008-10-31 16:29:19 +0000 | [diff] [blame] | 125 | #else |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 126 | static inline void s3c6410_default_sdhci0(void) { } |
Ben Dooks | a2205cd | 2008-10-31 16:14:39 +0000 | [diff] [blame] | 127 | static inline void s3c6410_default_sdhci1(void) { } |
Marek Szyprowski | 6b34f49 | 2010-06-22 15:45:26 +0900 | [diff] [blame] | 128 | static inline void s3c6410_default_sdhci2(void) { } |
Ben Dooks | 2f6c2ac | 2010-01-26 10:38:52 +0900 | [diff] [blame] | 129 | static inline void s3c6400_default_sdhci0(void) { } |
| 130 | static inline void s3c6400_default_sdhci1(void) { } |
Marek Szyprowski | 6b34f49 | 2010-06-22 15:45:26 +0900 | [diff] [blame] | 131 | static inline void s3c6400_default_sdhci2(void) { } |
Ben Dooks | 2f6c2ac | 2010-01-26 10:38:52 +0900 | [diff] [blame] | 132 | |
| 133 | #endif /* CONFIG_S3C64XX_SETUP_SDHCI */ |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 134 | |
Thomas Abraham | 8482c81 | 2012-04-14 08:04:46 -0700 | [diff] [blame] | 135 | static 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 Kamat | 8d67ec8 | 2013-02-12 10:27:52 -0800 | [diff] [blame] | 158 | default: |
| 159 | break; |
Thomas Abraham | 8482c81 | 2012-04-14 08:04:46 -0700 | [diff] [blame] | 160 | } |
| 161 | } |
Ben Dooks | 5cc7fd8 | 2008-10-31 16:14:38 +0000 | [diff] [blame] | 162 | #endif /* __PLAT_S3C_SDHCI_H */ |