162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2011 Samsung Electronics Co., Ltd. 462306a36Sopenharmony_ci * http://www.samsung.com 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright 2008 Openmoko, Inc. 762306a36Sopenharmony_ci * Copyright 2008 Simtec Electronics 862306a36Sopenharmony_ci * http://armlinux.simtec.co.uk/ 962306a36Sopenharmony_ci * Ben Dooks <ben@simtec.co.uk> 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * S3C Platform - SDHCI (HSMMC) platform data definitions 1262306a36Sopenharmony_ci */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#ifndef __PLAT_S3C_SDHCI_H 1562306a36Sopenharmony_ci#define __PLAT_S3C_SDHCI_H __FILE__ 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include <linux/platform_data/mmc-sdhci-s3c.h> 1862306a36Sopenharmony_ci#include "devs.h" 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data 2162306a36Sopenharmony_ci * @pd: The default platform data for this device. 2262306a36Sopenharmony_ci * @set: Pointer to the platform data to fill in. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_ciextern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd, 2562306a36Sopenharmony_ci struct s3c_sdhci_platdata *set); 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/** 2862306a36Sopenharmony_ci * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device. 2962306a36Sopenharmony_ci * @pd: Platform data to register to device. 3062306a36Sopenharmony_ci * 3162306a36Sopenharmony_ci * Register the given platform data for use withe S3C SDHCI device. 3262306a36Sopenharmony_ci * The call will copy the platform data, so the board definitions can 3362306a36Sopenharmony_ci * make the structure itself __initdata. 3462306a36Sopenharmony_ci */ 3562306a36Sopenharmony_ciextern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); 3662306a36Sopenharmony_ciextern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); 3762306a36Sopenharmony_ciextern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd); 3862306a36Sopenharmony_ciextern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd); 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci/* Default platform data, exported so that per-cpu initialisation can 4162306a36Sopenharmony_ci * set the correct one when there are more than one cpu type selected. 4262306a36Sopenharmony_ci*/ 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ciextern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; 4562306a36Sopenharmony_ciextern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; 4662306a36Sopenharmony_ciextern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; 4762306a36Sopenharmony_ciextern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci/* Helper function availability */ 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciextern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 5262306a36Sopenharmony_ciextern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 5362306a36Sopenharmony_ciextern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* S3C64XX SDHCI setup */ 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#ifdef CONFIG_S3C64XX_SETUP_SDHCI 5862306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci0(void) 5962306a36Sopenharmony_ci{ 6062306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC 6162306a36Sopenharmony_ci s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; 6262306a36Sopenharmony_ci#endif 6362306a36Sopenharmony_ci} 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci1(void) 6662306a36Sopenharmony_ci{ 6762306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC1 6862306a36Sopenharmony_ci s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; 6962306a36Sopenharmony_ci#endif 7062306a36Sopenharmony_ci} 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci2(void) 7362306a36Sopenharmony_ci{ 7462306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC2 7562306a36Sopenharmony_ci s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; 7662306a36Sopenharmony_ci#endif 7762306a36Sopenharmony_ci} 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci0(void) 8062306a36Sopenharmony_ci{ 8162306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC 8262306a36Sopenharmony_ci s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; 8362306a36Sopenharmony_ci#endif 8462306a36Sopenharmony_ci} 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci1(void) 8762306a36Sopenharmony_ci{ 8862306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC1 8962306a36Sopenharmony_ci s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; 9062306a36Sopenharmony_ci#endif 9162306a36Sopenharmony_ci} 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci2(void) 9462306a36Sopenharmony_ci{ 9562306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC2 9662306a36Sopenharmony_ci s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; 9762306a36Sopenharmony_ci#endif 9862306a36Sopenharmony_ci} 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#else 10162306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci0(void) { } 10262306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci1(void) { } 10362306a36Sopenharmony_cistatic inline void s3c6410_default_sdhci2(void) { } 10462306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci0(void) { } 10562306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci1(void) { } 10662306a36Sopenharmony_cistatic inline void s3c6400_default_sdhci2(void) { } 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci#endif /* CONFIG_S3C64XX_SETUP_SDHCI */ 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_cistatic inline void s3c_sdhci_setname(int id, char *name) 11162306a36Sopenharmony_ci{ 11262306a36Sopenharmony_ci switch (id) { 11362306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC 11462306a36Sopenharmony_ci case 0: 11562306a36Sopenharmony_ci s3c_device_hsmmc0.name = name; 11662306a36Sopenharmony_ci break; 11762306a36Sopenharmony_ci#endif 11862306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC1 11962306a36Sopenharmony_ci case 1: 12062306a36Sopenharmony_ci s3c_device_hsmmc1.name = name; 12162306a36Sopenharmony_ci break; 12262306a36Sopenharmony_ci#endif 12362306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC2 12462306a36Sopenharmony_ci case 2: 12562306a36Sopenharmony_ci s3c_device_hsmmc2.name = name; 12662306a36Sopenharmony_ci break; 12762306a36Sopenharmony_ci#endif 12862306a36Sopenharmony_ci#ifdef CONFIG_S3C_DEV_HSMMC3 12962306a36Sopenharmony_ci case 3: 13062306a36Sopenharmony_ci s3c_device_hsmmc3.name = name; 13162306a36Sopenharmony_ci break; 13262306a36Sopenharmony_ci#endif 13362306a36Sopenharmony_ci default: 13462306a36Sopenharmony_ci break; 13562306a36Sopenharmony_ci } 13662306a36Sopenharmony_ci} 13762306a36Sopenharmony_ci#endif /* __PLAT_S3C_SDHCI_H */ 138