linux/arch/arm/plat-samsung/include/plat/sdhci.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   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
  14#ifndef __PLAT_S3C_SDHCI_H
  15#define __PLAT_S3C_SDHCI_H __FILE__
  16
  17#include <linux/platform_data/mmc-sdhci-s3c.h>
  18#include <plat/devs.h>
  19
  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 */
  24extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
  25                                    struct s3c_sdhci_platdata *set);
  26
  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 */
  35extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
  36extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
  37extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
  38extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
  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
  44extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
  45extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
  46extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
  47extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
  48
  49/* Helper function availability */
  50
  51extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  52extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  53extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  54extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  55extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  56
  57/* S3C2416 SDHCI setup */
  58
  59#ifdef CONFIG_S3C2416_SETUP_SDHCI
  60static inline void s3c2416_default_sdhci0(void)
  61{
  62#ifdef CONFIG_S3C_DEV_HSMMC
  63        s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
  64#endif /* CONFIG_S3C_DEV_HSMMC */
  65}
  66
  67static inline void s3c2416_default_sdhci1(void)
  68{
  69#ifdef CONFIG_S3C_DEV_HSMMC1
  70        s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
  71#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 */
  79
  80/* S3C64XX SDHCI setup */
  81
  82#ifdef CONFIG_S3C64XX_SETUP_SDHCI
  83static inline void s3c6400_default_sdhci0(void)
  84{
  85#ifdef CONFIG_S3C_DEV_HSMMC
  86        s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  87#endif
  88}
  89
  90static inline void s3c6400_default_sdhci1(void)
  91{
  92#ifdef CONFIG_S3C_DEV_HSMMC1
  93        s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  94#endif
  95}
  96
  97static inline void s3c6400_default_sdhci2(void)
  98{
  99#ifdef CONFIG_S3C_DEV_HSMMC2
 100        s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
 101#endif
 102}
 103
 104static inline void s3c6410_default_sdhci0(void)
 105{
 106#ifdef CONFIG_S3C_DEV_HSMMC
 107        s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
 108#endif
 109}
 110
 111static inline void s3c6410_default_sdhci1(void)
 112{
 113#ifdef CONFIG_S3C_DEV_HSMMC1
 114        s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
 115#endif
 116}
 117
 118static inline void s3c6410_default_sdhci2(void)
 119{
 120#ifdef CONFIG_S3C_DEV_HSMMC2
 121        s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
 122#endif
 123}
 124
 125#else
 126static inline void s3c6410_default_sdhci0(void) { }
 127static inline void s3c6410_default_sdhci1(void) { }
 128static inline void s3c6410_default_sdhci2(void) { }
 129static inline void s3c6400_default_sdhci0(void) { }
 130static inline void s3c6400_default_sdhci1(void) { }
 131static inline void s3c6400_default_sdhci2(void) { }
 132
 133#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
 134
 135static 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
 158        default:
 159                break;
 160        }
 161}
 162#endif /* __PLAT_S3C_SDHCI_H */
 163