mc.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. /* latency allowance */
  19. struct tegra_mc_la {
  20. unsigned int reg;
  21. unsigned int shift;
  22. unsigned int mask;
  23. unsigned int def;
  24. };
  25. struct tegra_mc_client {
  26. unsigned int id;
  27. const char *name;
  28. unsigned int swgroup;
  29. unsigned int fifo_size;
  30. struct tegra_smmu_enable smmu;
  31. struct tegra_mc_la la;
  32. };
  33. struct tegra_smmu_swgroup {
  34. unsigned int swgroup;
  35. unsigned int reg;
  36. };
  37. struct tegra_smmu_ops {
  38. void (*flush_dcache)(struct page *page, unsigned long offset,
  39. size_t size);
  40. };
  41. struct tegra_smmu_soc {
  42. const struct tegra_mc_client *clients;
  43. unsigned int num_clients;
  44. const struct tegra_smmu_swgroup *swgroups;
  45. unsigned int num_swgroups;
  46. bool supports_round_robin_arbitration;
  47. bool supports_request_limit;
  48. unsigned int num_asids;
  49. const struct tegra_smmu_ops *ops;
  50. };
  51. struct tegra_mc;
  52. struct tegra_smmu;
  53. #ifdef CONFIG_TEGRA_IOMMU_SMMU
  54. struct tegra_smmu *tegra_smmu_probe(struct device *dev,
  55. const struct tegra_smmu_soc *soc,
  56. struct tegra_mc *mc);
  57. #else
  58. static inline struct tegra_smmu *
  59. tegra_smmu_probe(struct device *dev, const struct tegra_smmu_soc *soc,
  60. struct tegra_mc *mc)
  61. {
  62. return NULL;
  63. }
  64. #endif
  65. struct tegra_mc_soc {
  66. const struct tegra_mc_client *clients;
  67. unsigned int num_clients;
  68. const unsigned int *emem_regs;
  69. unsigned int num_emem_regs;
  70. unsigned int num_address_bits;
  71. unsigned int atom_size;
  72. const struct tegra_smmu_soc *smmu;
  73. };
  74. struct tegra_mc {
  75. struct device *dev;
  76. struct tegra_smmu *smmu;
  77. void __iomem *regs;
  78. struct clk *clk;
  79. int irq;
  80. const struct tegra_mc_soc *soc;
  81. unsigned long tick;
  82. };
  83. #endif /* __SOC_TEGRA_MC_H__ */