mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 05:24:47 +08:00
eab3540562
Various driver updates for platforms: - Nvidia: Fuse support for Tegra194, continued memory controller pieces for Tegra30 - NXP/FSL: Refactorings of QuickEngine drivers to support ARM/ARM64/PPC - NXP/FSL: i.MX8MP SoC driver pieces - TI Keystone: ring accelerator driver - Qualcomm: SCM driver cleanup/refactoring + support for new SoCs. - Xilinx ZynqMP: feature checking interface for firmware. Mailbox communication for power management - Overall support patch set for cpuidle on more complex hierarchies (PSCI-based) + Misc cleanups, refactorings of Marvell, TI, other platforms. -----BEGIN PGP SIGNATURE----- iQJDBAABCAAtFiEElf+HevZ4QCAJmMQ+jBrnPN6EHHcFAl4+lTYPHG9sb2ZAbGl4 b20ubmV0AAoJEIwa5zzehBx3nQcQAJm91+6hZbmMjlBySGS7ISjYvOcrI/hMgiOl uhhEP0Dcylvf9A9x3wcIbLwixe+2pvie9DQh2u5F80ShYimidtFi/2xCfuTb9fKu sxxKjrXWyVKhkpW0z+tedY08ftVhkwwcyD4m2C7uVl6AwTP7c367vFeU7XjF2APn drfgmgbjm8U3XbSyAqv+k6z6tyqaCnFM7vbPupSKHgHJ3mfByxOa+XyBN2RdgBbs 0KrVfbXGv80zFIFrMPwaWG7G52bu7K68nVdgy44MpKdRZ6QTjhnR+kerFxHsYgV4 bM55Fya52nTCSTGdKaQakDtKwbAUdCDTSkxgOHGcQoyFi0R/VaEUJtcysnvLbI6c +n/yFIzGyEdXcvIzfv2SoDYhogw19I6RR/M9K5Ni29eazkDVYx2z3rI+2QYeqCiF u7cq52gW6JLP0SI/9kuUrRFiR8v19Ixap7qokAxgqQwYB3NzT8a7WsYPkzdpDZGQ ETSDFMyBWT6UvBe/HWkQluBabbet53rG8BF0OHFrQuMK0u/ieKgSGuTB9XN2djEW PHMOMz2vhi+8XTfpkskhF2tTxlA/k4R6QwCdIMpIkMRVnVQCh1XdPr3Fi2NrgB+S kIXHD4vV6zLYh04zHyKewSPHAXWgraFpg2qKnvL5+KWMTnW6QH+RNjOt9xKDNXOd +iDXpOad =ONtb -----END PGP SIGNATURE----- Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc Pull ARM SoC-related driver updates from Olof Johansson: "Various driver updates for platforms: - Nvidia: Fuse support for Tegra194, continued memory controller pieces for Tegra30 - NXP/FSL: Refactorings of QuickEngine drivers to support ARM/ARM64/PPC - NXP/FSL: i.MX8MP SoC driver pieces - TI Keystone: ring accelerator driver - Qualcomm: SCM driver cleanup/refactoring + support for new SoCs. - Xilinx ZynqMP: feature checking interface for firmware. Mailbox communication for power management - Overall support patch set for cpuidle on more complex hierarchies (PSCI-based) and misc cleanups, refactorings of Marvell, TI, other platforms" * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (166 commits) drivers: soc: xilinx: Use mailbox IPI callback dt-bindings: power: reset: xilinx: Add bindings for ipi mailbox drivers: soc: ti: knav_qmss_queue: Pass lockdep expression to RCU lists MAINTAINERS: Add brcmstb PCIe controller entry soc/tegra: fuse: Unmap registers once they are not needed anymore soc/tegra: fuse: Correct straps' address for older Tegra124 device trees soc/tegra: fuse: Warn if straps are not ready soc/tegra: fuse: Cache values of straps and Chip ID registers memory: tegra30-emc: Correct error message for timed out auto calibration memory: tegra30-emc: Firm up hardware programming sequence memory: tegra30-emc: Firm up suspend/resume sequence soc/tegra: regulators: Do nothing if voltage is unchanged memory: tegra: Correct reset value of xusb_hostr soc/tegra: fuse: Add APB DMA dependency for Tegra20 bus: tegra-aconnect: Remove PM_CLK dependency dt-bindings: mediatek: add MT6765 power dt-bindings soc: mediatek: cmdq: delete not used define memory: tegra: Add support for the Tegra194 memory controller memory: tegra: Only include support for enabled SoCs memory: tegra: Support DVFS on Tegra186 and later ...
178 lines
4.0 KiB
C
178 lines
4.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <soc/tegra/fuse.h>
|
|
#include <soc/tegra/common.h>
|
|
|
|
#include "fuse.h"
|
|
|
|
#define FUSE_SKU_INFO 0x10
|
|
|
|
#define PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT 4
|
|
#define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_LONG \
|
|
(0xf << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT)
|
|
#define PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT \
|
|
(0x3 << PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT)
|
|
|
|
static bool long_ram_code;
|
|
static u32 strapping;
|
|
static u32 chipid;
|
|
|
|
u32 tegra_read_chipid(void)
|
|
{
|
|
WARN(!chipid, "Tegra ABP MISC not yet available\n");
|
|
|
|
return chipid;
|
|
}
|
|
|
|
u8 tegra_get_chip_id(void)
|
|
{
|
|
return (tegra_read_chipid() >> 8) & 0xff;
|
|
}
|
|
|
|
u32 tegra_read_straps(void)
|
|
{
|
|
WARN(!chipid, "Tegra ABP MISC not yet available\n");
|
|
|
|
return strapping;
|
|
}
|
|
|
|
u32 tegra_read_ram_code(void)
|
|
{
|
|
u32 straps = tegra_read_straps();
|
|
|
|
if (long_ram_code)
|
|
straps &= PMC_STRAPPING_OPT_A_RAM_CODE_MASK_LONG;
|
|
else
|
|
straps &= PMC_STRAPPING_OPT_A_RAM_CODE_MASK_SHORT;
|
|
|
|
return straps >> PMC_STRAPPING_OPT_A_RAM_CODE_SHIFT;
|
|
}
|
|
|
|
static const struct of_device_id apbmisc_match[] __initconst = {
|
|
{ .compatible = "nvidia,tegra20-apbmisc", },
|
|
{ .compatible = "nvidia,tegra186-misc", },
|
|
{ .compatible = "nvidia,tegra194-misc", },
|
|
{},
|
|
};
|
|
|
|
void __init tegra_init_revision(void)
|
|
{
|
|
u32 id, chip_id, minor_rev;
|
|
int rev;
|
|
|
|
id = tegra_read_chipid();
|
|
chip_id = (id >> 8) & 0xff;
|
|
minor_rev = (id >> 16) & 0xf;
|
|
|
|
switch (minor_rev) {
|
|
case 1:
|
|
rev = TEGRA_REVISION_A01;
|
|
break;
|
|
case 2:
|
|
rev = TEGRA_REVISION_A02;
|
|
break;
|
|
case 3:
|
|
if (chip_id == TEGRA20 && (tegra_fuse_read_spare(18) ||
|
|
tegra_fuse_read_spare(19)))
|
|
rev = TEGRA_REVISION_A03p;
|
|
else
|
|
rev = TEGRA_REVISION_A03;
|
|
break;
|
|
case 4:
|
|
rev = TEGRA_REVISION_A04;
|
|
break;
|
|
default:
|
|
rev = TEGRA_REVISION_UNKNOWN;
|
|
}
|
|
|
|
tegra_sku_info.revision = rev;
|
|
|
|
tegra_sku_info.sku_id = tegra_fuse_read_early(FUSE_SKU_INFO);
|
|
}
|
|
|
|
void __init tegra_init_apbmisc(void)
|
|
{
|
|
void __iomem *apbmisc_base, *strapping_base;
|
|
struct resource apbmisc, straps;
|
|
struct device_node *np;
|
|
|
|
np = of_find_matching_node(NULL, apbmisc_match);
|
|
if (!np) {
|
|
/*
|
|
* Fall back to legacy initialization for 32-bit ARM only. All
|
|
* 64-bit ARM device tree files for Tegra are required to have
|
|
* an APBMISC node.
|
|
*
|
|
* This is for backwards-compatibility with old device trees
|
|
* that didn't contain an APBMISC node.
|
|
*/
|
|
if (IS_ENABLED(CONFIG_ARM) && soc_is_tegra()) {
|
|
/* APBMISC registers (chip revision, ...) */
|
|
apbmisc.start = 0x70000800;
|
|
apbmisc.end = 0x70000863;
|
|
apbmisc.flags = IORESOURCE_MEM;
|
|
|
|
/* strapping options */
|
|
if (of_machine_is_compatible("nvidia,tegra124")) {
|
|
straps.start = 0x7000e864;
|
|
straps.end = 0x7000e867;
|
|
} else {
|
|
straps.start = 0x70000008;
|
|
straps.end = 0x7000000b;
|
|
}
|
|
|
|
straps.flags = IORESOURCE_MEM;
|
|
|
|
pr_warn("Using APBMISC region %pR\n", &apbmisc);
|
|
pr_warn("Using strapping options registers %pR\n",
|
|
&straps);
|
|
} else {
|
|
/*
|
|
* At this point we're not running on Tegra, so play
|
|
* nice with multi-platform kernels.
|
|
*/
|
|
return;
|
|
}
|
|
} else {
|
|
/*
|
|
* Extract information from the device tree if we've found a
|
|
* matching node.
|
|
*/
|
|
if (of_address_to_resource(np, 0, &apbmisc) < 0) {
|
|
pr_err("failed to get APBMISC registers\n");
|
|
return;
|
|
}
|
|
|
|
if (of_address_to_resource(np, 1, &straps) < 0) {
|
|
pr_err("failed to get strapping options registers\n");
|
|
return;
|
|
}
|
|
}
|
|
|
|
apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc));
|
|
if (!apbmisc_base) {
|
|
pr_err("failed to map APBMISC registers\n");
|
|
} else {
|
|
chipid = readl_relaxed(apbmisc_base + 4);
|
|
iounmap(apbmisc_base);
|
|
}
|
|
|
|
strapping_base = ioremap(straps.start, resource_size(&straps));
|
|
if (!strapping_base) {
|
|
pr_err("failed to map strapping options registers\n");
|
|
} else {
|
|
strapping = readl_relaxed(strapping_base);
|
|
iounmap(strapping_base);
|
|
}
|
|
|
|
long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code");
|
|
}
|