... | ... | ||
---|---|---|---|
21 | should provide better management of the device dependencies. | 21 | should provide better management of the device dependencies. |
22 | 22 | ||
23 | [1]: https://lore.kernel.org/linux-arm-kernel/20241119130726.2761726-1-daniel.baluta@nxp.com/ | 23 | [1]: https://lore.kernel.org/linux-arm-kernel/20241119130726.2761726-1-daniel.baluta@nxp.com/ |
24 | 24 | ||
25 | --- | 25 | --- |
26 | Changes in v5: | ||
27 | * merge imx-aipstz.h into imx8mp-aipstz.h. imx-aipstz.h is | ||
28 | currently only used in the DTS so it can't be added as a binding. | ||
29 | * place 'ranges' property just after 'reg' in the binding DT example | ||
30 | as Frank suggested. | ||
31 | * use the (1 << x) notation for the configuration bits. Previously, | ||
32 | hex values were used which didn't make it very clear that the | ||
33 | configuration options are bits. | ||
34 | * shorten the description of the bridge's AC cells. | ||
35 | * shorten the message of the commit introducing the bridge's binding. | ||
36 | * pick up some more R-b's on patches that remained untouched since V4. | ||
37 | * link to v4: https://lore.kernel.org/lkml/20250401154404.45932-1-laurentiumihalcea111@gmail.com/ | ||
38 | |||
26 | Changes in v4: | 39 | Changes in v4: |
27 | * AIPS5 node now only contains a single memory region: that of the AC | 40 | * AIPS5 node now only contains a single memory region: that of the AC |
28 | (just like in V2). 'reg-names' property is dropped. | 41 | (just like in V2). 'reg-names' property is dropped. |
29 | * AIPS5 node now uses 'ranges' property to restrict the size of the bus | 42 | * AIPS5 node now uses 'ranges' property to restrict the size of the bus |
30 | (1:1 mapping) | 43 | (1:1 mapping) |
31 | * change the number of AC cells from 0 to 3 | 44 | * change the number of AC cells from 0 to 3 |
32 | * add binding headers | 45 | * add binding headers |
33 | * link to v3: https://lore.kernel.org/lkml/20250324162556.30972-1-laurentiumihalcea111@gmail.com/ | 46 | * link to v3: https://lore.kernel.org/lkml/20250324162556.30972-1-laurentiumihalcea111@gmail.com/ |
34 | 47 | ||
35 | Changes in v3: | 48 | Changes in v3: |
36 | * make '#address-cells' and '#size-cells' constants and equal to 1 in the | 49 | * make '#address-cells' and '#size-cells' constants and equal to 1 in the |
37 | binding. The bus is 32-bit. | 50 | binding. The bus is 32-bit. |
38 | * add child node in the example DT snippet. | 51 | * add child node in the example DT snippet. |
39 | * the 'aips5' DT node now contains 2 memory regions: that of the | 52 | * the 'aips5' DT node now contains 2 memory regions: that of the |
40 | peripherals accessible via this bridge and that of the access controller. | 53 | peripherals accessible via this bridge and that of the access controller. |
41 | * link to v2: https://lore.kernel.org/lkml/20250226165314.34205-1-laurentiumihalcea111@gmail.com/ | 54 | * link to v2: https://lore.kernel.org/lkml/20250226165314.34205-1-laurentiumihalcea111@gmail.com/ |
... | ... | ||
47 | comment, AIPSTZ is not a "simple-bus". | 60 | comment, AIPSTZ is not a "simple-bus". |
48 | * link to v1: https://lore.kernel.org/lkml/20250221191909.31874-1-laurentiumihalcea111@gmail.com/ | 61 | * link to v1: https://lore.kernel.org/lkml/20250221191909.31874-1-laurentiumihalcea111@gmail.com/ |
49 | --- | 62 | --- |
50 | 63 | ||
51 | Laurentiu Mihalcea (6): | 64 | Laurentiu Mihalcea (6): |
52 | dt-bindings: bus: add documentation for the IMX AIPSTZ bridge | 65 | dt-bindings: bus: document the IMX AIPSTZ bridge |
53 | dt-bindings: dsp: fsl,dsp: document 'access-controllers' property | 66 | dt-bindings: dsp: fsl,dsp: document 'access-controllers' property |
54 | bus: add driver for IMX AIPSTZ bridge | 67 | bus: add driver for IMX AIPSTZ bridge |
55 | arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' | 68 | arm64: dts: imx8mp: convert 'aips5' to 'aipstz5' |
56 | arm64: dts: imx8mp: add aipstz master ID definitions | 69 | arm64: dts: imx8mp: add aipstz-related definitions |
57 | arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' | 70 | arm64: dts: imx8mp: make 'dsp' node depend on 'aips5' |
58 | 71 | ||
59 | .../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++ | 72 | .../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++ |
60 | .../devicetree/bindings/dsp/fsl,dsp.yaml | 3 + | 73 | .../devicetree/bindings/dsp/fsl,dsp.yaml | 3 + |
61 | arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 25 +++++ | 74 | arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 39 +++++++ |
62 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 12 +- | 75 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 12 +- |
63 | drivers/bus/Kconfig | 6 + | 76 | drivers/bus/Kconfig | 6 + |
64 | drivers/bus/Makefile | 1 + | 77 | drivers/bus/Makefile | 1 + |
65 | drivers/bus/imx-aipstz.c | 92 ++++++++++++++++ | 78 | drivers/bus/imx-aipstz.c | 92 ++++++++++++++++ |
66 | include/dt-bindings/bus/imx-aipstz.h | 25 +++++ | 79 | 7 files changed, 253 insertions(+), 4 deletions(-) |
67 | 8 files changed, 264 insertions(+), 4 deletions(-) | ||
68 | create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml | 80 | create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml |
69 | create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 81 | create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h |
70 | create mode 100644 drivers/bus/imx-aipstz.c | 82 | create mode 100644 drivers/bus/imx-aipstz.c |
71 | create mode 100644 include/dt-bindings/bus/imx-aipstz.h | ||
72 | 83 | ||
73 | -- | 84 | -- |
74 | 2.34.1 | 85 | 2.34.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
5 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> | 5 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> |
6 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> | 6 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> |
7 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 7 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
8 | --- | 8 | --- |
9 | .../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++ | 9 | .../bindings/bus/fsl,imx8mp-aipstz.yaml | 104 ++++++++++++++++++ |
10 | include/dt-bindings/bus/imx-aipstz.h | 25 +++++ | 10 | 1 file changed, 104 insertions(+) |
11 | 2 files changed, 129 insertions(+) | ||
12 | create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml | 11 | create mode 100644 Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml |
13 | create mode 100644 include/dt-bindings/bus/imx-aipstz.h | ||
14 | 12 | ||
15 | diff --git a/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml | 13 | diff --git a/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml b/Documentation/devicetree/bindings/bus/fsl,imx8mp-aipstz.yaml |
16 | new file mode 100644 | 14 | new file mode 100644 |
17 | index XXXXXXX..XXXXXXX | 15 | index XXXXXXX..XXXXXXX |
18 | --- /dev/null | 16 | --- /dev/null |
... | ... | ||
52 | + const: 1 | 50 | + const: 1 |
53 | + | 51 | + |
54 | + "#access-controller-cells": | 52 | + "#access-controller-cells": |
55 | + const: 3 | 53 | + const: 3 |
56 | + description: | 54 | + description: |
57 | + The first cell consists of the consumer type (master or peripheral). | 55 | + First cell - consumer type (master or peripheral) |
58 | + The second cell consists of the consumer ID. | 56 | + Second cell - consumer ID |
59 | + The third cell consists of the configuration value. | 57 | + Third cell - configuration value |
60 | + | 58 | + |
61 | + ranges: true | 59 | + ranges: true |
62 | + | 60 | + |
63 | +# borrowed from simple-bus.yaml, no additional requirements for children | 61 | +# borrowed from simple-bus.yaml, no additional requirements for children |
64 | +patternProperties: | 62 | +patternProperties: |
... | ... | ||
103 | + #include <dt-bindings/interrupt-controller/arm-gic.h> | 101 | + #include <dt-bindings/interrupt-controller/arm-gic.h> |
104 | + | 102 | + |
105 | + bus@30df0000 { | 103 | + bus@30df0000 { |
106 | + compatible = "fsl,imx8mp-aipstz"; | 104 | + compatible = "fsl,imx8mp-aipstz"; |
107 | + reg = <0x30df0000 0x10000>; | 105 | + reg = <0x30df0000 0x10000>; |
106 | + ranges = <0x30c00000 0x30c00000 0x400000>; | ||
108 | + power-domains = <&pgc_audio>; | 107 | + power-domains = <&pgc_audio>; |
109 | + #address-cells = <1>; | 108 | + #address-cells = <1>; |
110 | + #size-cells = <1>; | 109 | + #size-cells = <1>; |
111 | + #access-controller-cells = <3>; | 110 | + #access-controller-cells = <3>; |
112 | + ranges = <0x30c00000 0x30c00000 0x400000>; | ||
113 | + | 111 | + |
114 | + dma-controller@30e00000 { | 112 | + dma-controller@30e00000 { |
115 | + compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma"; | 113 | + compatible = "fsl,imx8mp-sdma", "fsl,imx8mq-sdma"; |
116 | + reg = <0x30e00000 0x10000>; | 114 | + reg = <0x30e00000 0x10000>; |
117 | + #dma-cells = <3>; | 115 | + #dma-cells = <3>; |
... | ... | ||
120 | + clock-names = "ipg", "ahb"; | 118 | + clock-names = "ipg", "ahb"; |
121 | + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; | 119 | + interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>; |
122 | + fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; | 120 | + fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin"; |
123 | + }; | 121 | + }; |
124 | + }; | 122 | + }; |
125 | diff --git a/include/dt-bindings/bus/imx-aipstz.h b/include/dt-bindings/bus/imx-aipstz.h | ||
126 | new file mode 100644 | ||
127 | index XXXXXXX..XXXXXXX | ||
128 | --- /dev/null | ||
129 | +++ b/include/dt-bindings/bus/imx-aipstz.h | ||
130 | @@ -XXX,XX +XXX,XX @@ | ||
131 | +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ | ||
132 | +/* | ||
133 | + * Copyright 2025 NXP | ||
134 | + */ | ||
135 | + | ||
136 | +#ifndef _DT_BINDINGS_BUS_IMX_AIPSTZ_H | ||
137 | +#define _DT_BINDINGS_BUS_IMX_AIPSTZ_H | ||
138 | + | ||
139 | +/* consumer type - master or peripheral */ | ||
140 | +#define IMX_AIPSTZ_MASTER 0x0 | ||
141 | +#define IMX_AIPSTZ_PERIPH 0x1 | ||
142 | + | ||
143 | +/* master configuration options */ | ||
144 | +#define IMX_AIPSTZ_MPL 0x1 | ||
145 | +#define IMX_AIPSTZ_MTW 0x2 | ||
146 | +#define IMX_AIPSTZ_MTR 0x4 | ||
147 | +#define IMX_AIPSTZ_MBW 0x8 | ||
148 | + | ||
149 | +/* peripheral configuration options */ | ||
150 | +#define IMX_AIPSTZ_TP 0x1 | ||
151 | +#define IMX_AIPSTZ_WP 0x2 | ||
152 | +#define IMX_AIPSTZ_SP 0x4 | ||
153 | +#define IMX_AIPSTZ_BW 0x8 | ||
154 | + | ||
155 | +#endif /* _DT_BINDINGS_BUS_IMX_AIPSTZ_H */ | ||
156 | -- | 123 | -- |
157 | 2.34.1 | 124 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
---|---|---|---|
2 | 2 | ||
3 | Some DSP instances may have their access to certain peripherals | 3 | Some DSP instances may have their access to certain peripherals |
4 | conditioned by a bus access controller such as the one from the | 4 | conditioned by a bus access controller such as the one from the |
5 | AIPSTZ bridge. | 5 | AIPSTZ bridge. |
6 | 6 | ||
7 | Add the optional 'access-controllers' property, which may be used | 7 | Add the optional 'access-controllers' property, which may be used |
8 | in such cases. | 8 | in such cases. |
9 | 9 | ||
10 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 10 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
11 | Reviewed-by: Frank Li <Frank.Li@nxp.com> | 11 | Reviewed-by: Frank Li <Frank.Li@nxp.com> |
12 | Acked-by: Rob Herring (Arm) <robh@kernel.org> | 12 | Acked-by: Rob Herring (Arm) <robh@kernel.org> |
13 | --- | 13 | --- |
14 | Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 3 +++ | 14 | Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 3 +++ |
15 | 1 file changed, 3 insertions(+) | 15 | 1 file changed, 3 insertions(+) |
16 | 16 | ||
17 | diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 17 | diff --git a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml |
18 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 19 | --- a/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml |
20 | +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml | 20 | +++ b/Documentation/devicetree/bindings/dsp/fsl,dsp.yaml |
21 | @@ -XXX,XX +XXX,XX @@ properties: | 21 | @@ -XXX,XX +XXX,XX @@ properties: |
22 | - const: runstall | 22 | - const: runstall |
23 | - const: softreset | 23 | - const: softreset |
24 | 24 | ||
25 | + access-controllers: | 25 | + access-controllers: |
26 | + maxItems: 1 | 26 | + maxItems: 1 |
27 | + | 27 | + |
28 | required: | 28 | required: |
29 | - compatible | 29 | - compatible |
30 | - reg | 30 | - reg |
31 | -- | 31 | -- |
32 | 2.34.1 | 32 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
---|---|---|---|
2 | 2 | ||
3 | The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control | 3 | The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control |
4 | configurations meant to restrict access to certain peripherals. | 4 | configurations meant to restrict access to certain peripherals. |
5 | Some of the configurations include: | 5 | Some of the configurations include: |
6 | 6 | ||
7 | 1) Marking masters as trusted for R/W. Based on this | 7 | 1) Marking masters as trusted for R/W. Based on this |
8 | (and the configuration of the accessed peripheral), the bridge | 8 | (and the configuration of the accessed peripheral), the bridge |
9 | may choose to abort the R/W transactions issued by certain | 9 | may choose to abort the R/W transactions issued by certain |
10 | masters. | 10 | masters. |
11 | 11 | ||
12 | 2) Allowing/disallowing write accesses to peripherals. | 12 | 2) Allowing/disallowing write accesses to peripherals. |
13 | 13 | ||
14 | Add driver for this IP. Since there's currently no framework for | 14 | Add driver for this IP. Since there's currently no framework for |
15 | access controllers (and since there's currently no need for having | 15 | access controllers (and since there's currently no need for having |
16 | flexibility w.r.t the configurations) all this driver does is it | 16 | flexibility w.r.t the configurations) all this driver does is it |
17 | applies a relaxed, "default" configuration, in which all masters | 17 | applies a relaxed, "default" configuration, in which all masters |
18 | are trusted for R/W. | 18 | are trusted for R/W. |
19 | 19 | ||
20 | Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied | 20 | Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied |
21 | to a power domain and may lose their configuration when the domain is | 21 | to a power domain and may lose their configuration when the domain is |
22 | powered off. This is why the configuration has to be restored when the | 22 | powered off. This is why the configuration has to be restored when the |
23 | domain is powered on. | 23 | domain is powered on. |
24 | 24 | ||
25 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> | 25 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> |
26 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> | 26 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> |
27 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 27 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
28 | --- | 28 | --- |
29 | drivers/bus/Kconfig | 6 +++ | 29 | drivers/bus/Kconfig | 6 +++ |
30 | drivers/bus/Makefile | 1 + | 30 | drivers/bus/Makefile | 1 + |
31 | drivers/bus/imx-aipstz.c | 92 ++++++++++++++++++++++++++++++++++++++++ | 31 | drivers/bus/imx-aipstz.c | 92 ++++++++++++++++++++++++++++++++++++++++ |
32 | 3 files changed, 99 insertions(+) | 32 | 3 files changed, 99 insertions(+) |
33 | create mode 100644 drivers/bus/imx-aipstz.c | 33 | create mode 100644 drivers/bus/imx-aipstz.c |
34 | 34 | ||
35 | diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig | 35 | diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig |
36 | index XXXXXXX..XXXXXXX 100644 | 36 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/drivers/bus/Kconfig | 37 | --- a/drivers/bus/Kconfig |
38 | +++ b/drivers/bus/Kconfig | 38 | +++ b/drivers/bus/Kconfig |
39 | @@ -XXX,XX +XXX,XX @@ config HISILICON_LPC | 39 | @@ -XXX,XX +XXX,XX @@ config HISILICON_LPC |
40 | Driver to enable I/O access to devices attached to the Low Pin | 40 | Driver to enable I/O access to devices attached to the Low Pin |
41 | Count bus on the HiSilicon Hip06/7 SoC. | 41 | Count bus on the HiSilicon Hip06/7 SoC. |
42 | 42 | ||
43 | +config IMX_AIPSTZ | 43 | +config IMX_AIPSTZ |
44 | + tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge" | 44 | + tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge" |
45 | + depends on ARCH_MXC | 45 | + depends on ARCH_MXC |
46 | + help | 46 | + help |
47 | + Enable support for IMX AIPSTZ bridge. | 47 | + Enable support for IMX AIPSTZ bridge. |
48 | + | 48 | + |
49 | config IMX_WEIM | 49 | config IMX_WEIM |
50 | bool "Freescale EIM DRIVER" | 50 | bool "Freescale EIM DRIVER" |
51 | depends on ARCH_MXC || COMPILE_TEST | 51 | depends on ARCH_MXC || COMPILE_TEST |
52 | diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile | 52 | diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile |
53 | index XXXXXXX..XXXXXXX 100644 | 53 | index XXXXXXX..XXXXXXX 100644 |
54 | --- a/drivers/bus/Makefile | 54 | --- a/drivers/bus/Makefile |
55 | +++ b/drivers/bus/Makefile | 55 | +++ b/drivers/bus/Makefile |
56 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ | 56 | @@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ |
57 | 57 | ||
58 | obj-$(CONFIG_BT1_APB) += bt1-apb.o | 58 | obj-$(CONFIG_BT1_APB) += bt1-apb.o |
59 | obj-$(CONFIG_BT1_AXI) += bt1-axi.o | 59 | obj-$(CONFIG_BT1_AXI) += bt1-axi.o |
60 | +obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o | 60 | +obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o |
61 | obj-$(CONFIG_IMX_WEIM) += imx-weim.o | 61 | obj-$(CONFIG_IMX_WEIM) += imx-weim.o |
62 | obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o | 62 | obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o |
63 | obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o | 63 | obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o |
64 | diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c | 64 | diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c |
65 | new file mode 100644 | 65 | new file mode 100644 |
66 | index XXXXXXX..XXXXXXX | 66 | index XXXXXXX..XXXXXXX |
67 | --- /dev/null | 67 | --- /dev/null |
68 | +++ b/drivers/bus/imx-aipstz.c | 68 | +++ b/drivers/bus/imx-aipstz.c |
69 | @@ -XXX,XX +XXX,XX @@ | 69 | @@ -XXX,XX +XXX,XX @@ |
70 | +// SPDX-License-Identifier: GPL-2.0 | 70 | +// SPDX-License-Identifier: GPL-2.0 |
71 | +/* | 71 | +/* |
72 | + * Copyright 2025 NXP | 72 | + * Copyright 2025 NXP |
73 | + */ | 73 | + */ |
74 | + | 74 | + |
75 | +#include <linux/module.h> | 75 | +#include <linux/module.h> |
76 | +#include <linux/of.h> | 76 | +#include <linux/of.h> |
77 | +#include <linux/of_platform.h> | 77 | +#include <linux/of_platform.h> |
78 | +#include <linux/platform_device.h> | 78 | +#include <linux/platform_device.h> |
79 | +#include <linux/pm_runtime.h> | 79 | +#include <linux/pm_runtime.h> |
80 | +#include <linux/regmap.h> | 80 | +#include <linux/regmap.h> |
81 | + | 81 | + |
82 | +#define IMX_AIPSTZ_MPR0 0x0 | 82 | +#define IMX_AIPSTZ_MPR0 0x0 |
83 | + | 83 | + |
84 | +struct imx_aipstz_config { | 84 | +struct imx_aipstz_config { |
85 | + u32 mpr0; | 85 | + u32 mpr0; |
86 | +}; | 86 | +}; |
87 | + | 87 | + |
88 | +static void imx_aipstz_apply_default(void __iomem *base, | 88 | +static void imx_aipstz_apply_default(void __iomem *base, |
89 | + const struct imx_aipstz_config *default_cfg) | 89 | + const struct imx_aipstz_config *default_cfg) |
90 | +{ | 90 | +{ |
91 | + writel(default_cfg->mpr0, base + IMX_AIPSTZ_MPR0); | 91 | + writel(default_cfg->mpr0, base + IMX_AIPSTZ_MPR0); |
92 | +} | 92 | +} |
93 | + | 93 | + |
94 | +static int imx_aipstz_probe(struct platform_device *pdev) | 94 | +static int imx_aipstz_probe(struct platform_device *pdev) |
95 | +{ | 95 | +{ |
96 | + const struct imx_aipstz_config *default_cfg; | 96 | + const struct imx_aipstz_config *default_cfg; |
97 | + void __iomem *base; | 97 | + void __iomem *base; |
98 | + | 98 | + |
99 | + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); | 99 | + base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); |
100 | + if (IS_ERR(base)) | 100 | + if (IS_ERR(base)) |
101 | + return dev_err_probe(&pdev->dev, -ENOMEM, | 101 | + return dev_err_probe(&pdev->dev, -ENOMEM, |
102 | + "failed to get/ioremap AC memory\n"); | 102 | + "failed to get/ioremap AC memory\n"); |
103 | + | 103 | + |
104 | + default_cfg = of_device_get_match_data(&pdev->dev); | 104 | + default_cfg = of_device_get_match_data(&pdev->dev); |
105 | + | 105 | + |
106 | + imx_aipstz_apply_default(base, default_cfg); | 106 | + imx_aipstz_apply_default(base, default_cfg); |
107 | + | 107 | + |
108 | + dev_set_drvdata(&pdev->dev, base); | 108 | + dev_set_drvdata(&pdev->dev, base); |
109 | + | 109 | + |
110 | + pm_runtime_set_active(&pdev->dev); | 110 | + pm_runtime_set_active(&pdev->dev); |
111 | + devm_pm_runtime_enable(&pdev->dev); | 111 | + devm_pm_runtime_enable(&pdev->dev); |
112 | + | 112 | + |
113 | + return devm_of_platform_populate(&pdev->dev); | 113 | + return devm_of_platform_populate(&pdev->dev); |
114 | +} | 114 | +} |
115 | + | 115 | + |
116 | +static int imx_aipstz_runtime_resume(struct device *dev) | 116 | +static int imx_aipstz_runtime_resume(struct device *dev) |
117 | +{ | 117 | +{ |
118 | + const struct imx_aipstz_config *default_cfg; | 118 | + const struct imx_aipstz_config *default_cfg; |
119 | + void __iomem *base; | 119 | + void __iomem *base; |
120 | + | 120 | + |
121 | + base = dev_get_drvdata(dev); | 121 | + base = dev_get_drvdata(dev); |
122 | + default_cfg = of_device_get_match_data(dev); | 122 | + default_cfg = of_device_get_match_data(dev); |
123 | + | 123 | + |
124 | + /* restore potentially lost configuration during domain power-off */ | 124 | + /* restore potentially lost configuration during domain power-off */ |
125 | + imx_aipstz_apply_default(base, default_cfg); | 125 | + imx_aipstz_apply_default(base, default_cfg); |
126 | + | 126 | + |
127 | + return 0; | 127 | + return 0; |
128 | +} | 128 | +} |
129 | + | 129 | + |
130 | +static const struct dev_pm_ops imx_aipstz_pm_ops = { | 130 | +static const struct dev_pm_ops imx_aipstz_pm_ops = { |
131 | + RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL) | 131 | + RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL) |
132 | + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) | 132 | + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) |
133 | +}; | 133 | +}; |
134 | + | 134 | + |
135 | +/* | 135 | +/* |
136 | + * following configuration is equivalent to: | 136 | + * following configuration is equivalent to: |
137 | + * masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege | 137 | + * masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege |
138 | + */ | 138 | + */ |
139 | +static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = { | 139 | +static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = { |
140 | + .mpr0 = 0x77777777, | 140 | + .mpr0 = 0x77777777, |
141 | +}; | 141 | +}; |
142 | + | 142 | + |
143 | +static const struct of_device_id imx_aipstz_of_ids[] = { | 143 | +static const struct of_device_id imx_aipstz_of_ids[] = { |
144 | + { .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg }, | 144 | + { .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg }, |
145 | + { } | 145 | + { } |
146 | +}; | 146 | +}; |
147 | +MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids); | 147 | +MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids); |
148 | + | 148 | + |
149 | +static struct platform_driver imx_aipstz_of_driver = { | 149 | +static struct platform_driver imx_aipstz_of_driver = { |
150 | + .probe = imx_aipstz_probe, | 150 | + .probe = imx_aipstz_probe, |
151 | + .driver = { | 151 | + .driver = { |
152 | + .name = "imx-aipstz", | 152 | + .name = "imx-aipstz", |
153 | + .of_match_table = imx_aipstz_of_ids, | 153 | + .of_match_table = imx_aipstz_of_ids, |
154 | + .pm = pm_ptr(&imx_aipstz_pm_ops), | 154 | + .pm = pm_ptr(&imx_aipstz_pm_ops), |
155 | + }, | 155 | + }, |
156 | +}; | 156 | +}; |
157 | +module_platform_driver(imx_aipstz_of_driver); | 157 | +module_platform_driver(imx_aipstz_of_driver); |
158 | + | 158 | + |
159 | +MODULE_LICENSE("GPL"); | 159 | +MODULE_LICENSE("GPL"); |
160 | +MODULE_DESCRIPTION("IMX secure AHB to IP Slave bus (AIPSTZ) bridge driver"); | 160 | +MODULE_DESCRIPTION("IMX secure AHB to IP Slave bus (AIPSTZ) bridge driver"); |
161 | +MODULE_AUTHOR("Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>"); | 161 | +MODULE_AUTHOR("Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>"); |
162 | -- | 162 | -- |
163 | 2.34.1 | 163 | 2.34.1 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
15 | which this node is referenced. | 15 | which this node is referenced. |
16 | 16 | ||
17 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> | 17 | Co-developed-by: Daniel Baluta <daniel.baluta@nxp.com> |
18 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> | 18 | Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> |
19 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 19 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
20 | Reviewed-by: Frank Li <Frank.Li@nxp.com> | ||
20 | --- | 21 | --- |
21 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++---- | 22 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 10 ++++++---- |
22 | 1 file changed, 6 insertions(+), 4 deletions(-) | 23 | 1 file changed, 6 insertions(+), 4 deletions(-) |
23 | 24 | ||
24 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi | 25 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
... | ... | diff view generated by jsdifflib |
1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 1 | From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
---|---|---|---|
2 | 2 | ||
3 | Add header file with master ID definitions for i.MX8MP's AIPSTZ. | 3 | Add header file with AIPSTZ-related definitions: consumer types, |
4 | master/peripheral configuration bits, and master ID definitions. | ||
4 | 5 | ||
5 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 6 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
6 | --- | 7 | --- |
7 | arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 25 +++++++++++++++++++ | 8 | arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 39 +++++++++++++++++++ |
8 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 + | 9 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 + |
9 | 2 files changed, 26 insertions(+) | 10 | 2 files changed, 40 insertions(+) |
10 | create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 11 | create mode 100644 arch/arm64/boot/dts/freescale/imx8mp-aipstz.h |
11 | 12 | ||
12 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h | 13 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h b/arch/arm64/boot/dts/freescale/imx8mp-aipstz.h |
13 | new file mode 100644 | 14 | new file mode 100644 |
14 | index XXXXXXX..XXXXXXX | 15 | index XXXXXXX..XXXXXXX |
... | ... | ||
21 | + */ | 22 | + */ |
22 | + | 23 | + |
23 | +#ifndef __IMX8MP_AIPSTZ_H | 24 | +#ifndef __IMX8MP_AIPSTZ_H |
24 | +#define __IMX8MP_AIPSTZ_H | 25 | +#define __IMX8MP_AIPSTZ_H |
25 | + | 26 | + |
26 | +#include <dt-bindings/bus/imx-aipstz.h> | 27 | +/* consumer type - master or peripheral */ |
28 | +#define IMX8MP_AIPSTZ_MASTER 0x0 | ||
29 | +#define IMX8MP_AIPSTZ_PERIPH 0x1 | ||
30 | + | ||
31 | +/* master configuration options */ | ||
32 | +#define IMX8MP_AIPSTZ_MPL (1 << 0) | ||
33 | +#define IMX8MP_AIPSTZ_MTW (1 << 1) | ||
34 | +#define IMX8MP_AIPSTZ_MTR (1 << 2) | ||
35 | +#define IMX8MP_AIPSTZ_MBW (1 << 3) | ||
36 | + | ||
37 | +/* peripheral configuration options */ | ||
38 | +#define IMX8MP_AIPSTZ_TP (1 << 0) | ||
39 | +#define IMX8MP_AIPSTZ_WP (1 << 1) | ||
40 | +#define IMX8MP_AIPSTZ_SP (1 << 2) | ||
41 | +#define IMX8MP_AIPSTZ_BW (1 << 3) | ||
27 | + | 42 | + |
28 | +/* master ID definitions */ | 43 | +/* master ID definitions */ |
29 | +#define IMX8MP_AIPSTZ_EDMA 0 /* AUDIOMIX EDMA */ | 44 | +#define IMX8MP_AIPSTZ_EDMA 0 /* AUDIOMIX EDMA */ |
30 | +#define IMX8MP_AIPSTZ_CA53 1 /* Cortex-A53 cluster */ | 45 | +#define IMX8MP_AIPSTZ_CA53 1 /* Cortex-A53 cluster */ |
31 | +#define IMX8MP_AIPSTZ_SDMA2 3 /* AUDIOMIX SDMA2 */ | 46 | +#define IMX8MP_AIPSTZ_SDMA2 3 /* AUDIOMIX SDMA2 */ |
32 | +#define IMX8MP_AIPSTZ_SDMA3 3 /* AUDIOMIX SDMA3 */ | 47 | +#define IMX8MP_AIPSTZ_SDMA3 3 /* AUDIOMIX SDMA3 */ |
33 | +#define IMX8MP_AIPSTZ_HIFI4 5 /* HIFI4 DSP */ | 48 | +#define IMX8MP_AIPSTZ_HIFI4 5 /* HIFI4 DSP */ |
34 | +#define IMX8MP_AIPSTZ_CM7 6 /* Cortex-M7 */ | 49 | +#define IMX8MP_AIPSTZ_CM7 6 /* Cortex-M7 */ |
35 | + | 50 | + |
36 | +/* helper macros */ | 51 | +/* helper macros */ |
37 | +#define IMX8MP_AIPSTZ_HIFI4_T_RW_PL \ | 52 | +#define IMX8MP_AIPSTZ_HIFI4_T_RW_PL \ |
38 | + IMX_AIPSTZ_MASTER \ | 53 | + IMX8MP_AIPSTZ_MASTER \ |
39 | + IMX8MP_AIPSTZ_HIFI4 \ | 54 | + IMX8MP_AIPSTZ_HIFI4 \ |
40 | + (IMX_AIPSTZ_MPL | IMX_AIPSTZ_MTW | IMX_AIPSTZ_MTR) | 55 | + (IMX8MP_AIPSTZ_MPL | IMX8MP_AIPSTZ_MTW | IMX8MP_AIPSTZ_MTR) |
41 | + | 56 | + |
42 | +#endif /* __IMX8MP_AIPSTZ_H */ | 57 | +#endif /* __IMX8MP_AIPSTZ_H */ |
43 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi | 58 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
44 | index XXXXXXX..XXXXXXX 100644 | 59 | index XXXXXXX..XXXXXXX 100644 |
45 | --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi | 60 | --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
... | ... | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
5 | registers of the bridge have to be configured before the DSP is started. | 5 | registers of the bridge have to be configured before the DSP is started. |
6 | Enforce a dependency on AIPSTZ5 by adding the 'access-controllers' | 6 | Enforce a dependency on AIPSTZ5 by adding the 'access-controllers' |
7 | property to the 'dsp' node. | 7 | property to the 'dsp' node. |
8 | 8 | ||
9 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> | 9 | Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com> |
10 | Reviewed-by: Frank Li <Frank.Li@nxp.com> | ||
10 | --- | 11 | --- |
11 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 + | 12 | arch/arm64/boot/dts/freescale/imx8mp.dtsi | 1 + |
12 | 1 file changed, 1 insertion(+) | 13 | 1 file changed, 1 insertion(+) |
13 | 14 | ||
14 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi | 15 | diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi |
... | ... | diff view generated by jsdifflib |