2019-05-29 17:17:56 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-06-12 19:36:37 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Google, Inc.
|
|
|
|
* Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
*
|
|
|
|
* Author:
|
|
|
|
* Colin Cross <ccross@android.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRIVERS_MISC_TEGRA_FUSE_H
|
|
|
|
#define __DRIVERS_MISC_TEGRA_FUSE_H
|
|
|
|
|
2015-04-29 17:54:04 +03:00
|
|
|
#include <linux/dmaengine.h>
|
|
|
|
#include <linux/types.h>
|
2014-06-12 19:36:37 +04:00
|
|
|
|
2019-08-20 17:01:04 +03:00
|
|
|
struct nvmem_cell_lookup;
|
2019-08-20 16:57:16 +03:00
|
|
|
struct nvmem_device;
|
2015-04-29 17:54:04 +03:00
|
|
|
struct tegra_fuse;
|
|
|
|
|
|
|
|
struct tegra_fuse_info {
|
|
|
|
u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
|
|
|
|
unsigned int size;
|
|
|
|
unsigned int spare;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_fuse_soc {
|
|
|
|
void (*init)(struct tegra_fuse *fuse);
|
|
|
|
void (*speedo_init)(struct tegra_sku_info *info);
|
|
|
|
int (*probe)(struct tegra_fuse *fuse);
|
|
|
|
|
|
|
|
const struct tegra_fuse_info *info;
|
2019-08-20 17:01:04 +03:00
|
|
|
|
|
|
|
const struct nvmem_cell_lookup *lookups;
|
|
|
|
unsigned int num_lookups;
|
soc/tegra: fuse: Add custom SoC attributes
Add a custom SoC attribute for Tegra to expose the HIDREV register
fields to userspace via the sysfs. This register provides additional
details about the type of device (eg, silicon, FPGA, etc) as well as
revision. Exposing this information is useful for identifying the
exact device revision and device type.
For Tegra devices up until Tegra186, the majorrev and minorrev fields of
the HIDREV register are used to determine the device revision and device
type. For Tegra194, the majorrev and minorrev fields only determine the
revision. Starting with Tegra194, there is an additional field,
pre_si_platform (which occupies bits 20-23), that now determines device
type. Therefore, for all Tegra devices, add a custom SoC attribute for
the majorrev and minorrev fields and for Tegra194 add an additional
attribute for the pre_si_platform field.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2020-04-17 15:39:48 +03:00
|
|
|
|
|
|
|
const struct attribute_group *soc_attr_group;
|
2015-04-29 17:54:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_fuse {
|
|
|
|
struct device *dev;
|
|
|
|
void __iomem *base;
|
|
|
|
phys_addr_t phys;
|
|
|
|
struct clk *clk;
|
|
|
|
|
|
|
|
u32 (*read_early)(struct tegra_fuse *fuse, unsigned int offset);
|
|
|
|
u32 (*read)(struct tegra_fuse *fuse, unsigned int offset);
|
|
|
|
const struct tegra_fuse_soc *soc;
|
|
|
|
|
|
|
|
/* APBDMA on Tegra20 */
|
|
|
|
struct {
|
|
|
|
struct mutex lock;
|
|
|
|
struct completion wait;
|
|
|
|
struct dma_chan *chan;
|
|
|
|
struct dma_slave_config config;
|
|
|
|
dma_addr_t phys;
|
|
|
|
u32 *virt;
|
|
|
|
} apbdma;
|
2019-08-20 16:57:16 +03:00
|
|
|
|
|
|
|
struct nvmem_device *nvmem;
|
2019-08-20 17:01:04 +03:00
|
|
|
struct nvmem_cell_lookup *lookups;
|
2015-04-29 17:54:04 +03:00
|
|
|
};
|
2014-06-12 19:36:37 +04:00
|
|
|
|
|
|
|
void tegra_init_revision(void);
|
|
|
|
void tegra_init_apbmisc(void);
|
|
|
|
|
2015-04-29 17:54:04 +03:00
|
|
|
bool __init tegra_fuse_read_spare(unsigned int spare);
|
|
|
|
u32 __init tegra_fuse_read_early(unsigned int offset);
|
|
|
|
|
soc/tegra: fuse: Add custom SoC attributes
Add a custom SoC attribute for Tegra to expose the HIDREV register
fields to userspace via the sysfs. This register provides additional
details about the type of device (eg, silicon, FPGA, etc) as well as
revision. Exposing this information is useful for identifying the
exact device revision and device type.
For Tegra devices up until Tegra186, the majorrev and minorrev fields of
the HIDREV register are used to determine the device revision and device
type. For Tegra194, the majorrev and minorrev fields only determine the
revision. Starting with Tegra194, there is an additional field,
pre_si_platform (which occupies bits 20-23), that now determines device
type. Therefore, for all Tegra devices, add a custom SoC attribute for
the majorrev and minorrev fields and for Tegra194 add an additional
attribute for the pre_si_platform field.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2020-04-17 15:39:48 +03:00
|
|
|
u8 tegra_get_major_rev(void);
|
|
|
|
u8 tegra_get_minor_rev(void);
|
|
|
|
|
|
|
|
extern const struct attribute_group tegra_soc_attr_group;
|
|
|
|
|
2014-06-12 19:36:37 +04:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
|
|
|
|
void tegra20_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
|
|
|
|
void tegra30_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_114_SOC
|
|
|
|
void tegra114_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
|
|
#endif
|
|
|
|
|
2015-04-29 17:54:04 +03:00
|
|
|
#if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
|
2014-06-12 19:36:37 +04:00
|
|
|
void tegra124_init_speedo_data(struct tegra_sku_info *sku_info);
|
2015-04-29 17:54:04 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-29 17:55:57 +03:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_210_SOC
|
|
|
|
void tegra210_init_speedo_data(struct tegra_sku_info *sku_info);
|
|
|
|
#endif
|
|
|
|
|
2015-04-29 17:54:04 +03:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra20_fuse_soc;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra30_fuse_soc;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_TEGRA_114_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra114_fuse_soc;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
|
|
|
|
extern const struct tegra_fuse_soc tegra124_fuse_soc;
|
2014-06-12 19:36:37 +04:00
|
|
|
#endif
|
|
|
|
|
2015-04-29 17:55:57 +03:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_210_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra210_fuse_soc;
|
|
|
|
#endif
|
|
|
|
|
2017-03-06 16:47:20 +03:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_186_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra186_fuse_soc;
|
|
|
|
#endif
|
|
|
|
|
2020-01-03 11:30:17 +03:00
|
|
|
#ifdef CONFIG_ARCH_TEGRA_194_SOC
|
|
|
|
extern const struct tegra_fuse_soc tegra194_fuse_soc;
|
soc/tegra: fuse: Add custom SoC attributes
Add a custom SoC attribute for Tegra to expose the HIDREV register
fields to userspace via the sysfs. This register provides additional
details about the type of device (eg, silicon, FPGA, etc) as well as
revision. Exposing this information is useful for identifying the
exact device revision and device type.
For Tegra devices up until Tegra186, the majorrev and minorrev fields of
the HIDREV register are used to determine the device revision and device
type. For Tegra194, the majorrev and minorrev fields only determine the
revision. Starting with Tegra194, there is an additional field,
pre_si_platform (which occupies bits 20-23), that now determines device
type. Therefore, for all Tegra devices, add a custom SoC attribute for
the majorrev and minorrev fields and for Tegra194 add an additional
attribute for the pre_si_platform field.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2020-04-17 15:39:48 +03:00
|
|
|
extern const struct attribute_group tegra194_soc_attr_group;
|
2020-01-03 11:30:17 +03:00
|
|
|
#endif
|
|
|
|
|
2014-06-12 19:36:37 +04:00
|
|
|
#endif
|