xref: /linux/drivers/soc/tegra/fuse/fuse.h (revision f86fd32d)
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 
10 #ifndef __DRIVERS_MISC_TEGRA_FUSE_H
11 #define __DRIVERS_MISC_TEGRA_FUSE_H
12 
13 #include <linux/dmaengine.h>
14 #include <linux/types.h>
15 
16 struct nvmem_cell_lookup;
17 struct nvmem_device;
18 struct tegra_fuse;
19 
20 struct tegra_fuse_info {
21 	u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
22 	unsigned int size;
23 	unsigned int spare;
24 };
25 
26 struct tegra_fuse_soc {
27 	void (*init)(struct tegra_fuse *fuse);
28 	void (*speedo_init)(struct tegra_sku_info *info);
29 	int (*probe)(struct tegra_fuse *fuse);
30 
31 	const struct tegra_fuse_info *info;
32 
33 	const struct nvmem_cell_lookup *lookups;
34 	unsigned int num_lookups;
35 };
36 
37 struct tegra_fuse {
38 	struct device *dev;
39 	void __iomem *base;
40 	phys_addr_t phys;
41 	struct clk *clk;
42 
43 	u32 (*read_early)(struct tegra_fuse *fuse, unsigned int offset);
44 	u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
45 	const struct tegra_fuse_soc *soc;
46 
47 	/* APBDMA on Tegra20 */
48 	struct {
49 		struct mutex lock;
50 		struct completion wait;
51 		struct dma_chan *chan;
52 		struct dma_slave_config config;
53 		dma_addr_t phys;
54 		u32 *virt;
55 	} apbdma;
56 
57 	struct nvmem_device *nvmem;
58 	struct nvmem_cell_lookup *lookups;
59 };
60 
61 void tegra_init_revision(void);
62 void tegra_init_apbmisc(void);
63 
64 bool __init tegra_fuse_read_spare(unsigned int spare);
65 u32 __init tegra_fuse_read_early(unsigned int offset);
66 
67 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
68 void tegra20_init_speedo_data(struct tegra_sku_info *sku_info);
69 #endif
70 
71 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
72 void tegra30_init_speedo_data(struct tegra_sku_info *sku_info);
73 #endif
74 
75 #ifdef CONFIG_ARCH_TEGRA_114_SOC
76 void tegra114_init_speedo_data(struct tegra_sku_info *sku_info);
77 #endif
78 
79 #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
80 void tegra124_init_speedo_data(struct tegra_sku_info *sku_info);
81 #endif
82 
83 #ifdef CONFIG_ARCH_TEGRA_210_SOC
84 void tegra210_init_speedo_data(struct tegra_sku_info *sku_info);
85 #endif
86 
87 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
88 extern const struct tegra_fuse_soc tegra20_fuse_soc;
89 #endif
90 
91 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
92 extern const struct tegra_fuse_soc tegra30_fuse_soc;
93 #endif
94 
95 #ifdef CONFIG_ARCH_TEGRA_114_SOC
96 extern const struct tegra_fuse_soc tegra114_fuse_soc;
97 #endif
98 
99 #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
100 extern const struct tegra_fuse_soc tegra124_fuse_soc;
101 #endif
102 
103 #ifdef CONFIG_ARCH_TEGRA_210_SOC
104 extern const struct tegra_fuse_soc tegra210_fuse_soc;
105 #endif
106 
107 #ifdef CONFIG_ARCH_TEGRA_186_SOC
108 extern const struct tegra_fuse_soc tegra186_fuse_soc;
109 #endif
110 
111 #ifdef CONFIG_ARCH_TEGRA_194_SOC
112 extern const struct tegra_fuse_soc tegra194_fuse_soc;
113 #endif
114 
115 #endif
116