devices-common.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) ST-Ericsson SA 2010
  3. *
  4. * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
  5. * License terms: GNU General Public License (GPL), version 2.
  6. */
  7. #ifndef __DEVICES_COMMON_H
  8. #define __DEVICES_COMMON_H
  9. extern struct amba_device *
  10. dbx500_add_amba_device(struct device *parent, const char *name, resource_size_t base,
  11. int irq, void *pdata, unsigned int periphid);
  12. extern struct platform_device *
  13. dbx500_add_platform_device_4k1irq(const char *name, int id,
  14. resource_size_t base,
  15. int irq, void *pdata);
  16. struct spi_master_cntlr;
  17. static inline struct amba_device *
  18. dbx500_add_msp_spi(struct device *parent, const char *name,
  19. resource_size_t base, int irq,
  20. struct spi_master_cntlr *pdata)
  21. {
  22. return dbx500_add_amba_device(parent, name, base, irq,
  23. pdata, 0);
  24. }
  25. static inline struct amba_device *
  26. dbx500_add_spi(struct device *parent, const char *name, resource_size_t base,
  27. int irq, struct spi_master_cntlr *pdata,
  28. u32 periphid)
  29. {
  30. return dbx500_add_amba_device(parent, name, base, irq,
  31. pdata, periphid);
  32. }
  33. struct mmci_platform_data;
  34. static inline struct amba_device *
  35. dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base,
  36. int irq, struct mmci_platform_data *pdata, u32 periphid)
  37. {
  38. return dbx500_add_amba_device(parent, name, base, irq,
  39. pdata, periphid);
  40. }
  41. struct amba_pl011_data;
  42. static inline struct amba_device *
  43. dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
  44. int irq, struct amba_pl011_data *pdata)
  45. {
  46. return dbx500_add_amba_device(parent, name, base, irq, pdata, 0);
  47. }
  48. struct nmk_i2c_controller;
  49. static inline struct platform_device *
  50. dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
  51. struct nmk_i2c_controller *pdata)
  52. {
  53. return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
  54. pdata);
  55. }
  56. struct msp_i2s_platform_data;
  57. static inline struct platform_device *
  58. dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
  59. struct msp_i2s_platform_data *pdata)
  60. {
  61. return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq,
  62. pdata);
  63. }
  64. static inline struct amba_device *
  65. dbx500_add_rtc(struct device *parent, resource_size_t base, int irq)
  66. {
  67. return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0);
  68. }
  69. struct nmk_gpio_platform_data;
  70. void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
  71. int irq, struct nmk_gpio_platform_data *pdata);
  72. #endif