Add generic MFD i.MX mix and audiomix support
Subsystems (6)
v2 cover Add generic MFD i.MX mix and audiomix support
The i.MX8MP has some new IPs called mixes. They are formed usually by some GPRs that can be split into different functionalities. The first example here is the audiomix which has dedicated registers that can be registered as a clock controller and some other registers that can be registered as a reset controller, plus some dedicated ones that will be registered as syscon and used by each dedicated audio IP.
More mixes to be following the same structure are to come, like hdmimix, dispmix and mediamix. They will all be populated and registered by the MFD imx-mix generic driver.
Changes since RFC:
* changed the gate2 to work as shared with single bit, therefor avoiding to add the new clk-gate-shared clock type.
* implemented all Stephen's comments
* implemented all Peng's comments
* documented the DT bindings
Abel Vesa (13):
mfd: Add i.MX generic mix support
Documentation: mfd: Add DT bindings for i.MX Audiomix
arm64: dts: imx8mp: Add AIPS 4 and 5
arm64: dts: imx8mp: Add audiomix node
clk: imx: gate2: Allow single bit gating clock
clk: imx: pll14xx: Add the device as argument when registering
clk: imx: Add helpers for passing the device as argument
dt-bindings: clocks: imx8mp: Add ids for audiomix clocks
clk: imx: Add audiomix clock controller support
arm64: dts: imx8mp: Add audiomix clock controller node
dt-bindings: reset: imx8mp: Add ids for audiomix reset
reset: imx: Add audiomix reset controller support
arm64: dts: imx8mp: Add audiomix reset controller node
.../devicetree/bindings/mfd/fsl,imx-audiomix.txt | 34 +++ arch/arm64/boot/dts/freescale/imx8mp.dtsi | 41 +++- drivers/clk/imx/Makefile | 2 +- drivers/clk/imx/clk-audiomix.c | 228 +++++++++++++++++++++ drivers/clk/imx/clk-gate2.c | 31 ++- drivers/clk/imx/clk-pll14xx.c | 8 +- drivers/clk/imx/clk.h | 55 ++++- drivers/mfd/Kconfig | 11 + drivers/mfd/Makefile | 1 + drivers/mfd/imx-mix.c | 48 +++++ drivers/reset/Kconfig | 7 + drivers/reset/Makefile | 1 + drivers/reset/reset-imx-audiomix.c | 122 +++++++++++ include/dt-bindings/clock/imx8mp-clock.h | 62 ++++++ include/dt-bindings/reset/imx-audiomix-reset.h | 15 ++ 15 files changed, 648 insertions(+), 18 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt create mode 100644 drivers/clk/imx/clk-audiomix.c create mode 100644 drivers/mfd/imx-mix.c create mode 100644 drivers/reset/reset-imx-audiomix.c create mode 100644 include/dt-bindings/reset/imx-audiomix-reset.h
Signature · 1 line
2.7.4
PATCH v2 1/13 mfd: Add i.MX generic mix support
Some of the i.MX SoCs have a IP for interfacing the dedicated IPs with clocks, resets and interrupts, plus some other specific control registers. To allow the functionality to be split between drivers, this MFD driver is added that has only two purposes: register the devices and map the entire register addresses. Everything else is left to the dedicated drivers that will bind to the registered devices.
--- drivers/mfd/Kconfig | 11 +++++++++++ drivers/mfd/Makefile | 1 + drivers/mfd/imx-mix.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 drivers/mfd/imx-mix.c
drivers/mfd/Kconfig +11 -0
@@ -460,6 +460,17 @@ config MFD_MX25_TSADC i.MX25 processors. They consist of a conversion queue for general purpose ADC and a queue for Touchscreens. +config MFD_IMX_MIX + tristate "NXP i.MX Generic Mix Control Driver" + depends on OF || COMPILE_TEST + help + Enable generic mixes support. On some i.MX platforms, there are + devices that are a mix of multiple functionalities like reset + controllers, clock controllers and some others. In order to split + those functionalities between the right drivers, this MFD populates + with virtual devices based on what's found in the devicetree node, + leaving the rest of the behavior control to the dedicated driver. + config MFD_HI6421_PMIC tristate "HiSilicon Hi6421 PMU/Codec IC" depends on OF
drivers/mfd/Makefile +1 -0
@@ -113,6 +113,7 @@ obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o obj-$(CONFIG_TWL6040_CORE) += twl6040.o obj-$(CONFIG_MFD_MX25_TSADC) += fsl-imx25-tsadc.o +obj-$(CONFIG_MFD_IMX_MIX) += imx-mix.o obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o
drivers/mfd/imx-mix.c new file +48 -0
48 lines not on this page · raw message
Signature · 7 lines
2.7.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/13 Documentation: mfd: Add DT bindings for i.MX Audiomix
In reply to Abel VesaThe i.MX Audiomix is a mix of clock gates, reset bits and some other i.MX audio specific functionalities. Add information for the MFD, its clock and reset controllers.
--- .../devicetree/bindings/mfd/fsl,imx-audiomix.txt | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt
Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt new file +34 -0
@@ -0,0 +1,34 @@ +Freescale i.MX Audiomix +====================================== + +Audiomix is a conglomerate of different functionalities. + +Required properties: +- compatible: Should be "fsl,<chip>-mix" for the MFD device + Should be"fsl,<chip>-audiomix-clk" for the clock controller + Should be"fsl,<chip>-audiomix-reset" for the reset controller + Some functionalities of the audiomix will be registered as syscon. +- reg: should be register base and length as documented in the + datasheet + +example: + audiomix: audiomix@30e20000 { + compatible = "fsl,imx8mp-mix"; + reg = <0x30e20000 0x10000>; + + audiomix_clk: clock-controller { + compatible = "fsl,imx8mp-audiomix-clk"; + #clock-cells = <1>; + clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, + <&clk IMX8MP_CLK_AUDIO_AHB>, + <&clk IMX8MP_CLK_AUDIO_AXI_DIV>; + clock-names = "audio_root", + "audio_ahb", + "audio_axi_div"; + }; + + audiomix_reset: reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; + };
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v2 02/13] Documentation: mfd: Add DT bindings for i.MX Audiomix
Quoted 9 lines · Abel Vesa
The i.MX Audiomix is a mix of clock gates, reset bits and some other i.MX audio specific functionalities. Add information for the MFD, its clock and reset controllers.
Signed-off-by Abel Vesa <[email protected]>--- .../devicetree/bindings/mfd/fsl,imx-audiomix.txt | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt
Please use DT schema format.
Quoted 20 lines
Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt new file +14
-0@@ -0,0 +1,34 @@ +Freescale i.MX Audiomix +====================================== + +Audiomix is a conglomerate of different functionalities. + +Required properties: +- compatible: Should be "fsl,<chip>-mix" for the MFD device + Should be"fsl,<chip>-audiomix-clk" for the clock controller + Should be"fsl,<chip>-audiomix-reset" for the reset controller + Some functionalities of the audiomix will be registered as syscon. +- reg: should be register base and length as documented in the + datasheet + +example:
Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt line 24
Quoted 10 lines
Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt new file +10
-0+ audiomix: audiomix@30e20000 { + compatible = "fsl,imx8mp-mix"; + reg = <0x30e20000 0x10000>; + + audiomix_clk: clock-controller { + compatible = "fsl,imx8mp-audiomix-clk"; + #clock-cells = <1>; + clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, + <&clk IMX8MP_CLK_AUDIO_AHB>, + <&clk IMX8MP_CLK_AUDIO_AXI_DIV>;
None of these clocks are needed for the other functions in this MFD.
I'm not all that convinced that these child nodes are needed. A single node can be a clock and reset provider. If you have other things to add to the binding, do so now even if you don't have driver support.
Quoted 13 lines
Documentation/devicetree/bindings/mfd/fsl,imx-audiomix.txt new file +10
-0+ clock-names = "audio_root", + "audio_ahb", + "audio_axi_div"; + }; + + audiomix_reset: reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; + };Signature · 1 line
2.7.4
PATCH v2 3/13 arm64: dts: imx8mp: Add AIPS 4 and 5
In reply to Abel VesaThere are 5 AIPS maps in total, according to the RM. Add the missing ones here.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +18 -2
@@ -318,7 +318,7 @@ aips2: bus@30400000 { compatible = "fsl,aips-bus", "simple-bus"; - reg = <0x305f0000 0x400000>; + reg = <0x305f0000 0x10000>; #address-cells = <1>; #size-cells = <1>; ranges;
@@ -378,7 +378,7 @@ aips3: bus@30800000 { compatible = "fsl,aips-bus", "simple-bus"; - reg = <0x309f0000 0x400000>; + reg = <0x309f0000 0x10000>; #address-cells = <1>; #size-cells = <1>; ranges;
@@ -641,6 +641,22 @@ }; }; + aips4: bus@32c00000 { + compatible = "fsl,aips-bus", "simple-bus"; + reg = <0x32c00000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; + + aips5: bus@30c00000 { + compatible = "fsl,aips-bus", "simple-bus"; + reg = <0x30c00000 0x10000>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; + gic: interrupt-controller@38800000 { compatible = "arm,gic-v3"; reg = <0x38800000 0x10000>,
Signature · 1 line
2.7.4
PATCH v2 4/13 arm64: dts: imx8mp: Add audiomix node
In reply to Abel VesaAudiomix is a mix of multiple functionalities controlled by the audio IPs. In order to split the functionality between the rightfull drivers, it will be probled by the imx-mix MFD driver.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +5 -0
@@ -655,6 +655,11 @@ #address-cells = <1>; #size-cells = <1>; ranges; + + audiomix: audiomix@30e20000 { + compatible = "fsl,imx8mp-mix"; + reg = <0x30e20000 0x10000>; + }; }; gic: interrupt-controller@38800000 {
Signature · 1 line
2.7.4
PATCH v2 5/13 clk: imx: gate2: Allow single bit gating clock
In reply to Abel VesaAudiomix on i.MX8MP registers two gates that share the same enable count but use the same bit to control the gate instead of two bits. By adding the flag IMX_CLK_GATE2_SINGLE_BIT we allow the gate2 to use the generic gate ops for enable, disable and is_enabled.
For the disable_unused, nothing happens if this flag is specified.
--- drivers/clk/imx/clk-gate2.c | 31 +++++++++++++++++++++++-------- drivers/clk/imx/clk.h | 13 +++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-)
drivers/clk/imx/clk-gate2.c +23 -8
@@ -41,21 +41,26 @@ static int clk_gate2_enable(struct clk_hw *hw)struct clk_gate2 *gate =to_clk_gate2 (hw);u32 reg;unsigned long flags; +int ret =0 ;spin_lock_irqsave (gate->lock, flags);if (gate->share_count && (*gate->share_count)++ >0 ) goto out; - reg =readl (gate->reg); - reg &= ~(3 << gate->bit_idx); - reg |= gate->cgr_val << gate->bit_idx; -writel (reg, gate->reg); +if (gate->flags &IMX_CLK_GATE2_SINGLE_BIT ) { + ret = clk_gate_ops.enable (hw); + }else { + reg =readl (gate->reg); + reg &= ~(3 << gate->bit_idx); + reg |= gate->cgr_val << gate->bit_idx; +writel (reg, gate->reg); + } out:spin_unlock_irqrestore (gate->lock, flags); -return 0 ; +return ret; }static void clk_gate2_disable (struct clk_hw *hw)
@@ -73,9 +78,13 @@ static void clk_gate2_disable(struct clk_hw *hw) goto out; } - reg =readl (gate->reg); - reg &= ~(3 << gate->bit_idx); -writel (reg, gate->reg); +if (gate->flags &IMX_CLK_GATE2_SINGLE_BIT ) { + clk_gate_ops.disable (hw); + }else { + reg =readl (gate->reg); + reg &= ~(3 << gate->bit_idx); +writel (reg, gate->reg); + } out:spin_unlock_irqrestore (gate->lock, flags);
@@ -95,6 +104,9 @@ static int clk_gate2_is_enabled(struct clk_hw *hw) {struct clk_gate2 *gate =to_clk_gate2 (hw); +if (gate->flags &IMX_CLK_GATE2_SINGLE_BIT ) +return clk_gate_ops.is_enabled (hw); +return clk_gate2_reg_is_enabled (gate->reg, gate->bit_idx); }
@@ -104,6 +116,9 @@ static void clk_gate2_disable_unused(struct clk_hw *hw)unsigned long flags;u32 reg; +if (gate->flags &IMX_CLK_GATE2_SINGLE_BIT ) +return ; +spin_lock_irqsave (gate->lock, flags);if (!gate->share_count || *gate->share_count ==0 ) {
drivers/clk/imx/clk.h +13 -0
@@ -5,6 +5,8 @@#include <linux/spinlock.h> #include <linux/clk-provider.h> +#define IMX_CLK_GATE2_SINGLE_BIT 1 +extern spinlock_t imx_ccm_lock;void imx_check_clocks (struct clk *clks[],unsigned int count);
@@ -355,6 +357,17 @@ static inline struct clk_hw *imx_clk_hw_gate2_shared2(const char *name, &imx_ccm_lock, share_count); } +static inline struct clk_hw *imx_dev_clk_hw_gate_shared (struct device *dev, +const char *name,const char *parent, +void __iomem *reg,u8 shift, +unsigned int *share_count) +{ +return clk_hw_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT | +CLK_OPS_PARENT_ENABLE , reg, shift,0x3 , +IMX_CLK_GATE2_SINGLE_BIT , + &imx_ccm_lock, share_count); +} +static inline struct clk *imx_clk_gate2_cgr (const char *name,const char *parent,void __iomem *reg,u8 shift,u8 cgr_val) {
Signature · 1 line
2.7.4
PATCH v2 6/13 clk: imx: pll14xx: Add the device as argument when registering
In reply to Abel VesaIn order to allow runtime PM, the device needs to be passed on to the register function. Audiomix clock controller, used on i.MX8MP and future platforms, registers a pll14xx and has runtime PM support.
--- drivers/clk/imx/clk-pll14xx.c | 8 ++++---- drivers/clk/imx/clk.h | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/clk/imx/clk-pll14xx.c +4 -4
@@ -378,9 +378,9 @@ static const struct clk_ops clk_pll1443x_ops = { .set_rate = clk_pll1443x_set_rate, }; -struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char *parent_name, -void __iomem *base, -const struct imx_pll14xx_clk *pll_clk) +struct clk_hw *imx_dev_clk_hw_pll14xx (struct device *dev,const char *name, +const char *parent_name,void __iomem *base, +const struct imx_pll14xx_clk *pll_clk) {struct clk_pll14xx *pll;struct clk_hw *hw;
@@ -426,7 +426,7 @@ struct clk_hw *imx_clk_hw_pll14xx(const char *name, const char *parent_name, hw = &pll->hw; - ret =clk_hw_register (NULL , hw); + ret =clk_hw_register (dev, hw);if (ret) {pr_err ("%s: failed to register pll %s %d\n" , __func__, name, ret);
drivers/clk/imx/clk.h +10 -3
@@ -133,9 +133,9 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,#define imx_clk_pll14xx (name, parent_name, base, pll_clk) \ to_clk(imx_clk_hw_pll14xx(name, parent_name, base, pll_clk)) -struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char *parent_name, -void __iomem *base, -const struct imx_pll14xx_clk *pll_clk); +struct clk_hw *imx_dev_clk_hw_pll14xx (struct device *dev,const char *name, +const char *parent_name,void __iomem *base, +const struct imx_pll14xx_clk *pll_clk);struct clk_hw *imx_clk_hw_pllv1 (enum imx_pllv1_type type,const char *name,const char *parent,void __iomem *base);
@@ -242,6 +242,13 @@ static inline struct clk *to_clk(struct clk_hw *hw)return hw->clk; } +static inline struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char *parent_name, +void __iomem *base, +const struct imx_pll14xx_clk *pll_clk) +{ +return imx_dev_clk_hw_pll14xx (NULL , name, parent_name, base, pll_clk); +} +static inline struct clk_hw *imx_clk_hw_fixed (const char *name,int rate) {return clk_hw_register_fixed_rate (NULL , name,NULL ,0 , rate);
Signature · 1 line
2.7.4
PATCH v2 7/13 clk: imx: Add helpers for passing the device as argument
In reply to Abel VesaAll the imx clocks that need to be registered by the audiomix need to pass on the device so that the runtime PM support could work properly.
--- drivers/clk/imx/clk.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/clk/imx/clk.h +29 -0
@@ -319,6 +319,13 @@ static inline struct clk_hw *imx_clk_hw_gate(const char *name, const char *paren shift, 0, &imx_ccm_lock); } +static inline struct clk_hw *imx_dev_clk_hw_gate (struct device *dev,const char *name, +const char *parent,void __iomem *reg,u8 shift) +{ +return clk_hw_register_gate (dev, name, parent,CLK_SET_RATE_PARENT , reg, + shift,0 , &imx_ccm_lock); +} +static inline struct clk_hw *imx_clk_hw_gate_dis (const char *name,const char *parent,void __iomem *reg,u8 shift) {
@@ -431,6 +438,15 @@ static inline struct clk_hw *imx_clk_hw_mux(const char *name, void __iomem *reg, width, 0, &imx_ccm_lock); } +static inline struct clk_hw *imx_dev_clk_hw_mux (struct device *dev, +const char *name,void __iomem *reg,u8 shift, +u8 width,const char *const *parents,int num_parents) +{ +return clk_hw_register_mux (dev, name, parents, num_parents, +CLK_SET_RATE_NO_REPARENT |CLK_SET_PARENT_GATE , + reg, shift, width,0 , &imx_ccm_lock); +} +static inline struct clk *imx_clk_mux2 (const char *name,void __iomem *reg,u8 shift,u8 width,const char *const *parents,int num_parents)
@@ -493,6 +509,19 @@ static inline struct clk_hw *imx_clk_hw_mux_flags(const char *name, reg, shift, width, 0, &imx_ccm_lock); } +static inline struct clk_hw *imx_dev_clk_hw_mux_flags (struct device *dev, +const char *name, +void __iomem *reg,u8 shift, +u8 width, +const char *const *parents, +int num_parents, +unsigned long flags) +{ +return clk_hw_register_mux (dev, name, parents, num_parents, + flags |CLK_SET_RATE_NO_REPARENT , + reg, shift, width,0 , &imx_ccm_lock); +} +struct clk_hw *imx_clk_hw_cpu (const char *name,const char *parent_name,struct clk *div,struct clk *mux,struct clk *pll,struct clk *step);
Signature · 1 line
2.7.4
PATCH v2 8/13 dt-bindings: clocks: imx8mp: Add ids for audiomix clocks
In reply to Abel VesaAdd all the clock ids for the audiomix clocks.
--- include/dt-bindings/clock/imx8mp-clock.h | 62 ++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
include/dt-bindings/clock/imx8mp-clock.h +62 -0
@@ -298,4 +298,66 @@#define IMX8MP_CLK_END 289 +#define IMX8MP_CLK_AUDIOMIX_SAI1_IPG 0 +#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1 1 +#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK2 2 +#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK3 3 +#define IMX8MP_CLK_AUDIOMIX_SAI2_IPG 4 +#define IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1 5 +#define IMX8MP_CLK_AUDIOMIX_SAI2_MCLK2 6 +#define IMX8MP_CLK_AUDIOMIX_SAI2_MCLK3 7 +#define IMX8MP_CLK_AUDIOMIX_SAI3_IPG 8 +#define IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1 9 +#define IMX8MP_CLK_AUDIOMIX_SAI3_MCLK2 10 +#define IMX8MP_CLK_AUDIOMIX_SAI3_MCLK3 11 +#define IMX8MP_CLK_AUDIOMIX_SAI5_IPG 12 +#define IMX8MP_CLK_AUDIOMIX_SAI5_MCLK1 13 +#define IMX8MP_CLK_AUDIOMIX_SAI5_MCLK2 14 +#define IMX8MP_CLK_AUDIOMIX_SAI5_MCLK3 15 +#define IMX8MP_CLK_AUDIOMIX_SAI6_IPG 16 +#define IMX8MP_CLK_AUDIOMIX_SAI6_MCLK1 17 +#define IMX8MP_CLK_AUDIOMIX_SAI6_MCLK2 18 +#define IMX8MP_CLK_AUDIOMIX_SAI6_MCLK3 19 +#define IMX8MP_CLK_AUDIOMIX_SAI7_IPG 20 +#define IMX8MP_CLK_AUDIOMIX_SAI7_MCLK1 21 +#define IMX8MP_CLK_AUDIOMIX_SAI7_MCLK2 22 +#define IMX8MP_CLK_AUDIOMIX_SAI7_MCLK3 23 +#define IMX8MP_CLK_AUDIOMIX_ASRC_IPG 24 +#define IMX8MP_CLK_AUDIOMIX_PDM_IPG 25 +#define IMX8MP_CLK_AUDIOMIX_SDMA2_ROOT 26 +#define IMX8MP_CLK_AUDIOMIX_SDMA3_ROOT 27 +#define IMX8MP_CLK_AUDIOMIX_SPBA2_ROOT 28 +#define IMX8MP_CLK_AUDIOMIX_DSP_ROOT 29 +#define IMX8MP_CLK_AUDIOMIX_DSPDBG_ROOT 30 +#define IMX8MP_CLK_AUDIOMIX_EARC_IPG 31 +#define IMX8MP_CLK_AUDIOMIX_OCRAMA_IPG 32 +#define IMX8MP_CLK_AUDIOMIX_AUD2HTX_IPG 33 +#define IMX8MP_CLK_AUDIOMIX_EDMA_ROOT 34 +#define IMX8MP_CLK_AUDIOMIX_AUDPLL_ROOT 35 +#define IMX8MP_CLK_AUDIOMIX_MU2_ROOT 36 +#define IMX8MP_CLK_AUDIOMIX_MU3_ROOT 37 +#define IMX8MP_CLK_AUDIOMIX_EARC_PHY 38 +#define IMX8MP_CLK_AUDIOMIX_PDM_ROOT 39 +#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1_SEL 40 +#define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK2_SEL 41 +#define IMX8MP_CLK_AUDIOMIX_SAI2_MCLK1_SEL 42 +#define IMX8MP_CLK_AUDIOMIX_SAI2_MCLK2_SEL 43 +#define IMX8MP_CLK_AUDIOMIX_SAI3_MCLK1_SEL 44 +#define IMX8MP_CLK_AUDIOMIX_SAI3_MCLK2_SEL 45 +#define IMX8MP_CLK_AUDIOMIX_SAI4_MCLK1_SEL 46 +#define IMX8MP_CLK_AUDIOMIX_SAI4_MCLK2_SEL 47 +#define IMX8MP_CLK_AUDIOMIX_SAI5_MCLK1_SEL 48 +#define IMX8MP_CLK_AUDIOMIX_SAI5_MCLK2_SEL 49 +#define IMX8MP_CLK_AUDIOMIX_SAI6_MCLK1_SEL 50 +#define IMX8MP_CLK_AUDIOMIX_SAI6_MCLK2_SEL 51 +#define IMX8MP_CLK_AUDIOMIX_SAI7_MCLK1_SEL 52 +#define IMX8MP_CLK_AUDIOMIX_SAI7_MCLK2_SEL 53 +#define IMX8MP_CLK_AUDIOMIX_PDM_SEL 54 +#define IMX8MP_CLK_AUDIOMIX_SAI_PLL_REF_SEL 55 +#define IMX8MP_CLK_AUDIOMIX_SAI_PLL 56 +#define IMX8MP_CLK_AUDIOMIX_SAI_PLL_BYPASS 57 +#define IMX8MP_CLK_AUDIOMIX_SAI_PLL_OUT 58 + +#define IMX8MP_CLK_AUDIOMIX_END 59 +#endif
Signature · 1 line
2.7.4
PATCH v2 9/13 clk: imx: Add audiomix clock controller support
In reply to Abel VesaThe imx-mix MFD driver registers some devices, one of which, in case of audiomix, maps correctly to a clock controller type. This driver registers a clock controller for that.
--- drivers/clk/imx/Makefile | 2 +- drivers/clk/imx/clk-audiomix.c | 228 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/imx/clk-audiomix.c
drivers/clk/imx/Makefile +1 -1
@@ -27,7 +27,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \ obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o -obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o +obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o clk-audiomix.o obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o
drivers/clk/imx/clk-audiomix.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 10/13 arm64: dts: imx8mp: Add audiomix clock controller node
In reply to Abel VesaAdd the audiomix clock controller as part of the audiomix MFD.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +11 -0
@@ -659,6 +659,17 @@ audiomix: audiomix@30e20000 { compatible = "fsl,imx8mp-mix"; reg = <0x30e20000 0x10000>; + + audiomix_clk: clock-controller { + compatible = "fsl,imx8mp-audiomix-clk"; + #clock-cells = <1>; + clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>, + <&clk IMX8MP_CLK_AUDIO_AHB>, + <&clk IMX8MP_CLK_AUDIO_AXI_DIV>; + clock-names = "audio_root", + "audio_ahb", + "audio_axi_div"; + }; }; };
Signature · 1 line
2.7.4
PATCH v2 11/13 dt-bindings: reset: imx8mp: Add ids for audiomix reset
In reply to Abel VesaAdd all the reset ids for the audiomix reset.
--- include/dt-bindings/reset/imx-audiomix-reset.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/dt-bindings/reset/imx-audiomix-reset.h
include/dt-bindings/reset/imx-audiomix-reset.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 NXP. +*/ + +#ifndef DT_BINDING_RESET_IMX_AUDIOMIX_H +#define DT_BINDING_RESET_IMX_AUDIOMIX_H + +#define IMX_AUDIOMIX_EARC_RESET 0x0 +#define IMX_AUDIOMIX_EARC_PHY_RESET 0x1 + +#define IMX_AUDIOMIX_RESET_NUM 2 + +#endif +
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v2 11/13] dt-bindings: reset: imx8mp: Add ids for audiomix reset
Quoted 7 lines · Abel Vesa
Add all the reset ids for the audiomix reset.
Signed-off-by Abel Vesa <[email protected]>--- include/dt-bindings/reset/imx-audiomix-reset.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/dt-bindings/reset/imx-audiomix-reset.h
This goes in the binding patch.
Quoted 25 lines
include/dt-bindings/reset/imx-audiomix-reset.h new file +15
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright 2019 NXP. +*/ + +#ifndef DT_BINDING_RESET_IMX_AUDIOMIX_H +#define DT_BINDING_RESET_IMX_AUDIOMIX_H + +#define IMX_AUDIOMIX_EARC_RESET 0x0 +#define IMX_AUDIOMIX_EARC_PHY_RESET 0x1 + +#define IMX_AUDIOMIX_RESET_NUM 2 + +#endif +Signature · 1 line
2.7.4
PATCH v2 12/13 reset: imx: Add audiomix reset controller support
In reply to Abel VesaThe imx-mix MFD driver registers some devices, one of which, in case of audiomix, maps correctly to a reset controller type. This driver registers a reset controller for that. For now, only the EARC specific resets are added.
--- drivers/reset/Kconfig | 7 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-imx-audiomix.c | 122 +++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 drivers/reset/reset-imx-audiomix.c
drivers/reset/Kconfig +7 -0
@@ -81,6 +81,13 @@ config RESET_INTEL_GW Say Y to control the reset signals provided by reset controller. Otherwise, say N. +config RESET_IMX_AUDIOMIX + bool "i.MX Audiomix Reset Driver" if COMPILE_TEST + depends on HAS_IOMEM + default ARCH_MXC + help + This enables the audiomix reset controller driver for i.MX SoCs. + config RESET_LANTIQ bool "Lantiq XWAY Reset Driver" if COMPILE_TEST default SOC_TYPE_XWAY
drivers/reset/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o +obj-$(CONFIG_RESET_IMX_AUDIOMIX) += reset-imx-audiomix.o obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o obj-$(CONFIG_RESET_MESON) += reset-meson.o
drivers/reset/reset-imx-audiomix.c new file +122 -0
122 lines not on this page · raw message
Signature · 1 line
2.7.4
Philipp Zabel
maintainerRe: [PATCH v2 12/13] reset: imx: Add audiomix reset controller support
Hi Abel,
Quoted 3 lines · Abel Vesa
The imx-mix MFD driver registers some devices, one of which, in case of audiomix, maps correctly to a reset controller type. This driver registers a reset controller for that. For now, only the EARC specific resets are added.
I am still confused about what the runtime PM actually does. Maybe it would help me understand if you could point me to the EARC driver that is using this reset controller.
Quoted 31 lines
Signed-off-by Abel Vesa <[email protected]>--- drivers/reset/Kconfig | 7 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-imx-audiomix.c | 122 +++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 drivers/reset/reset-imx-audiomix.cdrivers/reset/Kconfig +7
-0@@ -81,6 +81,13 @@ config RESET_INTEL_GW Say Y to control the reset signals provided by reset controller. Otherwise, say N. +config RESET_IMX_AUDIOMIX + bool "i.MX Audiomix Reset Driver" if COMPILE_TEST + depends on HAS_IOMEM + default ARCH_MXC + help + This enables the audiomix reset controller driver for i.MX SoCs. + config RESET_LANTIQ bool "Lantiq XWAY Reset Driver" if COMPILE_TEST default SOC_TYPE_XWAYdrivers/reset/Makefile +0
-0
drivers/reset/Makefile obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o · line 15
Quoted 4 lines
drivers/reset/Makefile +1
-0@@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o +obj-$(CONFIG_RESET_IMX_AUDIOMIX) += reset-imx-audiomix.o
The cover letter mentions hdmimix, dispmix and mediamix. Are there going to be a bunch of those mix reset drivers? How do they differ?
drivers/reset/reset-imx-audiomix.c line 1
Quoted 10 lines
drivers/reset/Makefile +0
-0obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o obj-$(CONFIG_RESET_MESON) += reset-meson.odrivers/reset/reset-imx-audiomix.c new file +1
-0@@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0
I think GPL-2.0 has been deprecated in the SPDX license list, better use GPL-2.0-only for new files.
Quoted 40 lines
drivers/reset/reset-imx-audiomix.c new file +40
-0+/* +* Copyright 2019 NXP. +*/ + +#include <dt-bindings/reset/imx-audiomix-reset.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/reset-controller.h> + +#define IMX_AUDIOMIX_EARC_CTRL_REG 0x200 + +#define IMX_AUDIOMIX_EARC_RESET_BIT 0x0 +#define IMX_AUDIOMIX_EARC_PHY_RESET_BIT 0x1 + +struct imx_audiomix_reset_data { +void __iomem *base; +struct reset_controller_dev rcdev; +spinlock_t lock; +}; + +static int imx_audiomix_reset_set (struct reset_controller_dev *rcdev, +unsigned long id,bool assert) +{ +struct imx_audiomix_reset_data *drvdata =container_of (rcdev, + struct imx_audiomix_reset_data, rcdev); +void __iomem *reg_addr = drvdata->base; +unsigned long flags; +unsigned int offset; +u32 reg; + +switch (id) { +case IMX_AUDIOMIX_EARC_PHY_RESET : + reg_addr +=IMX_AUDIOMIX_EARC_CTRL_REG ; + offset =IMX_AUDIOMIX_EARC_PHY_RESET_BIT ; +break ;
drivers/reset/reset-imx-audiomix.c line 51
Quoted 10 lines
drivers/reset/reset-imx-audiomix.c new file +10
-0+case IMX_AUDIOMIX_EARC_RESET : + reg_addr +=IMX_AUDIOMIX_EARC_CTRL_REG ; + offset =IMX_AUDIOMIX_EARC_RESET_BIT ; +break ; +default : +return -EINVAL ; + } + +if (assert) { +pm_runtime_get_sync (rcdev->dev);
This driver and the parent MFD driver do not implement runtime PM ops, and the device tree bindings do not specify any power domains. What does this actually do?
drivers/reset/reset-imx-audiomix.c line 61
Quoted 10 lines
drivers/reset/reset-imx-audiomix.c new file +10
-0+spin_lock_irqsave (&drvdata->lock, flags); + reg =readl (reg_addr); +writel (reg & ~BIT (offset), reg_addr); +spin_unlock_irqrestore (&drvdata->lock, flags); + }else { +spin_lock_irqsave (&drvdata->lock, flags); + reg =readl (reg_addr); +writel (reg |BIT (offset), reg_addr); +spin_unlock_irqrestore (&drvdata->lock, flags); +pm_runtime_put (rcdev->dev);
Assuming this disables the power domain that powers the whole Audiomix, what happens to the reset lines in this case? Do they float? Are they guaranteed to stay deasserted?
Note that the reset API does not require consumers to call reset_control_assert() on an exclusive reset control before calling reset_control_deassert(), so this could easily lead to issues with the device usage counter.
Shared reset controls call deassert first, and assert after the last user is gone, so if the driver would start with deasserting both EARC and EARC_PHY reset lines via shared reset controls, this would underflow the device usage counter right away.
Quoted 51 lines
drivers/reset/reset-imx-audiomix.c new file +51
-0+ } + +return 0 ; +} + +static int imx_audiomix_reset_assert (struct reset_controller_dev *rcdev, +unsigned long id) +{ +return imx_audiomix_reset_set (rcdev, id, true); +} + +static int imx_audiomix_reset_deassert (struct reset_controller_dev *rcdev, +unsigned long id) +{ +return imx_audiomix_reset_set (rcdev, id, false); +} + +static const struct reset_control_ops imx_audiomix_reset_ops = { + .assert = imx_audiomix_reset_assert, + .deassert = imx_audiomix_reset_deassert, +}; + +static int imx_audiomix_reset_probe (struct platform_device *pdev) +{ +struct imx_audiomix_reset_data *drvdata; +struct device *dev = &pdev->dev; + + drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (drvdata ==NULL ) +return -ENOMEM ; + + drvdata->base =dev_get_drvdata (dev->parent); + +platform_set_drvdata (pdev, drvdata); + +pm_runtime_enable (dev); + +spin_lock_init (&drvdata->lock); + + drvdata->rcdev.owner =THIS_MODULE ; + drvdata->rcdev.nr_resets =IMX_AUDIOMIX_RESET_NUM ; + drvdata->rcdev.ops = &imx_audiomix_reset_ops; + drvdata->rcdev.of_node = dev->of_node; + drvdata->rcdev.dev = dev; + +return devm_reset_controller_register (dev, &drvdata->rcdev); +} + +static const struct of_device_id imx_audiomix_reset_dt_ids[] = { + { .compatible ="fsl,imx8mp-audiomix-reset" , }, + {/* sentinel */ },
drivers/reset/reset-imx-audiomix.c line 122
Quoted 10 lines
drivers/reset/reset-imx-audiomix.c new file +10
-0+}; + +static struct platform_driver imx_audiomix_reset_driver = { + .probe = imx_audiomix_reset_probe, + .driver = { + .name =KBUILD_MODNAME , + .of_match_table = imx_audiomix_reset_dt_ids, + }, +}; +module_platform_driver (imx_audiomix_reset_driver);
regards
Philipp
Re: [PATCH v2 12/13] reset: imx: Add audiomix reset controller support
On 20-03-26 11:50:47, Philipp Zabel wrote:
Sorry for the late response. Please see my inline comments.
Quoted 11 lines
Hi Abel,
Quoted 3 lines · Abel Vesa
The imx-mix MFD driver registers some devices, one of which, in case of audiomix, maps correctly to a reset controller type. This driver registers a reset controller for that. For now, only the EARC specific resets are added.
I am still confused about what the runtime PM actually does. Maybe it would help me understand if you could point me to the EARC driver that is using this reset controller.
The documentation for the i.MX8MP is not public yet, so I'll try to explain with my own words how this works.
The audiomix is a HW mix that concentrates multiple GPRs that are audio subsystem related into one single IP. These mixes (hdmitx, mediamix, etc) have their own power domains, that's why the runtime PM.
Quoted 30 lines
Quoted 30 lines
Signed-off-by Abel Vesa <[email protected]>--- drivers/reset/Kconfig | 7 +++ drivers/reset/Makefile | 1 + drivers/reset/reset-imx-audiomix.c | 122 +++++++++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 drivers/reset/reset-imx-audiomix.cdrivers/reset/Kconfig +7
-0@@ -81,6 +81,13 @@ config RESET_INTEL_GW Say Y to control the reset signals provided by reset controller. Otherwise, say N. +config RESET_IMX_AUDIOMIX + bool "i.MX Audiomix Reset Driver" if COMPILE_TEST + depends on HAS_IOMEM + default ARCH_MXC + help + This enables the audiomix reset controller driver for i.MX SoCs. + config RESET_LANTIQ bool "Lantiq XWAY Reset Driver" if COMPILE_TEST default SOC_TYPE_XWAYdrivers/reset/Makefile +0
-0
Quoted 8 lines
drivers/reset/Makefile obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o · line 15
Quoted 5 lines
drivers/reset/Makefile +1
-0@@ -12,6 +12,7 @@ obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o +obj-$(CONFIG_RESET_IMX_AUDIOMIX) += reset-imx-audiomix.oThe cover letter mentions hdmimix, dispmix and mediamix. Are there going to be a bunch of those mix reset drivers? How do they differ?
Well, each mix will deal with a different bunch of GPRs. Again, the mix
is a conglomerate of GPRs specific to one subsystem (like audio, display, hdmi, and so on).
Quoted 14 lines
drivers/reset/reset-imx-audiomix.c line 1
Quoted 11 lines
drivers/reset/Makefile +0
-0obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o obj-$(CONFIG_RESET_MESON) += reset-meson.odrivers/reset/reset-imx-audiomix.c new file +1
-0@@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0 I think GPL-2.0 has been deprecated in the SPDX license list, better use GPL-2.0-only for new files.
Will fix in the next version.
Quoted 47 lines
Quoted 47 lines
drivers/reset/reset-imx-audiomix.c new file +46
-0+/* +* Copyright 2019 NXP. +*/ + +#include <dt-bindings/reset/imx-audiomix-reset.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/reset-controller.h> + +#define IMX_AUDIOMIX_EARC_CTRL_REG 0x200 + +#define IMX_AUDIOMIX_EARC_RESET_BIT 0x0 +#define IMX_AUDIOMIX_EARC_PHY_RESET_BIT 0x1 + +struct imx_audiomix_reset_data { +void __iomem *base; +struct reset_controller_dev rcdev; +spinlock_t lock; +}; + +static int imx_audiomix_reset_set (struct reset_controller_dev *rcdev, +unsigned long id,bool assert) +{ +struct imx_audiomix_reset_data *drvdata =container_of (rcdev, + struct imx_audiomix_reset_data, rcdev); +void __iomem *reg_addr = drvdata->base; +unsigned long flags; +unsigned int offset; +u32 reg; + +switch (id) { +case IMX_AUDIOMIX_EARC_PHY_RESET : + reg_addr +=IMX_AUDIOMIX_EARC_CTRL_REG ; + offset =IMX_AUDIOMIX_EARC_PHY_RESET_BIT ; +break ; +case IMX_AUDIOMIX_EARC_RESET : + reg_addr +=IMX_AUDIOMIX_EARC_CTRL_REG ; + offset =IMX_AUDIOMIX_EARC_RESET_BIT ; +break ; +default : +return -EINVAL ;
Quoted 8 lines
drivers/reset/reset-imx-audiomix.c line 51
Quoted 4 lines
drivers/reset/reset-imx-audiomix.c new file +4
-0+ } + +if (assert) { +pm_runtime_get_sync (rcdev->dev);This driver and the parent MFD driver do not implement runtime PM ops, and the device tree bindings do not specify any power domains. What does this actually do?
The power domains will be sent in the near future. Maybe I should just drop the pm_runtime for now and submit that part when the PD are already in.
Quoted 15 lines
drivers/reset/reset-imx-audiomix.c line 61
Quoted 11 lines
drivers/reset/reset-imx-audiomix.c new file +10
-0+spin_lock_irqsave (&drvdata->lock, flags); + reg =readl (reg_addr); +writel (reg & ~BIT (offset), reg_addr); +spin_unlock_irqrestore (&drvdata->lock, flags); + }else { +spin_lock_irqsave (&drvdata->lock, flags); + reg =readl (reg_addr); +writel (reg |BIT (offset), reg_addr); +spin_unlock_irqrestore (&drvdata->lock, flags); +pm_runtime_put (rcdev->dev);Assuming this disables the power domain that powers the whole Audiomix, what happens to the reset lines in this case? Do they float? Are they guaranteed to stay deasserted?
AFAIK, they stay deasserted. But this audiomix should only be suspended only after all the resets and clocks users have already suspended. So the actual state of the resets should not matter at that point.
Quoted 5 lines
Note that the reset API does not require consumers to call
reset_control_assert()on an exclusive reset control before callingreset_control_deassert(), so this could easily lead to issues with the device usage counter.
Hmm, you're right. It seems I need to keep count of each assertion/deassertion for each reset id. As I said before, maybe for now I should drop the runtime pm for the entire thing.
Am I the first one to make use of runtime PM for a reset controller ?!
Is the 'reset controller with its own PD" something I'm the only one dealing with EVER ? Grepping the drivers/reset for the runtime, it seems I am. THAT'S WEIRD ! :D
Quoted 5 lines
Shared reset controls call deassert first, and assert after the last user is gone, so if the driver would start with deasserting both EARC and
EARC_PHYreset lines via shared reset controls, this would underflow the device usage counter right away.
Right again. I'll definitely drop the runtime PM for now.
Quoted 65 lines
Quoted 52 lines
drivers/reset/reset-imx-audiomix.c new file +51
-0+ } + +return 0 ; +} + +static int imx_audiomix_reset_assert (struct reset_controller_dev *rcdev, +unsigned long id) +{ +return imx_audiomix_reset_set (rcdev, id, true); +} + +static int imx_audiomix_reset_deassert (struct reset_controller_dev *rcdev, +unsigned long id) +{ +return imx_audiomix_reset_set (rcdev, id, false); +} + +static const struct reset_control_ops imx_audiomix_reset_ops = { + .assert = imx_audiomix_reset_assert, + .deassert = imx_audiomix_reset_deassert, +}; + +static int imx_audiomix_reset_probe (struct platform_device *pdev) +{ +struct imx_audiomix_reset_data *drvdata; +struct device *dev = &pdev->dev; + + drvdata =devm_kzalloc (&pdev->dev,sizeof (*drvdata),GFP_KERNEL ); +if (drvdata ==NULL ) +return -ENOMEM ; + + drvdata->base =dev_get_drvdata (dev->parent); + +platform_set_drvdata (pdev, drvdata); + +pm_runtime_enable (dev); + +spin_lock_init (&drvdata->lock); + + drvdata->rcdev.owner =THIS_MODULE ; + drvdata->rcdev.nr_resets =IMX_AUDIOMIX_RESET_NUM ; + drvdata->rcdev.ops = &imx_audiomix_reset_ops; + drvdata->rcdev.of_node = dev->of_node; + drvdata->rcdev.dev = dev; + +return devm_reset_controller_register (dev, &drvdata->rcdev); +} + +static const struct of_device_id imx_audiomix_reset_dt_ids[] = { + { .compatible ="fsl,imx8mp-audiomix-reset" , }, + {/* sentinel */ },drivers/reset/reset-imx-audiomix.c line 122
Quoted 10 lines
drivers/reset/reset-imx-audiomix.c new file +10
-0+}; + +static struct platform_driver imx_audiomix_reset_driver = { + .probe = imx_audiomix_reset_probe, + .driver = { + .name =KBUILD_MODNAME , + .of_match_table = imx_audiomix_reset_dt_ids, + }, +}; +module_platform_driver (imx_audiomix_reset_driver);regards
Philipp
PATCH v2 13/13 arm64: dts: imx8mp: Add audiomix reset controller node
In reply to Abel VesaAdd the audiomix reset controller as part of the audiomix MFD.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +5 -0
@@ -670,6 +670,11 @@ "audio_ahb", "audio_axi_div"; }; + + audiomix_reset: reset-controller { + compatible = "fsl,imx8mp-audiomix-reset"; + #reset-cells = <1>; + }; }; };
Signature · 1 line
2.7.4