board-h3-mmc.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-omap1/board-h3-mmc.c
  4. *
  5. * Copyright (C) 2007 Instituto Nokia de Tecnologia - INdT
  6. * Author: Felipe Balbi <[email protected]>
  7. *
  8. * This code is based on linux/arch/arm/mach-omap2/board-n800-mmc.c, which is:
  9. * Copyright (C) 2006 Nokia Corporation
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mfd/tps65010.h>
  14. #include "common.h"
  15. #include "board-h3.h"
  16. #include "mmc.h"
  17. #if IS_ENABLED(CONFIG_MMC_OMAP)
  18. static int mmc_set_power(struct device *dev, int slot, int power_on,
  19. int vdd)
  20. {
  21. gpio_set_value(H3_TPS_GPIO_MMC_PWR_EN, power_on);
  22. return 0;
  23. }
  24. /*
  25. * H3 could use the following functions tested:
  26. * - mmc_get_cover_state that uses OMAP_MPUIO(1)
  27. * - mmc_get_wp that maybe uses OMAP_MPUIO(3)
  28. */
  29. static struct omap_mmc_platform_data mmc1_data = {
  30. .nr_slots = 1,
  31. .slots[0] = {
  32. .set_power = mmc_set_power,
  33. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  34. .name = "mmcblk",
  35. },
  36. };
  37. static struct omap_mmc_platform_data *mmc_data[OMAP16XX_NR_MMC];
  38. void __init h3_mmc_init(void)
  39. {
  40. int ret;
  41. ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
  42. if (ret < 0)
  43. return;
  44. gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
  45. mmc_data[0] = &mmc1_data;
  46. omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
  47. }
  48. #else
  49. void __init h3_mmc_init(void)
  50. {
  51. }
  52. #endif