~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-s5pv210/setup-sdhci-gpio.c

Version: ~ [ linux-5.15-rc5 ] ~ [ linux-5.14.11 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.72 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.152 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.210 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.250 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.286 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.288 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* linux/arch/arm/plat-s5pc1xx/setup-sdhci-gpio.c
  2  *
  3  * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
  4  *              http://www.samsung.com/
  5  *
  6  * S5PV210 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
  7  *
  8  * This program is free software; you can redistribute it and/or modify
  9  * it under the terms of the GNU General Public License version 2 as
 10  * published by the Free Software Foundation.
 11 */
 12 
 13 #include <linux/kernel.h>
 14 #include <linux/types.h>
 15 #include <linux/interrupt.h>
 16 #include <linux/platform_device.h>
 17 #include <linux/io.h>
 18 #include <linux/gpio.h>
 19 #include <linux/mmc/host.h>
 20 #include <linux/mmc/card.h>
 21 
 22 #include <plat/gpio-cfg.h>
 23 #include <plat/sdhci.h>
 24 
 25 void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
 26 {
 27         struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 28 
 29         /* Set all the necessary GPG0/GPG1 pins to special-function 2 */
 30         s3c_gpio_cfgrange_nopull(S5PV210_GPG0(0), 2, S3C_GPIO_SFN(2));
 31 
 32         switch (width) {
 33         case 8:
 34                 /* GPG1[3:6] special-function 3 */
 35                 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3));
 36         case 4:
 37                 /* GPG0[3:6] special-function 2 */
 38                 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2));
 39         default:
 40                 break;
 41         }
 42 
 43         if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
 44                 s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP);
 45                 s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2));
 46         }
 47 }
 48 
 49 void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
 50 {
 51         struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 52 
 53         /* Set all the necessary GPG1[0:1] pins to special-function 2 */
 54         s3c_gpio_cfgrange_nopull(S5PV210_GPG1(0), 2, S3C_GPIO_SFN(2));
 55 
 56         /* Data pin GPG1[3:6] to special-function 2 */
 57         s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(2));
 58 
 59         if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
 60                 s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
 61                 s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2));
 62         }
 63 }
 64 
 65 void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
 66 {
 67         struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 68 
 69         /* Set all the necessary GPG2[0:1] pins to special-function 2 */
 70         s3c_gpio_cfgrange_nopull(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2));
 71 
 72         switch (width) {
 73         case 8:
 74                 /* Data pin GPG3[3:6] to special-function 3 */
 75                 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3));
 76         case 4:
 77                 /* Data pin GPG2[3:6] to special-function 2 */
 78                 s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2));
 79         default:
 80                 break;
 81         }
 82 
 83         if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
 84                 s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP);
 85                 s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2));
 86         }
 87 }
 88 
 89 void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
 90 {
 91         struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
 92 
 93         /* Set all the necessary GPG3[0:1] pins to special-function 2 */
 94         s3c_gpio_cfgrange_nopull(S5PV210_GPG3(0), 2, S3C_GPIO_SFN(2));
 95 
 96         /* Data pin GPG3[3:6] to special-function 2 */
 97         s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(2));
 98 
 99         if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
100                 s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP);
101                 s3c_gpio_cfgpin(S5PV210_GPG3(2), S3C_GPIO_SFN(2));
102         }
103 }
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp