setup-sdhci-gpio.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* linux/arch/arm/plat-s3c64xx/setup-sdhci-gpio.c
  2. *
  3. * Copyright 2008 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. * http://armlinux.simtec.co.uk/
  6. *
  7. * S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  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 <plat/gpio-cfg.h>
  20. #include <plat/sdhci.h>
  21. #include <mach/gpio-samsung.h>
  22. void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
  23. {
  24. struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
  25. /* Set all the necessary GPG pins to special-function 2 */
  26. s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
  27. if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
  28. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
  29. s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
  30. }
  31. }
  32. void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
  33. {
  34. struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
  35. /* Set all the necessary GPH pins to special-function 2 */
  36. s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
  37. if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
  38. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
  39. s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
  40. }
  41. }
  42. void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
  43. {
  44. /* Set all the necessary GPH pins to special-function 3 */
  45. s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
  46. /* Set all the necessary GPC pins to special-function 3 */
  47. s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
  48. }