Skip to content

Commit

Permalink
Merge tag 'sunxi-clk-for-5.6' of https://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/sunxi/linux into clk-allwinner

Pull Allwinner clk driver updates from Maxime Ripard:

Our usual set of patches for sunxi, with a bunch of them required to
enable the MBUS controller, and two patches to enable cpufreq on the
A64.

* tag 'sunxi-clk-for-5.6' of https://git.kernel.org/pub/scm/linux/kernel/git/sunxi/linux:
  clk: sunxi: a23/a33: Export the MIPI PLL
  clk: sunxi: a31: Export the MIPI PLL
  clk: sunxi-ng: a64: export CLK_CPUX clock for DVFS
  clk: sunxi-ng: add mux and pll notifiers for A64 CPU clock
  clk: sunxi-ng: r40: Export MBUS clock
  clk: sunxi: use of_device_get_match_data
  • Loading branch information
Stephen Boyd committed Jan 22, 2020
2 parents e42617b + 9c232d3 commit fa9ae30
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 13 deletions.
28 changes: 27 additions & 1 deletion drivers/clk/sunxi-ng/ccu-sun50i-a64.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,11 +921,26 @@ static const struct sunxi_ccu_desc sun50i_a64_ccu_desc = {
.num_resets = ARRAY_SIZE(sun50i_a64_ccu_resets),
};

static struct ccu_pll_nb sun50i_a64_pll_cpu_nb = {
.common = &pll_cpux_clk.common,
/* copy from pll_cpux_clk */
.enable = BIT(31),
.lock = BIT(28),
};

static struct ccu_mux_nb sun50i_a64_cpu_nb = {
.common = &cpux_clk.common,
.cm = &cpux_clk.mux,
.delay_us = 1, /* > 8 clock cycles at 24 MHz */
.bypass_index = 1, /* index of 24 MHz oscillator */
};

static int sun50i_a64_ccu_probe(struct platform_device *pdev)
{
struct resource *res;
void __iomem *reg;
u32 val;
int ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg = devm_ioremap_resource(&pdev->dev, res);
Expand All @@ -939,7 +954,18 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev)

writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG);

return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc);
ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc);
if (ret)
return ret;

/* Gate then ungate PLL CPU after any rate changes */
ccu_pll_notifier_register(&sun50i_a64_pll_cpu_nb);

/* Reparent CPU during PLL CPU rate changes */
ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
&sun50i_a64_cpu_nb);

return 0;
}

static const struct of_device_id sun50i_a64_ccu_ids[] = {
Expand Down
1 change: 0 additions & 1 deletion drivers/clk/sunxi-ng/ccu-sun50i-a64.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#define CLK_PLL_HSIC 18
#define CLK_PLL_DE 19
#define CLK_PLL_DDR1 20
#define CLK_CPUX 21
#define CLK_AXI 22
#define CLK_APB 23
#define CLK_AHB1 24
Expand Down
4 changes: 3 additions & 1 deletion drivers/clk/sunxi-ng/ccu-sun6i-a31.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
/* The PLL_VIDEO1_2X clock is exported */

#define CLK_PLL_GPU 14
#define CLK_PLL_MIPI 15

/* The PLL_VIDEO1_2X clock is exported */

#define CLK_PLL9 16
#define CLK_PLL10 17

Expand Down
4 changes: 3 additions & 1 deletion drivers/clk/sunxi-ng/ccu-sun8i-a23-a33.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#define CLK_PLL_PERIPH 10
#define CLK_PLL_PERIPH_2X 11
#define CLK_PLL_GPU 12
#define CLK_PLL_MIPI 13

/* The PLL MIPI clock is exported */

#define CLK_PLL_HSIC 14
#define CLK_PLL_DE 15
#define CLK_PLL_DDR1 16
Expand Down
4 changes: 0 additions & 4 deletions drivers/clk/sunxi-ng/ccu-sun8i-r40.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@

/* Some more module clocks are exported */

#define CLK_MBUS 155

/* Another bunch of module clocks are exported */

#define CLK_NUMBER (CLK_OUTB + 1)

#endif /* _CCU_SUN8I_R40_H_ */
6 changes: 2 additions & 4 deletions drivers/clk/sunxi/clk-sun6i-apb0-gates.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct clk_onecell_data *clk_data;
const struct of_device_id *device;
const struct gates_data *data;
const char *clk_parent;
const char *clk_name;
Expand All @@ -50,10 +49,9 @@ static int sun6i_a31_apb0_gates_clk_probe(struct platform_device *pdev)
if (!np)
return -ENODEV;

device = of_match_device(sun6i_a31_apb0_gates_clk_dt_ids, &pdev->dev);
if (!device)
data = of_device_get_match_data(&pdev->dev);
if (!data)
return -ENODEV;
data = device->data;

r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
reg = devm_ioremap_resource(&pdev->dev, r);
Expand Down
1 change: 1 addition & 0 deletions include/dt-bindings/clock/sun50i-a64-ccu.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#define CLK_PLL_VIDEO0 7
#define CLK_PLL_PERIPH0 11

#define CLK_CPUX 21
#define CLK_BUS_MIPI_DSI 28
#define CLK_BUS_CE 29
#define CLK_BUS_DMA 30
Expand Down
2 changes: 2 additions & 0 deletions include/dt-bindings/clock/sun6i-a31-ccu.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

#define CLK_PLL_VIDEO1_2X 13

#define CLK_PLL_MIPI 15

#define CLK_CPU 18

#define CLK_AHB1_MIPIDSI 23
Expand Down
2 changes: 2 additions & 0 deletions include/dt-bindings/clock/sun8i-a23-a33-ccu.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#ifndef _DT_BINDINGS_CLK_SUN8I_A23_A33_H_
#define _DT_BINDINGS_CLK_SUN8I_A23_A33_H_

#define CLK_PLL_MIPI 13

#define CLK_CPUX 18

#define CLK_BUS_MIPI_DSI 23
Expand Down
2 changes: 1 addition & 1 deletion include/dt-bindings/clock/sun8i-r40-ccu.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
#define CLK_AVS 152
#define CLK_HDMI 153
#define CLK_HDMI_SLOW 154

#define CLK_MBUS 155
#define CLK_DSI_DPHY 156
#define CLK_TVE0 157
#define CLK_TVE1 158
Expand Down

0 comments on commit fa9ae30

Please sign in to comment.