Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright 2008 Simtec Electronics
0004 //  Ben Dooks <ben@simtec.co.uk>
0005 //  http://armlinux.simtec.co.uk/
0006 //
0007 // S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
0008 
0009 #include <linux/kernel.h>
0010 #include <linux/types.h>
0011 #include <linux/interrupt.h>
0012 #include <linux/platform_device.h>
0013 #include <linux/io.h>
0014 #include <linux/gpio.h>
0015 
0016 #include "gpio-cfg.h"
0017 #include "sdhci.h"
0018 #include "gpio-samsung.h"
0019 
0020 void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
0021 {
0022     struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
0023 
0024     /* Set all the necessary GPG pins to special-function 2 */
0025     s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
0026 
0027     if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
0028         s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
0029         s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
0030     }
0031 }
0032 
0033 void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
0034 {
0035     struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
0036 
0037     /* Set all the necessary GPH pins to special-function 2 */
0038     s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
0039 
0040     if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
0041         s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
0042         s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
0043     }
0044 }
0045 
0046 void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
0047 {
0048     /* Set all the necessary GPH pins to special-function 3 */
0049     s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
0050 
0051     /* Set all the necessary GPC pins to special-function 3 */
0052     s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
0053 }