fuse.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2010 Google, Inc.
  4. * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
  5. *
  6. * Author:
  7. * Colin Cross <ccross@android.com>
  8. */
  9. #ifndef __DRIVERS_MISC_TEGRA_FUSE_H
  10. #define __DRIVERS_MISC_TEGRA_FUSE_H
  11. #include <linux/dmaengine.h>
  12. #include <linux/types.h>
  13. struct nvmem_cell_lookup;
  14. struct nvmem_device;
  15. struct tegra_fuse;
  16. struct tegra_fuse_info {
  17. u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
  18. unsigned int size;
  19. unsigned int spare;
  20. };
  21. struct tegra_fuse_soc {
  22. void (*init)(struct tegra_fuse *fuse);
  23. void (*speedo_init)(struct tegra_sku_info *info);
  24. int (*probe)(struct tegra_fuse *fuse);
  25. const struct tegra_fuse_info *info;
  26. const struct nvmem_cell_lookup *lookups;
  27. unsigned int num_lookups;
  28. const struct nvmem_cell_info *cells;
  29. unsigned int num_cells;
  30. const struct nvmem_keepout *keepouts;
  31. unsigned int num_keepouts;
  32. const struct attribute_group *soc_attr_group;
  33. bool clk_suspend_on;
  34. };
  35. struct tegra_fuse {
  36. struct device *dev;
  37. void __iomem *base;
  38. phys_addr_t phys;
  39. struct clk *clk;
  40. struct reset_control *rst;
  41. u32 (*read_early)(struct tegra_fuse *fuse, unsigned int offset);
  42. u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
  43. const struct tegra_fuse_soc *soc;
  44. /* APBDMA on Tegra20 */
  45. struct {
  46. struct mutex lock;
  47. struct completion wait;
  48. struct dma_chan *chan;
  49. struct dma_slave_config config;
  50. dma_addr_t phys;
  51. u32 *virt;
  52. } apbdma;
  53. struct nvmem_device *nvmem;
  54. struct nvmem_cell_lookup *lookups;
  55. };
  56. void tegra_init_revision(void);
  57. void tegra_init_apbmisc(void);
  58. void tegra_acpi_init_apbmisc(void);
  59. u32 __init tegra_fuse_read_spare(unsigned int spare);
  60. u32 __init tegra_fuse_read_early(unsigned int offset);
  61. u8 tegra_get_major_rev(void);
  62. u8 tegra_get_minor_rev(void);
  63. extern const struct attribute_group tegra_soc_attr_group;
  64. #ifdef CONFIG_ARCH_TEGRA_2x_SOC
  65. void tegra20_init_speedo_data(struct tegra_sku_info *sku_info);
  66. #endif
  67. #ifdef CONFIG_ARCH_TEGRA_3x_SOC
  68. void tegra30_init_speedo_data(struct tegra_sku_info *sku_info);
  69. #endif
  70. #ifdef CONFIG_ARCH_TEGRA_114_SOC
  71. void tegra114_init_speedo_data(struct tegra_sku_info *sku_info);
  72. #endif
  73. #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
  74. void tegra124_init_speedo_data(struct tegra_sku_info *sku_info);
  75. #endif
  76. #ifdef CONFIG_ARCH_TEGRA_210_SOC
  77. void tegra210_init_speedo_data(struct tegra_sku_info *sku_info);
  78. #endif
  79. #ifdef CONFIG_ARCH_TEGRA_2x_SOC
  80. extern const struct tegra_fuse_soc tegra20_fuse_soc;
  81. #endif
  82. #ifdef CONFIG_ARCH_TEGRA_3x_SOC
  83. extern const struct tegra_fuse_soc tegra30_fuse_soc;
  84. #endif
  85. #ifdef CONFIG_ARCH_TEGRA_114_SOC
  86. extern const struct tegra_fuse_soc tegra114_fuse_soc;
  87. #endif
  88. #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
  89. extern const struct tegra_fuse_soc tegra124_fuse_soc;
  90. #endif
  91. #ifdef CONFIG_ARCH_TEGRA_210_SOC
  92. extern const struct tegra_fuse_soc tegra210_fuse_soc;
  93. #endif
  94. #ifdef CONFIG_ARCH_TEGRA_186_SOC
  95. extern const struct tegra_fuse_soc tegra186_fuse_soc;
  96. #endif
  97. #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \
  98. IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) || \
  99. IS_ENABLED(CONFIG_ARCH_TEGRA_241_SOC)
  100. extern const struct attribute_group tegra194_soc_attr_group;
  101. #endif
  102. #ifdef CONFIG_ARCH_TEGRA_194_SOC
  103. extern const struct tegra_fuse_soc tegra194_fuse_soc;
  104. #endif
  105. #ifdef CONFIG_ARCH_TEGRA_234_SOC
  106. extern const struct tegra_fuse_soc tegra234_fuse_soc;
  107. #endif
  108. #ifdef CONFIG_ARCH_TEGRA_241_SOC
  109. extern const struct tegra_fuse_soc tegra241_fuse_soc;
  110. #endif
  111. #endif