.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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 | | - * |
---|
16 | 4 | */ |
---|
17 | 5 | |
---|
18 | 6 | #include <linux/device.h> |
---|
.. | .. |
---|
20 | 8 | #include <linux/err.h> |
---|
21 | 9 | #include <linux/io.h> |
---|
22 | 10 | #include <linux/kernel.h> |
---|
| 11 | +#include <linux/nvmem-consumer.h> |
---|
23 | 12 | #include <linux/of_device.h> |
---|
24 | 13 | #include <linux/of_address.h> |
---|
25 | 14 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
123 | 112 | .init = tegra30_fuse_init, |
---|
124 | 113 | .speedo_init = tegra30_init_speedo_data, |
---|
125 | 114 | .info = &tegra30_fuse_info, |
---|
| 115 | + .soc_attr_group = &tegra_soc_attr_group, |
---|
126 | 116 | }; |
---|
127 | 117 | #endif |
---|
128 | 118 | |
---|
.. | .. |
---|
137 | 127 | .init = tegra30_fuse_init, |
---|
138 | 128 | .speedo_init = tegra114_init_speedo_data, |
---|
139 | 129 | .info = &tegra114_fuse_info, |
---|
| 130 | + .soc_attr_group = &tegra_soc_attr_group, |
---|
140 | 131 | }; |
---|
141 | 132 | #endif |
---|
142 | 133 | |
---|
143 | 134 | #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 | + |
---|
144 | 199 | static const struct tegra_fuse_info tegra124_fuse_info = { |
---|
145 | 200 | .read = tegra30_fuse_read, |
---|
146 | 201 | .size = 0x300, |
---|
.. | .. |
---|
151 | 206 | .init = tegra30_fuse_init, |
---|
152 | 207 | .speedo_init = tegra124_init_speedo_data, |
---|
153 | 208 | .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, |
---|
154 | 212 | }; |
---|
155 | 213 | #endif |
---|
156 | 214 | |
---|
157 | 215 | #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 | + |
---|
158 | 285 | static const struct tegra_fuse_info tegra210_fuse_info = { |
---|
159 | 286 | .read = tegra30_fuse_read, |
---|
160 | 287 | .size = 0x300, |
---|
.. | .. |
---|
165 | 292 | .init = tegra30_fuse_init, |
---|
166 | 293 | .speedo_init = tegra210_init_speedo_data, |
---|
167 | 294 | .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, |
---|
168 | 298 | }; |
---|
169 | 299 | #endif |
---|
170 | 300 | |
---|
171 | 301 | #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 | + |
---|
172 | 316 | static const struct tegra_fuse_info tegra186_fuse_info = { |
---|
173 | 317 | .read = tegra30_fuse_read, |
---|
174 | 318 | .size = 0x300, |
---|
.. | .. |
---|
178 | 322 | const struct tegra_fuse_soc tegra186_fuse_soc = { |
---|
179 | 323 | .init = tegra30_fuse_init, |
---|
180 | 324 | .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, |
---|
181 | 388 | }; |
---|
182 | 389 | #endif |
---|