hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/soc/tegra/fuse/fuse-tegra30.c
....@@ -1,18 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify it
5
- * under the terms and conditions of the GNU General Public License,
6
- * version 2, as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope it will be useful, but WITHOUT
9
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
- * more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
15
- *
164 */
175
186 #include <linux/device.h>
....@@ -20,6 +8,7 @@
208 #include <linux/err.h>
219 #include <linux/io.h>
2210 #include <linux/kernel.h>
11
+#include <linux/nvmem-consumer.h>
2312 #include <linux/of_device.h>
2413 #include <linux/of_address.h>
2514 #include <linux/platform_device.h>
....@@ -123,6 +112,7 @@
123112 .init = tegra30_fuse_init,
124113 .speedo_init = tegra30_init_speedo_data,
125114 .info = &tegra30_fuse_info,
115
+ .soc_attr_group = &tegra_soc_attr_group,
126116 };
127117 #endif
128118
....@@ -137,10 +127,75 @@
137127 .init = tegra30_fuse_init,
138128 .speedo_init = tegra114_init_speedo_data,
139129 .info = &tegra114_fuse_info,
130
+ .soc_attr_group = &tegra_soc_attr_group,
140131 };
141132 #endif
142133
143134 #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
135
+static const struct nvmem_cell_lookup tegra124_fuse_lookups[] = {
136
+ {
137
+ .nvmem_name = "fuse",
138
+ .cell_name = "xusb-pad-calibration",
139
+ .dev_id = "7009f000.padctl",
140
+ .con_id = "calibration",
141
+ }, {
142
+ .nvmem_name = "fuse",
143
+ .cell_name = "sata-calibration",
144
+ .dev_id = "70020000.sata",
145
+ .con_id = "calibration",
146
+ }, {
147
+ .nvmem_name = "fuse",
148
+ .cell_name = "tsensor-common",
149
+ .dev_id = "700e2000.thermal-sensor",
150
+ .con_id = "common",
151
+ }, {
152
+ .nvmem_name = "fuse",
153
+ .cell_name = "tsensor-realignment",
154
+ .dev_id = "700e2000.thermal-sensor",
155
+ .con_id = "realignment",
156
+ }, {
157
+ .nvmem_name = "fuse",
158
+ .cell_name = "tsensor-cpu0",
159
+ .dev_id = "700e2000.thermal-sensor",
160
+ .con_id = "cpu0",
161
+ }, {
162
+ .nvmem_name = "fuse",
163
+ .cell_name = "tsensor-cpu1",
164
+ .dev_id = "700e2000.thermal-sensor",
165
+ .con_id = "cpu1",
166
+ }, {
167
+ .nvmem_name = "fuse",
168
+ .cell_name = "tsensor-cpu2",
169
+ .dev_id = "700e2000.thermal-sensor",
170
+ .con_id = "cpu2",
171
+ }, {
172
+ .nvmem_name = "fuse",
173
+ .cell_name = "tsensor-cpu3",
174
+ .dev_id = "700e2000.thermal-sensor",
175
+ .con_id = "cpu3",
176
+ }, {
177
+ .nvmem_name = "fuse",
178
+ .cell_name = "tsensor-mem0",
179
+ .dev_id = "700e2000.thermal-sensor",
180
+ .con_id = "mem0",
181
+ }, {
182
+ .nvmem_name = "fuse",
183
+ .cell_name = "tsensor-mem1",
184
+ .dev_id = "700e2000.thermal-sensor",
185
+ .con_id = "mem1",
186
+ }, {
187
+ .nvmem_name = "fuse",
188
+ .cell_name = "tsensor-gpu",
189
+ .dev_id = "700e2000.thermal-sensor",
190
+ .con_id = "gpu",
191
+ }, {
192
+ .nvmem_name = "fuse",
193
+ .cell_name = "tsensor-pllx",
194
+ .dev_id = "700e2000.thermal-sensor",
195
+ .con_id = "pllx",
196
+ },
197
+};
198
+
144199 static const struct tegra_fuse_info tegra124_fuse_info = {
145200 .read = tegra30_fuse_read,
146201 .size = 0x300,
....@@ -151,10 +206,82 @@
151206 .init = tegra30_fuse_init,
152207 .speedo_init = tegra124_init_speedo_data,
153208 .info = &tegra124_fuse_info,
209
+ .lookups = tegra124_fuse_lookups,
210
+ .num_lookups = ARRAY_SIZE(tegra124_fuse_lookups),
211
+ .soc_attr_group = &tegra_soc_attr_group,
154212 };
155213 #endif
156214
157215 #if defined(CONFIG_ARCH_TEGRA_210_SOC)
216
+static const struct nvmem_cell_lookup tegra210_fuse_lookups[] = {
217
+ {
218
+ .nvmem_name = "fuse",
219
+ .cell_name = "tsensor-cpu1",
220
+ .dev_id = "700e2000.thermal-sensor",
221
+ .con_id = "cpu1",
222
+ }, {
223
+ .nvmem_name = "fuse",
224
+ .cell_name = "tsensor-cpu2",
225
+ .dev_id = "700e2000.thermal-sensor",
226
+ .con_id = "cpu2",
227
+ }, {
228
+ .nvmem_name = "fuse",
229
+ .cell_name = "tsensor-cpu0",
230
+ .dev_id = "700e2000.thermal-sensor",
231
+ .con_id = "cpu0",
232
+ }, {
233
+ .nvmem_name = "fuse",
234
+ .cell_name = "xusb-pad-calibration",
235
+ .dev_id = "7009f000.padctl",
236
+ .con_id = "calibration",
237
+ }, {
238
+ .nvmem_name = "fuse",
239
+ .cell_name = "tsensor-cpu3",
240
+ .dev_id = "700e2000.thermal-sensor",
241
+ .con_id = "cpu3",
242
+ }, {
243
+ .nvmem_name = "fuse",
244
+ .cell_name = "sata-calibration",
245
+ .dev_id = "70020000.sata",
246
+ .con_id = "calibration",
247
+ }, {
248
+ .nvmem_name = "fuse",
249
+ .cell_name = "tsensor-gpu",
250
+ .dev_id = "700e2000.thermal-sensor",
251
+ .con_id = "gpu",
252
+ }, {
253
+ .nvmem_name = "fuse",
254
+ .cell_name = "tsensor-mem0",
255
+ .dev_id = "700e2000.thermal-sensor",
256
+ .con_id = "mem0",
257
+ }, {
258
+ .nvmem_name = "fuse",
259
+ .cell_name = "tsensor-mem1",
260
+ .dev_id = "700e2000.thermal-sensor",
261
+ .con_id = "mem1",
262
+ }, {
263
+ .nvmem_name = "fuse",
264
+ .cell_name = "tsensor-pllx",
265
+ .dev_id = "700e2000.thermal-sensor",
266
+ .con_id = "pllx",
267
+ }, {
268
+ .nvmem_name = "fuse",
269
+ .cell_name = "tsensor-common",
270
+ .dev_id = "700e2000.thermal-sensor",
271
+ .con_id = "common",
272
+ }, {
273
+ .nvmem_name = "fuse",
274
+ .cell_name = "gpu-calibration",
275
+ .dev_id = "57000000.gpu",
276
+ .con_id = "calibration",
277
+ }, {
278
+ .nvmem_name = "fuse",
279
+ .cell_name = "xusb-pad-calibration-ext",
280
+ .dev_id = "7009f000.padctl",
281
+ .con_id = "calibration-ext",
282
+ },
283
+};
284
+
158285 static const struct tegra_fuse_info tegra210_fuse_info = {
159286 .read = tegra30_fuse_read,
160287 .size = 0x300,
....@@ -165,10 +292,27 @@
165292 .init = tegra30_fuse_init,
166293 .speedo_init = tegra210_init_speedo_data,
167294 .info = &tegra210_fuse_info,
295
+ .lookups = tegra210_fuse_lookups,
296
+ .num_lookups = ARRAY_SIZE(tegra210_fuse_lookups),
297
+ .soc_attr_group = &tegra_soc_attr_group,
168298 };
169299 #endif
170300
171301 #if defined(CONFIG_ARCH_TEGRA_186_SOC)
302
+static const struct nvmem_cell_lookup tegra186_fuse_lookups[] = {
303
+ {
304
+ .nvmem_name = "fuse",
305
+ .cell_name = "xusb-pad-calibration",
306
+ .dev_id = "3520000.padctl",
307
+ .con_id = "calibration",
308
+ }, {
309
+ .nvmem_name = "fuse",
310
+ .cell_name = "xusb-pad-calibration-ext",
311
+ .dev_id = "3520000.padctl",
312
+ .con_id = "calibration-ext",
313
+ },
314
+};
315
+
172316 static const struct tegra_fuse_info tegra186_fuse_info = {
173317 .read = tegra30_fuse_read,
174318 .size = 0x300,
....@@ -178,5 +322,68 @@
178322 const struct tegra_fuse_soc tegra186_fuse_soc = {
179323 .init = tegra30_fuse_init,
180324 .info = &tegra186_fuse_info,
325
+ .lookups = tegra186_fuse_lookups,
326
+ .num_lookups = ARRAY_SIZE(tegra186_fuse_lookups),
327
+ .soc_attr_group = &tegra_soc_attr_group,
328
+};
329
+#endif
330
+
331
+#if defined(CONFIG_ARCH_TEGRA_194_SOC)
332
+static const struct nvmem_cell_lookup tegra194_fuse_lookups[] = {
333
+ {
334
+ .nvmem_name = "fuse",
335
+ .cell_name = "xusb-pad-calibration",
336
+ .dev_id = "3520000.padctl",
337
+ .con_id = "calibration",
338
+ }, {
339
+ .nvmem_name = "fuse",
340
+ .cell_name = "xusb-pad-calibration-ext",
341
+ .dev_id = "3520000.padctl",
342
+ .con_id = "calibration-ext",
343
+ },
344
+};
345
+
346
+static const struct tegra_fuse_info tegra194_fuse_info = {
347
+ .read = tegra30_fuse_read,
348
+ .size = 0x300,
349
+ .spare = 0x280,
350
+};
351
+
352
+const struct tegra_fuse_soc tegra194_fuse_soc = {
353
+ .init = tegra30_fuse_init,
354
+ .info = &tegra194_fuse_info,
355
+ .lookups = tegra194_fuse_lookups,
356
+ .num_lookups = ARRAY_SIZE(tegra194_fuse_lookups),
357
+ .soc_attr_group = &tegra194_soc_attr_group,
358
+};
359
+#endif
360
+
361
+#if defined(CONFIG_ARCH_TEGRA_234_SOC)
362
+static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = {
363
+ {
364
+ .nvmem_name = "fuse",
365
+ .cell_name = "xusb-pad-calibration",
366
+ .dev_id = "3520000.padctl",
367
+ .con_id = "calibration",
368
+ }, {
369
+ .nvmem_name = "fuse",
370
+ .cell_name = "xusb-pad-calibration-ext",
371
+ .dev_id = "3520000.padctl",
372
+ .con_id = "calibration-ext",
373
+ },
374
+};
375
+
376
+static const struct tegra_fuse_info tegra234_fuse_info = {
377
+ .read = tegra30_fuse_read,
378
+ .size = 0x300,
379
+ .spare = 0x280,
380
+};
381
+
382
+const struct tegra_fuse_soc tegra234_fuse_soc = {
383
+ .init = tegra30_fuse_init,
384
+ .info = &tegra234_fuse_info,
385
+ .lookups = tegra234_fuse_lookups,
386
+ .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups),
387
+ .soc_attr_group = &tegra194_soc_attr_group,
181388 };
182389 #endif