setup-sdhci-gpio-s3c64xx.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // Copyright 2008 Simtec Electronics
  4. // Ben Dooks <[email protected]>
  5. // http://armlinux.simtec.co.uk/
  6. //
  7. // S3C64XX - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
  8. #include <linux/kernel.h>
  9. #include <linux/types.h>
  10. #include <linux/interrupt.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/io.h>
  13. #include <linux/gpio.h>
  14. #include "gpio-cfg.h"
  15. #include "sdhci.h"
  16. #include "gpio-samsung.h"
  17. void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
  18. {
  19. struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
  20. /* Set all the necessary GPG pins to special-function 2 */
  21. s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
  22. if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
  23. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
  24. s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
  25. }
  26. }
  27. void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
  28. {
  29. struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
  30. /* Set all the necessary GPH pins to special-function 2 */
  31. s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
  32. if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
  33. s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
  34. s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
  35. }
  36. }
  37. void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
  38. {
  39. /* Set all the necessary GPH pins to special-function 3 */
  40. s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
  41. /* Set all the necessary GPC pins to special-function 3 */
  42. s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
  43. }