mc.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C) 2014 NVIDIA Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __SOC_TEGRA_MC_H__
  9. #define __SOC_TEGRA_MC_H__
  10. #include <linux/types.h>
  11. struct clk;
  12. struct device;
  13. struct page;
  14. struct tegra_smmu_enable {
  15. unsigned int reg;
  16. unsigned int bit;
  17. };
  18. struct tegra_mc_timing {
  19. unsigned long rate;
  20. u32 *emem_data;
  21. };
  22. /* latency allowance */
  23. struct tegra_mc_la {
  24. unsigned int reg;
  25. unsigned int shift;
  26. unsigned int mask;
  27. unsigned int def;
  28. };
  29. struct tegra_mc_client {
  30. unsigned int id;
  31. const char *name;
  32. unsigned int swgroup;
  33. unsigned int fifo_size;
  34. struct tegra_smmu_enable smmu;
  35. struct tegra_mc_la la;
  36. };
  37. struct tegra_smmu_swgroup {
  38. const char *name;
  39. unsigned int swgroup;
  40. unsigned int reg;
  41. };
  42. struct tegra_smmu_ops {
  43. void (*flush_dcache)(struct page *page, unsigned long offset,
  44. size_t size);
  45. };
  46. struct tegra_smmu_soc {
  47. const struct tegra_mc_client *clients;
  48. unsigned int num_clients;
  49. const struct tegra_smmu_swgroup *swgroups;
  50. unsigned int num_swgroups;
  51. bool supports_round_robin_arbitration;
  52. bool supports_request_limit;
  53. unsigned int num_asids;
  54. const struct tegra_smmu_ops *ops;
  55. };
  56. struct tegra_mc;
  57. struct tegra_smmu;
  58. #ifdef CONFIG_TEGRA_IOMMU_SMMU
  59. struct tegra_smmu *tegra_smmu_probe(struct device *dev,
  60. const struct tegra_smmu_soc *soc,
  61. struct tegra_mc *mc);
  62. void tegra_smmu_remove(struct tegra_smmu *smmu);
  63. #else
  64. static inline struct tegra_smmu *
  65. tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
  66. struct tegra_mc *mc)
  67. {
  68. return NULL;
  69. }
  70. static inline void tegra_smmu_remove(struct tegra_smmu *smmu)
  71. {
  72. }
  73. #endif
  74. struct tegra_mc_soc {
  75. const struct tegra_mc_client *clients;
  76. unsigned int num_clients;
  77. const unsigned long *emem_regs;
  78. unsigned int num_emem_regs;
  79. unsigned int num_address_bits;
  80. unsigned int atom_size;
  81. const struct tegra_smmu_soc *smmu;
  82. };
  83. struct tegra_mc {
  84. struct device *dev;
  85. struct tegra_smmu *smmu;
  86. void __iomem *regs;
  87. struct clk *clk;
  88. int irq;
  89. const struct tegra_mc_soc *soc;
  90. unsigned long tick;
  91. struct tegra_mc_timing *timings;
  92. unsigned int num_timings;
  93. };
  94. void tegra_mc_write_emem_configuration(struct tegra_mc *mc, unsigned long rate);
  95. unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc);
  96. #endif /* __SOC_TEGRA_MC_H__ */