* [PATCH 0/3] soc: fsl: add DPAA2 log console support @ 2018-12-21 15:31 Ioana Ciornei 2018-12-21 15:31 ` [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms Ioana Ciornei ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Ioana Ciornei @ 2018-12-21 15:31 UTC (permalink / raw) To: Leo Li, linux-arm-kernel, devicetree Cc: Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, robh+dt, Ioana Ciornei, shawnguo This patch set adds support for exporting DPAA2 firmware console logs to userspace. The first two patches add the needed device tree node and its documentation while the third one adds the actual platform driver. Ioana Ciornei (3): arm64: dts: add dpaa2-console node for DPAA2 platforms Documentation: DT: Add entry for DPAA2 console soc: fsl: add DPAA2 console support .../devicetree/bindings/misc/dpaa2-console.txt | 11 + MAINTAINERS | 1 + arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 5 + arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi | 5 + drivers/soc/fsl/Kconfig | 10 + drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/dpaa2-console.c | 306 +++++++++++++++++++++ 7 files changed, 339 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/dpaa2-console.txt create mode 100644 drivers/soc/fsl/dpaa2-console.c -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2018-12-21 15:31 [PATCH 0/3] soc: fsl: add DPAA2 log console support Ioana Ciornei @ 2018-12-21 15:31 ` Ioana Ciornei 2019-01-12 2:47 ` Shawn Guo 2018-12-21 15:31 ` [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console Ioana Ciornei 2018-12-21 15:31 ` [PATCH 3/3] soc: fsl: add DPAA2 console support Ioana Ciornei 2 siblings, 1 reply; 13+ messages in thread From: Ioana Ciornei @ 2018-12-21 15:31 UTC (permalink / raw) To: Leo Li, linux-arm-kernel, devicetree Cc: Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, robh+dt, Ioana Ciornei, shawnguo Add the dpaa2-console device tree node for the following DPAA2 based platforms: LS1088A, LS2080A and LS2088A. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> --- arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 5 +++++ arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi index e73e55f..664e337 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -569,6 +569,11 @@ clock-names = "apb_pclk", "wdog_clk"; }; + dpaa2-console@0x08340020 { + compatible = "dpaa2-console"; + reg = <0x00000000 0x08340020 0 0x2>; + }; + fsl_mc: fsl-mc@80c000000 { compatible = "fsl,qoriq-mc"; reg = <0x00000008 0x0c000000 0 0x40>, /* MC portal base */ diff --git a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi index d188774..6db6ea4 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi @@ -333,6 +333,11 @@ }; }; + dpaa2-console@0x08340020 { + compatible = "dpaa2-console"; + reg = <0x00000000 0x08340020 0 0x2>; + }; + fsl_mc: fsl-mc@80c000000 { compatible = "fsl,qoriq-mc"; reg = <0x00000008 0x0c000000 0 0x40>, /* MC portal base */ -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2018-12-21 15:31 ` [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms Ioana Ciornei @ 2019-01-12 2:47 ` Shawn Guo 2019-01-16 10:02 ` Ioana Ciornei 0 siblings, 1 reply; 13+ messages in thread From: Shawn Guo @ 2019-01-12 2:47 UTC (permalink / raw) To: Ioana Ciornei Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > Add the dpaa2-console device tree node for the following > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> DTS patch generally goes to the last in a series. Shawn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2019-01-12 2:47 ` Shawn Guo @ 2019-01-16 10:02 ` Ioana Ciornei 2019-01-16 10:56 ` Shawn Guo 0 siblings, 1 reply; 13+ messages in thread From: Ioana Ciornei @ 2019-01-16 10:02 UTC (permalink / raw) To: Shawn Guo Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 > platforms > > On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > > Add the dpaa2-console device tree node for the following > > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > DTS patch generally goes to the last in a series. Should I resend this with the DTS patch the last? Ioana > > Shawn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2019-01-16 10:02 ` Ioana Ciornei @ 2019-01-16 10:56 ` Shawn Guo 2019-01-16 10:59 ` Ioana Ciornei 0 siblings, 1 reply; 13+ messages in thread From: Shawn Guo @ 2019-01-16 10:56 UTC (permalink / raw) To: Ioana Ciornei Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel On Wed, Jan 16, 2019 at 10:02:01AM +0000, Ioana Ciornei wrote: > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 > > platforms > > > > On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > > > Add the dpaa2-console device tree node for the following > > > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > > > DTS patch generally goes to the last in a series. > > Should I resend this with the DTS patch the last? You do not have to resend the series only for this. It's pretty much a suggestion for future posting. Shawn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2019-01-16 10:56 ` Shawn Guo @ 2019-01-16 10:59 ` Ioana Ciornei 2019-01-16 17:31 ` Ioana Ciornei 0 siblings, 1 reply; 13+ messages in thread From: Ioana Ciornei @ 2019-01-16 10:59 UTC (permalink / raw) To: Shawn Guo Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 > platforms > > On Wed, Jan 16, 2019 at 10:02:01AM +0000, Ioana Ciornei wrote: > > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for > > > DPAA2 platforms > > > > > > On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > > > > Add the dpaa2-console device tree node for the following > > > > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > > > > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > > > > > DTS patch generally goes to the last in a series. > > > > Should I resend this with the DTS patch the last? > > You do not have to resend the series only for this. It's pretty much a suggestion > for future posting. Ok, thanks for the suggestion. Ioana _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2019-01-16 10:59 ` Ioana Ciornei @ 2019-01-16 17:31 ` Ioana Ciornei 2019-01-22 2:53 ` Shawn Guo 0 siblings, 1 reply; 13+ messages in thread From: Ioana Ciornei @ 2019-01-16 17:31 UTC (permalink / raw) To: Shawn Guo Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 > > platforms > > > > On Wed, Jan 16, 2019 at 10:02:01AM +0000, Ioana Ciornei wrote: > > > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for > > > > DPAA2 platforms > > > > > > > > On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > > > > > Add the dpaa2-console device tree node for the following > > > > > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > > > > > > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > > > > > > > DTS patch generally goes to the last in a series. > > > > > > Should I resend this with the DTS patch the last? > > > > You do not have to resend the series only for this. It's pretty much > > a suggestion for future posting. > One more thing, do you have any other feedback on the DTS part? I think the best path for this patch set is through Leo's fsl soc tree but of course we need an ack from the DTS part also. Thanks, Ioana _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms 2019-01-16 17:31 ` Ioana Ciornei @ 2019-01-22 2:53 ` Shawn Guo 0 siblings, 0 replies; 13+ messages in thread From: Shawn Guo @ 2019-01-22 2:53 UTC (permalink / raw) To: Ioana Ciornei Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel On Wed, Jan 16, 2019 at 05:31:46PM +0000, Ioana Ciornei wrote: > > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 > > > platforms > > > > > > On Wed, Jan 16, 2019 at 10:02:01AM +0000, Ioana Ciornei wrote: > > > > > Subject: Re: [PATCH 1/3] arm64: dts: add dpaa2-console node for > > > > > DPAA2 platforms > > > > > > > > > > On Fri, Dec 21, 2018 at 03:31:09PM +0000, Ioana Ciornei wrote: > > > > > > Add the dpaa2-console device tree node for the following > > > > > > DPAA2 based platforms: LS1088A, LS2080A and LS2088A. > > > > > > > > > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > > > > > > > > > DTS patch generally goes to the last in a series. > > > > > > > > Should I resend this with the DTS patch the last? > > > > > > You do not have to resend the series only for this. It's pretty much > > > a suggestion for future posting. > > > > One more thing, do you have any other feedback on the DTS part? > I think the best path for this patch set is through Leo's fsl soc tree but of course we need an ack from the DTS part also. I do not see there is a hard dependency between driver and dts part, e.g. build error or causing regression. In that case, dts should just go via its channel. Shawn _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console 2018-12-21 15:31 [PATCH 0/3] soc: fsl: add DPAA2 log console support Ioana Ciornei 2018-12-21 15:31 ` [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms Ioana Ciornei @ 2018-12-21 15:31 ` Ioana Ciornei 2019-01-03 20:32 ` Rob Herring 2019-01-22 2:54 ` Shawn Guo 2018-12-21 15:31 ` [PATCH 3/3] soc: fsl: add DPAA2 console support Ioana Ciornei 2 siblings, 2 replies; 13+ messages in thread From: Ioana Ciornei @ 2018-12-21 15:31 UTC (permalink / raw) To: Leo Li, linux-arm-kernel, devicetree Cc: Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, robh+dt, Ioana Ciornei, shawnguo This patch adds a devicetree binding documentation for FSL's DPAA2 console. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> --- Documentation/devicetree/bindings/misc/dpaa2-console.txt | 11 +++++++++++ MAINTAINERS | 1 + 2 files changed, 12 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/dpaa2-console.txt diff --git a/Documentation/devicetree/bindings/misc/dpaa2-console.txt b/Documentation/devicetree/bindings/misc/dpaa2-console.txt new file mode 100644 index 0000000..f4e16b1 --- /dev/null +++ b/Documentation/devicetree/bindings/misc/dpaa2-console.txt @@ -0,0 +1,11 @@ +DPAA2 console support + +Required properties: + + - compatible + Value type: <string> + Definition: Must be "dpaa2-console". + - reg + Value type: <prop-encoded-array> + Definition: A standard property. Specifies the region where the MCFBA + (MC firmware base address) register can be found. diff --git a/MAINTAINERS b/MAINTAINERS index 7b76a80..229d4fb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5969,6 +5969,7 @@ M: Li Yang <leoyang.li@nxp.com> L: linuxppc-dev@lists.ozlabs.org L: linux-arm-kernel@lists.infradead.org S: Maintained +F: Documentation/devicetree/bindings/misc/dpaa2-console.txt F: Documentation/devicetree/bindings/soc/fsl/ F: drivers/soc/fsl/ F: include/linux/fsl/ -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console 2018-12-21 15:31 ` [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console Ioana Ciornei @ 2019-01-03 20:32 ` Rob Herring 2019-01-04 17:50 ` Ioana Ciornei 2019-01-22 2:54 ` Shawn Guo 1 sibling, 1 reply; 13+ messages in thread From: Rob Herring @ 2019-01-03 20:32 UTC (permalink / raw) To: Ioana Ciornei Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, shawnguo, linux-arm-kernel On Fri, Dec 21, 2018 at 03:31:11PM +0000, Ioana Ciornei wrote: > This patch adds a devicetree binding documentation for > FSL's DPAA2 console. > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > --- > Documentation/devicetree/bindings/misc/dpaa2-console.txt | 11 +++++++++++ > MAINTAINERS | 1 + > 2 files changed, 12 insertions(+) > create mode 100644 Documentation/devicetree/bindings/misc/dpaa2-console.txt > > diff --git a/Documentation/devicetree/bindings/misc/dpaa2-console.txt b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > new file mode 100644 > index 0000000..f4e16b1 > --- /dev/null > +++ b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > @@ -0,0 +1,11 @@ > +DPAA2 console support > + > +Required properties: > + > + - compatible > + Value type: <string> > + Definition: Must be "dpaa2-console". > + - reg > + Value type: <prop-encoded-array> > + Definition: A standard property. Specifies the region where the MCFBA > + (MC firmware base address) register can be found. What's the relationship between MCFBA and the console? The binding should describe the h/w block or firmware interface not the feature you want to implement. Are there other functions provided by the MC firmware? Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console 2019-01-03 20:32 ` Rob Herring @ 2019-01-04 17:50 ` Ioana Ciornei 0 siblings, 0 replies; 13+ messages in thread From: Ioana Ciornei @ 2019-01-04 17:50 UTC (permalink / raw) To: Rob Herring Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, shawnguo, linux-arm-kernel > Subject: Re: [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console > > On Fri, Dec 21, 2018 at 03:31:11PM +0000, Ioana Ciornei wrote: > > This patch adds a devicetree binding documentation for FSL's DPAA2 > > console. > > > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > > --- > > Documentation/devicetree/bindings/misc/dpaa2-console.txt | 11 > +++++++++++ > > MAINTAINERS | 1 + > > 2 files changed, 12 insertions(+) > > create mode 100644 > > Documentation/devicetree/bindings/misc/dpaa2-console.txt > > > > diff --git a/Documentation/devicetree/bindings/misc/dpaa2-console.txt > > b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > > new file mode 100644 > > index 0000000..f4e16b1 > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > > @@ -0,0 +1,11 @@ > > +DPAA2 console support > > + > > +Required properties: > > + > > + - compatible > > + Value type: <string> > > + Definition: Must be "dpaa2-console". > > + - reg > > + Value type: <prop-encoded-array> > > + Definition: A standard property. Specifies the region where the MCFBA > > + (MC firmware base address) register can be found. > > What's the relationship between MCFBA and the console? The console is basically a log buffer of the MC firmware, and is found at a known offset compared to the firmware image's runtime base address. > The binding should describe the h/w block or firmware interface not the feature you want to > implement. Are there other functions provided by the MC firmware? The MC firmware manages all hardware resources related to networking or any other accelerators. Any interaction with the firmware is made through commands put in memory mapped regions. The fsl-mc bus driver is the one that already manages this interaction with the MC. Ioana > > Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console 2018-12-21 15:31 ` [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console Ioana Ciornei 2019-01-03 20:32 ` Rob Herring @ 2019-01-22 2:54 ` Shawn Guo 1 sibling, 0 replies; 13+ messages in thread From: Shawn Guo @ 2019-01-22 2:54 UTC (permalink / raw) To: Ioana Ciornei Cc: devicetree, Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, Leo Li, robh+dt, linux-arm-kernel On Fri, Dec 21, 2018 at 03:31:11PM +0000, Ioana Ciornei wrote: > This patch adds a devicetree binding documentation for > FSL's DPAA2 console. > > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> > --- > Documentation/devicetree/bindings/misc/dpaa2-console.txt | 11 +++++++++++ > MAINTAINERS | 1 + > 2 files changed, 12 insertions(+) > create mode 100644 Documentation/devicetree/bindings/misc/dpaa2-console.txt > > diff --git a/Documentation/devicetree/bindings/misc/dpaa2-console.txt b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > new file mode 100644 > index 0000000..f4e16b1 > --- /dev/null > +++ b/Documentation/devicetree/bindings/misc/dpaa2-console.txt > @@ -0,0 +1,11 @@ > +DPAA2 console support > + > +Required properties: > + > + - compatible > + Value type: <string> > + Definition: Must be "dpaa2-console". Why this doesn't need a vendor prefix? Shawn > + - reg > + Value type: <prop-encoded-array> > + Definition: A standard property. Specifies the region where the MCFBA > + (MC firmware base address) register can be found. > diff --git a/MAINTAINERS b/MAINTAINERS > index 7b76a80..229d4fb 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -5969,6 +5969,7 @@ M: Li Yang <leoyang.li@nxp.com> > L: linuxppc-dev@lists.ozlabs.org > L: linux-arm-kernel@lists.infradead.org > S: Maintained > +F: Documentation/devicetree/bindings/misc/dpaa2-console.txt > F: Documentation/devicetree/bindings/soc/fsl/ > F: drivers/soc/fsl/ > F: include/linux/fsl/ > -- > 1.9.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/3] soc: fsl: add DPAA2 console support 2018-12-21 15:31 [PATCH 0/3] soc: fsl: add DPAA2 log console support Ioana Ciornei 2018-12-21 15:31 ` [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms Ioana Ciornei 2018-12-21 15:31 ` [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console Ioana Ciornei @ 2018-12-21 15:31 ` Ioana Ciornei 2 siblings, 0 replies; 13+ messages in thread From: Ioana Ciornei @ 2018-12-21 15:31 UTC (permalink / raw) To: Leo Li, linux-arm-kernel, devicetree Cc: Ioana Ciocoi Radulescu, Roy Pledge, linux-kernel, robh+dt, Ioana Ciornei, shawnguo This patch adds DPAA2 MC and AIOP console log support. The platform driver probes on the "dpaa2-console" device tree node which describes the base firmware address needed in order to infer the start address of both firmware logs: MC and AIOP. It then exports two misc char devices which can be used to dump the needed logs. Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Signed-off-by: Roy Pledge <roy.pledge@nxp.com> --- drivers/soc/fsl/Kconfig | 10 ++ drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/dpaa2-console.c | 306 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 317 insertions(+) create mode 100644 drivers/soc/fsl/dpaa2-console.c diff --git a/drivers/soc/fsl/Kconfig b/drivers/soc/fsl/Kconfig index 8f80e8b..94229a0 100644 --- a/drivers/soc/fsl/Kconfig +++ b/drivers/soc/fsl/Kconfig @@ -28,4 +28,14 @@ config FSL_MC_DPIO other DPAA2 objects. This driver does not expose the DPIO objects individually, but groups them under a service layer API. + +config DPAA2_CONSOLE + tristate "QorIQ DPAA2 console driver" + depends on OF && (ARCH_LAYERSCAPE || (COMPILE_TEST && (ARM || ARM64 || X86_LOCAL_APIC || PPC))) + default y + help + Console driver for DPAA2 platforms. Exports 2 char devices, + /dev/dpaa2_mc_console and /dev/dpaa2_aiop_console, + which can be used to dump the Management Complex and AIOP + firmware logs. endmenu diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile index 803ef1b..57762c9 100644 --- a/drivers/soc/fsl/Makefile +++ b/drivers/soc/fsl/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_QUICC_ENGINE) += qe/ obj-$(CONFIG_CPM) += qe/ obj-$(CONFIG_FSL_GUTS) += guts.o obj-$(CONFIG_FSL_MC_DPIO) += dpio/ +obj-$(CONFIG_DPAA2_CONSOLE) += dpaa2-console.o diff --git a/drivers/soc/fsl/dpaa2-console.c b/drivers/soc/fsl/dpaa2-console.c new file mode 100644 index 0000000..b088834 --- /dev/null +++ b/drivers/soc/fsl/dpaa2-console.c @@ -0,0 +1,306 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2015-2016 Freescale Semiconductor Inc. + * Copyright 2018 NXP + */ + +#define pr_fmt(fmt) "dpaa2-console: " fmt + +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/of_address.h> +#include <linux/miscdevice.h> +#include <linux/uaccess.h> +#include <linux/slab.h> +#include <linux/fs.h> +#include <linux/io.h> + +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_AUTHOR("Roy Pledge <roy.pledge@nxp.com>"); +MODULE_DESCRIPTION("DPAA2 console driver"); + +/* MC firmware base low/high registers indexes */ +#define MCFBALR_OFFSET 0 +#define MCFBAHR_OFFSET 1 + +/* Bit masks used to get the most/least significant part of the MC base addr */ +#define MC_FW_ADDR_MASK_HIGH 0x1FFFF +#define MC_FW_ADDR_MASK_LOW 0xE0000000 + +#define MC_BUFFER_OFFSET 0x01000000 +#define MC_BUFFER_SIZE (1024 * 1024 * 16) +#define MC_OFFSET_DELTA MC_BUFFER_OFFSET + +#define AIOP_BUFFER_OFFSET 0x06000000 +#define AIOP_BUFFER_SIZE (1024 * 1024 * 16) +#define AIOP_OFFSET_DELTA 0 + +#define LOG_HEADER_FLAG_BUFFER_WRAPAROUND 0x80000000 +#define LAST_BYTE(a) ((a) & ~(LOG_HEADER_FLAG_BUFFER_WRAPAROUND)) + +/* MC and AIOP Magic words */ +#define MAGIC_MC 0x4d430100 +#define MAGIC_AIOP 0x41494F50 + +struct log_header { + __le32 magic_word; + char reserved[4]; + __le32 buf_start; + __le32 buf_length; + __le32 last_byte; +}; + +struct console_data { + char *map_addr; + struct log_header *hdr; + char *start_addr; + char *end_addr; + char *end_of_data; + char *cur_ptr; +}; + +struct resource mc_base_addr; + +static inline void adjust_end(struct console_data *cd) +{ + u32 last_byte = readl(&cd->hdr->last_byte); + + cd->end_of_data = cd->start_addr + LAST_BYTE(last_byte); +} + +static u64 get_mc_fw_base_address(void) +{ + u64 mcfwbase = 0ULL; + u32 *mcfbaregs; + + mcfbaregs = (u32 *)ioremap(mc_base_addr.start, + resource_size(&mc_base_addr)); + if (!mcfbaregs) { + pr_err("could not map MC Firmaware Base registers\n"); + return -EIO; + } + + mcfwbase = readl(mcfbaregs + MCFBAHR_OFFSET) & MC_FW_ADDR_MASK_HIGH; + mcfwbase <<= 32; + mcfwbase |= readl(mcfbaregs + MCFBALR_OFFSET) & MC_FW_ADDR_MASK_LOW; + iounmap(mcfbaregs); + + pr_debug("MC base address at 0x%016llx\n", mcfwbase); + return mcfwbase; +} + +static ssize_t dpaa2_console_size(struct console_data *cd) +{ + ssize_t size; + + if (cd->cur_ptr <= cd->end_of_data) + size = cd->end_of_data - cd->cur_ptr; + else + size = (cd->end_addr - cd->cur_ptr) + + (cd->end_of_data - cd->start_addr); + + return size; +} + +static int dpaa2_generic_console_open(struct inode *node, struct file *fp, + u64 offset, u64 size, + u32 expected_magic, + u32 offset_delta) +{ + u32 read_magic, wrapped, last_byte, buf_start, buf_length; + struct console_data *cd; + u64 base_addr; + int err; + + cd = kmalloc(sizeof(*cd), GFP_KERNEL); + if (!cd) + return -ENOMEM; + + base_addr = get_mc_fw_base_address(); + if (base_addr < 0) + return -EIO; + + cd->map_addr = ioremap(base_addr + offset, size); + if (!cd->map_addr) { + pr_err("cannot map console log memory\n"); + err = -EIO; + goto err_ioremap; + } + + cd->hdr = (struct log_header *)cd->map_addr; + read_magic = readl(&cd->hdr->magic_word); + last_byte = readl(&cd->hdr->last_byte); + buf_start = readl(&cd->hdr->buf_start); + buf_length = readl(&cd->hdr->buf_length); + + if (read_magic != expected_magic) { + pr_warn("expected = %08x, read = %08x\n", + expected_magic, read_magic); + err = -EIO; + goto err_magic; + } + + cd->start_addr = cd->map_addr + buf_start - offset_delta; + cd->end_addr = cd->start_addr + buf_length; + + wrapped = last_byte & LOG_HEADER_FLAG_BUFFER_WRAPAROUND; + + adjust_end(cd); + if (wrapped && cd->end_of_data != cd->end_addr) + cd->cur_ptr = cd->end_of_data + 1; + else + cd->cur_ptr = cd->start_addr; + + fp->private_data = cd; + + return 0; + +err_magic: + iounmap(cd->map_addr); + +err_ioremap: + kfree(cd); + + return err; +} + +static int dpaa2_mc_console_open(struct inode *node, struct file *fp) +{ + return dpaa2_generic_console_open(node, fp, + MC_BUFFER_OFFSET, MC_BUFFER_SIZE, + MAGIC_MC, MC_OFFSET_DELTA); +} + +static int dpaa2_aiop_console_open(struct inode *node, struct file *fp) +{ + return dpaa2_generic_console_open(node, fp, + AIOP_BUFFER_OFFSET, AIOP_BUFFER_SIZE, + MAGIC_AIOP, AIOP_OFFSET_DELTA); +} + +static int dpaa2_console_close(struct inode *node, struct file *fp) +{ + struct console_data *cd = fp->private_data; + + iounmap(cd->map_addr); + kfree(cd); + return 0; +} + +static ssize_t dpaa2_console_read(struct file *fp, char __user *buf, + size_t count, loff_t *f_pos) +{ + struct console_data *cd = fp->private_data; + size_t bytes = dpaa2_console_size(cd); + size_t bytes_end = cd->end_addr - cd->cur_ptr; + size_t written = 0; + + /* Check if we need to adjust the end of data addr */ + adjust_end(cd); + + if (cd->end_of_data == cd->cur_ptr) + return 0; + + if (count < bytes) + bytes = count; + + if (bytes > bytes_end) { + if (copy_to_user(buf, cd->cur_ptr, bytes_end)) + return -EFAULT; + buf += bytes_end; + cd->cur_ptr = cd->start_addr; + bytes -= bytes_end; + written += bytes_end; + } + + if (copy_to_user(buf, cd->cur_ptr, bytes)) + return -EFAULT; + cd->cur_ptr += bytes; + written += bytes; + + return written; +} + +static const struct file_operations dpaa2_mc_console_fops = { + .owner = THIS_MODULE, + .open = dpaa2_mc_console_open, + .release = dpaa2_console_close, + .read = dpaa2_console_read, +}; + +static struct miscdevice dpaa2_mc_console_dev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "dpaa2_mc_console", + .fops = &dpaa2_mc_console_fops +}; + +static const struct file_operations dpaa2_aiop_console_fops = { + .owner = THIS_MODULE, + .open = dpaa2_aiop_console_open, + .release = dpaa2_console_close, + .read = dpaa2_console_read, +}; + +static struct miscdevice dpaa2_aiop_console_dev = { + .minor = MISC_DYNAMIC_MINOR, + .name = "dpaa2_aiop_console", + .fops = &dpaa2_aiop_console_fops +}; + +static int dpaa2_console_probe(struct platform_device *pdev) +{ + int error; + + error = of_address_to_resource(pdev->dev.of_node, 0, &mc_base_addr); + if (error < 0) { + pr_err("of_address_to_resource() failed for %pOF with %d\n", + pdev->dev.of_node, error); + return error; + } + + error = misc_register(&dpaa2_mc_console_dev); + if (error) { + pr_err("dpaa2-console: cannot register device %s\n", + dpaa2_mc_console_dev.name); + goto err_register_mc; + } + + error = misc_register(&dpaa2_aiop_console_dev); + if (error) { + pr_err("dpaa2-console: cannot register device %s\n", + dpaa2_aiop_console_dev.name); + goto err_register_aiop; + } + + return 0; + +err_register_aiop: + misc_deregister(&dpaa2_mc_console_dev); +err_register_mc: + return error; +} + +static int dpaa2_console_remove(struct platform_device *pdev) +{ + misc_deregister(&dpaa2_mc_console_dev); + misc_deregister(&dpaa2_aiop_console_dev); + + return 0; +} + +static const struct of_device_id dpaa2_console_match_table[] = { + { .compatible = "dpaa2-console",}, + {}, +}; + +MODULE_DEVICE_TABLE(of, dpaa2_console_match_table); + +static struct platform_driver dpaa2_console_driver = { + .driver = { + .name = "dpaa2-console", + .pm = NULL, + .of_match_table = dpaa2_console_match_table, + }, + .probe = dpaa2_console_probe, + .remove = dpaa2_console_remove, +}; +module_platform_driver(dpaa2_console_driver); -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2019-01-22 2:55 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-12-21 15:31 [PATCH 0/3] soc: fsl: add DPAA2 log console support Ioana Ciornei 2018-12-21 15:31 ` [PATCH 1/3] arm64: dts: add dpaa2-console node for DPAA2 platforms Ioana Ciornei 2019-01-12 2:47 ` Shawn Guo 2019-01-16 10:02 ` Ioana Ciornei 2019-01-16 10:56 ` Shawn Guo 2019-01-16 10:59 ` Ioana Ciornei 2019-01-16 17:31 ` Ioana Ciornei 2019-01-22 2:53 ` Shawn Guo 2018-12-21 15:31 ` [PATCH 2/3] Documentation: DT: Add entry for DPAA2 console Ioana Ciornei 2019-01-03 20:32 ` Rob Herring 2019-01-04 17:50 ` Ioana Ciornei 2019-01-22 2:54 ` Shawn Guo 2018-12-21 15:31 ` [PATCH 3/3] soc: fsl: add DPAA2 console support Ioana Ciornei
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).