mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 18:45:25 +07:00
102178108e
Some releases this branch is nearly empty, others we have more stuff. It tends to gather drivers that need SoC modification or dependencies such that they have to (also) go in through our tree. For this release, we have merged in part of the reset controller tree (with handshake that the parts we have merged in will remain stable), as well as dependencies on a few clock branches. In general, new items here are: - Qualcomm driver for SMM/SMD, which is how they communicate with the coprocessors on (some) of their platforms - Memory controller work for ARM's PL172 memory controller - Reset drivers for various platforms - PMU power domain support for Marvell platforms - Tegra support for T132/T210 SoCs: PMC, fuse, memory controller per-SoC support -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJV5Ou9AAoJEIwa5zzehBx3/k4P/jA5CVNiDvIs0GoTR3uGOuec MYd19oKf76reV1oL5bBSpg9uryJd3fPzK0JC/qU3pYfsCVFp2TWZD7liNpitqHyt 2xL02gzJQgjHzL3QrxTQrOFJDO6P8Vm2k/5pI0KX1beoulHvI+iHejNryXGjSKSx 9vbs1GPXU9IV831YOHSaMmHz727J65bbZE8Up113ctT+WbEIc1g/ihKzUgi/8xXW RniMxGsX8HynE3VH+UBDMbY6XkOmzZa1Wabgll735MXwIUFG1+TsvHNuGehXUski ySwqk67en25i0F/Q7oobLSZwCPbA6Ylxk9aOfr0AnAqOEKwgKWS+K7HkEiNMz7yh nt22b5SVkQ80sTCbNEkdJajOZ8oRalUae19CGxvMfVh77LmQ2sRI9iJrwXcxkt8W ASs6uDDAUNC5pIWfjeJE50vsDr//Hed/WtsIjenYOtb+RI1kru5iTTgp4oLPBiy5 OeHxOfiL7gPvyZQbuPgMKAGdoGBsa/7wTM7KWJCMP6mPGHpShO8XUUsuljqKHm4w nBV7eZRMiIuWkjRKw4bjp7R0NVKR5sOfAkZhjCsXB0aqA/NU2zyNbViWcGCh6yj8 3beZ93SdEdrKX6N8pPiAhGTMFA6eev8YeUHO7kM4IhC91ILjHlPpCs1pYk3pwEkO ABC7GyMY6Olg1pZJweEa =B6jn -----END PGP SIGNATURE----- Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC driver updates from Olof Johansson: "Some releases this branch is nearly empty, others we have more stuff. It tends to gather drivers that need SoC modification or dependencies such that they have to (also) go in through our tree. For this release, we have merged in part of the reset controller tree (with handshake that the parts we have merged in will remain stable), as well as dependencies on a few clock branches. In general, new items here are: - Qualcomm driver for SMM/SMD, which is how they communicate with the coprocessors on (some) of their platforms - memory controller work for ARM's PL172 memory controller - reset drivers for various platforms - PMU power domain support for Marvell platforms - Tegra support for T132/T210 SoCs: PMC, fuse, memory controller per-SoC support" * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (49 commits) ARM: tegra: cpuidle: implement cpuidle_state.enter_freeze() ARM: tegra: Disable cpuidle if PSCI is available soc/tegra: pmc: Use existing pclk reference soc/tegra: pmc: Remove unnecessary return statement soc: tegra: Remove redundant $(CONFIG_ARCH_TEGRA) in Makefile memory: tegra: Add Tegra210 support memory: tegra: Add support for a variable-size client ID bitfield clk: shmobile: rz: Add CPG/MSTP Clock Domain support clk: shmobile: rcar-gen2: Add CPG/MSTP Clock Domain support clk: shmobile: r8a7779: Add CPG/MSTP Clock Domain support clk: shmobile: r8a7778: Add CPG/MSTP Clock Domain support clk: shmobile: Add CPG/MSTP Clock Domain support ARM: dove: create a proper PMU driver for power domains, PMU IRQs and resets reset: reset-zynq: Adding support for Xilinx Zynq reset controller. docs: dts: Added documentation for Xilinx Zynq Reset Controller bindings. MIPS: ath79: Add the reset controller to the AR9132 dtsi reset: Add a driver for the reset controller on the AR71XX/AR9XXX devicetree: Add bindings for the ATH79 reset controller reset: socfpga: Update reset-socfpga to read the altr,modrst-offset property doc: dt: add documentation for lpc1850-rgu reset driver ...
183 lines
4.5 KiB
C
183 lines
4.5 KiB
C
/*
|
|
* r8a7779 Core CPG Clocks
|
|
*
|
|
* Copyright (C) 2013, 2014 Horms Solutions Ltd.
|
|
*
|
|
* Contact: Simon Horman <horms@verge.net.au>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*/
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/clk/shmobile.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <dt-bindings/clock/r8a7779-clock.h>
|
|
|
|
#define CPG_NUM_CLOCKS (R8A7779_CLK_OUT + 1)
|
|
|
|
struct r8a7779_cpg {
|
|
struct clk_onecell_data data;
|
|
spinlock_t lock;
|
|
void __iomem *reg;
|
|
};
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* CPG Clock Data
|
|
*/
|
|
|
|
/*
|
|
* MD1 = 1 MD1 = 0
|
|
* (PLLA = 1500) (PLLA = 1600)
|
|
* (MHz) (MHz)
|
|
*------------------------------------------------+--------------------
|
|
* clkz 1000 (2/3) 800 (1/2)
|
|
* clkzs 250 (1/6) 200 (1/8)
|
|
* clki 750 (1/2) 800 (1/2)
|
|
* clks 250 (1/6) 200 (1/8)
|
|
* clks1 125 (1/12) 100 (1/16)
|
|
* clks3 187.5 (1/8) 200 (1/8)
|
|
* clks4 93.7 (1/16) 100 (1/16)
|
|
* clkp 62.5 (1/24) 50 (1/32)
|
|
* clkg 62.5 (1/24) 66.6 (1/24)
|
|
* clkb, CLKOUT
|
|
* (MD2 = 0) 62.5 (1/24) 66.6 (1/24)
|
|
* (MD2 = 1) 41.6 (1/36) 50 (1/32)
|
|
*/
|
|
|
|
#define CPG_CLK_CONFIG_INDEX(md) (((md) & (BIT(2)|BIT(1))) >> 1)
|
|
|
|
struct cpg_clk_config {
|
|
unsigned int z_mult;
|
|
unsigned int z_div;
|
|
unsigned int zs_and_s_div;
|
|
unsigned int s1_div;
|
|
unsigned int p_div;
|
|
unsigned int b_and_out_div;
|
|
};
|
|
|
|
static const struct cpg_clk_config cpg_clk_configs[4] __initconst = {
|
|
{ 1, 2, 8, 16, 32, 24 },
|
|
{ 2, 3, 6, 12, 24, 24 },
|
|
{ 1, 2, 8, 16, 32, 32 },
|
|
{ 2, 3, 6, 12, 24, 36 },
|
|
};
|
|
|
|
/*
|
|
* MD PLLA Ratio
|
|
* 12 11
|
|
*------------------------
|
|
* 0 0 x42
|
|
* 0 1 x48
|
|
* 1 0 x56
|
|
* 1 1 x64
|
|
*/
|
|
|
|
#define CPG_PLLA_MULT_INDEX(md) (((md) & (BIT(12)|BIT(11))) >> 11)
|
|
|
|
static const unsigned int cpg_plla_mult[4] __initconst = { 42, 48, 56, 64 };
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
* Initialization
|
|
*/
|
|
|
|
static u32 cpg_mode __initdata;
|
|
|
|
static struct clk * __init
|
|
r8a7779_cpg_register_clock(struct device_node *np, struct r8a7779_cpg *cpg,
|
|
const struct cpg_clk_config *config,
|
|
unsigned int plla_mult, const char *name)
|
|
{
|
|
const char *parent_name = "plla";
|
|
unsigned int mult = 1;
|
|
unsigned int div = 1;
|
|
|
|
if (!strcmp(name, "plla")) {
|
|
parent_name = of_clk_get_parent_name(np, 0);
|
|
mult = plla_mult;
|
|
} else if (!strcmp(name, "z")) {
|
|
div = config->z_div;
|
|
mult = config->z_mult;
|
|
} else if (!strcmp(name, "zs") || !strcmp(name, "s")) {
|
|
div = config->zs_and_s_div;
|
|
} else if (!strcmp(name, "s1")) {
|
|
div = config->s1_div;
|
|
} else if (!strcmp(name, "p")) {
|
|
div = config->p_div;
|
|
} else if (!strcmp(name, "b") || !strcmp(name, "out")) {
|
|
div = config->b_and_out_div;
|
|
} else {
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
|
|
return clk_register_fixed_factor(NULL, name, parent_name, 0, mult, div);
|
|
}
|
|
|
|
static void __init r8a7779_cpg_clocks_init(struct device_node *np)
|
|
{
|
|
const struct cpg_clk_config *config;
|
|
struct r8a7779_cpg *cpg;
|
|
struct clk **clks;
|
|
unsigned int i, plla_mult;
|
|
int num_clks;
|
|
|
|
num_clks = of_property_count_strings(np, "clock-output-names");
|
|
if (num_clks < 0) {
|
|
pr_err("%s: failed to count clocks\n", __func__);
|
|
return;
|
|
}
|
|
|
|
cpg = kzalloc(sizeof(*cpg), GFP_KERNEL);
|
|
clks = kzalloc(CPG_NUM_CLOCKS * sizeof(*clks), GFP_KERNEL);
|
|
if (cpg == NULL || clks == NULL) {
|
|
/* We're leaking memory on purpose, there's no point in cleaning
|
|
* up as the system won't boot anyway.
|
|
*/
|
|
return;
|
|
}
|
|
|
|
spin_lock_init(&cpg->lock);
|
|
|
|
cpg->data.clks = clks;
|
|
cpg->data.clk_num = num_clks;
|
|
|
|
config = &cpg_clk_configs[CPG_CLK_CONFIG_INDEX(cpg_mode)];
|
|
plla_mult = cpg_plla_mult[CPG_PLLA_MULT_INDEX(cpg_mode)];
|
|
|
|
for (i = 0; i < num_clks; ++i) {
|
|
const char *name;
|
|
struct clk *clk;
|
|
|
|
of_property_read_string_index(np, "clock-output-names", i,
|
|
&name);
|
|
|
|
clk = r8a7779_cpg_register_clock(np, cpg, config,
|
|
plla_mult, name);
|
|
if (IS_ERR(clk))
|
|
pr_err("%s: failed to register %s %s clock (%ld)\n",
|
|
__func__, np->name, name, PTR_ERR(clk));
|
|
else
|
|
cpg->data.clks[i] = clk;
|
|
}
|
|
|
|
of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data);
|
|
|
|
cpg_mstp_add_clk_domain(np);
|
|
}
|
|
CLK_OF_DECLARE(r8a7779_cpg_clks, "renesas,r8a7779-cpg-clocks",
|
|
r8a7779_cpg_clocks_init);
|
|
|
|
void __init r8a7779_clocks_init(u32 mode)
|
|
{
|
|
cpg_mode = mode;
|
|
|
|
of_clk_init(NULL);
|
|
}
|