Support AMD Pensando Elba SoC
Subsystems (10)
v5 cover Support AMD Pensando Elba SoC
From: Brad Larson <[email protected]>
This series enables support for AMD Pensando Elba SoC based platforms.
The Elba SoC has the following features:
- Sixteen ARM64 A72 cores
- Dual DDR 4/5 memory controllers
- 32 lanes of PCIe Gen3/4 to the Host
- Network interfaces: Dual 200GE, Quad 100GE, 50GE, 25GE, 10GE and also a single 1GE management port.
- Storage/crypto offloads and 144 programmable P4 cores.
- QSPI and EMMC for SoC storage
- Two SPI interfaces for peripheral management
- I2C bus for platform management
This is a respin based on review inputs
1. Change to AMD Pensando instead of Pensando.
2. No reference to spidev in the device tree. Add multi-function driver pensando-elbasr and sub-device reset-elbasr.
3. Rebase to linux-next tag next-20220609 5.19.0-rc1
4. Redo the email list after rebase and using scripts/get_maintainer.pl
Brad Larson (15):
dt-bindings: arm: add AMD Pensando boards
dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
dt-bindings: spi: cdns: Add compatible for AMD Pensando Elba SoC
dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller
bindings
dt-bindings: mfd: syscon: Add amd,pensando-elba-syscon compatible
dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System
Resource chip
dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR
Reset Controller bindings
MAINTAINERS: Add entry for AMD PENSANDO
arm64: Add config for AMD Pensando SoC platforms
arm64: dts: Add AMD Pensando Elba SoC support
spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
spi: dw: Add support for AMD Pensando Elba SoC
mmc: sdhci-cadence: Add AMD Pensando Elba SoC support
mfd: pensando-elbasr: Add AMD Pensando Elba System Resource chip
reset: elbasr: Add AMD Pensando Elba SR Reset Controller
.../devicetree/bindings/arm/amd,pensando.yaml | 26 + .../bindings/mfd/amd,pensando-elbasr.yaml | 93 ++ .../devicetree/bindings/mfd/syscon.yaml | 1 + .../devicetree/bindings/mmc/cdns,sdhci.yaml | 14 + .../reset/amd,pensando-elbasr-reset.yaml | 62 ++ .../bindings/spi/cdns,qspi-nor.yaml | 12 + .../bindings/spi/snps,dw-apb-ssi.yaml | 2 + MAINTAINERS | 10 + arch/arm64/Kconfig.platforms | 12 + arch/arm64/boot/dts/amd/Makefile | 1 + arch/arm64/boot/dts/amd/elba-16core.dtsi | 189 ++++ arch/arm64/boot/dts/amd/elba-asic-common.dtsi | 103 +++ arch/arm64/boot/dts/amd/elba-asic.dts | 28 + arch/arm64/boot/dts/amd/elba-flash-parts.dtsi | 106 +++ arch/arm64/boot/dts/amd/elba.dtsi | 191 ++++ drivers/mfd/Kconfig | 14 + drivers/mfd/Makefile | 1 + drivers/mfd/pensando-elbasr.c | 862 ++++++++++++++++++ drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-cadence.c | 179 +++- drivers/reset/Kconfig | 9 + drivers/reset/Makefile | 1 + drivers/reset/reset-elbasr.c | 94 ++ drivers/spi/spi-cadence-quadspi.c | 19 + drivers/spi/spi-dw-mmio.c | 66 ++ .../reset/amd,pensando-elba-reset.h | 11 + include/linux/mfd/pensando-elbasr.h | 78 ++ 27 files changed, 2171 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/amd,pensando.yaml create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml create mode 100644 arch/arm64/boot/dts/amd/elba-16core.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic-common.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic.dts create mode 100644 arch/arm64/boot/dts/amd/elba-flash-parts.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba.dtsi create mode 100644 drivers/mfd/pensando-elbasr.c create mode 100644 drivers/reset/reset-elbasr.c create mode 100644 include/dt-bindings/reset/amd,pensando-elba-reset.h create mode 100644 include/linux/mfd/pensando-elbasr.h
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 1/15 dt-bindings: arm: add AMD Pensando boards
From: Brad Larson <[email protected]>
Document the compatible for AMD Pensando Elba SoC boards.
--- .../devicetree/bindings/arm/amd,pensando.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/amd,pensando.yaml
Documentation/devicetree/bindings/arm/amd,pensando.yaml new file +26 -0
@@ -0,0 +1,26 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/arm/amd,pensando.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando SoC Platforms Device Tree Bindings + +maintainers: + - Brad Larson <[email protected]> + +properties: + $nodename: + const: "/" + compatible: + oneOf: + + - description: Boards with Pensando Elba SoC + items: + - enum: + - amd,pensando-elba-ortano + - const: amd,pensando-elba + +additionalProperties: true + +...
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 2/15 dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
AMD Pensando Elba ARM 64-bit SoC is integrated with this IP and explicitly controls byte-lane enables.
--- .../devicetree/bindings/mmc/cdns,sdhci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +14 -0
@@ -13,10 +13,24 @@ maintainers: allOf: - $ref: mmc-controller.yaml + - if: + properties: + compatible: + enum: + - amd,pensando-elba-sd4hc + then: + properties: + reg: + items: + - description: Cadence host controller registers + - description: Byte-lane control register + minItems: 2 + properties: compatible: items: - enum: + - amd,pensando-elba-sd4hc - microchip,mpfs-sd4hc - socionext,uniphier-sd4hc - const: cdns,sd4hc
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 3/15 dt-bindings: spi: cdns: Add compatible for AMD Pensando Elba SoC
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Document the cadence qspi controller compatible for AMD Pensando Elba SoC boards. The Elba qspi fifo size is 1024.
--- .../devicetree/bindings/spi/cdns,qspi-nor.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml +12 -0
@@ -20,11 +20,23 @@ allOf: required: - power-domains + - if: + properties: + compatible: + enum: + - amd,pensando-elba-qspi + then: + properties: + cdns,fifo-depth: + enum: [ 128, 256, 1024 ] + default: 1024 + properties: compatible: oneOf: - items: - enum: + - amd,pensando-elba-qspi - ti,k2g-qspi - ti,am654-ospi - intel,lgm-qspi
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 4/15 dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2 -0
@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spi reg: minItems: 1
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 5/15 dt-bindings: mfd: syscon: Add amd,pensando-elba-syscon compatible
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add the AMD Pensando Elba SoC system registers compatible.
--- Documentation/devicetree/bindings/mfd/syscon.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +1 -0
@@ -38,6 +38,7 @@ properties: - allwinner,sun8i-h3-system-controller - allwinner,sun8i-v3s-system-controller - allwinner,sun50i-a64-system-controller + - amd,pensando-elba-syscon - brcm,cru-clkset - freecom,fsg-cs2-system-controller - hisilicon,dsa-subctrl
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 6/15 dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +93 -0
@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/amd,pensando-elbasr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Resource Controller bindings + +description: | + AMD Pensando Elba SoC Resource Controller bindings attached to a SPI bus. + +maintainers: + - Brad Larson <[email protected]> + +properties: + compatible: + items: + - enum: + - amd,pensando-elbasr + - const: simple-mfd + + spi-max-frequency: + description: Maximum SPI frequency of the device in Hz. + + reg: + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - spi-max-frequency + +patternProperties: + '^reset-controller@[a-f0-9]+$': + $ref: ../reset/amd,pensando-elbasr-reset.yaml + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <12000000>; + + rstc: reset-controller@0 { + compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + + spi@1 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <1>; + spi-max-frequency = <12000000>; + }; + + spi@2 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <2>; + spi-max-frequency = <12000000>; + interrupt-parent = <&porta>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + }; + + spi@3 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <3>; + spi-max-frequency = <12000000>; + }; + }; + +...
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 7/15 dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Document bindings for AMD Pensando Elba SR Reset Controller
--- .../reset/amd,pensando-elbasr-reset.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/amd,pensando-elbasr-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Reset Controller Device Tree Bindings + +maintainers: + - Brad Larson <[email protected]> + +description: | + AMD Pensando Elba SoC reset controller driver which supports a resource + controller connected to the Elba SoC over a SPI bus. The Elba reset + controller must be defined as a child node of the Elba SPI bus + chip-select 0 node. + + See also: + - dt-bindings/reset/amd,pensando-elba-reset.h + +properties: + $nodename: + pattern: "^reset-controller@[0-9a-f]+$" + + compatible: + const: amd,pensando-elbasr-reset + + reg: + const: 0 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + spi0 { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + rstc: reset-controller@0 { + compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + }; + +...
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 8/15 MAINTAINERS: Add entry for AMD PENSANDO
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add entry for AMD PENSANDO maintainer and files
--- MAINTAINERS | 10 ++++++++++ 1 file changed, 10 insertions(+)
MAINTAINERS +10 -0
@@ -1777,6 +1777,16 @@ N: allwinner N: sun[x456789]i N: sun50i +ARM/AMD PENSANDO ARM64 ARCHITECTURE +M: Brad Larson <[email protected]> +L: [email protected] (moderated for non-subscribers) +S: Supported +F: Documentation/devicetree/bindings/*/amd,pensando* +F: arch/arm64/boot/dts/amd/elba* +F: drivers/mfd/pensando* +F: drivers/reset/reset-elbasr.c +F: include/dt-bindings/reset/amd,pensando* + ARM/Amlogic Meson SoC CLOCK FRAMEWORK M: Neil Armstrong <[email protected]> M: Jerome Brunet <[email protected]>
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 15/15 reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
--- drivers/reset/Kconfig | 9 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-elbasr.c | 94 +++++++++++++++++++ .../reset/amd,pensando-elba-reset.h | 11 +++ 4 files changed, 115 insertions(+) create mode 100644 drivers/reset/reset-elbasr.c create mode 100644 include/dt-bindings/reset/amd,pensando-elba-reset.h
drivers/reset/Kconfig +9 -0
@@ -66,6 +66,15 @@ config RESET_BRCMSTB_RESCAL This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on BCM7216. +config RESET_ELBASR + tristate "Pensando Elba System Resource reset controller" + depends on MFD_PENSANDO_ELBASR || COMPILE_TEST + help + This option enables support for the external reset functions + on the Pensando Elba System Resource Chip. Reset control + of peripherals is accessed over SPI to the system resource + chip device registers using CS0. + config RESET_HSDK bool "Synopsys HSDK Reset Driver" depends on HAS_IOMEM
drivers/reset/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o +obj-$(CONFIG_RESET_ELBASR) += reset-elbasr.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.o
drivers/reset/reset-elbasr.c new file +94 -0
94 lines not on this page · raw message
include/dt-bindings/reset/amd,pensando-elba-reset.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Copyright (c) 2022, AMD Pensando +*/ + +#ifndef _DT_BINDINGS_RESET_AMD_PENSANDO_ELBA_RESET_H +#define _DT_BINDINGS_RESET_AMD_PENSANDO_ELBA_RESET_H + +#define EMMC_HW_RESET 0 + +#endif
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 13/15 mmc: sdhci-cadence: Add AMD Pensando Elba SoC support
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add support for AMD Pensando Elba SoC which explicitly controls byte-lane enables on writes. Add priv_write_l() which is used on Elba platforms for byte-lane control.
Select MMC_SDHCI_IO_ACCESSORS for MMC_SDHCI_CADENCE which allows Elba SoC sdhci_elba_ops to overwrite the SDHCI IO memory accessors.
--- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-cadence.c | 179 ++++++++++++++++++++++++++++--- 2 files changed, 166 insertions(+), 14 deletions(-)
drivers/mmc/host/Kconfig +1 -0
@@ -243,6 +243,7 @@ config MMC_SDHCI_CADENCE tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller" depends on MMC_SDHCI_PLTFM depends on OF + select MMC_SDHCI_IO_ACCESSORS help This selects the Cadence SD/SDIO/eMMC driver.
drivers/mmc/host/sdhci-cadence.c +165 -14
281 lines not on this page · raw message
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 14/15 mfd: pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
--- drivers/mfd/Kconfig | 14 + drivers/mfd/Makefile | 1 + drivers/mfd/pensando-elbasr.c | 862 ++++++++++++++++++++++++++++ include/linux/mfd/pensando-elbasr.h | 78 +++ 4 files changed, 955 insertions(+) create mode 100644 drivers/mfd/pensando-elbasr.c create mode 100644 include/linux/mfd/pensando-elbasr.h
drivers/mfd/Kconfig +14 -0
@@ -1050,6 +1050,20 @@ config UCB1400_CORE To compile this driver as a module, choose M here: the module will be called ucb1400_core. +config MFD_PENSANDO_ELBASR + bool "AMD Pensando Elba System Resource chip" + depends on SPI_MASTER=y + depends on (ARCH_PENSANDO && OF) || COMPILE_TEST + select REGMAP_SPI + select MFD_CORE + select MFD_SYSCON + help + Support for the AMD Pensando Elba SoC System Resource chip using the + SPI interface. This driver provides userspace access to four device + functions to include CS0 device registers, CS1 smbus interface for + FRU and board peripherals, CS2 dual Lattice I2C masters for + transceiver management, and CS3 flash for firmware update. + config MFD_PM8XXX tristate "Qualcomm PM8xxx PMIC chips driver" depends on (ARM || HEXAGON || COMPILE_TEST)
drivers/mfd/Makefile +1 -0
@@ -212,6 +212,7 @@ obj-$(CONFIG_MFD_INTEL_LPSS_PCI) += intel-lpss-pci.o obj-$(CONFIG_MFD_INTEL_LPSS_ACPI) += intel-lpss-acpi.o obj-$(CONFIG_MFD_INTEL_PMC_BXT) += intel_pmc_bxt.o obj-$(CONFIG_MFD_PALMAS) += palmas.o +obj-$(CONFIG_MFD_PENSANDO_ELBASR) += pensando-elbasr.o obj-$(CONFIG_MFD_VIPERBOARD) += viperboard.o obj-$(CONFIG_MFD_NTXEC) += ntxec.o obj-$(CONFIG_MFD_RC5T583) += rc5t583.o rc5t583-irq.o
drivers/mfd/pensando-elbasr.c new file +862 -0
862 lines not on this page · raw message
include/linux/mfd/pensando-elbasr.h new file +78 -0
78 lines not on this page · raw message
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 10/15 arm64: dts: Add AMD Pensando Elba SoC support
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add AMD Pensando common and Elba SoC specific device nodes
--- arch/arm64/boot/dts/amd/Makefile | 1 + arch/arm64/boot/dts/amd/elba-16core.dtsi | 189 +++++++++++++++++ arch/arm64/boot/dts/amd/elba-asic-common.dtsi | 103 ++++++++++ arch/arm64/boot/dts/amd/elba-asic.dts | 28 +++ arch/arm64/boot/dts/amd/elba-flash-parts.dtsi | 106 ++++++++++ arch/arm64/boot/dts/amd/elba.dtsi | 191 ++++++++++++++++++ 6 files changed, 618 insertions(+) create mode 100644 arch/arm64/boot/dts/amd/elba-16core.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic-common.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic.dts create mode 100644 arch/arm64/boot/dts/amd/elba-flash-parts.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba.dtsi
arch/arm64/boot/dts/amd/Makefile +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_SEATTLE) += amd-overdrive-rev-b0.dtb amd-overdrive-rev-b1.dtb +dtb-$(CONFIG_ARCH_PENSANDO) += elba-asic.dtb
arch/arm64/boot/dts/amd/elba-16core.dtsi new file +189 -0
189 lines not on this page · raw message
arch/arm64/boot/dts/amd/elba-asic-common.dtsi new file +103 -0
103 lines not on this page · raw message
arch/arm64/boot/dts/amd/elba-asic.dts new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for AMD Pensando Elba Board. + * + * Copyright (c) 2020-2022 AMD Pensando + */ + +/dts-v1/; + +#include "elba.dtsi" +#include "elba-16core.dtsi" +#include "elba-asic-common.dtsi" +#include "elba-flash-parts.dtsi" + +/ { + model = "AMD Pensando Elba Board"; + compatible = "amd,pensando-elba-ortano", "amd,pensando-elba"; + + aliases { + serial0 = &uart0; + spi0 = &spi0; + spi1 = &qspi; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; +};
arch/arm64/boot/dts/amd/elba-flash-parts.dtsi new file +106 -0
106 lines not on this page · raw message
arch/arm64/boot/dts/amd/elba.dtsi new file +191 -0
191 lines not on this page · raw message
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 12/15 spi: dw: Add support for AMD Pensando Elba SoC
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
The AMD Pensando Elba SoC includes a DW apb_ssi v4 controller with device specific chip-select control. The Elba SoC provides four chip-selects where the native DW IP supports two chip-selects. The Elba DW_SPI instance has two native CS signals that are always overridden.
--- drivers/spi/spi-dw-mmio.c | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+)
drivers/spi/spi-dw-mmio.c +66 -0
@@ -53,6 +53,24 @@ struct dw_spi_mscc {void __iomem *spi_mst;/* Not sparx5 */ }; +struct dw_spi_elba { +struct regmap *syscon; +}; + +/* +* Elba SoC does not use ssi, pin override is used for cs 0,1 and +* gpios for cs 2,3 as defined in the device tree. +* +* cs: | 1 0 +* bit: |---3-------2-------1-------0 +* | cs1 cs1_ovr cs0 cs0_ovr +*/ +#define ELBA_SPICS_REG 0x2468 +#define ELBA_SPICS_SHIFT (cs) (2 * (cs)) +#define ELBA_SPICS_MASK (cs) (0x3 << ELBA_SPICS_SHIFT(cs)) +#define ELBA_SPICS_SET (cs, val) \ + ((((val) << 1) | 0x1) << ELBA_SPICS_SHIFT(cs)) +/* * The Designware SPI controller (referred to as master in the documentation) * automatically deasserts chip select when the tx fifo is empty. The chip
@@ -238,6 +256,53 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev,return 0 ; } +static void dw_spi_elba_override_cs (struct dw_spi_elba *dwselba,int cs,int enable) +{ +regmap_update_bits (dwselba->syscon,ELBA_SPICS_REG ,ELBA_SPICS_MASK (cs), +ELBA_SPICS_SET (cs, enable)); +} + +static void dw_spi_elba_set_cs (struct spi_device *spi,bool enable) +{ +struct dw_spi *dws =spi_master_get_devdata (spi->master); + struct dw_spi_mmio *dwsmmio = container_of(dws, struct dw_spi_mmio, dws); +struct dw_spi_elba *dwselba = dwsmmio->priv; +u8 cs; + + cs = spi->chip_select; +if (cs <2 ) +dw_spi_elba_override_cs (dwselba, spi->chip_select, enable); + +/* +* The DW SPI controller needs a native CS bit selected to start +* the serial engine. +*/ + spi->chip_select =0 ; +dw_spi_set_cs (spi, enable); + spi->chip_select = cs; +} + +static int dw_spi_elba_init (struct platform_device *pdev, +struct dw_spi_mmio *dwsmmio) +{ +struct dw_spi_elba *dwselba; +struct regmap *regmap; + + regmap =syscon_regmap_lookup_by_compatible ("amd,pensando-elba-syscon" ); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + dwselba =devm_kzalloc (&pdev->dev,sizeof (*dwselba),GFP_KERNEL ); +if (!dwselba) +return -ENOMEM ; + dwselba->syscon = regmap; + + dwsmmio->priv = dwselba; + dwsmmio->dws.set_cs = dw_spi_elba_set_cs; + +return 0 ; +} +static int dw_spi_mmio_probe (struct platform_device *pdev) { int (*init_func)(struct platform_device *pdev,
@@ -352,6 +417,7 @@ static const struct of_device_id dw_spi_mmio_of_match[] = { { .compatible = "intel,keembay-ssi", .data = dw_spi_keembay_init}, { .compatible = "microchip,sparx5-spi", dw_spi_mscc_sparx5_init}, { .compatible = "canaan,k210-spi", dw_spi_canaan_k210_init}, + { .compatible = "amd,pensando-elba-spi", .data = dw_spi_elba_init}, { /* end of table */} };MODULE_DEVICE_TABLE (of, dw_spi_mmio_of_match);
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 11/15 spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has the Cadence QSPI controller integrated.
The quirk CQSPI_NEEDS_APB_AHB_HAZARD_WAR is added and if enabled a dummy readback from the controller is performed to ensure synchronization.
--- drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/spi/spi-cadence-quadspi.c +19 -0
@@ -39,6 +39,7 @@#define CQSPI_DISABLE_DAC_MODE BIT(1)#define CQSPI_SUPPORT_EXTERNAL_DMA BIT(2)#define CQSPI_NO_SUPPORT_WR_COMPLETION BIT(3) +#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR BIT(4)/* Capabilities */ #define CQSPI_SUPPORTS_OCTAL BIT(0)
@@ -87,6 +88,7 @@ struct cqspi_st {bool use_dma_read;u32 pd_dev_id;bool wr_completion; +bool apb_ahb_hazard; };struct cqspi_driver_platdata {
@@ -952,6 +954,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata,if (cqspi->wr_delay)ndelay (cqspi->wr_delay); +/* +* If a hazard exists between the APB and AHB interfaces, perform a +* dummy readback from the controller to ensure synchronization. +*/ +if (cqspi->apb_ahb_hazard) + (void )readl (reg_base +CQSPI_REG_INDIRECTWR ); +while (remaining >0 ) {size_t write_words, mod_bytes;
@@ -1667,6 +1676,8 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->use_dma_read = true;if (ddata->quirks &CQSPI_NO_SUPPORT_WR_COMPLETION ) cqspi->wr_completion = false; +if (ddata->quirks &CQSPI_NEEDS_APB_AHB_HAZARD_WAR ) + cqspi->apb_ahb_hazard = true;if (of_device_is_compatible (pdev->dev.of_node,"xlnx,versal-ospi-1.0" ))
@@ -1789,6 +1800,10 @@ static const struct cqspi_driver_platdata versal_ospi = { .get_dma_status = cqspi_get_versal_dma_status, }; +static const struct cqspi_driver_platdata pen_cdns_qspi = { + .quirks =CQSPI_NEEDS_APB_AHB_HAZARD_WAR |CQSPI_DISABLE_DAC_MODE , +}; +static const struct of_device_id cqspi_dt_ids[] = { { .compatible ="cdns,qspi-nor" ,
@@ -1814,6 +1829,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "intel,socfpga-qspi", .data = &socfpga_qspi, }, + { + .compatible = "amd,pensando-elba-qspi", + .data = &pen_cdns_qspi, + }, {/* end of table */ } };
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v5 9/15 arm64: Add config for AMD Pensando SoC platforms
In reply to Brad LarsonFrom: Brad Larson <[email protected]>
Add ARCH_PENSANDO configuration option for AMD Pensando SoC based platforms.
--- arch/arm64/Kconfig.platforms | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/Kconfig.platforms +12 -0
@@ -202,6 +202,18 @@ config ARCH_MXC This enables support for the ARMv8 based SoCs in the NXP i.MX family. +config ARCH_PENSANDO + bool "AMD Pensando Platforms" + help + This enables support for the ARMv8 based AMD Pensando SoC + family to include the Elba SoC. + + AMD Pensando SoCs support a range of Distributed Services + Cards in PCIe format installed into servers. The Elba + SoC includes 16 A-72 CPU cores, 144 programmable P4 + cores for a minimal latency/jitter datapath, and network + interfaces up to 200 Gb/s. + config ARCH_QCOM bool "Qualcomm Platforms" select GPIOLIB
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH v5 11/15] spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
In reply to Brad LarsonHi Brad,
Quoted 34 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has the Cadence QSPI controller integrated.
The quirk
CQSPI_NEEDS_APB_AHB_HAZARD_WARis added and if enabled a dummy readback from the controller is performed to ensure synchronization.Signed-off-by Brad Larson <[email protected]>--- drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/spi/spi-cadence-quadspi.c +2
-0@@ -39,6 +39,7 @@#define CQSPI_DISABLE_DAC_MODE BIT(1)#define CQSPI_SUPPORT_EXTERNAL_DMA BIT(2)#define CQSPI_NO_SUPPORT_WR_COMPLETION BIT(3) +#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR BIT(4)/* Capabilities */ #define CQSPI_SUPPORTS_OCTAL BIT(0)@@ -87,6 +88,7 @@ struct cqspi_st {bool use_dma_read;u32 pd_dev_id;bool wr_completion; +bool apb_ahb_hazard; };struct cqspi_driver_platdata {
drivers/spi/spi-cadence-quadspi.c static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata, · line 960
Quoted 7 lines
drivers/spi/spi-cadence-quadspi.c +4
-0@@ -952,6 +954,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata,if (cqspi->wr_delay)ndelay (cqspi->wr_delay); +/* +* If a hazard exists between the APB and AHB interfaces, perform a +* dummy readback from the controller to ensure synchronization. +*/
This is needed for TI's SoCs as well. APB and AHB accesses are independent of each other on the interconnect and can be racy. I wrote a couple patches [0][1] to fix this on TI's fork. I never got around to sending them upstream. It would be great if you can pick those up. They fix the race in all paths, not just indirect write.
I would also prefer if we do this unconditionally. I don't think it has much downside even on platforms that do not strictly need this.
[0] https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/drivers/spi/spi-cadence-quadspi.c?h=ti-linux-5.10.y&id=027f03a8512086e5ef05dc4e4ff53b2628848f95
[1] https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/drivers/spi/spi-cadence-quadspi.c?h=ti-linux-5.10.y&id=4c367e58bab7d3f9c470c3778441f73546f20398
Quoted 40 lines
drivers/spi/spi-cadence-quadspi.c +13
-0+if (cqspi->apb_ahb_hazard) + (void )readl (reg_base +CQSPI_REG_INDIRECTWR ); +while (remaining >0 ) {size_t write_words, mod_bytes;@@ -1667,6 +1676,8 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->use_dma_read = true;if (ddata->quirks &CQSPI_NO_SUPPORT_WR_COMPLETION ) cqspi->wr_completion = false; +if (ddata->quirks &CQSPI_NEEDS_APB_AHB_HAZARD_WAR ) + cqspi->apb_ahb_hazard = true;if (of_device_is_compatible (pdev->dev.of_node,"xlnx,versal-ospi-1.0" ))@@ -1789,6 +1800,10 @@ static const struct cqspi_driver_platdata versal_ospi = { .get_dma_status = cqspi_get_versal_dma_status, }; +static const struct cqspi_driver_platdata pen_cdns_qspi = { + .quirks =CQSPI_NEEDS_APB_AHB_HAZARD_WAR |CQSPI_DISABLE_DAC_MODE , +}; +static const struct of_device_id cqspi_dt_ids[] = { { .compatible ="cdns,qspi-nor" ,@@ -1814,6 +1829,10 @@ static const struct of_device_id cqspi_dt_ids[] = { .compatible = "intel,socfpga-qspi", .data = &socfpga_qspi, }, + { + .compatible = "amd,pensando-elba-qspi", + .data = &pen_cdns_qspi, + }, {/* end of table */ } };Signature · 1 line
2.17.1
Signature · 3 lines
Regards, Pratyush Yadav Texas Instruments Inc.
Re: [PATCH v5 12/15] spi: dw: Add support for AMD Pensando Elba SoC
In reply to Brad LarsonQuoted 8 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC includes a DW
apb_ssiv4 controller with device specific chip-select control. The Elba SoC provides four chip-selects where the native DW IP supports two chip-selects. The ElbaDW_SPIinstance has two native CS signals that are always overridden.
...
drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 69
Quoted 10 lines
drivers/spi/spi-dw-mmio.c +9
-0+/* +* Elba SoC does not use ssi, pin override is used for cs 0,1 and +* gpios for cs 2,3 as defined in the device tree. +* +* cs: | 1 0 +* bit: |---3-------2-------1-------0 +* | cs1 cs1_ovr cs0 cs0_ovr +*/ +#define ELBA_SPICS_SHIFT (cs) (2 * (cs))
Useless.It takes much more than simply multiplying each time in two macros. Also see below.
Quoted 1 line
+#define
ELBA_SPICS_MASK(cs)(0x3<<ELBA_SPICS_SHIFT(cs))
(GENMASK(1, 0) << ((cs) << 1))
Or ((cs) * 2) to show that it takes 2 bits and not two times of CS',
drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 72
Quoted 2 lines
drivers/spi/spi-dw-mmio.c +2
-0+#define ELBA_SPICS_SET (cs, val) \ + ((((val) << 1) | 0x1) << ELBA_SPICS_SHIFT(cs))
BIT(0)
So the main point is to use GENMASK() and BIT() the rest is up to you.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 13/15] mmc: sdhci-cadence: Add AMD Pensando Elba SoC support
In reply to Brad LarsonQuoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for AMD Pensando Elba SoC which explicitly controls byte-lane enables on writes. Add
priv_write_l()which is
enabling ?
Quoted 5 lines
used on Elba platforms for byte-lane control.
Select
MMC_SDHCI_IO_ACCESSORSforMMC_SDHCI_CADENCEwhich allows Elba SoCsdhci_elba_opsto overwrite the SDHCI IO memory accessors.
...
Quoted 1 line
+ void (*priv_write_l)(struct
sdhci_cdns_priv*priv, u32 val,
priv_writel
Quoted 1 line
+ void
__iomem*reg);
And perhaps leave it on one line.
I also would swap parameters, so address goes first followed by value.
...
drivers/mmc/host/sdhci-cadence.c static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { · line 107
Quoted 5 lines
drivers/mmc/host/sdhci-cadence.c +4
-0+static inline void sdhci_cdns_priv_writel (struct sdhci_cdns_priv *priv, +u32 val,void __iomem *reg) +{ +if (unlikely (priv->priv_write_l))
First of all, why if (unlikely())-else instead of if (likely())-else?
drivers/mmc/host/sdhci-cadence.c static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { · line 111
Quoted 4 lines
drivers/mmc/host/sdhci-cadence.c +4
-0+ priv->priv_write_l (priv, val, reg); + else +writel (val ,reg ); +}
Instead of branching each time you do I/O, make sure that callback is always set and call it unconditionally. In this case you don't need to have this callback, but maybe just a wrapper on writel(). As a result you may split this to two patches in the first of which you simply introduce a callback and a writel() wrapper which is assigned unconditionally to all current chips. In the next you add a new chip support.
...
drivers/mmc/host/sdhci-cadence.c static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, · line 362
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+u32 m = (reg &0x3 ); +u32 msk = (0x3 << (m)); + +spin_lock_irqsave (&priv->wrlock, flags); +writel (msk <<3 , priv->ctl_addr); +writew (val, host->ioaddr + reg); +spin_unlock_irqrestore (&priv->wrlock, flags);
Too many 3:s as magic. Is it GENMASK() or something else? Perhaps it needs a definition.
...
drivers/mmc/host/sdhci-cadence.c static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, · line 375
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+u32 m = (reg &0x3 ); +u32 msk = (0x1 << (m)); + +spin_lock_irqsave (&priv->wrlock, flags); +writel (msk <<3 , priv->ctl_addr); +writeb (val, host->ioaddr + reg); +spin_unlock_irqrestore (&priv->wrlock, flags);
Ditto.
...
Quoted 1 line
+
writel(0x78, priv->ctl_addr);
Magic.
...
drivers/mmc/host/sdhci-cadence.c static const struct sdhci_ops sdhci_cdns_ops = { · line 444
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = { + .pltfm_data = { + .ops = &sdhci_cdns_ops, + }, +}; + +
One blank line is enough.
...
drivers/mmc/host/sdhci-cadence.c static const struct dev_pm_ops sdhci_cdns_pm_ops = { · line 607
Quoted 3 lines
drivers/mmc/host/sdhci-cadence.c +3
-0+ { + .compatible = "amd,pensando-elba-sd4hc", + .data = &sdhci_elba_drv_data
Leave a comma here.
Quoted 1 line
},
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v5 14/15] mfd: pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonQuoted 8 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
...
Quoted 9 lines
drivers/mfd/pensando-elbasr.c new file +9
-0+#include <linux/mfd/pensando-elbasr.h> +#include <linux/mfd/core.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/ioctl.h> +#include <linux/fs.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/list.h>
drivers/mfd/pensando-elbasr.c line 34
Quoted 10 lines
drivers/mfd/pensando-elbasr.c new file +10
-0+#include <linux/errno.h> +#include <linux/mutex.h> +#include <linux/slab.h> +#include <linux/compat.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/regmap.h> +#include <linux/spi/spi.h> +#include <linux/spi/spidev.h> +#include <linux/delay.h>
Keep it sorted?
It would easily tell that types.h is missed, but maybe other headers are superfluous.
...
Quoted 5 lines
+/* The main reason to have this class is to make mdev/udev create the
+ */dev/pensrB.Ccharacter device nodes exposing our userspace API.
+ * It also simplifies memory management. The device nodes
+ */dev/pensrB.Care common across Pensando boards.
+ */
/*
* The above style of multi-line
* comments is for networking,
* the rest uses a slightly different one.
*/
...
drivers/mfd/pensando-elbasr.c line 52
Quoted 5 lines
drivers/mfd/pensando-elbasr.c new file +5
-0+static DECLARE_BITMAP(minors, ELBASR_MAX_DEVS); +static unsigned int bufsiz =4096 ; + +static LIST_HEAD (device_list); +static DEFINE_MUTEX (device_list_lock);
Is it all to reinvent IDA?
...
drivers/mfd/pensando-elbasr.c line 86
Quoted 11 lines
drivers/mfd/pensando-elbasr.c new file +10
-0+static ssize_t +elbasr_spi_sync (struct elbasr_data *elbasr_spi,struct spi_message *message) +{ +int status; +struct spi_device *spi; + +spin_lock_irq (&elbasr_spi->spi_lock); + spi = elbasr_spi->spi; +spin_unlock_irq (&elbasr_spi->spi_lock); +
Drop this blank line and see below.
drivers/mfd/pensando-elbasr.c line 88
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+if (spi ==NULL ) + status = -ESHUTDOWN ;
if (!spi)
return ...
drivers/mfd/pensando-elbasr.c line 95
Quoted 8 lines
drivers/mfd/pensando-elbasr.c new file +7
-0+else + status =spi_sync (spi, message); + +if (status ==0 ) + status = message->actual_length; + +return status;
status = spi_sync(...);
if (status)
return status;
return message->actual_length;
Quoted 1 line
+}
...
drivers/mfd/pensando-elbasr.c line 564
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+if (status) { +pr_debug ("elbasr_spi: nothing for minor %d\n" ,iminor (inode));
We have a device pointer, don't we?
Quoted 2 lines
(quoted diff) +2
-0+ goto err_find_dev; + }
...
drivers/mfd/pensando-elbasr.c line 646
Quoted 10 lines
drivers/mfd/pensando-elbasr.c new file +10
-0+static const struct file_operations elbasr_spi_fops = { + .owner =THIS_MODULE , + .write = elbasr_spi_write, + .read = elbasr_spi_read, + .unlocked_ioctl = elbasr_spi_ioctl, + .compat_ioctl = elbasr_spi_compat_ioctl, + .open = elbasr_spi_open, + .release = elbasr_spi_release, + .llseek = no_llseek, +};
As far as I can see the code looks like a proxy for SPI via SPI. Is that the correct interpretation? If so, why this code repeating _a lot_ from SPI framework, including character device IOCTL? This is a big question here and since there is missed documentation for ABI and no points to userspace tools which are going to use this ABI (red flag!) the code is no go.
...
drivers/mfd/pensando-elbasr.c line 649
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+static bool +elbasr_reg_readable (struct device *dev,unsigned int reg)
It's pretty much one line, can you reduce the number of LoCs by reindenting your code a bit?
...
Review
Quoted 2 lines
(quoted diff) +2
-0+static bool +elbasr_reg_writeable(struct device *dev, unsigned int reg)
Ditto and so on.
...
Quoted 1 line
+ struct
spi_transfert[2] = { { 0 } };
Isn't { } enough?
...
drivers/mfd/pensando-elbasr.c line 683
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+spi_message_add_tail (&t[0 ], &m); +spi_message_add_tail (&t[1 ], &m);
spi_message_init_with_transfers() ?
Here and elsewhere.
...
Quoted 1 line
+ struct
spi_transfert[1] = { { 0 } };
Why does struct spi_transfer t = { }; not work?!
...
drivers/mfd/pensando-elbasr.c line 724
Quoted 9 lines
drivers/mfd/pensando-elbasr.c new file +9
-0+static const struct regmap_config pensando_elbasr_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .cache_type =REGCACHE_NONE , + .readable_reg = elbasr_reg_readable, + .writeable_reg = elbasr_reg_writeable, + .reg_read = elbasr_regs_read, + .reg_write = elbasr_regs_write, + .max_register =ELBASR_MAX_REG
Leave a comma here.
Quoted 1 line
+};
...
drivers/mfd/pensando-elbasr.c line 742
Quoted 6 lines
drivers/mfd/pensando-elbasr.c new file +6
-0+ elbasr->elbasr_regs =devm_regmap_init (&spi->dev,NULL , spi, + &pensando_elbasr_regmap_config); +if (IS_ERR (elbasr->elbasr_regs)) { + ret =PTR_ERR (elbasr->elbasr_regs); +dev_err (&spi->dev,"Failed to allocate register map: %d\n" , ret); +return ret;
return dev_err_probe(...);
drivers/mfd/pensando-elbasr.c line 752
Quoted 10 lines
drivers/mfd/pensando-elbasr.c new file +10
-0+ } + + ret =devm_mfd_add_devices (&spi->dev,PLATFORM_DEVID_NONE , + pensando_elbasr_subdev_info, +ARRAY_SIZE (pensando_elbasr_subdev_info), +NULL ,0 ,NULL ); +if (ret) +dev_err (&spi->dev,"Failed to register sub-devices: %d\n" , ret); + +return ret;
Ditto.
...
drivers/mfd/pensando-elbasr.c line 834
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +3
-0+/* Add Elba reset driver sub-device */ +if (spi->chip_select ==0 ) +elbasr_regs_setup (spi, elbasr);
You have an awful mixture of devm_ vs. non-devm_ calls. Either move from devm_ completely, or switch to devm_ in the rest of the ->probe() code.
...
drivers/mfd/pensando-elbasr.c line 852
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +3
-0+static const struct of_device_id elbasr_spi_of_match[] = { + { .compatible ="amd,pensando-elbasr" }, + {/* sentinel */ },
Comma is not needed in terminator entry.
Quoted 1 line
+};
...
drivers/mfd/pensando-elbasr.c line 859
Quoted 6 lines
drivers/mfd/pensando-elbasr.c new file +5
-0+static struct spi_driver elbasr_spi_driver = { + .probe = elbasr_spi_probe, + .driver = { + .name ="elbasr" , + .of_match_table =of_match_ptr (elbasr_spi_of_match),
of_match_ptr() is useless here (look at your Kconfig) and in some cases is harmful. No need to use this.
Quoted 2 lines
(quoted diff) +2
-0+ }, +};
...
include/linux/mfd/pensando-elbasr.h line 12
Quoted 2 lines
include/linux/mfd/pensando-elbasr.h new file +2
-0+#include <linux/cdev.h> +#include <linux/regmap.h>
mutex.h and types.h are missed, for example.
You need to use headers for direct use of. And in some cases forward declarations can be used instead of including a header.
--
With Best Regards,
Andy Shevchenko
Re: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Brad LarsonQuoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
...
drivers/reset/reset-elbasr.c line 11
Quoted 7 lines
drivers/reset/reset-elbasr.c new file +6
-0+#include <linux/mfd/pensando-elbasr.h> +#include <linux/platform_device.h> +#include <linux/reset-controller.h> +#include <linux/regmap.h> +#include <linux/err.h> +#include <linux/of.h>
There is no user of this header. But there are missed ones, such as mod_devicetable.h.
Keep them ordered to easily find such issues.
...
drivers/reset/reset-elbasr.c line 79
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+ ret =devm_reset_controller_register (&pdev->dev, &elbar->rcdev); + +return ret;
It is simply return devm_...(...);. Looking through your patches I can tell that you may easily drop LoCs by 10%. Please do so in the next version.
...
drivers/reset/reset-elbasr.c line 84
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+static const struct of_device_id elba_reset_dt_match[] = { + { .compatible ="amd,pensando-elbasr-reset" , }, + {/* sentinel */ },
No comma.
Quoted 1 line
+};
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerRe: [PATCH v5 11/15] spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
In reply to Brad Larsondrivers/spi/spi-cadence-quadspi.c static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata, · line 962
Quoted 6 lines · Brad Larson
drivers/spi/spi-cadence-quadspi.c +6
-0+/* +* If a hazard exists between the APB and AHB interfaces, perform a +* dummy readback from the controller to ensure synchronization. +*/ +if (cqspi->apb_ahb_hazard) + (void )readl (reg_base +CQSPI_REG_INDIRECTWR );
You shouldn't need the cast here.
Philipp Zabel
maintainerRe: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Brad LarsonHi Brad,
Quoted 6 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
Signed-off-by Brad Larson <[email protected]>
[...]
Quoted 24 lines
drivers/reset/reset-elbasr.c new file +18
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* +* Copyright (c) 2022 AMD Pensando +*/ + +#include <linux/mfd/pensando-elbasr.h> +#include <linux/platform_device.h> +#include <linux/reset-controller.h> +#include <linux/regmap.h> +#include <linux/err.h> +#include <linux/of.h> + +#include <dt-bindings/reset/amd,pensando-elba-reset.h> + +struct elbasr_reset { +struct reset_controller_dev rcdev; +struct regmap *regmap; +};
drivers/reset/reset-elbasr.c line 28
Quoted 10 lines
drivers/reset/reset-elbasr.c new file +10
-0+ +static inline struct elbasr_reset *to_elbasr_rst (struct reset_controller_dev *rc) +{ + return container_of(rc, struct elbasr_reset, rcdev); +} + +static inline int elbasr_reset_shift (unsigned long id) +{ +switch (id) { +case EMMC_HW_RESET :
Are there more reset controls than EMMC_HW_RESET?
If so, please list them all.
If not, why is this a function with a switch statement for a single reset bit?
drivers/reset/reset-elbasr.c line 31
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+return 6 ; +default : +return -EINVAL ;
The error return value is never checked.
This can't be reached, since ELBASR_NR_RESETS == 1. So id will only ever be 0.
drivers/reset/reset-elbasr.c line 60
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+static int elbasr_reset_probe (struct platform_device *pdev) +{ +struct elbasr_data *elbasr =dev_get_drvdata (pdev->dev.parent);
Peeking into the MFD driver's private data structure seems unnecessary. Consider using dev_get_regmap() instead.
regards
Philipp
Re: [PATCH v5 01/15] dt-bindings: arm: add AMD Pensando boards
In reply to Brad LarsonQuoted 10 lines · Brad Larson
From: Brad Larson <[email protected]>
Document the compatible for AMD Pensando Elba SoC boards.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/arm/amd,pensando.yaml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/amd,pensando.yaml
Rob Herring
maintainerRe: [PATCH v5 02/15] dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
In reply to Brad LarsonQuoted 20 lines · Brad Larson
From: Brad Larson <[email protected]>
AMD Pensando Elba ARM 64-bit SoC is integrated with this IP and explicitly controls byte-lane enables.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/mmc/cdns,sdhci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +2
-0@@ -13,10 +13,24 @@ maintainers: allOf: - $ref: mmc-controller.yaml + - if: + properties:
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml maintainers: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +10
-0+ compatible: + enum: + - amd,pensando-elba-sd4hc + then: + properties: + reg: + items: + - description: Cadence host controller registers + - description: Byte-lane control register + minItems: 2
This doesn't work. The if/then is additional constraints on the main section which says there is only 1 register region. The main section needs the above, but with 'minItems: 1'. Then the if/then should be:
if:
properties:
compatible:
const: amd,pensando-elba-sd4hc
then:
properties:
reg:
minItems: 2
else:
properties:
reg:
maxItems: 1
Quoted 13 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +2
-0+ properties: compatible: items: - enum: + - amd,pensando-elba-sd4hc - microchip,mpfs-sd4hc - socionext,uniphier-sd4hc - const: cdns,sd4hcSignature · 1 line
2.17.1
Re: [PATCH v5 03/15] dt-bindings: spi: cdns: Add compatible for AMD Pensando Elba SoC
In reply to Brad LarsonQuoted 10 lines · Brad Larson
From: Brad Larson <[email protected]>
Document the cadence qspi controller compatible for AMD Pensando Elba SoC boards. The Elba qspi fifo size is 1024.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/spi/cdns,qspi-nor.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
In reply to Brad LarsonQuoted 9 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)
Re: [PATCH v5 05/15] dt-bindings: mfd: syscon: Add amd,pensando-elba-syscon compatible
In reply to Brad LarsonQuoted 9 lines · Brad Larson
From: Brad Larson <[email protected]>
Add the AMD Pensando Elba SoC system registers compatible.
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/mfd/syscon.yaml | 1 + 1 file changed, 1 insertion(+)
Rob Herring
maintainerRe: [PATCH v5 06/15] dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonQuoted 54 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Signed-off-by Brad Larson <[email protected]>--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yamlDocumentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +34
-0@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/amd,pensando-elbasr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Resource Controller bindings + +description: | + AMD Pensando Elba SoC Resource Controller bindings attached to a SPI bus. + +maintainers: + - Brad Larson <[email protected]> + +properties: + compatible: + items: + - enum: + - amd,pensando-elbasr + - const: simple-mfd + + spi-max-frequency: + description: Maximum SPI frequency of the device in Hz. + + reg: + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + interrupts:
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ maxItems: 1 + +required: + - compatible + - reg + - spi-max-frequency + +patternProperties: + '^reset-controller@[a-f0-9]+$': + $ref: ../reset/amd,pensando-elbasr-reset.yaml
/schemas/reset/...
Quoted 11 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +11
-0+ +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 { + #address-cells = <1>; + #size-cells = <0>;
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 65
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ num-cs = <4>; + + spi@0 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <12000000>; + + rstc: reset-controller@0 {
Only one child does not make a MFD...
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 75
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + + spi@1 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <1>; + spi-max-frequency = <12000000>;
'simple-mfd' implies there are child nodes, but you have none. Is this complete?
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 83
Quoted 8 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +8
-0+ }; + + spi@2 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <2>; + spi-max-frequency = <12000000>; + interrupt-parent = <&porta>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
This one has interrupt but the others don't?
Quoted 14 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ }; + + spi@3 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <3>; + spi-max-frequency = <12000000>; + }; + }; + +...Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Brad LarsonQuoted 55 lines · Brad Larson
From: Brad Larson <[email protected]>
Document bindings for AMD Pensando Elba SR Reset Controller
Signed-off-by Brad Larson <[email protected]>--- .../reset/amd,pensando-elbasr-reset.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yamlDocumentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +39
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/amd,pensando-elbasr-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Reset Controller Device Tree Bindings + +maintainers: + - Brad Larson <[email protected]> + +description: | + AMD Pensando Elba SoC reset controller driver which supports a resource + controller connected to the Elba SoC over a SPI bus. The Elba reset + controller must be defined as a child node of the Elba SPI bus + chip-select 0 node. + + See also: + - dt-bindings/reset/amd,pensando-elba-reset.h + +properties: + $nodename: + pattern: "^reset-controller@[0-9a-f]+$" + + compatible: + const: amd,pensando-elbasr-reset + + reg: + const: 0 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 49
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+ +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + spi0 { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 {
'spi' is reserved for SPI buses. I thought this was an MFD.
Quoted 17 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +13
-0+ reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + + rstc: reset-controller@0 { + compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + }; + +...Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Brad LarsonQuoted 11 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
Signed-off-by Brad Larson <[email protected]>--- drivers/reset/Kconfig | 9 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-elbasr.c | 94 +++++++++++++++++++ .../reset/amd,pensando-elba-reset.h | 11 +++
This goes with the binding patch
Quoted 42 lines
4 files changed, 115 insertions(+) create mode 100644 drivers/reset/reset-elbasr.c create mode 100644 include/dt-bindings/reset/amd,pensando-elba-reset.hdrivers/reset/Kconfig +9
-0@@ -66,6 +66,15 @@ config RESET_BRCMSTB_RESCAL This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on BCM7216. +config RESET_ELBASR + tristate "Pensando Elba System Resource reset controller" + depends on MFD_PENSANDO_ELBASR || COMPILE_TEST + help + This option enables support for the external reset functions + on the Pensando Elba System Resource Chip. Reset control + of peripherals is accessed over SPI to the system resource + chip device registers using CS0. + config RESET_HSDK bool "Synopsys HSDK Reset Driver" depends on HAS_IOMEMdrivers/reset/Makefile +1
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o +obj-$(CONFIG_RESET_ELBASR) += reset-elbasr.o obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o obj-$(CONFIG_RESET_IMX7) += reset-imx7.o obj-$(CONFIG_RESET_INTEL_GW) += reset-intel-gw.odrivers/reset/reset-elbasr.c new file +0
-0
drivers/reset/reset-elbasr.c line 1
Quoted 1 line
drivers/reset/reset-elbasr.c new file +1
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
Kernel code is GPL-2.0-only generally.
Re: [PATCH v5 10/15] arm64: dts: Add AMD Pensando Elba SoC support
In reply to Brad LarsonQuoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
Add AMD Pensando common and Elba SoC specific device nodes
Signed-off-by Brad Larson <[email protected]>
Thank you for your patch. There is something to discuss/improve.
Quoted 19 lines
--- arch/arm64/boot/dts/amd/Makefile | 1 + arch/arm64/boot/dts/amd/elba-16core.dtsi | 189 +++++++++++++++++ arch/arm64/boot/dts/amd/elba-asic-common.dtsi | 103 ++++++++++ arch/arm64/boot/dts/amd/elba-asic.dts | 28 +++ arch/arm64/boot/dts/amd/elba-flash-parts.dtsi | 106 ++++++++++ arch/arm64/boot/dts/amd/elba.dtsi | 191 ++++++++++++++++++ 6 files changed, 618 insertions(+) create mode 100644 arch/arm64/boot/dts/amd/elba-16core.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic-common.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic.dts create mode 100644 arch/arm64/boot/dts/amd/elba-flash-parts.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba.dtsiarch/arm64/boot/dts/amd/Makefile +0
-0
arch/arm64/boot/dts/amd/Makefile line 3
Quoted 3 lines
arch/arm64/boot/dts/amd/Makefile +1
-0@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_SEATTLE) += amd-overdrive-rev-b0.dtb amd-overdrive-rev-b1.dtb +dtb-$(CONFIG_ARCH_PENSANDO) += elba-asic.dtb
Put it in alphabetical order, so not at the end of file.
(...)
Quoted 6 lines
arch/arm64/boot/dts/amd/Makefile +6
-0+ +&i2c0 { + clock-frequency = <100000>; + status = "okay"; + rtc@51 { + compatible = "nxp,pcf85263";
arch/arm64/boot/dts/amd/Makefile
Quoted 10 lines
arch/arm64/boot/dts/amd/Makefile +10
-0+ reg = <0x51>; + }; +}; + +&spi0 { + num-cs = <4>; + cs-gpios = <0>, <0>, <&porta 1 GPIO_ACTIVE_LOW>, + <&porta 7 GPIO_ACTIVE_LOW>; + status = "okay"; + spi@0 {
Rob's comment about bindings applies here as well, so please fix both. This has to be sorted out - either it is SPI controller or MFD.
Rest looks okay for me.
arch/arm64/boot/dts/amd/Makefile
Quoted 6 lines
arch/arm64/boot/dts/amd/Makefile +6
-0+ compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <12000000>; +
Best regards,
Krzysztof
Re: [PATCH v5 01/15] dt-bindings: arm: add AMD Pensando boards
In reply to Brad LarsonQuoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
Document the compatible for AMD Pensando Elba SoC boards.
Signed-off-by Brad Larson <[email protected]>
Best regards,
Krzysztof
Re: [PATCH v5 02/15] dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
In reply to Brad LarsonQuoted 21 lines · Brad Larson
From: Brad Larson <[email protected]>
AMD Pensando Elba ARM 64-bit SoC is integrated with this IP and explicitly controls byte-lane enables.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/mmc/cdns,sdhci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +3
-0@@ -13,10 +13,24 @@ maintainers: allOf: - $ref: mmc-controller.yaml + - if: + properties: + compatible:
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml maintainers: · line 28
Quoted 10 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +10
-0+ enum: + - amd,pensando-elba-sd4hc + then: + properties: + reg: + items: + - description: Cadence host controller registers + - description: Byte-lane control register + minItems: 2 +
Except Rob's comment, the entire section now should be moved to bottom - just before unevaluated/additionalProperties:false
Best regards,
Krzysztof
Re: [PATCH v5 03/15] dt-bindings: spi: cdns: Add compatible for AMD Pensando Elba SoC
In reply to Brad LarsonQuoted 10 lines · Brad Larson
From: Brad Larson <[email protected]>
Document the cadence qspi controller compatible for AMD Pensando Elba SoC boards. The Elba qspi fifo size is 1024.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/spi/cdns,qspi-nor.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Best regards,
Krzysztof
Re: [PATCH v5 06/15] dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonQuoted 63 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Signed-off-by Brad Larson <[email protected]>--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yamlDocumentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +43
-0@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/amd,pensando-elbasr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Resource Controller bindings + +description: | + AMD Pensando Elba SoC Resource Controller bindings attached to a SPI bus. + +maintainers: + - Brad Larson <[email protected]> + +properties: + compatible: + items: + - enum: + - amd,pensando-elbasr + - const: simple-mfd + + spi-max-frequency: + description: Maximum SPI frequency of the device in Hz. + + reg: + maxItems: 1 + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - spi-max-frequency + +patternProperties: + '^reset-controller@[a-f0-9]+$':
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ $ref: ../reset/amd,pensando-elbasr-reset.yaml + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 {
Just "spi"
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 58
Quoted 5 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +5
-0+ #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 {
"spi" is for SPI controllers. Use generic name matching the device. Usually this is "system-controller", however Rob pointed out your inaccurate bindings and example.
Quoted 25 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +25
-0+ compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <12000000>; + + rstc: reset-controller@0 { + compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + + spi@1 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <1>; + spi-max-frequency = <12000000>; + }; + + spi@2 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <2>; + spi-max-frequency = <12000000>; + interrupt-parent = <&porta>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 93
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ }; + + spi@3 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <3>; + spi-max-frequency = <12000000>; + }; + }; + +...
Best regards,
Krzysztof
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Brad LarsonQuoted 16 lines · Brad Larson
From: Brad Larson <[email protected]>
Document bindings for AMD Pensando Elba SR Reset Controller
Signed-off-by Brad Larson <[email protected]>--- .../reset/amd,pensando-elbasr-reset.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yamlDocumentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +0
-0
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +7
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/amd,pensando-elbasr-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Reset Controller Device Tree Bindings
Here and in all other patches:
s/Device Tree Bindings//
Quoted 6 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +6
-0+ +maintainers: + - Brad Larson <[email protected]> + +description: | + AMD Pensando Elba SoC reset controller driver which supports a resource
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 23
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+ controller connected to the Elba SoC over a SPI bus. The Elba reset + controller must be defined as a child node of the Elba SPI bus + chip-select 0 node. + + See also: + - dt-bindings/reset/amd,pensando-elba-reset.h + +properties: + $nodename: + pattern: "^reset-controller@[0-9a-f]+$"
Skip the pattern. No particular need for it and unit address part is not correct (const: 0).
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+ + compatible: + const: amd,pensando-elbasr-reset + + reg: + const: 0 + + '#reset-cells': + const: 1 +
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h>
Missing file:
ls: cannot access 'include/dt-bindings/reset/amd,pensando-elba-reset.h':
No such file or directory
Send complete bindings, not parts of it. Did you test it? I am pretty sure that this did not happen. :(
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 44
Quoted 1 line
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +1
-0+ spi0 {
spi
Quoted 8 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +8
-0+ #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>;
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 62
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+ + rstc: reset-controller@0 { + compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + }; + +...
Best regards,
Krzysztof
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
In reply to Brad LarsonQuoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spi
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the dtbs_check procedure will fail on your dts evaluation.
-Sergey
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0reg: minItems: 1Signature · 1 line
2.17.1
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spi
Quoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Otherwise this is incomplete binding...
Best regards,
Krzysztof
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
Quoted 32 lines · Krzysztof Kozlowski
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spiQuoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.
Quoted 2 lines
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Ah, the property has been indeed removed. The driver now searches for the system controller by the next compatible string:
"amd,pensando-elba-syscon" using the syscon_regmap_lookup_by_compatible() method. My mistake. Sorry for the noise.
* Though personally I'd prefer to have a property with the phandle reference in order to signify the connection between the system controller and the SPI-controller. Otherwise the implicit DT bindings like having the "amd,pensando-elba-syscon"-compatible syscon gets to be hidden behind the DT scene. But seeing we have already got the Microsemi platform with such semantic, I can't insist on fixing this.
-Sergey
Quoted 5 lines
Otherwise this is incomplete binding...
Best regards,
Krzysztof
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
Quoted 42 lines · Serge Semin
Quoted 32 lines · Krzysztof Kozlowski
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spiQuoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.Quoted 2 lines
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Ah, the property has been indeed removed. The driver now searches for the system controller by the next compatible string:
"amd,pensando-elba-syscon" using thesyscon_regmap_lookup_by_compatible()method. My mistake. Sorry for the noise.
Quoted 6 lines
* Though personally I'd prefer to have a property with the phandle reference in order to signify the connection between the system controller and the SPI-controller. Otherwise the implicit DT bindings like having the "amd,pensando-elba-syscon"-compatible syscon gets to be hidden behind the DT scene. But seeing we have already got the Microsemi platform with such semantic, I can't insist on fixing this.
I agree entirely, this should be explicit syscon-type property. Looking up for compatibles:
- creates hidden (not expressed via bindings) dependency between nodes,
- is not portable and several people struggled with it later and needed
backward-compatible code (many examples, let's just give recent one: [1])
[1]
https://lore.kernel.org/all/[email protected]/
Best regards,
Krzysztof
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
Quoted 58 lines · Krzysztof Kozlowski
Quoted 43 lines · Serge Semin
Quoted 32 lines · Krzysztof Kozlowski
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spiQuoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.Quoted 2 lines
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Ah, the property has been indeed removed. The driver now searches for the system controller by the next compatible string:
"amd,pensando-elba-syscon" using thesyscon_regmap_lookup_by_compatible()method. My mistake. Sorry for the noise.Quoted 6 lines
* Though personally I'd prefer to have a property with the phandle reference in order to signify the connection between the system controller and the SPI-controller. Otherwise the implicit DT bindings like having the "amd,pensando-elba-syscon"-compatible syscon gets to be hidden behind the DT scene. But seeing we have already got the Microsemi platform with such semantic, I can't insist on fixing this.
I agree entirely, this should be explicit syscon-type property. Looking up for compatibles:
- creates hidden (not expressed via bindings) dependency between nodes,
- is not portable and several people struggled with it later and needed
backward-compatible code (many examples, let's just give recent one: [1])
Quoted 2 lines
Seems even more reasonable now. Thanks for providing a bright example justifying the property-based approach.
@Brad, could you get back the property with a phandle to the syscon DT-node? (No need in adding the CS CSR address as the phandle argument, just a phandle.)
-Sergey
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH v5 11/15] spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
In reply to Pratyush YadavHi Pratyush,
Quoted 11 lines · Pratyush Yadav
This is needed for TI's SoCs as well. APB and AHB accesses are independent of each other on the interconnect and can be racy. I wrote a couple patches [0][1] to fix this on TI's fork. I never got around to sending them upstream. It would be great if you can pick those up. They fix the race in all paths, not just indirect write.
I would also prefer if we do this unconditionally. I don't think it has much downside even on platforms that do not strictly need this.
[0] https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/drivers/spi/spi-cadence-quadspi.c?h=ti-linux-5.10.y&id=027f03a8512086e5ef05dc4e4ff53b2628848f95
[1] https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/drivers/spi/spi-cadence-quadspi.c?h=ti-linux-5.10.y&id=4c367e58bab7d3f9c470c3778441f73546f20398
Let's get Elba specific support in first and then in a separate patch go for the unconditional. An extra op for devices for which its not currently done will result in questions I can't answer.
Regards,
Brad
Re: [PATCH v5 11/15] spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
In reply to Mark BrownHi Mark,
Quoted 11 lines · Mark Brown
drivers/spi/spi-cadence-quadspi.c static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata, · line 962
Quoted 6 lines · Brad Larson
drivers/spi/spi-cadence-quadspi.c +6
-0+/* +* If a hazard exists between the APB and AHB interfaces, perform a +* dummy readback from the controller to ensure synchronization. +*/ +if (cqspi->apb_ahb_hazard) + (void )readl (reg_base +CQSPI_REG_INDIRECTWR );You shouldn't need the cast here.
Removed (void) cast
Regards,
Brad
Re: [PATCH v5 12/15] spi: dw: Add support for AMD Pensando Elba SoC
In reply to Andy ShevchenkoHi Andy,
Quoted 22 lines · Andy Shevchenko
On Mon, Jun 13, 2022 at 9:57 PM Brad Larson <[email protected]> wrote:
...drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 69
Quoted 10 lines
drivers/spi/spi-dw-mmio.c +9
-0+/* +* Elba SoC does not use ssi, pin override is used for cs 0,1 and +* gpios for cs 2,3 as defined in the device tree. +* +* cs: | 1 0 +* bit: |---3-------2-------1-------0 +* | cs1 cs1_ovr cs0 cs0_ovr +*/ +#define ELBA_SPICS_SHIFT (cs) (2 * (cs))Useless.It takes much more than simply multiplying each time in two macros. Also see below.
Quoted 1 line
+#define
ELBA_SPICS_MASK(cs)(0x3<<ELBA_SPICS_SHIFT(cs))(
GENMASK(1, 0)<< ((cs) << 1))
Quoted 8 lines
Or ((cs) * 2) to show that it takes 2 bits and not two times of CS',
drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 72
Quoted 2 lines
drivers/spi/spi-dw-mmio.c +2
-0+#define ELBA_SPICS_SET (cs, val) \ + ((((val) << 1) | 0x1) << ELBA_SPICS_SHIFT(cs))BIT(0)
So the main point is to use
GENMASK()andBIT()the rest is up to you.
I think you're recommending this approach which I'll change to
static void dw_spi_elba_override_cs(struct dw_spi_elba *dwselba, int cs, int enable)
{
regmap_update_bits(dwselba->syscon, ELBA_SPICS_REG,
(GENMASK(1, 0) << ((cs) << 1)),
((enable) << 1 | BIT(0)) << ((cs) << 1));
}Regards,
Brad
Re: [PATCH v5 13/15] mmc: sdhci-cadence: Add AMD Pensando Elba SoC support
In reply to Andy ShevchenkoHi Andy,
Quoted 7 lines · Andy Shevchenko
Quoted 2 lines · Brad Larson
Add support for AMD Pensando Elba SoC which explicitly controls byte-lane enables on writes. Add
priv_write_l()which isenabling ?
Changed to enabling
Quoted 5 lines
...
Quoted 1 line
+ void (*priv_write_l)(struct
sdhci_cdns_priv*priv, u32 val,
priv_writel
Changed to priv_writel
Quoted 6 lines
Quoted 2 lines
+ void
__iomem*reg);And perhaps leave it on one line.
I also would swap parameters, so address goes first followed by value.
Which is the reverse of writel() parameter ordering which is value, address. Should I do this?
Quoted 14 lines
...
drivers/mmc/host/sdhci-cadence.c static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { · line 107
Quoted 5 lines
drivers/mmc/host/sdhci-cadence.c +4
-0+static inline void sdhci_cdns_priv_writel (struct sdhci_cdns_priv *priv, +u32 val,void __iomem *reg) +{ +if (unlikely (priv->priv_write_l))First of all, why if (unlikely())-else instead of if (likely())-else?
Quoted 4 lines
drivers/mmc/host/sdhci-cadence.c +4
-0+ priv->priv_write_l (priv, val, reg); + else +writel (val ,reg ); +}
It was existing code and never looked at it. This construct looks to be widely used however this goes away with the two patch approach below.
$ find . -name \*.c | xargs grep if | grep unlikely | wc 18640
Quoted 7 lines
Instead of branching each time you do I/O, make sure that callback is always set and call it unconditionally. In this case you don't need to have this callback, but maybe just a wrapper on
writel(). As a result you may split this to two patches in the first of which you simply introduce a callback and awritel()wrapper which is assigned unconditionally to all current chips. In the next you add a new chip support.
Next version will separate into two patches as described
Quoted 10 lines
...
drivers/mmc/host/sdhci-cadence.c static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, · line 362
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+u32 m = (reg &0x3 ); +u32 msk = (0x3 << (m)); + +spin_lock_irqsave (&priv->wrlock, flags); +writel (msk <<3 , priv->ctl_addr); +writew (val, host->ioaddr + reg); +spin_unlock_irqrestore (&priv->wrlock, flags);
Quoted 2 lines
Too many 3:s as magic. Is it
GENMASK()or something else? Perhaps it needs a definition.
Definitely, changed this to be understandable by inspection. GENMASK() for word and BIT() for byte makes this more clear. The 3's came from bits [6:3] are the byte-lane enables in the control reg where the lower two bits of the address specify the byte(s) to enable.
/* Elba control reg bits [6:3] are byte-lane enables */
#define ELBA_BYTE_ENABLE_MASK(x) ((x) << 3)
elba_priv_write_l(...):
writel(ELBA_BYTE_ENABLE_MASK(0xf), priv->ctl_addr);
writel(val, reg);elba_write_w(...):
byte_enables = GENMASK(1, 0) << (reg & 0x3);
writel(ELBA_BYTE_ENABLE_MASK(byte_enables), priv->ctl_addr);
writew(val, host->ioaddr + reg);Quoted 11 lines
...
drivers/mmc/host/sdhci-cadence.c static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, · line 375
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+u32 m = (reg &0x3 ); +u32 msk = (0x1 << (m)); + +spin_lock_irqsave (&priv->wrlock, flags); +writel (msk <<3 , priv->ctl_addr); +writeb (val, host->ioaddr + reg); +spin_unlock_irqrestore (&priv->wrlock, flags);Ditto.
elba_write_b(...):
byte_enables = BIT(0) << (reg & 0x3);
writel(ELBA_BYTE_ENABLE_MASK(byte_enables), priv->ctl_addr);
writeb(val, host->ioaddr + reg);Quoted 5 lines
...
Quoted 1 line
+
writel(0x78, priv->ctl_addr);Magic.
writel(ELBA_BYTE_ENABLE_MASK(0xf), priv->ctl_addr);
Quoted 11 lines
...
drivers/mmc/host/sdhci-cadence.c static const struct sdhci_ops sdhci_cdns_ops = { · line 444
Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +7
-0+static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = { + .pltfm_data = { + .ops = &sdhci_cdns_ops, + }, +}; + +One blank line is enough.
Removed extra blank line
Quoted 7 lines
...
drivers/mmc/host/sdhci-cadence.c static const struct dev_pm_ops sdhci_cdns_pm_ops = { · line 607
Quoted 3 lines
drivers/mmc/host/sdhci-cadence.c +3
-0+ { + .compatible = "amd,pensando-elba-sd4hc", + .data = &sdhci_elba_drv_dataLeave a comma here.
Added comma
Regards,
Brad
Re: [PATCH v5 14/15] mfd: pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Andy ShevchenkoHi Andy,
Quoted 19 lines · Andy Shevchenko
On Mon, Jun 13, 2022 at 9:57 PM Brad Larson <[email protected]> wrote:
...Quoted 15 lines
drivers/mfd/pensando-elbasr.c new file +15
-0+#include <linux/mfd/pensando-elbasr.h> +#include <linux/mfd/core.h> +#include <linux/init.h> +#include <linux/module.h> +#include <linux/ioctl.h> +#include <linux/fs.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/list.h> +#include <linux/errno.h> +#include <linux/mutex.h> +#include <linux/slab.h> +#include <linux/compat.h> +#include <linux/of.h> +#include <linux/of_device.h>
Quoted 8 lines
drivers/mfd/pensando-elbasr.c line 34
Quoted 4 lines
drivers/mfd/pensando-elbasr.c new file +4
-0+#include <linux/regmap.h> +#include <linux/spi/spi.h> +#include <linux/spi/spidev.h> +#include <linux/delay.h> Keep it sorted?
It would easily tell thattypes.his missed, but maybe other headers are superfluous.
Sorted and added types.h
Quoted 8 lines
...
Quoted 5 lines
+/* The main reason to have this class is to make mdev/udev create the
+ */dev/pensrB.Ccharacter device nodes exposing our userspace API.
+ * It also simplifies memory management. The device nodes
+ */dev/pensrB.Care common across Pensando boards.
+ */
Quoted 5 lines
/*
* The above style of multi-line
* comments is for networking,
* the rest uses a slightly different one.
*/
Changed to non-networking multi-line comments, code reuse from driver/spi/spidev.c there since ~2007.
Quoted 9 lines
...
drivers/mfd/pensando-elbasr.c line 52
Quoted 5 lines
drivers/mfd/pensando-elbasr.c new file +5
-0+static DECLARE_BITMAP(minors, ELBASR_MAX_DEVS); +static unsigned int bufsiz =4096 ; + +static LIST_HEAD (device_list); +static DEFINE_MUTEX (device_list_lock);Is it all to reinvent IDA?
I don't know what IDA is, searching linux IDA yields debugger and some image viewer.
The whole purpose of adding this driver was to not use spidev.c to provide Elba specific
access to 4 functions in the fpga and also an emmc reset driver. The reuse of code fromspidev.c was to avoid breaking production deployments while adding emmc hardware reset support as a priority. I'll strip out any code not used for Elba deployments for next
version.
Quoted 12 lines
...
Quoted 9 lines
drivers/mfd/pensando-elbasr.c new file +9
-0+static ssize_t +elbasr_spi_sync (struct elbasr_data *elbasr_spi,struct spi_message *message) +{ +int status; +struct spi_device *spi; + +spin_lock_irq (&elbasr_spi->spi_lock); + spi = elbasr_spi->spi; +spin_unlock_irq (&elbasr_spi->spi_lock);
Quoted 3 lines
Quoted 1 line
+
Drop this blank line and see below.
Removed
Quoted 19 lines
drivers/mfd/pensando-elbasr.c line 88
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+if (spi ==NULL ) + status = -ESHUTDOWN ;if (!spi)
return ...drivers/mfd/pensando-elbasr.c line 95
Quoted 8 lines
drivers/mfd/pensando-elbasr.c new file +7
-0+else + status =spi_sync (spi, message); + +if (status ==0 ) + status = message->actual_length; + +return status;status =
spi_sync(...);
if (status)
return status;
Quoted 1 line
return
message->actual_length;
Refactored to:
if (!spi)
return -ESHUTDOWN;
status = spi_sync(spi, message);
if (status)
return status;
return message->actual_length;Quoted 6 lines
...
drivers/mfd/pensando-elbasr.c line 564
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+if (status) { +pr_debug ("elbasr_spi: nothing for minor %d\n" ,iminor (inode));We have a device pointer, don't we?
Removed
Quoted 14 lines
...
drivers/mfd/pensando-elbasr.c line 646
Quoted 10 lines
drivers/mfd/pensando-elbasr.c new file +10
-0+static const struct file_operations elbasr_spi_fops = { + .owner =THIS_MODULE , + .write = elbasr_spi_write, + .read = elbasr_spi_read, + .unlocked_ioctl = elbasr_spi_ioctl, + .compat_ioctl = elbasr_spi_compat_ioctl, + .open = elbasr_spi_open, + .release = elbasr_spi_release, + .llseek = no_llseek, +};
Quoted 6 lines
As far as I can see the code looks like a proxy for SPI via SPI. Is that the correct interpretation? If so, why this code repeating _a
lot_from SPI framework, including character device IOCTL? This is a big question here and since there is missed documentation for ABI and no points to userspace tools which are going to use this ABI (red flag!) the code is no go.
The patch v5-0006-dt-bindings-mfd-amd-pensando-elbasr-Add-AMD-Pensa.patch has the documentation where below is the commit message. This is a required companion device to the Elba SoC (on spi0) which is a FPGA with four functions.
One function that isn't filled out (driver not included in base SoC support) is accessed
at /dev/pensr0.2 which is a Lattice dual I2C master for the transceiver management.
There are customer utilities and programs that open /dev/pensr0.x in operation.
dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System
Resource chip
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Quoted 7 lines
...
drivers/mfd/pensando-elbasr.c line 649
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+static bool +elbasr_reg_readable (struct device *dev,unsigned int reg)It's pretty much one line, can you reduce the number of LoCs by reindenting your code a bit?
Moved to one line, here and others
Quoted 7 lines
...
Review
Quoted 2 lines
(quoted diff) +2
-0+static bool +elbasr_reg_writeable(struct device *dev, unsigned int reg)Ditto and so on.
Quoted 5 lines
...
Quoted 1 line
+ struct
spi_transfert[2] = { { 0 } };Isn't
{ }enough?
Yes, changed
Quoted 7 lines
...
drivers/mfd/pensando-elbasr.c line 683
Quoted 2 lines
drivers/mfd/pensando-elbasr.c new file +2
-0+spi_message_add_tail (&t[0 ], &m); +spi_message_add_tail (&t[1 ], &m);
spi_message_init_with_transfers()?
Here and elsewhere.
Changed to use of spi_message_init_with_transfers()
Quoted 5 lines
...
Quoted 1 line
+ struct
spi_transfert[1] = { { 0 } };Why does
struct spi_transfer t = { };not work?!
It does, changed
Quoted 12 lines
...
drivers/mfd/pensando-elbasr.c line 724
Quoted 9 lines
drivers/mfd/pensando-elbasr.c new file +9
-0+static const struct regmap_config pensando_elbasr_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .cache_type =REGCACHE_NONE , + .readable_reg = elbasr_reg_readable, + .writeable_reg = elbasr_reg_writeable, + .reg_read = elbasr_regs_read, + .reg_write = elbasr_regs_write, + .max_register =ELBASR_MAX_REG
Quoted 1 line
Leave a comma here.
Added a comma after ELBASR_MAX_REG
Quoted 4 lines
Quoted 1 line
+};
...
Quoted 8 lines
drivers/mfd/pensando-elbasr.c line 742
Quoted 6 lines
drivers/mfd/pensando-elbasr.c new file +6
-0+ elbasr->elbasr_regs =devm_regmap_init (&spi->dev,NULL , spi, + &pensando_elbasr_regmap_config); +if (IS_ERR (elbasr->elbasr_regs)) { + ret =PTR_ERR (elbasr->elbasr_regs); +dev_err (&spi->dev,"Failed to allocate register map: %d\n" , ret); +return ret;return
dev_err_probe(...);
Changed to dev_err_probe(...)
Quoted 4 lines
Quoted 4 lines
drivers/mfd/pensando-elbasr.c new file +4
-0+ } + + ret = devm_mfd_add_devices(&spi->dev, PLATFORM_DEVID_NONE, + pensando_elbasr_subdev_info,
Quoted 8 lines
drivers/mfd/pensando-elbasr.c line 752
Quoted 6 lines
drivers/mfd/pensando-elbasr.c new file +6
-0+ARRAY_SIZE (pensando_elbasr_subdev_info), + NULL, 0, NULL); +if (ret) +dev_err (&spi->dev,"Failed to register sub-devices: %d\n" , ret); + +return ret;Ditto.
Changed to dev_err_probe(...)
Quoted 9 lines
...
drivers/mfd/pensando-elbasr.c line 834
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +3
-0+/* Add Elba reset driver sub-device */ +if (spi->chip_select ==0 ) +elbasr_regs_setup (spi, elbasr);You have an awful mixture of
devm_vs. non-devm_ calls. Either move fromdevm_completely, or switch todevm_in the rest of the ->probe() code.
Moved away from devm_
Quoted 7 lines
...
drivers/mfd/pensando-elbasr.c line 852
Quoted 3 lines
drivers/mfd/pensando-elbasr.c new file +3
-0+static const struct of_device_id elbasr_spi_of_match[] = { + { .compatible ="amd,pensando-elbasr" }, + {/* sentinel */ },Comma is not needed in terminator entry.
Removed comma
Quoted 11 lines
...
drivers/mfd/pensando-elbasr.c line 859
Quoted 6 lines
drivers/mfd/pensando-elbasr.c new file +5
-0+static struct spi_driver elbasr_spi_driver = { + .probe = elbasr_spi_probe, + .driver = { + .name ="elbasr" , + .of_match_table =of_match_ptr (elbasr_spi_of_match),
of_match_ptr()is useless here (look at yourKconfig) and in some cases is harmful. No need to use this.
Removed use of of_match_ptr()
Quoted 11 lines
Quoted 2 lines
(quoted diff) +2
-0+ }, +};...
include/linux/mfd/pensando-elbasr.h line 12
Quoted 2 lines
include/linux/mfd/pensando-elbasr.h new file +2
-0+#include <linux/cdev.h> +#include <linux/regmap.h>
mutex.handtypes.hare missed, for example.
You need to use headers for direct use of. And in some cases forward declarations can be used instead of including a header.
Added missed mutex.h and types.h
Regards,
Brad
Re: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Philipp ZabelHi Philipp,
Quoted 13 lines · Philipp Zabel
Hi Brad,
Quoted 6 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
Signed-off-by Brad Larson <[email protected]>[...]
Quoted 1 line
drivers/reset/reset-elbasr.c +0
-0...
Quoted 13 lines
drivers/reset/reset-elbasr.c line 28
Quoted 4 lines
drivers/reset/reset-elbasr.c +4
-0+static inline int elbasr_reset_shift (unsigned long id) +{ +switch (id) { +case EMMC_HW_RESET :Are there more reset controls than
EMMC_HW_RESET?
If so, please list them all.
If not, why is this a function with a switch statement for a single reset bit?Quoted 3 lines
drivers/reset/reset-elbasr.c +3
-0+return 6 ; +default : +return -EINVAL ;
There are others but only emmc hardware reset is currently needed/used. Removed the switch and just using BIT(6) and removed file amd,pensando-elba-reset.h.
Quoted 10 lines
The error return value is never checked.
This can't be reached, sinceELBASR_NR_RESETS== 1. So id will only ever be 0.drivers/reset/reset-elbasr.c line 60
Quoted 3 lines
drivers/reset/reset-elbasr.c +3
-0+static int elbasr_reset_probe (struct platform_device *pdev) +{ +struct elbasr_data *elbasr =dev_get_drvdata (pdev->dev.parent);Peeking into the MFD driver's private data structure seems unnecessary. Consider using
dev_get_regmap()instead.
Prefer to keep it this way as it follows the approach of existing driver reset-a10sr.c
Regards,
Brad
Re: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Andy ShevchenkoHi Andy,
Quoted 16 lines · Andy Shevchenko
Quoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
...
Quoted 5 lines
drivers/reset/reset-elbasr.c new file +5
-0+#include <linux/mfd/pensando-elbasr.h> +#include <linux/platform_device.h> +#include <linux/reset-controller.h> +#include <linux/regmap.h> +#include <linux/err.h>
Quoted 6 lines
Quoted 1 line
+#include <
linux/of.h>There is no user of this header. But there are missed ones, such as
mod_devicetable.h.Keep them ordered to easily find such issues.
Removed of.h and added mod_devicetable.h.
Quoted 8 lines
...
drivers/reset/reset-elbasr.c line 79
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+ ret =devm_reset_controller_register (&pdev->dev, &elbar->rcdev); + +return ret;It is simply
return devm_...(...);. Looking through your patches I can tell that you may easily drop LoCs by 10%. Please do so in the next version.
Changed to return devm...(...)
Quoted 7 lines
...
drivers/reset/reset-elbasr.c line 84
Quoted 3 lines
drivers/reset/reset-elbasr.c new file +3
-0+static const struct of_device_id elba_reset_dt_match[] = { + { .compatible ="amd,pensando-elbasr-reset" , }, + {/* sentinel */ },No comma.
Removed comma
Regards,
Brad
Re: [PATCH v5 02/15] dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
In reply to Rob HerringHi Rob,
Quoted 37 lines · Rob Herring
Quoted 20 lines · Brad Larson
From: Brad Larson <[email protected]>
AMD Pensando Elba ARM 64-bit SoC is integrated with this IP and explicitly controls byte-lane enables.
Signed-off-by Brad Larson <[email protected]>--- .../devicetree/bindings/mmc/cdns,sdhci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +2
-0@@ -13,10 +13,24 @@ maintainers: allOf: - $ref: mmc-controller.yaml + - if: + properties:Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml maintainers: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +10
-0+ compatible: + enum: + - amd,pensando-elba-sd4hc + then: + properties: + reg: + items: + - description: Cadence host controller registers + - description: Byte-lane control register + minItems: 2This doesn't work. The if/then is additional constraints on the main section which says there is only 1 register region. The main section needs the above, but with 'minItems: 1'. Then the if/then should be:
Quoted 13 lines
if:
properties:
compatible:
const: amd,pensando-elba-sd4hc
then:
properties:
reg:
minItems: 2
else:
properties:
reg:
maxItems: 1
...
The proposed change to current version throws dtbs_check error below:
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +14 -14
@@ -13,19 +13,6 @@ maintainers: allOf: - $ref: mmc-controller.yaml - - if: - properties: - compatible: - enum: - - amd,pensando-elba-sd4hc - then: - properties: - reg: - items: - - description: Cadence host controller registers - - description: Byte-lane control register - minItems: 2 - properties: compatible: items:
@@ -36,7 +23,7 @@ properties: - const: cdns,sd4hc reg: - maxItems: 1 + minItems: 1 interrupts: maxItems: 1
@@ -132,6 +119,19 @@ required: - interrupts - clocks +if: + properties: + compatible: + const: amd,pensando-elba-sd4hc +then: + properties: + reg: + minItems: 2 +else: + properties: + reg: + maxItems: 1 + unevaluatedProperties: false
results in
$ make ARCH=arm64 dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml
LINT Documentation/devicetree/bindings
CHKDT Documentation/devicetree/bindings/processed-schema.json
SCHEMA Documentation/devicetree/bindings/processed-schema.json
/home/brad/linux-next/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml:
ignoring, error in schema:
/home/brad/linux-next/Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml:
ignoring, error in schema:
DTC arch/arm64/boot/dts/amd/elba-asic.dtb
CHECK arch/arm64/boot/dts/amd/elba-asic.dtb
/home/brad/linux-next/arch/arm64/boot/dts/amd/elba-asic.dtb:
mmc@30440000: reg: [[0, 809762816, 0, 65536], [0, 810025028, 0, 4]] is
too long
From schema:
/home/brad/linux-next/Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml
/home/brad/linux-next/arch/arm64/boot/dts/amd/elba-asic.dtb:
mmc@30440000: reg: [[0, 809762816, 0, 65536], [0, 810025028, 0, 4]] is
too long
From schema:
/home/brad/linux-next/Documentation/devicetree/bindings/mmc/cdns,sdhci.yamlBelow modification to proposed change passes dtbs_check:
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +11 -14
@@ -13,19 +13,6 @@ maintainers: allOf: - $ref: mmc-controller.yaml - - if: - properties: - compatible: - enum: - - amd,pensando-elba-sd4hc - then: - properties: - reg: - items: - - description: Cadence host controller registers - - description: Byte-lane control register - minItems: 2 - properties: compatible: items:
@@ -36,7 +23,8 @@ properties: - const: cdns,sd4hc reg: - maxItems: 1 + minItems: 1 + maxItems: 2 interrupts: maxItems: 1
@@ -132,6 +120,15 @@ required: - interrupts - clocks +if: + properties: + compatible: + const: amd,pensando-elba-sd4hc +then: + properties: + reg: + minItems: 2 + unevaluatedProperties: false
Regards,
Brad
Re: [PATCH v5 02/15] dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC binding
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 9 lines · Krzysztof Kozlowski
On 13/06/2022 21:56, Brad Larson wrote:
...Quoted 6 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +0
-0@@ -13,10 +13,24 @@ maintainers: allOf: - $ref: mmc-controller.yaml
Quoted 16 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml maintainers: · line 28
Quoted 13 lines
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +13
-0+ - if: + properties: + compatible: + enum: + - amd,pensando-elba-sd4hc + then: + properties: + reg: + items: + - description: Cadence host controller registers + - description: Byte-lane control register + minItems: 2 +Except Rob's comment, the entire section now should be moved to bottom - just before unevaluated/additionalProperties:false
Yes, moved it to just before unevaluatedProperties
Regards,
Brad
Re: [PATCH v5 10/15] arm64: dts: Add AMD Pensando Elba SoC support
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 24 lines · Krzysztof Kozlowski
Quoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
Add AMD Pensando common and Elba SoC specific device nodes
Signed-off-by Brad Larson <[email protected]>Thank you for your patch. There is something to discuss/improve.
Quoted 14 lines
--- arch/arm64/boot/dts/amd/Makefile | 1 + arch/arm64/boot/dts/amd/elba-16core.dtsi | 189 +++++++++++++++++ arch/arm64/boot/dts/amd/elba-asic-common.dtsi | 103 ++++++++++ arch/arm64/boot/dts/amd/elba-asic.dts | 28 +++ arch/arm64/boot/dts/amd/elba-flash-parts.dtsi | 106 ++++++++++ arch/arm64/boot/dts/amd/elba.dtsi | 191 ++++++++++++++++++ 6 files changed, 618 insertions(+) create mode 100644 arch/arm64/boot/dts/amd/elba-16core.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic-common.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba-asic.dts create mode 100644 arch/arm64/boot/dts/amd/elba-flash-parts.dtsi create mode 100644 arch/arm64/boot/dts/amd/elba.dtsi
Quoted 10 lines
arch/arm64/boot/dts/amd/Makefile line 3
Quoted 8 lines
arch/arm64/boot/dts/amd/Makefile +1
-0@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 dtb-$(CONFIG_ARCH_SEATTLE) += amd-overdrive-rev-b0.dtb amd-overdrive-rev-b1.dtb +dtb-$(CONFIG_ARCH_PENSANDO) += elba-asic.dtbPut it in alphabetical order, so not at the end of file.
Reversed the order in the Makefile
Quoted 10 lines
(...)
arch/arm64/boot/dts/amd/Makefile
Quoted 7 lines
arch/arm64/boot/dts/amd/Makefile +7
-0+ +&spi0 { + num-cs = <4>; + cs-gpios = <0>, <0>, <&porta 1 GPIO_ACTIVE_LOW>, + <&porta 7 GPIO_ACTIVE_LOW>; + status = "okay"; + spi@0 {
Quoted 4 lines
Rob's comment about bindings applies here as well, so please fix both. This has to be sorted out - either it is SPI controller or MFD.
Rest looks okay for me.
Proposed a change after reviewing existing drivers in mfd directory
Regards,
Brad
Re: [PATCH v5 15/15] reset: elbasr: Add AMD Pensando Elba SR Reset Controller
In reply to Rob HerringHi Rob,
Quoted 7 lines · Rob Herring
Quoted 5 lines · Brad Larson
From: Brad Larson <[email protected]>
This patch adds the reset controller functionality for the AMD Pensando Elba System Resource Chip.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Brad Larson <[email protected]>--- drivers/reset/Kconfig | 9 ++ drivers/reset/Makefile | 1 + drivers/reset/reset-elbasr.c | 94 +++++++++++++++++++ .../reset/amd,pensando-elba-reset.h | 11 +++This goes with the binding patch
I must have misinterpreted an earlier request to put the bindings separately up front in the patch set. For a new driver the binding and driver should be in one patch which I'll change for the next version.
Quoted 7 lines
...
drivers/reset/reset-elbasr.c line 1
Quoted 4 lines
drivers/reset/reset-elbasr.c new file +1
-0@@ -0,0 +1,94 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) Kernel code is GPL-2.0-only generally.
Did something change versus earlier request for dual license?
Quoted 6 lines
Re: [PATCH v3 11/11] arm64: dts: Add Pensando Elba SoC support
- by Rob Herring @ 2021-10-27 21:37 UTC [8%]drivers/reset/reset-elbasr.c line 2
Quoted 1 line
drivers/reset/reset-elbasr.c new file +1
-0+// SPDX-License-Identifier: GPL-2.0 Do you care about using with non-GPL OS? Dual license is preferred.
Regards,
Brad
Re: [PATCH v5 06/15] dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Rob HerringHi Rob,
Quoted 30 lines · Rob Herring
Quoted 27 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Signed-off-by Brad Larson <[email protected]>--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yamlDocumentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +7
-0@@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/amd,pensando-elbasr.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Resource Controller bindings...
Quoted 5 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 44
Quoted 3 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +3
-0+patternProperties: + '^reset-controller@[a-f0-9]+$': + $ref: ../reset/amd,pensando-elbasr-reset.yaml/schemas/reset/...
Changed it to
$ref: /schemas/reset/amd,pensando-elbasr-reset.yaml
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +15
-0+ +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 { + compatible = "amd,pensando-elbasr", "simple-mfd";
Quoted 8 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 65
Quoted 6 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +6
-0+ reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + spi-max-frequency = <12000000>; + + rstc: reset-controller@0 {Only one child does not make a MFD...
Looking over the approaches for other SoCs with an external required controller (cpld, fpga) this appeared to be an acceptable choice. This device is accessed by several different utilities/programs via /dev/pensr0.x, CS0 registers for a variety of control/status, CS1 designware i2c master/slave, CS2 lattice dual i2c masters, and CS3 for flash.
Quoted 11 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 75
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +10
-0+ compatible = "amd,pensando-elbasr-reset"; + reg = <0>; + #reset-cells = <1>; + }; + }; + + spi@1 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <1>; + spi-max-frequency = <12000000>;
Quoted 2 lines
'simple-mfd' implies there are child nodes, but you have none. Is this complete?
This function is a designware i2c master/slave for board peripheral access. Removed simple-mfd.
Quoted 10 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 83
Quoted 8 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +8
-0+ }; + + spi@2 { + compatible = "amd,pensando-elbasr", "simple-mfd"; + reg = <2>; + spi-max-frequency = <12000000>; + interrupt-parent = <&porta>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;This one has interrupt but the others don't?
Yes, this function is a Lattice dual I2C master for transceiver management. The spi to i2c driver is not included in this patch set for essential Elba SoC support. Removed simple-mfd.
Regards,
Brad
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Rob HerringHi Rob,
Quoted 61 lines · Rob Herring
Quoted 59 lines · Brad Larson
From: Brad Larson <[email protected]>
Document bindings for AMD Pensando Elba SR Reset Controller
Signed-off-by Brad Larson <[email protected]>--- .../reset/amd,pensando-elbasr-reset.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yamlDocumentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +43
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/amd,pensando-elbasr-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Reset Controller Device Tree Bindings + +maintainers: + - Brad Larson <[email protected]> + +description: | + AMD Pensando Elba SoC reset controller driver which supports a resource + controller connected to the Elba SoC over a SPI bus. The Elba reset + controller must be defined as a child node of the Elba SPI bus + chip-select 0 node. + + See also: + - dt-bindings/reset/amd,pensando-elba-reset.h + +properties: + $nodename: + pattern: "^reset-controller@[0-9a-f]+$" + + compatible: + const: amd,pensando-elbasr-reset + + reg: + const: 0 + + '#reset-cells': + const: 1 + +required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h>
Quoted 8 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 49
Quoted 6 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +6
-0+ spi0 { + #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 {'spi' is reserved for SPI buses. I thought this was an MFD.
Looking at other drivers/mfd files the naming convention could allow the following, how about this?
spi@0 {
sr_regs@0 {
rstc: reset-controller@0 {
dw_i2c@1 {
lattice_i2c@2 {
flash@3 {Regards,
Brad
Re: [PATCH v5 06/15] dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 16 lines · Krzysztof Kozlowski
Quoted 13 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Signed-off-by Brad Larson <[email protected]>--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml...
Quoted 9 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 53
Quoted 7 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +7
-0+ +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 {Just "spi"
Changed to spi
Quoted 9 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 58
Quoted 5 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +5
-0+ #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 {"spi" is for SPI controllers. Use generic name matching the device. Usually this is "system-controller", however Rob pointed out your inaccurate bindings and example.
Proposed the below change node in the reply to Rob. The model I followed for this was the Altera mfd/altera-a10sr.c
spi@0 {
sr_regs@0 {
rstc: reset-controller@0 {
dw_i2c@1 {
lattice_i2c@2 {
flash@3 {Regards,
Brad
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 12 lines · Krzysztof Kozlowski
Quoted 10 lines · Brad Larson
From: Brad Larson <[email protected]>
Document bindings for AMD Pensando Elba SR Reset Controller
Signed-off-by Brad Larson <[email protected]>--- .../reset/amd,pensando-elbasr-reset.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
Quoted 16 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 7
Quoted 13 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +7
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/reset/amd,pensando-elbasr-reset.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMD Pensando Elba SoC Reset Controller Device Tree BindingsHere and in all other patches:
s/Device Tree Bindings//
Removed, must be implicit now, currently 366 files use it
$ find . -name \*.yaml|xargs grep title|grep 'Device Tree Bindings'|wc
366Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +11
-0+ +maintainers: + - Brad Larson <[email protected]> + +description: | + AMD Pensando Elba SoC reset controller driver which supports a resource + controller connected to the Elba SoC over a SPI bus. The Elba reset + controller must be defined as a child node of the Elba SPI bus + chip-select 0 node. + + See also:
Quoted 8 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 23
Quoted 5 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +5
-0+ - dt-bindings/reset/amd,pensando-elba-reset.h + +properties: + $nodename: + pattern: "^reset-controller@[0-9a-f]+$"Skip the pattern. No particular need for it and unit address part is not correct (const: 0).
Deleted these lines
$nodename:
pattern: "^reset-controller@[0-9a-f]+$"
Quoted 27 lines
Quoted 11 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+ + compatible: + const: amd,pensando-elbasr-reset + + reg: + const: 0 + + '#reset-cells': + const: 1 +Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +10
-0+required: + - compatible + - reg + - '#reset-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h>Missing file:
ls: cannot access 'include/dt-bindings/reset/amd,pensando-elba-reset.h':
No such file or directory
Quoted 2 lines
Send complete bindings, not parts of it. Did you test it? I am pretty sure that this did not happen. :(
Its in patch v5-0015 with the driver. I'll check this, the correct approach should be put all binding changes as individual patches up front or there are exceptions for new driver.
$ cat v5-0015-reset-elbasr-Add-AMD-Pensando-Elba-SR-Reset-Contr.patch | grep diff
drivers/reset/Kconfig +0 -0
drivers/reset/Makefile +0 -0
drivers/reset/reset-elbasr.c +0 -0
(quoted diff) +0 -0
b/include/dt-bindings/reset/amd,pensando-elba-reset.h
Yes, tested it with the following and no warnings or errors
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/amd,pensando.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yaml
make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/vendor-prefixes.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml make ARCH=arm64 dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/amd,pensando.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yaml
make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/vendor-prefixes.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml make DT_CHECKER_FLAGS=-m dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
Quoted 3 lines
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml line 44
Quoted 1 line
Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml new file +1
-0+ spi0 {spi
Changed to spi
Regards,
Brad
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
In reply to Serge SeminHi Sergey,
Quoted 63 lines · Serge Semin
Quoted 58 lines · Krzysztof Kozlowski
Quoted 43 lines · Serge Semin
Quoted 32 lines · Krzysztof Kozlowski
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spiQuoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.Quoted 2 lines
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Ah, the property has been indeed removed. The driver now searches for the system controller by the next compatible string:
"amd,pensando-elba-syscon" using thesyscon_regmap_lookup_by_compatible()method. My mistake. Sorry for the noise.Quoted 6 lines
* Though personally I'd prefer to have a property with the phandle reference in order to signify the connection between the system controller and the SPI-controller. Otherwise the implicit DT bindings like having the "amd,pensando-elba-syscon"-compatible syscon gets to be hidden behind the DT scene. But seeing we have already got the Microsemi platform with such semantic, I can't insist on fixing this.
I agree entirely, this should be explicit syscon-type property. Looking up for compatibles:
- creates hidden (not expressed via bindings) dependency between nodes,
- is not portable and several people struggled with it later and needed
backward-compatible code (many examples, let's just give recent one: [1])Quoted 2 lines
Quoted 6 lines
Seems even more reasonable now. Thanks for providing a bright example justifying the property-based approach.
@Brad, could you get back the property with a phandle to the syscon DT-node? (No need in adding the CS CSR address as the phandle argument, just a phandle.)
Replying to the sequence of review inputs. The below change to version 5 brings back the phandle without the earlier argument that complicated the binding (was the motivation for moving in this direction in earlier version). Passes dtbs_check.
drivers/spi/spi-dw-mmio.c +0 -0
@@ -285,12 +285,17 @@ static void dw_spi_elba_set_cs(struct spi_device
*spi, bool enable)
static int dw_spi_elba_init(struct platform_device *pdev,
struct dw_spi_mmio *dwsmmio)
{
+ struct device_node *np = pdev->dev.of_node;
+ struct device_node *node;
struct dw_spi_elba *dwselba;
struct regmap *regmap;- regmap = syscon_regmap_lookup_by_compatible("amd,pensando-elba-syscon");
- if (IS_ERR(regmap))
- return PTR_ERR(regmap);
+ node = of_parse_phandle(np, "pensando,elba-syscon-spics", 0);
+ if (node) {
+ regmap = syscon_node_to_regmap(node);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+ }
(quoted diff) +0 -0
b/arch/arm64/boot/dts/amd/elba.dtsi
index 9739641261c3..ec48be4cfe48 100644
arch/arm64/boot/dts/amd/elba.dtsi +1 -0
@@ -98,6 +98,7 @@ reg = <0x0 0x2800 0x0 0x100>; #address-cells = <1>; #size-cells = <0>; + pensando,elba-syscon-spics = <&syscon>; clocks = <&ahb_clk>; interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; num-cs = <2>;
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +9 -0
@@ -37,6 +37,15 @@ allOf: else: required: - interrupts + - if: + properties: + compatible: + contains: + enum: + - amd,pensando-elba-spi + then: + required: + - pensando,elba-syscon-spics properties: compatible:
Regards,
Brad
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Brad LarsonQuoted 9 lines · Brad Larson
Quoted 7 lines
Missing file:
ls: cannot access 'include/dt-bindings/reset/amd,pensando-elba-reset.h':
No such file or directorySend complete bindings, not parts of it. Did you test it? I am pretty sure that this did not happen. :(
Its in patch v5-0015 with the driver
Header is part of bindings, not driver.
Quoted 30 lines
. I'll check this, the correct
approach should be put all binding changes as individual patches up front or there are exceptions for new driver.$ cat v5-0015-reset-elbasr-Add-AMD-Pensando-Elba-SR-Reset-Contr.patch | grep diffdrivers/reset/Kconfig +0
-0drivers/reset/Makefile +0
-0drivers/reset/reset-elbasr.c +0
-0include/dt-bindings/reset/amd,pensando-elba-reset.h +0
-0Yes, tested it with the following and no warnings or errors
make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/amd,pensando.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yaml
make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/vendor-prefixes.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml make ARCH=arm64dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
Quoted 16 lines
make DT_CHECKER_FLAGS=-m
dt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/amd,pensando.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yaml
make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/vendor-prefixes.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml make DT_CHECKER_FLAGS=-mdt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/reset/amd,pensando-elbasr-reset.yaml
So how this test could pass if there is no header file included in the example here? Are you sure you tested each commit separately (like it will be included in the kernel)?
Best regards,
Krzysztof
Re: [PATCH v5 04/15] dt-bindings: spi: dw: Add AMD Pensando Elba SoC SPI Controller bindings
In reply to Brad LarsonQuoted 85 lines · Brad Larson
Hi Sergey,
Quoted 63 lines · Serge Semin
Quoted 58 lines · Krzysztof Kozlowski
Quoted 43 lines · Serge Semin
Quoted 32 lines · Krzysztof Kozlowski
Quoted 22 lines · Serge Semin
Quoted 14 lines · Brad Larson
From: Brad Larson <[email protected]>
The AMD Pensando Elba SoC has integrated the DW APB SPI Controller
Signed-off-by Brad Larson <[email protected]>--- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml properties: · line 78
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0@@ -73,6 +73,8 @@ properties: - renesas,r9a06g032-spi # RZ/N1D - renesas,r9a06g033-spi # RZ/N1S - const: renesas,rzn1-spi # RZ/N1 + - description: AMD Pensando Elba SoC SPI Controller + const: amd,pensando-elba-spiQuoted 7 lines
Not enough. The driver requires to have a phandle reference to the Pensando System Controller. So the property like "amd,pensando-elba-syscon" is also needed to be added to the DT schema otherwise should the dt-schema tool correctly handle the "unevaluatedProperties: false" setting (Rob says it isn't fully supported at the moment), the
dtbs_checkprocedure will fail on your dts evaluation.Quoted 2 lines
The property was here before, now removed, so I assume it was also removed from the driver and DTS. Isn't that the case?
Ah, the property has been indeed removed. The driver now searches for the system controller by the next compatible string:
"amd,pensando-elba-syscon" using thesyscon_regmap_lookup_by_compatible()method. My mistake. Sorry for the noise.Quoted 6 lines
* Though personally I'd prefer to have a property with the phandle reference in order to signify the connection between the system controller and the SPI-controller. Otherwise the implicit DT bindings like having the "amd,pensando-elba-syscon"-compatible syscon gets to be hidden behind the DT scene. But seeing we have already got the Microsemi platform with such semantic, I can't insist on fixing this.
I agree entirely, this should be explicit syscon-type property. Looking up for compatibles:
- creates hidden (not expressed via bindings) dependency between nodes,
- is not portable and several people struggled with it later and needed
backward-compatible code (many examples, let's just give recent one: [1])Quoted 2 lines
Quoted 6 lines
Seems even more reasonable now. Thanks for providing a bright example justifying the property-based approach.
@Brad, could you get back the property with a phandle to the syscon DT-node? (No need in adding the CS CSR address as the phandle argument, just a phandle.)
Replying to the sequence of review inputs. The below change to version 5 brings back the phandle without the earlier argument that complicated the binding (was the motivation for moving in this direction in earlier version). Passes
dtbs_check.drivers/spi/spi-dw-mmio.c +0
-0@@ -285,12 +285,17 @@ static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)static int dw_spi_elba_init (struct platform_device *pdev,struct dw_spi_mmio *dwsmmio) {
drivers/spi/spi-dw-mmio.c static void dw_spi_elba_set_cs(struct spi_device · line 295
Quoted 10 lines
drivers/spi/spi-dw-mmio.c +3
-3+struct device_node *np = pdev->dev.of_node; +struct device_node *node;struct dw_spi_elba *dwselba;struct regmap *regmap; - regmap =syscon_regmap_lookup_by_compatible ("amd,pensando-elba-syscon" ); -if (IS_ERR (regmap)) -return PTR_ERR (regmap); + node =of_parse_phandle (np,"pensando,elba-syscon-spics" ,0 );
1. Property name must be structured with the permitted vendor-prefix. In your case it's "amd," not "pensando,".
2. Having 'spics' in the property name doesn't make much sense since the property is supposed to contain a phandle reference to the whole syscon node.
So to speak the property with name like 'amd,pensando-elba-syscon' seems more appropriate here.
Quoted 12 lines
drivers/spi/spi-dw-mmio.c +5
-0+if (node) { + regmap =syscon_node_to_regmap (node); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + }arch/arm64/boot/dts/amd/elba.dtsi +0
-0
arch/arm64/boot/dts/amd/elba.dtsi line 102
Quoted 5 lines
arch/arm64/boot/dts/amd/elba.dtsi +1
-0@@ -98,6 +98,7 @@ reg = <0x0 0x2800 0x0 0x100>; #address-cells = <1>; #size-cells = <0>; + pensando,elba-syscon-spics = <&syscon>;
+ amd,pensando-elba-syscon = <&syscon>;
ditto
Quoted 7 lines
arch/arm64/boot/dts/amd/elba.dtsi +0
-0clocks = <&ahb_clk>; interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;num-cs = <2>;
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml allOf: · line 46
Quoted 10 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +7
-0@@ -37,6 +37,15 @@ allOf: else: required: - interrupts + - if: + properties: + compatible: + contains: + enum: + - amd,pensando-elba-spi + then:
+ properties:
+ amd,pensando-elba-syscon
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: AMD Pensando Elba SoC system controller
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml allOf: · line 48
Quoted 2 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +2
-0+ required: + - amd,pensando-elba-syscon
Please make sure the DT-bindings check passes correctly.
-Sergey
Quoted 6 lines
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml +0
-0properties: compatible:Regards,
Brad
Re: [PATCH v5 06/15] dt-bindings: mfd: amd,pensando-elbasr: Add AMD Pensando Elba System Resource chip
In reply to Brad LarsonQuoted 38 lines · Brad Larson
Hi Krzysztof,
Quoted 16 lines · Krzysztof Kozlowski
Quoted 13 lines · Brad Larson
From: Brad Larson <[email protected]>
Add support for the AMD Pensando Elba SoC System Resource chip using the SPI interface. The Elba SR is a Multi-function Device supporting device register access using CS0, smbus interface for FRU and board peripherals using CS1, dual Lattice I2C masters for transceiver management using CS2, and CS3 for flash access.
Signed-off-by Brad Larson <[email protected]>--- .../bindings/mfd/amd,pensando-elbasr.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml...
Quoted 9 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml line 53
Quoted 7 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +7
-0+ +examples: + - | + #include <dt-bindings/reset/amd,pensando-elba-reset.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + + spi0 {Just "spi"
Changed to spi
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/amd,pensando-elbasr.yaml new file +5
-0+ #address-cells = <1>; + #size-cells = <0>; + num-cs = <4>; + + spi@0 {
Quoted 6 lines
Quoted 3 lines
"spi" is for SPI controllers. Use generic name matching the device. Usually this is "system-controller", however Rob pointed out your inaccurate bindings and example.
Proposed the below change node in the reply to Rob. The model I followed for this was the Altera
mfd/altera-a10sr.c
You pointed driver, so how is it related to bindings? Do not mix Linux implementation with the bindings.
Quoted 4 lines
spi@0 {
sr_regs@0 {
rstc: reset-controller@0 {No underscores in node names. sr_regs is not generic name.
Quoted 2 lines
dw_i2c@1 {Again, not a generic name. If it is i2c controller, should be i2c. If it is i2c device/client, should be something generic matching class of the device.
Quoted 4 lines
lattice_i2c@2 {
flash@3 {This looks ok, depending on compatible.
Quoted 3 lines
Regards,
Brad
Best regards,
Krzysztof
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
In reply to Krzysztof KozlowskiHi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Brad Larson
Quoted 5 lines
Missing file:
ls: cannot access 'include/dt-bindings/reset/amd,pensando-elba-reset.h':
No such file or directory
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Send complete bindings, not parts of it. Did you test it? I am pretty sure that this did not happen. :(
Its in patch v5-0015 with the driver
Header is part of bindings, not driver.
That's the reason, the header was not with the bindings.
Quoted 4 lines
...
So how this test could pass if there is no header file included in the example here? Are you sure you tested each commit separately (like it will be included in the kernel)?
and I had applied the patchset before running the checks. I'll check each commit separately for next version.
Regards,
Brad
Re: [PATCH v5 07/15] dt-bindings: reset: amd,pensando-elbasr-reset: Add AMD Pensando SR Reset Controller bindings
Quoted 11 lines · Brad Larson
Hi Krzysztof,
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Brad Larson
Quoted 5 lines
Missing file:
ls: cannot access 'include/dt-bindings/reset/amd,pensando-elba-reset.h':
No such file or directory
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Send complete bindings, not parts of it. Did you test it? I am pretty sure that this did not happen. :(
Its in patch v5-0015 with the driver
Header is part of bindings, not driver.
That's the reason, the header was not with the bindings.
Sorry, I don't understand. The reason header was not with the bindings is that header is part of bindings? That does not make really sense...
Anyway, don't mix up bindings and driver changes in one commit.
Best regards,
Krzysztof