dev-hsmmc2.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* linux/arch/arm/plat-s3c/dev-hsmmc2.c
  2. *
  3. * Copyright (c) 2009 Samsung Electronics
  4. * Copyright (c) 2009 Maurus Cuelenaere
  5. *
  6. * Based on arch/arm/plat-s3c/dev-hsmmc1.c
  7. * original file Copyright (c) 2008 Simtec Electronics
  8. *
  9. * S3C series device definition for hsmmc device 2
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/mmc/host.h>
  18. #include <mach/map.h>
  19. #include <plat/sdhci.h>
  20. #include <plat/devs.h>
  21. #define S3C_SZ_HSMMC (0x1000)
  22. static struct resource s3c_hsmmc2_resource[] = {
  23. [0] = {
  24. .start = S3C_PA_HSMMC2,
  25. .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1,
  26. .flags = IORESOURCE_MEM,
  27. },
  28. [1] = {
  29. .start = IRQ_HSMMC2,
  30. .end = IRQ_HSMMC2,
  31. .flags = IORESOURCE_IRQ,
  32. }
  33. };
  34. static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL;
  35. struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
  36. .max_width = 4,
  37. .host_caps = (MMC_CAP_4_BIT_DATA |
  38. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  39. .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
  40. };
  41. struct platform_device s3c_device_hsmmc2 = {
  42. .name = "s3c-sdhci",
  43. .id = 2,
  44. .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource),
  45. .resource = s3c_hsmmc2_resource,
  46. .dev = {
  47. .dma_mask = &s3c_device_hsmmc2_dmamask,
  48. .coherent_dma_mask = 0xffffffffUL,
  49. .platform_data = &s3c_hsmmc2_def_platdata,
  50. },
  51. };
  52. void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
  53. {
  54. struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
  55. set->cd_type = pd->cd_type;
  56. set->ext_cd_init = pd->ext_cd_init;
  57. set->ext_cd_cleanup = pd->ext_cd_cleanup;
  58. set->ext_cd_gpio = pd->ext_cd_gpio;
  59. set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
  60. if (pd->max_width)
  61. set->max_width = pd->max_width;
  62. if (pd->cfg_gpio)
  63. set->cfg_gpio = pd->cfg_gpio;
  64. if (pd->cfg_card)
  65. set->cfg_card = pd->cfg_card;
  66. if (pd->host_caps)
  67. set->host_caps |= pd->host_caps;
  68. if (pd->clk_type)
  69. set->clk_type = pd->clk_type;
  70. }