linux/arch/arm/plat-samsung/include/plat/sdhci.h
<<
>>
Prefs
   1/* linux/arch/arm/plat-samsung/include/plat/sdhci.h
   2 *
   3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
   4 *              http://www.samsung.com
   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
  12 *
  13 * This program is free software; you can redistribute it and/or modify
  14 * it under the terms of the GNU General Public License version 2 as
  15 * published by the Free Software Foundation.
  16*/
  17
  18#ifndef __PLAT_S3C_SDHCI_H
  19#define __PLAT_S3C_SDHCI_H __FILE__
  20
  21#include <linux/platform_data/mmc-sdhci-s3c.h>
  22#include <plat/devs.h>
  23
  24/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
  25 * @pd: The default platform data for this device.
  26 * @set: Pointer to the platform data to fill in.
  27 */
  28extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
  29                                    struct s3c_sdhci_platdata *set);
  30
  31/**
  32 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
  33 * @pd: Platform data to register to device.
  34 *
  35 * Register the given platform data for use withe S3C SDHCI device.
  36 * The call will copy the platform data, so the board definitions can
  37 * make the structure itself __initdata.
  38 */
  39extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
  40extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
  41extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
  42extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
  43
  44/* Default platform data, exported so that per-cpu initialisation can
  45 * set the correct one when there are more than one cpu type selected.
  46*/
  47
  48extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
  49extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
  50extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
  51extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
  52
  53/* Helper function availability */
  54
  55extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  57extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  59extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  60extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  61extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  62extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  63extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  64extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  65extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  66extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
  67extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  68extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  69extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  70extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
  71extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  72extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  73extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  74extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  75
  76/* S3C2416 SDHCI setup */
  77
  78#ifdef CONFIG_S3C2416_SETUP_SDHCI
  79static inline void s3c2416_default_sdhci0(void)
  80{
  81#ifdef CONFIG_S3C_DEV_HSMMC
  82        s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
  83#endif /* CONFIG_S3C_DEV_HSMMC */
  84}
  85
  86static inline void s3c2416_default_sdhci1(void)
  87{
  88#ifdef CONFIG_S3C_DEV_HSMMC1
  89        s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
  90#endif /* CONFIG_S3C_DEV_HSMMC1 */
  91}
  92
  93#else
  94static inline void s3c2416_default_sdhci0(void) { }
  95static inline void s3c2416_default_sdhci1(void) { }
  96
  97#endif /* CONFIG_S3C2416_SETUP_SDHCI */
  98
  99/* S3C64XX SDHCI setup */
 100
 101#ifdef CONFIG_S3C64XX_SETUP_SDHCI
 102static inline void s3c6400_default_sdhci0(void)
 103{
 104#ifdef CONFIG_S3C_DEV_HSMMC
 105        s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
 106#endif
 107}
 108
 109static inline void s3c6400_default_sdhci1(void)
 110{
 111#ifdef CONFIG_S3C_DEV_HSMMC1
 112        s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
 113#endif
 114}
 115
 116static inline void s3c6400_default_sdhci2(void)
 117{
 118#ifdef CONFIG_S3C_DEV_HSMMC2
 119        s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
 120#endif
 121}
 122
 123static inline void s3c6410_default_sdhci0(void)
 124{
 125#ifdef CONFIG_S3C_DEV_HSMMC
 126        s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
 127#endif
 128}
 129
 130static inline void s3c6410_default_sdhci1(void)
 131{
 132#ifdef CONFIG_S3C_DEV_HSMMC1
 133        s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
 134#endif
 135}
 136
 137static inline void s3c6410_default_sdhci2(void)
 138{
 139#ifdef CONFIG_S3C_DEV_HSMMC2
 140        s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
 141#endif
 142}
 143
 144#else
 145static inline void s3c6410_default_sdhci0(void) { }
 146static inline void s3c6410_default_sdhci1(void) { }
 147static inline void s3c6410_default_sdhci2(void) { }
 148static inline void s3c6400_default_sdhci0(void) { }
 149static inline void s3c6400_default_sdhci1(void) { }
 150static inline void s3c6400_default_sdhci2(void) { }
 151
 152#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
 153
 154/* S5P64X0 SDHCI setup */
 155
 156#ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
 157static inline void s5p64x0_default_sdhci0(void)
 158{
 159#ifdef CONFIG_S3C_DEV_HSMMC
 160        s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
 161#endif
 162}
 163
 164static inline void s5p64x0_default_sdhci1(void)
 165{
 166#ifdef CONFIG_S3C_DEV_HSMMC1
 167        s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
 168#endif
 169}
 170
 171static inline void s5p6440_default_sdhci2(void)
 172{
 173#ifdef CONFIG_S3C_DEV_HSMMC2
 174        s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
 175#endif
 176}
 177
 178static inline void s5p6450_default_sdhci2(void)
 179{
 180#ifdef CONFIG_S3C_DEV_HSMMC2
 181        s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
 182#endif
 183}
 184
 185#else
 186static inline void s5p64x0_default_sdhci0(void) { }
 187static inline void s5p64x0_default_sdhci1(void) { }
 188static inline void s5p6440_default_sdhci2(void) { }
 189static inline void s5p6450_default_sdhci2(void) { }
 190
 191#endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
 192
 193/* S5PC100 SDHCI setup */
 194
 195#ifdef CONFIG_S5PC100_SETUP_SDHCI
 196static inline void s5pc100_default_sdhci0(void)
 197{
 198#ifdef CONFIG_S3C_DEV_HSMMC
 199        s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
 200#endif
 201}
 202
 203static inline void s5pc100_default_sdhci1(void)
 204{
 205#ifdef CONFIG_S3C_DEV_HSMMC1
 206        s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
 207#endif
 208}
 209
 210static inline void s5pc100_default_sdhci2(void)
 211{
 212#ifdef CONFIG_S3C_DEV_HSMMC2
 213        s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
 214#endif
 215}
 216
 217#else
 218static inline void s5pc100_default_sdhci0(void) { }
 219static inline void s5pc100_default_sdhci1(void) { }
 220static inline void s5pc100_default_sdhci2(void) { }
 221
 222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
 223
 224/* S5PV210 SDHCI setup */
 225
 226#ifdef CONFIG_S5PV210_SETUP_SDHCI
 227static inline void s5pv210_default_sdhci0(void)
 228{
 229#ifdef CONFIG_S3C_DEV_HSMMC
 230        s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
 231#endif
 232}
 233
 234static inline void s5pv210_default_sdhci1(void)
 235{
 236#ifdef CONFIG_S3C_DEV_HSMMC1
 237        s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
 238#endif
 239}
 240
 241static inline void s5pv210_default_sdhci2(void)
 242{
 243#ifdef CONFIG_S3C_DEV_HSMMC2
 244        s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
 245#endif
 246}
 247
 248static inline void s5pv210_default_sdhci3(void)
 249{
 250#ifdef CONFIG_S3C_DEV_HSMMC3
 251        s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
 252#endif
 253}
 254
 255#else
 256static inline void s5pv210_default_sdhci0(void) { }
 257static inline void s5pv210_default_sdhci1(void) { }
 258static inline void s5pv210_default_sdhci2(void) { }
 259static inline void s5pv210_default_sdhci3(void) { }
 260
 261#endif /* CONFIG_S5PV210_SETUP_SDHCI */
 262
 263/* EXYNOS4 SDHCI setup */
 264#ifdef CONFIG_EXYNOS4_SETUP_SDHCI
 265static inline void exynos4_default_sdhci0(void)
 266{
 267#ifdef CONFIG_S3C_DEV_HSMMC
 268        s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
 269#endif
 270}
 271
 272static inline void exynos4_default_sdhci1(void)
 273{
 274#ifdef CONFIG_S3C_DEV_HSMMC1
 275        s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
 276#endif
 277}
 278
 279static inline void exynos4_default_sdhci2(void)
 280{
 281#ifdef CONFIG_S3C_DEV_HSMMC2
 282        s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
 283#endif
 284}
 285
 286static inline void exynos4_default_sdhci3(void)
 287{
 288#ifdef CONFIG_S3C_DEV_HSMMC3
 289        s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
 290#endif
 291}
 292
 293#else
 294static inline void exynos4_default_sdhci0(void) { }
 295static inline void exynos4_default_sdhci1(void) { }
 296static inline void exynos4_default_sdhci2(void) { }
 297static inline void exynos4_default_sdhci3(void) { }
 298
 299#endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
 300
 301static inline void s3c_sdhci_setname(int id, char *name)
 302{
 303        switch (id) {
 304#ifdef CONFIG_S3C_DEV_HSMMC
 305        case 0:
 306                s3c_device_hsmmc0.name = name;
 307                break;
 308#endif
 309#ifdef CONFIG_S3C_DEV_HSMMC1
 310        case 1:
 311                s3c_device_hsmmc1.name = name;
 312                break;
 313#endif
 314#ifdef CONFIG_S3C_DEV_HSMMC2
 315        case 2:
 316                s3c_device_hsmmc2.name = name;
 317                break;
 318#endif
 319#ifdef CONFIG_S3C_DEV_HSMMC3
 320        case 3:
 321                s3c_device_hsmmc3.name = name;
 322                break;
 323#endif
 324        default:
 325                break;
 326        }
 327}
 328#endif /* __PLAT_S3C_SDHCI_H */
 329