meson-gxbb: Add mali-450 support
Subsystems (4)
cover meson-gxbb: Add mali-450 support
Since the merge of the Mali dt bindings at [1], add support for Mali clocks and DT node.
The Mali is clocked by two identical clock paths behind a glitch free mux to safely change frequency while running.
So these clocks must be added to the meson-gxbb clock controller.
[1] http://lkml.kernel.org/r/b098c4fa9fce88361cca20417978734d0e1b5cca.1485939041.git-series.maxime.ripard at free-electrons.com
Neil Armstrong (2):
clk: meson-gxbb: Add MALI clocks and fix GP0 pll support
ARM64: dts: meson-gxbb: Add Mali node
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 37 +++++ drivers/clk/meson/clk-pll.c | 34 ++++- drivers/clk/meson/clkc.h | 3 + drivers/clk/meson/gxbb.c | 211 +++++++++++++++++++++++++++- drivers/clk/meson/gxbb.h | 7 +- include/dt-bindings/clock/gxbb-clkc.h | 4 + 6 files changed, 282 insertions(+), 14 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/2 clk: meson-gxbb: Add MALI clocks and fix GP0 pll support
The Mali is clocked by two identical clock paths behind a glitch free mux to safely change frequency while running.
The optimal clock frequency is provided by the GP0 PLL, but unlike Meson8 the GXBB GP0 PLL needs some tweaking and need some SoC specific values to be set in order to setup the PLL.
Since these values will change for GXL and GXM, add an init table that will be changed for GXL or GXM.
For the MALI clocks, introduce them as Composite clocks to simplify the management.
To handle composite clocks, a gxbb_composite structure is added to dynamically create the composite clock at probe and fill accordingly the DT table.
Finally the glitch free mux is added and other muxes and dividers are also grouped in initialization tables.
--- drivers/clk/meson/clk-pll.c | 34 ++++-- drivers/clk/meson/clkc.h | 3 + drivers/clk/meson/gxbb.c | 211 +++++++++++++++++++++++++++++++++- drivers/clk/meson/gxbb.h | 7 +- include/dt-bindings/clock/gxbb-clkc.h | 4 + 5 files changed, 245 insertions(+), 14 deletions(-)
drivers/clk/meson/clk-pll.c +27 -7
@@ -132,6 +132,24 @@ static int meson_clk_pll_wait_lock(struct meson_clk_pll *pll,return -ETIMEDOUT ; } +static void meson_clk_pll_init (struct meson_clk_pll *pll) +{ +if (pll->init_count && pll->init_regs && pll->init_data) { +unsigned int i; + +for (i =0 ; i < pll->init_count; ++i) +writel (pll->init_data[i], pll->init_regs[i]); + }else { +struct parm *p; +u32 reg; + +/* PLL reset */ + p = &pll->n; + reg =readl (pll->base + p->reg_off); +writel (reg |MESON_PLL_RESET , pll->base + p->reg_off); + } +} +static int meson_clk_pll_set_rate (struct clk_hw *hw,unsigned long rate,unsigned long parent_rate) {
@@ -151,19 +169,18 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,if (!rate_set)return -EINVAL ; -/* PLL reset */ - p = &pll->n; - reg =readl (pll->base + p->reg_off); -writel (reg |MESON_PLL_RESET , pll->base + p->reg_off); - - reg =PARM_SET (p->width, p->shift, reg, rate_set->n); -writel (reg, pll->base + p->reg_off); +meson_clk_pll_init (pll); p = &pll->m; reg =readl (pll->base + p->reg_off); reg =PARM_SET (p->width, p->shift, reg, rate_set->m);writel (reg, pll->base + p->reg_off); + p = &pll->n; + reg =readl (pll->base + p->reg_off); + reg =PARM_SET (p->width, p->shift, reg, rate_set->n); +writel (reg, pll->base + p->reg_off); + p = &pll->od; reg =readl (pll->base + p->reg_off); reg =PARM_SET (p->width, p->shift, reg, rate_set->od);
@@ -184,6 +201,9 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, } p = &pll->n; + reg =readl (pll->base + p->reg_off); +writel (reg & ~MESON_PLL_RESET , pll->base + p->reg_off); + ret =meson_clk_pll_wait_lock (pll, p);if (ret) { pr_warn("%s: pll did not lock, trying to restore old rate %lu\n",
drivers/clk/meson/clkc.h +3 -0
@@ -70,6 +70,9 @@ struct meson_clk_pll {struct parm frac;struct parm od;struct parm od2; +void __iomem **init_regs; +u32 *init_data; +unsigned int init_count;const struct pll_rate_table *rate_table;unsigned int rate_count;spinlock_t *lock;
drivers/clk/meson/gxbb.c +206 -5
271 lines not on this page · raw message
drivers/clk/meson/gxbb.h +5 -2
@@ -177,7 +177,7 @@/* CLKID_FCLK_DIV4 */ #define CLKID_FCLK_DIV5 7#define CLKID_FCLK_DIV7 8 -#define CLKID_GP0_PLL 9 +/* CLKID_GP0_PLL */ #define CLKID_MPEG_SEL 10#define CLKID_MPEG_DIV 11/* CLKID_CLK81 */
@@ -265,8 +265,11 @@/* CLKID_SD_EMMC_A */ /* CLKID_SD_EMMC_B */ /* CLKID_SD_EMMC_C */ +/* CLKID_MALI_0 */ +/* CLKID_MALI_1 */ +/* CLKID_MALI */ -#define NR_CLKS 97 +#define NR_CLKS 100/* include the CLKIDs that have been made part of the stable DT binding */ #include <dt-bindings/clock/gxbb-clkc.h>
include/dt-bindings/clock/gxbb-clkc.h +4 -0
@@ -10,6 +10,7 @@#define CLKID_FCLK_DIV2 4#define CLKID_FCLK_DIV3 5#define CLKID_FCLK_DIV4 6 +#define CLKID_GP0_PLL 9#define CLKID_CLK81 12#define CLKID_MPLL2 15#define CLKID_SPI 34
@@ -24,5 +25,8 @@#define CLKID_SD_EMMC_A 94#define CLKID_SD_EMMC_B 95#define CLKID_SD_EMMC_C 96 +#define CLKID_MALI_0 97 +#define CLKID_MALI_1 98 +#define CLKID_MALI 99#endif /* __GXBB_CLKC_H */
Signature · 1 line
1.9.1
PATCH 2/2 ARM64: dts: meson-gxbb: Add Mali node
In reply to Neil ArmstrongAdd the Mali-450 MP3 node for GXBB.
--- arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +37 -0
@@ -474,6 +474,43 @@ }; }; +&apb { + mali: gpu at c0000 { + compatible = "amlogic,meson-gxbb-mali", "arm,mali-450"; + reg = <0x0 0xc0000 0x0 0x40000>; + interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 161 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 166 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "gp", "gpmmu", "pp", "pmu", + "pp0", "ppmmu0", "pp1", "ppmmu1", + "pp2", "ppmmu2"; + clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>; + clock-names = "bus", "core"; + + /* + * Mali clocking is provided by two identical clock paths + * MALI_0 and MALI_1 muxed to a single clock by a glitch + * free mux to safely change frequency while running. + */ + assigned-clocks = <&clkc CLKID_GP0_PLL>, + <&clkc CLKID_MALI_0>, + <&clkc CLKID_MALI>; /* Glitch free mux */ + assigned-clock-parents = <0>, /* Do Nothing */ + <&clkc CLKID_GP0_PLL>, + <&clkc CLKID_MALI_0>; + assigned-clock-rates = <744000000>, + <744000000>, + <0>; /* Do Nothing */ + }; +}; + &i2c_A { clocks = <&clkc CLKID_I2C>; };
Signature · 1 line
1.9.1