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