mc.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_soc {
  43. const struct tegra_mc_client *clients;
  44. unsigned int num_clients;
  45. const struct tegra_smmu_swgroup *swgroups;
  46. unsigned int num_swgroups;
  47. bool supports_round_robin_arbitration;
  48. bool supports_request_limit;
  49. unsigned int num_tlb_lines;
  50. unsigned int num_asids;
  51. };
  52. struct tegra_mc;
  53. struct tegra_smmu;
  54. #ifdef CONFIG_TEGRA_IOMMU_SMMU
  55. struct tegra_smmu *tegra_smmu_probe(struct device *dev,
  56. const struct tegra_smmu_soc *soc,
  57. struct tegra_mc *mc);
  58. void tegra_smmu_remove(struct tegra_smmu *smmu);
  59. #else
  60. static inline struct tegra_smmu *
  61. tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
  62. struct tegra_mc *mc)
  63. {
  64. return NULL;
  65. }
  66. static inline void tegra_smmu_remove(struct tegra_smmu *smmu)
  67. {
  68. }
  69. #endif
  70. struct tegra_mc_soc {
  71. const struct tegra_mc_client *clients;
  72. unsigned int num_clients;
  73. const unsigned long *emem_regs;
  74. unsigned int num_emem_regs;
  75. unsigned int num_address_bits;
  76. unsigned int atom_size;
  77. u8 client_id_mask;
  78. const struct tegra_smmu_soc *smmu;
  79. u32 intmask;
  80. };
  81. struct tegra_mc {
  82. struct device *dev;
  83. struct tegra_smmu *smmu;
  84. void __iomem *regs;
  85. struct clk *clk;
  86. int irq;
  87. const struct tegra_mc_soc *soc;
  88. unsigned long tick;
  89. struct tegra_mc_timing *timings;
  90. unsigned int num_timings;
  91. };
  92. void tegra_mc_write_emem_configuration(struct tegra_mc *mc, unsigned long rate);
  93. unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *mc);
  94. #endif /* __SOC_TEGRA_MC_H__ */