Re: [PATCH] of: address: Unify resource bounds overflow checking

2024-09-13 Thread Rob Herring
On Fri, Sep 13, 2024 at 8:15 AM Michael Ellerman  wrote:
>
> Thomas Weißschuh  writes:
> > The members "start" and "end" of struct resource are of type
> > "resource_size_t" which can be 32bit wide.
> > Values read from OF however are always 64bit wide.
> >
> > Refactor the diff overflow checks into a helper function.
> > Also extend the checks to validate each calculation step.
> >
> > Signed-off-by: Thomas Weißschuh 
> > ---
> >  drivers/of/address.c | 45 ++---
> >  1 file changed, 26 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/of/address.c b/drivers/of/address.c
> > index 7e59283a4472..df854bb427ce 100644
> > --- a/drivers/of/address.c
> > +++ b/drivers/of/address.c
> > @@ -198,6 +198,25 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 
> > *range, int na, int ns,
> >
> >  #endif /* CONFIG_PCI */
> >
> > +static int __of_address_resource_bounds(struct resource *r, u64 start, u64 
> > size)
> > +{
> > + u64 end = start;
> > +
> > + if (overflows_type(start, r->start))
> > + return -EOVERFLOW;
> > + if (size == 0)
> > + return -EOVERFLOW;
> > + if (check_add_overflow(end, size - 1, &end))
> > + return -EOVERFLOW;
> > + if (overflows_type(end, r->end))
> > + return -EOVERFLOW;
>
> This breaks PCI on powerpc qemu. Part of the PCI probe reads a resource
> that's zero sized, which used to succeed but now fails due to the size
> check above.
>
> The diff below fixes it for me.

I fixed it up with your change.


> It leaves r.end == r.start, which is fine in my case, because the code
> only uses r.start.
>
> And it seems more sane than the old code which would return
> end = start - 1, for zero sized resources.
>
> cheers
>
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index df854bb427ce..a001e789a6c4 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -204,9 +204,7 @@ static int __of_address_resource_bounds(struct resource 
> *r, u64 start, u64 size)
>
> if (overflows_type(start, r->start))
> return -EOVERFLOW;
> -   if (size == 0)
> -   return -EOVERFLOW;
> -   if (check_add_overflow(end, size - 1, &end))
> +   if (size > 0 && check_add_overflow(end, size - 1, &end))
> return -EOVERFLOW;
> if (overflows_type(end, r->end))
> return -EOVERFLOW;
>



Re: [Patch v5 02/12] dt-bindings: dma: Add lpc32xx DMA mux binding

2024-09-10 Thread Rob Herring (Arm)
On Thu, 27 Jun 2024 17:00:20 +0200, Piotr Wojtaszczyk wrote:
> LPC32XX SoCs use pl080 dma controller which have few request signals
> multiplexed between peripherals. This binding describes how devices can
> use the multiplexed request signals.
> 
> Signed-off-by: Piotr Wojtaszczyk 
> ---
> Changes for v5:
> - Corrected property order
> - Added maxItems to properties
> - Fixed example
> - Removed "N:: from the MAINTAINERS entry
> - Added Piotr Wojtaszczyk  to LPC32XX 
> maintainers
> 
> Changes for v4:
> - This patch is new in v4
> 
>  .../bindings/dma/nxp,lpc3220-dmamux.yaml  | 49 +++
>  MAINTAINERS   |  9 
>  2 files changed, 58 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/dma/nxp,lpc3220-dmamux.yaml
> 

Applied, thanks!



Re: [PATCH 1/1] dt-bindings: soc: fsl: cpm_qe: convert network.txt to yaml

2024-08-15 Thread Rob Herring (Arm)


On Mon, 12 Aug 2024 12:50:35 -0400, Frank Li wrote:
> Convert binding doc newwork.txt to yaml format.
> 
> HDLC part:
> - Convert to "fsl,ucc-hdlc.yaml".
> - Add missed reg and interrupt property.
> - Update example to pass build.
> 
> ethernet part:
> - Convert to net/fsl,cpm-enet.yaml
> - Add 0x in example, which should be hex value
> - Add ref to ethernet-controller.yaml
> 
> mdio part:
> - Convert to net/fsl,cpm-mdio.yaml
> - Add 0x in example, which should be hex value
> - Add ref to mdio.yaml
> 
> Signed-off-by: Frank Li 
> ---
> This one is quite old. The detail informaiton is limited.
> ---
>  .../devicetree/bindings/net/fsl,cpm-enet.yaml |  59 
>  .../devicetree/bindings/net/fsl,cpm-mdio.yaml |  55 +++
>  .../bindings/soc/fsl/cpm_qe/fsl,ucc-hdlc.yaml | 140 ++
>  .../bindings/soc/fsl/cpm_qe/network.txt   | 130 
>  4 files changed, 254 insertions(+), 130 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/fsl,cpm-enet.yaml
>  create mode 100644 Documentation/devicetree/bindings/net/fsl,cpm-mdio.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,ucc-hdlc.yaml
>  delete mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/network.txt
> 

Applied, thanks!




Re: [PATCH v2 23/36] dt-bindings: soc: fsl: cpm_qe: Add QUICC Engine (QE) QMC controller

2024-08-13 Thread Rob Herring
On Thu, Aug 08, 2024 at 09:11:16AM +0200, Herve Codina wrote:
> Add support for the QMC (QUICC Multichannel Controller) available in
> some PowerQUICC SoC that uses a QUICC Engine (QE) block such as MPC8321.
> 
> This QE QMC is similar to the CPM QMC except that it uses UCCs (Unified
> Communication Controllers) instead of SCCs (Serial Communication
> Controllers). Also, compared against the CPM QMC, this QE QMC does not
> use a fixed area for the UCC/SCC parameters area but it uses a dynamic
> area allocated and provided to the hardware at runtime.
> Last point, the QE QMC can use a firmware to have the QMC working in
> 'soft-qmc' mode.
> 
> Signed-off-by: Herve Codina 
> ---
>  .../soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml| 197 ++
>  1 file changed, 197 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> new file mode 100644
> index ..71ae64cb8a4f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> @@ -0,0 +1,197 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PowerQUICC QE QUICC Multichannel Controller (QMC)
> +
> +maintainers:
> +  - Herve Codina 
> +
> +description:
> +  The QMC (QUICC Multichannel Controller) emulates up to 64 channels within 
> one
> +  serial controller using the same TDM physical interface routed from TSA.
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +  - fsl,mpc8321-ucc-qmc
> +  - const: fsl,qe-ucc-qmc
> +
> +  reg:
> +items:
> +  - description: UCC (Unified communication controller) register base
> +  - description: Dual port ram base
> +
> +  reg-names:
> +items:
> +  - const: ucc_regs

_regs is redundant.

> +  - const: dpram
> +
> +  interrupts:
> +maxItems: 1
> +description: UCC interrupt line in the QE interrupt controller
> +
> +  fsl,tsa-serial:
> +$ref: /schemas/types.yaml#/definitions/phandle-array
> +items:
> +  - items:
> +  - description: phandle to TSA node
> +  - enum: [1, 2, 3, 4, 5]
> +description: |
> +  TSA serial interface (dt-bindings/soc/qe-fsl,tsa.h defines 
> these
> +  values)
> +   - 1: UCC1
> +   - 2: UCC2
> +   - 3: UCC3
> +   - 4: UCC4
> +   - 5: UCC5
> +description:
> +  Should be a phandle/number pair. The phandle to TSA node and the TSA
> +  serial interface to use.
> +
> +  fsl,soft-qmc:
> +$ref: /schemas/types.yaml#/definitions/string
> +description:
> +  Soft QMC firmware name to load. If this property is omitted, no 
> firmware
> +  are used.

"firmware-name" doesn't work here?

> +
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +patternProperties:
> +  '^channel@([0-9]|[1-5][0-9]|6[0-3])$':

Unit-addresses are typically hex.

> +description:
> +  A channel managed by this controller
> +type: object
> +additionalProperties: false
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +  - fsl,mpc8321-ucc-qmc-hdlc
> +  - const: fsl,qe-ucc-qmc-hdlc
> +  - const: fsl,qmc-hdlc
> +
> +  reg:
> +minimum: 0
> +maximum: 63
> +description:
> +  The channel number
> +
> +  fsl,operational-mode:
> +$ref: /schemas/types.yaml#/definitions/string
> +enum: [transparent, hdlc]
> +default: transparent
> +description: |
> +  The channel operational mode
> +- hdlc: The channel handles HDLC frames
> +- transparent: The channel handles raw data without any 
> processing
> +
> +  fsl,reverse-data:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  The bit order as seen on the channels is reversed,
> +  transmitting/receiving the MSB of each octet first.
> +  This flag is used only in 'transparent' mode.
> +
> +  fsl,tx-ts-mask:
> +$ref: /schemas/types.yaml#/definitions/uint64
> +description:
> +  Channel assigned Tx time-slots within the Tx time-slots routed by 
> the
> +  TSA to this cell.
> +
> +  fsl,rx-ts-mask:
> +$ref: /schemas/types.yaml#/definitions/uint64
> +description:
> +  Channel assigned Rx time-slots within the Rx time-slots routed by 
> the
> +  TSA to this cell.
> +
> +  fsl,framer:
> +$ref: /schemas/types.yaml#/definitions/phandle
> +description:
> +  phandle to the framer node. The framer is in c

Re: [PATCH v2 07/36] dt-bindings: soc: fsl: cpm_qe: Add QUICC Engine (QE) TSA controller

2024-08-13 Thread Rob Herring (Arm)


On Thu, 08 Aug 2024 09:11:00 +0200, Herve Codina wrote:
> Add support for the time slot assigner (TSA) available in some
> PowerQUICC SoC that uses a QUICC Engine (QE) block such as MPC8321.
> 
> This QE TSA is similar to the CPM TSA except that it uses UCCs (Unified
> Communication Controllers) instead of SCCs (Serial Communication
> Controllers). Also, compared against the CPM TSA, this QE TSA can handle
> up to 4 TDMs instead of 2 and allows to configure the logic level of
> sync signals.
> 
> Signed-off-by: Herve Codina 
> ---
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml   | 210 ++
>  include/dt-bindings/soc/qe-fsl,tsa.h  |  13 ++
>  2 files changed, 223 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml
>  create mode 100644 include/dt-bindings/soc/qe-fsl,tsa.h
> 

Reviewed-by: Rob Herring (Arm) 




Re: [PATCH v3] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-08-13 Thread Rob Herring (Arm)


On Sat, 03 Aug 2024 00:03:25 +0530, Amit Machhiwal wrote:
> With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> of a PCI device attached to a PCI-bridge causes following kernel Oops on
> a pseries KVM guest:
> 
>  RTAS: event: 2, Type: Hotplug Event (229), Severity: 1
>  Kernel attempted to read user page (10ec0048) - exploit attempt? (uid: 0)
>  BUG: Unable to handle kernel data access on read at 0x10ec0048
>  Faulting instruction address: 0xc12d8728
>  Oops: Kernel access of bad area, sig: 11 [#1]
>  LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> 
>  NIP [c12d8728] __of_changeset_entry_invert+0x10/0x1ac
>  LR [c12da7f0] __of_changeset_revert_entries+0x98/0x180
>  Call Trace:
>  [cbcc3970] [c12daa60] of_changeset_revert+0x58/0xd8
>  [cbcc39c0] [c0d0ed78] of_pci_remove_node+0x74/0xb0
>  [cbcc39f0] [c0cdcfe0] pci_stop_bus_device+0xf4/0x138
>  [cbcc3a30] [c0cdd140] 
> pci_stop_and_remove_bus_device_locked+0x34/0x64
>  [cbcc3a60] [c0cf3780] remove_store+0xf0/0x108
>  [cbcc3ab0] [c0e89e04] dev_attr_store+0x34/0x78
>  [cbcc3ad0] [c07f8dd4] sysfs_kf_write+0x70/0xa4
>  [cbcc3af0] [c07f7248] kernfs_fop_write_iter+0x1d0/0x2e0
>  [cbcc3b40] [c06c9b08] vfs_write+0x27c/0x558
>  [cbcc3bf0] [c06ca168] ksys_write+0x90/0x170
>  [cbcc3c40] [c0033248] system_call_exception+0xf8/0x290
>  [cbcc3e50] [c000d05c] system_call_vectored_common+0x15c/0x2ec
> 
> 
> A git bisect pointed this regression to be introduced via [1] that added
> a mechanism to create device tree nodes for parent PCI bridges when a
> PCI device is hot-plugged.
> 
> The Oops is caused when `pci_stop_dev()` tries to remove a non-existing
> device-tree node associated with the pci_dev that was earlier
> hot-plugged and was attached under a pci-bridge. The PCI dev header
> `dev->hdr_type` being 0, results a conditional check done with
> `pci_is_bridge()` into false. Consequently, a call to
> `of_pci_make_dev_node()` to create a device node is never made. When at
> a later point in time, in the device node removal path, a memcpy is
> attempted in `__of_changeset_entry_invert()`; since the device node was
> never created, results in an Oops due to kernel read access to a bad
> address.
> 
> To fix this issue, the patch introduces a new flag OF_CREATE_WITH_CSET
> to keep track of device nodes created via `of_pci_make_dev_node()` and
> later attempt to destroy only such device nodes which have this flag
> set.
> 
> [1] commit 407d1a51921e ("PCI: Create device tree node for bridge")
> 
> Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> Reported-by: Kowshik Jois B S 
> Signed-off-by: Lizhi Hou 
> Signed-off-by: Amit Machhiwal 
> ---
> Changes since v2:
> * Drop v2 changes and introduce a different approach from Lizhi discussed
>   over the v2 of this patch
> * V2: 
> https://lore.kernel.org/all/20240715080726.2496198-1-amach...@linux.ibm.com/
> Changes since v1:
> * Included Lizhi's suggested changes on V1
> * Fixed below two warnings from Lizhi's changes and rearranged the cleanup
>   part a bit in `of_pci_make_dev_node`
>   drivers/pci/of.c:611:6: warning: no previous prototype for 
> ‘of_pci_free_node’ [-Wmissing-prototypes]
> 611 | void of_pci_free_node(struct device_node *np)
> |  ^~~~
>   drivers/pci/of.c: In function ‘of_pci_make_dev_node’:
>   drivers/pci/of.c:696:1: warning: label ‘out_destroy_cset’ defined but 
> not used [-Wunused-label]
> 696 | out_destroy_cset:
>     | ^~~~
> * V1: 
> https://lore.kernel.org/all/20240703141634.2974589-1-amach...@linux.ibm.com/
> 
>  drivers/pci/of.c   | 3 ++-
>  include/linux/of.h | 1 +
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring (Arm) 




Re: [PATCH v3] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-08-13 Thread Rob Herring
On Tue, Aug 06, 2024 at 03:00:59PM -0500, Bjorn Helgaas wrote:
> On Sat, Aug 03, 2024 at 12:03:25AM +0530, Amit Machhiwal wrote:
> > With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> > of a PCI device attached to a PCI-bridge causes following kernel Oops on
> > a pseries KVM guest:
> 
> What is unique about pseries here?  There's nothing specific to
> pseries in the patch, so I would expect this to be a generic problem
> on any arch.

Only pseries does PCI hotplug with DT I think. It would happen if 
another system did though, but I think documenting the exact system is 
good. No reason we can't do both though.

Rob



Re: [PATCH] dt-bindings: fsl: fsl,rcpm: fix unevaluated fsl,rcpm-wakeup property

2024-08-12 Thread Rob Herring (Arm)


On Sun, 11 Aug 2024 17:35:07 +0200, Krzysztof Kozlowski wrote:
> Drop the RCPM consumer example from the binding (LPUART device node),
> because:
> 1. Using phandles is typical syntax, thus explaining it is not needed in
>the provider binding,
> 2. It has 'fsl,rcpm-wakeup' property which is not allowed by LPUART
>binding so it causes dt_binding_check warning:
> 
>fsl,rcpm.example.dtb: serial@295: Unevaluated properties are not 
> allowed ('fsl,rcpm-wakeup' was unexpected)
>  from schema $id: http://devicetree.org/schemas/serial/fsl-lpuart.yaml#
> 
> Alternatively, this property could be added to LPUART binding
> (fsl-lpuart.yaml), but it looks like none of in-tree DTS use it.
> 
> Fixes: ad21e3840a88 ("dt-bindings: soc: fsl: Convert rcpm to yaml format")
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../devicetree/bindings/soc/fsl/fsl,rcpm.yaml | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 

Applied, thanks!




Re: [PATCH v2 1/1] dt-bindings: soc: fsl: add missed compatible string fsl,ls*-isc

2024-08-06 Thread Rob Herring (Arm)


On Tue, 06 Aug 2024 12:21:21 -0400, Frank Li wrote:
> Add compatible string, fsl,ls1088a-isc, fsl,ls2080a-isc, fsl,lx2160a-isc.
> Fix the below warning:
> arch/arm64/boot/dts/freescale/fsl-ls2080a-qds.dtb: /soc/syscon@1f7: 
> failed to match any schema with compatible: ['fsl,ls2080a-isc', 'syscon']
> 
> Signed-off-by: Frank Li 
> ---
> Change from v1 to v2
> - fixed typo lx2046a with lx2160a
> ---
>  .../devicetree/bindings/soc/fsl/fsl,layerscape-scfg.yaml   | 3 +++
>  1 file changed, 3 insertions(+)
> 

Applied, thanks!



Re: [PATCH v4 1/1] dt-bindings: soc: fsl: Convert rcpm to yaml format

2024-08-06 Thread Rob Herring (Arm)


On Fri, 02 Aug 2024 11:22:19 -0400, Frank Li wrote:
> Convert dt-binding rcpm from txt to yaml format.
> Add fsl,ls1028a-rcpm compatible string.
> 
> Additional changes:
> - Add missed compatible string fsl,-rcpm.
> - Remove map fsl,-rcpm to fsl,qoriq-rcpm-.
> 
> Signed-off-by: Frank Li 
> ---
> Change from v3 to v4
> - Add missed fsl,ls1088a-rcpm, fsl,ls208xa-rcpm, fsl,lx2160a-rcpm
> 
> Chagne from v2 to v3
> - fallback use const
> - order as fallback compatible string
> - remove minItems for compatible string
> - Fix typo 1045a
> 
> Change from v1 to v2
> - add missed compatible string
> - Remove compatible string map table
> - use oneof Item to align compatible string map table
> ---
>  .../bindings/rtc/fsl,ls-ftm-alarm.yaml|  2 +-
>  .../devicetree/bindings/soc/fsl/fsl,rcpm.yaml | 96 +++
>  .../devicetree/bindings/soc/fsl/rcpm.txt  | 69 -
>  3 files changed, 97 insertions(+), 70 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> 

Applied, thanks!



Re: [PATCH] powerpc: dtc: update P2020RDB dts

2024-08-01 Thread Rob Herring
On Wed, Jul 31, 2024 at 11:14 PM Pawel Dembicki  wrote:
>

On the subject, every patch is an 'update'. Please make it more
specific. If you have a hard time coming up with something specific,
that's a sign your patch is making too many separate changes.

> P2020RDB contains multiple peripherals, which isn't added to
> devicetree:
>   - Switch: Microchip VSC7385
>   - PMIC: Renesas ZL2006
>   - Temperature sensor: Analog Devices ADT7461
>   - Two eeproms: 24C256 and 24C01
>   - GPIO expander: NXP PCA9557
>   - reset gpios of Ethernet PHYs
>
> This commit adds it.
>
> Some refreshments was done:
>   - fixed link in ethernet-node
>   - platform drivers nodes names
>   - added 'gpio0' label in pq3-gpio-0.dtsi
>
> Signed-off-by: Pawel Dembicki 
> ---
>  arch/powerpc/boot/dts/fsl/p2020rdb.dts| 85 +--
>  arch/powerpc/boot/dts/fsl/pq3-gpio-0.dtsi |  2 +-
>  2 files changed, 81 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/fsl/p2020rdb.dts 
> b/arch/powerpc/boot/dts/fsl/p2020rdb.dts
> index 3acd3890b397..d563d37b91f1 100644
> --- a/arch/powerpc/boot/dts/fsl/p2020rdb.dts
> +++ b/arch/powerpc/boot/dts/fsl/p2020rdb.dts
> @@ -6,6 +6,7 @@
>   */
>
>  /include/ "p2020si-pre.dtsi"
> +#include 
>
>  / {
> model = "fsl,P2020RDB";
> @@ -33,7 +34,7 @@ lbc: localbus@ffe05000 {
>   0x1 0x0 0x0 0xffa0 0x0004
>   0x2 0x0 0x0 0xffb0 0x0002>;
>
> -   nor@0,0 {
> +   nor@0 {

Make these clean-ups a separate patch.

> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "cfi-flash";
> @@ -79,7 +80,7 @@ partition@f0 {
> };
> };
>
> -   nand@1,0 {
> +   nand@1 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "fsl,p2020-fcm-nand",
> @@ -128,11 +129,49 @@ partition@110 {
> };
> };
>
> -   L2switch@2,0 {
> +   ethernet-switch@2 {
> #address-cells = <1>;
> #size-cells = <1>;
> -   compatible = "vitesse-7385";
> +   compatible = "vitesse,vsc7385";

There are 7 occurrences of this. Please fix them all. (And again,
separate patch).

> reg = <0x2 0x0 0x2>;
> +   reset-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
> +
> +   ports {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   port@1 {
> +   reg = <1>;
> +   label = "lan1";
> +   };
> +   port@2 {
> +   reg = <2>;
> +   label = "lan2";
> +   };
> +   port@3 {
> +   reg = <3>;
> +   label = "lan3";
> +   };
> +   port@4 {
> +   reg = <4>;
> +   label = "lan4";
> +   };
> +   vsc: port@6 {
> +   reg = <6>;
> +   label = "cpu";
> +   ethernet = <&enet0>;
> +   phy-mode = "rgmii";
> +   rx-internal-delay-ps = <1400>;
> +   tx-internal-delay-ps = <2000>;
> +
> +   fixed-link {
> +   speed = <1000>;
> +   full-duplex;
> +   pause;
> +   };
> +   };
> +   };
> +
> };
>
> };
> @@ -141,12 +180,39 @@ soc: soc@ffe0 {
> ranges = <0x0 0x0 0xffe0 0x10>;
>
> i2c@3000 {
> +   temperature-sensor@4c {
> +   compatible = "adi,adt7461";
> +   reg = <0x4c>;
> +   };
> +
> +   eeprom@50 {
> +   compatible = "atmel,24c256";
> +   reg = <0x50>;
> +   };
> +
> rtc@68 {
> compatible = "dallas,ds1339";
> reg = <0x68>;
>

Re: [PATCH] powerpc: dtc: update P2020RDB dts

2024-08-01 Thread Rob Herring (Arm)


On Thu, 01 Aug 2024 07:14:01 +0200, Pawel Dembicki wrote:
> P2020RDB contains multiple peripherals, which isn't added to
> devicetree:
>   - Switch: Microchip VSC7385
>   - PMIC: Renesas ZL2006
>   - Temperature sensor: Analog Devices ADT7461
>   - Two eeproms: 24C256 and 24C01
>   - GPIO expander: NXP PCA9557
>   - reset gpios of Ethernet PHYs
> 
> This commit adds it.
> 
> Some refreshments was done:
>   - fixed link in ethernet-node
>   - platform drivers nodes names
>   - added 'gpio0' label in pq3-gpio-0.dtsi
> 
> Signed-off-by: Pawel Dembicki 
> ---
>  arch/powerpc/boot/dts/fsl/p2020rdb.dts| 85 +--
>  arch/powerpc/boot/dts/fsl/pq3-gpio-0.dtsi |  2 +-
>  2 files changed, 81 insertions(+), 6 deletions(-)
> 


My bot found new DTB warnings on the .dts files added or changed in this
series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:

  pip3 install dtschema --upgrade


New warnings running 'make CHECK_DTBS=y fsl/p2020rdb.dtb' for 
20240801051402.584652-1-paweldembi...@gmail.com:

arch/powerpc/boot/dts/fsl/p2020rdb.dts:326.22-329.4: Warning (pci_bridge): 
/pcie@ffe08000: missing ranges for PCI bridge (or not a bridge)
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: nor@0: $nodename:0: 'nor@0' does not 
match '^(flash|.*sram|nand)(@.*)?$'
from schema $id: http://devicetree.org/schemas/mtd/mtd-physmap.yaml#
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: /localbus@ffe05000/nand@1: failed to 
match any schema with compatible: ['fsl,p2020-fcm-nand', 'fsl,elbc-fcm-nand']
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: /localbus@ffe05000/nand@1: failed to 
match any schema with compatible: ['fsl,p2020-fcm-nand', 'fsl,elbc-fcm-nand']
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: ethernet-switch@2: Unevaluated 
properties are not allowed ('#address-cells', '#size-cells' were unexpected)
from schema $id: 
http://devicetree.org/schemas/net/dsa/vitesse,vsc73xx.yaml#
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: /soc@ffe0/i2c@3100/pmic@11: failed 
to match any schema with compatible: ['zl2006']
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: gpio@18: 'gpio-controller' is a 
required property
from schema $id: http://devicetree.org/schemas/gpio/gpio-pca95xx.yaml#
arch/powerpc/boot/dts/fsl/p2020rdb.dtb: gpio@18: '#gpio-cells' is a required 
property
from schema $id: http://devicetree.org/schemas/gpio/gpio-pca95xx.yaml#







Re: [PATCH v2 1/1] dt-bindings: soc: fsl: Convert rcpm to yaml format

2024-07-31 Thread Rob Herring
On Wed, Jul 31, 2024 at 11:04:20AM -0400, Frank Li wrote:
> Convert dt-binding rcpm from txt to yaml format.
> Add fsl,ls1028a-rcpm compatible string.
> 
> Additional changes:
> - Add missed compatible string fsl,-rcpm.
> - Remove map fsl,-rcpm to fsl,qoriq-rcpm-.
> 
> Signed-off-by: Frank Li 
> ---
> Change from v1 to v2
> - add missed compatible string
> - Remove compatible string map table
> - use oneof Item to align compatible string map table
> - Fix typo 1045a
> ---
>  .../bindings/rtc/fsl,ls-ftm-alarm.yaml|   2 +-
>  .../devicetree/bindings/soc/fsl/fsl,rcpm.yaml | 101 ++
>  .../devicetree/bindings/soc/fsl/rcpm.txt  |  69 
>  3 files changed, 102 insertions(+), 70 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml 
> b/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> index 388102ae30cd8..3ec111f2fdc40 100644
> --- a/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> +++ b/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> @@ -42,7 +42,7 @@ properties:
>  minItems: 1
>  description:
>phandle to rcpm node, Please refer
> -  Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> +  Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
>  
>big-endian:
>  $ref: /schemas/types.yaml#/definitions/flag
> diff --git a/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
> new file mode 100644
> index 0..762316ef4d150
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
> @@ -0,0 +1,101 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/fsl,rcpm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Run Control and Power Management
> +
> +description:
> +  The RCPM performs all device-level tasks associated with device run control
> +  and power management.
> +
> +maintainers:
> +  - Frank Li 
> +
> +properties:
> +  compatible:
> +oneOf:
> +  - items:
> +  - enum:
> +  - fsl,ls1012a-rcpm
> +  - fsl,ls1021a-rcpm
> +  - fsl,ls1028a-rcpm
> +  - fsl,ls1043a-rcpm
> +  - fsl,ls1045a-rcpm
> +  - enum:

"const" for the fallbacks.

> +  - fsl,qoriq-rcpm-2.1+


> +minItems: 1

Why? I don't see any .dts files without the fallback.

> +  - items:
> +  - enum:
> +  - fsl,p2041-rcpm
> +  - fsl,p3041-rcpm
> +  - fsl,p4080-rcpm
> +  - fsl,p5020-rcpm
> +  - fsl,p5040-rcpm
> +  - enum:
> +  - fsl,qoriq-rcpm-1.0
> +minItems: 1
> +  - items:
> +  - enum:
> +  - fsl,b4420-rcpm
> +  - fsl,b4860-rcpm
> +  - fsl,t4240-rcpm
> +  - enum:
> +  - fsl,qoriq-rcpm-2.0
> +minItems: 1
> +  - items:
> +  - enum:
> +  - fsl,t1040-rcpm
> +  - enum:
> +  - fsl,qoriq-rcpm-2.1
> +minItems: 1


[PATCH] powerpc: Use of_property_present()

2024-07-31 Thread Rob Herring (Arm)
Use of_property_present() to test for property presence rather than
of_get_property(). This is part of a larger effort to remove callers
of of_get_property() and similar functions. of_get_property() leaks
the DT property data pointer which is a problem for dynamically
allocated nodes which may be freed.

Signed-off-by: Rob Herring (Arm) 
---
 arch/powerpc/platforms/powernv/eeh-powernv.c | 2 +-
 arch/powerpc/platforms/powernv/opal-lpc.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c 
b/arch/powerpc/platforms/powernv/eeh-powernv.c
index af3a5d37a149..3d072a7455bf 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -860,7 +860,7 @@ static int pnv_eeh_bridge_reset(struct pci_dev *pdev, int 
option)
int64_t rc;
 
/* Hot reset to the bus if firmware cannot handle */
-   if (!dn || !of_get_property(dn, "ibm,reset-by-firmware", NULL))
+   if (!dn || !of_property_present(dn, "ibm,reset-by-firmware"))
return __pnv_eeh_bridge_reset(pdev, option);
 
pr_debug("%s: FW reset PCI bus %04x:%02x with option %d\n",
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c 
b/arch/powerpc/platforms/powernv/opal-lpc.c
index a16f07cdab26..8a7f39e106bd 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -393,7 +393,7 @@ void __init opal_lpc_init(void)
for_each_compatible_node(np, NULL, "ibm,power8-lpc") {
if (!of_device_is_available(np))
continue;
-   if (!of_get_property(np, "primary", NULL))
+   if (!of_property_present(np, "primary"))
continue;
opal_lpc_chip_id = of_get_ibm_chip_id(np);
of_node_put(np);
-- 
2.43.0



[PATCH] cpufreq: Use of_property_present()

2024-07-31 Thread Rob Herring (Arm)
Use of_property_present() to test for property presence rather than
of_(find|get)_property(). This is part of a larger effort to remove
callers of of_find_property() and similar functions. of_find_property()
leaks the DT struct property and data pointers which is a problem for
dynamically allocated nodes which may be freed.

Signed-off-by: Rob Herring (Arm) 
---
 drivers/cpufreq/cpufreq-dt.c   | 11 +++
 drivers/cpufreq/pmac64-cpufreq.c   |  2 +-
 drivers/cpufreq/sti-cpufreq.c  |  2 +-
 drivers/cpufreq/sun50i-cpufreq-nvmem.c |  2 +-
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 6532c4d71338..983443396f8f 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -69,7 +69,6 @@ static int set_target(struct cpufreq_policy *policy, unsigned 
int index)
 static const char *find_supply_name(struct device *dev)
 {
struct device_node *np __free(device_node) = of_node_get(dev->of_node);
-   struct property *pp;
int cpu = dev->id;
 
/* This must be valid for sure */
@@ -77,14 +76,10 @@ static const char *find_supply_name(struct device *dev)
return NULL;
 
/* Try "cpu0" for older DTs */
-   if (!cpu) {
-   pp = of_find_property(np, "cpu0-supply", NULL);
-   if (pp)
-   return "cpu0";
-   }
+   if (!cpu && of_property_present(np, "cpu0-supply"))
+   return "cpu0";
 
-   pp = of_find_property(np, "cpu-supply", NULL);
-   if (pp)
+   if (of_property_present(np, "cpu-supply"))
return "cpu";
 
dev_dbg(dev, "no regulator for cpu%d\n", cpu);
diff --git a/drivers/cpufreq/pmac64-cpufreq.c b/drivers/cpufreq/pmac64-cpufreq.c
index 2cd2b06849a2..c87cd6e0b638 100644
--- a/drivers/cpufreq/pmac64-cpufreq.c
+++ b/drivers/cpufreq/pmac64-cpufreq.c
@@ -505,7 +505,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node 
*cpunode)
continue;
if (strcmp(loc, "CPU CLOCK"))
continue;
-   if (!of_get_property(hwclock, "platform-get-frequency", NULL))
+   if (!of_property_present(hwclock, "platform-get-frequency"))
continue;
break;
}
diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c
index 8e2e703c3865..b15b3142b5fe 100644
--- a/drivers/cpufreq/sti-cpufreq.c
+++ b/drivers/cpufreq/sti-cpufreq.c
@@ -267,7 +267,7 @@ static int __init sti_cpufreq_init(void)
goto skip_voltage_scaling;
}
 
-   if (!of_get_property(ddata.cpu->of_node, "operating-points-v2", NULL)) {
+   if (!of_property_present(ddata.cpu->of_node, "operating-points-v2")) {
dev_err(ddata.cpu, "OPP-v2 not supported\n");
goto skip_voltage_scaling;
}
diff --git a/drivers/cpufreq/sun50i-cpufreq-nvmem.c 
b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
index 95ac8d46c156..293921acec93 100644
--- a/drivers/cpufreq/sun50i-cpufreq-nvmem.c
+++ b/drivers/cpufreq/sun50i-cpufreq-nvmem.c
@@ -146,7 +146,7 @@ static bool dt_has_supported_hw(void)
return false;
 
for_each_child_of_node_scoped(np, opp) {
-   if (of_find_property(opp, "opp-supported-hw", NULL)) {
+   if (of_property_present(opp, "opp-supported-hw")) {
has_opp_supported_hw = true;
break;
}
-- 
2.43.0



Re: [PATCH 1/1] dt-bindings: soc: fsl: Convert rcpm to yaml format

2024-07-30 Thread Rob Herring
On Mon, Jul 29, 2024 at 03:11:42PM -0400, Frank Li wrote:
> Convert dt-binding rcpm from txt to yaml format.
> Add fsl,ls1028a-rcpm compatible string.
> 
> Signed-off-by: Frank Li 
> ---
>  .../bindings/rtc/fsl,ls-ftm-alarm.yaml|  2 +-
>  .../devicetree/bindings/soc/fsl/fsl,rcpm.yaml | 91 +++
>  .../devicetree/bindings/soc/fsl/rcpm.txt  | 69 --
>  3 files changed, 92 insertions(+), 70 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> 
> diff --git a/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml 
> b/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> index 388102ae30cd8..3ec111f2fdc40 100644
> --- a/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> +++ b/Documentation/devicetree/bindings/rtc/fsl,ls-ftm-alarm.yaml
> @@ -42,7 +42,7 @@ properties:
>  minItems: 1
>  description:
>phandle to rcpm node, Please refer
> -  Documentation/devicetree/bindings/soc/fsl/rcpm.txt
> +  Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
>  
>big-endian:
>  $ref: /schemas/types.yaml#/definitions/flag
> diff --git a/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
> new file mode 100644
> index 0..6c6cda7f2b220
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/fsl,rcpm.yaml
> @@ -0,0 +1,91 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/fsl,rcpm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Run Control and Power Management
> +
> +description:
> +  The RCPM performs all device-level tasks associated with device run control
> +  and power management.
> +
> +maintainers:
> +  - Frank Li 
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +  - fsl,ls1012a-rcpm
> +  - fsl,ls1021a-rcpm
> +  - fsl,ls1028a-rcpm
> +  - fsl,ls1043a-rcpm
> +  - fsl,ls1045a-rcpm
> +  - fsl,p2041-rcpm
> +  - fsl,p5020-rcpm
> +  - fsl,t4240-rcpm
> +  - enum:
> +  - fsl,qoriq-rcpm-1.0
> +  - fsl,qoriq-rcpm-2.0
> +  - fsl,qoriq-rcpm-2.1
> +  - fsl,qoriq-rcpm-2.1+

You can't just allow any combination.

> +minItems: 1
> +description: |
> +  All references to "1.0" and "2.0" refer to the QorIQ chassis version to
> +  which the chip complies.
> +  Chassis Version Example Chips
> +  --- ---
> +  1.0 p4080, p5020, p5040, p2041, p3041
> +  2.0 t4240, b4860, b4420
> +  2.1 t1040,
> +  2.1+ls1021a, ls1012a, ls1043a, ls1046a

The compatible lists above needs to match this.

> +
> +  reg:
> +maxItems: 1
> +
> +  "#fsl,rcpm-wakeup-cells":
> +description: |
> +  The number of IPPDEXPCR register cells in the
> +  fsl,rcpm-wakeup property.
> +
> +  Freescale RCPM Wakeup Source Device Tree Bindings
> +
> +  Required fsl,rcpm-wakeup property should be added to a device node if
> +  the device can be used as a wakeup source.
> +
> +  fsl,rcpm-wakeup: Consists of a phandle to the rcpm node and the 
> IPPDEXPCR
> +  register cells. The number of IPPDEXPCR register cells is defined in
> +  "#fsl,rcpm-wakeup-cells" in the rcpm node. The first register cell is
> +  the bit mask that should be set in IPPDEXPCR0, and the second register
> +  cell is for IPPDEXPCR1, and so on.
> +
> +  Note: IPPDEXPCR(IP Powerdown Exception Control Register) provides a
> +  mechanism for keeping certain blocks awake during STANDBY and MEM, in
> +  order to use them as wake-up sources.
> +
> +  little-endian:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  RCPM register block is Little Endian. Without it RCPM
> +  will be Big Endian (default case).
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +#include 
> +rcpm: global-utilities@e2000 {
> +  compatible = "fsl,t4240-rcpm", "fsl,qoriq-rcpm-2.0";
> +  reg = <0xe2000 0x1000>;
> +  #fsl,rcpm-wakeup-cells = <2>;
> +};
> +
> +serial@295 {
> + compatible = "fsl,ls1021a-lpuart";
> + reg = <0x295 0x1000>;
> + interrupts = ;
> + clocks = <&sysclk>;
> + clock-names = "ipg";
> + fsl,rcpm-wakeup = <&rcpm 0x0 0x4000>;
> +};


Re: [PATCH v1 23/36] dt-bindings: soc: fsl: cpm_qe: Add QUICC Engine (QE) QMC controller

2024-07-30 Thread Rob Herring
On Mon, Jul 29, 2024 at 04:20:52PM +0200, Herve Codina wrote:
> Add support for the QMC (QUICC Multichannel Controller) available in
> some PowerQUICC SoC that uses a QUICC Engine (QE) block such as MPC8321.
> 
> This QE QMC is similar to the CPM QMC except that it uses UCCs (Unified
> Communication Controllers) instead of SCCs (Serial Communication
> Controllers). Also, compared against the CPM QMC, this QE QMC does not
> use a fixed area for the UCC/SCC parameters area but it uses a dynamic
> area allocated and provided to the hardware at runtime.
> Last point, the QE QMC can use a firmware to have the QMC working in
> 'soft-qmc' mode.
> 
> Signed-off-by: Herve Codina 
> ---
>  .../soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml| 197 ++
>  1 file changed, 197 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> new file mode 100644
> index ..1215b2de36e6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml
> @@ -0,0 +1,197 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,qe-ucc-qmc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PowerQUICC QE QUICC Multichannel Controller (QMC)
> +
> +maintainers:
> +  - Herve Codina 
> +
> +description:
> +  The QMC (QUICC Multichannel Controller) emulates up to 64 channels within 
> one
> +  serial controller using the same TDM physical interface routed from TSA.
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +  - fsl,mpc8321-ucc-qmc
> +  - const: fsl,qe-ucc-qmc
> +
> +  reg:
> +items:
> +  - description: UCC (Unified communication controller) register base
> +  - description: Dual port ram base
> +
> +  reg-names:
> +items:
> +  - const: ucc_regs
> +  - const: dpram
> +
> +  interrupts:
> +maxItems: 1
> +description: UCC interrupt line in the QE interrupt controller
> +
> +  fsl,tsa-serial:
> +$ref: /schemas/types.yaml#/definitions/phandle-array
> +items:
> +  - items:
> +  - description: phandle to TSA node
> +  - enum: [1, 2, 3, 4, 5]
> +description: |
> +  TSA serial interface (dt-bindings/soc/qe-fsl,tsa.h defines 
> these
> +  values)
> +   - 1: UCC1
> +   - 2: UCC2
> +   - 3: UCC3
> +   - 4: UCC4
> +   - 5: UCC5
> +description:
> +  Should be a phandle/number pair. The phandle to TSA node and the TSA
> +  serial interface to use.
> +
> +  fsl,soft-qmc:
> +$ref: /schemas/types.yaml#/definitions/string
> +description:
> +  Soft QMC firmware name to load. If this property is omitted, no 
> firmware
> +  are used.
> +
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +patternProperties:
> +  '^channel@([0-9]|[1-5][0-9]|6[0-3])$':

Unit-addresses are typically in hex.

> +description:
> +  A channel managed by this controller
> +type: object
> +additionalProperties: false
> +
> +properties:
> +  reg:
> +minimum: 0
> +maximum: 63
> +description:
> +  The channel number
> +
> +  fsl,operational-mode:
> +$ref: /schemas/types.yaml#/definitions/string
> +enum: [transparent, hdlc]
> +default: transparent
> +description: |
> +  The channel operational mode
> +- hdlc: The channel handles HDLC frames
> +- transparent: The channel handles raw data without any 
> processing
> +
> +  fsl,reverse-data:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  The bit order as seen on the channels is reversed,
> +  transmitting/receiving the MSB of each octet first.
> +  This flag is used only in 'transparent' mode.
> +
> +  fsl,tx-ts-mask:
> +$ref: /schemas/types.yaml#/definitions/uint64
> +description:
> +  Channel assigned Tx time-slots within the Tx time-slots routed by 
> the
> +  TSA to this cell.
> +
> +  fsl,rx-ts-mask:
> +$ref: /schemas/types.yaml#/definitions/uint64
> +description:
> +  Channel assigned Rx time-slots within the Rx time-slots routed by 
> the
> +  TSA to this cell.
> +
> +  compatible:

compatible goes first in the list.

> +items:
> +  - enum:
> +  - fsl,mpc8321-ucc-qmc-hdlc
> +  - const: fsl,qe-ucc-qmc-hdlc
> +  - const: fsl,qmc-hdlc

Really need 3 compatibles?

> +
> +  fsl,framer:
> +$ref: /schemas/types.yaml#/definitions/phandle
> +description:
> +  phandle to the framer node. The fram

Re: [PATCH v1 07/36] dt-bindings: soc: fsl: cpm_qe: Add QUICC Engine (QE) TSA controller

2024-07-30 Thread Rob Herring
On Mon, Jul 29, 2024 at 04:20:36PM +0200, Herve Codina wrote:
> Add support for the time slot assigner (TSA) available in some
> PowerQUICC SoC that uses a QUICC Engine (QE) block such as MPC8321.
> 
> This QE TSA is similar to the CPM TSA except that it uses UCCs (Unified
> Communication Controllers) instead of SCCs (Serial Communication
> Controllers). Also, compared against the CPM TSA, this QE TSA can handle
> up to 4 TDMs instead of 2 and allows to configure the logic level of
> sync signals.
> 
> Signed-off-by: Herve Codina 
> ---
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml   | 212 ++
>  include/dt-bindings/soc/qe-fsl,tsa.h  |  13 ++
>  2 files changed, 225 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml
>  create mode 100644 include/dt-bindings/soc/qe-fsl,tsa.h
> 
> diff --git a/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml
> new file mode 100644
> index ..569a4d2e0cab
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,qe-tsa.yaml
> @@ -0,0 +1,212 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/cpm_qe/fsl,qe-tsa.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PowerQUICC QE Time-slot assigner (TSA) controller
> +
> +maintainers:
> +  - Herve Codina 
> +
> +description:
> +  The TSA is the time-slot assigner that can be found on some PowerQUICC SoC.
> +  Its purpose is to route some TDM time-slots to other internal serial
> +  controllers.
> +
> +properties:
> +  compatible:
> +items:
> +  - enum:
> +  - fsl,mpc8321-tsa
> +  - const: fsl,qe-tsa
> +
> +  reg:
> +items:
> +  - description: SI (Serial Interface) register base
> +  - description: SI RAM base
> +
> +  reg-names:
> +items:
> +  - const: si_regs
> +  - const: si_ram
> +
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +patternProperties:
> +  '^tdm@[0-3]$':
> +description:
> +  The TDM managed by this controller
> +type: object
> +
> +additionalProperties: false
> +
> +properties:
> +  reg:
> +minimum: 0
> +maximum: 3
> +description:
> +  The TDM number for this TDM, 0 for TDMa, 1 for TDMb, 2 for TDMc 
> and 3
> +  for TDMd.
> +
> +  fsl,common-rxtx-pins:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  The hardware can use four dedicated pins for Tx clock, Tx sync, Rx
> +  clock and Rx sync or use only two pins, Tx/Rx clock and Tx/Rx sync.
> +  Without the 'fsl,common-rxtx-pins' property, the four pins are 
> used.
> +  With the 'fsl,common-rxtx-pins' property, two pins are used.
> +
> +  clocks:
> +minItems: 2
> +items:
> +  - description: Receive sync clock
> +  - description: Receive data clock
> +  - description: Transmit sync clock
> +  - description: Transmit data clock
> +
> +  clock-names:
> +minItems: 2
> +items:
> +  - const: rsync
> +  - const: rclk
> +  - const: tsync
> +  - const: tclk
> +
> +  fsl,rx-frame-sync-delay-bits:
> +enum: [0, 1, 2, 3]
> +default: 0
> +description: |
> +  Receive frame sync delay in number of bits.
> +  Indicates the delay between the Rx sync and the first bit of the Rx
> +  frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.

The last 2 sentences seem redundant to me.

> +
> +  fsl,tx-frame-sync-delay-bits:
> +enum: [0, 1, 2, 3]
> +default: 0
> +description: |
> +  Transmit frame sync delay in number of bits.
> +  Indicates the delay between the Tx sync and the first bit of the Tx
> +  frame. 0 for no bit delay. 1, 2 or 3 for 1, 2 or 3 bits delay.
> +
> +  fsl,clock-falling-edge:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  Data is sent on falling edge of the clock (and received on the 
> rising
> +  edge). If 'clock-falling-edge' is not present, data is sent on the

No such property 'clock-falling-edge'. I don't think you need to repeat 
the property name anyways.

> +  rising edge (and received on the falling edge).
> +
> +  fsl,fsync-rising-edge:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  Frame sync pulses are sampled with the rising edge of the channel
> +  clock. If 'fsync-rising-edge' is not present, pulses are sampled 
> with

And same here.

> +  the falling edge.
> +
> +  fsl,fsync-active-low:
> +$ref: /schemas/types.yaml#/definitions/flag
> +description:
> +  Frame sync signals are active

[PATCH 2/2] cxl: Use of_property_ accessor functions

2024-07-29 Thread Rob Herring (Arm)
The CXL driver has its own custom implementations of typed DT property
accessors. Replace the custom property accessor functions with the
common DT property functions.

This clean-up is part of a larger effort to remove of_get_property() and
other DT functions which leak pointers to DT node and property data.

Signed-off-by: Rob Herring (Arm) 
---
 drivers/misc/cxl/of.c  | 106 ++---
 drivers/misc/cxl/pci.c |  32 ++-
 2 files changed, 33 insertions(+), 105 deletions(-)

diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index 21ecce0f9403..03633cccd043 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -7,59 +7,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "cxl.h"
 
-
-static const __be32 *read_prop_string(const struct device_node *np,
-   const char *prop_name)
-{
-   const __be32 *prop;
-
-   prop = of_get_property(np, prop_name, NULL);
-   return prop;
-}
-
-static const __be32 *read_prop_dword(const struct device_node *np,
-   const char *prop_name, u32 *val)
-{
-   const __be32 *prop;
-
-   prop = of_get_property(np, prop_name, NULL);
-   if (prop)
-   *val = be32_to_cpu(prop[0]);
-   return prop;
-}
-
-static const __be64 *read_prop64_dword(const struct device_node *np,
-   const char *prop_name, u64 *val)
-{
-   const __be64 *prop;
-
-   prop = of_get_property(np, prop_name, NULL);
-   if (prop)
-   *val = be64_to_cpu(prop[0]);
-   return prop;
-}
-
-
-static int read_handle(struct device_node *np, u64 *handle)
-{
-   const __be32 *prop;
-   u64 size;
-
-   /* Get address and size of the node */
-   prop = of_get_address(np, 0, &size, NULL);
-   if (size)
-   return -EINVAL;
-
-   /* Helper to read a big number; size is in cells (not bytes) */
-   *handle = of_read_number(prop, of_n_addr_cells(np));
-   return 0;
-}
-
 static int read_phys_addr(struct device_node *np, char *prop_name,
struct cxl_afu *afu)
 {
@@ -121,17 +74,12 @@ static int read_vpd(struct cxl *adapter, struct cxl_afu 
*afu)
 
 int cxl_of_read_afu_handle(struct cxl_afu *afu, struct device_node *afu_np)
 {
-   if (read_handle(afu_np, &afu->guest->handle))
-   return -EINVAL;
-   pr_devel("AFU handle: 0x%.16llx\n", afu->guest->handle);
-
-   return 0;
+   return of_property_read_reg(afu_np, 0, &afu->guest->handle, NULL);
 }
 
 int cxl_of_read_afu_properties(struct cxl_afu *afu, struct device_node *np)
 {
int i, rc;
-   const __be32 *prop;
u16 device_id, vendor_id;
u32 val = 0, class_code;
 
@@ -150,16 +98,15 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, struct 
device_node *np)
else
afu->psa = true;
 
-   read_prop_dword(np, "ibm,#processes", &afu->max_procs_virtualised);
+   of_property_read_u32(np, "ibm,#processes", &afu->max_procs_virtualised);
 
if (cxl_verbose)
read_vpd(NULL, afu);
 
-   read_prop_dword(np, "ibm,max-ints-per-process", &afu->guest->max_ints);
+   of_property_read_u32(np, "ibm,max-ints-per-process", 
&afu->guest->max_ints);
afu->irqs_max = afu->guest->max_ints;
 
-   prop = read_prop_dword(np, "ibm,min-ints-per-process", &afu->pp_irqs);
-   if (prop) {
+   if (!of_property_read_u32(np, "ibm,min-ints-per-process", 
&afu->pp_irqs)) {
/* One extra interrupt for the PSL interrupt is already
 * included. Remove it now to keep only AFU interrupts and
 * match the native case.
@@ -167,13 +114,13 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, 
struct device_node *np)
afu->pp_irqs--;
}
 
-   read_prop64_dword(np, "ibm,error-buffer-size", &afu->eb_len);
+   of_property_read_u64(np, "ibm,error-buffer-size", &afu->eb_len);
afu->eb_offset = 0;
 
-   read_prop64_dword(np, "ibm,config-record-size", &afu->crs_len);
+   of_property_read_u64(np, "ibm,config-record-size", &afu->crs_len);
afu->crs_offset = 0;
 
-   read_prop_dword(np, "ibm,#config-records", &afu->crs_num);
+   of_property_read_u32(np, "ibm,#config-records", &afu->crs_num);
 
if (cxl_verbose) {
for (i = 0; i < afu->crs_num; i++) {
@@ -201,14 +148,12 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, 
struct device_node *np)
 * not supported
 */
val = 0;
-   prop = read_prop_dword(np, "ibm,process-mmio", &va

[PATCH 0/2] cxl: DT property accessor cleanups

2024-07-29 Thread Rob Herring (Arm)
This short series replaces the custom DT property accessors in the CXL 
driver with the common ones. The one difference is dumping the 
properties read out is removed. If that feature is really needed, then 
it should be implemented in the DT core for everyone. 

This is part of a larger effort to remove DT functions leaking DT data 
(e.g. of_get_property()).

Signed-off-by: Rob Herring (Arm) 
---
Rob Herring (Arm) (2):
  cxl: Drop printing of DT properties
  cxl: Use of_property_ accessor functions

 drivers/misc/cxl/of.c  | 207 ++---
 drivers/misc/cxl/pci.c |  32 
 2 files changed, 36 insertions(+), 203 deletions(-)
---
base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
change-id: 20240729-dt-cxl-cleanup-eaf8185a99fc

Best regards,
-- 
Rob Herring (Arm) 



[PATCH 1/2] cxl: Drop printing of DT properties

2024-07-29 Thread Rob Herring (Arm)
There's little reason to dump DT property values when they can be read
at any time from the DT in /proc/device-tree. If such a feature is
needed, then it really should be implemented in the DT core such that
any module/driver can use it.

Signed-off-by: Rob Herring (Arm) 
---
 drivers/misc/cxl/of.c | 101 ++
 1 file changed, 3 insertions(+), 98 deletions(-)

diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
index bcc005dff1c0..21ecce0f9403 100644
--- a/drivers/misc/cxl/of.c
+++ b/drivers/misc/cxl/of.c
@@ -19,8 +19,6 @@ static const __be32 *read_prop_string(const struct 
device_node *np,
const __be32 *prop;
 
prop = of_get_property(np, prop_name, NULL);
-   if (cxl_verbose && prop)
-   pr_info("%s: %s\n", prop_name, (char *) prop);
return prop;
 }
 
@@ -32,8 +30,6 @@ static const __be32 *read_prop_dword(const struct device_node 
*np,
prop = of_get_property(np, prop_name, NULL);
if (prop)
*val = be32_to_cpu(prop[0]);
-   if (cxl_verbose && prop)
-   pr_info("%s: %#x (%u)\n", prop_name, *val, *val);
return prop;
 }
 
@@ -45,8 +41,6 @@ static const __be64 *read_prop64_dword(const struct 
device_node *np,
prop = of_get_property(np, prop_name, NULL);
if (prop)
*val = be64_to_cpu(prop[0]);
-   if (cxl_verbose && prop)
-   pr_info("%s: %#llx (%llu)\n", prop_name, *val, *val);
return prop;
 }
 
@@ -100,9 +94,6 @@ static int read_phys_addr(struct device_node *np, char 
*prop_name,
type, prop_name);
return -EINVAL;
}
-   if (cxl_verbose)
-   pr_info("%s: %#x %#llx (size %#llx)\n",
-   prop_name, type, addr, size);
}
}
return 0;
@@ -139,27 +130,13 @@ int cxl_of_read_afu_handle(struct cxl_afu *afu, struct 
device_node *afu_np)
 
 int cxl_of_read_afu_properties(struct cxl_afu *afu, struct device_node *np)
 {
-   int i, len, rc;
-   char *p;
+   int i, rc;
const __be32 *prop;
u16 device_id, vendor_id;
u32 val = 0, class_code;
 
/* Properties are read in the same order as listed in PAPR */
 
-   if (cxl_verbose) {
-   pr_info("Dump of the 'ibm,coherent-platform-function' node 
properties:\n");
-
-   prop = of_get_property(np, "compatible", &len);
-   i = 0;
-   while (i < len) {
-   p = (char *) prop + i;
-   pr_info("compatible: %s\n", p);
-   i += strlen(p) + 1;
-   }
-   read_prop_string(np, "name");
-   }
-
rc = read_phys_addr(np, "reg", afu);
if (rc)
return rc;
@@ -173,19 +150,10 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, 
struct device_node *np)
else
afu->psa = true;
 
-   if (cxl_verbose) {
-   read_prop_string(np, "ibm,loc-code");
-   read_prop_string(np, "device_type");
-   }
-
read_prop_dword(np, "ibm,#processes", &afu->max_procs_virtualised);
 
-   if (cxl_verbose) {
-   read_prop_dword(np, "ibm,scratchpad-size", &val);
-   read_prop_dword(np, "ibm,programmable", &val);
-   read_prop_string(np, "ibm,phandle");
+   if (cxl_verbose)
read_vpd(NULL, afu);
-   }
 
read_prop_dword(np, "ibm,max-ints-per-process", &afu->guest->max_ints);
afu->irqs_max = afu->guest->max_ints;
@@ -199,17 +167,9 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, struct 
device_node *np)
afu->pp_irqs--;
}
 
-   if (cxl_verbose) {
-   read_prop_dword(np, "ibm,max-ints", &val);
-   read_prop_dword(np, "ibm,vpd-size", &val);
-   }
-
read_prop64_dword(np, "ibm,error-buffer-size", &afu->eb_len);
afu->eb_offset = 0;
 
-   if (cxl_verbose)
-   read_prop_dword(np, "ibm,config-record-type", &val);
-
read_prop64_dword(np, "ibm,config-record-size", &afu->crs_len);
afu->crs_offset = 0;
 
@@ -235,15 +195,6 @@ int cxl_of_read_afu_properties(struct cxl_afu *afu, struct 
device_node *np)
i, class_code);
}
}
-
-   read_prop_dword(np, "ibm,function-number", &val);
-   read_prop_dword(np, "ibm,privileged-function", &

Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-26 Thread Rob Herring
On Thu, Jul 25, 2024 at 6:06 PM Lizhi Hou  wrote:
>
> Hi Amit,
>
>
> I try to follow the option which add a OF flag. If Rob is ok with this,
> I would suggest to use it instead of V1 patch
>
> diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
> index dda6092e6d3a..a401ed0463d9 100644
> --- a/drivers/of/dynamic.c
> +++ b/drivers/of/dynamic.c
> @@ -382,6 +382,11 @@ void of_node_release(struct kobject *kobj)
> __func__, node);
>  }
>
> +   if (of_node_check_flag(node, OF_CREATED_WITH_CSET)) {
> +   of_changeset_revert(node->data);
> +   of_changeset_destroy(node->data);
> +   }

What happens if multiple nodes are created in the changeset?

> +
>  if (node->child)
>  pr_err("ERROR: %s() unexpected children for %pOF/%s\n",
>  __func__, node->parent, node->full_name);
> @@ -507,6 +512,7 @@ struct device_node *of_changeset_create_node(struct
> of_changeset *ocs,
>  np = __of_node_dup(NULL, full_name);
>  if (!np)
>  return NULL;
> +   of_node_set_flag(np, OF_CREATED_WITH_CSET);

This should be set where the data ptr is set.

Rob


Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-26 Thread Rob Herring
+ Ubuntu kernel list, again

On Thu, Jul 25, 2024 at 11:15:39PM +0530, Amit Machhiwal wrote:
> Hi Lizhi, Rob,
> 
> Sorry for responding late. I got busy with some other things.
> 
> On 2024/07/23 02:08 PM, Lizhi Hou wrote:
> > 
> > On 7/23/24 12:54, Rob Herring wrote:
> > > On Tue, Jul 23, 2024 at 12:21 PM Lizhi Hou  wrote:
> > > > 
> > > > On 7/23/24 09:21, Rob Herring wrote:
> > > > > On Mon, Jul 15, 2024 at 01:52:30PM -0700, Lizhi Hou wrote:
> > > > > > On 7/15/24 11:55, Rob Herring wrote:
> > > > > > > On Mon, Jul 15, 2024 at 2:08 AM Amit Machhiwal 
> > > > > > >  wrote:
> > > > > > > > With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug 
> > > > > > > > sequence
> > > > > > > > of a PCI device attached to a PCI-bridge causes following 
> > > > > > > > kernel Oops on
> > > > > > > > a pseries KVM guest:
> > > > > > > > 
> > > > > > > > RTAS: event: 2, Type: Hotplug Event (229), Severity: 1
> > > > > > > > Kernel attempted to read user page (10ec0048) - exploit 
> > > > > > > > attempt? (uid: 0)
> > > > > > > > BUG: Unable to handle kernel data access on read at 
> > > > > > > > 0x10ec0048
> > > > > > > > Faulting instruction address: 0xc12d8728
> > > > > > > > Oops: Kernel access of bad area, sig: 11 [#1]
> > > > > > > > LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> > > > > > > > 
> > > > > > > > NIP [c12d8728] 
> > > > > > > > __of_changeset_entry_invert+0x10/0x1ac
> > > > > > > > LR [c12da7f0] 
> > > > > > > > __of_changeset_revert_entries+0x98/0x180
> > > > > > > > Call Trace:
> > > > > > > > [cbcc3970] [c12daa60] 
> > > > > > > > of_changeset_revert+0x58/0xd8
> > > > > > > > [cbcc39c0] [c0d0ed78] 
> > > > > > > > of_pci_remove_node+0x74/0xb0
> > > > > > > > [cbcc39f0] [c0cdcfe0] 
> > > > > > > > pci_stop_bus_device+0xf4/0x138
> > > > > > > > [cbcc3a30] [c0cdd140] 
> > > > > > > > pci_stop_and_remove_bus_device_locked+0x34/0x64
> > > > > > > > [cbcc3a60] [c0cf3780] 
> > > > > > > > remove_store+0xf0/0x108
> > > > > > > > [cbcc3ab0] [c0e89e04] 
> > > > > > > > dev_attr_store+0x34/0x78
> > > > > > > > [cbcc3ad0] [c07f8dd4] 
> > > > > > > > sysfs_kf_write+0x70/0xa4
> > > > > > > > [cbcc3af0] [c07f7248] 
> > > > > > > > kernfs_fop_write_iter+0x1d0/0x2e0
> > > > > > > > [cbcc3b40] [c06c9b08] vfs_write+0x27c/0x558
> > > > > > > > [cbcc3bf0] [c06ca168] ksys_write+0x90/0x170
> > > > > > > > [cbcc3c40] [c0033248] 
> > > > > > > > system_call_exception+0xf8/0x290
> > > > > > > > [cbcc3e50] [c000d05c] 
> > > > > > > > system_call_vectored_common+0x15c/0x2ec
> > > > > > > > 
> > > > > > > > 
> > > > > > > > A git bisect pointed this regression to be introduced via [1] 
> > > > > > > > that added
> > > > > > > > a mechanism to create device tree nodes for parent PCI bridges 
> > > > > > > > when a
> > > > > > > > PCI device is hot-plugged.
> > > > > > > > 
> > > > > > > > The Oops is caused when `pci_stop_dev()` tries to remove a 
> > > > > > > > non-existing
> > > > > > > > device-tree node associated with the pci_dev that was earlier
> > > > > > > > hot-plugged and was attached under a pci-bridge. The PCI dev 
> > > > > > > > header
> > > > > > > > `dev->hdr_type` being 0, results a conditional check d

Re: [PATCH v2] of: remove internal arguments from of_property_for_each_u32()

2024-07-24 Thread Rob Herring
On Thu, Jul 18, 2024 at 1:57 AM Luca Ceresoli  wrote:
>
> Hello Stephen,
>
> On Wed, 17 Jul 2024 16:33:34 -0700
> Stephen Boyd  wrote:
>
> > > @@ -1191,20 +1191,24 @@ static int si5351_dt_parse(struct i2c_client 
> > > *client,
> > >  * property silabs,pll-source : , [<..>]
> > >  * allow to selectively set pll source
> > >  */
> > > -   of_property_for_each_u32(np, "silabs,pll-source", prop, p, num) {
> > > +   sz = of_property_read_variable_u32_array(np, "silabs,pll-source", 
> > > array, 2, 4);
> > > +   sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */
> > > +   if (sz < 0)
> > > +   return dev_err_probe(&client->dev, sz, "invalid 
> > > pll-source");
> >
> > Needs a newline on the printk message.
>
> Ouch! Fix queued for v3.

I need v3 like today if I'm going to send it for rc1.

Rob


Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-23 Thread Rob Herring
On Tue, Jul 23, 2024 at 12:21 PM Lizhi Hou  wrote:
>
>
> On 7/23/24 09:21, Rob Herring wrote:
> > On Mon, Jul 15, 2024 at 01:52:30PM -0700, Lizhi Hou wrote:
> >> On 7/15/24 11:55, Rob Herring wrote:
> >>> On Mon, Jul 15, 2024 at 2:08 AM Amit Machhiwal  
> >>> wrote:
> >>>> With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> >>>> of a PCI device attached to a PCI-bridge causes following kernel Oops on
> >>>> a pseries KVM guest:
> >>>>
> >>>>RTAS: event: 2, Type: Hotplug Event (229), Severity: 1
> >>>>Kernel attempted to read user page (10ec0048) - exploit attempt? 
> >>>> (uid: 0)
> >>>>BUG: Unable to handle kernel data access on read at 0x10ec0048
> >>>>Faulting instruction address: 0xc12d8728
> >>>>Oops: Kernel access of bad area, sig: 11 [#1]
> >>>>LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> >>>> 
> >>>>NIP [c12d8728] __of_changeset_entry_invert+0x10/0x1ac
> >>>>LR [c12da7f0] __of_changeset_revert_entries+0x98/0x180
> >>>>Call Trace:
> >>>>[cbcc3970] [c12daa60] of_changeset_revert+0x58/0xd8
> >>>>[cbcc39c0] [c0d0ed78] of_pci_remove_node+0x74/0xb0
> >>>>[cbcc39f0] [c0cdcfe0] pci_stop_bus_device+0xf4/0x138
> >>>>[cbcc3a30] [c0cdd140] 
> >>>> pci_stop_and_remove_bus_device_locked+0x34/0x64
> >>>>[cbcc3a60] [c0cf3780] remove_store+0xf0/0x108
> >>>>[cbcc3ab0] [c0e89e04] dev_attr_store+0x34/0x78
> >>>>[cbcc3ad0] [c07f8dd4] sysfs_kf_write+0x70/0xa4
> >>>>[cbcc3af0] [c07f7248] 
> >>>> kernfs_fop_write_iter+0x1d0/0x2e0
> >>>>[cbcc3b40] [c06c9b08] vfs_write+0x27c/0x558
> >>>>[cbcc3bf0] [c06ca168] ksys_write+0x90/0x170
> >>>>[cbcc3c40] [c0033248] system_call_exception+0xf8/0x290
> >>>>[cbcc3e50] [c000d05c] 
> >>>> system_call_vectored_common+0x15c/0x2ec
> >>>> 
> >>>>
> >>>> A git bisect pointed this regression to be introduced via [1] that added
> >>>> a mechanism to create device tree nodes for parent PCI bridges when a
> >>>> PCI device is hot-plugged.
> >>>>
> >>>> The Oops is caused when `pci_stop_dev()` tries to remove a non-existing
> >>>> device-tree node associated with the pci_dev that was earlier
> >>>> hot-plugged and was attached under a pci-bridge. The PCI dev header
> >>>> `dev->hdr_type` being 0, results a conditional check done with
> >>>> `pci_is_bridge()` into false. Consequently, a call to
> >>>> `of_pci_make_dev_node()` to create a device node is never made. When at
> >>>> a later point in time, in the device node removal path, a memcpy is
> >>>> attempted in `__of_changeset_entry_invert()`; since the device node was
> >>>> never created, results in an Oops due to kernel read access to a bad
> >>>> address.
> >>>>
> >>>> To fix this issue, the patch updates `of_changeset_create_node()` to
> >>>> allocate a new node only when the device node doesn't exist and init it
> >>>> in case it does already. Also, introduce `of_pci_free_node()` to be
> >>>> called to only revert and destroy the changeset device node that was
> >>>> created via a call to `of_changeset_create_node()`.
> >>>>
> >>>> [1] commit 407d1a51921e ("PCI: Create device tree node for bridge")
> >>>>
> >>>> Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> >>>> Reported-by: Kowshik Jois B S 
> >>>> Signed-off-by: Lizhi Hou 
> >>>> Signed-off-by: Amit Machhiwal 
> >>>> ---
> >>>> Changes since v1:
> >>>>   * Included Lizhi's suggested changes on V1
> >>>>   * Fixed below two warnings from Lizhi's changes and rearranged the 
> >>>> cleanup
> >>>> part a bit in `of_pci_make_dev_node`
> >>>>   drivers/pci/of.c:611:6: warning: no previous prototype for 
> >>>> ‘of_pci_free_node’ [-Wmissing-

Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-23 Thread Rob Herring
On Mon, Jul 15, 2024 at 01:52:30PM -0700, Lizhi Hou wrote:
> 
> On 7/15/24 11:55, Rob Herring wrote:
> > On Mon, Jul 15, 2024 at 2:08 AM Amit Machhiwal  
> > wrote:
> > > With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> > > of a PCI device attached to a PCI-bridge causes following kernel Oops on
> > > a pseries KVM guest:
> > > 
> > >   RTAS: event: 2, Type: Hotplug Event (229), Severity: 1
> > >   Kernel attempted to read user page (10ec0048) - exploit attempt? 
> > > (uid: 0)
> > >   BUG: Unable to handle kernel data access on read at 0x10ec0048
> > >   Faulting instruction address: 0xc12d8728
> > >   Oops: Kernel access of bad area, sig: 11 [#1]
> > >   LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> > > 
> > >   NIP [c12d8728] __of_changeset_entry_invert+0x10/0x1ac
> > >   LR [c12da7f0] __of_changeset_revert_entries+0x98/0x180
> > >   Call Trace:
> > >   [cbcc3970] [c12daa60] of_changeset_revert+0x58/0xd8
> > >   [cbcc39c0] [c0d0ed78] of_pci_remove_node+0x74/0xb0
> > >   [cbcc39f0] [c0cdcfe0] pci_stop_bus_device+0xf4/0x138
> > >   [cbcc3a30] [c0cdd140] 
> > > pci_stop_and_remove_bus_device_locked+0x34/0x64
> > >   [cbcc3a60] [c0cf3780] remove_store+0xf0/0x108
> > >   [cbcc3ab0] [c0e89e04] dev_attr_store+0x34/0x78
> > >   [cbcc3ad0] [c07f8dd4] sysfs_kf_write+0x70/0xa4
> > >   [cbcc3af0] [c07f7248] kernfs_fop_write_iter+0x1d0/0x2e0
> > >   [cbcc3b40] [c06c9b08] vfs_write+0x27c/0x558
> > >   [cbcc3bf0] [c06ca168] ksys_write+0x90/0x170
> > >   [cbcc3c40] [c0033248] system_call_exception+0xf8/0x290
> > >   [cbcc3e50] [c000d05c] 
> > > system_call_vectored_common+0x15c/0x2ec
> > > 
> > > 
> > > A git bisect pointed this regression to be introduced via [1] that added
> > > a mechanism to create device tree nodes for parent PCI bridges when a
> > > PCI device is hot-plugged.
> > > 
> > > The Oops is caused when `pci_stop_dev()` tries to remove a non-existing
> > > device-tree node associated with the pci_dev that was earlier
> > > hot-plugged and was attached under a pci-bridge. The PCI dev header
> > > `dev->hdr_type` being 0, results a conditional check done with
> > > `pci_is_bridge()` into false. Consequently, a call to
> > > `of_pci_make_dev_node()` to create a device node is never made. When at
> > > a later point in time, in the device node removal path, a memcpy is
> > > attempted in `__of_changeset_entry_invert()`; since the device node was
> > > never created, results in an Oops due to kernel read access to a bad
> > > address.
> > > 
> > > To fix this issue, the patch updates `of_changeset_create_node()` to
> > > allocate a new node only when the device node doesn't exist and init it
> > > in case it does already. Also, introduce `of_pci_free_node()` to be
> > > called to only revert and destroy the changeset device node that was
> > > created via a call to `of_changeset_create_node()`.
> > > 
> > > [1] commit 407d1a51921e ("PCI: Create device tree node for bridge")
> > > 
> > > Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> > > Reported-by: Kowshik Jois B S 
> > > Signed-off-by: Lizhi Hou 
> > > Signed-off-by: Amit Machhiwal 
> > > ---
> > > Changes since v1:
> > >  * Included Lizhi's suggested changes on V1
> > >  * Fixed below two warnings from Lizhi's changes and rearranged the 
> > > cleanup
> > >part a bit in `of_pci_make_dev_node`
> > >  drivers/pci/of.c:611:6: warning: no previous prototype for 
> > > ‘of_pci_free_node’ [-Wmissing-prototypes]
> > >611 | void of_pci_free_node(struct device_node *np)
> > >|  ^~~~
> > >  drivers/pci/of.c: In function ‘of_pci_make_dev_node’:
> > >  drivers/pci/of.c:696:1: warning: label ‘out_destroy_cset’ 
> > > defined but not used [-Wunused-label]
> > >696 | out_destroy_cset:
> > >| ^~~~
> > >  * V1: 
> > > https://lore.kernel.org/all/20240703141634.2974589-1-amach...@linux.ibm.com/
> > > 
> > >   drivers/of/dynam

Re: [PATCH] tpm: atmel: Drop PPC64 specific MMIO setup

2024-07-18 Thread Rob Herring
On Wed, Jul 17, 2024 at 6:14 AM Jarkko Sakkinen  wrote:
>
> On Wed Jul 17, 2024 at 3:08 PM EEST, Jarkko Sakkinen wrote:
> > On Tue Jul 2, 2024 at 7:10 PM EEST, Rob Herring (Arm) wrote:
> > > The PPC64 specific MMIO setup open codes DT address functions rather
> > > than using standard address parsing functions. The open-coded version
> > > fails to handle any address translation and is not endian safe.
> > >
> > > I haven't found any evidence of what platform used this. The only thing
> > > that turned up was a PPC405 platform, but that is 32-bit and PPC405
> > > support is being removed as well. CONFIG_TCG_ATMEL is not enabled for
> > > any powerpc config and never was. The support was added in 2005 and
> > > hasn't been touched since.
> > >
> > > Rather than try to modernize and fix this code, just remove it.
> > >
> > > Signed-off-by: Rob Herring (Arm) 
> > > ---
> > >  drivers/char/tpm/Kconfig |   2 +-
> > >  drivers/char/tpm/tpm_atmel.c |  64 +++-
> > >  drivers/char/tpm/tpm_atmel.h | 140 ---
> > >  3 files changed, 62 insertions(+), 144 deletions(-)
> > >  delete mode 100644 drivers/char/tpm/tpm_atmel.h
> > >
> > > diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
> > > index e63a6a17793c..9b655e9fc7ab 100644
> > > --- a/drivers/char/tpm/Kconfig
> > > +++ b/drivers/char/tpm/Kconfig
> > > @@ -162,7 +162,7 @@ config TCG_NSC
> > >
> > >  config TCG_ATMEL
> > > tristate "Atmel TPM Interface"
> > > -   depends on PPC64 || HAS_IOPORT_MAP
> > > +   depends on HAS_IOPORT_MAP
> > > depends on HAS_IOPORT
> > > help
> > >   If you have a TPM security chip from Atmel say Yes and it
> > > diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
> > > index 9fb2defa9dc4..622c4abe8cb3 100644
> > > --- a/drivers/char/tpm/tpm_atmel.c
> > > +++ b/drivers/char/tpm/tpm_atmel.c
> > > @@ -15,7 +15,67 @@
> > >   */
> > >
> > >  #include "tpm.h"
> > > -#include "tpm_atmel.h"
> > > +
> > > +struct tpm_atmel_priv {
> > > +   int region_size;
> > > +   int have_region;
> > > +   unsigned long base;
> > > +   void __iomem *iobase;
> > > +};
> > > +
> > > +#define atmel_getb(chip, offset) inb(atmel_get_priv(chip)->base + offset)
> > > +#define atmel_putb(val, chip, offset) \
> > > +   outb(val, atmel_get_priv(chip)->base + offset)
> > > +#define atmel_request_region request_region
> > > +#define atmel_release_region release_region
> > > +/* Atmel definitions */
> > > +enum tpm_atmel_addr {
> > > +   TPM_ATMEL_BASE_ADDR_LO = 0x08,
> > > +   TPM_ATMEL_BASE_ADDR_HI = 0x09
> > > +};
> > > +
> > > +static inline int tpm_read_index(int base, int index)
> > > +{
> > > +   outb(index, base);
> > > +   return inb(base+1) & 0xFF;
> > > +}
> > > +
> > > +/* Verify this is a 1.1 Atmel TPM */
> > > +static int atmel_verify_tpm11(void)
> > > +{
> > > +
> > > +   /* verify that it is an Atmel part */
> > > +   if (tpm_read_index(TPM_ADDR, 4) != 'A' ||
> > > +   tpm_read_index(TPM_ADDR, 5) != 'T' ||
> > > +   tpm_read_index(TPM_ADDR, 6) != 'M' ||
> > > +   tpm_read_index(TPM_ADDR, 7) != 'L')
> > > +   return 1;
> > > +
> > > +   /* query chip for its version number */
> > > +   if (tpm_read_index(TPM_ADDR, 0x00) != 1 ||
> > > +   tpm_read_index(TPM_ADDR, 0x01) != 1)
> > > +   return 1;
> > > +
> > > +   /* This is an atmel supported part */
> > > +   return 0;
> > > +}
> > > +
> > > +/* Determine where to talk to device */
> > > +static void __iomem * atmel_get_base_addr(unsigned long *base, int 
> > > *region_size)
> > > +{
> > > +   int lo, hi;
> > > +
> > > +   if (atmel_verify_tpm11() != 0)
> > > +   return NULL;
> > > +
> > > +   lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO);
> > > +   hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI);
> > > +
> > > +   *base = (hi << 8) | lo;
> > > +   *region_size = 2;
> > > +
> > > +   return ioport_map(*base, *region_size);
>

Re: [PATCH v2] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-15 Thread Rob Herring
On Mon, Jul 15, 2024 at 2:08 AM Amit Machhiwal  wrote:
>
> With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> of a PCI device attached to a PCI-bridge causes following kernel Oops on
> a pseries KVM guest:
>
>  RTAS: event: 2, Type: Hotplug Event (229), Severity: 1
>  Kernel attempted to read user page (10ec0048) - exploit attempt? (uid: 0)
>  BUG: Unable to handle kernel data access on read at 0x10ec0048
>  Faulting instruction address: 0xc12d8728
>  Oops: Kernel access of bad area, sig: 11 [#1]
>  LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
> 
>  NIP [c12d8728] __of_changeset_entry_invert+0x10/0x1ac
>  LR [c12da7f0] __of_changeset_revert_entries+0x98/0x180
>  Call Trace:
>  [cbcc3970] [c12daa60] of_changeset_revert+0x58/0xd8
>  [cbcc39c0] [c0d0ed78] of_pci_remove_node+0x74/0xb0
>  [cbcc39f0] [c0cdcfe0] pci_stop_bus_device+0xf4/0x138
>  [cbcc3a30] [c0cdd140] 
> pci_stop_and_remove_bus_device_locked+0x34/0x64
>  [cbcc3a60] [c0cf3780] remove_store+0xf0/0x108
>  [cbcc3ab0] [c0e89e04] dev_attr_store+0x34/0x78
>  [cbcc3ad0] [c07f8dd4] sysfs_kf_write+0x70/0xa4
>  [cbcc3af0] [c07f7248] kernfs_fop_write_iter+0x1d0/0x2e0
>  [cbcc3b40] [c06c9b08] vfs_write+0x27c/0x558
>  [cbcc3bf0] [c06ca168] ksys_write+0x90/0x170
>  [cbcc3c40] [c0033248] system_call_exception+0xf8/0x290
>  [cbcc3e50] [c000d05c] system_call_vectored_common+0x15c/0x2ec
> 
>
> A git bisect pointed this regression to be introduced via [1] that added
> a mechanism to create device tree nodes for parent PCI bridges when a
> PCI device is hot-plugged.
>
> The Oops is caused when `pci_stop_dev()` tries to remove a non-existing
> device-tree node associated with the pci_dev that was earlier
> hot-plugged and was attached under a pci-bridge. The PCI dev header
> `dev->hdr_type` being 0, results a conditional check done with
> `pci_is_bridge()` into false. Consequently, a call to
> `of_pci_make_dev_node()` to create a device node is never made. When at
> a later point in time, in the device node removal path, a memcpy is
> attempted in `__of_changeset_entry_invert()`; since the device node was
> never created, results in an Oops due to kernel read access to a bad
> address.
>
> To fix this issue, the patch updates `of_changeset_create_node()` to
> allocate a new node only when the device node doesn't exist and init it
> in case it does already. Also, introduce `of_pci_free_node()` to be
> called to only revert and destroy the changeset device node that was
> created via a call to `of_changeset_create_node()`.
>
> [1] commit 407d1a51921e ("PCI: Create device tree node for bridge")
>
> Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
> Reported-by: Kowshik Jois B S 
> Signed-off-by: Lizhi Hou 
> Signed-off-by: Amit Machhiwal 
> ---
> Changes since v1:
> * Included Lizhi's suggested changes on V1
> * Fixed below two warnings from Lizhi's changes and rearranged the cleanup
>   part a bit in `of_pci_make_dev_node`
> drivers/pci/of.c:611:6: warning: no previous prototype for 
> ‘of_pci_free_node’ [-Wmissing-prototypes]
>   611 | void of_pci_free_node(struct device_node *np)
>   |  ^~~~
> drivers/pci/of.c: In function ‘of_pci_make_dev_node’:
> drivers/pci/of.c:696:1: warning: label ‘out_destroy_cset’ defined but 
> not used [-Wunused-label]
>   696 | out_destroy_cset:
>   | ^~~~
> * V1: 
> https://lore.kernel.org/all/20240703141634.2974589-1-amach...@linux.ibm.com/
>
>  drivers/of/dynamic.c  | 16 
>  drivers/of/unittest.c |  2 +-
>  drivers/pci/bus.c |  3 +--
>  drivers/pci/of.c  | 39 ++-
>  drivers/pci/pci.h |  2 ++
>  include/linux/of.h|  1 +
>  6 files changed, 43 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
> index dda6092e6d3a..9bba5e82a384 100644
> --- a/drivers/of/dynamic.c
> +++ b/drivers/of/dynamic.c
> @@ -492,21 +492,29 @@ struct device_node *__of_node_dup(const struct 
> device_node *np,
>   * a given changeset.
>   *
>   * @ocs: Pointer to changeset
> + * @np: Pointer to device node. If null, allocate a new node. If not, init an
> + * existing one.
>   * @parent: Pointer to parent device node
>   * @full_name: Node full name
>   *
>   * Return: Pointer to the created device node or NULL in case of an error.
>   */
>  struct device_node *of_changeset_create_node(struct of_changeset *ocs,
> +struct device_node *np,
>  struct device_node *parent,
>  const char *full_name)
>  {
> -   struct device_node *np;
> int ret;
>
> 

Re: [PATCH] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-11 Thread Rob Herring
+Ubuntu kernel team

On Thu, Jul 11, 2024 at 8:21 AM Amit Machhiwal  wrote:
>
> Hi Rob,
>
> On 2024/07/11 06:20 AM, Rob Herring wrote:
> > On Wed, Jul 3, 2024 at 8:17 AM Amit Machhiwal  
> > wrote:
> > >
> > > With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> > > of a PCI device attached to a PCI-bridge causes following kernel Oops on
> > > a pseries KVM guest:
> >
> > Can I ask why you have this option on in the first place? Do you have
> > a use for it or it's just a case of distros turn on every kconfig
> > option.
>
> Yes, this option is turned on in Ubuntu's distro kernel config where the issue
> was originally reported, while Fedora is keeping this turned off.
>
> root@ubuntu:~# cat /boot/config-6.8.0-38-generic | grep PCI_DYN
> CONFIG_PCI_DYNAMIC_OF_NODES=y

Ubuntu should turn off this option. For starters, it is not complete
to be usable. Eventually, it should get removed in favor of some TBD
runtime option.

(And we should fix the crash too)

Rob


Re: [PATCH] PCI: Fix crash during pci_dev hot-unplug on pseries KVM guest

2024-07-11 Thread Rob Herring
On Wed, Jul 3, 2024 at 8:17 AM Amit Machhiwal  wrote:
>
> With CONFIG_PCI_DYNAMIC_OF_NODES [1], a hot-plug and hot-unplug sequence
> of a PCI device attached to a PCI-bridge causes following kernel Oops on
> a pseries KVM guest:

Can I ask why you have this option on in the first place? Do you have
a use for it or it's just a case of distros turn on every kconfig
option.

Rob


Re: [PowerPC] [PASEMI] Issue with the identification of ATA drives after the of/irq updates 2024-05-29

2024-07-10 Thread Rob Herring
On Tue, Jul 9, 2024 at 9:53 PM Christian Zigotzky
 wrote:
>
> Hi All,
>
> The RC7 of kernel 6.10 boots without any problems [1] if we use the
> second irq patch [2]. Is it possible to add this patch to the mainline
> kernel?

Yes, sent it to Linus yesterday.

Rob


Re: [PATCH 1/2] dt-bindings: soc: fsl: Add fsl,ls1028a-reset for reset syscon node

2024-07-08 Thread Rob Herring (Arm)


On Wed, 03 Jul 2024 14:08:11 -0400, Frank Li wrote:
> ls1028a has a reset module that includes reboot, reset control word, and
> service processor control.
> 
> Add platform specific compatible string to fix the below warning.
> 
> syscon@1e6: compatible: 'anyOf' conditional failed, one must be fixed:
> ['syscon'] is too short
> 'syscon' is not one of ['al,alpine-sysfabric-service', ...]
> 
> Signed-off-by: Frank Li 
> ---
>  .../bindings/soc/fsl/fsl,ls1028a-reset.yaml| 56 
> ++
>  1 file changed, 56 insertions(+)
> 

Applied, thanks!



Re: [PATCH 1/2] dt-bindings: soc: fsl: cpm_qe: convert to yaml format

2024-07-08 Thread Rob Herring (Arm)


On Wed, 03 Jul 2024 12:49:39 -0400, Frank Li wrote:
> Convert binding doc qe.txt to yaml format. Split it to
> fsl,qe-firmware.yaml, fsl,qe-ic.yaml, fsl,qe-muram.yaml, fsl,qe-si.yaml
> fsl,qe-siram.yaml, fsl,qe.yaml.
> 
> Additional Changes:
> - Fix error in example.
> - Change to low case for hex value.
> - Remove fsl,qe-num-riscs and fsl,qe-snums from required list.
> - Add #address-cell and #size-cell.
> - Add interrupts description for qe-ic.
> - Add compatible string fsl,ls1043-qe-si for fsl,qe-si.yaml
> - Add compatible string fsl,ls1043-qe-siram for fsl,qe-siram.yaml
> - Add child node for fsl,qe.yaml
> 
> Fix below warning:
> arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dtb: 
> /soc/uqe@240/muram@1: failed to match any schema with compatible: 
> ['fsl,qe-muram', 'fsl,cpm-muram']
> arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dtb: 
> /soc/uqe@240/muram@1: failed to match any schema with compatible: 
> ['fsl,qe-muram', 'fsl,cpm-muram']
> arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dtb: 
> /soc/uqe@240/muram@1/data-only@0: failed to match any schema with 
> compatible: ['fsl,qe-muram-data', 'fsl,cpm-muram-data']
> arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dtb: /soc/uqe@240: failed 
> to match any schema with compatible: ['fsl,qe', 'simple-bus']
> arch/arm64/boot/dts/freescale/fsl-ls1043a-rdb.dtb: 
> /soc/uqe@240/muram@1/data-only@0: failed to match any schema with 
> compatible: ['fsl,qe-muram-data', 'fsl,cpm-muram-data']
> arch/arm64/boot/dts/freescale/fsl-ls1043a-qds.dtb: /soc/uqe@240/qeic@80: 
> failed to match any schema with compatible: ['fsl,qe-ic']
> 
> Signed-off-by: Frank Li 
> ---
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-firmware.yaml   |  48 ++
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-ic.yaml |  47 ++
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-muram.yaml  |  71 
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-si.yaml |  40 +
>  .../bindings/soc/fsl/cpm_qe/fsl,qe-siram.yaml  |  39 +
>  .../devicetree/bindings/soc/fsl/cpm_qe/fsl,qe.yaml | 148 +
>  .../devicetree/bindings/soc/fsl/cpm_qe/qe.txt  | 178 
> -
>  7 files changed, 393 insertions(+), 178 deletions(-)
> 

Applied, thanks!



Re: [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge

2024-07-08 Thread Rob Herring (Arm)


On Thu, 27 Jun 2024 10:31:02 +0200, Elinor Montmasson wrote:
> The S/PDIF audio card support with compatible "fsl,imx-audio-spdif"
> was merged from imx-spdif into the fsl-asoc-card driver.
> It makes possible to use an S/PDIF with an ASRC.
> 
> This merge introduces new DT bindings to use with compatible
> "fsl,imx-audio-spdif" to follow the way fsl-asoc-card works:
> * the "spdif-controller" property from imx-spdif is named "audio-cpu"
>   in fsl-asoc-card.
> * fsl-asoc-card uses codecs explicitly declared in DT
>   with "audio-codec".
>   With an SPDIF, codec drivers spdif_transmitter and
>   spdif_receiver should be used.
>   Driver imx-spdif used instead the dummy codec and a pair of
>   boolean properties, "spdif-in" and "spdif-out".
> 
> In an upcoming commit, in-tree DTs will be modified to follow these new
> properties:
> * Property "spdif-controller" will be renamed "audio-cpu".
> * spdif_transmitter and spdif_receiver nodes will be declared
>   and linked to the fsl-asoc-card node with the property "audio-codec".
> 
> To keep backward compatibility with other DTs, support for
> "spdif-controller", "spdif-in" and "spdif-out" properties is kept.
> However, it is recommended to use the new properties if possible.
> It is better to declare transmitter and/or receiver
> in DT than using the dummy codec.
> 
> DTs using compatible "fsl,imx-audio-spdif" are still supported, and
> fsl-asoc-card will behave the same as imx-spdif for these DTs.
> 
> Signed-off-by: Elinor Montmasson 
> ---
>  .../bindings/sound/fsl,imx-audio-spdif.yaml   | 66 -------
>  .../bindings/sound/fsl-asoc-card.yaml | 53 +--
>  2 files changed, 49 insertions(+), 70 deletions(-)
>  delete mode 100644 
> Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
> 

Reviewed-by: Rob Herring (Arm) 



Re: [PATCH 00/20] Simplify of_property_for_each_u32()

2024-07-03 Thread Rob Herring
On Wed, Jul 03, 2024 at 12:36:44PM +0200, Luca Ceresoli wrote:
> [Note: to reduce the noise I have trimmed the get_maintainers list
> manually. Should you want to be removed, or someone else added, to future
> versions, just tell me. Sorry for the noise.]
> 
> This series aims at simplifying of_property_for_each_u32() as well as
> making it more difficult to misuse it in the future.
> 
> The long-term goal is changing this pattern:
> 
>   struct property *prop;
>   const __be32 *p;
>   u32 val;
>  
>   of_property_for_each_u32(np, "xyz", prop, p, val) { ... }
> 
> to this:
> 
>   u32 val;
> 
>   of_property_for_each_u32(np, "xyz", val) { ... }
> 
> So, removing the 3rd and 4th arguments which are typically meant to be
> internal. Those two parameters used to be unavoidable until the kernel
> moved to building with the C11 standard unconditionally. Since then, it is
> now possible to get rid of them. However a few users of
> of_property_for_each_u32() do actually use those arguments, which
> complicates the transition. For this reason this series does the following:
> 
>  * Add of_property_for_each_u32_new(), which does not have those two
>arguments (patch 1)
>  * Convert _almost_ every usage to of_property_for_each_u32_new()
>  * Rename of_property_for_each_u32() to of_property_for_each_u32_old() and
>deprecate it, as a incentive to code not (yet) in mainline to upgrade
>to the *_new() version (last patch)

I don't really see the point of introducing the _old variant. Let's get 
this done in one step.

> 
> The plan for the next series is to additionally:
> 
>  * Convert the few remaining of_property_for_each_u32_old() instantes to
>of_property_for_each_u32_new()
>  * Remove of_property_for_each_u32_old()
>  * Rename of_property_for_each_u32_new() to of_property_for_each_u32()

Honestly, I think there's few enough users we could just convert the 
whole thing in one patch. It's all got to go thru 1 tree anyways. If 
there's new cases in -next, then I'd be happy to send it to Linus at the 
end of the merge window.

Rob


Re: [PATCH 20/20] of: deprecate and rename of_property_for_each_u32()

2024-07-03 Thread Rob Herring
On Wed, Jul 03, 2024 at 12:37:04PM +0200, Luca Ceresoli wrote:
> of_property_for_each_u32() is meant to disappear. All the call sites not
> using the 3rd and 4th arguments have already been replaced by
> of_property_for_each_u32_new().
> 
> Deprecate the old macro. Also rename it to minimize the number of new
> usages and encourage conversion to the of_property_for_each_u32_new() macro
> in not(-yet)-upstream code.
> 
> Signed-off-by: Luca Ceresoli 
> 
> ---
> 
> Notes:
> 
>  * The following files have not been build-tested simply because I haven't
>managed to have a config that enables them so far:
> 
>  drivers/irqchip/irq-pic32-evic.c
>  drivers/pinctrl/pinctrl-k210.c
> 
>  * These have not been converted yet as they are not trivial, and they will
>need to use a more specific function that does the lookup they need and
>returns the result:
> 
>  drivers/clk/clk-si5351.c

I would do something like this:

sz = of_property_read_variable_u32_array(np, "silabs,pll-source", 
array, 2, 4);
if (sz >= 2)
pdata->pll_src[array[0]] = val_to_src(array[1]);
if (sz >= 4)
pdata->pll_src[array[2]] = val_to_src(array[3]);


>  drivers/clk/clk.c

Wouldn't this work:

8<--

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 8cca52be993f..33a8cc193556 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5371,6 +5371,7 @@ const char *of_clk_get_parent_name(const struct 
device_node *np, int index)
int rc;
int count;
struct clk *clk;
+   bool found = false;
 
rc = of_parse_phandle_with_args(np, "clocks", "#clock-cells", index,
&clkspec);
@@ -5383,15 +5384,16 @@ const char *of_clk_get_parent_name(const struct 
device_node *np, int index)
/* if there is an indices property, use it to transfer the index
 * specified into an array offset for the clock-output-names property.
 */
-   of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) {
+   of_property_for_each_u32_new(clkspec.np, "clock-indices", pv) {
if (index == pv) {
index = count;
+   found = true;
break;
}
count++;
}
/* We went off the end of 'clock-indices' without finding it */
-   if (prop && !vp)
+   if (of_property_present(clkspec.np, "clock-indices") && !found)
return NULL;
 
if (of_property_read_string_index(clkspec.np, "clock-output-names",


[PATCH] powerpc: kexec: Use of_property_read_reg()

2024-07-02 Thread Rob Herring (Arm)
Replace open-coded parsing of "reg" property with
of_property_read_reg().

Signed-off-by: Rob Herring (Arm) 
---
 arch/powerpc/kexec/file_load_64.c | 31 ++-
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/kexec/file_load_64.c 
b/arch/powerpc/kexec/file_load_64.c
index 925a69ad2468..5200529bf4db 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -376,10 +377,9 @@ static int kdump_setup_usable_lmb(struct drmem_lmb *lmb, 
const __be32 **usm,
 static int add_usable_mem_property(void *fdt, struct device_node *dn,
   struct umem_info *um_info)
 {
-   int n_mem_addr_cells, n_mem_size_cells, node;
+   int node;
char path[NODE_PATH_LEN];
-   int i, len, ranges, ret;
-   const __be32 *prop;
+   int i, ret;
u64 base, end;
 
of_node_get(dn);
@@ -399,40 +399,29 @@ static int add_usable_mem_property(void *fdt, struct 
device_node *dn,
goto out;
}
 
-   /* Get the address & size cells */
-   n_mem_addr_cells = of_n_addr_cells(dn);
-   n_mem_size_cells = of_n_size_cells(dn);
-   kexec_dprintk("address cells: %d, size cells: %d\n", n_mem_addr_cells,
- n_mem_size_cells);
-
um_info->idx  = 0;
if (!check_realloc_usable_mem(um_info, 2)) {
ret = -ENOMEM;
goto out;
}
 
-   prop = of_get_property(dn, "reg", &len);
-   if (!prop || len <= 0) {
-   ret = 0;
-   goto out;
-   }
-
/*
 * "reg" property represents sequence of (addr,size) tuples
 * each representing a memory range.
 */
-   ranges = (len >> 2) / (n_mem_addr_cells + n_mem_size_cells);
+   for (i = 0; ; i++) {
+   ret = of_property_read_reg(dn, i, &base, &end);
+   if (ret)
+   break;
 
-   for (i = 0; i < ranges; i++) {
-   base = of_read_number(prop, n_mem_addr_cells);
-   prop += n_mem_addr_cells;
-   end = base + of_read_number(prop, n_mem_size_cells) - 1;
-   prop += n_mem_size_cells;
+   end += base - 1;
 
ret = add_usable_mem(um_info, base, end);
if (ret)
goto out;
}
+   if (!i)
+   goto out;
 
/*
 * No kdump kernel usable memory found in this memory node.
-- 
2.43.0



Re: [PowerPC] [PASEMI] Issue with the identification of ATA drives after the of/irq updates 2024-05-29

2024-07-02 Thread Rob Herring
On Tue, Jul 2, 2024 at 10:54 AM Marc Zyngier  wrote:
>
> On Sun, 30 Jun 2024 11:21:55 +0100,
> Christian Zigotzky  wrote:
> >
> > Hello,
> >
> > There is an issue with the identification of ATA drives with our
> > P.A. Semi Nemo boards [1] after the
> > commit "of/irq: Factor out parsing of interrupt-map parent
> > phandle+args from of_irq_parse_raw()" [2].
>
> [snip]
>
> My earlier request for valuable debug information still stands. But
> while you're at it, can you please give the following hack a go?
>
> M.
>
> --- a/drivers/of/irq.c
> +++ b/drivers/of/irq.c
> @@ -282,8 +282,10 @@ int of_irq_parse_raw(const __be32 *addr, struct 
> of_phandle_args *out_irq)
>
> oldimap = imap;
> imap = of_irq_parse_imap_parent(oldimap, imaplen, 
> out_irq);
> -   if (!imap)
> -   goto fail;
> +   if (!imap) {
> +   match = 0;
> +   break;
> +   }

AFAICT reading the DT, I don't think this would fix it. imap should
only be null if malformed. This case to me looks like interrupt-map
has the correct cell sizes, but just never matches to do the mapping.
So maybe imaplen is off and that causes us to end up here, but if
there's an error I don't see it. A boot with DEBUG enabled in
drivers/of/irq.c would help.

>
> match &= of_device_is_available(out_irq->np);
> if (match)
>
> This may not be the final workaround even if it solves your boot
> problem, but will at least give us a hint at what is going wrong.
>
> I have the fuzzy feeling that we may be able to lob this broken system
> as part of the of_irq_imap_abusers[] array, which would solve things
> pretty "neatly".

I think this would work and would consolidate the work-arounds. It
would need either "pasemi,rootbus" or "pa-pxp" added to the list.

Rob


[PATCH] tpm: atmel: Drop PPC64 specific MMIO setup

2024-07-02 Thread Rob Herring (Arm)
The PPC64 specific MMIO setup open codes DT address functions rather
than using standard address parsing functions. The open-coded version
fails to handle any address translation and is not endian safe.

I haven't found any evidence of what platform used this. The only thing
that turned up was a PPC405 platform, but that is 32-bit and PPC405
support is being removed as well. CONFIG_TCG_ATMEL is not enabled for
any powerpc config and never was. The support was added in 2005 and
hasn't been touched since.

Rather than try to modernize and fix this code, just remove it.

Signed-off-by: Rob Herring (Arm) 
---
 drivers/char/tpm/Kconfig |   2 +-
 drivers/char/tpm/tpm_atmel.c |  64 +++-
 drivers/char/tpm/tpm_atmel.h | 140 ---
 3 files changed, 62 insertions(+), 144 deletions(-)
 delete mode 100644 drivers/char/tpm/tpm_atmel.h

diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index e63a6a17793c..9b655e9fc7ab 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -162,7 +162,7 @@ config TCG_NSC
 
 config TCG_ATMEL
tristate "Atmel TPM Interface"
-   depends on PPC64 || HAS_IOPORT_MAP
+   depends on HAS_IOPORT_MAP
depends on HAS_IOPORT
help
  If you have a TPM security chip from Atmel say Yes and it 
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index 9fb2defa9dc4..622c4abe8cb3 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -15,7 +15,67 @@
  */
 
 #include "tpm.h"
-#include "tpm_atmel.h"
+
+struct tpm_atmel_priv {
+   int region_size;
+   int have_region;
+   unsigned long base;
+   void __iomem *iobase;
+};
+
+#define atmel_getb(chip, offset) inb(atmel_get_priv(chip)->base + offset)
+#define atmel_putb(val, chip, offset) \
+   outb(val, atmel_get_priv(chip)->base + offset)
+#define atmel_request_region request_region
+#define atmel_release_region release_region
+/* Atmel definitions */
+enum tpm_atmel_addr {
+   TPM_ATMEL_BASE_ADDR_LO = 0x08,
+   TPM_ATMEL_BASE_ADDR_HI = 0x09
+};
+
+static inline int tpm_read_index(int base, int index)
+{
+   outb(index, base);
+   return inb(base+1) & 0xFF;
+}
+
+/* Verify this is a 1.1 Atmel TPM */
+static int atmel_verify_tpm11(void)
+{
+
+   /* verify that it is an Atmel part */
+   if (tpm_read_index(TPM_ADDR, 4) != 'A' ||
+   tpm_read_index(TPM_ADDR, 5) != 'T' ||
+   tpm_read_index(TPM_ADDR, 6) != 'M' ||
+   tpm_read_index(TPM_ADDR, 7) != 'L')
+   return 1;
+
+   /* query chip for its version number */
+   if (tpm_read_index(TPM_ADDR, 0x00) != 1 ||
+   tpm_read_index(TPM_ADDR, 0x01) != 1)
+   return 1;
+
+   /* This is an atmel supported part */
+   return 0;
+}
+
+/* Determine where to talk to device */
+static void __iomem * atmel_get_base_addr(unsigned long *base, int 
*region_size)
+{
+   int lo, hi;
+
+   if (atmel_verify_tpm11() != 0)
+   return NULL;
+
+   lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO);
+   hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI);
+
+   *base = (hi << 8) | lo;
+   *region_size = 2;
+
+   return ioport_map(*base, *region_size);
+}
 
 /* write status bits */
 enum tpm_atmel_write_status {
@@ -142,7 +202,6 @@ static void atml_plat_remove(void)
tpm_chip_unregister(chip);
if (priv->have_region)
atmel_release_region(priv->base, priv->region_size);
-   atmel_put_base_addr(priv->iobase);
platform_device_unregister(pdev);
 }
 
@@ -211,7 +270,6 @@ static int __init init_atmel(void)
 err_unreg_dev:
platform_device_unregister(pdev);
 err_rel_reg:
-   atmel_put_base_addr(iobase);
if (have_region)
atmel_release_region(base,
 region_size);
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h
deleted file mode 100644
index 7ac3f69dcf0f..
--- a/drivers/char/tpm/tpm_atmel.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2005 IBM Corporation
- *
- * Authors:
- * Kylene Hall 
- *
- * Maintained by: 
- *
- * Device driver for TCG/TCPA TPM (trusted platform module).
- * Specifications at www.trustedcomputinggroup.org
- *
- * These difference are required on power because the device must be
- * discovered through the device tree and iomap must be used to get
- * around the need for holes in the io_page_mask.  This does not happen
- * automatically because the tpm is not a normal pci device and lives
- * under the root node.
- */
-
-struct tpm_atmel_priv {
-   int region_size;
-   int have_region;
-   unsigned long base;
-   void __iomem *iobase;
-};
-
-#ifdef CONFIG_PPC64
-
-#include 
-
-#define atmel_get

Re: [PATCH 1/2] ASoC: dt-bindings: fsl_rpmsg: Add compatible string for i.MX95

2024-06-28 Thread Rob Herring (Arm)


On Wed, 26 Jun 2024 16:12:01 +0900, Chancel Liu wrote:
> Add compatible string for i.MX95 platform which supports audio
> function through rpmsg channel between Cortex-A and Cortex-M core.
> 
> Signed-off-by: Chancel Liu 
> ---
>  Documentation/devicetree/bindings/sound/fsl,rpmsg.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring (Arm) 



Re: [PATCH v2 1/1] dt-bindings: soc: fsl: Convert q(b)man-* to yaml format

2024-06-28 Thread Rob Herring (Arm)


On Wed, 26 Jun 2024 15:37:53 -0400, Frank Li wrote:
> Convert qman, bman, qman-portals, bman-portals to yaml format.
> 
> Additional Change for fsl,q(b)man-portal:
> - Only keep one example.
> - Add fsl,qman-channel-id property.
> - Use interrupt type macro.
> - Remove top level qman-portals@ff420 at example.
> 
> Additional change for fsl,q(b)man:
> - Fixed example error.
> - Remove redundent part, only keep fsl,qman node.
> - Change memory-regions to memory-region.
> - fsl,q(b)man-portals is not required property
> 
> Additional change for fsl,qman-fqd.yaml:
> - Fixed example error.
> - Only keep one example.
> - Ref to reserve-memory.yaml
> - Merge fsl,bman reserver memory part
> 
> Signed-off-by: Frank Li 
> ---
> Change from v1 to v2
> - fix typo chang
> - fix typo porta
> - Add | for reg description
> - wrap to 80 for reg descritption
> - memory-region set maxItems: 2
> - fix regex parttern
> - drop  See clock-bindings.txt
> - "see reserved-memory.yaml" change to
> "see reserved-memory/reserved-memory.yaml in dtschema project"
> 
> - A strange thing in fsl,qman-fqd.yaml, if example compatible string
> change to fsl,qman-fqd, dt_binding_check report below error.
>   qman-fqd: False schema does not allow {'compatible': ['fsl,qman-fqd'], 
> 'size': [[4194304]], 'alignment': [[4194304]], 'no-map': True, '$nodename': 
> ['qman-fqd']}
> 
> but I replace "fsl,qman-fqd" with "abc", it pass check.
> ---
>  .../bindings/soc/fsl/bman-portals.txt |  56 --
>  .../devicetree/bindings/soc/fsl/bman.txt  | 137 -
>  .../bindings/soc/fsl/fsl,bman-portal.yaml |  52 +
>  .../devicetree/bindings/soc/fsl/fsl,bman.yaml |  83 
>  .../bindings/soc/fsl/fsl,qman-fqd.yaml|  69 +++
>  .../bindings/soc/fsl/fsl,qman-portal.yaml | 110 +++
>  .../devicetree/bindings/soc/fsl/fsl,qman.yaml |  93 +
>  .../bindings/soc/fsl/qman-portals.txt | 134 -
>  .../devicetree/bindings/soc/fsl/qman.txt  | 187 --
>  9 files changed, 407 insertions(+), 514 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman.txt
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-fqd.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,qman.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman.txt
> 

Applied, thanks!



Re: [PATCH 09/10] dt-bindings: sound: fsl,qmc-audio: Add support for multiple QMC channels per DAI

2024-06-27 Thread Rob Herring (Arm)


On Thu, 20 Jun 2024 10:42:56 +0200, Herve Codina wrote:
> The QMC audio uses one QMC channel per DAI and uses this QMC channel to
> transmit interleaved audio channel samples.
> 
> In order to work in non-interleave mode, a QMC audio DAI needs to use
> multiple QMC channels. In that case, the DAI maps each QMC channel to
> exactly one audio channel.
> 
> Allow QMC audio DAIs with multiple QMC channels attached.
> 
> Signed-off-by: Herve Codina 
> ---
>  .../bindings/sound/fsl,qmc-audio.yaml | 41 ---
>  1 file changed, 35 insertions(+), 6 deletions(-)
> 

Reviewed-by: Rob Herring (Arm) 



Re: [PATCH 1/1] dt-bindings: soc: fsl: Convert q(b)man-* to yaml format

2024-06-24 Thread Rob Herring
On Fri, Jun 21, 2024 at 05:30:14PM -0400, Frank Li wrote:
> Convert qman, bman, qman-portals, bman-portals to yaml format.
> 
> Additional Chang for fsl,q(b)man-portal:

typo

> - Only keep one example.
> - Add fsl,qman-channel-id property.
> - Use interrupt type macro.
> - Remove top level qman-portals@ff420 at example.
> 
> Additional change for fsl,q(b)man:
> - Fixed example error.
> - Remove redundent part, only keep fsl,qman node.
> - Change memory-regions to memory-region.
> - fsl,q(b)man-portals is not required property
> 
> Additional change for fsl,qman-fqd.yaml:
> - Fixed example error.
> - Only keep one example.
> - Ref to reserve-memory.yaml
> - Merge fsl,bman reserver memory part
> 
> Signed-off-by: Frank Li 
> ---
>  .../bindings/soc/fsl/bman-portals.txt |  56 --
>  .../devicetree/bindings/soc/fsl/bman.txt  | 137 -
>  .../bindings/soc/fsl/fsl,bman-portal.yaml |  51 +
>  .../devicetree/bindings/soc/fsl/fsl,bman.yaml |  83 
>  .../bindings/soc/fsl/fsl,qman-fqd.yaml|  68 +++
>  .../bindings/soc/fsl/fsl,qman-portal.yaml | 110 +++
>  .../devicetree/bindings/soc/fsl/fsl,qman.yaml |  97 +
>  .../bindings/soc/fsl/qman-portals.txt | 134 -
>  .../devicetree/bindings/soc/fsl/qman.txt  | 187 --
>  9 files changed, 409 insertions(+), 514 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman.txt
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-fqd.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,qman.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman.txt


> diff --git a/Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml
> new file mode 100644
> index 0..06b51f049098f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/fsl,bman-portal.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: QorIQ DPAA Queue Manager Portals
> +
> +maintainers:
> +  - Frank Li 
> +
> +description:
> +  QorIQ DPAA Buffer Manager Portal
> +
> +  Portals are memory mapped interfaces to BMan that allow low-latency, 
> lock-less
> +  interaction by software running on processor cores, accelerators and 
> network
> +  interfaces with the BMan
> +
> +properties:
> +  compatible:
> +oneOf:
> +  - const: fsl,bman-portal
> +  - items:
> +  - enum:
> +  - fsl,ls1043a-bmap-portal
> +  - fsl,ls1046a-bmap-portal
> +  - const: fsl,bman-portal
> +  reg:
> +items:
> +  - description: the cache-enabled region of the portal
> +  - description: the cache-inhibited region of the porta

typo

> +
> +  interrupts:
> +maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +#include 
> +
> +bman-portal@0 {
> +compatible = "fsl,bman-portal-1.0.0", "fsl,bman-portal";
> +reg = <0x0 0x4000>, <0x10 0x1000>;
> +interrupts = <105 IRQ_TYPE_EDGE_FALLING 0 0>;
> +};
> diff --git a/Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml 
> b/Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml
> new file mode 100644
> index 0..e6b3d489ce5cc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml
> @@ -0,0 +1,83 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/fsl/fsl,bman.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: QorIQ DPAA Buffer Manager
> +
> +maintainers:
> +  - Frank Li 
> +
> +description:
> +  The Buffer Manager is part of the Data-Path Acceleration Architecture 
> (DPAA).
> +  BMan supports hardware allocation and deallocation of buffers belonging to 
> pools
> +  originally created by software with configurable depletion thresholds. This
> +  binding covers the CCSR space programming model
> +
> +properties:
> +  compatible:
> +oneOf:
> +  - const: fsl,bman
> +  - items:
> +  - enum:
> +  - fsl,ls1043a-bman
> +  - fsl,ls1046a-bman
> +  - const: fsl,bman
> +
> +  reg:
> +items:
> +  - description:

Needs '|' if you want formatting preserved.


Re: [PATCH 1/1] dt-bindings: soc: fsl: Convert q(b)man-* to yaml format

2024-06-21 Thread Rob Herring (Arm)


On Fri, 21 Jun 2024 17:30:14 -0400, Frank Li wrote:
> Convert qman, bman, qman-portals, bman-portals to yaml format.
> 
> Additional Chang for fsl,q(b)man-portal:
> - Only keep one example.
> - Add fsl,qman-channel-id property.
> - Use interrupt type macro.
> - Remove top level qman-portals@ff420 at example.
> 
> Additional change for fsl,q(b)man:
> - Fixed example error.
> - Remove redundent part, only keep fsl,qman node.
> - Change memory-regions to memory-region.
> - fsl,q(b)man-portals is not required property
> 
> Additional change for fsl,qman-fqd.yaml:
> - Fixed example error.
> - Only keep one example.
> - Ref to reserve-memory.yaml
> - Merge fsl,bman reserver memory part
> 
> Signed-off-by: Frank Li 
> ---
>  .../bindings/soc/fsl/bman-portals.txt |  56 --
>  .../devicetree/bindings/soc/fsl/bman.txt  | 137 -
>  .../bindings/soc/fsl/fsl,bman-portal.yaml |  51 +
>  .../devicetree/bindings/soc/fsl/fsl,bman.yaml |  83 
>  .../bindings/soc/fsl/fsl,qman-fqd.yaml|  68 +++
>  .../bindings/soc/fsl/fsl,qman-portal.yaml | 110 +++
>  .../devicetree/bindings/soc/fsl/fsl,qman.yaml |  97 +
>  .../bindings/soc/fsl/qman-portals.txt | 134 -
>  .../devicetree/bindings/soc/fsl/qman.txt  | 187 --
>  9 files changed, 409 insertions(+), 514 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/bman.txt
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-fqd.yaml
>  create mode 100644 
> Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/fsl/fsl,qman.yaml
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman-portals.txt
>  delete mode 100644 Documentation/devicetree/bindings/soc/fsl/qman.txt
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/soc/fsl/fsl,bman-portal.example.dtb: 
/example-0/bman-portal@0: failed to match any schema with compatible: 
['fsl,bman-portal-1.0.0', 'fsl,bman-portal']

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240621213031.2759046-1-frank...@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.



Re: [Patch v4 02/10] dt-bindings: dma: Add lpc32xx DMA mux binding

2024-06-20 Thread Rob Herring (Arm)


On Thu, 20 Jun 2024 19:56:33 +0200, Piotr Wojtaszczyk wrote:
> LPC32XX SoCs use pl080 dma controller which have few request signals
> multiplexed between peripherals. This binding describes how devices can
> use the multiplexed request signals.
> 
> Signed-off-by: Piotr Wojtaszczyk 
> ---
> Changes for v4:
> - This patch is new in v4
> 
>  .../bindings/dma/nxp,lpc3220-dmamux.yaml  | 56 +++
>  MAINTAINERS   |  9 +++
>  2 files changed, 65 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/dma/nxp,lpc3220-dmamux.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/dma/nxp,lpc3220-dmamux.example.dtb: 
/example-0/syscon@40004000: failed to match any schema with compatible: 
['nxp,lpc3220-creg', 'syscon', 'simple-mfd']

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240620175657.358273-3-piotr.wojtaszc...@timesys.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.



Re: [Patch v2 2/2] ASoC: dt-bindings: lpc32xx: Add lpc32xx i2s DT binding

2024-06-11 Thread Rob Herring (Arm)


On Tue, 11 Jun 2024 11:47:52 +0200, Piotr Wojtaszczyk wrote:
> Add nxp,lpc3220-i2s DT binding documentation.
> 
> Signed-off-by: Piotr Wojtaszczyk 
> ---
> Changes for v2:
> - Added maintainers field
> - Dropped clock-names
> - Dropped unused unneded interrupts field
> 
>  .../bindings/sound/nxp,lpc3220-i2s.yaml   | 47 +++
>  1 file changed, 47 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/sound/nxp,lpc3220-i2s.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/nxp,lpc3220-i2s.example.dtb:
 i2s@20094000: 'clock-names' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: 
http://devicetree.org/schemas/sound/nxp,lpc3220-i2s.yaml#

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240611094810.27475-2-piotr.wojtaszc...@timesys.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.



Re: [PATCH v4 1/2] ASoC: dt-bindings: fsl,xcvr: Add compatible string for i.MX95

2024-06-03 Thread Rob Herring (Arm)


On Wed, 29 May 2024 16:40:01 +0800, Shengjiu Wang wrote:
> Add compatible string "fsl,imx95-xcvr" for i.MX95 platform.
> 
> The difference between each platform is in below table.
> 
> +-++--++
> |  SOC  |  PHY   | eARC/ARC | SPDIF  |
> +-++--++
> | i.MX8MP |  V1|  Yes |  Yes   |
> +-++--++
> | i.MX93  |  N/A   |  N/A |  Yes   |
> +-++--++
> | i.MX95  |  V2|  N/A |  Yes   |
> +-++--++
> 
> On i.MX95, there are two PLL clock sources, they are the parent
> clocks of the XCVR root clock. one is for 8kHz series rates, named
> as 'pll8k', another one is for 11kHz series rates, named as 'pll11k'.
> They are optional clocks, if there are such clocks, then the driver
> can switch between them to support more accurate sample rates.
> 
> As 'pll8k' and 'pll11k' are optional, then add 'minItems: 4' for
> clocks and clock-names properties.
> 
> On i.MX95, the 'interrupts' configuration has the same constraint
> as i.MX93.
> 
> Only on i.MX8MP, the 'resets' is required, but for i.MX95 and i.MX93
> there is no such hardware setting.
> 
> Signed-off-by: Shengjiu Wang 
> ---
>  .../devicetree/bindings/sound/fsl,xcvr.yaml   | 32 ++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring (Arm) 



Re: [PATCH v2 1/2] ASoC: dt-bindings: fsl,mqs: Add i.MX95 platform support

2024-05-28 Thread Rob Herring (Arm)


On Wed, 22 May 2024 11:08:24 +0800, Shengjiu Wang wrote:
> There are two MQS instances on the i.MX95 platform.
> The definition of bit positions in the control register are
> different. In order to support these MQS modules, define
> two compatible strings to distinguish them.
> 
> As one instance is in the always-on domain, another is in the
> net controller domain, so the compatible strings are
> "fsl,imx95-aonmix-mqs", "fsl,imx95-netcmix-mqs".
> 
> Signed-off-by: Shengjiu Wang 
> ---
>  Documentation/devicetree/bindings/sound/fsl,mqs.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 

Reviewed-by: Rob Herring (Arm) 



Re: [PATCH v3 1/2] ASoC: dt-bindings: fsl,xcvr: Add compatible string for i.MX95

2024-05-28 Thread Rob Herring
On Tue, May 21, 2024 at 06:13:35PM +0800, Shengjiu Wang wrote:
> Add compatible string "fsl,imx95-xcvr" for i.MX95 platform.
> 
> The difference between each platform is in below table.
> 
> +-++--++
> |  SOC  |  PHY   | eARC/ARC | SPDIF  |
> +-++--++
> | i.MX8MP |  V1|  Yes |  Yes   |
> +-++--++
> | i.MX93  |  N/A   |  N/A |  Yes   |
> +-++--++
> | i.MX95  |  V2|  N/A |  Yes   |
> +-++--++
> 
> On i.MX95, there are two PLL clock sources, they are the parent
> clocks of the XCVR root clock. one is for 8kHz series rates, named
> as 'pll8k', another one is for 11kHz series rates, named as 'pll11k'.
> They are optional clocks, if there are such clocks, then the driver
> can switch between them to support more accurate sample rates.
> 
> As 'pll8k' and 'pll11k' are optional, then add 'minItems: 4' for
> clocks and clock-names properties.
> 
> On i.MX95, the 'interrupts' configuration has the same constraint
> as i.MX93.
> 
> Only on i.MX8MP, the 'resets' is required, but for i.MX95 and i.MX93
> there is no such hardware setting.
> 
> Signed-off-by: Shengjiu Wang 
> ---
>  .../devicetree/bindings/sound/fsl,xcvr.yaml   | 37 ++-
>  1 file changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml 
> b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> index 0eb0c1ba8710..d1dcc27655eb 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> +++ b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> @@ -22,6 +22,7 @@ properties:
>  enum:
>- fsl,imx8mp-xcvr
>- fsl,imx93-xcvr
> +  - fsl,imx95-xcvr
>  
>reg:
>  items:
> @@ -49,6 +50,9 @@ properties:
>- description: PHY clock
>- description: SPBA clock
>- description: PLL clock
> +  - description: PLL clock source for 8kHz series
> +  - description: PLL clock source for 11kHz series
> +minItems: 4
>  
>clock-names:
>  items:
> @@ -56,6 +60,9 @@ properties:
>- const: phy
>- const: spba
>- const: pll_ipg
> +  - const: pll8k
> +  - const: pll11k
> +minItems: 4
>  
>dmas:
>  items:
> @@ -79,15 +86,24 @@ required:
>- clock-names
>- dmas
>- dma-names
> -  - resets
>  
>  allOf:
> +  - if:
> +  properties:
> +compatible:
> +  contains:
> +const: fsl,imx8mp-xcvr
> +then:
> +  required:
> +- resets
> +
>- if:
>properties:
>  compatible:
>contains:
>  enum:
>- fsl,imx93-xcvr
> +  - fsl,imx95-xcvr
>  then:
>properties:
>  interrupts:
> @@ -98,6 +114,25 @@ allOf:
>  interrupts:
>maxItems: 1
>  
> +  - if:
> +  properties:
> +compatible:
> +  contains:
> +enum:
> +  - fsl,imx95-xcvr
> +then:
> +  properties:
> +clocks:
> +  maxItems: 6
> +clock-names:
> +  maxItems: 6

6 is already the max. Drop these and add a 'not' into the if schema (or 
list out the other compatibles).

> +else:
> +  properties:
> +clocks:
> +  maxItems: 4
> +clock-names:
> +  maxItems: 4
> +
>  additionalProperties: false
>  
>  examples:
> -- 
> 2.34.1
> 


Re: [PATCHv4 9/9] ASoC: dt-bindings: fsl-asoc-card: add compatible for generic codec

2024-05-20 Thread Rob Herring
On Wed, May 15, 2024 at 03:54:11PM +0200, Elinor Montmasson wrote:
> Add documentation about new dts bindings following new support
> for compatible "fsl,imx-audio-generic".
> 
> Some CPU DAI don't require a real audio codec. The new compatible
> "fsl,imx-audio-generic" allows using the driver with codec drivers
> SPDIF DIT and SPDIF DIR as dummy codecs.
> It also allows using not pre-configured audio codecs which
> don't require specific control through a codec driver.
> 
> The new dts properties give the possibility to set some parameters
> about the CPU DAI usually set through the codec configuration.
> 
> Signed-off-by: Elinor Montmasson 
> ---
>  .../bindings/sound/fsl-asoc-card.yaml | 96 ++-
>  1 file changed, 92 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml 
> b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> index 9922664d5ccc..332d8bf96e06 100644
> --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> @@ -23,6 +23,16 @@ description:
>and PCM DAI formats. However, it'll be also possible to support those non
>AC'97/I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, as
>long as the driver has been properly upgraded.
> +  To use CPU DAIs that do not require a codec such as an S/PDIF controller,
> +  or to use a DAI to output or capture raw I2S/TDM data, you can
> +  use the compatible "fsl,imx-audio-generic".
> +
> +definitions:
> +  imx-audio-generic-dependency:
> +properties:
> +  compatible:
> +contains:
> +  const: fsl,imx-audio-generic
>  
>  maintainers:
>- Shengjiu Wang 
> @@ -81,6 +91,7 @@ properties:
>- fsl,imx-audio-wm8960
>- fsl,imx-audio-wm8962
>- fsl,imx-audio-wm8958
> +  - fsl,imx-audio-generic
>  
>model:
>  $ref: /schemas/types.yaml#/definitions/string
> @@ -93,8 +104,14 @@ properties:
>need to add ASRC support via DPCM.
>  
>audio-codec:
> -$ref: /schemas/types.yaml#/definitions/phandle
> -description: The phandle of an audio codec
> +$ref: /schemas/types.yaml#/definitions/phandle-array
> +description: |
> +  The phandle of an audio codec.
> +  If using the "fsl,imx-audio-generic" compatible, give instead a pair of
> +  phandles with the spdif_transmitter first (driver SPDIF DIT) and the
> +  spdif_receiver second (driver SPDIF DIR).

   minItems: 1
   maxItems: 2

> +items:
> +  maxItems: 1
>  
>audio-cpu:
>  $ref: /schemas/types.yaml#/definitions/phandle
> @@ -150,8 +167,8 @@ properties:
>  description: dai-link uses bit clock inversion.
>  
>mclk-id:
> -$ref: /schemas/types.yaml#/definitions/uint32
> -description: main clock id, specific for each card configuration.
> +$ref: /schemas/types.yaml#/definitions/uint32-array
> +description: Main clock id for each codec, specific for each card 
> configuration.

   minItems: 1
   maxItems: 2
>  
>mux-int-port:
>  $ref: /schemas/types.yaml#/definitions/uint32
> @@ -167,10 +184,68 @@ properties:
>  $ref: /schemas/types.yaml#/definitions/phandle
>  description: The phandle of an CPU DAI controller
>  
> +  # Properties relevant only with "fsl,imx-audio-generic" compatible
> +  dai-tdm-slot-width:
> +description: See tdm-slot.txt.
> +$ref: /schemas/types.yaml#/definitions/uint32
> +
> +  dai-tdm-slot-num:
> +description: See tdm-slot.txt.
> +$ref: /schemas/types.yaml#/definitions/uint32
> +
> +  clocks:
> +description: |
> +  The CPU DAI system clock, used to retrieve
> +  the CPU DAI system clock frequency with the generic codec.
> +maxItems: 1
> +
> +  clock-names:
> +items:
> +  - const: cpu_sysclk
> +
> +  cpu-system-clock-direction-out:
> +description: |
> +  Specifies cpu system clock direction as 'out' on initialization.
> +  If not set, direction is 'in'.
> +$ref: /schemas/types.yaml#/definitions/flag
> +
> +dependencies:
> +  dai-tdm-slot-width:
> +$ref: "#/definitions/imx-audio-generic-dependency"
> +  dai-tdm-slot-num:
> +$ref: "#/definitions/imx-audio-generic-dependency"
> +  clocks:
> +$ref: "#/definitions/imx-audio-generic-dependency"
> +  cpu-system-clock-direction-out:
> +$ref: "#/definitions/imx-audio-generic-dependency"

This works, but is an unusual pattern...

> +
>  required:
>- compatible
>- model
>  
> +allOf:
> +  - if:
> +  $ref: "#/definitions/imx-audio-generic-dependency"
> +then:
> +  properties:
> +audio-codec:
> +  items:
> +- description: SPDIF DIT phandle
> +- description: SPDIF DIR phandle
> +mclk-id:
> +  maxItems: 1
> +  items:
> +minItems: 1
> +maxItems: 2
> +else:
> +  properties:
> +audio-codec:
> +   

Re: [PATCH v2 1/2] ASoC: dt-bindings: fsl,xcvr: Add compatible string for i.MX95

2024-05-20 Thread Rob Herring
On Tue, May 14, 2024 at 11:12:08AM +0800, Shengjiu Wang wrote:
> Add compatible string "fsl,imx95-xcvr" for i.MX95 platform.
> 
> The difference between each platform is in below table.
> 
> +-++--++
> |  SOC  |  PHY   | eARC/ARC | SPDIF  |
> +-++--++
> | i.MX8MP |  V1|  Yes |  Yes   |
> +-++--++
> | i.MX93  |  N/A   |  N/A |  Yes   |
> +-++--++
> | i.MX95  |  V2|  N/A |  Yes   |
> +-++--++
> 
> On i.MX95, there are two PLL clock sources, they are the parent
> clocks of the XCVR root clock. one is for 8kHz series rates, named
> as 'pll8k', another one is for 11kHz series rates, named as 'pll11k'.
> They are optional clocks, if there are such clocks, then the driver
> can switch between them to support more accurate sample rates.
> 
> As 'pll8k' and 'pll11k' are optional, then add 'minItems: 4'
> for clocks and clock-names properties.
> 
> Signed-off-by: Shengjiu Wang 
> ---
>  .../devicetree/bindings/sound/fsl,xcvr.yaml   | 55 +++
>  1 file changed, 45 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml 
> b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> index 0eb0c1ba8710..70bcde33e986 100644
> --- a/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> +++ b/Documentation/devicetree/bindings/sound/fsl,xcvr.yaml
> @@ -22,6 +22,7 @@ properties:
>  enum:
>- fsl,imx8mp-xcvr
>- fsl,imx93-xcvr
> +  - fsl,imx95-xcvr
>  
>reg:
>  items:
> @@ -44,18 +45,12 @@ properties:
>  minItems: 1
>  
>clocks:
> -items:
> -  - description: Peripheral clock
> -  - description: PHY clock
> -  - description: SPBA clock
> -  - description: PLL clock

Leave these here and add pll8k and pll11k.

> +minItems: 4

Keep this.

> +maxItems: 6
>  
>clock-names:
> -items:
> -  - const: ipg
> -  - const: phy
> -  - const: spba
> -  - const: pll_ipg
> +minItems: 4
> +maxItems: 6

Same here.

>  
>dmas:
>  items:
> @@ -97,6 +92,46 @@ allOf:
>properties:
>  interrupts:
>maxItems: 1
> +  - if:
> +  properties:
> +compatible:
> +  contains:
> +enum:
> +  - fsl,imx95-xcvr
> +then:
> +  properties:
> +clocks:
> +  items:
> +- description: Peripheral clock
> +- description: PHY clock
> +- description: SPBA clock
> +- description: PLL clock
> +- description: PLL clock source for 8kHz series
> +- description: PLL clock source for 11kHz series
> +  minItems: 4
> +clock-names:
> +  items:
> +- const: ipg
> +- const: phy
> +- const: spba
> +- const: pll_ipg
> +- const: pll8k
> +- const: pll11k
> +  minItems: 4

Drop all this.

> +else:
> +  properties:
> +clocks:
> +  items:
> +- description: Peripheral clock
> +- description: PHY clock
> +- description: SPBA clock
> +- description: PLL clock
> +clock-names:
> +  items:
> +- const: ipg
> +- const: phy
> +- const: spba
> +- const: pll_ipg

And for this case, you just need 'maxItems: 4'.

Rob


Re: [PATCH 0/7] Remove 40x

2024-05-06 Thread Rob Herring (Arm)


On Mon, 06 May 2024 22:51:45 +1000, Michael Ellerman wrote:
> The 40x platforms & CPUs are old and have been unmaintained for years, and as
> far as we can tell have no users.
> 
> Note 44x and 476 are not affected.
> 
> Christophe first proposed removing 40x in 2020:
>   
> https://lore.kernel.org/linuxppc-dev/40899eb1b8f10da3706acd06c3d46d2418c8886e.1585635837.git.christophe.le...@c-s.fr/
> 
> And on a few subsequent occasions.
> 
> The proposed removal was covered on Phronix:
>   https://www.phoronix.com/news/PowerPC-40x-400-Linux-Removal
> 
> OpenWRT dropped support in 2019.
> 
> So unless anyone steps up to maintain it, remove 40x as unused. RIP.
> 
> cheers
> 
> 
> More context: https://github.com/linuxppc/issues/issues/349
> 
> Christophe Leroy (4):
>   powerpc/40x: Remove 40x platforms.
>   powerpc/boot: Remove all 40x platforms from boot
>   powerpc: Remove core support for 40x
>   powerpc/platforms: Move files from 4xx to 44x
> 
> Michael Ellerman (3):
>   powerpc: Remove 40x from Kconfig and defconfig
>   powerpc/4xx: Remove CONFIG_BOOKE_OR_40x
>   powerpc: Replace CONFIG_4xx with CONFIG_44x
> 
>  MAINTAINERS   |   1 -
>  arch/powerpc/Kconfig  |  17 +-
>  arch/powerpc/Kconfig.debug|  13 -
>  arch/powerpc/Makefile |   5 -
>  arch/powerpc/boot/4xx.c   | 266 ---
>  arch/powerpc/boot/4xx.h   |   4 -
>  arch/powerpc/boot/Makefile|  11 -
>  arch/powerpc/boot/cuboot-acadia.c | 171 -
>  arch/powerpc/boot/cuboot-hotfoot.c| 139 
>  arch/powerpc/boot/cuboot-kilauea.c|  46 --
>  arch/powerpc/boot/dcr.h   |  11 -
>  arch/powerpc/boot/dts/acadia.dts  | 224 --
>  arch/powerpc/boot/dts/hotfoot.dts | 296 ---
>  arch/powerpc/boot/dts/kilauea.dts | 407 --
>  arch/powerpc/boot/dts/obs600.dts  | 314 
>  arch/powerpc/boot/ppcboot-hotfoot.h   | 119 ---
>  arch/powerpc/boot/ppcboot.h   |   2 +-
>  arch/powerpc/configs/40x.config   |   2 -
>  arch/powerpc/configs/40x/acadia_defconfig |  61 --
>  arch/powerpc/configs/40x/kilauea_defconfig|  69 --
>  arch/powerpc/configs/40x/klondike_defconfig   |  43 --
>  arch/powerpc/configs/40x/makalu_defconfig |  59 --
>  arch/powerpc/configs/40x/obs600_defconfig |  69 --
>  arch/powerpc/configs/40x/walnut_defconfig |  55 --
>  arch/powerpc/configs/ppc40x_defconfig |  74 --
>  arch/powerpc/include/asm/cacheflush.h |   2 +-
>  arch/powerpc/include/asm/cputable.h   |   7 -
>  arch/powerpc/include/asm/hw_irq.h |   8 +-
>  arch/powerpc/include/asm/irq.h|   2 +-
>  arch/powerpc/include/asm/kup.h|   2 +-
>  arch/powerpc/include/asm/mmu.h|   7 -
>  arch/powerpc/include/asm/nohash/32/mmu-40x.h  |  68 --
>  arch/powerpc/include/asm/nohash/32/pgtable.h  |   4 +-
>  arch/powerpc/include/asm/nohash/32/pte-40x.h  |  73 --
>  arch/powerpc/include/asm/nohash/mmu.h |   5 +-
>  arch/powerpc/include/asm/ppc_asm.h|   2 +-
>  arch/powerpc/include/asm/processor.h  |   2 +-
>  arch/powerpc/include/asm/ptrace.h |   2 +-
>  arch/powerpc/include/asm/reg.h|  27 +-
>  arch/powerpc/include/asm/reg_booke.h  | 113 +--
>  arch/powerpc/include/asm/time.h   |   7 +-
>  arch/powerpc/include/asm/udbg.h   |   1 -
>  arch/powerpc/kernel/Makefile  |   1 -
>  arch/powerpc/kernel/asm-offsets.c |   2 +-
>  arch/powerpc/kernel/cpu_specs.h   |   4 -
>  arch/powerpc/kernel/cpu_specs_40x.h   | 280 ---
>  arch/powerpc/kernel/entry_32.S|  48 +-
>  arch/powerpc/kernel/epapr_hcalls.S|   2 +-
>  arch/powerpc/kernel/head_32.h |  12 +-
>  arch/powerpc/kernel/head_40x.S| 721 --
>  arch/powerpc/kernel/head_booke.h  |   3 +-
>  arch/powerpc/kernel/irq.c |   2 +-
>  arch/powerpc/kernel/kgdb.c|   4 +-
>  arch/powerpc/kernel/misc_32.S |  40 -
>  arch/powerpc/kernel/process.c |   4 +-
>  arch/powerpc/kernel/setup.h   |   2 +-
>  arch/powerpc/kernel/setup_32.c|   2 +-
>  arch/powerpc/kernel/time.c|   2 +-
>  arch/powerpc/kernel/traps.c   |   2 +-
>  arch/powerpc/kernel/udbg.c|   3 -
>  arch/powerpc/kernel/udbg_16550.c  |  23 -
>  arch/powerpc/mm/fault.c   |   4 +-
>  arch/powerpc/mm/mmu_context.c |   2 +-
>  arch/powerpc/mm/mmu_decl.h|   8 +-
>  arch/powerpc/mm/nohash/40x.c  | 161 
>  arch/powerpc/mm/nohash/Makefile   |   1 -
>  a

Re: [PATCH v2] ASoC: dt-bindings: fsl,ssi: Convert to YAML

2024-04-23 Thread Rob Herring
On Mon, Apr 22, 2024 at 01:48:14PM +0800, Shengjiu Wang wrote:
> Convert the fsl,ssi binding to YAML.
> 
> Add below compatible strings which were not listed
> in document:
> 
> fsl,imx50-ssi
> fsl,imx53-ssi
> fsl,imx25-ssi
> fsl,imx27-ssi
> fsl,imx6q-ssi
> fsl,imx6sl-ssi
> fsl,imx6sx-ssi
> 
> Add below fsl,mode strings which were not listed.
> 
> i2s-slave
> i2s-master
> lj-slave
> lj-master
> rj-slave
> rj-master
> 
> Add 'ac97-gpios' property which were not listed.
> Then dtbs_check can pass.
> 
> And remove the 'codec' description which should be
> in the 'codec' binding doc.
> 
> Signed-off-by: Shengjiu Wang 
> ---
> changes in v2:
> - change fallback string to const.
> - add dai-common.yaml
> - add ac97-gpios property
> 
>  .../devicetree/bindings/sound/fsl,ssi.txt |  87 
>  .../devicetree/bindings/sound/fsl,ssi.yaml| 192 ++
>  2 files changed, 192 insertions(+), 87 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/sound/fsl,ssi.txt
>  create mode 100644 Documentation/devicetree/bindings/sound/fsl,ssi.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl,ssi.txt 
> b/Documentation/devicetree/bindings/sound/fsl,ssi.txt
> deleted file mode 100644
> index 7e15a85cecd2..
> --- a/Documentation/devicetree/bindings/sound/fsl,ssi.txt
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -Freescale Synchronous Serial Interface
> -
> -The SSI is a serial device that communicates with audio codecs.  It can
> -be programmed in AC97, I2S, left-justified, or right-justified modes.
> -
> -Required properties:
> -- compatible:   Compatible list, should contain one of the following
> -compatibles:
> -  fsl,mpc8610-ssi
> -  fsl,imx51-ssi
> -  fsl,imx35-ssi
> -  fsl,imx21-ssi
> -- cell-index:   The SSI, <0> = SSI1, <1> = SSI2, and so on.
> -- reg:  Offset and length of the register set for the device.
> -- interrupts:where a is the interrupt number and b is a
> -field that represents an encoding of the sense and
> -level information for the interrupt.  This should be
> -encoded based on the information in section 2)
> -depending on the type of interrupt controller you
> -have.
> -- fsl,fifo-depth:   The number of elements in the transmit and receive FIFOs.
> -This number is the maximum allowed value for 
> SFCSR[TFWM0].
> - - clocks:  "ipg" - Required clock for the SSI unit
> -"baud" - Required clock for SSI master mode. Otherwise 
> this
> -   clock is not used
> -
> -Required are also ac97 link bindings if ac97 is used. See
> -Documentation/devicetree/bindings/sound/soc-ac97link.txt for the necessary
> -bindings.
> -
> -Optional properties:
> -- codec-handle: Phandle to a 'codec' node that defines an audio
> -codec connected to this SSI.  This node is typically
> -a child of an I2C or other control node.
> -- fsl,fiq-stream-filter: Bool property. Disabled DMA and use FIQ instead to
> - filter the codec stream. This is necessary for some boards
> - where an incompatible codec is connected to this SSI, e.g.
> - on pca100 and pcm043.
> -- dmas:  Generic dma devicetree binding as described in
> - Documentation/devicetree/bindings/dma/dma.txt.
> -- dma-names: Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
> - is not defined.
> -- fsl,mode: The operating mode for the AC97 interface only.
> -"ac97-slave" - AC97 mode, SSI is clock slave
> -"ac97-master" - AC97 mode, SSI is clock master
> -- fsl,ssi-asynchronous:
> -If specified, the SSI is to be programmed in asynchronous
> -mode.  In this mode, pins SRCK, STCK, SRFS, and STFS must
> -all be connected to valid signals.  In synchronous mode,
> -SRCK and SRFS are ignored.  Asynchronous mode allows
> -playback and capture to use different sample sizes and
> -sample rates.  Some drivers may require that SRCK and 
> STCK
> -be connected together, and SRFS and STFS be connected
> -together.  This would still allow different sample sizes,
> -but not different sample rates.
> -- fsl,playback-dma: Phandle to a node for the DMA channel to use for
> -playback of audio.  This is typically dictated by SOC
> -design.  See the notes below.
> -Only used on Power Architecture.
> -- fsl,capture-dma:  Phandle to a node for the DMA channel to use for
> -capture (recording) of audio.  This is typ

Re: [PATCH 5/5] dt-bindings: hwmon: ibm,p8-occ-hwmon: move to trivial devices

2024-03-21 Thread Rob Herring


On Thu, 21 Mar 2024 19:43:46 +0100, Javier Carrasco wrote:
> This binding meets the requirements to be converted to dtschema
> via trivial-devices.yaml.
> 
> Signed-off-by: Javier Carrasco 
> ---
>  .../devicetree/bindings/hwmon/ibm,p8-occ-hwmon.txt | 25 
> --
>  .../devicetree/bindings/trivial-devices.yaml   |  2 ++
>  2 files changed, 2 insertions(+), 25 deletions(-)
> 

Reviewed-by: Rob Herring 



Re: [PATCH 3/5] dt-bindings: hwmon: pwm-fan: drop text file

2024-03-21 Thread Rob Herring


On Thu, 21 Mar 2024 19:43:44 +0100, Javier Carrasco wrote:
> This binding was converted to dtschema a year ago.
> 
> Signed-off-by: Javier Carrasco 
> ---
>  Documentation/devicetree/bindings/hwmon/pwm-fan.txt | 1 -
>  1 file changed, 1 deletion(-)
> 

Acked-by: Rob Herring 



Re: [PATCH 1/5] dt-bindings: hwmon: as370: convert to dtschema

2024-03-21 Thread Rob Herring


On Thu, 21 Mar 2024 19:43:42 +0100, Javier Carrasco wrote:
> Convert existing binding to support validation.
> 
> This is a straightforward conversion with now new properties.
> 
> Signed-off-by: Javier Carrasco 
> ---
>  Documentation/devicetree/bindings/hwmon/as370.txt  | 11 
>  .../devicetree/bindings/hwmon/syna,as370.yaml  | 32 
> ++
>  2 files changed, 32 insertions(+), 11 deletions(-)
> 

Reviewed-by: Rob Herring 



Re: [PATCH 4/5] dt-bindings: hwmon: stts751: convert to dtschema

2024-03-21 Thread Rob Herring


On Thu, 21 Mar 2024 19:43:45 +0100, Javier Carrasco wrote:
> Convert existing binding to support validation.
> 
> This is a straightforward conversion with no new properties.
> 
> Signed-off-by: Javier Carrasco 
> ---
>  .../devicetree/bindings/hwmon/st,stts751.yaml  | 41 
> ++
>  .../devicetree/bindings/hwmon/stts751.txt  | 15 
>  2 files changed, 41 insertions(+), 15 deletions(-)
> 

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/hwmon/ibm,powernv.example.dtb:
 sensor: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/hwmon/st,stts751.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/ibm,powernv.example.dtb:
 sensor: 'sensor-id' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/hwmon/st,stts751.yaml#

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240321-hwmon_dtschema-v1-4-96c3810c3...@gmail.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.



Re: [PATCH 2/5] dt-bindings: hwmon: ibmpowernv: convert to dtschema

2024-03-21 Thread Rob Herring


On Thu, 21 Mar 2024 19:43:43 +0100, Javier Carrasco wrote:
> Convert existing binding to support validation.
> 
> This is a straightforward conversion with now new properties.
> 
> Signed-off-by: Javier Carrasco 
> ---
>  .../devicetree/bindings/hwmon/ibm,powernv.yaml | 37 
> ++
>  .../devicetree/bindings/hwmon/ibmpowernv.txt   | 23 --
>  2 files changed, 37 insertions(+), 23 deletions(-)
> 

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:
Documentation/devicetree/bindings/hwmon/ibm,powernv.example.dtb: 
/example-0/sensor: failed to match any schema with compatible: ['st,stts751']

doc reference errors (make refcheckdocs):

See 
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240321-hwmon_dtschema-v1-2-96c3810c3...@gmail.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.



Re: [PATCH 1/2] powerpc/prom_init: Replace linux,sml-base/sml-size with linux,sml-log

2024-03-12 Thread Rob Herring
On Tue, Mar 12, 2024 at 09:32:50PM +1100, Michael Ellerman wrote:
> Rob Herring  writes:
> > On Fri, Mar 08, 2024 at 07:23:35AM -0500, Stefan Berger wrote:
> >> On 3/7/24 16:52, Rob Herring wrote:
> >> > On Thu, Mar 07, 2024 at 09:41:31PM +1100, Michael Ellerman wrote:
> >> > > Stefan Berger  writes:
> >> > > > linux,sml-base holds the address of a buffer with the TPM log. This
> >> > > > buffer may become invalid after a kexec and therefore embed the 
> >> > > > whole TPM
> >> > > > log in linux,sml-log. This helps to protect the log since it is 
> >> > > > properly
> >> > > > carried across a kexec with both of the kexec syscalls.
> >> > > > 
> >> > > > Signed-off-by: Stefan Berger 
> >> > > > ---
> >> > > >   arch/powerpc/kernel/prom_init.c | 8 ++--
> >> > > >   1 file changed, 2 insertions(+), 6 deletions(-)
> >> > > > 
> >> 
> >> > 
> >> > 
> >> > > Also adding the new linux,sml-log property should be accompanied by a
> >> > > change to the device tree binding.
> >> > > 
> >> > > The syntax is not very obvious to me, but possibly something like?
> >> > > 
> >> > > diff --git a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml 
> >> > > b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> >> > > index 50a3fd31241c..cd75037948bc 100644
> >> > > --- a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> >> > > +++ b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> >> > > @@ -74,8 +74,6 @@ required:
> >> > > - ibm,my-dma-window
> >> > > - ibm,my-drc-index
> >> > > - ibm,loc-code
> >> > > -  - linux,sml-base
> >> > > -  - linux,sml-size
> >> > 
> >> > Dropping required properties is an ABI break. If you drop them, an older
> >> > OS version won't work.
> >> 
> >> 1) On PowerVM and KVM on Power these two properties were added in the Linux
> >> code. I replaced the creation of these properties with creation of
> >> linux,sml-log (1/2 in this series). I also replaced the handling of
> >> these two (2/2 in this series) for these two platforms but leaving it for
> >> powernv systems where the firmware creates these.
> >
> > Okay, I guess your case is not a ABI break if the kernel is populating 
> > it and the same kernel consumes it. 
> >
> > You failed to answer my question on using /reserved-memory. Again, why 
> > can't that be used? That is the standard way we prevent chunks of memory 
> > from being clobbered.
> 
> Yes I think that would mostly work. I don't see support for
> /reserved-memory in kexec-tools, so that would need fixing I think.
> 
> My logic was that the memory is not special. It's just a buffer we
> allocated during early boot to store the log. There isn't anything else
> in the system that relies on that memory remaining untouched. So it
> seemed cleaner to just put the log in the device tree, rather than a
> pointer to it.

My issue is we already have 2 ways to describe the log to the OS. I 
don't see a good reason to add a 3rd way. (Though it might actually be a 
4th way, because the chosen property for the last attempt was accepted 
to dtschema yet the code has been abandoned.)

If you put the log into the DT, then the memory for the log remains 
untouched too because the FDT remains untouched. For reserved-memory 
regions, the OS is free to free them if it knows what the region is and 
that it is no longer needed. IOW, if freeing the log memory is desired, 
then the suggested approach doesn't work.

> 
> Having the log external to the device tree creates several problems,
> like the crash kernel region colliding with it, it being clobbered by
> kexec, etc.

We have multiple regions to pass/maintain thru kexec, so how does having 
one less really matter?

Rob


Re: [PATCH 1/2] powerpc/prom_init: Replace linux,sml-base/sml-size with linux,sml-log

2024-03-08 Thread Rob Herring
On Fri, Mar 08, 2024 at 07:23:35AM -0500, Stefan Berger wrote:
> 
> 
> On 3/7/24 16:52, Rob Herring wrote:
> > On Thu, Mar 07, 2024 at 09:41:31PM +1100, Michael Ellerman wrote:
> > > Stefan Berger  writes:
> > > > linux,sml-base holds the address of a buffer with the TPM log. This
> > > > buffer may become invalid after a kexec and therefore embed the whole 
> > > > TPM
> > > > log in linux,sml-log. This helps to protect the log since it is properly
> > > > carried across a kexec with both of the kexec syscalls.
> > > > 
> > > > Signed-off-by: Stefan Berger 
> > > > ---
> > > >   arch/powerpc/kernel/prom_init.c | 8 ++--
> > > >   1 file changed, 2 insertions(+), 6 deletions(-)
> > > > 
> 
> > 
> > 
> > > Also adding the new linux,sml-log property should be accompanied by a
> > > change to the device tree binding.
> > > 
> > > The syntax is not very obvious to me, but possibly something like?
> > > 
> > > diff --git a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml 
> > > b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> > > index 50a3fd31241c..cd75037948bc 100644
> > > --- a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> > > +++ b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> > > @@ -74,8 +74,6 @@ required:
> > > - ibm,my-dma-window
> > > - ibm,my-drc-index
> > > - ibm,loc-code
> > > -  - linux,sml-base
> > > -  - linux,sml-size
> > 
> > Dropping required properties is an ABI break. If you drop them, an older
> > OS version won't work.
> 
> 1) On PowerVM and KVM on Power these two properties were added in the Linux
> code. I replaced the creation of these properties with creation of
> linux,sml-log (1/2 in this series). I also replaced the handling of
> these two (2/2 in this series) for these two platforms but leaving it for
> powernv systems where the firmware creates these.

Okay, I guess your case is not a ABI break if the kernel is populating 
it and the same kernel consumes it. 

You failed to answer my question on using /reserved-memory. Again, why 
can't that be used? That is the standard way we prevent chunks of memory 
from being clobbered. There's already support for describing the TPM log 
that way anyways. The only reasoning I can see writing out a node for 
that is harder than just adding a property, but that's not a great 
argument IMO.


> 2) There is an example in the ibm,vtpm.yaml file that has both of these
> and the test case still passes the check when the two entries above are
> removed. I will post v2 with the changes to the DT bindings for
> linux,sml-log including an example for linux,sml-log. [The test cases fail,
> as expected, when an additional property is added, such as when
> linux,sml-base is added when linux,sml-log is there or linux,sml-log is
> added when linux,sml-base is there.]

Sure, removing a required property is never going to break the DT 
checks. What would break is a client (OS) version that only understands 
linux,sml-base and can no longer get the log assuming getting the log 
itself was required. 

Rob


Re: [PATCH 1/2] powerpc/prom_init: Replace linux,sml-base/sml-size with linux,sml-log

2024-03-07 Thread Rob Herring
On Thu, Mar 07, 2024 at 09:41:31PM +1100, Michael Ellerman wrote:
> Stefan Berger  writes:
> > linux,sml-base holds the address of a buffer with the TPM log. This
> > buffer may become invalid after a kexec and therefore embed the whole TPM
> > log in linux,sml-log. This helps to protect the log since it is properly
> > carried across a kexec with both of the kexec syscalls.
> >
> > Signed-off-by: Stefan Berger 
> > ---
> >  arch/powerpc/kernel/prom_init.c | 8 ++--
> >  1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/prom_init.c 
> > b/arch/powerpc/kernel/prom_init.c
> > index e67effdba85c..41268c30de4c 100644
> > --- a/arch/powerpc/kernel/prom_init.c
> > +++ b/arch/powerpc/kernel/prom_init.c
> > @@ -1956,12 +1956,8 @@ static void __init prom_instantiate_sml(void)
> >  
> > reserve_mem(base, size);
> >  
> > -   prom_setprop(ibmvtpm_node, "/vdevice/vtpm", "linux,sml-base",
> > -&base, sizeof(base));
> > -   prom_setprop(ibmvtpm_node, "/vdevice/vtpm", "linux,sml-size",
> > -&size, sizeof(size));
> > -
> > -   prom_debug("sml base = 0x%llx\n", base);
> > +   prom_setprop(ibmvtpm_node, "/vdevice/vtpm", "linux,sml-log",
> > +(void *)base, size);
> 
> As we discussed via chat, doing it this way sucks the full content of
> the log back into Open Firmware. 
> 
> That relies on OF handling such big properties, and also means more
> memory will be consumed, which can cause problems early in boot.
> 
> A better solution is to explicitly add the log to the FDT in the
> flattening phase.
> 

Why can't you just use /reserved-memory here? That should be preserved 
from one kernel entry to the next.


> Also adding the new linux,sml-log property should be accompanied by a
> change to the device tree binding.
> 
> The syntax is not very obvious to me, but possibly something like?
> 
> diff --git a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml 
> b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> index 50a3fd31241c..cd75037948bc 100644
> --- a/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> +++ b/Documentation/devicetree/bindings/tpm/ibm,vtpm.yaml
> @@ -74,8 +74,6 @@ required:
>- ibm,my-dma-window
>- ibm,my-drc-index
>- ibm,loc-code
> -  - linux,sml-base
> -  - linux,sml-size

Dropping required properties is an ABI break. If you drop them, an older 
OS version won't work.

>  
>  allOf:
>- $ref: tpm-common.yaml#
> diff --git a/Documentation/devicetree/bindings/tpm/tpm-common.yaml 
> b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
> index 3c1241b2a43f..616604707c95 100644
> --- a/Documentation/devicetree/bindings/tpm/tpm-common.yaml
> +++ b/Documentation/devicetree/bindings/tpm/tpm-common.yaml
> @@ -25,6 +25,11 @@ properties:
>base address of reserved memory allocated for firmware event log
>  $ref: /schemas/types.yaml#/definitions/uint64
>  
> +  linux,sml-log:

Why is this Linux specific?

> +description:
> +  Content of firmware event log
> +$ref: /schemas/types.yaml#/definitions/uint8-array
> +
>linux,sml-size:
>  description:
>size of reserved memory allocated for firmware event log
> @@ -53,15 +58,22 @@ dependentRequired:
>linux,sml-base: ['linux,sml-size']
>linux,sml-size: ['linux,sml-base']
>  
> -# must only have either memory-region or linux,sml-base
> +# must only have either memory-region or linux,sml-base/size or linux,sml-log
>  # as well as either resets or reset-gpios
>  dependentSchemas:
>memory-region:
>  properties:
>linux,sml-base: false
> +  linux,sml-log: false
>linux,sml-base:
>  properties:
>memory-region: false
> +  linux,sml-log: false
> +  linux,sml-log:
> +properties:
> +  memory-region: false
> +  linux,sml-base: false
> +  linux,sml-size: false
>resets:
>  properties:
>reset-gpios: false
> 
> 
> cheers


Re: [PATCH 0/2] Preserve TPM log across kexec

2024-03-07 Thread Rob Herring
On Wed, Mar 06, 2024 at 11:08:20AM -0500, Stefan Berger wrote:
> 
> 
> On 3/6/24 10:55, Stefan Berger wrote:
> > This series resolves an issue on PowerVM and KVM on Power where the memory
> > the TPM log was held in may become inaccessible or corrupted after a kexec
> > soft reboot. The solution on these two platforms is to store the whole log
> > in the device tree because the device tree is preserved across a kexec with
> > either of the two kexec syscalls.
> > 
> FYI: This was the previous attempt that didn't work with the older kexec
> syscall: 
> https://lore.kernel.org/lkml/4afde78d-e138-9eee-50e0-dbd32f4dc...@linux.ibm.com/T/#m158630d214837e41858b03d4b025e6f96cb8f251

Doesn't everyone else still need that? Is powerpc the only ones that 
care about the old kexec syscall?

Rob


Re: [PATCH] soc: fsl: qbman: Remove RESERVEDMEM_OF_DECLARE usage

2024-03-05 Thread Rob Herring


On Thu, 01 Feb 2024 13:29:30 -0600, Rob Herring wrote:
> There is no reason to use RESERVEDMEM_OF_DECLARE() as the initialization
> hook just saves off the base address and size. Use of
> RESERVEDMEM_OF_DECLARE() is reserved for non-driver code and
> initialization which must be done early. For qbman, retrieving the
> address and size can be done in probe just as easily.
> 
> Signed-off-by: Rob Herring 
> ---
>  drivers/soc/fsl/qbman/bman_ccsr.c | 27 +++-
>  drivers/soc/fsl/qbman/dpaa_sys.c  | 12 +++--
>  drivers/soc/fsl/qbman/dpaa_sys.h  |  4 +-
>  drivers/soc/fsl/qbman/qman_ccsr.c | 73 ++-
>  4 files changed, 38 insertions(+), 78 deletions(-)
> 

No one is going to pick this up? I applied to the DT tree.

Rob


[PATCH] soc: fsl: qbman: Remove RESERVEDMEM_OF_DECLARE usage

2024-02-01 Thread Rob Herring
There is no reason to use RESERVEDMEM_OF_DECLARE() as the initialization
hook just saves off the base address and size. Use of
RESERVEDMEM_OF_DECLARE() is reserved for non-driver code and
initialization which must be done early. For qbman, retrieving the
address and size can be done in probe just as easily.

Signed-off-by: Rob Herring 
---
 drivers/soc/fsl/qbman/bman_ccsr.c | 27 +++-
 drivers/soc/fsl/qbman/dpaa_sys.c  | 12 +++--
 drivers/soc/fsl/qbman/dpaa_sys.h  |  4 +-
 drivers/soc/fsl/qbman/qman_ccsr.c | 73 ++-
 4 files changed, 38 insertions(+), 78 deletions(-)

diff --git a/drivers/soc/fsl/qbman/bman_ccsr.c 
b/drivers/soc/fsl/qbman/bman_ccsr.c
index cb24a08be084..b0f26f6f731e 100644
--- a/drivers/soc/fsl/qbman/bman_ccsr.c
+++ b/drivers/soc/fsl/qbman/bman_ccsr.c
@@ -144,17 +144,6 @@ static int bm_set_memory(u64 ba, u32 size)
 static dma_addr_t fbpr_a;
 static size_t fbpr_sz;
 
-static int bman_fbpr(struct reserved_mem *rmem)
-{
-   fbpr_a = rmem->base;
-   fbpr_sz = rmem->size;
-
-   WARN_ON(!(fbpr_a && fbpr_sz));
-
-   return 0;
-}
-RESERVEDMEM_OF_DECLARE(bman_fbpr, "fsl,bman-fbpr", bman_fbpr);
-
 static irqreturn_t bman_isr(int irq, void *ptr)
 {
u32 isr_val, ier_val, ecsr_val, isr_mask, i;
@@ -242,17 +231,11 @@ static int fsl_bman_probe(struct platform_device *pdev)
return -ENODEV;
}
 
-   /*
-* If FBPR memory wasn't defined using the qbman compatible string
-* try using the of_reserved_mem_device method
-*/
-   if (!fbpr_a) {
-   ret = qbman_init_private_mem(dev, 0, &fbpr_a, &fbpr_sz);
-   if (ret) {
-   dev_err(dev, "qbman_init_private_mem() failed 0x%x\n",
-   ret);
-   return -ENODEV;
-   }
+   ret = qbman_init_private_mem(dev, 0, "fsl,bman-fbpr", &fbpr_a, 
&fbpr_sz);
+   if (ret) {
+   dev_err(dev, "qbman_init_private_mem() failed 0x%x\n",
+   ret);
+   return -ENODEV;
}
 
dev_dbg(dev, "Allocated FBPR 0x%llx 0x%zx\n", fbpr_a, fbpr_sz);
diff --git a/drivers/soc/fsl/qbman/dpaa_sys.c b/drivers/soc/fsl/qbman/dpaa_sys.c
index 33751450047e..e1d7b79cc450 100644
--- a/drivers/soc/fsl/qbman/dpaa_sys.c
+++ b/drivers/soc/fsl/qbman/dpaa_sys.c
@@ -34,8 +34,8 @@
 /*
  * Initialize a devices private memory region
  */
-int qbman_init_private_mem(struct device *dev, int idx, dma_addr_t *addr,
-   size_t *size)
+int qbman_init_private_mem(struct device *dev, int idx, const char *compat,
+  dma_addr_t *addr, size_t *size)
 {
struct device_node *mem_node;
struct reserved_mem *rmem;
@@ -44,8 +44,12 @@ int qbman_init_private_mem(struct device *dev, int idx, 
dma_addr_t *addr,
 
mem_node = of_parse_phandle(dev->of_node, "memory-region", idx);
if (!mem_node) {
-   dev_err(dev, "No memory-region found for index %d\n", idx);
-   return -ENODEV;
+   mem_node = of_find_compatible_node(NULL, NULL, compat);
+   if (!mem_node) {
+   dev_err(dev, "No memory-region found for index %d or 
compatible '%s'\n",
+   idx, compat);
+   return -ENODEV;
+   }
}
 
rmem = of_reserved_mem_lookup(mem_node);
diff --git a/drivers/soc/fsl/qbman/dpaa_sys.h b/drivers/soc/fsl/qbman/dpaa_sys.h
index ae8afa552b1e..16485bde9636 100644
--- a/drivers/soc/fsl/qbman/dpaa_sys.h
+++ b/drivers/soc/fsl/qbman/dpaa_sys.h
@@ -101,8 +101,8 @@ static inline u8 dpaa_cyc_diff(u8 ringsize, u8 first, u8 
last)
 #define DPAA_GENALLOC_OFF  0x8000
 
 /* Initialize the devices private memory region */
-int qbman_init_private_mem(struct device *dev, int idx, dma_addr_t *addr,
-   size_t *size);
+int qbman_init_private_mem(struct device *dev, int idx, const char *compat,
+  dma_addr_t *addr, size_t *size);
 
 /* memremap() attributes for different platforms */
 #ifdef CONFIG_PPC
diff --git a/drivers/soc/fsl/qbman/qman_ccsr.c 
b/drivers/soc/fsl/qbman/qman_ccsr.c
index 157659fd033a..392e54f14dbe 100644
--- a/drivers/soc/fsl/qbman/qman_ccsr.c
+++ b/drivers/soc/fsl/qbman/qman_ccsr.c
@@ -468,28 +468,6 @@ static int zero_priv_mem(phys_addr_t addr, size_t sz)
 
return 0;
 }
-
-static int qman_fqd(struct reserved_mem *rmem)
-{
-   fqd_a = rmem->base;
-   fqd_sz = rmem->size;
-
-   WARN_ON(!(fqd_a && fqd_sz));
-   return 0;
-}
-RESERVEDMEM_OF_DECLARE(qman_fqd, "fsl,qman-fqd", qman_fqd);
-
-static int qman_pfdr(struct reserved_mem *rmem)
-{
-   pfdr_a = rmem->base;
-   pfdr_sz = rmem->size;
-
-   WARN_ON(!(pfdr_a &

Re: [PATCH] dt-bindings: soc: fsl: narrow regex for unit address to hex numbers

2024-01-30 Thread Rob Herring


On Tue, 23 Jan 2024 09:35:05 +0100, Krzysztof Kozlowski wrote:
> Regular expression used to match the unit address part should not allow
> non-hex numbers.
> 
> Signed-off-by: Krzysztof Kozlowski 
> ---
>  .../devicetree/bindings/soc/fsl/fsl,layerscape-dcfg.yaml| 2 +-
>  .../devicetree/bindings/soc/fsl/fsl,layerscape-scfg.yaml| 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Rob Herring 



Re: [PATCHv3 RESEND 10/10] ASoC: dt-bindings: fsl-asoc-card: add compatible for generic codec

2023-12-20 Thread Rob Herring
On Mon, Dec 18, 2023 at 01:40:58PM +0100, Elinor Montmasson wrote:
> Add documentation about new dts bindings following new support
> for compatible "fsl,imx-audio-generic".
> 
> Some CPU DAI don't require a real audio codec. The new compatible
> "fsl,imx-audio-generic" allows using the driver with codec drivers
> SPDIF DIT and SPDIF DIR as dummy codecs.
> It also allows using not pre-configured audio codecs which
> don't require specific control through a codec driver.
> 
> The new dts properties give the possibility to set some parameters
> about the CPU DAI usually set through the codec configuration.
> 
> Signed-off-by: Elinor Montmasson 
> Co-authored-by: Philip-Dylan Gleonec 
> 
> ---
>  .../bindings/sound/fsl-asoc-card.txt  | 28 ++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt 
> b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> index 4e8dbc5abfd1..f137ef2154e3 100644
> --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> @@ -17,6 +17,9 @@ Note: The card is initially designed for those sound cards 
> who use AC'97, I2S
>and PCM DAI formats. However, it'll be also possible to support those 
> non
>AC'97/I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, as
>long as the driver has been properly upgraded.
> +  To use CPU DAIs that do not require a codec such as an S/PDIF 
> controller,
> +  or to use a DAI to output or capture raw I2S/TDM data, you can
> +  use the compatible "fsl,imx-audio-generic".
>  
>  
>  The compatible list for this generic sound card currently:
> @@ -48,6 +51,8 @@ The compatible list for this generic sound card currently:
>  
>   "fsl,imx-audio-nau8822"
>  
> + "fsl,imx-audio-generic"
> +
>  Required properties:
>  
>- compatible   : Contains one of entries in the compatible 
> list.
> @@ -56,7 +61,11 @@ Required properties:
>  
>- audio-cpu: The phandle of an CPU DAI controller
>  
> -  - audio-codec  : The phandle of an audio codec
> +  - audio-codec  : The phandle of an audio codec.
> +   If using the "fsl,imx-audio-generic" compatible,
> +   give instead a pair of phandles with the
> +   spdif_transmitter first (driver SPDIF DIT) and the
> +   spdif_receiver second (driver SPDIF DIR).
>  
>  Optional properties:
>  
> @@ -87,6 +96,23 @@ Optional properties:
>- frame-inversion  : dai-link uses frame clock inversion, for details see 
> simple-card.yaml.
>- bitclock-inversion   : dai-link uses bit clock inversion, for 
> details see simple-card.yaml.
>- mclk-id  : main clock id, specific for each card configuration.
> +   For multi-codec configurations, an array of ids can be
> +   given, one for each codec.
> +
> +Optional, relevant only with the "fsl,imx-audio-generic" compatible:
> +
> +  - cpu-slot-width   : Indicates a specific TDM slot width in bits.
> +  - cpu-slot-num : Indicates a specific number of TDM slots per frame.

Pretty sure I've seen other bindings with TDM slot properties. A sign we 
need something common if we don't already have something.

> +
> +  - cpu-sysclk-freq-rx   : Frequency of the CPU DAI sys clock for Rx.
> +  - cpu-sysclk-freq-tx   : Frequency of the CPU DAI sys clock for Tx.
> +
> +  - cpu-sysclk-dir-rx-out: Boolean property. Specifies sys clock 
> direction
> +   as 'out' on initialization for Rx.
> +   If not set, default direction is 'in'.
> +  - cpu-sysclk-dir-tx-out: Boolean property. Specifies sys clock 
> direction
> +   as 'out' on initialization for Tx.
> +   If not set, default direction is 'in'.

Looks like clock stuff. Use the clock binding.

Rob


Re: [PATCH v1 2/4] of: Reimplement of_machine_is_compatible() using of_machine_compatible_match()

2023-12-07 Thread Rob Herring
On Wed, Dec 06, 2023 at 05:13:33PM +0100, Christophe Leroy wrote:
> of_machine_compatible_match() works with a table of strings.
> of_machine_is_compatible() is a simplier version with only one string.
> 
> Re-implement of_machine_is_compatible() by setting a table of strings
> with a single string then using of_machine_compatible_match().
> 
> Suggested-by: Rob Herring 
> Signed-off-by: Christophe Leroy 
> ---
>  drivers/of/base.c  | 22 +-
>  include/linux/of.h | 15 ++-
>  2 files changed, 15 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 9020be2eb4d5..73c3a754bad1 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -414,27 +414,7 @@ bool of_machine_compatible_match(const char *const 
> *compats)
>  
>   return rc != 0;
>  }
> -
> -/**
> - * of_machine_is_compatible - Test root of device tree for a given 
> compatible value
> - * @compat: compatible string to look for in root node's compatible property.
> - *
> - * Return: A positive integer if the root node has the given value in its
> - * compatible property.
> - */
> -int of_machine_is_compatible(const char *compat)
> -{
> - struct device_node *root;
> - int rc = 0;
> -
> - root = of_find_node_by_path("/");
> - if (root) {
> - rc = of_device_is_compatible(root, compat);
> - of_node_put(root);
> - }
> - return rc;
> -}
> -EXPORT_SYMBOL(of_machine_is_compatible);
> +EXPORT_SYMBOL(of_machine_compatible_match);
>  
>  /**
>   *  __of_device_is_available - check if a device is available for use
> diff --git a/include/linux/of.h b/include/linux/of.h
> index e3418babc203..a0f70be5007f 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -402,9 +402,22 @@ extern void of_alias_scan(void * (*dt_alloc)(u64 size, 
> u64 align));
>  extern int of_alias_get_id(struct device_node *np, const char *stem);
>  extern int of_alias_get_highest_id(const char *stem);
>  
> -extern int of_machine_is_compatible(const char *compat);
>  bool of_machine_compatible_match(const char *const *compats);
>  
> +/**
> + * of_machine_is_compatible - Test root of device tree for a given 
> compatible value
> + * @compat: compatible string to look for in root node's compatible property.
> + *
> + * Return: A positive integer if the root node has the given value in its
> + * compatible property.

There is a subtle change that we really only return true/false instead 
of a score. In a quick scan, I don't see any callers caring. Lots of 
places we could use a list of compatibles instead though. Maybe this 
should just return a bool instead of int? Either way:

Reviewed-by: Rob Herring 


Re: [PATCH v1 1/4] of: Add of_machine_compatible_match()

2023-12-07 Thread Rob Herring


On Wed, 06 Dec 2023 17:13:32 +0100, Christophe Leroy wrote:
> From: Michael Ellerman 
> 
> We have of_machine_is_compatible() to check if a machine is compatible
> with a single compatible string. However some code is able to support
> multiple compatible boards, and so wants to check for one of many
> compatible strings.
> 
> So add of_machine_compatible_match() which takes a NULL terminated
> array of compatible strings to check against the root node's
> compatible property.
> 
> Compared to an open coded match this is slightly more self
> documenting, and also avoids the caller needing to juggle the root
> node either directly or via of_find_node_by_path().
> 
> Signed-off-by: Michael Ellerman 
> Signed-off-by: Christophe Leroy 
> ---
>  drivers/of/base.c  | 21 +
>  include/linux/of.h |  6 ++
>  2 files changed, 27 insertions(+)
> 

Reviewed-by: Rob Herring 



Re: [PATCH v1 4/4] powerpc: Stop using of_root

2023-12-07 Thread Rob Herring
On Wed, Dec 06, 2023 at 05:13:35PM +0100, Christophe Leroy wrote:
> Replace all usages of of_root by of_find_node_by_path("/")
> 
> Signed-off-by: Christophe Leroy 
> ---
>  arch/powerpc/kernel/secure_boot.c|  8 ++--
>  arch/powerpc/kexec/ranges.c  |  8 +---
>  arch/powerpc/mm/drmem.c  | 10 +-
>  arch/powerpc/mm/numa.c   |  6 --
>  arch/powerpc/platforms/52xx/efika.c  |  4 +++-
>  arch/powerpc/platforms/pasemi/pci.c  |  4 +++-
>  arch/powerpc/platforms/pseries/lparcfg.c |  6 +-
>  arch/powerpc/platforms/pseries/setup.c   | 12 +---
>  8 files changed, 40 insertions(+), 18 deletions(-)

Reviewed-by: Rob Herring 


Re: [PATCH v1 3/4] powerpc/machdep: Define 'compatibles' property in ppc_md and use it

2023-12-07 Thread Rob Herring
On Wed, Dec 06, 2023 at 05:13:34PM +0100, Christophe Leroy wrote:
> Most probe functions that do not use the 'compatible' string do
> nothing else than checking whether the machine is compatible with
> one of the strings in a NULL terminated table of strings.
> 
> Define that table of strings in ppc_md structure and check it directly
> from probe_machine() instead of using ppc_md.probe() for that.
> 
> Keep checking in ppc_md.probe() only for more complex probing.
> 
> All .compatible could be replaced with a single element NULL
> terminated list but that's not worth the churn. Can be do incrementaly
> in follow-up patches.
> 
> Signed-off-by: Christophe Leroy 
> ---
>  arch/powerpc/include/asm/machdep.h|  1 +
>  arch/powerpc/kernel/setup-common.c|  2 ++
>  arch/powerpc/platforms/40x/ppc40x_simple.c|  9 +++--
>  arch/powerpc/platforms/512x/mpc512x_generic.c |  4 +---
>  arch/powerpc/platforms/52xx/lite5200.c| 10 +-
>  arch/powerpc/platforms/52xx/mpc5200_simple.c  | 10 +-
>  arch/powerpc/platforms/83xx/mpc830x_rdb.c | 10 +-
>  arch/powerpc/platforms/83xx/mpc831x_rdb.c | 10 +-
>  arch/powerpc/platforms/83xx/mpc837x_rdb.c | 10 +-
>  arch/powerpc/platforms/85xx/corenet_generic.c |  2 +-
>  arch/powerpc/platforms/85xx/tqm85xx.c | 10 +-
>  11 files changed, 14 insertions(+), 64 deletions(-)

> -/*
> - * Called very early, MMU is off, device-tree isn't unflattened
> - */

Certainly an out of date comment as the unflattened API was being 
called.

Reviewed-by: Rob Herring 


Re: [PATCH] dt-bindings: fsl,dpaa2-console: drop unneeded quotes

2023-11-27 Thread Rob Herring


On Wed, 22 Nov 2023 15:44:19 -0700, Rob Herring wrote:
> Drop unneeded quotes over simple string values to fix a soon to be
> enabled yamllint warning:
> 
>   [error] string value is redundantly quoted with any quotes (quoted-strings)
> 
> Signed-off-by: Rob Herring 
> ---
>  Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied, thanks!



[PATCH] dt-bindings: fsl,dpaa2-console: drop unneeded quotes

2023-11-22 Thread Rob Herring
Drop unneeded quotes over simple string values to fix a soon to be
enabled yamllint warning:

  [error] string value is redundantly quoted with any quotes (quoted-strings)

Signed-off-by: Rob Herring 
---
 Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml 
b/Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml
index 8cc951feb7df..59b83ea5e05e 100644
--- a/Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml
+++ b/Documentation/devicetree/bindings/misc/fsl,dpaa2-console.yaml
@@ -12,7 +12,7 @@ maintainers:
 
 properties:
   compatible:
-const: "fsl,dpaa2-console"
+const: fsl,dpaa2-console
 
   reg:
 maxItems: 1
-- 
2.42.0



Re: [PATCH 7/8] of: replace command line handling

2023-11-16 Thread Rob Herring
On Thu, Nov 09, 2023 at 05:38:11PM -0800, Daniel Walker wrote:
> Rob Herring has complained about this section of code. I removed the
> command line handling code to the cmdline.h header. This hopefully makes
> it easier for Rob to maintain it (at least he doesn't have to look at it
> directly anymore).

Well, my goal is to eliminate drivers/of/, but no.

> I would like to add a Kconfig option called
> OF_DEPRECATED_CMDLINE which an architecture would set if it uses this code.

Which architecture needs this code? Do we wait and see who complains 
their platform broke and then go set this option? In the meantime, new 
platforms started depending on the new behavior and setting the option 
may break them. So we can't have a kconfig option.

> This would allow a platform to use the cmdline.h and the added function
> directly and remove the Kconfig option. This change would be in a subsequent
> patch.

Per platform code handling the cmdline is completely the wrong 
direction. Per arch behavior is bad enough.

Rob


Re: [PATCH v8 00/30] Add support for QMC HDLC, framer infrastructure and PEF2256 framer

2023-10-30 Thread Rob Herring
On Wed, Oct 25, 2023 at 12:32:15PM -0700, Jakub Kicinski wrote:
> On Wed, 25 Oct 2023 17:00:51 +0200 Herve Codina wrote:
> > > Which way will those patches go? Via some FSL SoC tree?  
> > 
> > This series seems mature now.
> > What is the plan next in order to have it applied ?
> > 
> > Don't hesitate to tell me if you prefer split series.
> 
> FWIW we are happy to take the drivers/net/ parts if there is no hard
> dependency. But there's no point taking that unless the SoC bits
> also go in for 6.7.
> 
> Li Yang, what are your expectations WRT merging this series?

I think it is too late for SoC stuff for 6.7. 

I picked up binding patches 6, 7, and 8 because 6 and 7 are the same as 
an additionalProperties fix I have in my tree. As 8 depends on them, I 
just picked it up too.

Rob


Re: Several kmemleak reports + "refcount_t: underflow; use-after-free" at boot when OF_UNITTEST + OF_OVERLAY is set (Kernel v6.6-rc6, PowerMac G5 11,2)

2023-10-30 Thread Rob Herring
On Wed, Oct 18, 2023 at 4:38 PM Erhard Furtner  wrote:
>
> Greetings!
>
> Getting this at every boot on my G5 with kernel v6.6-rc6 with OF_UNITTEST and 
> OF_OVERLAY selected:
>
> [...]
> ### dt-test ### EXPECT \ : OF: ERROR: of_node_release() detected bad
> of_node_put() on /testcase-data/refcount-node ### dt-test ### pass
> of_unittest_lifecycle():3189 OF: ERROR: of_node_release() detected bad
> of_node_put() on /testcase-data/refcount-node ### dt-test ### EXPECT / : OF:
> ERROR: of_node_release() detected bad of_node_put() on
> /testcase-data/refcount-node ### dt-test ### EXPECT \ : [ cut here
> ] ### dt-test ### EXPECT \ : WARNING: <> ### dt-test ###
> EXPECT \ : refcount_t: underflow; use-after-free. ### dt-test ### EXPECT \ :

The test tells you to expect a use-after-free...

> ---[ end trace <> ]--- ### dt-test ### pass of_unittest_lifecycle():3209
> [ cut here ]
> refcount_t: underflow; use-after-free.

Then you get a use-after-free. Looks like it is working as designed.

I believe it's the same with kmemleak.

Note that running DT unittests also taints the kernel. That's because
they are not meant to be run on a production system.

Rob


Re: [PATCH v4 1/2] ASoC: dt-bindings: sound-card-common: List sound widgets ignoring system suspend

2023-10-26 Thread Rob Herring
On Mon, Oct 23, 2023 at 10:07:17AM +0800, Chancel Liu wrote:
> Add a property to list audio sound widgets which are marked ignoring
> system suspend. Paths between these endpoints are still active over
> suspend of the main application processor that the current operating
> system is running.

Perhaps it would be better to define components used for low power 
audio rather than the OS mode that gets used. Isn't LPA just audio 
handling that doesn't require the OS CPU to be involved? So the state of 
the CPU is kind of orthogonal.

Rob


Re: [PATCH v3 1/2] ASoC: dt-bindings: sound-card-common: List DAPM endpoints ignoring system suspend

2023-10-12 Thread Rob Herring
On Wed, Oct 11, 2023 at 10:21:33PM +0100, Mark Brown wrote:
> On Wed, Oct 11, 2023 at 07:47:58PM +0800, Chancel Liu wrote:
> 
> > +  lpa-widgets:
> > +$ref: /schemas/types.yaml#/definitions/non-unique-string-array
> > +description: |
> > +  A list of DAPM endpoints which mark paths between these endpoints 
> > should
> > +  not be disabled when system enters in suspend state. LPA means low 
> > power
> > +  audio case. For example on asymmetric multiprocessor, there are 
> > Cortex-A
> 
> I suspect that the DT maintainers would prefer that this description be
> workshopped a bit to remove the Linux specifics.

And Cortex A/M specifics if this is a common binding.


>  I think the key thing
> here is that these are endpoints that can be active over suspend of the
> main application processor that the current operating system is running
> (system DT stuff is an interesting corner case here...), and the example
> is probably a bit specific.  Other bindings use "audio sound widgets"
> rather than "DAPM widgets".
> 
> We also shouldn't see that these endpoints "should not be disabled"
> since that implies that they should be left on even if they aren't
> active which isn't quite the case, instead it's that we can continue
> playing an audio stream through them in suspend.

This seems like one of those things that everyone has/does, and everyone 
handles it a bit differently. I applaud trying to do something common, 
but it isn't really common until we have multiple users.

Rob


[PATCH] usb: Use device_get_match_data()

2023-10-09 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 11 +--
 drivers/usb/dwc2/params.c   | 21 ++---
 drivers/usb/gadget/udc/fsl_qe_udc.c | 10 +++---
 drivers/usb/misc/onboard_usb_hub.c  |  7 +--
 4 files changed, 15 insertions(+), 34 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c 
b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 1321ee67f3b8..180a632dd7ba 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -51,8 +51,8 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct ci_hdrc_usb2_priv *priv;
struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
+   const struct ci_hdrc_platform_data *data;
int ret;
-   const struct of_device_id *match;
 
if (!ci_pdata) {
ci_pdata = devm_kmalloc(dev, sizeof(*ci_pdata), GFP_KERNEL);
@@ -61,11 +61,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
*ci_pdata = ci_default_pdata;   /* struct copy */
}
 
-   match = of_match_device(ci_hdrc_usb2_of_match, &pdev->dev);
-   if (match && match->data) {
+   data = device_get_match_data(&pdev->dev);
+   if (data)
/* struct copy */
-   *ci_pdata = *(struct ci_hdrc_platform_data *)match->data;
-   }
+   *ci_pdata = *data;
 
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 93f52e371cdd..fb03162ae9b7 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -5,7 +5,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -968,26 +968,17 @@ typedef void (*set_params_cb)(struct dwc2_hsotg *data);
 
 int dwc2_init_params(struct dwc2_hsotg *hsotg)
 {
-   const struct of_device_id *match;
set_params_cb set_params;
 
dwc2_set_default_params(hsotg);
dwc2_get_device_properties(hsotg);
 
-   match = of_match_device(dwc2_of_match_table, hsotg->dev);
-   if (match && match->data) {
-   set_params = match->data;
+   set_params = device_get_match_data(hsotg->dev);
+   if (set_params) {
set_params(hsotg);
-   } else if (!match) {
-   const struct acpi_device_id *amatch;
-   const struct pci_device_id *pmatch = NULL;
-
-   amatch = acpi_match_device(dwc2_acpi_match, hsotg->dev);
-   if (amatch && amatch->driver_data) {
-   set_params = (set_params_cb)amatch->driver_data;
-   set_params(hsotg);
-   } else if (!amatch)
-   pmatch = pci_match_id(dwc2_pci_ids, 
to_pci_dev(hsotg->dev->parent));
+   } else {
+   const struct pci_device_id *pmatch =
+   pci_match_id(dwc2_pci_ids, 
to_pci_dev(hsotg->dev->parent));
 
if (pmatch && pmatch->driver_data) {
set_params = (set_params_cb)pmatch->driver_data;
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c 
b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 4aae86b47edf..4e88681a79b6 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -27,9 +27,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2471,17 +2472,12 @@ static const struct of_device_id qe_udc_match[];
 static int qe_udc_probe(struct platform_device *ofdev)
 {
struct qe_udc *udc;
-   const struct of_device_id *match;
struct device_node *np = ofdev->dev.of_node;
struct qe_ep *ep;
unsigned int ret = 0;
unsigned int i;
const void *prop;
 
-   match = of_match_device(qe_udc_match, &ofdev->dev);
-   if (!match)
-   return -EINVAL;
-
prop = of_get_property(np, "mode", NULL);
if (!prop || strcmp(prop, "peripheral"))
return -ENODEV;
@@ -2493,7 +2489,7 @@ static int qe_udc_probe(struct platform_device *ofdev)
return -ENOMEM;
}
 
-   udc->soc_type = (unsigned long)match->data;
+   udc->soc_type = (unsigned long)device_get_match_data(&ofdev->dev);
udc->usb_regs = of_iomap(np, 0);
if (!udc->usb_regs) {
ret = -ENOMEM;
diff --git a/drivers/usb/misc/onboard_usb_hub.c 
b/drivers/usb/misc/onboard_usb_hub.c
ind

[PATCH net-next] net: ethernet: Use device_get_match_data()

2023-10-09 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
 drivers/net/ethernet/altera/altera_tse.h  |  2 +-
 drivers/net/ethernet/altera/altera_tse_main.c | 13 ++
 drivers/net/ethernet/amd/xgbe/xgbe-platform.c | 42 +--
 .../net/ethernet/apm/xgene/xgene_enet_main.c  | 15 +--
 .../net/ethernet/apm/xgene/xgene_enet_main.h  |  3 +-
 drivers/net/ethernet/freescale/fec_main.c | 12 +++---
 .../ethernet/freescale/fs_enet/fs_enet-main.c | 18 
 .../net/ethernet/freescale/fs_enet/mii-fec.c  | 10 ++---
 drivers/net/ethernet/freescale/fsl_pq_mdio.c  | 12 ++
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 11 ++---
 .../stmicro/stmmac/dwmac-intel-plat.c |  9 ++--
 drivers/net/ethernet/ti/davinci_emac.c| 12 ++
 drivers/net/ethernet/ti/icssg/icssg_prueth.c  | 13 ++
 13 files changed, 40 insertions(+), 132 deletions(-)

diff --git a/drivers/net/ethernet/altera/altera_tse.h 
b/drivers/net/ethernet/altera/altera_tse.h
index db5eed06e92d..82f2363a45cd 100644
--- a/drivers/net/ethernet/altera/altera_tse.h
+++ b/drivers/net/ethernet/altera/altera_tse.h
@@ -472,7 +472,7 @@ struct altera_tse_private {
/* ethtool msglvl option */
u32 msg_enable;
 
-   struct altera_dmaops *dmaops;
+   const struct altera_dmaops *dmaops;
 
struct phylink *phylink;
struct phylink_config phylink_config;
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c 
b/drivers/net/ethernet/altera/altera_tse_main.c
index 1b1799985d1d..1c8763be0e4b 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -29,13 +29,13 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -82,8 +82,6 @@ MODULE_PARM_DESC(dma_tx_num, "Number of descriptors in the TX 
list");
 
 #define TXQUEUESTOP_THRESHHOLD 2
 
-static const struct of_device_id altera_tse_ids[];
-
 static inline u32 tse_tx_avail(struct altera_tse_private *priv)
 {
return priv->tx_cons + priv->tx_ring_size - priv->tx_prod - 1;
@@ -1133,7 +1131,6 @@ static int request_and_map(struct platform_device *pdev, 
const char *name,
  */
 static int altera_tse_probe(struct platform_device *pdev)
 {
-   const struct of_device_id *of_id = NULL;
struct regmap_config pcs_regmap_cfg;
struct altera_tse_private *priv;
struct mdio_regmap_config mrc;
@@ -1159,11 +1156,7 @@ static int altera_tse_probe(struct platform_device *pdev)
priv->dev = ndev;
priv->msg_enable = netif_msg_init(debug, default_msg_level);
 
-   of_id = of_match_device(altera_tse_ids, &pdev->dev);
-
-   if (of_id)
-   priv->dmaops = (struct altera_dmaops *)of_id->data;
-
+   priv->dmaops = device_get_match_data(&pdev->dev);
 
if (priv->dmaops &&
priv->dmaops->altera_dtype == ALTERA_DTYPE_SGDMA) {
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c 
b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
index 91842a5e161b..9131020d06af 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-platform.c
@@ -123,9 +123,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -135,17 +133,6 @@
 #include "xgbe-common.h"
 
 #ifdef CONFIG_ACPI
-static const struct acpi_device_id xgbe_acpi_match[];
-
-static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata)
-{
-   const struct acpi_device_id *id;
-
-   id = acpi_match_device(xgbe_acpi_match, pdata->dev);
-
-   return id ? (struct xgbe_version_data *)id->driver_data : NULL;
-}
-
 static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
 {
struct device *dev = pdata->dev;
@@ -173,11 +160,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
return 0;
 }
 #else   /* CONFIG_ACPI */
-static struct xgbe_version_data *xgbe_acpi_vdata(struct xgbe_prv_data *pdata)
-{
-   return NULL;
-}
-
 static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
 {
return -EINVAL;
@@ -185,17 +167,6 @@ static int xgbe_acpi_support(struct xgbe_prv_data *pdata)
 #endif  /* CONFIG_ACPI */
 
 #ifdef CONFIG_OF
-static const struct of_device_id xgbe_of_match[];
-
-static struct xgbe_version_data *xgbe_of_vdata(struct xgbe_prv_data *pdata)
-{
-   const struct of_device_id *id;
-
-   id = of_match_device(xgbe_of_match, pdata->dev);
-
-   return id ? (struct xgbe_version_data *)id->data : NULL;
-}
-
 static int xgbe_of_support(struct xgbe_prv_data *pdata)
 {
struct device *dev = pdata->dev;
@@ -244,11 +215,6 @@ static struct platform_device *xgbe_of_get_phy_pd

[PATCH] powerpc: fsl_msi: Use device_get_match_data()

2023-10-06 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
 arch/powerpc/sysdev/fsl_msi.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 57978a44d55b..558ec68d768e 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -11,9 +11,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -392,7 +394,6 @@ static int fsl_msi_setup_hwirq(struct fsl_msi *msi, struct 
platform_device *dev,
 static const struct of_device_id fsl_of_msi_ids[];
 static int fsl_of_msi_probe(struct platform_device *dev)
 {
-   const struct of_device_id *match;
struct fsl_msi *msi;
struct resource res, msiir;
int err, i, j, irq_index, count;
@@ -402,10 +403,7 @@ static int fsl_of_msi_probe(struct platform_device *dev)
u32 offset;
struct pci_controller *phb;
 
-   match = of_match_device(fsl_of_msi_ids, &dev->dev);
-   if (!match)
-   return -EINVAL;
-   features = match->data;
+   features = device_get_match_data(&dev->dev);
 
printk(KERN_DEBUG "Setting up Freescale MSI support\n");
 
-- 
2.40.1



[PATCH v3 3/5] ASoC: da7218: Use i2c_get_match_data()

2023-10-06 Thread Rob Herring
Use preferred i2c_get_match_data() instead of of_match_device() and
i2c_match_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Avoid using 0 for enum da7218_dev_id so that no match data can be
distinguished.

Signed-off-by: Rob Herring 
---
 sound/soc/codecs/da7218.c | 29 ++---
 sound/soc/codecs/da7218.h |  2 +-
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 3f456b08b809..8aacd7350798 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -9,7 +9,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2285,16 +2285,6 @@ static const struct of_device_id da7218_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, da7218_of_match);
 
-static inline int da7218_of_get_id(struct device *dev)
-{
-   const struct of_device_id *id = of_match_device(da7218_of_match, dev);
-
-   if (id)
-   return (uintptr_t)id->data;
-   else
-   return -EINVAL;
-}
-
 static enum da7218_micbias_voltage
da7218_of_micbias_lvl(struct snd_soc_component *component, u32 val)
 {
@@ -3253,18 +3243,6 @@ static const struct regmap_config da7218_regmap_config = 
{
  * I2C layer
  */
 
-static const struct i2c_device_id da7218_i2c_id[];
-
-static inline int da7218_i2c_get_id(struct i2c_client *i2c)
-{
-   const struct i2c_device_id *id = i2c_match_id(da7218_i2c_id, i2c);
-
-   if (id)
-   return (uintptr_t)id->driver_data;
-   else
-   return -EINVAL;
-}
-
 static int da7218_i2c_probe(struct i2c_client *i2c)
 {
struct da7218_priv *da7218;
@@ -3276,10 +3254,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, da7218);
 
-   if (i2c->dev.of_node)
-   da7218->dev_id = da7218_of_get_id(&i2c->dev);
-   else
-   da7218->dev_id = da7218_i2c_get_id(i2c);
+   da7218->dev_id = (uintptr_t)i2c_get_match_data(i2c);
 
if ((da7218->dev_id != DA7217_DEV_ID) &&
(da7218->dev_id != DA7218_DEV_ID)) {
diff --git a/sound/soc/codecs/da7218.h b/sound/soc/codecs/da7218.h
index 9ac2892092b5..7f6a4aea2c7a 100644
--- a/sound/soc/codecs/da7218.h
+++ b/sound/soc/codecs/da7218.h
@@ -1369,7 +1369,7 @@ enum da7218_sys_clk {
 };
 
 enum da7218_dev_id {
-   DA7217_DEV_ID = 0,
+   DA7217_DEV_ID = 1,
DA7218_DEV_ID,
 };
 

-- 
2.40.1



[PATCH v3 4/5] ASoC: qcom/lpass: Constify struct lpass_variant

2023-10-06 Thread Rob Herring
'struct lpass_variant' is used for driver match data which is supposed to
be constant. It's not modified anywhere, so it's just a matter of adding
'const' everywhere.

Signed-off-by: Rob Herring 
---
 sound/soc/qcom/lpass-apq8016.c  |  6 +++---
 sound/soc/qcom/lpass-cdc-dma.c  |  2 +-
 sound/soc/qcom/lpass-cpu.c  | 28 ++--
 sound/soc/qcom/lpass-ipq806x.c  |  2 +-
 sound/soc/qcom/lpass-platform.c | 36 ++--
 sound/soc/qcom/lpass-sc7180.c   |  6 +++---
 sound/soc/qcom/lpass-sc7280.c   |  6 +++---
 sound/soc/qcom/lpass.h  |  2 +-
 8 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index f919d46e18ca..8ce75b442b64 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -123,7 +123,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
   int direction, unsigned int dai_id)
 {
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -157,7 +157,7 @@ static int apq8016_lpass_free_dma_channel(struct lpass_data 
*drvdata, int chan,
 static int apq8016_lpass_init(struct platform_device *pdev)
 {
struct lpass_data *drvdata = platform_get_drvdata(pdev);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
struct device *dev = &pdev->dev;
int ret, i;
 
@@ -223,7 +223,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
 }
 
 
-static struct lpass_variant apq8016_data = {
+static const struct lpass_variant apq8016_data = {
.i2sctrl_reg_base   = 0x1000,
.i2sctrl_reg_stride = 0x1000,
.i2s_ports  = 4,
diff --git a/sound/soc/qcom/lpass-cdc-dma.c b/sound/soc/qcom/lpass-cdc-dma.c
index 8221e2cbe35c..6389c7b6051e 100644
--- a/sound/soc/qcom/lpass-cdc-dma.c
+++ b/sound/soc/qcom/lpass-cdc-dma.c
@@ -37,7 +37,7 @@ static void __lpass_get_dmactl_handle(struct 
snd_pcm_substream *substream, struc
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
unsigned int dai_id = cpu_dai->driver->id;
 
switch (dai_id) {
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 39571fed4001..18aff2654f89 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -44,7 +44,7 @@ static int lpass_cpu_init_i2sctl_bitfields(struct device *dev,
struct lpaif_i2sctl *i2sctl, struct regmap *map)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
 
i2sctl->loopback = devm_regmap_field_alloc(dev, map, v->loopback);
i2sctl->spken = devm_regmap_field_alloc(dev, map, v->spken);
@@ -463,7 +463,7 @@ static int asoc_qcom_of_xlate_dai_name(struct 
snd_soc_component *component,
   const char **dai_name)
 {
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
int id = args->args[0];
int ret = -EINVAL;
int i;
@@ -488,7 +488,7 @@ static const struct snd_soc_component_driver 
lpass_cpu_comp_driver = {
 static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -530,7 +530,7 @@ static bool lpass_cpu_regmap_writeable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -578,7 +578,7 @@ static bool lpass_cpu_regmap_readable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_varia

[PATCH v3 5/5] ASoC: Use device_get_match_data()

2023-10-06 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
v3:
 - Move some header changes from patch 1 to here for rockchip_i2s_tdm.c,
   rockchip_pdm.c, smdk_wm8994.c, and tegra210_amx.c.
---
 sound/soc/intel/keembay/kmb_platform.c | 13 +
 sound/soc/qcom/lpass-cpu.c | 15 +--
 sound/soc/rockchip/rockchip_i2s.c  |  8 +++-
 sound/soc/rockchip/rockchip_i2s_tdm.c  | 24 
 sound/soc/rockchip/rockchip_pdm.c  |  7 +--
 sound/soc/samsung/smdk_wm8994.c| 28 +++-
 sound/soc/stm/stm32_i2s.c  |  7 ++-
 sound/soc/stm/stm32_sai.c  |  8 
 sound/soc/stm/stm32_sai_sub.c  |  6 +-
 sound/soc/stm/stm32_spdifrx.c  |  8 ++--
 sound/soc/tegra/tegra210_amx.c | 10 ++
 sound/soc/ti/davinci-evm.c |  7 ++-
 sound/soc/ti/davinci-mcasp.c   |  9 -
 sound/soc/ti/omap-mcbsp.c  | 10 --
 14 files changed, 42 insertions(+), 118 deletions(-)

diff --git a/sound/soc/intel/keembay/kmb_platform.c 
b/sound/soc/intel/keembay/kmb_platform.c
index e929497a5eb5..37ea2e1d2e92 100644
--- a/sound/soc/intel/keembay/kmb_platform.c
+++ b/sound/soc/intel/keembay/kmb_platform.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -820,7 +819,6 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
struct snd_soc_dai_driver *kmb_i2s_dai;
-   const struct of_device_id *match;
struct device *dev = &pdev->dev;
struct kmb_i2s_info *kmb_i2s;
struct resource *res;
@@ -831,16 +829,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
if (!kmb_i2s)
return -ENOMEM;
 
-   kmb_i2s_dai = devm_kzalloc(dev, sizeof(*kmb_i2s_dai), GFP_KERNEL);
-   if (!kmb_i2s_dai)
-   return -ENOMEM;
-
-   match = of_match_device(kmb_plat_of_match, &pdev->dev);
-   if (!match) {
-   dev_err(&pdev->dev, "Error: No device match found\n");
-   return -ENODEV;
-   }
-   kmb_i2s_dai = (struct snd_soc_dai_driver *) match->data;
+   kmb_i2s_dai = (struct snd_soc_dai_driver 
*)device_get_match_data(&pdev->dev);
 
/* Prepare the related clocks */
kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk");
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 18aff2654f89..ac0feb89b458 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1106,7 +1105,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
struct resource *res;
const struct lpass_variant *variant;
struct device *dev = &pdev->dev;
-   const struct of_device_id *match;
int ret, i, dai_id;
 
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
@@ -1121,17 +1119,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, drvdata);
 
-   match = of_match_device(dev->driver->of_match_table, dev);
-   if (!match || !match->data)
+   variant = device_get_match_data(dev);
+   if (!variant)
return -EINVAL;
 
-   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) {
-   dev_warn(dev, "%s compatible is deprecated\n",
-match->compatible);
-   }
+   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016"))
+   dev_warn(dev, "qcom,lpass-cpu-apq8016 compatible is 
deprecated\n");
 
-   drvdata->variant = (struct lpass_variant *)match->data;
-   variant = drvdata->variant;
+   drvdata->variant = variant;
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
diff --git a/sound/soc/rockchip/rockchip_i2s.c 
b/sound/soc/rockchip/rockchip_i2s.c
index 74e7d6ee0f28..b0c3ef030e06 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -10,8 +10,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -736,7 +736,6 @@ static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, 
struct resource *res,
 static int rockchip_i2s_probe(struct platform_device *pdev)
 {
struct device_node *node = pdev->dev.of_node;
-   const struct of_device_id *of_id;
struct rk_i2s_dev *i2s;
struct snd_soc_dai_driver *dai;
struct resource *res;
@@ -752,11 +751,10 @@ static int rock

[PATCH v3 2/5] ASoC: Drop unnecessary of_match_device() calls

2023-10-06 Thread Rob Herring
If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Acked-by: Charles Keepax 
Signed-off-by: Rob Herring 
---
 sound/soc/codecs/ak5386.c  |  7 ++-
 sound/soc/codecs/cs4271.c  | 22 ++
 sound/soc/codecs/tas5086.c |  6 +-
 3 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c
index 0c5e00679c7d..21a44476f48d 100644
--- a/sound/soc/codecs/ak5386.c
+++ b/sound/soc/codecs/ak5386.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -168,7 +167,6 @@ static int ak5386_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
 
-   priv->reset_gpio = -EINVAL;
dev_set_drvdata(dev, priv);
 
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
@@ -179,9 +177,8 @@ static int ak5386_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
 
-   if (of_match_device(of_match_ptr(ak5386_dt_ids), dev))
-   priv->reset_gpio = of_get_named_gpio(dev->of_node,
- "reset-gpio", 0);
+   priv->reset_gpio = of_get_named_gpio(dev->of_node,
+"reset-gpio", 0);
 
if (gpio_is_valid(priv->reset_gpio))
if (devm_gpio_request_one(dev, priv->reset_gpio,
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 188b8b43c524..9e6f8a048dd5 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -563,19 +562,12 @@ static int cs4271_component_probe(struct 
snd_soc_component *component)
struct cs4271_private *cs4271 = 
snd_soc_component_get_drvdata(component);
struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
int ret;
-   bool amutec_eq_bmutec = false;
+   bool amutec_eq_bmutec;
 
-#ifdef CONFIG_OF
-   if (of_match_device(cs4271_dt_ids, component->dev)) {
-   if (of_get_property(component->dev->of_node,
-"cirrus,amutec-eq-bmutec", NULL))
-   amutec_eq_bmutec = true;
-
-   if (of_get_property(component->dev->of_node,
-"cirrus,enable-soft-reset", NULL))
-   cs4271->enable_soft_reset = true;
-   }
-#endif
+   amutec_eq_bmutec = of_property_read_bool(component->dev->of_node,
+"cirrus,amutec-eq-bmutec");
+   cs4271->enable_soft_reset = 
of_property_read_bool(component->dev->of_node,
+ 
"cirrus,enable-soft-reset");
 
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies);
@@ -655,9 +647,7 @@ static int cs4271_common_probe(struct device *dev,
if (!cs4271)
return -ENOMEM;
 
-   if (of_match_device(cs4271_dt_ids, dev))
-   cs4271->gpio_nreset =
-   of_get_named_gpio(dev->of_node, "reset-gpio", 0);
+   cs4271->gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
 
if (cs4271plat)
cs4271->gpio_nreset = cs4271plat->gpio_nreset;
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 60e59e993ba6..f52c14b43f28 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -940,11 +940,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, priv);
 
-   if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) {
-   struct device_node *of_node = dev->of_node;
-   gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0);
-   }
-
+   gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
if (gpio_is_valid(gpio_nreset))
if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset"))
gpio_nreset = -EINVAL;

-- 
2.40.1



[PATCH v3 1/5] ASoC: Explicitly include correct DT includes

2023-10-06 Thread Rob Herring
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec 
Reviewed-by: AngeloGioacchino Del Regno 

Acked-by: Charles Keepax 
Reviewed-by: Claudiu Beznea  # for at91
Signed-off-by: Rob Herring 
---
v3:
 - Move some header changes to patch 5
---
 sound/soc/atmel/atmel_wm8904.c | 1 -
 sound/soc/atmel/mchp-i2s-mcc.c | 2 +-
 sound/soc/atmel/tse850-pcm5142.c   | 1 -
 sound/soc/bcm/cygnus-ssp.c | 2 +-
 sound/soc/codecs/adau1701.c| 1 -
 sound/soc/codecs/adau1977-spi.c| 1 -
 sound/soc/codecs/ak4104.c  | 2 +-
 sound/soc/codecs/ak4118.c  | 2 +-
 sound/soc/codecs/ak4375.c  | 2 +-
 sound/soc/codecs/ak4458.c  | 2 +-
 sound/soc/codecs/ak4613.c  | 2 +-
 sound/soc/codecs/ak4642.c  | 2 +-
 sound/soc/codecs/ak5558.c  | 2 +-
 sound/soc/codecs/cs35l32.c | 2 +-
 sound/soc/codecs/cs35l33.c | 2 --
 sound/soc/codecs/cs35l34.c | 2 +-
 sound/soc/codecs/cs35l35.c | 3 +--
 sound/soc/codecs/cs35l36.c | 3 +--
 sound/soc/codecs/cs35l41-i2c.c | 2 +-
 sound/soc/codecs/cs35l41.c | 1 -
 sound/soc/codecs/cs4270.c  | 2 +-
 sound/soc/codecs/cs42l42.c | 1 -
 sound/soc/codecs/cs42l56.c | 2 +-
 sound/soc/codecs/cs42xx8-i2c.c | 2 +-
 sound/soc/codecs/cs43130.c | 3 +--
 sound/soc/codecs/cs4349.c  | 2 +-
 sound/soc/codecs/da7213.c  | 2 +-
 sound/soc/codecs/da7219.c  | 2 +-
 sound/soc/codecs/da9055.c  | 1 -
 sound/soc/codecs/es8328.c  | 1 -
 sound/soc/codecs/gtm601.c  | 2 +-
 sound/soc/codecs/lpass-macro-common.c  | 2 +-
 sound/soc/codecs/mt6351.c  | 2 +-
 sound/soc/codecs/mt6358.c  | 2 +-
 sound/soc/codecs/mt6359-accdet.c   | 4 
 sound/soc/codecs/mt6359.c  | 2 +-
 sound/soc/codecs/nau8540.c | 2 +-
 sound/soc/codecs/pcm1681.c | 2 --
 sound/soc/codecs/rt715.c   | 2 --
 sound/soc/codecs/sgtl5000.c| 2 +-
 sound/soc/codecs/sma1303.c | 2 +-
 sound/soc/codecs/sta32x.c  | 3 +--
 sound/soc/codecs/sta350.c  | 3 +--
 sound/soc/codecs/tas571x.c | 2 +-
 sound/soc/codecs/uda1334.c | 2 +-
 sound/soc/codecs/wm8510.c  | 2 +-
 sound/soc/codecs/wm8523.c  | 2 +-
 sound/soc/codecs/wm8524.c  | 2 +-
 sound/soc/codecs/wm8580.c  | 2 +-
 sound/soc/codecs/wm8711.c  | 2 +-
 sound/soc/codecs/wm8728.c  | 2 +-
 sound/soc/codecs/wm8731-i2c.c  | 2 +-
 sound/soc/codecs/wm8731-spi.c  | 2 +-
 sound/soc/codecs/wm8737.c  | 2 +-
 sound/soc/codecs/wm8741.c  | 2 +-
 sound/soc/codecs/wm8750.c  | 2 +-
 sound/soc/codecs/wm8753.c  | 2 +-
 sound/soc/codecs/wm8770.c  | 2 +-
 sound/soc/codecs/wm8776.c  | 2 +-
 sound/soc/codecs/wm8804.c  | 1 -
 sound/soc/fsl/efika-audio-fabric.c | 4 ++--
 sound/soc/fsl/fsl_aud2htx.c| 3 +--
 sound/soc/fsl/fsl_mqs.c| 2 +-
 sound/soc/

[PATCH v3 0/5] ASoC: DT matching and header cleanups

2023-10-06 Thread Rob Herring
(trimmed the recipient list due to bounces on v1)

This is a series is part of ongoing clean-ups related to device 
matching and DT related implicit includes. Essentially of_device.h has 
a bunch of implicit includes and generally isn't needed any nore except 
for of_match_device(). As we also generally want to get rid of 
of_match_device() as well, I've done that so we're not updating the 
includes twice.

Signed-off-by: Rob Herring 
---
Changes in v3:
- Move some include changes from patch #1 to #5 to fix build with just 
  patch #1 applied.
- Link to v2: 
https://lore.kernel.org/r/20231004-dt-asoc-header-cleanups-v2-0-e77765080...@kernel.org

Changes in v2:
- Add tags
- Link to v1: 
https://lore.kernel.org/r/20231003-dt-asoc-header-cleanups-v1-0-308666806...@kernel.org
- Link to v1 resend: 
https://lore.kernel.org/r/20231003-dt-asoc-header-cleanups-v1-0-05b5d6447...@kernel.org/

---
Rob Herring (5):
  ASoC: Explicitly include correct DT includes
  ASoC: Drop unnecessary of_match_device() calls
  ASoC: da7218: Use i2c_get_match_data()
  ASoC: qcom/lpass: Constify struct lpass_variant
  ASoC: Use device_get_match_data()

 sound/soc/atmel/atmel_wm8904.c |  1 -
 sound/soc/atmel/mchp-i2s-mcc.c |  2 +-
 sound/soc/atmel/tse850-pcm5142.c   |  1 -
 sound/soc/bcm/cygnus-ssp.c |  2 +-
 sound/soc/codecs/adau1701.c|  1 -
 sound/soc/codecs/adau1977-spi.c|  1 -
 sound/soc/codecs/ak4104.c  |  2 +-
 sound/soc/codecs/ak4118.c  |  2 +-
 sound/soc/codecs/ak4375.c  |  2 +-
 sound/soc/codecs/ak4458.c  |  2 +-
 sound/soc/codecs/ak4613.c  |  2 +-
 sound/soc/codecs/ak4642.c  |  2 +-
 sound/soc/codecs/ak5386.c  |  7 +---
 sound/soc/codecs/ak5558.c  |  2 +-
 sound/soc/codecs/cs35l32.c |  2 +-
 sound/soc/codecs/cs35l33.c |  2 -
 sound/soc/codecs/cs35l34.c |  2 +-
 sound/soc/codecs/cs35l35.c |  3 +-
 sound/soc/codecs/cs35l36.c |  3 +-
 sound/soc/codecs/cs35l41-i2c.c |  2 +-
 sound/soc/codecs/cs35l41.c |  1 -
 sound/soc/codecs/cs4270.c  |  2 +-
 sound/soc/codecs/cs4271.c  | 22 +++
 sound/soc/codecs/cs42l42.c |  1 -
 sound/soc/codecs/cs42l56.c |  2 +-
 sound/soc/codecs/cs42xx8-i2c.c |  2 +-
 sound/soc/codecs/cs43130.c |  3 +-
 sound/soc/codecs/cs4349.c  |  2 +-
 sound/soc/codecs/da7213.c  |  2 +-
 sound/soc/codecs/da7218.c  | 29 +--
 sound/soc/codecs/da7218.h  |  2 +-
 sound/soc/codecs/da7219.c  |  2 +-
 sound/soc/codecs/da9055.c  |  1 -
 sound/soc/codecs/es8328.c  |  1 -
 sound/soc/codecs/gtm601.c  |  2 +-
 sound/soc/codecs/lpass-macro-common.c  |  2 +-
 sound/soc/codecs/mt6351.c  |  2 +-
 sound/soc/codecs/mt6358.c  |  2 +-
 sound/soc/codecs/mt6359-accdet.c   |  4 --
 sound/soc/codecs/mt6359.c  |  2 +-
 sound/soc/codecs/nau8540.c |  2 +-
 sound/soc/codecs/pcm1681.c |  2 -
 sound/soc/codecs/rt715.c   |  2 -
 sound/soc/codecs/sgtl5000.c|  2 +-
 sound/soc/codecs/sma1303.c |  2 +-
 sound/soc/codecs/sta32x.c  |  3 +-
 sound/soc/codecs/sta350.c  |  3 +-
 sound/soc/codecs/tas5086.c |  6 +--
 sound/soc/codecs/tas571x.c |  2 +-
 sound/soc/codecs/uda1334.c |  2 +-
 sound/soc/codecs/wm8510.c  |  2 +-
 sound/soc/codecs/wm8523.c  |  2 +-
 sound/soc/codecs/wm8524.c  |  2 +-
 sound/soc/codecs/wm8580.c  |  2 +-
 sound/soc/codecs/wm8711.c  |  2 +-
 sound/soc/codecs/wm8728.c  |  2 +-
 sound/soc/codecs/wm8731-i2c.c  |  2 +-
 sound/soc/codecs/wm8731-spi.c  |  2 +-
 sound/soc/codecs/wm8737.c  |  2 +-
 sound/soc/codecs/wm8741.c  |  2 +-
 sound/soc/codecs/wm8750.c  |  2 +-
 sound/soc/codecs/wm8753.c  |  2 +-
 sound/soc/codecs/wm8770.c  |  2 +-
 sound/soc/

Re: [PATCH v2 1/5] ASoC: Explicitly include correct DT includes

2023-10-04 Thread Rob Herring
On Wed, Oct 4, 2023 at 12:39 PM Mark Brown  wrote:
>
> On Wed, Oct 04, 2023 at 10:58:05AM -0500, Rob Herring wrote:
> > The DT of_device.h and of_platform.h date back to the separate
> > of_platform_bus_type before it was merged into the regular platform bus.
> > As part of that merge prepping Arm DT support 13 years ago, they
> > "temporarily" include each other. They also include platform_device.h
> > and of.h. As a result, there's a pretty much random mix of those include
> > files used throughout the tree. In order to detangle these headers and
> > replace the implicit includes with struct declarations, users need to
> > explicitly include the correct includes.
>
> This is breaking various builds for me, for example arm64 defconfig:

I believe I got some of the include changes in the wrong place. They
should go into patch 5.

Rob


[PATCH v2 3/5] ASoC: da7218: Use i2c_get_match_data()

2023-10-04 Thread Rob Herring
Use preferred i2c_get_match_data() instead of of_match_device() and
i2c_match_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Avoid using 0 for enum da7218_dev_id so that no match data can be
distinguished.

Signed-off-by: Rob Herring 
---
 sound/soc/codecs/da7218.c | 29 ++---
 sound/soc/codecs/da7218.h |  2 +-
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 3f456b08b809..8aacd7350798 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -9,7 +9,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2285,16 +2285,6 @@ static const struct of_device_id da7218_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, da7218_of_match);
 
-static inline int da7218_of_get_id(struct device *dev)
-{
-   const struct of_device_id *id = of_match_device(da7218_of_match, dev);
-
-   if (id)
-   return (uintptr_t)id->data;
-   else
-   return -EINVAL;
-}
-
 static enum da7218_micbias_voltage
da7218_of_micbias_lvl(struct snd_soc_component *component, u32 val)
 {
@@ -3253,18 +3243,6 @@ static const struct regmap_config da7218_regmap_config = 
{
  * I2C layer
  */
 
-static const struct i2c_device_id da7218_i2c_id[];
-
-static inline int da7218_i2c_get_id(struct i2c_client *i2c)
-{
-   const struct i2c_device_id *id = i2c_match_id(da7218_i2c_id, i2c);
-
-   if (id)
-   return (uintptr_t)id->driver_data;
-   else
-   return -EINVAL;
-}
-
 static int da7218_i2c_probe(struct i2c_client *i2c)
 {
struct da7218_priv *da7218;
@@ -3276,10 +3254,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, da7218);
 
-   if (i2c->dev.of_node)
-   da7218->dev_id = da7218_of_get_id(&i2c->dev);
-   else
-   da7218->dev_id = da7218_i2c_get_id(i2c);
+   da7218->dev_id = (uintptr_t)i2c_get_match_data(i2c);
 
if ((da7218->dev_id != DA7217_DEV_ID) &&
(da7218->dev_id != DA7218_DEV_ID)) {
diff --git a/sound/soc/codecs/da7218.h b/sound/soc/codecs/da7218.h
index 9ac2892092b5..7f6a4aea2c7a 100644
--- a/sound/soc/codecs/da7218.h
+++ b/sound/soc/codecs/da7218.h
@@ -1369,7 +1369,7 @@ enum da7218_sys_clk {
 };
 
 enum da7218_dev_id {
-   DA7217_DEV_ID = 0,
+   DA7217_DEV_ID = 1,
DA7218_DEV_ID,
 };
 

-- 
2.40.1



[PATCH v2 1/5] ASoC: Explicitly include correct DT includes

2023-10-04 Thread Rob Herring
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec 
Reviewed-by: AngeloGioacchino Del Regno 

Acked-by: Charles Keepax 
Signed-off-by: Rob Herring 
---
 sound/soc/atmel/atmel_wm8904.c | 1 -
 sound/soc/atmel/mchp-i2s-mcc.c | 2 +-
 sound/soc/atmel/tse850-pcm5142.c   | 1 -
 sound/soc/bcm/cygnus-ssp.c | 2 +-
 sound/soc/codecs/adau1701.c| 1 -
 sound/soc/codecs/adau1977-spi.c| 1 -
 sound/soc/codecs/ak4104.c  | 2 +-
 sound/soc/codecs/ak4118.c  | 2 +-
 sound/soc/codecs/ak4375.c  | 2 +-
 sound/soc/codecs/ak4458.c  | 2 +-
 sound/soc/codecs/ak4613.c  | 2 +-
 sound/soc/codecs/ak4642.c  | 2 +-
 sound/soc/codecs/ak5558.c  | 2 +-
 sound/soc/codecs/cs35l32.c | 2 +-
 sound/soc/codecs/cs35l33.c | 2 --
 sound/soc/codecs/cs35l34.c | 2 +-
 sound/soc/codecs/cs35l35.c | 3 +--
 sound/soc/codecs/cs35l36.c | 3 +--
 sound/soc/codecs/cs35l41-i2c.c | 2 +-
 sound/soc/codecs/cs35l41.c | 1 -
 sound/soc/codecs/cs4270.c  | 2 +-
 sound/soc/codecs/cs42l42.c | 1 -
 sound/soc/codecs/cs42l56.c | 2 +-
 sound/soc/codecs/cs42xx8-i2c.c | 2 +-
 sound/soc/codecs/cs43130.c | 3 +--
 sound/soc/codecs/cs4349.c  | 2 +-
 sound/soc/codecs/da7213.c  | 2 +-
 sound/soc/codecs/da7219.c  | 2 +-
 sound/soc/codecs/da9055.c  | 1 -
 sound/soc/codecs/es8328.c  | 1 -
 sound/soc/codecs/gtm601.c  | 2 +-
 sound/soc/codecs/lpass-macro-common.c  | 2 +-
 sound/soc/codecs/mt6351.c  | 2 +-
 sound/soc/codecs/mt6358.c  | 2 +-
 sound/soc/codecs/mt6359-accdet.c   | 4 
 sound/soc/codecs/mt6359.c  | 2 +-
 sound/soc/codecs/nau8540.c | 2 +-
 sound/soc/codecs/pcm1681.c | 2 --
 sound/soc/codecs/rt715.c   | 2 --
 sound/soc/codecs/sgtl5000.c| 2 +-
 sound/soc/codecs/sma1303.c | 2 +-
 sound/soc/codecs/sta32x.c  | 3 +--
 sound/soc/codecs/sta350.c  | 3 +--
 sound/soc/codecs/tas571x.c | 2 +-
 sound/soc/codecs/uda1334.c | 2 +-
 sound/soc/codecs/wm8510.c  | 2 +-
 sound/soc/codecs/wm8523.c  | 2 +-
 sound/soc/codecs/wm8524.c  | 2 +-
 sound/soc/codecs/wm8580.c  | 2 +-
 sound/soc/codecs/wm8711.c  | 2 +-
 sound/soc/codecs/wm8728.c  | 2 +-
 sound/soc/codecs/wm8731-i2c.c  | 2 +-
 sound/soc/codecs/wm8731-spi.c  | 2 +-
 sound/soc/codecs/wm8737.c  | 2 +-
 sound/soc/codecs/wm8741.c  | 2 +-
 sound/soc/codecs/wm8750.c  | 2 +-
 sound/soc/codecs/wm8753.c  | 2 +-
 sound/soc/codecs/wm8770.c  | 2 +-
 sound/soc/codecs/wm8776.c  | 2 +-
 sound/soc/codecs/wm8804.c  | 1 -
 sound/soc/fsl/efika-audio-fabric.c | 4 ++--
 sound/soc/fsl/fsl_aud2htx.c| 3 +--
 sound/soc/fsl/fsl_mqs.c| 2 +-
 sound/soc/fsl/fsl_rpmsg.c  | 3 +--
 sound/so

[PATCH v2 5/5] ASoC: Use device_get_match_data()

2023-10-04 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
 sound/soc/intel/keembay/kmb_platform.c | 13 +
 sound/soc/qcom/lpass-cpu.c | 15 +--
 sound/soc/rockchip/rockchip_i2s.c  |  8 +++-
 sound/soc/rockchip/rockchip_i2s_tdm.c  | 20 +++-
 sound/soc/rockchip/rockchip_pdm.c  |  6 +-
 sound/soc/samsung/smdk_wm8994.c| 27 +++
 sound/soc/stm/stm32_i2s.c  |  7 ++-
 sound/soc/stm/stm32_sai.c  |  8 
 sound/soc/stm/stm32_sai_sub.c  |  6 +-
 sound/soc/stm/stm32_spdifrx.c  |  8 ++--
 sound/soc/tegra/tegra210_amx.c |  7 +--
 sound/soc/ti/davinci-evm.c |  7 ++-
 sound/soc/ti/davinci-mcasp.c   |  9 -
 sound/soc/ti/omap-mcbsp.c  | 10 --
 14 files changed, 40 insertions(+), 111 deletions(-)

diff --git a/sound/soc/intel/keembay/kmb_platform.c 
b/sound/soc/intel/keembay/kmb_platform.c
index e929497a5eb5..37ea2e1d2e92 100644
--- a/sound/soc/intel/keembay/kmb_platform.c
+++ b/sound/soc/intel/keembay/kmb_platform.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -820,7 +819,6 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
struct snd_soc_dai_driver *kmb_i2s_dai;
-   const struct of_device_id *match;
struct device *dev = &pdev->dev;
struct kmb_i2s_info *kmb_i2s;
struct resource *res;
@@ -831,16 +829,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
if (!kmb_i2s)
return -ENOMEM;
 
-   kmb_i2s_dai = devm_kzalloc(dev, sizeof(*kmb_i2s_dai), GFP_KERNEL);
-   if (!kmb_i2s_dai)
-   return -ENOMEM;
-
-   match = of_match_device(kmb_plat_of_match, &pdev->dev);
-   if (!match) {
-   dev_err(&pdev->dev, "Error: No device match found\n");
-   return -ENODEV;
-   }
-   kmb_i2s_dai = (struct snd_soc_dai_driver *) match->data;
+   kmb_i2s_dai = (struct snd_soc_dai_driver 
*)device_get_match_data(&pdev->dev);
 
/* Prepare the related clocks */
kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk");
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 18aff2654f89..ac0feb89b458 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1106,7 +1105,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
struct resource *res;
const struct lpass_variant *variant;
struct device *dev = &pdev->dev;
-   const struct of_device_id *match;
int ret, i, dai_id;
 
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
@@ -1121,17 +1119,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, drvdata);
 
-   match = of_match_device(dev->driver->of_match_table, dev);
-   if (!match || !match->data)
+   variant = device_get_match_data(dev);
+   if (!variant)
return -EINVAL;
 
-   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) {
-   dev_warn(dev, "%s compatible is deprecated\n",
-match->compatible);
-   }
+   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016"))
+   dev_warn(dev, "qcom,lpass-cpu-apq8016 compatible is 
deprecated\n");
 
-   drvdata->variant = (struct lpass_variant *)match->data;
-   variant = drvdata->variant;
+   drvdata->variant = variant;
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
diff --git a/sound/soc/rockchip/rockchip_i2s.c 
b/sound/soc/rockchip/rockchip_i2s.c
index 74e7d6ee0f28..b0c3ef030e06 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -10,8 +10,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -736,7 +736,6 @@ static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, 
struct resource *res,
 static int rockchip_i2s_probe(struct platform_device *pdev)
 {
struct device_node *node = pdev->dev.of_node;
-   const struct of_device_id *of_id;
struct rk_i2s_dev *i2s;
struct snd_soc_dai_driver *dai;
struct resource *res;
@@ -752,11 +751,10 @@ static int rockchip_i2s_probe(struct platform_device 
*pdev)
 
i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
  

[PATCH v2 4/5] ASoC: qcom/lpass: Constify struct lpass_variant

2023-10-04 Thread Rob Herring
'struct lpass_variant' is used for driver match data which is supposed to
be constant. It's not modified anywhere, so it's just a matter of adding
'const' everywhere.

Signed-off-by: Rob Herring 
---
 sound/soc/qcom/lpass-apq8016.c  |  6 +++---
 sound/soc/qcom/lpass-cdc-dma.c  |  2 +-
 sound/soc/qcom/lpass-cpu.c  | 28 ++--
 sound/soc/qcom/lpass-ipq806x.c  |  2 +-
 sound/soc/qcom/lpass-platform.c | 36 ++--
 sound/soc/qcom/lpass-sc7180.c   |  6 +++---
 sound/soc/qcom/lpass-sc7280.c   |  6 +++---
 sound/soc/qcom/lpass.h  |  2 +-
 8 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index f919d46e18ca..8ce75b442b64 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -123,7 +123,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
   int direction, unsigned int dai_id)
 {
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -157,7 +157,7 @@ static int apq8016_lpass_free_dma_channel(struct lpass_data 
*drvdata, int chan,
 static int apq8016_lpass_init(struct platform_device *pdev)
 {
struct lpass_data *drvdata = platform_get_drvdata(pdev);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
struct device *dev = &pdev->dev;
int ret, i;
 
@@ -223,7 +223,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
 }
 
 
-static struct lpass_variant apq8016_data = {
+static const struct lpass_variant apq8016_data = {
.i2sctrl_reg_base   = 0x1000,
.i2sctrl_reg_stride = 0x1000,
.i2s_ports  = 4,
diff --git a/sound/soc/qcom/lpass-cdc-dma.c b/sound/soc/qcom/lpass-cdc-dma.c
index 8221e2cbe35c..6389c7b6051e 100644
--- a/sound/soc/qcom/lpass-cdc-dma.c
+++ b/sound/soc/qcom/lpass-cdc-dma.c
@@ -37,7 +37,7 @@ static void __lpass_get_dmactl_handle(struct 
snd_pcm_substream *substream, struc
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
unsigned int dai_id = cpu_dai->driver->id;
 
switch (dai_id) {
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 39571fed4001..18aff2654f89 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -44,7 +44,7 @@ static int lpass_cpu_init_i2sctl_bitfields(struct device *dev,
struct lpaif_i2sctl *i2sctl, struct regmap *map)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
 
i2sctl->loopback = devm_regmap_field_alloc(dev, map, v->loopback);
i2sctl->spken = devm_regmap_field_alloc(dev, map, v->spken);
@@ -463,7 +463,7 @@ static int asoc_qcom_of_xlate_dai_name(struct 
snd_soc_component *component,
   const char **dai_name)
 {
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
int id = args->args[0];
int ret = -EINVAL;
int i;
@@ -488,7 +488,7 @@ static const struct snd_soc_component_driver 
lpass_cpu_comp_driver = {
 static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -530,7 +530,7 @@ static bool lpass_cpu_regmap_writeable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -578,7 +578,7 @@ static bool lpass_cpu_regmap_readable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_varia

[PATCH v2 2/5] ASoC: Drop unnecessary of_match_device() calls

2023-10-04 Thread Rob Herring
If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Acked-by: Charles Keepax 
Signed-off-by: Rob Herring 
---
 sound/soc/codecs/ak5386.c  |  7 ++-
 sound/soc/codecs/cs4271.c  | 22 ++
 sound/soc/codecs/tas5086.c |  6 +-
 3 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c
index 0c5e00679c7d..21a44476f48d 100644
--- a/sound/soc/codecs/ak5386.c
+++ b/sound/soc/codecs/ak5386.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -168,7 +167,6 @@ static int ak5386_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
 
-   priv->reset_gpio = -EINVAL;
dev_set_drvdata(dev, priv);
 
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
@@ -179,9 +177,8 @@ static int ak5386_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
 
-   if (of_match_device(of_match_ptr(ak5386_dt_ids), dev))
-   priv->reset_gpio = of_get_named_gpio(dev->of_node,
- "reset-gpio", 0);
+   priv->reset_gpio = of_get_named_gpio(dev->of_node,
+"reset-gpio", 0);
 
if (gpio_is_valid(priv->reset_gpio))
if (devm_gpio_request_one(dev, priv->reset_gpio,
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 188b8b43c524..9e6f8a048dd5 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -563,19 +562,12 @@ static int cs4271_component_probe(struct 
snd_soc_component *component)
struct cs4271_private *cs4271 = 
snd_soc_component_get_drvdata(component);
struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
int ret;
-   bool amutec_eq_bmutec = false;
+   bool amutec_eq_bmutec;
 
-#ifdef CONFIG_OF
-   if (of_match_device(cs4271_dt_ids, component->dev)) {
-   if (of_get_property(component->dev->of_node,
-"cirrus,amutec-eq-bmutec", NULL))
-   amutec_eq_bmutec = true;
-
-   if (of_get_property(component->dev->of_node,
-"cirrus,enable-soft-reset", NULL))
-   cs4271->enable_soft_reset = true;
-   }
-#endif
+   amutec_eq_bmutec = of_property_read_bool(component->dev->of_node,
+"cirrus,amutec-eq-bmutec");
+   cs4271->enable_soft_reset = 
of_property_read_bool(component->dev->of_node,
+ 
"cirrus,enable-soft-reset");
 
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies);
@@ -655,9 +647,7 @@ static int cs4271_common_probe(struct device *dev,
if (!cs4271)
return -ENOMEM;
 
-   if (of_match_device(cs4271_dt_ids, dev))
-   cs4271->gpio_nreset =
-   of_get_named_gpio(dev->of_node, "reset-gpio", 0);
+   cs4271->gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
 
if (cs4271plat)
cs4271->gpio_nreset = cs4271plat->gpio_nreset;
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 60e59e993ba6..f52c14b43f28 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -940,11 +940,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, priv);
 
-   if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) {
-   struct device_node *of_node = dev->of_node;
-   gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0);
-   }
-
+   gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
if (gpio_is_valid(gpio_nreset))
if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset"))
gpio_nreset = -EINVAL;

-- 
2.40.1



[PATCH v2 0/5] ASoC: DT matching and header cleanups

2023-10-04 Thread Rob Herring
(trimmed the recipient list due to bounces on v1)

This is a series is part of ongoing clean-ups related to device 
matching and DT related implicit includes. Essentially of_device.h has 
a bunch of implicit includes and generally isn't needed any nore except 
for of_match_device(). As we also generally want to get rid of 
of_match_device() as well, I've done that so we're not updating the 
includes twice.

Signed-off-by: Rob Herring 
---
Changes in v2:
- Add tags
- Link to v1: 
https://lore.kernel.org/r/20231003-dt-asoc-header-cleanups-v1-0-308666806...@kernel.org
- Link to v1 resend: 
https://lore.kernel.org/r/20231003-dt-asoc-header-cleanups-v1-0-05b5d6447...@kernel.org/

---
Rob Herring (5):
  ASoC: Explicitly include correct DT includes
  ASoC: Drop unnecessary of_match_device() calls
  ASoC: da7218: Use i2c_get_match_data()
  ASoC: qcom/lpass: Constify struct lpass_variant
  ASoC: Use device_get_match_data()

 sound/soc/atmel/atmel_wm8904.c |  1 -
 sound/soc/atmel/mchp-i2s-mcc.c |  2 +-
 sound/soc/atmel/tse850-pcm5142.c   |  1 -
 sound/soc/bcm/cygnus-ssp.c |  2 +-
 sound/soc/codecs/adau1701.c|  1 -
 sound/soc/codecs/adau1977-spi.c|  1 -
 sound/soc/codecs/ak4104.c  |  2 +-
 sound/soc/codecs/ak4118.c  |  2 +-
 sound/soc/codecs/ak4375.c  |  2 +-
 sound/soc/codecs/ak4458.c  |  2 +-
 sound/soc/codecs/ak4613.c  |  2 +-
 sound/soc/codecs/ak4642.c  |  2 +-
 sound/soc/codecs/ak5386.c  |  7 +---
 sound/soc/codecs/ak5558.c  |  2 +-
 sound/soc/codecs/cs35l32.c |  2 +-
 sound/soc/codecs/cs35l33.c |  2 -
 sound/soc/codecs/cs35l34.c |  2 +-
 sound/soc/codecs/cs35l35.c |  3 +-
 sound/soc/codecs/cs35l36.c |  3 +-
 sound/soc/codecs/cs35l41-i2c.c |  2 +-
 sound/soc/codecs/cs35l41.c |  1 -
 sound/soc/codecs/cs4270.c  |  2 +-
 sound/soc/codecs/cs4271.c  | 22 +++
 sound/soc/codecs/cs42l42.c |  1 -
 sound/soc/codecs/cs42l56.c |  2 +-
 sound/soc/codecs/cs42xx8-i2c.c |  2 +-
 sound/soc/codecs/cs43130.c |  3 +-
 sound/soc/codecs/cs4349.c  |  2 +-
 sound/soc/codecs/da7213.c  |  2 +-
 sound/soc/codecs/da7218.c  | 29 +--
 sound/soc/codecs/da7218.h  |  2 +-
 sound/soc/codecs/da7219.c  |  2 +-
 sound/soc/codecs/da9055.c  |  1 -
 sound/soc/codecs/es8328.c  |  1 -
 sound/soc/codecs/gtm601.c  |  2 +-
 sound/soc/codecs/lpass-macro-common.c  |  2 +-
 sound/soc/codecs/mt6351.c  |  2 +-
 sound/soc/codecs/mt6358.c  |  2 +-
 sound/soc/codecs/mt6359-accdet.c   |  4 --
 sound/soc/codecs/mt6359.c  |  2 +-
 sound/soc/codecs/nau8540.c |  2 +-
 sound/soc/codecs/pcm1681.c |  2 -
 sound/soc/codecs/rt715.c   |  2 -
 sound/soc/codecs/sgtl5000.c|  2 +-
 sound/soc/codecs/sma1303.c |  2 +-
 sound/soc/codecs/sta32x.c  |  3 +-
 sound/soc/codecs/sta350.c  |  3 +-
 sound/soc/codecs/tas5086.c |  6 +--
 sound/soc/codecs/tas571x.c |  2 +-
 sound/soc/codecs/uda1334.c |  2 +-
 sound/soc/codecs/wm8510.c  |  2 +-
 sound/soc/codecs/wm8523.c  |  2 +-
 sound/soc/codecs/wm8524.c  |  2 +-
 sound/soc/codecs/wm8580.c  |  2 +-
 sound/soc/codecs/wm8711.c  |  2 +-
 sound/soc/codecs/wm8728.c  |  2 +-
 sound/soc/codecs/wm8731-i2c.c  |  2 +-
 sound/soc/codecs/wm8731-spi.c  |  2 +-
 sound/soc/codecs/wm8737.c  |  2 +-
 sound/soc/codecs/wm8741.c  |  2 +-
 sound/soc/codecs/wm8750.c  |  2 +-
 sound/soc/codecs/wm8753.c  |  2 +-
 sound/soc/codecs/wm8770.c  |  2 +-
 sound/soc/codecs/wm8776.c  |  2 +-
 sound/soc/codecs/wm8804.c  |  1 -
 sound/soc/fsl/efika-audio-fabric.c |  4 +-
 sound/soc/fsl/fsl_aud2htx.c|  3 +-

[PATCH RESEND 3/5] ASoC: da7218: Use i2c_get_match_data()

2023-10-03 Thread Rob Herring
Use preferred i2c_get_match_data() instead of of_match_device() and
i2c_match_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Avoid using 0 for enum da7218_dev_id so that no match data can be
distinguished.

Signed-off-by: Rob Herring 
---
 sound/soc/codecs/da7218.c | 29 ++---
 sound/soc/codecs/da7218.h |  2 +-
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index 3f456b08b809..8aacd7350798 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -9,7 +9,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -2285,16 +2285,6 @@ static const struct of_device_id da7218_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, da7218_of_match);
 
-static inline int da7218_of_get_id(struct device *dev)
-{
-   const struct of_device_id *id = of_match_device(da7218_of_match, dev);
-
-   if (id)
-   return (uintptr_t)id->data;
-   else
-   return -EINVAL;
-}
-
 static enum da7218_micbias_voltage
da7218_of_micbias_lvl(struct snd_soc_component *component, u32 val)
 {
@@ -3253,18 +3243,6 @@ static const struct regmap_config da7218_regmap_config = 
{
  * I2C layer
  */
 
-static const struct i2c_device_id da7218_i2c_id[];
-
-static inline int da7218_i2c_get_id(struct i2c_client *i2c)
-{
-   const struct i2c_device_id *id = i2c_match_id(da7218_i2c_id, i2c);
-
-   if (id)
-   return (uintptr_t)id->driver_data;
-   else
-   return -EINVAL;
-}
-
 static int da7218_i2c_probe(struct i2c_client *i2c)
 {
struct da7218_priv *da7218;
@@ -3276,10 +3254,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, da7218);
 
-   if (i2c->dev.of_node)
-   da7218->dev_id = da7218_of_get_id(&i2c->dev);
-   else
-   da7218->dev_id = da7218_i2c_get_id(i2c);
+   da7218->dev_id = (uintptr_t)i2c_get_match_data(i2c);
 
if ((da7218->dev_id != DA7217_DEV_ID) &&
(da7218->dev_id != DA7218_DEV_ID)) {
diff --git a/sound/soc/codecs/da7218.h b/sound/soc/codecs/da7218.h
index 9ac2892092b5..7f6a4aea2c7a 100644
--- a/sound/soc/codecs/da7218.h
+++ b/sound/soc/codecs/da7218.h
@@ -1369,7 +1369,7 @@ enum da7218_sys_clk {
 };
 
 enum da7218_dev_id {
-   DA7217_DEV_ID = 0,
+   DA7217_DEV_ID = 1,
DA7218_DEV_ID,
 };
 

-- 
2.40.1



[PATCH RESEND 5/5] ASoC: Use device_get_match_data()

2023-10-03 Thread Rob Herring
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring 
---
 sound/soc/intel/keembay/kmb_platform.c | 13 +
 sound/soc/qcom/lpass-cpu.c | 15 +--
 sound/soc/rockchip/rockchip_i2s.c  |  8 +++-
 sound/soc/rockchip/rockchip_i2s_tdm.c  | 20 +++-
 sound/soc/rockchip/rockchip_pdm.c  |  6 +-
 sound/soc/samsung/smdk_wm8994.c| 27 +++
 sound/soc/stm/stm32_i2s.c  |  7 ++-
 sound/soc/stm/stm32_sai.c  |  8 
 sound/soc/stm/stm32_sai_sub.c  |  6 +-
 sound/soc/stm/stm32_spdifrx.c  |  8 ++--
 sound/soc/tegra/tegra210_amx.c |  7 +--
 sound/soc/ti/davinci-evm.c |  7 ++-
 sound/soc/ti/davinci-mcasp.c   |  9 -
 sound/soc/ti/omap-mcbsp.c  | 10 --
 14 files changed, 40 insertions(+), 111 deletions(-)

diff --git a/sound/soc/intel/keembay/kmb_platform.c 
b/sound/soc/intel/keembay/kmb_platform.c
index e929497a5eb5..37ea2e1d2e92 100644
--- a/sound/soc/intel/keembay/kmb_platform.c
+++ b/sound/soc/intel/keembay/kmb_platform.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -820,7 +819,6 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
 {
struct device_node *np = pdev->dev.of_node;
struct snd_soc_dai_driver *kmb_i2s_dai;
-   const struct of_device_id *match;
struct device *dev = &pdev->dev;
struct kmb_i2s_info *kmb_i2s;
struct resource *res;
@@ -831,16 +829,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
if (!kmb_i2s)
return -ENOMEM;
 
-   kmb_i2s_dai = devm_kzalloc(dev, sizeof(*kmb_i2s_dai), GFP_KERNEL);
-   if (!kmb_i2s_dai)
-   return -ENOMEM;
-
-   match = of_match_device(kmb_plat_of_match, &pdev->dev);
-   if (!match) {
-   dev_err(&pdev->dev, "Error: No device match found\n");
-   return -ENODEV;
-   }
-   kmb_i2s_dai = (struct snd_soc_dai_driver *) match->data;
+   kmb_i2s_dai = (struct snd_soc_dai_driver 
*)device_get_match_data(&pdev->dev);
 
/* Prepare the related clocks */
kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk");
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 18aff2654f89..ac0feb89b458 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -9,7 +9,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1106,7 +1105,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
struct resource *res;
const struct lpass_variant *variant;
struct device *dev = &pdev->dev;
-   const struct of_device_id *match;
int ret, i, dai_id;
 
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
@@ -1121,17 +1119,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return -ENOMEM;
platform_set_drvdata(pdev, drvdata);
 
-   match = of_match_device(dev->driver->of_match_table, dev);
-   if (!match || !match->data)
+   variant = device_get_match_data(dev);
+   if (!variant)
return -EINVAL;
 
-   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) {
-   dev_warn(dev, "%s compatible is deprecated\n",
-match->compatible);
-   }
+   if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016"))
+   dev_warn(dev, "qcom,lpass-cpu-apq8016 compatible is 
deprecated\n");
 
-   drvdata->variant = (struct lpass_variant *)match->data;
-   variant = drvdata->variant;
+   drvdata->variant = variant;
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
diff --git a/sound/soc/rockchip/rockchip_i2s.c 
b/sound/soc/rockchip/rockchip_i2s.c
index 74e7d6ee0f28..b0c3ef030e06 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -10,8 +10,8 @@
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -736,7 +736,6 @@ static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, 
struct resource *res,
 static int rockchip_i2s_probe(struct platform_device *pdev)
 {
struct device_node *node = pdev->dev.of_node;
-   const struct of_device_id *of_id;
struct rk_i2s_dev *i2s;
struct snd_soc_dai_driver *dai;
struct resource *res;
@@ -752,11 +751,10 @@ static int rockchip_i2s_probe(struct platform_device 
*pdev)
 
i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
  

[PATCH RESEND 2/5] ASoC: Drop unnecessary of_match_device() calls

2023-10-03 Thread Rob Herring
If probe is reached, we've already matched the device and in the case of
DT matching, the struct device_node pointer will be set. Therefore, there
is no need to call of_match_device() in probe.

Signed-off-by: Rob Herring 
---
 sound/soc/codecs/ak5386.c  |  7 ++-
 sound/soc/codecs/cs4271.c  | 22 ++
 sound/soc/codecs/tas5086.c |  6 +-
 3 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c
index 0c5e00679c7d..21a44476f48d 100644
--- a/sound/soc/codecs/ak5386.c
+++ b/sound/soc/codecs/ak5386.c
@@ -10,7 +10,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -168,7 +167,6 @@ static int ak5386_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
 
-   priv->reset_gpio = -EINVAL;
dev_set_drvdata(dev, priv);
 
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
@@ -179,9 +177,8 @@ static int ak5386_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
 
-   if (of_match_device(of_match_ptr(ak5386_dt_ids), dev))
-   priv->reset_gpio = of_get_named_gpio(dev->of_node,
- "reset-gpio", 0);
+   priv->reset_gpio = of_get_named_gpio(dev->of_node,
+"reset-gpio", 0);
 
if (gpio_is_valid(priv->reset_gpio))
if (devm_gpio_request_one(dev, priv->reset_gpio,
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 188b8b43c524..9e6f8a048dd5 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -563,19 +562,12 @@ static int cs4271_component_probe(struct 
snd_soc_component *component)
struct cs4271_private *cs4271 = 
snd_soc_component_get_drvdata(component);
struct cs4271_platform_data *cs4271plat = component->dev->platform_data;
int ret;
-   bool amutec_eq_bmutec = false;
+   bool amutec_eq_bmutec;
 
-#ifdef CONFIG_OF
-   if (of_match_device(cs4271_dt_ids, component->dev)) {
-   if (of_get_property(component->dev->of_node,
-"cirrus,amutec-eq-bmutec", NULL))
-   amutec_eq_bmutec = true;
-
-   if (of_get_property(component->dev->of_node,
-"cirrus,enable-soft-reset", NULL))
-   cs4271->enable_soft_reset = true;
-   }
-#endif
+   amutec_eq_bmutec = of_property_read_bool(component->dev->of_node,
+"cirrus,amutec-eq-bmutec");
+   cs4271->enable_soft_reset = 
of_property_read_bool(component->dev->of_node,
+ 
"cirrus,enable-soft-reset");
 
ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies),
cs4271->supplies);
@@ -655,9 +647,7 @@ static int cs4271_common_probe(struct device *dev,
if (!cs4271)
return -ENOMEM;
 
-   if (of_match_device(cs4271_dt_ids, dev))
-   cs4271->gpio_nreset =
-   of_get_named_gpio(dev->of_node, "reset-gpio", 0);
+   cs4271->gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
 
if (cs4271plat)
cs4271->gpio_nreset = cs4271plat->gpio_nreset;
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 60e59e993ba6..f52c14b43f28 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -940,11 +940,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c)
 
i2c_set_clientdata(i2c, priv);
 
-   if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) {
-   struct device_node *of_node = dev->of_node;
-   gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0);
-   }
-
+   gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0);
if (gpio_is_valid(gpio_nreset))
if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset"))
gpio_nreset = -EINVAL;

-- 
2.40.1



[PATCH RESEND 4/5] ASoC: qcom/lpass: Constify struct lpass_variant

2023-10-03 Thread Rob Herring
'struct lpass_variant' is used for driver match data which is supposed to
be constant. It's not modified anywhere, so it's just a matter of adding
'const' everywhere.

Signed-off-by: Rob Herring 
---
 sound/soc/qcom/lpass-apq8016.c  |  6 +++---
 sound/soc/qcom/lpass-cdc-dma.c  |  2 +-
 sound/soc/qcom/lpass-cpu.c  | 28 ++--
 sound/soc/qcom/lpass-ipq806x.c  |  2 +-
 sound/soc/qcom/lpass-platform.c | 36 ++--
 sound/soc/qcom/lpass-sc7180.c   |  6 +++---
 sound/soc/qcom/lpass-sc7280.c   |  6 +++---
 sound/soc/qcom/lpass.h  |  2 +-
 8 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index f919d46e18ca..8ce75b442b64 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -123,7 +123,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
   int direction, unsigned int dai_id)
 {
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
@@ -157,7 +157,7 @@ static int apq8016_lpass_free_dma_channel(struct lpass_data 
*drvdata, int chan,
 static int apq8016_lpass_init(struct platform_device *pdev)
 {
struct lpass_data *drvdata = platform_get_drvdata(pdev);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
struct device *dev = &pdev->dev;
int ret, i;
 
@@ -223,7 +223,7 @@ static int apq8016_lpass_exit(struct platform_device *pdev)
 }
 
 
-static struct lpass_variant apq8016_data = {
+static const struct lpass_variant apq8016_data = {
.i2sctrl_reg_base   = 0x1000,
.i2sctrl_reg_stride = 0x1000,
.i2s_ports  = 4,
diff --git a/sound/soc/qcom/lpass-cdc-dma.c b/sound/soc/qcom/lpass-cdc-dma.c
index 8221e2cbe35c..6389c7b6051e 100644
--- a/sound/soc/qcom/lpass-cdc-dma.c
+++ b/sound/soc/qcom/lpass-cdc-dma.c
@@ -37,7 +37,7 @@ static void __lpass_get_dmactl_handle(struct 
snd_pcm_substream *substream, struc
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
struct snd_pcm_runtime *rt = substream->runtime;
struct lpass_pcm_data *pcm_data = rt->private_data;
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
unsigned int dai_id = cpu_dai->driver->id;
 
switch (dai_id) {
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 39571fed4001..18aff2654f89 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -44,7 +44,7 @@ static int lpass_cpu_init_i2sctl_bitfields(struct device *dev,
struct lpaif_i2sctl *i2sctl, struct regmap *map)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
 
i2sctl->loopback = devm_regmap_field_alloc(dev, map, v->loopback);
i2sctl->spken = devm_regmap_field_alloc(dev, map, v->spken);
@@ -463,7 +463,7 @@ static int asoc_qcom_of_xlate_dai_name(struct 
snd_soc_component *component,
   const char **dai_name)
 {
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
-   struct lpass_variant *variant = drvdata->variant;
+   const struct lpass_variant *variant = drvdata->variant;
int id = args->args[0];
int ret = -EINVAL;
int i;
@@ -488,7 +488,7 @@ static const struct snd_soc_component_driver 
lpass_cpu_comp_driver = {
 static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -530,7 +530,7 @@ static bool lpass_cpu_regmap_writeable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_variant *v = drvdata->variant;
int i;
 
for (i = 0; i < v->i2s_ports; ++i)
@@ -578,7 +578,7 @@ static bool lpass_cpu_regmap_readable(struct device *dev, 
unsigned int reg)
 static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
 {
struct lpass_data *drvdata = dev_get_drvdata(dev);
-   struct lpass_variant *v = drvdata->variant;
+   const struct lpass_varia

[PATCH RESEND 1/5] ASoC: Explicitly include correct DT includes

2023-10-03 Thread Rob Herring
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring 
---
 sound/soc/atmel/atmel_wm8904.c | 1 -
 sound/soc/atmel/mchp-i2s-mcc.c | 2 +-
 sound/soc/atmel/tse850-pcm5142.c   | 1 -
 sound/soc/bcm/cygnus-ssp.c | 2 +-
 sound/soc/codecs/adau1701.c| 1 -
 sound/soc/codecs/adau1977-spi.c| 1 -
 sound/soc/codecs/ak4104.c  | 2 +-
 sound/soc/codecs/ak4118.c  | 2 +-
 sound/soc/codecs/ak4375.c  | 2 +-
 sound/soc/codecs/ak4458.c  | 2 +-
 sound/soc/codecs/ak4613.c  | 2 +-
 sound/soc/codecs/ak4642.c  | 2 +-
 sound/soc/codecs/ak5558.c  | 2 +-
 sound/soc/codecs/cs35l32.c | 2 +-
 sound/soc/codecs/cs35l33.c | 2 --
 sound/soc/codecs/cs35l34.c | 2 +-
 sound/soc/codecs/cs35l35.c | 3 +--
 sound/soc/codecs/cs35l36.c | 3 +--
 sound/soc/codecs/cs35l41-i2c.c | 2 +-
 sound/soc/codecs/cs35l41.c | 1 -
 sound/soc/codecs/cs4270.c  | 2 +-
 sound/soc/codecs/cs42l42.c | 1 -
 sound/soc/codecs/cs42l56.c | 2 +-
 sound/soc/codecs/cs42xx8-i2c.c | 2 +-
 sound/soc/codecs/cs43130.c | 3 +--
 sound/soc/codecs/cs4349.c  | 2 +-
 sound/soc/codecs/da7213.c  | 2 +-
 sound/soc/codecs/da7219.c  | 2 +-
 sound/soc/codecs/da9055.c  | 1 -
 sound/soc/codecs/es8328.c  | 1 -
 sound/soc/codecs/gtm601.c  | 2 +-
 sound/soc/codecs/lpass-macro-common.c  | 2 +-
 sound/soc/codecs/mt6351.c  | 2 +-
 sound/soc/codecs/mt6358.c  | 2 +-
 sound/soc/codecs/mt6359-accdet.c   | 4 
 sound/soc/codecs/mt6359.c  | 2 +-
 sound/soc/codecs/nau8540.c | 2 +-
 sound/soc/codecs/pcm1681.c | 2 --
 sound/soc/codecs/rt715.c   | 2 --
 sound/soc/codecs/sgtl5000.c| 2 +-
 sound/soc/codecs/sma1303.c | 2 +-
 sound/soc/codecs/sta32x.c  | 3 +--
 sound/soc/codecs/sta350.c  | 3 +--
 sound/soc/codecs/tas571x.c | 2 +-
 sound/soc/codecs/uda1334.c | 2 +-
 sound/soc/codecs/wm8510.c  | 2 +-
 sound/soc/codecs/wm8523.c  | 2 +-
 sound/soc/codecs/wm8524.c  | 2 +-
 sound/soc/codecs/wm8580.c  | 2 +-
 sound/soc/codecs/wm8711.c  | 2 +-
 sound/soc/codecs/wm8728.c  | 2 +-
 sound/soc/codecs/wm8731-i2c.c  | 2 +-
 sound/soc/codecs/wm8731-spi.c  | 2 +-
 sound/soc/codecs/wm8737.c  | 2 +-
 sound/soc/codecs/wm8741.c  | 2 +-
 sound/soc/codecs/wm8750.c  | 2 +-
 sound/soc/codecs/wm8753.c  | 2 +-
 sound/soc/codecs/wm8770.c  | 2 +-
 sound/soc/codecs/wm8776.c  | 2 +-
 sound/soc/codecs/wm8804.c  | 1 -
 sound/soc/fsl/efika-audio-fabric.c | 4 ++--
 sound/soc/fsl/fsl_aud2htx.c| 3 +--
 sound/soc/fsl/fsl_mqs.c| 2 +-
 sound/soc/fsl/fsl_rpmsg.c  | 3 +--
 sound/soc/fsl/fsl_sai.c| 3 +--
 sound/soc/fsl/fsl_spdif.c  | 4 

[PATCH RESEND 0/5] ASoC: DT matching and header cleanups

2023-10-03 Thread Rob Herring
(Got a bunch of bounces on the first try. Something weird going on with 
the To header best I can tell. Retrying with git-send-email instead of 
b4.)

This is a series is part of ongoing clean-ups related to device
matching and DT related implicit includes. Essentially of_device.h has
a bunch of implicit includes and generally isn't needed any nore except
for of_match_device(). As we also generally want to get rid of
of_match_device() as well, I've done that so we're not updating the
includes twice.

Signed-off-by: Rob Herring 
---
Rob Herring (5):
  ASoC: Explicitly include correct DT includes
  ASoC: Drop unnecessary of_match_device() calls
  ASoC: da7218: Use i2c_get_match_data()
  ASoC: qcom/lpass: Constify struct lpass_variant
  ASoC: Use device_get_match_data()

 sound/soc/atmel/atmel_wm8904.c |  1 -
 sound/soc/atmel/mchp-i2s-mcc.c |  2 +-
 sound/soc/atmel/tse850-pcm5142.c   |  1 -
 sound/soc/bcm/cygnus-ssp.c |  2 +-
 sound/soc/codecs/adau1701.c|  1 -
 sound/soc/codecs/adau1977-spi.c|  1 -
 sound/soc/codecs/ak4104.c  |  2 +-
 sound/soc/codecs/ak4118.c  |  2 +-
 sound/soc/codecs/ak4375.c  |  2 +-
 sound/soc/codecs/ak4458.c  |  2 +-
 sound/soc/codecs/ak4613.c  |  2 +-
 sound/soc/codecs/ak4642.c  |  2 +-
 sound/soc/codecs/ak5386.c  |  7 +---
 sound/soc/codecs/ak5558.c  |  2 +-
 sound/soc/codecs/cs35l32.c |  2 +-
 sound/soc/codecs/cs35l33.c |  2 -
 sound/soc/codecs/cs35l34.c |  2 +-
 sound/soc/codecs/cs35l35.c |  3 +-
 sound/soc/codecs/cs35l36.c |  3 +-
 sound/soc/codecs/cs35l41-i2c.c |  2 +-
 sound/soc/codecs/cs35l41.c |  1 -
 sound/soc/codecs/cs4270.c  |  2 +-
 sound/soc/codecs/cs4271.c  | 22 +++
 sound/soc/codecs/cs42l42.c |  1 -
 sound/soc/codecs/cs42l56.c |  2 +-
 sound/soc/codecs/cs42xx8-i2c.c |  2 +-
 sound/soc/codecs/cs43130.c |  3 +-
 sound/soc/codecs/cs4349.c  |  2 +-
 sound/soc/codecs/da7213.c  |  2 +-
 sound/soc/codecs/da7218.c  | 29 +--
 sound/soc/codecs/da7218.h  |  2 +-
 sound/soc/codecs/da7219.c  |  2 +-
 sound/soc/codecs/da9055.c  |  1 -
 sound/soc/codecs/es8328.c  |  1 -
 sound/soc/codecs/gtm601.c  |  2 +-
 sound/soc/codecs/lpass-macro-common.c  |  2 +-
 sound/soc/codecs/mt6351.c  |  2 +-
 sound/soc/codecs/mt6358.c  |  2 +-
 sound/soc/codecs/mt6359-accdet.c   |  4 --
 sound/soc/codecs/mt6359.c  |  2 +-
 sound/soc/codecs/nau8540.c |  2 +-
 sound/soc/codecs/pcm1681.c |  2 -
 sound/soc/codecs/rt715.c   |  2 -
 sound/soc/codecs/sgtl5000.c|  2 +-
 sound/soc/codecs/sma1303.c |  2 +-
 sound/soc/codecs/sta32x.c  |  3 +-
 sound/soc/codecs/sta350.c  |  3 +-
 sound/soc/codecs/tas5086.c |  6 +--
 sound/soc/codecs/tas571x.c |  2 +-
 sound/soc/codecs/uda1334.c |  2 +-
 sound/soc/codecs/wm8510.c  |  2 +-
 sound/soc/codecs/wm8523.c  |  2 +-
 sound/soc/codecs/wm8524.c  |  2 +-
 sound/soc/codecs/wm8580.c  |  2 +-
 sound/soc/codecs/wm8711.c  |  2 +-
 sound/soc/codecs/wm8728.c  |  2 +-
 sound/soc/codecs/wm8731-i2c.c  |  2 +-
 sound/soc/codecs/wm8731-spi.c  |  2 +-
 sound/soc/codecs/wm8737.c  |  2 +-
 sound/soc/codecs/wm8741.c  |  2 +-
 sound/soc/codecs/wm8750.c  |  2 +-
 sound/soc/codecs/wm8753.c  |  2 +-
 sound/soc/codecs/wm8770.c  |  2 +-
 sound/soc/codecs/wm8776.c  |  2 +-
 sound/soc/codecs/wm8804.c  |  1 -
 sound/soc/fsl/efika-audio-fabric.c |  4 +-
 sound/soc/fsl/fsl_aud2htx.c|  3 +-
 sound/soc/fsl/fsl_mqs.c|  2 +-
 sound/soc/fsl/fsl_rpmsg.c  |  3 +-
 sound/so

[PATCH 1/5] ASoC: Explicitly include correct DT includes

2023-10-03 Thread Rob Herring
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring 
---
 sound/soc/atmel/atmel_wm8904.c | 1 -
 sound/soc/atmel/mchp-i2s-mcc.c | 2 +-
 sound/soc/atmel/tse850-pcm5142.c   | 1 -
 sound/soc/bcm/cygnus-ssp.c | 2 +-
 sound/soc/codecs/adau1701.c| 1 -
 sound/soc/codecs/adau1977-spi.c| 1 -
 sound/soc/codecs/ak4104.c  | 2 +-
 sound/soc/codecs/ak4118.c  | 2 +-
 sound/soc/codecs/ak4375.c  | 2 +-
 sound/soc/codecs/ak4458.c  | 2 +-
 sound/soc/codecs/ak4613.c  | 2 +-
 sound/soc/codecs/ak4642.c  | 2 +-
 sound/soc/codecs/ak5558.c  | 2 +-
 sound/soc/codecs/cs35l32.c | 2 +-
 sound/soc/codecs/cs35l33.c | 2 --
 sound/soc/codecs/cs35l34.c | 2 +-
 sound/soc/codecs/cs35l35.c | 3 +--
 sound/soc/codecs/cs35l36.c | 3 +--
 sound/soc/codecs/cs35l41-i2c.c | 2 +-
 sound/soc/codecs/cs35l41.c | 1 -
 sound/soc/codecs/cs4270.c  | 2 +-
 sound/soc/codecs/cs42l42.c | 1 -
 sound/soc/codecs/cs42l56.c | 2 +-
 sound/soc/codecs/cs42xx8-i2c.c | 2 +-
 sound/soc/codecs/cs43130.c | 3 +--
 sound/soc/codecs/cs4349.c  | 2 +-
 sound/soc/codecs/da7213.c  | 2 +-
 sound/soc/codecs/da7219.c  | 2 +-
 sound/soc/codecs/da9055.c  | 1 -
 sound/soc/codecs/es8328.c  | 1 -
 sound/soc/codecs/gtm601.c  | 2 +-
 sound/soc/codecs/lpass-macro-common.c  | 2 +-
 sound/soc/codecs/mt6351.c  | 2 +-
 sound/soc/codecs/mt6358.c  | 2 +-
 sound/soc/codecs/mt6359-accdet.c   | 4 
 sound/soc/codecs/mt6359.c  | 2 +-
 sound/soc/codecs/nau8540.c | 2 +-
 sound/soc/codecs/pcm1681.c | 2 --
 sound/soc/codecs/rt715.c   | 2 --
 sound/soc/codecs/sgtl5000.c| 2 +-
 sound/soc/codecs/sma1303.c | 2 +-
 sound/soc/codecs/sta32x.c  | 3 +--
 sound/soc/codecs/sta350.c  | 3 +--
 sound/soc/codecs/tas571x.c | 2 +-
 sound/soc/codecs/uda1334.c | 2 +-
 sound/soc/codecs/wm8510.c  | 2 +-
 sound/soc/codecs/wm8523.c  | 2 +-
 sound/soc/codecs/wm8524.c  | 2 +-
 sound/soc/codecs/wm8580.c  | 2 +-
 sound/soc/codecs/wm8711.c  | 2 +-
 sound/soc/codecs/wm8728.c  | 2 +-
 sound/soc/codecs/wm8731-i2c.c  | 2 +-
 sound/soc/codecs/wm8731-spi.c  | 2 +-
 sound/soc/codecs/wm8737.c  | 2 +-
 sound/soc/codecs/wm8741.c  | 2 +-
 sound/soc/codecs/wm8750.c  | 2 +-
 sound/soc/codecs/wm8753.c  | 2 +-
 sound/soc/codecs/wm8770.c  | 2 +-
 sound/soc/codecs/wm8776.c  | 2 +-
 sound/soc/codecs/wm8804.c  | 1 -
 sound/soc/fsl/efika-audio-fabric.c | 4 ++--
 sound/soc/fsl/fsl_aud2htx.c| 3 +--
 sound/soc/fsl/fsl_mqs.c| 2 +-
 sound/soc/fsl/fsl_rpmsg.c  | 3 +--
 sound/soc/fsl/fsl_sai.c| 3 +--
 sound/soc/fsl/fsl_spdif.c  | 4 

  1   2   3   4   5   6   7   8   9   10   >