diff options
author | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-11 10:41:07 +0300 |
---|---|---|
committer | José Pekkarinen <jose.pekkarinen@nokia.com> | 2016-04-13 08:17:18 +0300 |
commit | e09b41010ba33a20a87472ee821fa407a5b8da36 (patch) | |
tree | d10dc367189862e7ca5c592f033dc3726e1df4e3 /kernel/drivers/clk/shmobile | |
parent | f93b97fd65072de626c074dbe099a1fff05ce060 (diff) |
These changes are the raw update to linux-4.4.6-rt14. Kernel sources
are taken from kernel.org, and rt patch from the rt wiki download page.
During the rebasing, the following patch collided:
Force tick interrupt and get rid of softirq magic(I70131fb85).
Collisions have been removed because its logic was found on the
source already.
Change-Id: I7f57a4081d9deaa0d9ccfc41a6c8daccdee3b769
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'kernel/drivers/clk/shmobile')
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-div6.c | 8 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-emev2.c | 8 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-mstp.c | 93 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-r8a73a4.c | 2 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-r8a7740.c | 2 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-r8a7778.c | 12 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-r8a7779.c | 4 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-rcar-gen2.c | 4 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-rz.c | 3 | ||||
-rw-r--r-- | kernel/drivers/clk/shmobile/clk-sh73a0.c | 2 |
10 files changed, 122 insertions, 16 deletions
diff --git a/kernel/drivers/clk/shmobile/clk-div6.c b/kernel/drivers/clk/shmobile/clk-div6.c index 036a692c7..b4c8d6746 100644 --- a/kernel/drivers/clk/shmobile/clk-div6.c +++ b/kernel/drivers/clk/shmobile/clk-div6.c @@ -11,12 +11,12 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.h> #include <linux/init.h> #include <linux/io.h> #include <linux/kernel.h> #include <linux/of.h> #include <linux/of_address.h> +#include <linux/slab.h> #define CPG_DIV6_CKSTP BIT(8) #define CPG_DIV6_DIV(d) ((d) & 0x3f) @@ -133,13 +133,13 @@ static u8 cpg_div6_clock_get_parent(struct clk_hw *hw) hw_index = (clk_readl(clock->reg) >> clock->src_shift) & (BIT(clock->src_width) - 1); - for (i = 0; i < __clk_get_num_parents(hw->clk); i++) { + for (i = 0; i < clk_hw_get_num_parents(hw); i++) { if (clock->parents[i] == hw_index) return i; } pr_err("%s: %s DIV6 clock set to invalid parent %u\n", - __func__, __clk_get_name(hw->clk), hw_index); + __func__, clk_hw_get_name(hw), hw_index); return 0; } @@ -149,7 +149,7 @@ static int cpg_div6_clock_set_parent(struct clk_hw *hw, u8 index) u8 hw_index; u32 mask; - if (index >= __clk_get_num_parents(hw->clk)) + if (index >= clk_hw_get_num_parents(hw)) return -EINVAL; mask = ~((BIT(clock->src_width) - 1) << clock->src_shift); diff --git a/kernel/drivers/clk/shmobile/clk-emev2.c b/kernel/drivers/clk/shmobile/clk-emev2.c index 6c7c929c7..a91825471 100644 --- a/kernel/drivers/clk/shmobile/clk-emev2.c +++ b/kernel/drivers/clk/shmobile/clk-emev2.c @@ -28,13 +28,15 @@ #define USIBU1_RSTCTRL 0x0ac #define USIBU2_RSTCTRL 0x0b0 #define USIBU3_RSTCTRL 0x0b4 +#define IIC0_RSTCTRL 0x0dc +#define IIC1_RSTCTRL 0x0e0 #define STI_RSTCTRL 0x124 #define STI_CLKSEL 0x688 static DEFINE_SPINLOCK(lock); /* not pretty, but hey */ -void __iomem *smu_base; +static void __iomem *smu_base; static void __init emev2_smu_write(unsigned long value, int offs) { @@ -66,6 +68,10 @@ static void __init emev2_smu_init(void) emev2_smu_write(2, USIBU1_RSTCTRL); emev2_smu_write(2, USIBU2_RSTCTRL); emev2_smu_write(2, USIBU3_RSTCTRL); + + /* deassert reset for IIC0->IIC1 */ + emev2_smu_write(1, IIC0_RSTCTRL); + emev2_smu_write(1, IIC1_RSTCTRL); } static void __init emev2_smu_clkdiv_init(struct device_node *np) diff --git a/kernel/drivers/clk/shmobile/clk-mstp.c b/kernel/drivers/clk/shmobile/clk-mstp.c index 2d2fe773a..3b09716eb 100644 --- a/kernel/drivers/clk/shmobile/clk-mstp.c +++ b/kernel/drivers/clk/shmobile/clk-mstp.c @@ -2,6 +2,7 @@ * R-Car MSTP clocks * * Copyright (C) 2013 Ideas On Board SPRL + * Copyright (C) 2015 Glider bvba * * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * @@ -10,11 +11,16 @@ * the Free Software Foundation; version 2 of the License. */ +#include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/clkdev.h> +#include <linux/clk/shmobile.h> +#include <linux/device.h> #include <linux/io.h> #include <linux/of.h> #include <linux/of_address.h> +#include <linux/pm_clock.h> +#include <linux/pm_domain.h> #include <linux/spinlock.h> /* @@ -208,7 +214,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) break; if (clkidx >= MSTP_MAX_CLOCKS) { - pr_err("%s: invalid clock %s %s index %u)\n", + pr_err("%s: invalid clock %s %s index %u\n", __func__, np->name, name, clkidx); continue; } @@ -236,3 +242,88 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) of_clk_add_provider(np, of_clk_src_onecell_get, &group->data); } CLK_OF_DECLARE(cpg_mstp_clks, "renesas,cpg-mstp-clocks", cpg_mstp_clocks_init); + + +#ifdef CONFIG_PM_GENERIC_DOMAINS_OF +int cpg_mstp_attach_dev(struct generic_pm_domain *domain, struct device *dev) +{ + struct device_node *np = dev->of_node; + struct of_phandle_args clkspec; + struct clk *clk; + int i = 0; + int error; + + while (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", i, + &clkspec)) { + if (of_device_is_compatible(clkspec.np, + "renesas,cpg-mstp-clocks")) + goto found; + + /* BSC on r8a73a4/sh73a0 uses zb_clk instead of an mstp clock */ + if (!strcmp(clkspec.np->name, "zb_clk")) + goto found; + + of_node_put(clkspec.np); + i++; + } + + return 0; + +found: + clk = of_clk_get_from_provider(&clkspec); + of_node_put(clkspec.np); + + if (IS_ERR(clk)) + return PTR_ERR(clk); + + error = pm_clk_create(dev); + if (error) { + dev_err(dev, "pm_clk_create failed %d\n", error); + goto fail_put; + } + + error = pm_clk_add_clk(dev, clk); + if (error) { + dev_err(dev, "pm_clk_add_clk %pC failed %d\n", clk, error); + goto fail_destroy; + } + + return 0; + +fail_destroy: + pm_clk_destroy(dev); +fail_put: + clk_put(clk); + return error; +} + +void cpg_mstp_detach_dev(struct generic_pm_domain *domain, struct device *dev) +{ + if (!list_empty(&dev->power.subsys_data->clock_list)) + pm_clk_destroy(dev); +} + +void __init cpg_mstp_add_clk_domain(struct device_node *np) +{ + struct generic_pm_domain *pd; + u32 ncells; + + if (of_property_read_u32(np, "#power-domain-cells", &ncells)) { + pr_warn("%s lacks #power-domain-cells\n", np->full_name); + return; + } + + pd = kzalloc(sizeof(*pd), GFP_KERNEL); + if (!pd) + return; + + pd->name = np->name; + + pd->flags = GENPD_FLAG_PM_CLK; + pm_genpd_init(pd, &simple_qos_governor, false); + pd->attach_dev = cpg_mstp_attach_dev; + pd->detach_dev = cpg_mstp_detach_dev; + + of_genpd_add_provider_simple(np, pd); +} +#endif /* !CONFIG_PM_GENERIC_DOMAINS_OF */ diff --git a/kernel/drivers/clk/shmobile/clk-r8a73a4.c b/kernel/drivers/clk/shmobile/clk-r8a73a4.c index 29b9a0b00..9326204be 100644 --- a/kernel/drivers/clk/shmobile/clk-r8a73a4.c +++ b/kernel/drivers/clk/shmobile/clk-r8a73a4.c @@ -9,10 +9,10 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.h> #include <linux/clk/shmobile.h> #include <linux/init.h> #include <linux/kernel.h> +#include <linux/slab.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/spinlock.h> diff --git a/kernel/drivers/clk/shmobile/clk-r8a7740.c b/kernel/drivers/clk/shmobile/clk-r8a7740.c index 1e2eaae21..1e6b1da58 100644 --- a/kernel/drivers/clk/shmobile/clk-r8a7740.c +++ b/kernel/drivers/clk/shmobile/clk-r8a7740.c @@ -9,10 +9,10 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.h> #include <linux/clk/shmobile.h> #include <linux/init.h> #include <linux/kernel.h> +#include <linux/slab.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/spinlock.h> diff --git a/kernel/drivers/clk/shmobile/clk-r8a7778.c b/kernel/drivers/clk/shmobile/clk-r8a7778.c index cb33b5727..b1741551f 100644 --- a/kernel/drivers/clk/shmobile/clk-r8a7778.c +++ b/kernel/drivers/clk/shmobile/clk-r8a7778.c @@ -9,9 +9,9 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.h> #include <linux/clk/shmobile.h> #include <linux/of_address.h> +#include <linux/slab.h> struct r8a7778_cpg { struct clk_onecell_data data; @@ -20,10 +20,10 @@ struct r8a7778_cpg { }; /* PLL multipliers per bits 11, 12, and 18 of MODEMR */ -struct { +static const struct { unsigned long plla_mult; unsigned long pllb_mult; -} r8a7778_rates[] __initdata = { +} r8a7778_rates[] __initconst = { [0] = { 21, 21 }, [1] = { 24, 24 }, [2] = { 28, 28 }, @@ -34,10 +34,10 @@ struct { }; /* Clock dividers per bits 1 and 2 of MODEMR */ -struct { +static const struct { const char *name; unsigned int div[4]; -} r8a7778_divs[6] __initdata = { +} r8a7778_divs[6] __initconst = { { "b", { 12, 12, 16, 18 } }, { "out", { 12, 12, 16, 18 } }, { "p", { 16, 12, 16, 12 } }, @@ -124,6 +124,8 @@ static void __init r8a7778_cpg_clocks_init(struct device_node *np) } of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); + + cpg_mstp_add_clk_domain(np); } CLK_OF_DECLARE(r8a7778_cpg_clks, "renesas,r8a7778-cpg-clocks", diff --git a/kernel/drivers/clk/shmobile/clk-r8a7779.c b/kernel/drivers/clk/shmobile/clk-r8a7779.c index 652ecacb6..92275c5f2 100644 --- a/kernel/drivers/clk/shmobile/clk-r8a7779.c +++ b/kernel/drivers/clk/shmobile/clk-r8a7779.c @@ -11,12 +11,12 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.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> @@ -168,6 +168,8 @@ static void __init r8a7779_cpg_clocks_init(struct device_node *np) } 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); diff --git a/kernel/drivers/clk/shmobile/clk-rcar-gen2.c b/kernel/drivers/clk/shmobile/clk-rcar-gen2.c index acfb6d7db..745496f7e 100644 --- a/kernel/drivers/clk/shmobile/clk-rcar-gen2.c +++ b/kernel/drivers/clk/shmobile/clk-rcar-gen2.c @@ -11,13 +11,13 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.h> #include <linux/clk/shmobile.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/math64.h> #include <linux/of.h> #include <linux/of_address.h> +#include <linux/slab.h> #include <linux/spinlock.h> struct rcar_gen2_cpg { @@ -415,6 +415,8 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np) } of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); + + cpg_mstp_add_clk_domain(np); } CLK_OF_DECLARE(rcar_gen2_cpg_clks, "renesas,rcar-gen2-cpg-clocks", rcar_gen2_cpg_clocks_init); diff --git a/kernel/drivers/clk/shmobile/clk-rz.c b/kernel/drivers/clk/shmobile/clk-rz.c index 7e68e8630..9766e3cb5 100644 --- a/kernel/drivers/clk/shmobile/clk-rz.c +++ b/kernel/drivers/clk/shmobile/clk-rz.c @@ -10,6 +10,7 @@ */ #include <linux/clk-provider.h> +#include <linux/clk/shmobile.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/of.h> @@ -99,5 +100,7 @@ static void __init rz_cpg_clocks_init(struct device_node *np) } of_clk_add_provider(np, of_clk_src_onecell_get, &cpg->data); + + cpg_mstp_add_clk_domain(np); } CLK_OF_DECLARE(rz_cpg_clks, "renesas,rz-cpg-clocks", rz_cpg_clocks_init); diff --git a/kernel/drivers/clk/shmobile/clk-sh73a0.c b/kernel/drivers/clk/shmobile/clk-sh73a0.c index cd529cfe4..8966f8bbf 100644 --- a/kernel/drivers/clk/shmobile/clk-sh73a0.c +++ b/kernel/drivers/clk/shmobile/clk-sh73a0.c @@ -9,12 +9,12 @@ */ #include <linux/clk-provider.h> -#include <linux/clkdev.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> struct sh73a0_cpg { |