Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 0/4] riscv: Allow userspace to directly access perf counters
From: Ian Rogers @ 2023-04-19 17:42 UTC (permalink / raw)
  To: Alexandre Ghiti, paranlee
  Cc: Atish Patra, David Laight, Jonathan Corbet, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Anup Patel, Will Deacon, Rob Herring,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
In-Reply-To: <CAHVXubjhORBEDok_Zhq5p_Yv4Ty4Hct84dWJZXzo48+40N=CGg@mail.gmail.com>

On Wed, Apr 19, 2023 at 2:21 AM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
>
> Hi Ian,
>
> On Tue, Apr 18, 2023 at 10:30 PM Atish Patra <atishp@atishpatra.org> wrote:
> >
> > On Tue, Apr 18, 2023 at 11:46 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > On Tue, Apr 18, 2023 at 9:43 AM Atish Patra <atishp@atishpatra.org> wrote:
> > > >
> > > > On Fri, Apr 14, 2023 at 2:40 AM David Laight <David.Laight@aculab.com> wrote:
> > > > >
> > > > > From: Atish Patra
> > > > > > Sent: 13 April 2023 20:18
> > > > > >
> > > > > > On Thu, Apr 13, 2023 at 9:47 PM Alexandre Ghiti <alexghiti@rivosinc.com> wrote:
> > > > > > >
> > > > > > > riscv used to allow direct access to cycle/time/instret counters,
> > > > > > > bypassing the perf framework, this patchset intends to allow the user to
> > > > > > > mmap any counter when accessed through perf. But we can't break the
> > > > > > > existing behaviour so we introduce a sysctl perf_user_access like arm64
> > > > > > > does, which defaults to the legacy mode described above.
> > > > > > >
> > > > > >
> > > > > > It would be good provide additional direction for user space packages:
> > > > > >
> > > > > > The legacy behavior is supported for now in order to avoid breaking
> > > > > > existing software.
> > > > > > However, reading counters directly without perf interaction may
> > > > > > provide incorrect values which
> > > > > > the userspace software must avoid. We are hoping that the user space
> > > > > > packages which
> > > > > > read the cycle/instret directly, will move to the proper interface
> > > > > > eventually if they actually need it.
> > > > > > Most of the users are supposed to read "time" instead of "cycle" if
> > > > > > they intend to read timestamps.
> > > > >
> > > > > If you are trying to measure the performance of short code
> > > > > fragments then you need pretty much raw access directly to
> > > > > the cycle/clock count register.
> > > > >
> > > > > I've done this on x86 to compare the actual cycle times
> > > > > of different implementations of the IP checksum loop
> > > > > (and compare them to the theoretical limit).
> > > > > The perf framework just added far too much latency,
> > > > > only directly reading the cpu registers gave anything
> > > > > like reliable (and consistent) answers.
> > > > >
> > > >
> > > > This series allows direct access to the counters once configured
> > > > through the perf.
> > > > Earlier the cycle/instret counters are directly exposed to the
> > > > userspace without kernel/perf frameworking knowing
> > > > when/which user space application is reading it. That has security implications.
> > > >
> > > > With this series applied, the user space application just needs to
> > > > configure the event (cycle/instret) through perf syscall.
> > > > Once configured, the userspace application can find out the counter
> > > > information from the mmap & directly
> > > > read the counter. There is no latency while reading the counters.
> > > >
> > > > This mechanism allows stop/clear the counters when the requesting task
> > > > is not running. It also takes care of context switching
> > > > which may result in invalid values as you mentioned below. This is
> > > > nothing new and all other arch (x86, ARM64) allow user space
> > > > counter read through the same mechanism.
> > > >
> > > > Here is the relevant upstream discussion:
> > > > https://lore.kernel.org/lkml/Y7wLa7I2hlz3rKw%2F@hirez.programming.kicks-ass.net/T/
> > > >
> > > > ARM64:
> > > > https://docs.kernel.org/arm64/perf.html?highlight=perf_user_access#perf-userspace-pmu-hardware-counter-access
> > > >
> > > > example usage in x86:
> > > > https://github.com/andikleen/pmu-tools/blob/master/jevents/rdpmc.c
> > >
> > > The canonical implementation of this should be:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/mmap.c#n400
> >
> > Thanks for sharing the libperf implementation.
> >
> > > which is updated in these patches but the tests are not:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/tests/mmap-basic.c#n287
> > > Which appears to be an oversight. The tests display some differences
> >
> > Yes. It's an oversight. We should make sure that perf mmap tests pass
> > for RISC-V as well.
>
> Yes, that's an oversight, I had a local test adapted from this one but
> forgot to update it afterwards, I'll do that in the next version.
>
> Thanks for your quick feedbacks and sorry for being late,
>
> Alex

Thanks Alex, there was an equally likely chance that I wasn't
understanding things :-) Is there any information on RISC-V PMU
testing? I know ParanLee is interested. It'd be awesome to have
something say on:
https://perf.wiki.kernel.org/index.php/Main_Page
on how to run tests, perhaps on QEMU or known to work boards. We can
also just drop a link on there if there is information. We can also
add the RISC-V PMU information to the links here:
https://perf.wiki.kernel.org/index.php/Useful_Links

Thanks,
Ian

>
> >
> >
> > > between x86 and aarch64 that have assumed userspace hardware counter
> > > access, and everything else that it is assumed don't.
> > >
> > > Thanks,
> > > Ian
> > >
> > > > > Clearly process switches (especially cpu migrations) cause
> > > > > problems, but they are obviously invalid values and can
> > > > > be ignored.
> > > > >
> > > > > So while a lot of uses may be 'happy' with the values the
> > > > > perf framework gives, sometimes you do need to directly
> > > > > read the relevant registers.
> > > > >
> > > > >         David
> > > > >
> > > > > -
> > > > > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> > > > > Registration No: 1397386 (Wales)
> > > >
> > > >
> > > >
> > > > --
> > > > Regards,
> > > > Atish
> >
> >
> >
> > --
> > Regards,
> > Atish

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: SMP enablement on Cortex-R52 (using PSCI ?)
From: Robin Murphy @ 2023-04-19 17:50 UTC (permalink / raw)
  To: Sudeep Holla, Ayan Kumar Halder
  Cc: mark.rutland, lpieralisi, linux-arm-kernel, linux-kernel,
	Vladimir Murzin, Stefano Stabellini
In-Reply-To: <20230419084756.3gypfyuuezjj7tyd@bogus>

On 19/04/2023 9:47 am, Sudeep Holla wrote:
> Hi Ayan,
> 
> On Fri, Apr 14, 2023 at 12:24:38PM +0100, Ayan Kumar Halder wrote:
>> Hi PSCI developers,
>>
>> We have a SoC where there are 4 Cortex-R52 which is distributed in two
>> clusters. So we have 2 Cortex-R52 in one cluster and 2 Cortex-R52 in another
>> cluster.
>>
>> We wish to enable SMP on the 2 R52 within a cluster with Xen hypervisor (EL2
>> software) running on them.
>>
>> We are trying to explore if we can use PSCI for booting the secondary cores.
>>
>> Refer Cortex-R52 TRM
>> (https://developer.arm.com/documentation/100026/0101/?lang=en ), it
>> specifies the following :-
>>
>> Page 24 - Section 1.4.1
>>
>> "Support for Exception levels, EL0, EL1, and EL2."
>>
>> Page 30 - Section 2.1.6
>>
>> "The Cortex-R52 processor does not implement TrustZone® technology. It does
>> not support the ability to distinguish between secure and non-secure
>> physical memories."
>>
>> Thus, there is no EL3 and secure world in Cortex-R52. It implements
>> AArch32-V8R architecture.
>>
> 
> KVM hypervisor use PSCI to bring up secondaries in the VMs. So I am sure we
> must be able to use the interface on Cortex-R52 without EL3.
> 
>>
>> Refer PSCI design document,
>> https://developer.arm.com/documentation/den0022/e/?lang=en
>>
>> Page 18 -
>> "The PSCI specification focuses on the interface between Security states for
>> power management. It provides a method for issuing power management
>> requests. To deal with the requests, the PPF must include a PSCI
>> implementation. A PSCI implementation might require communication between
>> the PPF and a Trusted OS or SP."
>>
>> Page 17 - Privileged Platform Firmware (PPF)
>>
>> "For Armv7 systems, or Armv8 systems using AArch32 at EL3, PPF executes in
>> EL3."
>>
>>  From the above two statements, I infer that PSCI requires a PPF (running at
>> EL3) and a Trusted OS (running at secure EL2). If this is correct, then R52
>> cannot support PSCI. Please correct me if I am mistaken.
>>
>> I wish to know how do we wake up the secondary core if PSCI is not
>> supported.
>>
> 
> I will check with the authors if EL3 is a must for PSCI implementation, but
> IMO it must not be though every aspects described in the spec may not apply
> when used across EL2/EL1 boundaries especially when EL3 is not implemented
> in the hardware.

Xen could provide PSCI to EL1 guests using the HVC conduit. However if 
EL2 is the highest implemented EL, then Xen is the most privileged 
software in the system - it would have to own the EL2 exception vectors, 
and it would have to own the low-level CPU bringup code. At that point 
it just wouldn't make much sense to HVC *itself* via the PSCI protocol 
when it could simply call the function directly.

Robin.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v3 4/5] arm64: dts: ti: k3-j784s4-main: Add DSS and DP-bridge node
From: Krzysztof Kozlowski @ 2023-04-19 18:04 UTC (permalink / raw)
  To: Jayesh Choudhary, nm, vigneshr, afd
  Cc: s-vadapalli, kristo, robh+dt, krzysztof.kozlowski+dt,
	linux-arm-kernel, devicetree, linux-kernel, a-bhatia1
In-Reply-To: <bc58b9cc-f1a1-9c60-341c-9a00777e7142@ti.com>

On 19/04/2023 12:35, Jayesh Choudhary wrote:
>>> +		reg-names = "common_m", "common_s0",
>>> +			"common_s1", "common_s2",
>>> +			"vidl1", "vidl2","vid1","vid2",
>>> +			"ovr1", "ovr2", "ovr3", "ovr4",
>>> +			"vp1", "vp2", "vp3", "vp4",
>>> +			"wb";
>>> +
>>> +		clocks =	<&k3_clks 218 0>,
>>
>> Broken indentation.
> 
> Indentation at both places are similar to j721e dss node.
> Changes are needed in both?

There is no DTS coding style which uses indentation before or after '='.
Just because some DTS are written wrong, should not encourage you to do
the same...

I am commenting only on this patch - it is not correct. What is wrong in
other files should be fixed in other places, not relevant to this patch.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v3 2/3] dt-bindings: timer: rockchip: Add rk3588 compatible
From: Cristian Ciocaltea @ 2023-04-19 18:13 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Sebastian Reichel, Sugar Zhang, Shreeya Patel,
	Kever Yang, Johan Jonker
  Cc: linux-kernel, devicetree, linux-arm-kernel, linux-rockchip,
	kernel, Krzysztof Kozlowski
In-Reply-To: <20230419181309.338354-1-cristian.ciocaltea@collabora.com>

Add compatible string for Rockchip RK3588 timer.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
index 2bdb6e6bdb21..19e56b7577a0 100644
--- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
+++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
@@ -24,6 +24,7 @@ properties:
               - rockchip,rk3228-timer
               - rockchip,rk3229-timer
               - rockchip,rk3368-timer
+              - rockchip,rk3588-timer
               - rockchip,px30-timer
           - const: rockchip,rk3288-timer
   reg:
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v3 0/3] Enable rk3588 timer support
From: Cristian Ciocaltea @ 2023-04-19 18:13 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Sebastian Reichel, Sugar Zhang, Shreeya Patel,
	Kever Yang, Johan Jonker
  Cc: linux-kernel, devicetree, linux-arm-kernel, linux-rockchip,
	kernel

This patchset enables Rockchip RK3588/RK3588S SoC timer support.
While here, it also handles a minor DT binding issue related to RK3288.

Changes in v3:
 - Updated commit description in patch 1, per Krzysztof's review
 - Added Acked-by tag from Krzysztof in patch 2
 - v2: https://lore.kernel.org/lkml/20230418120624.284551-1-cristian.ciocaltea@collabora.com/

Changes in v2:
 - Added Reviewed-by tag from Heiko in patches 1 & 2
 - Update patch 3 according to Johan's review
 - v1: https://lore.kernel.org/lkml/20230418095344.274025-1-cristian.ciocaltea@collabora.com/

Cristian Ciocaltea (3):
  dt-bindings: timer: rockchip: Drop superfluous rk3288 compatible
  dt-bindings: timer: rockchip: Add rk3588 compatible
  arm64: dts: rockchip: Add rk3588 timer

 .../devicetree/bindings/timer/rockchip,rk-timer.yaml      | 2 +-
 arch/arm64/boot/dts/rockchip/rk3588s.dtsi                 | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH v3 1/3] dt-bindings: timer: rockchip: Drop superfluous rk3288 compatible
From: Cristian Ciocaltea @ 2023-04-19 18:13 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Sebastian Reichel, Sugar Zhang, Shreeya Patel,
	Kever Yang, Johan Jonker
  Cc: linux-kernel, devicetree, linux-arm-kernel, linux-rockchip,
	kernel
In-Reply-To: <20230419181309.338354-1-cristian.ciocaltea@collabora.com>

The compatible string for Rockchip RK3288 is wrongly provided in the
'enum' item, in addition to the subsequent 'const', which allows the
usage of an incorrect specification:

  compatible = "rockchip,rk3288-timer", "rockchip,rk3288-timer";

As the rk3288 string is also specified in the top-most 'const' item, the
binding already allows the usage of the correct variant:

  compatible = "rockchip,rk3288-timer";

Drop the unwanted rk3288 entry from the enum.

Fixes: faa186adbd06 ("dt-bindings: timer: convert rockchip,rk-timer.txt to YAML")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
---
 Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
index 65e59836a660..2bdb6e6bdb21 100644
--- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
+++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.yaml
@@ -23,7 +23,6 @@ properties:
               - rockchip,rk3188-timer
               - rockchip,rk3228-timer
               - rockchip,rk3229-timer
-              - rockchip,rk3288-timer
               - rockchip,rk3368-timer
               - rockchip,px30-timer
           - const: rockchip,rk3288-timer
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH v3 3/3] arm64: dts: rockchip: Add rk3588 timer
From: Cristian Ciocaltea @ 2023-04-19 18:13 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner, Rob Herring, Krzysztof Kozlowski,
	Heiko Stuebner, Sebastian Reichel, Sugar Zhang, Shreeya Patel,
	Kever Yang, Johan Jonker
  Cc: linux-kernel, devicetree, linux-arm-kernel, linux-rockchip,
	kernel
In-Reply-To: <20230419181309.338354-1-cristian.ciocaltea@collabora.com>

Add DT node for Rockchip RK3588/RK3588S SoC timer.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 arch/arm64/boot/dts/rockchip/rk3588s.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
index 657c019d27fa..767084a1ec43 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588s.dtsi
@@ -1400,6 +1400,14 @@ i2c5: i2c@fead0000 {
 		status = "disabled";
 	};
 
+	timer0: timer@feae0000 {
+		compatible = "rockchip,rk3588-timer", "rockchip,rk3288-timer";
+		reg = <0x0 0xfeae0000 0x0 0x20>;
+		interrupts = <GIC_SPI 289 IRQ_TYPE_LEVEL_HIGH 0>;
+		clocks = <&cru PCLK_BUSTIMER0>, <&cru CLK_BUSTIMER0>;
+		clock-names = "pclk", "timer";
+	};
+
 	wdt: watchdog@feaf0000 {
 		compatible = "rockchip,rk3588-wdt", "snps,dw-wdt";
 		reg = <0x0 0xfeaf0000 0x0 0x100>;
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [net-next PATCH v7 13/16] ARM: dts: qcom: ipq8064-rb3011: Add Switch LED for each port
From: Krzysztof Kozlowski @ 2023-04-19 18:15 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Heiner Kallweit, Russell King,
	Jonathan Corbet, Gregory Clement, Sebastian Hesselbarth,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Pavel Machek,
	Lee Jones, John Crispin, netdev, devicetree, linux-kernel,
	linux-doc, linux-arm-kernel, linux-arm-msm, linux-leds,
	Jonathan McDowell
In-Reply-To: <643ffce4.050a0220.73dcc.1bec@mx.google.com>

On 19/04/2023 16:38, Christian Marangi wrote:
> On Wed, Apr 19, 2023 at 02:53:45PM +0200, Krzysztof Kozlowski wrote:
>> On 17/04/2023 17:17, Christian Marangi wrote:
>>> Add Switch LED for each port for MikroTik RB3011UiAS-RM.
>>>
>>> MikroTik RB3011UiAS-RM is a 10 port device with 2 qca8337 switch chips
>>> connected.
>>>
>>> It was discovered that in the hardware design all 3 Switch LED trace of
>>> the related port is connected to the same LED. This was discovered by
>>> setting to 'always on' the related led in the switch regs and noticing
>>> that all 3 LED for the specific port (for example for port 1) cause the
>>> connected LED for port 1 to turn on. As an extra test we tried enabling
>>> 2 different LED for the port resulting in the LED turned off only if
>>> every led in the reg was off.
>>>
>>> Aside from this funny and strange hardware implementation, the device
>>> itself have one green LED for each port, resulting in 10 green LED one
>>> for each of the 10 supported port.
>>>
>>> Cc: Jonathan McDowell <noodles@earth.li>
>>> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
>>> ---
>>>  arch/arm/boot/dts/qcom-ipq8064-rb3011.dts | 120 ++++++++++++++++++++++
>>
>> Please do not send the DTS patches to the net-next, but to the Qualcomm
>> SoC maintainers. The DTS must not be mixed with driver code.
>>
> 
> Hi,
> 
> sorry for the mess, it was asked to give an user of the LED feature for
> qca8k so I was a bit confused on where to include it and at the end I
> decided to put it in this series.
> 
> What was the correct way? 2 different series and reference the DT one in
> the net-next? (or not targetting net-next at all?)

Send a separate patchset and provide a lore URL to it in the bindings
(or vice versa).

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 1/7] doc: device tree binding addition for ele MU
From: Rob Herring @ 2023-04-19 18:21 UTC (permalink / raw)
  To: Pankaj Gupta
  Cc: festevam, V.Sethi, kernel, krzysztof.kozlowski+dt, linux-kernel,
	linux-imx, aisheng.dong, shawnguo, linux-arm-kernel, gaurav.jain,
	devicetree, s.hauer, sahil.malhotra, robh+dt
In-Reply-To: <20230419175538.855493-2-pankaj.gupta@nxp.com>


On Wed, 19 Apr 2023 23:25:32 +0530, Pankaj Gupta wrote:
> Documentation update with addition of new device tree
> for NXP ele-mu (Edgelock Enclave Message Unit), driver.
> 
> Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
> ---
>  .../bindings/arm/freescale/fsl,ele_mu.yaml    | 139 ++++++++++++++++++
>  1 file changed, 139 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.example.dtb: ele_mu: mboxes: [[4294967295, 2, 0], [4294967295, 3, 0]] is too short
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/freescale/fsl,ele_mu.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230419175538.855493-2-pankaj.gupta@nxp.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH] Revert "ASoC: fsl: remove unnecessary dai_link->platform"
From: Mark Brown @ 2023-04-19 18:25 UTC (permalink / raw)
  To: kuninori.morimoto.gx, shengjiu.wang, Xiubo.Lee, festevam,
	nicoleotsuka, lgirdwood, perex, tiwai, shawnguo, s.hauer, kernel,
	linux-imx, alsa-devel, Shengjiu Wang
  Cc: linuxppc-dev, linux-arm-kernel, linux-kernel
In-Reply-To: <1681900158-17428-1-git-send-email-shengjiu.wang@nxp.com>

On Wed, 19 Apr 2023 18:29:18 +0800, Shengjiu Wang wrote:
> This reverts commit 33683cbf49b5412061cb1e4c876063fdef86def4.
> 
> dai_link->platform is needed. The platform component is
> "snd_dmaengine_pcm", which is registered from cpu driver,
> 
> If dai_link->platform is not assigned, then platform
> component will not be probed, then there will be issue:
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] Revert "ASoC: fsl: remove unnecessary dai_link->platform"
      commit: 09cda705860125ffee1b1359b1da79f8e0c77a40

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2] stm: class: Add MIPI OST protocol support
From: kernel test robot @ 2023-04-19 18:25 UTC (permalink / raw)
  To: Mao Jinlong, Steven Rostedt, Masami Hiramatsu, Jonathan Corbet,
	Alexander Shishkin, Maxime Coquelin, Alexandre Torgue,
	Tingwei Zhang
  Cc: oe-kbuild-all, Mao Jinlong, linux-kernel, linux-trace-kernel,
	linux-doc, linux-stm32, linux-arm-kernel, linux-arm-msm,
	Yuanfang Zhang, Tao Zhang, Hao Zhang
In-Reply-To: <20230419141328.37472-1-quic_jinlmao@quicinc.com>

Hi Mao,

kernel test robot noticed the following build errors:

[auto build test ERROR on atorgue-stm32/stm32-next]
[also build test ERROR on linus/master v6.3-rc7 next-20230418]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mao-Jinlong/stm-class-Add-MIPI-OST-protocol-support/20230419-221653
base:   https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next
patch link:    https://lore.kernel.org/r/20230419141328.37472-1-quic_jinlmao%40quicinc.com
patch subject: [PATCH v2] stm: class: Add MIPI OST protocol support
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230420/202304200216.kvZgZcao-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/54db7d137859caf5a14de2b166d80913b0c80218
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Mao-Jinlong/stm-class-Add-MIPI-OST-protocol-support/20230419-221653
        git checkout 54db7d137859caf5a14de2b166d80913b0c80218
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202304200216.kvZgZcao-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   drivers/hwtracing/stm/p_ost.c: In function 'ost_write':
>> drivers/hwtracing/stm/p_ost.c:174:46: error: implicit declaration of function 'get_current'; did you mean 'get_cred'? [-Werror=implicit-function-declaration]
     174 |         *(u64 *)(trc_hdr + 8) = task_tgid_nr(get_current());
         |                                              ^~~~~~~~~~~
         |                                              get_cred
>> drivers/hwtracing/stm/p_ost.c:174:46: warning: passing argument 1 of 'task_tgid_nr' makes pointer from integer without a cast [-Wint-conversion]
     174 |         *(u64 *)(trc_hdr + 8) = task_tgid_nr(get_current());
         |                                              ^~~~~~~~~~~~~
         |                                              |
         |                                              int
   In file included from include/linux/sched/mm.h:7,
                    from include/linux/xarray.h:19,
                    from include/linux/radix-tree.h:21,
                    from include/linux/idr.h:15,
                    from include/linux/kernfs.h:12,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/module.h:21,
                    from drivers/hwtracing/stm/p_ost.c:9:
   include/linux/sched.h:1582:54: note: expected 'struct task_struct *' but argument is of type 'int'
    1582 | static inline pid_t task_tgid_nr(struct task_struct *tsk)
         |                                  ~~~~~~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors


vim +174 drivers/hwtracing/stm/p_ost.c

   131	
   132	static ssize_t notrace ost_write(struct stm_data *data,
   133			struct stm_output *output, unsigned int chan,
   134			const char *buf, size_t count)
   135	{
   136		unsigned int c = output->channel + chan;
   137		unsigned int m = output->master;
   138		const unsigned char nil = 0;
   139		u32 header = DATA_HEADER;
   140		u8 trc_hdr[16];
   141		ssize_t sz;
   142	
   143		struct ost_output *op = output->pdrv_private;
   144	
   145		/*
   146		 * Identify the source by entity type.
   147		 * If entity type is not set, return error value.
   148		 */
   149		if (op->node.entity_type == OST_ENTITY_TYPE_FTRACE) {
   150			header |= OST_ENTITY_FTRACE;
   151		} else if (op->node.entity_type == OST_ENTITY_TYPE_CONSOLE) {
   152			header |= OST_ENTITY_CONSOLE;
   153		} else {
   154			pr_debug("p_ost: Entity must be set for trace data.");
   155			return -EINVAL;
   156		}
   157	
   158		/*
   159		 * STP framing rules for OST frames:
   160		 *   * the first packet of the OST frame is marked;
   161		 *   * the last packet is a FLAG with timestamped tag.
   162		 */
   163		/* Message layout: HEADER / DATA / TAIL */
   164		/* HEADER */
   165		sz = data->packet(data, m, c, STP_PACKET_DATA, STP_PACKET_MARKED,
   166				  4, (u8 *)&header);
   167		if (sz <= 0)
   168			return sz;
   169	
   170		/* DATA */
   171		*(u16 *)(trc_hdr) = STM_MAKE_VERSION(0, 4);
   172		*(u16 *)(trc_hdr + 2) = STM_HEADER_MAGIC;
   173		*(u32 *)(trc_hdr + 4) = raw_smp_processor_id();
 > 174		*(u64 *)(trc_hdr + 8) = task_tgid_nr(get_current());
   175		sz = stm_data_write(data, m, c, false, trc_hdr, sizeof(trc_hdr));
   176		if (sz <= 0)
   177			return sz;
   178	
   179		sz = stm_data_write(data, m, c, false, buf, count);
   180	
   181		/* TAIL */
   182		if (sz > 0)
   183			data->packet(data, m, c, STP_PACKET_FLAG,
   184				STP_PACKET_TIMESTAMPED, 0, &nil);
   185	
   186		return sz;
   187	}
   188	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH net-next 0/2] wireless offloading on MediaTek MT7981
From: Daniel Golle @ 2023-04-19 19:04 UTC (permalink / raw)
  To: devicetree, netdev, linux-mediatek, linux-arm-kernel,
	linux-kernel, Rob Herring, Krzysztof Kozlowski, Felix Fietkau,
	John Crispin, Sean Wang, Mark Lee, Lorenzo Bianconi,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno

Add new compatible and load appropriate wireless offloading firmware on
the MediaTek MT7981 SoC.

Daniel Golle (2):
  dt-bindings: net: mediatek: add WED RX binding for MT7981 eth driver
  net: ethernet: mtk_eth_soc: use WO firmware for MT7981

 .../bindings/arm/mediatek/mediatek,mt7622-wed.yaml         | 1 +
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c                | 7 ++++++-
 drivers/net/ethernet/mediatek/mtk_wed_wo.h                 | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH net-next 1/2] dt-bindings: net: mediatek: add WED RX binding for MT7981 eth driver
From: Daniel Golle @ 2023-04-19 19:04 UTC (permalink / raw)
  To: devicetree, netdev, linux-mediatek, linux-arm-kernel,
	linux-kernel, Rob Herring, Krzysztof Kozlowski, Felix Fietkau,
	John Crispin, Sean Wang, Mark Lee, Lorenzo Bianconi,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, AngeloGioacchino Del Regno
In-Reply-To: <cover.1681930898.git.daniel@makrotopia.org>

Add compatible string for mediatek,mt7981-wed as MT7981 also supports
RX WED just like MT7986, but needs a different firmware file.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 .../devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml    | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
index 5c223cb063d48..2c5e04c9adcc8 100644
--- a/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,mt7622-wed.yaml
@@ -21,6 +21,7 @@ properties:
       - enum:
           - mediatek,mt7622-wed
           - mediatek,mt7986-wed
+          - mediatek,mt7981-wed
       - const: syscon
 
   reg:
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH net-next 2/2] net: ethernet: mtk_eth_soc: use WO firmware for MT7981
From: Daniel Golle @ 2023-04-19 19:05 UTC (permalink / raw)
  To: netdev, linux-mediatek, linux-arm-kernel, linux-kernel,
	Felix Fietkau, John Crispin, Sean Wang, Mark Lee,
	Lorenzo Bianconi, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Matthias Brugger, AngeloGioacchino Del Regno
In-Reply-To: <cover.1681930898.git.daniel@makrotopia.org>

In order to support wireless offloading on MT7981 we need to load the
appropriate firmware. Recognize MT7981 and load mt7981_wo.bin.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/ethernet/mediatek/mtk_wed_mcu.c | 7 ++++++-
 drivers/net/ethernet/mediatek/mtk_wed_wo.h  | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
index 6bad0d262f286..071ed3dea860d 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_mcu.c
@@ -326,7 +326,11 @@ mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
 		wo->hw->index + 1);
 
 	/* load firmware */
-	fw_name = wo->hw->index ? MT7986_FIRMWARE_WO1 : MT7986_FIRMWARE_WO0;
+	if (of_device_is_compatible(wo->hw->node, "mediatek,mt7981-wed"))
+		fw_name = MT7981_FIRMWARE_WO;
+	else
+		fw_name = wo->hw->index ? MT7986_FIRMWARE_WO1 : MT7986_FIRMWARE_WO0;
+
 	ret = request_firmware(&fw, fw_name, wo->hw->dev);
 	if (ret)
 		return ret;
@@ -386,5 +390,6 @@ int mtk_wed_mcu_init(struct mtk_wed_wo *wo)
 				  100, MTK_FW_DL_TIMEOUT);
 }
 
+MODULE_FIRMWARE(MT7981_FIRMWARE_WO);
 MODULE_FIRMWARE(MT7986_FIRMWARE_WO0);
 MODULE_FIRMWARE(MT7986_FIRMWARE_WO1);
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.h b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
index dbcf42ce9173c..7a1a2a28f1acb 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
@@ -88,6 +88,7 @@ enum mtk_wed_dummy_cr_idx {
 	MTK_WED_DUMMY_CR_WO_STATUS,
 };
 
+#define MT7981_FIRMWARE_WO	"mediatek/mt7981_wo.bin"
 #define MT7986_FIRMWARE_WO0	"mediatek/mt7986_wo_0.bin"
 #define MT7986_FIRMWARE_WO1	"mediatek/mt7986_wo_1.bin"
 
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 1/2] arm64: dts: mt7622: declare SPI-NAND present on BPI-R64
From: Daniel Golle @ 2023-04-19 19:15 UTC (permalink / raw)
  To: devicetree, linux-mediatek, linux-arm-kernel, linux-kernel,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger,
	AngeloGioacchino Del Regno

The SPI-NOR node in the device tree of the BananaPi R64 has most likely
been copied from the reference board's device tree even though the R64
comes with an SPI-NAND chip rather than SPI-NOR.

Setup the Serial NAND Flash Interface (SNFI) controller, enable
hardware BCH error detection and correction engine and add the SPI-NAND
chip including basic partitions,

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 .../dts/mediatek/mt7622-bananapi-bpi-r64.dts  | 39 ++++++++++++++++---
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
index af3fe61e40938..d583e816684cf 100644
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
@@ -248,14 +248,42 @@ &nandc {
 	status = "disabled";
 };
 
-&nor_flash {
-	pinctrl-names = "default";
-	pinctrl-0 = <&spi_nor_pins>;
-	status = "disabled";
+&bch {
+	status = "okay";
+};
 
+&snfi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&serial_nand_pins>;
+	status = "okay";
 	flash@0 {
-		compatible = "jedec,spi-nor";
+		compatible = "spi-nand";
 		reg = <0>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
+		nand-ecc-engine = <&snfi>;
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "bl2";
+				reg = <0x0 0x80000>;
+				read-only;
+			};
+
+			partition@80000 {
+				label = "fip";
+				reg = <0x80000 0x200000>;
+				read-only;
+			};
+
+			ubi: partition@280000 {
+				label = "ubi";
+				reg = <0x280000 0x7d80000>;
+			};
+		};
 	};
 };
 

base-commit: 13961ef828cbc254cc272221b7fc54851caa39a7
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 2/2] arm64: dts: mt7622: handle interrupts from MT7531 switch on BPI-R64
From: Daniel Golle @ 2023-04-19 19:16 UTC (permalink / raw)
  To: devicetree, linux-mediatek, linux-arm-kernel, linux-kernel,
	Rob Herring, Krzysztof Kozlowski, Matthias Brugger,
	AngeloGioacchino Del Regno

Since commit ba751e28d442 ("net: dsa: mt7530: add interrupt support")
the mt7530 driver can act as an interrupt controller. Wire up irq line
of the MT7531 switch on the BananaPi BPi-R64 board, so the status of
the PHYs of the five 1000Base-T ports doesn't need to be polled any
more.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
index d583e816684cf..aabd104b12acf 100644
--- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
@@ -150,6 +150,10 @@ mdio: mdio-bus {
 		switch@0 {
 			compatible = "mediatek,mt7531";
 			reg = <0>;
+			interrupt-controller;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&pio>;
+			interrupts = <53 IRQ_TYPE_LEVEL_HIGH>;
 			reset-gpios = <&pio 54 0>;
 
 			ports {
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 0/2] Support PWM on MediaTek MT7981
From: Daniel Golle @ 2023-04-19 19:24 UTC (permalink / raw)
  To: devicetree, linux-pwm, linux-mediatek, linux-arm-kernel,
	linux-kernel, Rob Herring, Krzysztof Kozlowski, Thierry Reding,
	Uwe Kleine-König, Matthias Brugger,
	AngeloGioacchino Del Regno, John Crispin

Add support for PWM on the MediaTek MT7981 to pwm-mediatek.c as well
as new mediatek,mt7981-pwm compatible string to the existing bindings.

Daniel Golle (2):
  dt-bindings: pwm: mediatek: Add mediatek,mt7981 compatible
  pwm: mediatek: Add support for MT7981

 .../bindings/pwm/mediatek,mt2712-pwm.yaml     |  1 +
 drivers/pwm/pwm-mediatek.c                    | 54 ++++++++++++++++---
 2 files changed, 47 insertions(+), 8 deletions(-)


base-commit: 67d5d9f013d6c3829383c08162939cabff14fccc
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* [PATCH 1/2] dt-bindings: pwm: mediatek: Add mediatek,mt7981 compatible
From: Daniel Golle @ 2023-04-19 19:24 UTC (permalink / raw)
  To: devicetree, linux-pwm, linux-mediatek, linux-arm-kernel,
	linux-kernel, Rob Herring, Krzysztof Kozlowski, Thierry Reding,
	Uwe Kleine-König, Matthias Brugger,
	AngeloGioacchino Del Regno, John Crispin
In-Reply-To: <cover.1681932165.git.daniel@makrotopia.org>

Add compatible string for the PWM unit found of the MediaTek MT7981 SoC.
This is in preparation to adding support in the pwm-mediatek.c driver.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml b/Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml
index 8e176ba7a525f..0fbe8a6469eb2 100644
--- a/Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml
+++ b/Documentation/devicetree/bindings/pwm/mediatek,mt2712-pwm.yaml
@@ -22,6 +22,7 @@ properties:
           - mediatek,mt7623-pwm
           - mediatek,mt7628-pwm
           - mediatek,mt7629-pwm
+          - mediatek,mt7981-pwm
           - mediatek,mt7986-pwm
           - mediatek,mt8183-pwm
           - mediatek,mt8365-pwm
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* [PATCH 2/2] pwm: mediatek: Add support for MT7981
From: Daniel Golle @ 2023-04-19 19:25 UTC (permalink / raw)
  To: linux-pwm, linux-mediatek, linux-arm-kernel, linux-kernel,
	Thierry Reding, Uwe Kleine-König, Matthias Brugger,
	AngeloGioacchino Del Regno, John Crispin
In-Reply-To: <cover.1681932165.git.daniel@makrotopia.org>

The PWM unit on MT7981 uses different register offsets than previous
MediaTek PWM units. Add support for these new offsets and add support
for PWM on MT7981 which has 3 PWM channels, one of them is typically
used for a temperature controlled fan.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/pwm/pwm-mediatek.c | 54 ++++++++++++++++++++++++++++++++------
 1 file changed, 46 insertions(+), 8 deletions(-)

diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
index 5b5eeaff35da6..2bfb5bedf570b 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -34,10 +34,14 @@
 
 #define PWM_CLK_DIV_MAX		7
 
+#define REG_V1			1
+#define REG_V2			2
+
 struct pwm_mediatek_of_data {
 	unsigned int num_pwms;
 	bool pwm45_fixup;
 	bool has_ck_26m_sel;
+	u8 reg_ver;
 };
 
 /**
@@ -59,10 +63,14 @@ struct pwm_mediatek_chip {
 	const struct pwm_mediatek_of_data *soc;
 };
 
-static const unsigned int pwm_mediatek_reg_offset[] = {
+static const unsigned int mtk_pwm_reg_offset_v1[] = {
 	0x0010, 0x0050, 0x0090, 0x00d0, 0x0110, 0x0150, 0x0190, 0x0220
 };
 
+static const unsigned int mtk_pwm_reg_offset_v2[] = {
+	0x0080, 0x00c0, 0x0100, 0x0140, 0x0180, 0x1c0, 0x200, 0x0240
+};
+
 static inline struct pwm_mediatek_chip *
 to_pwm_mediatek_chip(struct pwm_chip *chip)
 {
@@ -111,7 +119,19 @@ static inline void pwm_mediatek_writel(struct pwm_mediatek_chip *chip,
 				       unsigned int num, unsigned int offset,
 				       u32 value)
 {
-	writel(value, chip->regs + pwm_mediatek_reg_offset[num] + offset);
+	u32 pwm_offset;
+
+	switch (chip->soc->reg_ver) {
+	case REG_V2:
+		pwm_offset = mtk_pwm_reg_offset_v2[num];
+		break;
+
+	case REG_V1:
+	default:
+		pwm_offset = mtk_pwm_reg_offset_v1[num];
+	}
+
+	writel(value, chip->regs + pwm_offset + offset);
 }
 
 static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -285,60 +305,77 @@ static const struct pwm_mediatek_of_data mt2712_pwm_data = {
 	.num_pwms = 8,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = false,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt6795_pwm_data = {
 	.num_pwms = 7,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = false,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt7622_pwm_data = {
 	.num_pwms = 6,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = true,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt7623_pwm_data = {
 	.num_pwms = 5,
 	.pwm45_fixup = true,
 	.has_ck_26m_sel = false,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt7628_pwm_data = {
 	.num_pwms = 4,
 	.pwm45_fixup = true,
 	.has_ck_26m_sel = false,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt7629_pwm_data = {
 	.num_pwms = 1,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = false,
+	.reg_ver = REG_V1,
 };
 
-static const struct pwm_mediatek_of_data mt8183_pwm_data = {
-	.num_pwms = 4,
+static const struct pwm_mediatek_of_data mt7981_pwm_data = {
+	.num_pwms = 3,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = true,
+	.reg_ver = REG_V2,
 };
 
-static const struct pwm_mediatek_of_data mt8365_pwm_data = {
-	.num_pwms = 3,
+static const struct pwm_mediatek_of_data mt7986_pwm_data = {
+	.num_pwms = 2,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = true,
+	.reg_ver = REG_V1,
 };
 
-static const struct pwm_mediatek_of_data mt7986_pwm_data = {
-	.num_pwms = 2,
+static const struct pwm_mediatek_of_data mt8183_pwm_data = {
+	.num_pwms = 4,
+	.pwm45_fixup = false,
+	.has_ck_26m_sel = true,
+	.reg_ver = REG_V1,
+};
+
+static const struct pwm_mediatek_of_data mt8365_pwm_data = {
+	.num_pwms = 3,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = true,
+	.reg_ver = REG_V1,
 };
 
 static const struct pwm_mediatek_of_data mt8516_pwm_data = {
 	.num_pwms = 5,
 	.pwm45_fixup = false,
 	.has_ck_26m_sel = true,
+	.reg_ver = REG_V1,
 };
 
 static const struct of_device_id pwm_mediatek_of_match[] = {
@@ -348,6 +385,7 @@ static const struct of_device_id pwm_mediatek_of_match[] = {
 	{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
 	{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
 	{ .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data },
+	{ .compatible = "mediatek,mt7981-pwm", .data = &mt7981_pwm_data },
 	{ .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data },
 	{ .compatible = "mediatek,mt8183-pwm", .data = &mt8183_pwm_data },
 	{ .compatible = "mediatek,mt8365-pwm", .data = &mt8365_pwm_data },
-- 
2.40.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related

* Re: [PATCH v1 1/5] mtd: rawnand: meson: fix NAND access for read/write
From: Arseniy Krasnov @ 2023-04-19 19:43 UTC (permalink / raw)
  To: Liang Yang, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Yixun Lan, Jianxin Pan
  Cc: oxffffaa, kernel, linux-mtd, linux-arm-kernel, linux-amlogic,
	linux-kernel
In-Reply-To: <44dd5bcc-2b98-d402-7e8f-5e2d4babf898@sberdevices.ru>



On 17.04.2023 17:10, Arseniy Krasnov wrote:
> 
> 
> On 17.04.2023 16:54, Liang Yang wrote:
>> Hi Arseniy,
>>
>> On 2023/4/17 14:47, Arseniy Krasnov wrote:
>>> [ EXTERNAL EMAIL ]
>>>
>>>
>>>
>>> On 13.04.2023 08:57, Liang Yang wrote:
>>>> Hi Arseniy,
>>>>
>>>> On 2023/4/13 13:10, Arseniy Krasnov wrote:
>>>>> [ EXTERNAL EMAIL ]
>>>>>
>>>>>
>>>>>
>>>>> On 12.04.2023 16:30, Liang Yang wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On 2023/4/12 20:03, Arseniy Krasnov wrote:
>>>>>>> [ EXTERNAL EMAIL ]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 12.04.2023 13:24, Arseniy Krasnov wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12.04.2023 12:37, Liang Yang wrote:
>>>>>>>>> Hi Arseniy,
>>>>>>>>>
>>>>>>>>> Thanks for pointing out this problem. also comment inline.
>>>>>>>>>
>>>>>>>>> On 2023/4/12 14:16, Arseniy Krasnov wrote:
>>>>>>>>>> [ EXTERNAL EMAIL ]
>>>>>>>>>>
>>>>>>>>>> This fixes read/write functionality. New command sequences were ported
>>>>>>>>>> from old vendor's driver. Without this patch driver works unstable. This
>>>>>>>>>> change is tested with 'nanddump'/'nandwrite' utilities and mounting
>>>>>>>>>> JFFS2 filesystem on AXG family (A113X SoC).
>>>>>>>>>>
>>>>>>>>>> Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
>>>>>>>>>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>>>>>>>>>> ---
>>>>>>>>>>      drivers/mtd/nand/raw/meson_nand.c | 116 ++++++++++++++++++++++++++----
>>>>>>>>>>      1 file changed, 101 insertions(+), 15 deletions(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
>>>>>>>>>> index 074e14225c06..256c37c76526 100644
>>>>>>>>>> --- a/drivers/mtd/nand/raw/meson_nand.c
>>>>>>>>>> +++ b/drivers/mtd/nand/raw/meson_nand.c
>>>>>>>>>> @@ -26,6 +26,7 @@
>>>>>>>>>>      #define NFC_CMD_IDLE        (0xc << 14)
>>>>>>>>>>      #define NFC_CMD_CLE        (0x5 << 14)
>>>>>>>>>>      #define NFC_CMD_ALE        (0x6 << 14)
>>>>>>>>>> +#define NFC_CMD_DRD        (0x8 << 14)
>>>>>>>>>>      #define NFC_CMD_ADL        ((0 << 16) | (3 << 20))
>>>>>>>>>>      #define NFC_CMD_ADH        ((1 << 16) | (3 << 20))
>>>>>>>>>>      #define NFC_CMD_AIL        ((2 << 16) | (3 << 20))
>>>>>>>>>> @@ -84,6 +85,7 @@
>>>>>>>>>>        #define DMA_BUSY_TIMEOUT    0x100000
>>>>>>>>>>      #define CMD_FIFO_EMPTY_TIMEOUT    1000
>>>>>>>>>> +#define DEVICE_READY_TIMEOUT    1000
>>>>>>>>>>        #define MAX_CE_NUM        2
>>>>>>>>>>      @@ -255,8 +257,26 @@ static void meson_nfc_select_chip(struct nand_chip *nand, int chip)
>>>>>>>>>>          }
>>>>>>>>>>      }
>>>>>>>>>>      +static int meson_nfc_wait_cmd_finish(struct meson_nfc *nfc,
>>>>>>>>>> +                     unsigned int timeout_ms)
>>>>>>>>>> +{
>>>>>>>>>> +    u32 cmd_size = 0;
>>>>>>>>>> +    int ret;
>>>>>>>>>> +
>>>>>>>>>> +    /* wait cmd fifo is empty */
>>>>>>>>>> +    ret = readl_relaxed_poll_timeout(nfc->reg_base + NFC_REG_CMD, cmd_size,
>>>>>>>>>> +                     !NFC_CMD_GET_SIZE(cmd_size),
>>>>>>>>>> +                     10, timeout_ms * 1000);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        dev_err(nfc->dev, "wait for empty CMD FIFO timed out\n");
>>>>>>>>>> +
>>>>>>>>>> +    return ret;
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>>      static void meson_nfc_cmd_idle(struct meson_nfc *nfc, u32 time)
>>>>>>>>>>      {
>>>>>>>>>> +    meson_nfc_wait_cmd_finish(nfc, 0);
>>>>>>>>>> +
>>>>>>>>>>          writel(nfc->param.chip_select | NFC_CMD_IDLE | (time & 0x3ff),
>>>>>>>>>>                 nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>>      }
>>>>>>>>>> @@ -308,23 +328,9 @@ static void meson_nfc_drain_cmd(struct meson_nfc *nfc)
>>>>>>>>>>           */
>>>>>>>>>>          meson_nfc_cmd_idle(nfc, 0);
>>>>>>>>>>          meson_nfc_cmd_idle(nfc, 0);
>>>>>>>>>> +    meson_nfc_wait_cmd_finish(nfc, 1000);
>>>>>>>>>>      }
>>>>>>>>>>      -static int meson_nfc_wait_cmd_finish(struct meson_nfc *nfc,
>>>>>>>>>> -                     unsigned int timeout_ms)
>>>>>>>>>> -{
>>>>>>>>>> -    u32 cmd_size = 0;
>>>>>>>>>> -    int ret;
>>>>>>>>>> -
>>>>>>>>>> -    /* wait cmd fifo is empty */
>>>>>>>>>> -    ret = readl_relaxed_poll_timeout(nfc->reg_base + NFC_REG_CMD, cmd_size,
>>>>>>>>>> -                     !NFC_CMD_GET_SIZE(cmd_size),
>>>>>>>>>> -                     10, timeout_ms * 1000);
>>>>>>>>>> -    if (ret)
>>>>>>>>>> -        dev_err(nfc->dev, "wait for empty CMD FIFO time out\n");
>>>>>>>>>> -
>>>>>>>>>> -    return ret;
>>>>>>>>>> -}
>>>>>>>>>>        static int meson_nfc_wait_dma_finish(struct meson_nfc *nfc)
>>>>>>>>>>      {
>>>>>>>>>> @@ -631,6 +637,48 @@ static int meson_nfc_rw_cmd_prepare_and_execute(struct nand_chip *nand,
>>>>>>>>>>          return 0;
>>>>>>>>>>      }
>>>>>>>>>>      +static uint8_t meson_nfc_read_byte(struct nand_chip *nand)
>>>>>>>>>> +{
>>>>>>>>>> +    struct meson_nfc *nfc = nand_get_controller_data(nand);
>>>>>>>>>> +
>>>>>>>>>> +    writel(NFC_CMD_DRD, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>> +    meson_nfc_cmd_idle(nfc, nfc->timing.twb);
>>>>>>>>>> +    meson_nfc_drain_cmd(nfc);
>>>>>>>>>> +
>>>>>>>>>> +    return readl(nfc->reg_base + NFC_REG_BUF);
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>> +static int meson_nfc_wait_dev_ready(struct nand_chip *nand)
>>>>>>>>>> +{
>>>>>>>>>> +    struct meson_nfc *nfc = nand_get_controller_data(nand);
>>>>>>>>>> +    u32 cs = nfc->param.chip_select;
>>>>>>>>>> +    unsigned long cnt = 0;
>>>>>>>>>> +
>>>>>>>>>> +    meson_nfc_drain_cmd(nfc);
>>>>>>>>>> +
>>>>>>>>>> +    writel(cs | NFC_CMD_CLE | NAND_CMD_STATUS, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>> +
>>>>>>>>>> +    /* 10 ms. */
>>>>>>>>>> +    while (cnt < DEVICE_READY_TIMEOUT) {
>>>>>>>>>> +        uint8_t status;
>>>>>>>>>> +
>>>>>>>>>> +        status = meson_nfc_read_byte(nand);
>>>>>>>>>> +
>>>>>>>>>> +        if (status & NAND_STATUS_READY)
>>>>>>>>>> +            break;
>>>>>>>>>> +
>>>>>>>>>> +        usleep_range(10, 11);
>>>>>>>>>> +        cnt++;
>>>>>>>>>> +    }
>>>>>>>>>> +
>>>>>>>>>> +    if (cnt == DEVICE_READY_TIMEOUT) {
>>>>>>>>>> +        dev_err(nfc->dev, "device ready timeout\n");
>>>>>>>>>> +        return -ETIMEDOUT;
>>>>>>>>>> +    }
>>>>>>>>>> +
>>>>>>>>>> +    return 0;
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>>      static int meson_nfc_write_page_sub(struct nand_chip *nand,
>>>>>>>>>>                          int page, int raw)
>>>>>>>>>>      {
>>>>>>>>>> @@ -643,6 +691,10 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand,
>>>>>>>>>>          u32 cmd;
>>>>>>>>>>          int ret;
>>>>>>>>>>      +    ret = meson_nfc_wait_dev_ready(nand);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          meson_nfc_select_chip(nand, nand->cur_cs);
>>>>>>>>>>            data_len =  mtd->writesize + mtd->oobsize;
>>>>>>>>>> @@ -667,12 +719,20 @@ static int meson_nfc_write_page_sub(struct nand_chip *nand,
>>>>>>>>>>                           NFC_CMD_SCRAMBLER_DISABLE);
>>>>>>>>>>          }
>>>>>>>>>>      +    ret = meson_nfc_wait_dma_finish(nfc);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          cmd = nfc->param.chip_select | NFC_CMD_CLE | NAND_CMD_PAGEPROG;
>>>>>>>>>>          writel(cmd, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>>          meson_nfc_queue_rb(nfc, PSEC_TO_MSEC(sdr->tPROG_max));
>>>>>>>>>>            meson_nfc_dma_buffer_release(nand, data_len, info_len, DMA_TO_DEVICE);
>>>>>>>>>>      +    ret = meson_nfc_wait_dev_ready(nand);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          return ret;
>>>>>>>>>>      }
>>>>>>>>>>      @@ -720,6 +780,21 @@ static void meson_nfc_check_ecc_pages_valid(struct meson_nfc *nfc,
>>>>>>>>>>          } while (!ret);
>>>>>>>>>>      }
>>>>>>>>>>      +static inline int meson_nfc_send_read(struct nand_chip *nand)
>>>>>>>>>> +{
>>>>>>>>>> +    struct meson_nfc *nfc = nand_get_controller_data(nand);
>>>>>>>>>> +    u32 cs = nfc->param.chip_select;
>>>>>>>>>> +    int ret;
>>>>>>>>>> +
>>>>>>>>>> +    ret = meson_nfc_wait_dev_ready(nand);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>> +    writel(cs | NFC_CMD_CLE | NAND_CMD_READ0, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>> +
>>>>>>>>>> +    return 0;
>>>>>>>>>> +}
>>>>>>>>>> +
>>>>>>>>>
>>>>>>>>> it already calls meson_nfc_queue_rb() in meson_nfc_rw_cmd_prepare_and_execute(). Could you implements this in meson_nfc_queue_rb()? and we can use the irq method.
>>>>>>>>> also without Ready/Busy pin, the meson_nfc_queue_rb() should change like below:
>>>>>>>>>        ......
>>>>>>>>>        #define NFC_CMD_RB_INT    ((0xb << 10) | BIT(18))
>>>>>>>
>>>>>>> Sorry, I can see this define as (and it is used in the driver):
>>>>>>> #define NFC_CMD_RB_INT          BIT(14)
>>>>>>>
>>>>>>> in drivers/mtd/nand/raw/meson_nand.c
>>>>>>>
>>>>>>> Which one is correct ?
>>>>>>
>>>>>> we need to modify the define 'NFC_CMD_RB_INT' as ((0xb << 10) | BIT(18)).
>>>>>>
>>>>>
>>>>> Ok, NFC_CMD_RB_INT - it is "Ready/Busy_Interrupt" ? You suppose that currently it is
>>>>> defined incorrectly, so irq waiting does not work?
>>>>
>>>> Previous defined BIT(14) is for having the external Ready/Busy pin of the NAND device connected to the controller. the new define is for reading status by sending read status(70H) command and read status from the data bus(checking the IO6). the both can work on AXG soc.
>>>> when the controller RB command is sent, the controller automatically checks the level of external Ready/Busy pin or the data bus(IO6) periodicity. and generate the irq signal if status is ready.
>>>>
>>>>>
>>>>> Thanks, Arseniy
>>>>>
>>>>>>>
>>>>>>> Thanks, Arseniy
>>>>>>>
>>>>>>>>>
>>>>>>>>>        meson_nfc_cmd_idle(nfc, 0);
>>>>>>>>>        cmd = nfc->param.chip_select | NFC_CMD_CLE | NAND_CMD_STATUS;
>>>>>>>>>        writel(cmd, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>        meson_nfc_cmd_idle(nfc, 5);
>>>>>>>>>        cmd = NFC_CMD_RB | NFC_CMD_RB_INT | nfc->timing.tbers_max;
>>>>>>>>>        writel(cmd, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>
>>>>>>>>>        ret = wait_for_completion_timeout(&nfc->completion,
>>>>>>>>>                          msecs_to_jiffies(timeout_ms));
>>>>>>>>>        if (ret == 0)
>>>>>>>>>            ret = -1;
>>>>>>>>>
>>>>>>>>>        writel(cs | NFC_CMD_CLE | NAND_CMD_READ0, nfc->reg_base + NFC_REG_CMD);
>>>>>>>>>        ......
>>>>>>>>>
>>>
>>> Hello Liang!
>>>
>>> I've got small questions to clarify Your comment. You suggest two thing IIUC:
>>>
>>> 1) Send NAND_CMD_READ0 from 'meson_nfc_queue_rb()'. This means that extra argument is needed to
>>> 'meson_nfc_queue_rb()' which shows that read operation is going to be performed. We can't send
>>> NAND_CMD_READ0 for write operation?
>>
>> it is ok to me. but does NAND_CMD_READ0 really need to send in the controller driver? i don't find the other controller drivers have to send it for the old vendor NAND device.
> 
> Hm, I found this command in the old driver. For example without it I get the following error:
> 
> # nanddump -c -s 0 -l 2048 /dev/mtd0 --oob
> ECC failed: 3975
> ECC corrected: 47
> Number of bad blocks: 10
> Number of bbt blocks: 0
> Block size 131072, page size 2048, OOB size 64
> Dumping data starting at 0x00000000 and ending at 0x00000800...
> 
> But data is not corrupted and seems ok. With this extra NAND_CMD_READ0 everything is ok - data is still valid and
> there are no ECC errors.
> 
>>
>>>
>>> 2) About code and define above, I tried to replace current body of 'meson_nfc_queue_rb()', but it
>>> didn't work. May be I did it wrong, because what to do with 'meson_nfc_wait_dev_ready()' and it's
>>> call sites? It must be removed? Could You please explain Your idea in more details? I'm asking You
>>> because I don't have doc for this NAND controller, so it is very difficult to me to add valid
>>> logic to this driver without any references
>>
>> Could you please try the following? i have tested it on another SOC (not axg).
>>
>> static int meson_nfc_queue_rb(struct meson_nfc *nfc, int timeout_ms)
>> {
>>     u32 cmd, cfg;
>>     int ret = 0;
>>
>>     meson_nfc_cmd_idle(nfc, nfc->timing.twb);
>>     meson_nfc_drain_cmd(nfc);
>>     meson_nfc_wait_cmd_finish(nfc, CMD_FIFO_EMPTY_TIMEOUT);
>>
>>     cfg = readl(nfc->reg_base + NFC_REG_CFG);
>>     cfg |= NFC_RB_IRQ_EN;
>>     writel(cfg, nfc->reg_base + NFC_REG_CFG);
>>
>>     reinit_completion(&nfc->completion);
>>
>>     meson_nfc_cmd_idle(nfc, 0);
>>     cmd = nfc->param.chip_select | NFC_CMD_CLE | NAND_CMD_STATUS;
>>     writel(cmd, nfc->reg_base + NFC_REG_CMD);
>>     meson_nfc_cmd_idle(nfc, 5);
>>     cmd = NFC_CMD_RB | NFC_CMD_RB_INT
>>         | nfc->param.chip_select | nfc->timing.tbers_max;
>>     writel(cmd, nfc->reg_base + NFC_REG_CMD);
>>     meson_nfc_drain_cmd(nfc);
>>
>>     ret = wait_for_completion_timeout(&nfc->completion,
>>                       msecs_to_jiffies(timeout_ms));
>>     if (ret == 0)
>>         ret = -1;
>>
>>     writel(1 << 31, nfc->reg_base + NFC_REG_CMD);
>>
>>     return ret;
>> }
> 
> Ok! Thanks, I'll try it!
> 
> Thanks, Arseniy

Hello @Liang, I tried this code, seems with this implementation NAND driver works very slow,
here is for example output buring bad blocks lookup:

[    2.060835] Scanning device for bad blocks
[    3.350085] Bad eraseblock 20 at 0x000000280000
[    3.536389] Freeing initrd memory: 11808K
[   39.133952] Bad eraseblock 581 at 0x0000048a0000
[   44.837917] Bad eraseblock 671 at 0x0000053e0000
[   45.677964] Bad eraseblock 685 at 0x0000055a0000
[   83.637917] Bad eraseblock 1279 at 0x000009fe0000
[  132.833318] modprobe (56) used greatest stack depth: 12672 bytes left


Take a look at timeouts. I used Your variant of 'meson_nfc_queue_rb()' from above,
#define NFC_CMD_RB_INT is ((0xb << 10) | BIT(18)). I tested it with my ports of
of dev ready calls from the old vendor's driver.

Thanks, Arseniy

> 
>>
>> also we need to check and return the return value for meson_nfc_queue_rb() in meson_nfc_rw_cmd_prepare_and_execute() and meson_nfc_write_page_sub().
>>
>>>
>>> May be I can send v2 patchset for review without this change, as v2 already includes udpate for OOB
>>> handling which is I think more critical?
>>>
>>
>> sure, it is up to you. it is more important, thanks again.
>>
>>> Thanks, Arseniy
>>>
>>>>>>>>
>>>>>>>>        Thanks for reply! I'll try this code! One more question about OOB processing in this
>>>>>>>> driver (as You are author of it):
>>>>>>>>
>>>>>>>>       OOB size is 64 bytes, but for example if I have 1K ECC, 2 bytes user bytes and 14
>>>>>>>>       bytes for ECC code for each 1K. In this case I have access to only 32 bytes of OOB:
>>>>>>>>       2 x (2 user bytes + 14 ECC bytes). Correct me if i'm wrong, but rest of OOB (next
>>>>>>>>       32 bytes) become unavailable (in both raw and ECC modes) ?
>>>>>>>>
>>>>>>>> Thanks, Arseniy
>>>>>>>>
>>>>>>>>>>      static int meson_nfc_read_page_sub(struct nand_chip *nand,
>>>>>>>>>>                         int page, int raw)
>>>>>>>>>>      {
>>>>>>>>>> @@ -734,10 +809,18 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand,
>>>>>>>>>>          data_len =  mtd->writesize + mtd->oobsize;
>>>>>>>>>>          info_len = nand->ecc.steps * PER_INFO_BYTE;
>>>>>>>>>>      +    ret = meson_nfc_wait_dev_ready(nand);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          ret = meson_nfc_rw_cmd_prepare_and_execute(nand, page, DIRREAD);
>>>>>>>>>>          if (ret)
>>>>>>>>>>              return ret;
>>>>>>>>>>      +    ret = meson_nfc_send_read(nand);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          ret = meson_nfc_dma_buffer_setup(nand, meson_chip->data_buf,
>>>>>>>>>>                           data_len, meson_chip->info_buf,
>>>>>>>>>>                           info_len, DMA_FROM_DEVICE);
>>>>>>>>>> @@ -754,6 +837,9 @@ static int meson_nfc_read_page_sub(struct nand_chip *nand,
>>>>>>>>>>          }
>>>>>>>>>>            ret = meson_nfc_wait_dma_finish(nfc);
>>>>>>>>>> +    if (ret)
>>>>>>>>>> +        return ret;
>>>>>>>>>> +
>>>>>>>>>>          meson_nfc_check_ecc_pages_valid(nfc, nand, raw);
>>>>>>>>>>            meson_nfc_dma_buffer_release(nand, data_len, info_len, DMA_FROM_DEVICE);
>>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v4 1/2] dt-bindings: arm: amlogic: add Xiaomi Mi box 3 binding
From: Krzysztof Kozlowski @ 2023-04-19 19:57 UTC (permalink / raw)
  To: Karl Chan, linux-amlogic
  Cc: robh+dt, krzysztof.kozlowski+dt, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, devicetree, linux-arm-kernel, linux-kernel,
	Karl Chan
In-Reply-To: <20230418145515.19547-2-exkcmailist@inbox.lv>

On 18/04/2023 16:55, Karl Chan wrote:
> From: "Karl Chan"  <exkcmailist@inbox.lv>
> 
> Add the board binding for the Xiaomi Mi box 3 Android Set-Top Box device.
> 
> Signed-off-by: Karl Chan <exxxxkc@getgoogleoff.me>

Your SoB does not match From. You have been told last time to which you
did not respond, not fix it.

NAK.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v4 4/4] pwm: meson: make full use of common clock framework
From: Heiner Kallweit @ 2023-04-19 19:58 UTC (permalink / raw)
  To: neil.armstrong, Jerome Brunet, Martin Blumenstingl,
	Neil Armstrong, Kevin Hilman, Uwe Kleine-König,
	thierry.reding@gmail.com
  Cc: linux-arm-kernel@lists.infradead.org,
	open list:ARM/Amlogic Meson..., linux-pwm
In-Reply-To: <229e20ef-6e99-6d52-b0e6-a357a184b6af@linaro.org>

On 17.04.2023 14:21, neil.armstrong@linaro.org wrote:
> On 17/04/2023 12:36, Heiner Kallweit wrote:
>> On 17.04.2023 11:59, neil.armstrong@linaro.org wrote:
>>> On 17/04/2023 11:53, Heiner Kallweit wrote:
>>>> On 17.04.2023 09:23, Neil Armstrong wrote:
>>>>> On 13/04/2023 07:54, Heiner Kallweit wrote:
>>>>>> Newer versions of the PWM block use a core clock with external mux,
>>>>>> divider, and gate. These components either don't exist any longer in
>>>>>> the PWM block, or they are bypassed.
>>>>>> To minimize needed changes for supporting the new version, the internal
>>>>>> divider and gate should be handled by CCF too.
>>>>>>
>>>>>> I didn't see a good way to split the patch, therefore it's somewhat
>>>>>> bigger. What it does:
>>>>>>
>>>>>> - The internal mux is handled by CCF already. Register also internal
>>>>>>      divider and gate with CCF, so that we have one representation of the
>>>>>>      input clock: [mux] parent of [divider] parent of [gate]
>>>>>>      - Now that CCF selects an appropriate mux parent, we don't need the
>>>>>>      DT-provided default parent any longer. Accordingly we can also omit
>>>>>>      setting the mux parent directly in the driver.
>>>>>>      - Instead of manually handling the pre-div divider value, let CCF
>>>>>>      set the input clock. Targeted input clock frequency is
>>>>>>      0xffff * 1/period for best precision.
>>>>>>      - For the "inverted pwm disabled" scenario target an input clock
>>>>>>      frequency of 1GHz. This ensures that the remaining low pulses
>>>>>>      have minimum length.
>>>>>>
>>>>>> I don't have hw with the old PWM block, therefore I couldn't test this
>>>>>> patch. With the not yet included extension for the new PWM block
>>>>>> (channel->clk coming directly from get_clk(external_clk)) I didn't
>>>>>> notice any problem. My system uses PWM for the CPU voltage regulator
>>>>>> and for the SDIO 32kHz clock.
>>>>>>
>>>>>> Note: The clock gate in the old PWM block is permanently disabled.
>>>>>> This seems to indicate that it's not used by the new PWM block.
>>>>>>
>>>>>> Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
>>>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>>>>> ---
>>>>>> Changes to RFT/RFC version:
>>>>>> - use parent_hws instead of parent_names for div/gate clock
>>>>>> - use devm_clk_hw_register where the struct clk * returned by
>>>>>>      devm_clk_register isn't needed
>>>>>>
>>>>>> v2:
>>>>>> - add patch 1
>>>>>> - add patch 3
>>>>>> - switch to using clk_parent_data in all relevant places
>>>>>> v3:
>>>>>> - add flag CLK_IGNORE_UNUSED
>>>>>> v4:
>>>>>> - remove variable tmp in meson_pwm_get_state
>>>>>> - don't use deprecated function devm_clk_register
>>>>>> ---
>>>>>>     drivers/pwm/pwm-meson.c | 142 +++++++++++++++++++++++-----------------
>>>>>>     1 file changed, 83 insertions(+), 59 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
>>>>>> index 40a8709ff..80ac71cbc 100644
>>>>>> --- a/drivers/pwm/pwm-meson.c
>>>>>> +++ b/drivers/pwm/pwm-meson.c
>>>>>> @@ -51,7 +51,7 @@
>>>>>>     #define REG_MISC_AB        0x8
>>>>>>     #define MISC_B_CLK_EN        23
>>>>>>     #define MISC_A_CLK_EN        15
>>>>>> -#define MISC_CLK_DIV_MASK    0x7f
>>>>>> +#define MISC_CLK_DIV_WIDTH    7
>>>>>>     #define MISC_B_CLK_DIV_SHIFT    16
>>>>>>     #define MISC_A_CLK_DIV_SHIFT    8
>>>>>>     #define MISC_B_CLK_SEL_SHIFT    6
>>>>>> @@ -87,12 +87,13 @@ static struct meson_pwm_channel_data {
>>>>>>     };
>>>>>>       struct meson_pwm_channel {
>>>>>> +    unsigned long rate;
>>>>>>         unsigned int hi;
>>>>>>         unsigned int lo;
>>>>>> -    u8 pre_div;
>>>>>>     -    struct clk *clk_parent;
>>>>>>         struct clk_mux mux;
>>>>>> +    struct clk_divider div;
>>>>>> +    struct clk_gate gate;
>>>>>>         struct clk *clk;
>>>>>>     };
>>>>>>     @@ -125,16 +126,6 @@ static int meson_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
>>>>>>         struct device *dev = chip->dev;
>>>>>>         int err;
>>>>>>     -    if (channel->clk_parent) {
>>>>>> -        err = clk_set_parent(channel->clk, channel->clk_parent);
>>>>>> -        if (err < 0) {
>>>>>> -            dev_err(dev, "failed to set parent %s for %s: %d\n",
>>>>>> -                __clk_get_name(channel->clk_parent),
>>>>>> -                __clk_get_name(channel->clk), err);
>>>>>> -            return err;
>>>>>> -        }
>>>>>> -    }
>>>>>> -
>>>>>>         err = clk_prepare_enable(channel->clk);
>>>>>>         if (err < 0) {
>>>>>>             dev_err(dev, "failed to enable clock %s: %d\n",
>>>>>> @@ -157,8 +148,9 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
>>>>>>                   const struct pwm_state *state)
>>>>>>     {
>>>>>>         struct meson_pwm_channel *channel = &meson->channels[pwm->hwpwm];
>>>>>> -    unsigned int duty, period, pre_div, cnt, duty_cnt;
>>>>>> +    unsigned int duty, period, cnt, duty_cnt;
>>>>>>         unsigned long fin_freq;
>>>>>> +    u64 freq;
>>>>>>           duty = state->duty_cycle;
>>>>>>         period = state->period;
>>>>>> @@ -166,7 +158,11 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
>>>>>>         if (state->polarity == PWM_POLARITY_INVERSED)
>>>>>>             duty = period - duty;
>>>>>>     -    fin_freq = clk_get_rate(channel->clk);
>>>>>> +    freq = div64_u64(NSEC_PER_SEC * (u64)0xffff, period);
>>>>>> +    if (freq > ULONG_MAX)
>>>>>> +        freq = ULONG_MAX;
>>>>>> +
>>>>>> +    fin_freq = clk_round_rate(channel->clk, freq);
>>>>>>         if (fin_freq == 0) {
>>>>>>             dev_err(meson->chip.dev, "invalid source clock frequency\n");
>>>>>>             return -EINVAL;
>>>>>> @@ -174,46 +170,35 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
>>>>>>           dev_dbg(meson->chip.dev, "fin_freq: %lu Hz\n", fin_freq);
>>>>>>     -    pre_div = div64_u64(fin_freq * (u64)period, NSEC_PER_SEC * 0xffffLL);
>>>>>> -    if (pre_div > MISC_CLK_DIV_MASK) {
>>>>>> -        dev_err(meson->chip.dev, "unable to get period pre_div\n");
>>>>>> -        return -EINVAL;
>>>>>> -    }
>>>>>> -
>>>>>> -    cnt = div64_u64(fin_freq * (u64)period, NSEC_PER_SEC * (pre_div + 1));
>>>>>> +    cnt = div64_u64(fin_freq * (u64)period, NSEC_PER_SEC);
>>>>>>         if (cnt > 0xffff) {
>>>>>>             dev_err(meson->chip.dev, "unable to get period cnt\n");
>>>>>>             return -EINVAL;
>>>>>>         }
>>>>>>     -    dev_dbg(meson->chip.dev, "period=%u pre_div=%u cnt=%u\n", period,
>>>>>> -        pre_div, cnt);
>>>>>> +    dev_dbg(meson->chip.dev, "period=%u cnt=%u\n", period, cnt);
>>>>>>           if (duty == period) {
>>>>>> -        channel->pre_div = pre_div;
>>>>>>             channel->hi = cnt;
>>>>>>             channel->lo = 0;
>>>>>>         } else if (duty == 0) {
>>>>>> -        channel->pre_div = pre_div;
>>>>>>             channel->hi = 0;
>>>>>>             channel->lo = cnt;
>>>>>>         } else {
>>>>>> -        /* Then check is we can have the duty with the same pre_div */
>>>>>> -        duty_cnt = div64_u64(fin_freq * (u64)duty,
>>>>>> -                     NSEC_PER_SEC * (pre_div + 1));
>>>>>> +        duty_cnt = div64_u64(fin_freq * (u64)duty, NSEC_PER_SEC);
>>>>>>             if (duty_cnt > 0xffff) {
>>>>>>                 dev_err(meson->chip.dev, "unable to get duty cycle\n");
>>>>>>                 return -EINVAL;
>>>>>>             }
>>>>>>     -        dev_dbg(meson->chip.dev, "duty=%u pre_div=%u duty_cnt=%u\n",
>>>>>> -            duty, pre_div, duty_cnt);
>>>>>> +        dev_dbg(meson->chip.dev, "duty=%u duty_cnt=%u\n", duty, duty_cnt);
>>>>>>     -        channel->pre_div = pre_div;
>>>>>>             channel->hi = duty_cnt;
>>>>>>             channel->lo = cnt - duty_cnt;
>>>>>>         }
>>>>>>     +    channel->rate = fin_freq;
>>>>>> +
>>>>>>         return 0;
>>>>>>     }
>>>>>>     @@ -223,16 +208,15 @@ static void meson_pwm_enable(struct meson_pwm *meson, struct pwm_device *pwm)
>>>>>>         struct meson_pwm_channel_data *channel_data;
>>>>>>         unsigned long flags;
>>>>>>         u32 value;
>>>>>> +    int err;
>>>>>>           channel_data = &meson_pwm_per_channel_data[pwm->hwpwm];
>>>>>>     -    spin_lock_irqsave(&meson->lock, flags);
>>>>>> +    err = clk_set_rate(channel->clk, channel->rate);
>>>>>> +    if (err)
>>>>>> +        dev_err(meson->chip.dev, "setting clock rate failed\n");
>>>>>>     -    value = readl(meson->base + REG_MISC_AB);
>>>>>> -    value &= ~(MISC_CLK_DIV_MASK << channel_data->clk_div_shift);
>>>>>> -    value |= channel->pre_div << channel_data->clk_div_shift;
>>>>>> -    value |= BIT(channel_data->clk_en_bit);
>>>>>> -    writel(value, meson->base + REG_MISC_AB);
>>>>>> +    spin_lock_irqsave(&meson->lock, flags);
>>>>>>           value = FIELD_PREP(PWM_HIGH_MASK, channel->hi) |
>>>>>>             FIELD_PREP(PWM_LOW_MASK, channel->lo);
>>>>>> @@ -271,16 +255,16 @@ static int meson_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>>>>>>                 /*
>>>>>>                  * This IP block revision doesn't have an "always high"
>>>>>>                  * setting which we can use for "inverted disabled".
>>>>>> -             * Instead we achieve this using the same settings
>>>>>> -             * that we use a pre_div of 0 (to get the shortest
>>>>>> -             * possible duration for one "count") and
>>>>>> +             * Instead we achieve this by setting an arbitrary,
>>>>>> +             * very high frequency, resulting in the shortest
>>>>>> +             * possible duration for one "count" and
>>>>>>                  * "period == duty_cycle". This results in a signal
>>>>>>                  * which is LOW for one "count", while being HIGH for
>>>>>>                  * the rest of the (so the signal is HIGH for slightly
>>>>>>                  * less than 100% of the period, but this is the best
>>>>>>                  * we can achieve).
>>>>>>                  */
>>>>>> -            channel->pre_div = 0;
>>>>>> +            channel->rate = 1000000000;
>>>>>>                 channel->hi = ~0;
>>>>>>                 channel->lo = 0;
>>>>>
>>>>> This looks like a really bad idea... please don't do that and instead introduce
>>>>> some pinctrl states where we set the PWM pin as GPIO mode high/low state like we
>>>>> did for SPI:
>>>>> https://lore.kernel.org/r/20221004-up-aml-fix-spi-v4-2-0342d8e10c49@baylibre.com
>>>>>
>>>>
>>>> There's no behavior change in this patch set. So my understanding is that you'd
>>>> like to change the current behavior independent of the CCF-related changes.
>>>
>>> There's a behavior change since you change the calculation with a radically different
>>> algorithm.
>>>
>> Setting an input clock rate of 1GHz will result in pre_div = 0 with (where available)
>> mux parent fdiv3 (850MHz). So it's the same duty cycle as before, just with a different
>> period. The applied logic is the same as before and as described in the comment
>> "get the shortest possible duration for one count"
> 
> This is a hack based on current clock values, either explicitly support a code path
> where pre_div = 0 or if you can't do that with CCF implement the pinctrl way to handle this,
> which is the cleanest.
> 
To make it explicit we could request ULONG_MAX as rate instead of 1GHz, this would imply
choosing mux parent with highest rate and pre_div = 0. Up to you whether this would be
acceptable.
AFAICS pinctrl would need quite some DTS changes, and it's not my area of expertise.
So it would be open who can implement this.

> Neil
> 
>>
>>> Neil
>>>
>>>>
>>>> For the updated PWM block (at least for S905X3, not sure with which family Amlogic
>>>> extended the PWM block) we have an integrated option to achieve constant low/high
>>>> output. It's just not implemented yet, it's something I may do as next step.
>>>> The extended PWM block added new bits pwm_A/B_constant_en that prevent the default
>>>> increment of the hi/lo period. By supporting these bits we can achieve value 0
>>>> for hi/lo.
>>>> IMO that's easier than adding pinctrl handling. The remaining question would be
>>>> whether it's worth it to add pinctrl handling just for the legacy version of the
>>>> PWM block.
>>>>
>>>
>>
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v4 2/2] arm64: dts: meson-gxl: add support for Xiaomi Mi box 3
From: Krzysztof Kozlowski @ 2023-04-19 19:58 UTC (permalink / raw)
  To: Karl Chan, linux-amlogic
  Cc: robh+dt, krzysztof.kozlowski+dt, neil.armstrong, khilman, jbrunet,
	martin.blumenstingl, devicetree, linux-arm-kernel, linux-kernel,
	Karl Chan
In-Reply-To: <20230418145515.19547-3-exkcmailist@inbox.lv>

On 18/04/2023 16:55, Karl Chan wrote:
> From: "Karl Chan"  <exkcmailist@inbox.lv>
> 
> The Xiaomi Mi box 3 is a TV box based on the Amlogic S905X chipset.
> There are two variants:
> - 2 GiB/8GIB
> - 1 GiB/4GIB
> 
> Both variants come with:
> - 802.11a/b/g/n/ac wifi (BCM4345)
> - HDMI , AV (CVBS) and S/PDIF optical output
> - 1x USB (utilizing both USB ports provided by the SoC)
> 
> Signed-off-by: Karl Chan <exxxxkc@getgoogleoff.me>

Still broken chain.

Also, drop stray blank lines from end of files.

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v5 06/11] dt-bindings: PCI: Update the RK3399 example to a valid one
From: Krzysztof Kozlowski @ 2023-04-19 20:01 UTC (permalink / raw)
  To: Rick Wertenbroek, alberto.dassatti
  Cc: xxm, dlemoal, Shawn Lin, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
	Krzysztof Kozlowski, Heiko Stuebner, Caleb Connolly,
	Corentin Labbe, Brian Norris, Johan Jonker, Judy Hsiao,
	Sascha Hauer, Hugh Cole-Baker, Arnaud Ferraris, linux-pci,
	linux-rockchip, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <20230418074700.1083505-7-rick.wertenbroek@gmail.com>

On 18/04/2023 09:46, Rick Wertenbroek wrote:
> Update the example in the documentation to a valid example.
> Address for mem-base was invalid, it pointed to address
> 0x8000'0000 which is the upper region of the DDR which
> is not necessarily populated depending on the board.
> This address should point to the base of the memory
> window region of the controller which is 0xfa00'0000.
> Add missing pinctrl.
> 
> Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
> ---
>  .../devicetree/bindings/pci/rockchip,rk3399-pcie-ep.yaml      | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie-ep.yaml b/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie-ep.yaml
> index 88386a6d7011..6b62f6f58efe 100644
> --- a/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie-ep.yaml
> +++ b/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie-ep.yaml
> @@ -47,7 +47,7 @@ examples:
>  
>          pcie-ep@f8000000 {
>              compatible = "rockchip,rk3399-pcie-ep";
> -            reg = <0x0 0xfd000000 0x0 0x1000000>, <0x0 0x80000000 0x0 0x20000>;
> +            reg = <0x0 0xfd000000 0x0 0x1000000>, <0x0 0xfa000000 0x0 0x2000000>;
>              reg-names = "apb-base", "mem-base";
>              clocks = <&cru ACLK_PCIE>, <&cru ACLK_PERF_PCIE>,
>                <&cru PCLK_PCIE>, <&cru SCLK_PCIE_PM>;
> @@ -63,6 +63,8 @@ examples:
>              phys = <&pcie_phy 0>, <&pcie_phy 1>, <&pcie_phy 2>, <&pcie_phy 3>;
>              phy-names = "pcie-phy-0", "pcie-phy-1", "pcie-phy-2", "pcie-phy-3";
>              rockchip,max-outbound-regions = <16>;
> +            pinctrl-names = "default";
> +            pinctrl-0 = <&pcie_clkreqnb_cpm>;

This is just example of the binding, you do not need to fill all
unrelated (generic) properties like pinctrl.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Re: [PATCH v2 03/12] ARM: exynos: Re-introduce Exynos4212 support
From: Henrik Grimler @ 2023-04-19 20:24 UTC (permalink / raw)
  To: Artur Weber
  Cc: Krzysztof Kozlowski, Alim Akhtar, Rob Herring, Sylwester Nawrocki,
	Tomasz Figa, Chanwoo Choi, Michael Turquette, Stephen Boyd,
	Arnd Bergmann, Olof Johansson, soc, Russell King, Daniel Lezcano,
	Kukjin Kim, Mauro Carvalho Chehab, Vinod Koul,
	Kishon Vijay Abraham I, linux-arm-kernel, linux-samsung-soc,
	devicetree, linux-kernel, linux-clk, linux-pm, linux-media,
	linux-phy, ~postmarketos/upstreaming
In-Reply-To: <20230416133422.1949-4-aweber.kernel@gmail.com>

Hi Artur,

On Sun, Apr 16, 2023 at 03:34:13PM +0200, Artur Weber wrote:
> The platform was originally dropped in commit bca9085e0ae9 ("ARM:
> dts: exynos: remove Exynos4212 support (dead code)"), as there were
> no boards using it.
> 
> We will be adding a device that uses it, so add it back.
> 
> This effectively reverts commit 9e43eca3c874 ("ARM: EXYNOS: Remove
> Exynos4212 related dead code").
> 
> Signed-off-by: Artur Weber <aweber.kernel@gmail.com>
> ---
>  arch/arm/mach-exynos/Kconfig    | 5 +++++
>  arch/arm/mach-exynos/common.h   | 8 ++++++++
>  arch/arm/mach-exynos/exynos.c   | 2 ++
>  arch/arm/mach-exynos/firmware.c | 8 +++++++-
>  arch/arm/mach-exynos/pm.c       | 2 +-
>  arch/arm/mach-exynos/suspend.c  | 4 ++++
>  6 files changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
> index 4d3b40e4049a..b3d5df5225fe 100644
> --- a/arch/arm/mach-exynos/Kconfig
> +++ b/arch/arm/mach-exynos/Kconfig
> @@ -78,6 +78,11 @@ config CPU_EXYNOS4210
>  	default y
>  	depends on ARCH_EXYNOS4
>  
> +config SOC_EXYNOS4212
> +	bool "Samsung Exynos4212"
> +	default y
> +	depends on ARCH_EXYNOS4
> +
>  config SOC_EXYNOS4412
>  	bool "Samsung Exynos4412"
>  	default y
> diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
> index 29eb075b24a4..c9e85d33c309 100644
> --- a/arch/arm/mach-exynos/common.h
> +++ b/arch/arm/mach-exynos/common.h
> @@ -15,6 +15,7 @@
>  #define EXYNOS3_SOC_MASK	0xFFFFF000
>  
>  #define EXYNOS4210_CPU_ID	0x43210000
> +#define EXYNOS4212_CPU_ID	0x43220000
>  #define EXYNOS4412_CPU_ID	0xE4412200
>  #define EXYNOS4_CPU_MASK	0xFFFE0000
>  
> @@ -34,6 +35,7 @@ static inline int is_samsung_##name(void)	\
>  
>  IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
>  IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
> +IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
>  IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
>  IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
>  IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK)
> @@ -52,6 +54,12 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
>  # define soc_is_exynos4210()	0
>  #endif
>  
> +#if defined(CONFIG_SOC_EXYNOS4212)
> +# define soc_is_exynos4212()	is_samsung_exynos4212()
> +#else
> +# define soc_is_exynos4212()	0
> +#endif
> +
>  #if defined(CONFIG_SOC_EXYNOS4412)
>  # define soc_is_exynos4412()	is_samsung_exynos4412()
>  #else
> diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
> index 51a247ca4da8..5671621f1661 100644
> --- a/arch/arm/mach-exynos/exynos.c
> +++ b/arch/arm/mach-exynos/exynos.c
> @@ -178,6 +178,7 @@ static void __init exynos_dt_machine_init(void)
>  		exynos_cpuidle.dev.platform_data = &cpuidle_coupled_exynos_data;
>  #endif
>  	if (of_machine_is_compatible("samsung,exynos4210") ||
> +	    of_machine_is_compatible("samsung,exynos4212") ||
>  	    (of_machine_is_compatible("samsung,exynos4412") &&
>  	     (of_machine_is_compatible("samsung,trats2") ||
>  		  of_machine_is_compatible("samsung,midas") ||
> @@ -192,6 +193,7 @@ static char const *const exynos_dt_compat[] __initconst = {
>  	"samsung,exynos3250",
>  	"samsung,exynos4",
>  	"samsung,exynos4210",
> +	"samsung,exynos4212",
>  	"samsung,exynos4412",
>  	"samsung,exynos5",
>  	"samsung,exynos5250",
> diff --git a/arch/arm/mach-exynos/firmware.c b/arch/arm/mach-exynos/firmware.c
> index 2da5b60b59e2..110c8064ee64 100644
> --- a/arch/arm/mach-exynos/firmware.c
> +++ b/arch/arm/mach-exynos/firmware.c
> @@ -63,12 +63,18 @@ static int exynos_cpu_boot(int cpu)
>  	 *
>  	 * On Exynos5 devices the call is ignored by trustzone firmware.
>  	 */
> -	if (!soc_is_exynos4210() && !soc_is_exynos4412())
> +	if (!soc_is_exynos4210() && !soc_is_exynos4412() &&
> +	    !soc_is_exynos4212())

Seems more logical to have 4212 before 4412 here.

>  		return 0;
>  
>  	/*
>  	 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
> +	 * But, Exynos4212 has only one secondary CPU so second parameter
> +	 * isn't used for informing secure firmware about CPU id.
>  	 */
> +	if (soc_is_exynos4212())
> +		cpu = 0;

Is it necessary to set cpu = 0?  Are there any obvious issues without
it (like second cpu not being brought up)?  It seems vendor kernel
does this for both exynos4210 and exynos4212 [1], but mainline has not
done this for exynos4210 and there has been no reported issues on for
that platform as far as I know.

The assembly that handles SMC_CMD_CPU1BOOT in sboot.bin from firmware
version T310XXSBQB2 is identical to what is found in sboot.bin from
exynos4412-galaxy-s3, and it uses the cpu arg in both cases, so seems
likely that we need this and I am mostly asking out of curiosity.

[1] https://github.com/krzk/linux-vendor-backup/blob/mokee/android-3.4-samsung-galaxy-tab-s-10.5-sm-t805-exynos5420/arch/arm/mach-exynos/platsmp.c#L225-L229

Best regards,
Henrik Grimler

>  	exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
>  	return 0;
>  }
> diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
> index 30f4e55bf39e..9b6db04e4e34 100644
> --- a/arch/arm/mach-exynos/pm.c
> +++ b/arch/arm/mach-exynos/pm.c
> @@ -161,7 +161,7 @@ void exynos_enter_aftr(void)
>  
>  	exynos_pm_central_suspend();
>  
> -	if (soc_is_exynos4412()) {
> +	if (soc_is_exynos4412() || soc_is_exynos4212()) {
>  		/* Setting SEQ_OPTION register */
>  		pmu_raw_writel(S5P_USE_STANDBY_WFI0 | S5P_USE_STANDBY_WFE0,
>  			       S5P_CENTRAL_SEQ_OPTION);
> diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c
> index 3bf14ca78b62..df1e10033f90 100644
> --- a/arch/arm/mach-exynos/suspend.c
> +++ b/arch/arm/mach-exynos/suspend.c
> @@ -231,6 +231,7 @@ static int __init exynos_pmu_irq_init(struct device_node *node,
>  
>  EXYNOS_PMU_IRQ(exynos3250_pmu_irq, "samsung,exynos3250-pmu");
>  EXYNOS_PMU_IRQ(exynos4210_pmu_irq, "samsung,exynos4210-pmu");
> +EXYNOS_PMU_IRQ(exynos4212_pmu_irq, "samsung,exynos4212-pmu");
>  EXYNOS_PMU_IRQ(exynos4412_pmu_irq, "samsung,exynos4412-pmu");
>  EXYNOS_PMU_IRQ(exynos5250_pmu_irq, "samsung,exynos5250-pmu");
>  EXYNOS_PMU_IRQ(exynos5420_pmu_irq, "samsung,exynos5420-pmu");
> @@ -640,6 +641,9 @@ static const struct of_device_id exynos_pmu_of_device_ids[] __initconst = {
>  	}, {
>  		.compatible = "samsung,exynos4210-pmu",
>  		.data = &exynos4_pm_data,
> +	}, {
> +		.compatible = "samsung,exynos4212-pmu",
> +		.data = &exynos4_pm_data,
>  	}, {
>  		.compatible = "samsung,exynos4412-pmu",
>  		.data = &exynos4_pm_data,
> -- 
> 2.40.0
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox