Skip to contentSkip to conversation

Support Pensando Elba SoC

PATCH Superseded Brad Larson 10 participants 48 messages Mar 29, 2021 – Aug 23, 2021

Subsystems (8)
Device tree bindings GPIO SPI arm64 +4 more subsystems

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support Pensando Elba SoC

This series enables support for 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

See below for an overview of changes since v1.

== Patch overview ==

- 01 Fix typo, return code value and log message.
- 03 Remove else clause, intrinsic DW chip-select is never used.
- 08-11 Split out dts and bindings to sub-patches
- 10 Converted existing cadence-quadspi.txt to YAML schema
- 13 New driver should use <linux/gpio/driver.h>

Brad Larson (13):
gpio: Add Elba SoC gpio driver for spi cs control
spi: cadence-quadspi: Add QSPI support for Pensando Elba SoC
spi: dw: Add support for Pensando Elba SoC SPI
spidev: Add Pensando CPLD compatible
mmc: sdhci-cadence: Add Pensando Elba SoC support
arm64: Add config for Pensando SoC platforms
arm64: dts: Add Pensando Elba SoC support
dt-bindings: Add pensando vendor prefix
dt-bindings: mmc: Add Pensando Elba SoC binding
dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC
dt-bindings: gpio: Add Pensando Elba SoC support
MAINTAINERS: Add entry for PENSANDO
gpio: Use linux/gpio/driver.h

 .../bindings/gpio/pensando,elba-spics.yaml    |  50 +++
 .../devicetree/bindings/mmc/cdns,sdhci.yaml   |   1 +
 .../bindings/spi/cadence-quadspi.txt          |  68 ----
 .../bindings/spi/cadence-quadspi.yaml         | 153 +++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   9 +
 arch/arm64/Kconfig.platforms                  |   5 +
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/pensando/Makefile         |   6 +
 arch/arm64/boot/dts/pensando/elba-16core.dtsi | 170 ++++++++++
 .../boot/dts/pensando/elba-asic-common.dtsi   | 112 +++++++
 arch/arm64/boot/dts/pensando/elba-asic.dts    |   7 +
 .../boot/dts/pensando/elba-flash-parts.dtsi   |  78 +++++
 arch/arm64/boot/dts/pensando/elba.dtsi        | 310 ++++++++++++++++++
 drivers/gpio/Kconfig                          |   6 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-elba-spics.c                | 113 +++++++
 drivers/mmc/host/Kconfig                      |  15 +
 drivers/mmc/host/Makefile                     |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c         | 137 ++++++++
 drivers/mmc/host/sdhci-cadence.c              |  81 +++--
 drivers/mmc/host/sdhci-cadence.h              |  68 ++++
 drivers/spi/spi-cadence-quadspi.c             |   9 +
 drivers/spi/spi-dw-mmio.c                     |  28 +-
 drivers/spi/spidev.c                          |   1 +
 25 files changed, 1321 insertions(+), 111 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/pensando,elba-spics.yaml
 delete mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.yaml
 create mode 100644 arch/arm64/boot/dts/pensando/Makefile
 create mode 100644 arch/arm64/boot/dts/pensando/elba-16core.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic-common.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic.dts
 create mode 100644 arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba.dtsi
 create mode 100644 drivers/gpio/gpio-elba-spics.c
 create mode 100644 drivers/mmc/host/sdhci-cadence-elba.c
 create mode 100644 drivers/mmc/host/sdhci-cadence.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/13 gpio: Add Elba SoC gpio driver for spi cs control

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

---
 drivers/gpio/Kconfig           |   6 ++
 drivers/gpio/Makefile          |   1 +
 drivers/gpio/gpio-elba-spics.c | 114 +++++++++++++++++++++++++++++++++
 3 files changed, 121 insertions(+)
 create mode 100644 drivers/gpio/gpio-elba-spics.c
drivers/gpio/Kconfig +6 -0
index e3607ec4c2e8..4720459b24f5 100644
@@ -241,6 +241,12 @@ config GPIO_EIC_SPRD
 	help
 	  Say yes here to support Spreadtrum EIC device.
 
+config GPIO_ELBA_SPICS
+	bool "Pensando Elba SPI chip-select"
+	depends on (ARCH_PENSANDO_ELBA_SOC || COMPILE_TEST)
+	help
+	  Say yes here to support the Penasndo Elba SoC SPI chip-select driver
+
 config GPIO_EM
 	tristate "Emma Mobile GPIO"
 	depends on (ARCH_EMEV2 || COMPILE_TEST) && OF_GPIO
drivers/gpio/Makefile +1 -0
index c58a90a3c3b1..c5c7acad371b 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_DAVINCI)		+= gpio-davinci.o
 obj-$(CONFIG_GPIO_DLN2)			+= gpio-dln2.o
 obj-$(CONFIG_GPIO_DWAPB)		+= gpio-dwapb.o
 obj-$(CONFIG_GPIO_EIC_SPRD)		+= gpio-eic-sprd.o
+obj-$(CONFIG_GPIO_ELBA_SPICS)		+= gpio-elba-spics.o
 obj-$(CONFIG_GPIO_EM)			+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)		+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_EXAR)			+= gpio-exar.o
drivers/gpio/gpio-elba-spics.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v2 01/13] gpio: Add Elba SoC gpio driver for spi cs control

Quoted 3 lines · Brad Larson

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

Same comments as per v1.
NAK from me until we get settled in that discussion.

...

drivers/gpio/gpio-elba-spics.c line 114

Quoted 2 lines
drivers/gpio/gpio-elba-spics.c new file +2 -0
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Pensando Elba SoC SPI chip-select driver");

It's funny, you told it can't be a module and you add a dead code. Be somehow consistent, please.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH v2 01/13] gpio: Add Elba SoC gpio driver for spi cs control

Hi Andy,

Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Brad Larson

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

[...]

Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Pensando Elba SoC SPI chip-select driver");

It's funny, you told it can't be a module and you add a dead code. Be somehow consistent, please.

Yes the code was not consistent with statement that the module cannot being loadable in my reply. I had not used builtin_platform_driver() previously. The updated patchset will be changed to this for the driver.

-module_platform_driver(elba_spics_driver); -
-MODULE_LICENSE("GPL v2"); -MODULE_DESCRIPTION("Elba SPI chip-select driver"); +builtin_platform_driver(elba_spics_driver);

where drivers/gpio/Kconfig could be changed to this

drivers/gpio/Kconfig +1 -3
@@ -241,10 +241,8 @@ config GPIO_EIC_SPRD
          Say yes here to support Spreadtrum EIC device.
 
 config GPIO_ELBA_SPICS
-       bool "Pensando Elba SPI chip-select"
+       def_bool y
        depends on ARCH_PENSANDO_ELBA_SOC || COMPILE_TEST
-       help
-         Say yes here to support the Pensando Elba SoC SPI chip-select driver
 

Regards,
Brad

#4 lore raw

Re: [PATCH v2 01/13] gpio: Add Elba SoC gpio driver for spi cs control

In reply to Brad Larson
Quoted 4 lines · Brad Larson

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

You have not addressed mine nor Andy's comments
on v1. Go back, read and reply, and rewrite.

Yours,
Linus Walleij

#5 lore raw

Re: [PATCH v2 01/13] gpio: Add Elba SoC gpio driver for spi cs control

In reply to Brad Larson
Quoted 114 lines · Brad Larson

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

---
 drivers/gpio/Kconfig           |   6 ++
 drivers/gpio/Makefile          |   1 +
 drivers/gpio/gpio-elba-spics.c | 114 +++++++++++++++++++++++++++++++++
 3 files changed, 121 insertions(+)
 create mode 100644 drivers/gpio/gpio-elba-spics.c
drivers/gpio/Kconfig +6 -0
index e3607ec4c2e8..4720459b24f5 100644
@@ -241,6 +241,12 @@ config GPIO_EIC_SPRD
 	help
 	  Say yes here to support Spreadtrum EIC device.
 
+config GPIO_ELBA_SPICS
+	bool "Pensando Elba SPI chip-select"
+	depends on (ARCH_PENSANDO_ELBA_SOC || COMPILE_TEST)
+	help
+	  Say yes here to support the Penasndo Elba SoC SPI chip-select driver
+
 config GPIO_EM
 	tristate "Emma Mobile GPIO"
 	depends on (ARCH_EMEV2 || COMPILE_TEST) && OF_GPIO
drivers/gpio/Makefile +1 -0
index c58a90a3c3b1..c5c7acad371b 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_GPIO_DAVINCI)		+= gpio-davinci.o
 obj-$(CONFIG_GPIO_DLN2)			+= gpio-dln2.o
 obj-$(CONFIG_GPIO_DWAPB)		+= gpio-dwapb.o
 obj-$(CONFIG_GPIO_EIC_SPRD)		+= gpio-eic-sprd.o
+obj-$(CONFIG_GPIO_ELBA_SPICS)		+= gpio-elba-spics.o
 obj-$(CONFIG_GPIO_EM)			+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)		+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_EXAR)			+= gpio-exar.o
drivers/gpio/gpio-elba-spics.c new file +68 -0
new file mode 100644
index 000000000000..351bbaeea033
@@ -0,0 +1,114 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Pensando Elba SoC SPI chip select driver
+ *
+ * Copyright (c) 2020-2021, Pensando Systems Inc.
+ */
+
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/init.h>
+//#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+/*
+ * pin:	     3		  2	   |	   1		0
+ * bit:	 7------6------5------4----|---3------2------1------0
+ *	cs1  cs1_ovr  cs0  cs0_ovr |  cs1  cs1_ovr  cs0	 cs0_ovr
+ *		   ssi1		   |		 ssi0
+ */
+#define SPICS_PIN_SHIFT(pin)	(2 * (pin))
+#define SPICS_MASK(pin)		(0x3 << SPICS_PIN_SHIFT(pin))
+#define SPICS_SET(pin, val)	((((val) << 1) | 0x1) << SPICS_PIN_SHIFT(pin))
+
+struct elba_spics_priv {
+	void __iomem *base;
+	spinlock_t lock;
+	struct gpio_chip chip;
+};
+
+static int elba_spics_get_value(struct gpio_chip *chip, unsigned int pin)
+{
+	return -ENOTSUPP;
+}
+
+static void elba_spics_set_value(struct gpio_chip *chip,
+		unsigned int pin, int value)
+{
+	struct elba_spics_priv *p = gpiochip_get_data(chip);
+	unsigned long flags;
+	u32 tmp;
+
+	/* select chip select from register */
+	spin_lock_irqsave(&p->lock, flags);
+	tmp = readl_relaxed(p->base);
+	tmp = (tmp & ~SPICS_MASK(pin)) | SPICS_SET(pin, value);
+	writel_relaxed(tmp, p->base);
+	spin_unlock_irqrestore(&p->lock, flags);
+}
+
+static int elba_spics_direction_input(struct gpio_chip *chip, unsigned int pin)
+{
+	return -ENOTSUPP;
+}
+
+static int elba_spics_direction_output(struct gpio_chip *chip,
+		unsigned int pin, int value)
+{
+	elba_spics_set_value(chip, pin, value);
+	return 0;
+}
+
+static int elba_spics_probe(struct platform_device *pdev)
+{
+	struct elba_spics_priv *p;

drivers/gpio/gpio-elba-spics.c line 77

Quoted 10 lines
drivers/gpio/gpio-elba-spics.c new file +9 -0
+	struct resource *res;
+	int ret = 0;
+
+	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
+	if (!p)
+		return -ENOMEM;
+
 
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	p->base = devm_ioremap_resource(&pdev->dev, res);

In accordance with the DTS-node this is just a single register 0x307c2468-0x307c24C picked from some bigger block, which most likely belongs to something like a system controller. PCIe node has got another register from there "0x307c2480-0x307c2484/* MS CFG_WDT */", and some BSM device too "0x307c2080-0x307c2084". Please consider using syscon instead of directly requesting the resource here.

-Sergey

Quoted 40 lines
drivers/gpio/gpio-elba-spics.c new file +37 -0
+	if (IS_ERR(p->base))
+		return PTR_ERR(p->base);
+	spin_lock_init(&p->lock);
+	platform_set_drvdata(pdev, p);
+
+	p->chip.ngpio = 4;	/* 2 cs pins for spi0, and 2 for spi1 */
+	p->chip.base = -1;
+	p->chip.direction_input = elba_spics_direction_input;
+	p->chip.direction_output = elba_spics_direction_output;
+	p->chip.get = elba_spics_get_value;
+	p->chip.set = elba_spics_set_value;
+	p->chip.label = dev_name(&pdev->dev);
+	p->chip.parent = &pdev->dev;
+	p->chip.owner = THIS_MODULE;
+
+	ret = devm_gpiochip_add_data(&pdev->dev, &p->chip, p);
+	if (ret)
+		dev_err(&pdev->dev, "unable to add gpio chip\n");
+	return ret;
+}
+
+static const struct of_device_id elba_spics_of_match[] = {
+	{ .compatible = "pensando,elba-spics" },
+	{}
+};
+
+static struct platform_driver elba_spics_driver = {
+	.probe = elba_spics_probe,
+	.driver = {
+		.name = "pensando-elba-spics",
+		.of_match_table = elba_spics_of_match,
+	},
+};
+module_platform_driver(elba_spics_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("Pensando Elba SoC SPI chip-select driver");
Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH v2 01/13] gpio: Add Elba SoC gpio driver for spi cs control

Hi Sergey,

Quoted 4 lines · Serge Semin
Quoted 2 lines · Brad Larson

This GPIO driver is for the Pensando Elba SoC which provides control of four chip selects on two SPI busses.

[...]

Quoted 14 lines

drivers/gpio/gpio-elba-spics.c line 77

Quoted 13 lines
drivers/gpio/gpio-elba-spics.c new file +12 -0
+static int elba_spics_probe(struct platform_device *pdev)
+{
+     struct elba_spics_priv *p;
+     struct resource *res;
+     int ret = 0;
+
+     p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
+     if (!p)
+             return -ENOMEM;
+
 
+     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+     p->base = devm_ioremap_resource(&pdev->dev, res);
Quoted 8 lines

In accordance with the DTS-node this is just a single register 0x307c2468-0x307c24C picked from some bigger block, which most likely belongs to something like a system controller. PCIe node has got another register from there "0x307c2480-0x307c2484/* MS CFG_WDT */", and some BSM device too "0x307c2080-0x307c2084". Please consider using syscon instead of directly requesting the resource here.

-Sergey

I've looked into a few syscon based implementations which resulted in a regressions to include Elba spi probe failure and host machine check trying to perform PCIe access to Elba SoC. I like the idea of refactoring to use syscon but I don't have a functional solution to do so.

Regards,
Brad

#7 lore raw

PATCH v2 2/13 spi: cadence-quadspi: Add QSPI support for Pensando Elba SoC

In reply to Brad Larson

Add QSPI controller support for Pensando Elba SoC

---
 drivers/spi/spi-cadence-quadspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/spi-cadence-quadspi.c +9 -0
index 52ddb3255d88..4aacb0b2dbc7 100644
@@ -1353,6 +1353,7 @@ static int cqspi_request_mmap_dma(struct cqspi_st *cqspi)
 	cqspi->rx_chan = dma_request_chan_by_mask(&mask);
 	if (IS_ERR(cqspi->rx_chan)) {
 		int ret = PTR_ERR(cqspi->rx_chan);
+
 		cqspi->rx_chan = NULL;
 		return dev_err_probe(&cqspi->pdev->dev, ret, "No Rx DMA available\n");
 	}
@@ -1633,6 +1634,10 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = {
 	.quirks = CQSPI_DISABLE_DAC_MODE,
 };
 
+static const struct cqspi_driver_platdata pen_cdns_qspi = {
+	.quirks = CQSPI_NEEDS_WR_DELAY | CQSPI_DISABLE_DAC_MODE,
+};
+
 static const struct of_device_id cqspi_dt_ids[] = {
 	{
 		.compatible = "cdns,qspi-nor",
@@ -1650,6 +1655,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
 		.compatible = "intel,lgm-qspi",
 		.data = &intel_lgm_qspi,
 	},
+	{
+		.compatible = "pensando,cdns-qspi",
+		.data = &pen_cdns_qspi,
+	},
 	{ /* end of table */ }
 };
 
Signature · 1 line
2.17.1
#8 lore raw

Re: [PATCH v2 02/13] spi: cadence-quadspi: Add QSPI support for Pensando Elba SoC

Quoted 12 lines · Brad Larson

Add QSPI controller support for Pensando Elba SoC

---
 drivers/spi/spi-cadence-quadspi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/spi/spi-cadence-quadspi.c +0 -0
index 52ddb3255d88..4aacb0b2dbc7 100644

drivers/spi/spi-cadence-quadspi.c static int cqspi_request_mmap_dma(struct cqspi_st *cqspi) · line 1356

Quoted 4 lines
drivers/spi/spi-cadence-quadspi.c +1 -0
@@ -1353,6 +1353,7 @@ static int cqspi_request_mmap_dma(struct cqspi_st *cqspi)
 	cqspi->rx_chan = dma_request_chan_by_mask(&mask);
 	if (IS_ERR(cqspi->rx_chan)) {
 		int ret = PTR_ERR(cqspi->rx_chan);
+

Unrelated whitespace change. Please move it into a separate cleanup patch.

Quoted 28 lines
drivers/spi/spi-cadence-quadspi.c +8 -0
 		cqspi->rx_chan = NULL;
 		return dev_err_probe(&cqspi->pdev->dev, ret, "No Rx DMA available\n");
 	}
@@ -1633,6 +1634,10 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = {
 	.quirks = CQSPI_DISABLE_DAC_MODE,
 };
 
+static const struct cqspi_driver_platdata pen_cdns_qspi = {
+	.quirks = CQSPI_NEEDS_WR_DELAY | CQSPI_DISABLE_DAC_MODE,
+};
+
 static const struct of_device_id cqspi_dt_ids[] = {
 	{
 		.compatible = "cdns,qspi-nor",
@@ -1650,6 +1655,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
 		.compatible = "intel,lgm-qspi",
 		.data = &intel_lgm_qspi,
 	},
+	{
+		.compatible = "pensando,cdns-qspi",
+		.data = &pen_cdns_qspi,
+	},
 	{ /* end of table */ }
 };
 
Signature · 1 line
2.17.1

Rest of the patch looks good to me.

Signature · 3 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.
#9 lore raw

PATCH v2 3/13 spi: dw: Add support for Pensando Elba SoC SPI

In reply to Brad Larson

The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects.

---
 drivers/spi/spi-dw-mmio.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-mmio.c +27 -1
index 17c06039a74d..c323a5ceecb8 100644
@@ -56,7 +56,7 @@ struct dw_spi_mscc {
 /*
  * The Designware SPI controller (referred to as master in the documentation)
  * automatically deasserts chip select when the tx fifo is empty. The chip
- * selects then needs to be either driven as GPIOs or, for the first 4 using the
+ * selects then needs to be either driven as GPIOs or, for the first 4 using
  * the SPI boot controller registers. the final chip select is an OR gate
  * between the Designware SPI controller and the SPI boot controller.
  */
@@ -237,6 +237,31 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev,
 	return 0;
 }
 
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+	struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
+	if (!enable) {
+		/*
+		 * Using a GPIO-based chip-select, the DW SPI
+		 * controller still needs its own CS bit selected
+		 * to start the serial engine.  On Elba the specific
+		 * CS doesn't matter to start the serial engine,
+		 * so using CS0.
+		 */
+		dw_writel(dws, DW_SPI_SER, BIT(0));
+	} else {
+		dw_writel(dws, DW_SPI_SER, 0);
+	}
+}
+
+static int dw_spi_elba_init(struct platform_device *pdev,
+			    struct dw_spi_mmio *dwsmmio)
+{
+	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,
@@ -351,6 +376,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 = "pensando,elba-spi", .data = dw_spi_elba_init},
 	{ /* end of table */}
 };
 MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match);
Signature · 1 line
2.17.1
#10 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

Quoted 4 lines · Brad Larson

The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects.

...

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 244

Quoted 5 lines
drivers/spi/spi-dw-mmio.c +5 -0
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+       struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
+       if (!enable) {

Can you use positive conditional?

Quoted 12 lines
drivers/spi/spi-dw-mmio.c +12 -0
+               /*
+                * Using a GPIO-based chip-select, the DW SPI
+                * controller still needs its own CS bit selected
+                * to start the serial engine.  On Elba the specific
+                * CS doesn't matter to start the serial engine,
+                * so using CS0.
+                */
+               dw_writel(dws, DW_SPI_SER, BIT(0));
+       } else {
+               dw_writel(dws, DW_SPI_SER, 0);
+       }
+}
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

Hi Andy,

Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Brad Larson

The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects.

...

Quoted 7 lines

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 244

Quoted 5 lines
drivers/spi/spi-dw-mmio.c +5 -0
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+       struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
+       if (!enable) {

Can you use positive conditional?

This function has been re-written to use the existing dw_spi_set_cs(). This is what I currently plan for the v3 patchset.

static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)

{
        spi->chip_select = 0;
        dw_spi_set_cs(spi, enable);
}

Regards,
Brad

maintainer
#12 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

In reply to Brad Larson

drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 62

Quoted 9 lines · Brad Larson
drivers/spi/spi-dw-mmio.c +1 -1
@@ -56,7 +56,7 @@ struct dw_spi_mscc {
 /*
  * The Designware SPI controller (referred to as master in the documentation)
  * automatically deasserts chip select when the tx fifo is empty. The chip
- * selects then needs to be either driven as GPIOs or, for the first 4 using the
+ * selects then needs to be either driven as GPIOs or, for the first 4 using
  * the SPI boot controller registers. the final chip select is an OR gate
  * between the Designware SPI controller and the SPI boot controller.
  */

This is an unrelated fix, please send as a separate patch as covered in submitting-patches.rst.

Quoted 6 lines
drivers/spi/spi-dw-mmio.c +2 -0
@@ -237,6 +237,31 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev,
 	return 0;
 }
 
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 251

Quoted 10 lines
drivers/spi/spi-dw-mmio.c +10 -0
+	struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
+	if (!enable) {
+		/*
+		 * Using a GPIO-based chip-select, the DW SPI
+		 * controller still needs its own CS bit selected
+		 * to start the serial engine.  On Elba the specific
+		 * CS doesn't matter to start the serial engine,
+		 * so using CS0.
+		 */

Why does this comment only apply to one branch of the conditional?

#13 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

Quoted 15 lines · Mark Brown

drivers/spi/spi-dw-mmio.c struct dw_spi_mscc { · line 62

Quoted 9 lines · Brad Larson
drivers/spi/spi-dw-mmio.c +1 -1
@@ -56,7 +56,7 @@ struct dw_spi_mscc {
 /*
  * The Designware SPI controller (referred to as master in the documentation)
  * automatically deasserts chip select when the tx fifo is empty. The chip
- * selects then needs to be either driven as GPIOs or, for the first 4 using the
+ * selects then needs to be either driven as GPIOs or, for the first 4 using
  * the SPI boot controller registers. the final chip select is an OR gate
  * between the Designware SPI controller and the SPI boot controller.
  */

This is an unrelated fix, please send as a separate patch as covered in submitting-patches.rst.

I'll remove this. Belongs in a trivial patch set.

Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-dw-mmio.c +0 -0
@@ -237,6 +237,31 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev,
      return 0;
 }
 
Quoted 14 lines

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 251

Quoted 12 lines
drivers/spi/spi-dw-mmio.c +12 -0
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+     struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
+     if (!enable) {
+             /*
+              * Using a GPIO-based chip-select, the DW SPI
+              * controller still needs its own CS bit selected
+              * to start the serial engine.  On Elba the specific
+              * CS doesn't matter to start the serial engine,
+              * so using CS0.
+              */

Why does this comment only apply to one branch of the conditional?

It doesn't, I'll move it outside the conditional.

#14 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

In reply to Brad Larson
Quoted 23 lines · Brad Larson

The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects.

---
 drivers/spi/spi-dw-mmio.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/spi/spi-dw-mmio.c +1 -1
index 17c06039a74d..c323a5ceecb8 100644
@@ -56,7 +56,7 @@ struct dw_spi_mscc {
 /*
  * The Designware SPI controller (referred to as master in the documentation)
  * automatically deasserts chip select when the tx fifo is empty. The chip
- * selects then needs to be either driven as GPIOs or, for the first 4 using the
+ * selects then needs to be either driven as GPIOs or, for the first 4 using
  * the SPI boot controller registers. the final chip select is an OR gate
  * between the Designware SPI controller and the SPI boot controller.
  */

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 245

Quoted 9 lines
drivers/spi/spi-dw-mmio.c +5 -0
@@ -237,6 +237,31 @@ static int dw_spi_canaan_k210_init(struct platform_device *pdev,
 	return 0;
 }
 
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+	struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
 
+	if (!enable) {

Please, be more attentive to the review-comments given to you before resending a new patchset. One more time. This version of set_cs won't work for Active-high CS. Each SPI controller working with GPIO-based chip-select is marked as supporting that feature. So your DW SPI controller won't be able to work correctly with SPI-devices activated by active-high chip-select signal. Note default dw_spi_set_cs() callback supports that.

-Sergey

Quoted 34 lines
drivers/spi/spi-dw-mmio.c +20 -0
+		/*
+		 * Using a GPIO-based chip-select, the DW SPI
+		 * controller still needs its own CS bit selected
+		 * to start the serial engine.  On Elba the specific
+		 * CS doesn't matter to start the serial engine,
+		 * so using CS0.
+		 */
+		dw_writel(dws, DW_SPI_SER, BIT(0));
+	} else {
+		dw_writel(dws, DW_SPI_SER, 0);
+	}
+}
+
+static int dw_spi_elba_init(struct platform_device *pdev,
+			    struct dw_spi_mmio *dwsmmio)
+{
+	dwsmmio->dws.set_cs = dw_spi_elba_set_cs;
+	return 0;
+}
+
 static int dw_spi_mmio_probe(struct platform_device *pdev)
 {
drivers/spi/spi-dw-mmio.c +1 -0
 	int (*init_func)(struct platform_device *pdev,
@@ -351,6 +376,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 = "pensando,elba-spi", .data = dw_spi_elba_init},
 	{ /* end of table */}
 };
 MODULE_DEVICE_TABLE(of, dw_spi_mmio_of_match);
Signature · 1 line
2.17.1
#15 lore raw

Re: [PATCH v2 03/13] spi: dw: Add support for Pensando Elba SoC SPI

Hi Sergey,

Quoted 5 lines · Serge Semin
Quoted 3 lines · Brad Larson

The Pensando Elba SoC uses a GPIO based chip select for two DW SPI busses with each bus having two chip selects.

(...)

Quoted 7 lines

drivers/spi/spi-dw-mmio.c static int dw_spi_canaan_k210_init(struct platform_device *pdev, · line 244

Quoted 6 lines
drivers/spi/spi-dw-mmio.c +5 -0
+static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)
+{
+     struct dw_spi *dws = spi_master_get_devdata(spi->master);
+
 
+     if (!enable) {
Quoted 7 lines

Please, be more attentive to the review-comments given to you before resending a new patchset. One more time. This version of set_cs won't work for Active-high CS. Each SPI controller working with GPIO-based chip-select is marked as supporting that feature. So your DW SPI controller won't be able to work correctly with SPI-devices activated by active-high chip-select signal. Note default dw_spi_set_cs() callback supports that.

Thanks for your patience. It took me a while to understand what you were asking about regarding dw_spi_set_cs() due to the unnecessarily complicated function that was being used. The current implementation I propose for v3 patchset is this which as you identified handles cs active high/low properly.

static void dw_spi_elba_set_cs(struct spi_device *spi, bool enable)

{
        spi->chip_select = 0;
        dw_spi_set_cs(spi, enable);
}

Regards,
Brad

#16 lore raw

PATCH v2 4/13 spidev: Add Pensando CPLD compatible

In reply to Brad Larson

Pensando Elba SoC platforms have a SPI connected CPLD for platform management.

---
 drivers/spi/spidev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/spidev.c +1 -0
index 8cb4d923aeaa..8b285852ce82 100644
@@ -683,6 +683,7 @@ static const struct of_device_id spidev_dt_ids[] = {
 	{ .compatible = "dh,dhcom-board" },
 	{ .compatible = "menlo,m53cpld" },
 	{ .compatible = "cisco,spi-petra" },
+	{ .compatible = "pensando,cpld" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, spidev_dt_ids);
Signature · 1 line
2.17.1
#17 lore raw

Re: [PATCH v2 04/13] spidev: Add Pensando CPLD compatible

Quoted 3 lines · Brad Larson

Pensando Elba SoC platforms have a SPI connected CPLD for platform management.

And? It's not a good justification to spread the (debugging only) spidev interface.

What tool is going to use it? Why can't you have a driver for that in the kernel?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#18 lore raw

Re: [PATCH v2 04/13] spidev: Add Pensando CPLD compatible

Quoted 11 lines · Andy Shevchenko
Quoted 3 lines · Brad Larson

Pensando Elba SoC platforms have a SPI connected CPLD for platform management.

And? It's not a good justification to spread the (debugging only) spidev interface.

What tool is going to use it? Why can't you have a driver for that in the kernel?

The driver is in userspace and we need to instantiate /dev/spi0.N in the /dev directory. The CPLD includes a device id and version id that userspace applications use to differentiate functionality on different boards. It wouldn't really be appropriate to use one of the existing entries.

For example even with high pin count SoCs we are offloading low speed functionality into the CPLD connected over SPI. The elba-asic-common.dtsi file shows a compatible string of "pensando,cpld-rd1173" which does have a kernel driver we intend to contribute later if there is interest. This IP in the CPLD is readily available from Lattice which provides two I2C Masters which in our case we use for access to the network port transceivers. What was missing in the kernel was a bridge driver that exposes what looks like a standard I2C device to userspace where the drivers/i2c/busses/i2c-rd1173.c handles the spi transfers to the Lattice IP in the CPLD.

Quoted 4 lines

--
With Best Regards,
Andy Shevchenko

#19 lore raw

PATCH v2 5/13 mmc: sdhci-cadence: Add Pensando Elba SoC support

In reply to Brad Larson

Add support for Pensando Elba SoC which explicitly controls byte-lane enables on writes. Refactor to allow platform specific write ops.

---
 drivers/mmc/host/Kconfig              |  15 +++
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c | 137 ++++++++++++++++++++++++++
 drivers/mmc/host/sdhci-cadence.c      |  81 ++++++++-------
 drivers/mmc/host/sdhci-cadence.h      |  68 +++++++++++++
 5 files changed, 260 insertions(+), 42 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-cadence-elba.c
 create mode 100644 drivers/mmc/host/sdhci-cadence.h
drivers/mmc/host/Kconfig +15 -0
index b236dfe2e879..65ea323c06f2 100644
@@ -250,6 +250,21 @@ config MMC_SDHCI_CADENCE
 
 	  If unsure, say N.
 
+config MMC_SDHCI_CADENCE_ELBA
+	tristate "SDHCI support for the Pensando/Cadence SD/SDIO/eMMC controller"
+	depends on ARCH_PENSANDO_ELBA_SOC
+	depends on MMC_SDHCI
+	depends on OF
+	depends on MMC_SDHCI_CADENCE
+	depends on MMC_SDHCI_PLTFM
+	select MMC_SDHCI_IO_ACCESSORS
+	help
+	  This selects the Pensando/Cadence SD/SDIO/eMMC controller.
+
+	  If you have a controller with this interface, say Y or M here.
+
+	  If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
 	tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
 	depends on ARCH_CNS3XXX || COMPILE_TEST
drivers/mmc/host/Makefile +1 -0
index 6df5c4774260..f2a6d50e64de 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_MMC_REALTEK_USB)	+= rtsx_usb_sdmmc.o
 
 obj-$(CONFIG_MMC_SDHCI_PLTFM)		+= sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)		+= sdhci-cadence.o
+obj-$(CONFIG_MMC_SDHCI_CADENCE_ELBA)	+= sdhci-cadence-elba.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)		+= sdhci-cns3xxx.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_MCF)       += sdhci-esdhc-mcf.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)	+= sdhci-esdhc-imx.o
drivers/mmc/host/sdhci-cadence-elba.c new file +137 -0

137 lines not on this page · raw message

drivers/mmc/host/sdhci-cadence.c +39 -42

172 lines not on this page · raw message

drivers/mmc/host/sdhci-cadence.h new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.17.1
#20 lore raw

Re: [PATCH v2 05/13] mmc: sdhci-cadence: Add Pensando Elba SoC support

+ Masahiro Yamada (main author of the driver)

Quoted 10 lines · Brad Larson

Add support for Pensando Elba SoC which explicitly controls byte-lane enables on writes. Refactor to allow platform specific write ops.

---
 drivers/mmc/host/Kconfig              |  15 +++
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c | 137 ++++++++++++++++++++++++++

By looking at the amount of code changes that seem to be needed to support the Pensando Elba variant, I don't think it's necessary to split this into a separate file.

Unless Yamada-san has a different opinion, I would rather just stick with using sdhci-cadence.c.

Quoted 12 lines
 drivers/mmc/host/sdhci-cadence.c      |  81 ++++++++-------
 drivers/mmc/host/sdhci-cadence.h      |  68 +++++++++++++
 5 files changed, 260 insertions(+), 42 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-cadence-elba.c
 create mode 100644 drivers/mmc/host/sdhci-cadence.h
drivers/mmc/host/Kconfig +0 -0
index b236dfe2e879..65ea323c06f2 100644
@@ -250,6 +250,21 @@ config MMC_SDHCI_CADENCE
 

drivers/mmc/host/Kconfig config MMC_SDHCI_CADENCE · line 260

Quoted 10 lines
drivers/mmc/host/Kconfig +8 -0
          If unsure, say N.
 
+config MMC_SDHCI_CADENCE_ELBA
+       tristate "SDHCI support for the Pensando/Cadence SD/SDIO/eMMC controller"
+       depends on ARCH_PENSANDO_ELBA_SOC
+       depends on MMC_SDHCI
+       depends on OF
+       depends on MMC_SDHCI_CADENCE
+       depends on MMC_SDHCI_PLTFM
+       select MMC_SDHCI_IO_ACCESSORS

According to the comment above - then you should probably just extend the conditions for when building MMC_SDHCI_CADENCE, rather than having to add a new Kconfig for "*_ELBA".

Quoted 36 lines
drivers/mmc/host/Kconfig +7 -0
+       help
+         This selects the Pensando/Cadence SD/SDIO/eMMC controller.
+
+         If you have a controller with this interface, say Y or M here.
+
+         If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
        tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
        depends on ARCH_CNS3XXX || COMPILE_TEST
drivers/mmc/host/Makefile +1 -0
index 6df5c4774260..f2a6d50e64de 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
 
 obj-$(CONFIG_MMC_SDHCI_PLTFM)          += sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)                += sdhci-cadence.o
+obj-$(CONFIG_MMC_SDHCI_CADENCE_ELBA)   += sdhci-cadence-elba.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)                += sdhci-cns3xxx.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_MCF)       += sdhci-esdhc-mcf.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)      += sdhci-esdhc-imx.o
drivers/mmc/host/sdhci-cadence-elba.c new file +8 -0
new file mode 100644
index 000000000000..ec23f43de407
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2020 Pensando Systems, Inc.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/iopoll.h>

drivers/mmc/host/sdhci-cadence-elba.c line 18

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+#include <linux/module.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+
+#include "sdhci-pltfm.h"
+#include "sdhci-cadence.h"
+
+// delay regs address

Please don't use "//" when adding comments, but instead "/* ... */". This applies to several more places of the patch.

Quoted 57 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +57 -0
+#define SDIO_REG_HRS4          0x10
+#define REG_DELAY_HS           0x00
+#define REG_DELAY_DEFAULT      0x01
+#define REG_DELAY_UHSI_SDR50   0x04
+#define REG_DELAY_UHSI_DDR50   0x05
+
+static void elba_write_l(struct sdhci_host *host, u32 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, host->ioaddr + reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}
+
+static void elba_write_w(struct sdhci_host *host, u16 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+       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);
+}
+
+static void elba_write_b(struct sdhci_host *host, u8 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+       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);
+}
+
+static void elba_priv_write_l(struct sdhci_cdns_priv *priv,
+               u32 val, void __iomem *reg)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}
+
+static const struct sdhci_ops sdhci_elba_ops = {
+       .write_l = elba_write_l,
+       .write_w = elba_write_w,

drivers/mmc/host/sdhci-cadence-elba.c line 85

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+       .write_b = elba_write_b,
+       .set_clock = sdhci_set_clock,
+       .get_timeout_clock = sdhci_cdns_get_timeout_clock,
+       .set_bus_width = sdhci_set_bus_width,
+       .reset = sdhci_reset,
+       .set_uhs_signaling = sdhci_cdns_set_uhs_signaling,
+};
+
+static void sd4_set_dlyvr(struct sdhci_host *host,
+                         unsigned char addr, unsigned char data)

Please, try to think of a better function name that's more descriptive. Moreover, please use a common prefix for functions that is used on elba.

Quoted 7 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +7 -0
+{
+       unsigned long dlyrv_reg;
+
+       dlyrv_reg = ((unsigned long)data << 8);
+       dlyrv_reg |= addr;
+
+       // set data and address

drivers/mmc/host/sdhci-cadence-elba.c line 102

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg |= (1uL << 24uL);
+       // send write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg &= ~(1uL << 24);
+       // clear write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+}
+
+static void phy_config(struct sdhci_host *host)

Ditto.

Quoted 208 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +35 -0
+{
+       sd4_set_dlyvr(host, REG_DELAY_DEFAULT, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_HS, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_SDR50, 0x06);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_DDR50, 0x16);
+}
+
+static int elba_drv_init(struct platform_device *pdev)
+{
+       struct sdhci_host *host = platform_get_drvdata(pdev);
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       struct resource *iomem;
+       void __iomem *ioaddr;
+
+       host->mmc->caps |= (MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA);
+       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       if (!iomem)
+               return -ENOMEM;
+       ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
+       if (IS_ERR(ioaddr))
+               return PTR_ERR(ioaddr);
+       priv->ctl_addr = ioaddr;
+       priv->priv_write_l = elba_priv_write_l;
+       spin_lock_init(&priv->wrlock);
+       writel(0x78, priv->ctl_addr);
+       phy_config(host);
+       return 0;
+}
+
+const struct sdhci_cdns_drv_data sdhci_elba_drv_data = {
+       .init = elba_drv_init,
+       .pltfm_data = {
+               .ops = &sdhci_elba_ops,
+       },
+};
drivers/mmc/host/sdhci-cadence.c +32 -41
index 6f2de54a5987..d1ae996c3824 100644
@@ -14,6 +14,7 @@
 #include <linux/of_device.h>
 
 #include "sdhci-pltfm.h"
+#include "sdhci-cadence.h"
 
 /* HRS - Host Register Set (specific to Cadence) */
 #define SDHCI_CDNS_HRS04               0x10            /* PHY access port */
@@ -59,23 +60,6 @@
  */
 #define SDHCI_CDNS_MAX_TUNING_LOOP     40
 
-struct sdhci_cdns_phy_param {
-       u8 addr;
-       u8 data;
-};
-
-struct sdhci_cdns_priv {
-       void __iomem *hrs_addr;
-       bool enhanced_strobe;
-       unsigned int nr_phy_params;
-       struct sdhci_cdns_phy_param phy_params[];
-};
-
-struct sdhci_cdns_phy_cfg {
-       const char *property;
-       u8 addr;
-};
-
 static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = {
        { "cdns,phy-input-delay-sd-highspeed", SDHCI_CDNS_PHY_DLY_SD_HS, },
        { "cdns,phy-input-delay-legacy", SDHCI_CDNS_PHY_DLY_SD_DEFAULT, },
@@ -104,17 +88,17 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
 
        tmp = FIELD_PREP(SDHCI_CDNS_HRS04_WDATA, data) |
              FIELD_PREP(SDHCI_CDNS_HRS04_ADDR, addr);
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        tmp |= SDHCI_CDNS_HRS04_WR;
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10);
        if (ret)
                return ret;
 
        tmp &= ~SDHCI_CDNS_HRS04_WR;
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK),
                                 0, 10);
@@ -167,14 +151,7 @@ static int sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv)
        return 0;
 }
 
-static void *sdhci_cdns_priv(struct sdhci_host *host)
-{
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-
-       return sdhci_pltfm_priv(pltfm_host);
-}
-
-static unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
+unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
 {
        /*
         * Cadence's spec says the Timeout Clock Frequency is the same as the
@@ -191,7 +168,7 @@ static void sdhci_cdns_set_emmc_mode(struct sdhci_cdns_priv *priv, u32 mode)
        tmp = readl(priv->hrs_addr + SDHCI_CDNS_HRS06);
        tmp &= ~SDHCI_CDNS_HRS06_MODE;
        tmp |= FIELD_PREP(SDHCI_CDNS_HRS06_MODE, mode);
-       writel(tmp, priv->hrs_addr + SDHCI_CDNS_HRS06);
+       sdhci_cdns_priv_writel(priv, tmp, priv->hrs_addr + SDHCI_CDNS_HRS06);
 }
 
 static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv)
@@ -223,7 +200,7 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val)
         */
        for (i = 0; i < 2; i++) {
                tmp |= SDHCI_CDNS_HRS06_TUNE_UP;
-               writel(tmp, reg);
+               sdhci_cdns_priv_writel(priv, tmp, reg);
 
                ret = readl_poll_timeout(reg, tmp,
                                         !(tmp & SDHCI_CDNS_HRS06_TUNE_UP),
@@ -272,10 +249,13 @@ static int sdhci_cdns_execute_tuning(struct sdhci_host *host, u32 opcode)
                return -EIO;
        }
 
+       dev_info(mmc_dev(host->mmc), "tuning val %d streak end %d max %d\n",
+                end_of_streak - max_streak / 2, end_of_streak, max_streak);
+
        return sdhci_cdns_set_tune_val(host, end_of_streak - max_streak / 2);
 }
 
-static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,
+void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,
                                         unsigned int timing)
 {
        struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
@@ -318,13 +298,17 @@ static const struct sdhci_ops sdhci_cdns_ops = {
        .set_uhs_signaling = sdhci_cdns_set_uhs_signaling,
 };
 
-static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = {
-       .ops = &sdhci_cdns_ops,
-       .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+static const struct sdhci_cdns_drv_data sdhci_cdns_uniphier_drv_data = {
+       .pltfm_data = {
+               .ops = &sdhci_cdns_ops,
+               .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+       },
 };
 
-static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = {
-       .ops = &sdhci_cdns_ops,
+static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = {
+       .pltfm_data = {
+               .ops = &sdhci_cdns_ops,
+       },
 };
 
 static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
@@ -350,7 +334,7 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
 static int sdhci_cdns_probe(struct platform_device *pdev)
 {
        struct sdhci_host *host;
-       const struct sdhci_pltfm_data *data;
+       const struct sdhci_cdns_drv_data *data;
        struct sdhci_pltfm_host *pltfm_host;
        struct sdhci_cdns_priv *priv;
        struct clk *clk;
@@ -369,10 +353,10 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
 
        data = of_device_get_match_data(dev);
        if (!data)
-               data = &sdhci_cdns_pltfm_data;
+               data = &sdhci_cdns_drv_data;
 
        nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node);
-       host = sdhci_pltfm_init(pdev, data,
+       host = sdhci_pltfm_init(pdev, &data->pltfm_data,
                                struct_size(priv, phy_params, nr_phy_params));
        if (IS_ERR(host)) {
                ret = PTR_ERR(host);
@@ -389,11 +373,18 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
        host->ioaddr += SDHCI_CDNS_SRS_BASE;
        host->mmc_host_ops.hs400_enhanced_strobe =
                                sdhci_cdns_hs400_enhanced_strobe;
-       sdhci_enable_v4_mode(host);
-       __sdhci_read_caps(host, &version, NULL, NULL);
 
        sdhci_get_of_property(pdev);
 
+       if (data->init) {
+               ret = data->init(pdev);
+               if (ret)
+                       goto free;
+       }
+
+       sdhci_enable_v4_mode(host);
+       __sdhci_read_caps(host, &version, NULL, NULL);
+
        ret = mmc_of_parse(host->mmc);
        if (ret)
                goto free;

drivers/mmc/host/sdhci-cadence.c static const struct dev_pm_ops sdhci_cdns_pm_ops = { · line 449

Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +2 -1
@@ -453,8 +444,14 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = {
 static const struct of_device_id sdhci_cdns_match[] = {
        {
                .compatible = "socionext,uniphier-sd4hc",
-               .data = &sdhci_cdns_uniphier_pltfm_data,
+               .data = &sdhci_cdns_uniphier_drv_data,
        },
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA

No need to hide this minor piece of code behind ifdefs.

drivers/mmc/host/sdhci-cadence.h

Quoted 13 lines
drivers/mmc/host/sdhci-cadence.c +5 -0
+       {
+               .compatible = "pensando,elba-emmc",
+               .data = &sdhci_elba_drv_data
+       },
+#endif
        { .compatible = "cdns,sd4hc" },
        { /* sentinel */ }
 };
drivers/mmc/host/sdhci-cadence.h new file +0 -0
new file mode 100644
index 000000000000..bf48e8d13430

This new header file can go away too, if you fold in all the code in the common c-file.

Quoted 59 lines
drivers/mmc/host/sdhci-cadence.h new file +58 -0
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2016 Socionext Inc.
+ *   Author: Masahiro Yamada <[email protected]>
+ */
+
+#ifndef _SDHCI_CADENCE_H_
+#define _SDHCI_CADENCE_H_
+
+struct sdhci_cdns_phy_param {
+       u8 addr;
+       u8 data;
+};
+
+struct sdhci_cdns_priv {
+       void __iomem *hrs_addr;
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA
+       void __iomem *ctl_addr; /* write control */
+       spinlock_t wrlock;      /* write lock */
+#endif
+       bool enhanced_strobe;
+       void (*priv_write_l)(struct sdhci_cdns_priv *priv, u32 val,
+                            void __iomem *reg); /* for cadence-elba.c */
+       unsigned int nr_phy_params;
+       struct sdhci_cdns_phy_param phy_params[];
+};
+
+struct sdhci_cdns_phy_cfg {
+       const char *property;
+       u8 addr;
+};
+
+struct sdhci_cdns_drv_data {
+       int (*init)(struct platform_device *pdev);
+       const struct sdhci_pltfm_data pltfm_data;
+};
+
+static inline void *sdhci_cdns_priv(struct sdhci_host *host)
+{
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+       return sdhci_pltfm_priv(pltfm_host);
+}
+
+/*
+ * The Pensando Elba SoC explicitly controls byte-lane enables on writes,
+ * which includes writes to the HRS registers.
+ * sdhci_cdns_priv_writel() is used in the common sdhci-cadence.c code
+ * to write HRS registers, and this function dispatches to the specific
+ * code.
+ */
+static inline void sdhci_cdns_priv_writel(struct sdhci_cdns_priv *priv,
+               u32 val, void __iomem *reg)
+{
+       if (unlikely(priv->priv_write_l))
+               priv->priv_write_l(priv, val, reg);
+       else
+               writel(val, reg);

drivers/mmc/host/sdhci-cadence.h line 68

Quoted 10 lines
drivers/mmc/host/sdhci-cadence.h new file +10 -0
+}
+
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA
+extern const struct sdhci_cdns_drv_data sdhci_elba_drv_data;
+#endif
+
+unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host);
+void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, unsigned int timing);
+
+#endif

Kind regards
Uffe

#21 lore raw

Re: [PATCH v2 05/13] mmc: sdhci-cadence: Add Pensando Elba SoC support

Quoted 15 lines · Ulf Hansson

+ Masahiro Yamada (main author of the driver)

Quoted 10 lines · Brad Larson

Add support for Pensando Elba SoC which explicitly controls byte-lane enables on writes. Refactor to allow platform specific write ops.

---
 drivers/mmc/host/Kconfig              |  15 +++
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c | 137 ++++++++++++++++++++++++++
Quoted 6 lines

By looking at the amount of code changes that seem to be needed to support the Pensando Elba variant, I don't think it's necessary to split this into a separate file.

Unless Yamada-san has a different opinion, I would rather just stick with using sdhci-cadence.c.

I agree with Ulf.

BTW, this patch cannot probe
"pensando,elba-emmc"
when CONFIG_MMC_SDHCI_CADENCE_ELBA=m.

Quoted 69 lines
Quoted 13 lines
 drivers/mmc/host/sdhci-cadence.c      |  81 ++++++++-------
 drivers/mmc/host/sdhci-cadence.h      |  68 +++++++++++++
 5 files changed, 260 insertions(+), 42 deletions(-)
 create mode 100644 drivers/mmc/host/sdhci-cadence-elba.c
 create mode 100644 drivers/mmc/host/sdhci-cadence.h
drivers/mmc/host/Kconfig +0 -0
index b236dfe2e879..65ea323c06f2 100644
@@ -250,6 +250,21 @@ config MMC_SDHCI_CADENCE
 

drivers/mmc/host/Kconfig config MMC_SDHCI_CADENCE · line 260

Quoted 10 lines
drivers/mmc/host/Kconfig +8 -0
          If unsure, say N.
 
+config MMC_SDHCI_CADENCE_ELBA
+       tristate "SDHCI support for the Pensando/Cadence SD/SDIO/eMMC controller"
+       depends on ARCH_PENSANDO_ELBA_SOC
+       depends on MMC_SDHCI
+       depends on OF
+       depends on MMC_SDHCI_CADENCE
+       depends on MMC_SDHCI_PLTFM
+       select MMC_SDHCI_IO_ACCESSORS

According to the comment above - then you should probably just extend the conditions for when building MMC_SDHCI_CADENCE, rather than having to add a new Kconfig for "*_ELBA".

Quoted 41 lines
drivers/mmc/host/Kconfig +7 -0
+       help
+         This selects the Pensando/Cadence SD/SDIO/eMMC controller.
+
+         If you have a controller with this interface, say Y or M here.
+
+         If unsure, say N.
+
 config MMC_SDHCI_CNS3XXX
        tristate "SDHCI support on the Cavium Networks CNS3xxx SoC"
        depends on ARCH_CNS3XXX || COMPILE_TEST
drivers/mmc/host/Makefile +1 -0
index 6df5c4774260..f2a6d50e64de 100644
@@ -80,6 +80,7 @@ obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
 
 obj-$(CONFIG_MMC_SDHCI_PLTFM)          += sdhci-pltfm.o
 obj-$(CONFIG_MMC_SDHCI_CADENCE)                += sdhci-cadence.o
+obj-$(CONFIG_MMC_SDHCI_CADENCE_ELBA)   += sdhci-cadence-elba.o
 obj-$(CONFIG_MMC_SDHCI_CNS3XXX)                += sdhci-cns3xxx.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_MCF)       += sdhci-esdhc-mcf.o
 obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX)      += sdhci-esdhc-imx.o
drivers/mmc/host/sdhci-cadence-elba.c new file +13 -0
new file mode 100644
index 000000000000..ec23f43de407
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2020 Pensando Systems, Inc.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/bits.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
Quoted 10 lines

drivers/mmc/host/sdhci-cadence-elba.c line 18

Quoted 5 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +5 -0
+
+#include "sdhci-pltfm.h"
+#include "sdhci-cadence.h"
+
+// delay regs address

Please don't use "//" when adding comments, but instead "/* ... */". This applies to several more places of the patch.

Quoted 1 line
drivers/mmc/host/sdhci-cadence-elba.c new file +1 -0
+#define SDIO_REG_HRS4          0x10

This is the same as SDHCI_CDNS_HRS04

Quoted 1 line

drivers/mmc/host/sdhci-cadence-elba.c line 20

Quoted 1 line
drivers/mmc/host/sdhci-cadence-elba.c new file +1 -0
+#define REG_DELAY_HS           0x00

This is the same as SDHCI_CDNS_PHY_DLY_SD_HS

Quoted 1 line

drivers/mmc/host/sdhci-cadence-elba.c line 21

Quoted 1 line
drivers/mmc/host/sdhci-cadence-elba.c new file +1 -0
+#define REG_DELAY_DEFAULT      0x01

This is the same as SDHCI_CDNS_PHY_DLY_SD_DEFAULT

Quoted 1 line

drivers/mmc/host/sdhci-cadence-elba.c line 22

Quoted 1 line
drivers/mmc/host/sdhci-cadence-elba.c new file +1 -0
+#define REG_DELAY_UHSI_SDR50   0x04

This is the same as SDHCI_CDNS_PHY_DLY_UHS_SDR50

Quoted 1 line

drivers/mmc/host/sdhci-cadence-elba.c line 23

Quoted 1 line
drivers/mmc/host/sdhci-cadence-elba.c new file +1 -0
+#define REG_DELAY_UHSI_DDR50   0x05

This is the same as SDHCI_CDNS_PHY_DLY_UHS_DDR50

Quoted 40 lines
Quoted 40 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +40 -0
+
+static void elba_write_l(struct sdhci_host *host, u32 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, host->ioaddr + reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}
+
+static void elba_write_w(struct sdhci_host *host, u16 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+       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);
+}
+
+static void elba_write_b(struct sdhci_host *host, u8 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+       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);
+}
+
+static void elba_priv_write_l(struct sdhci_cdns_priv *priv,
+               u32 val, void __iomem *reg)
Quoted 8 lines

drivers/mmc/host/sdhci-cadence-elba.c line 71

Quoted 8 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +8 -0
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}

Maybe, can this avoid code duplication?

static void elba_hrs_write_l(struct sdhci_cdns_priv *priv,
u32 val, int reg)

{
        unsigned long flags;

        spin_lock_irqsave(&priv->wrlock, flags);
        writel(0x78, priv->ctl_addr);
        writel(val, priv->hrs_addr + reg);
        spin_unlock_irqrestore(&priv->wrlock, flags);
}

static void elba_write_l(struct sdhci_host *host, u32 val, int reg)

{
        elba_hrs_write_l(sdhci_cdns_priv(host), val, SDHCI_CDNS_SRS_BASE + reg);
}
Quoted 19 lines
Quoted 4 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +4 -0
+
+static const struct sdhci_ops sdhci_elba_ops = {
+       .write_l = elba_write_l,
+       .write_w = elba_write_w,

drivers/mmc/host/sdhci-cadence-elba.c line 85

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+       .write_b = elba_write_b,
+       .set_clock = sdhci_set_clock,
+       .get_timeout_clock = sdhci_cdns_get_timeout_clock,
+       .set_bus_width = sdhci_set_bus_width,
+       .reset = sdhci_reset,
+       .set_uhs_signaling = sdhci_cdns_set_uhs_signaling,
+};
+
+static void sd4_set_dlyvr(struct sdhci_host *host,
+                         unsigned char addr, unsigned char data)

Please, try to think of a better function name that's more descriptive. Moreover, please use a common prefix for functions that is used on elba.

Quoted 14 lines
Quoted 4 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +4 -0
+{
+       unsigned long dlyrv_reg;
+
+       dlyrv_reg = ((unsigned long)data << 8);

drivers/mmc/host/sdhci-cadence-elba.c line 99

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+       dlyrv_reg |= addr;
+
+       // set data and address
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg |= (1uL << 24uL);
+       // send write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg &= ~(1uL << 24);
+       // clear write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);

This seems to be equivalent to sdhci_cdns_write_phy_reg().

Quoted 11 lines

drivers/mmc/host/sdhci-cadence-elba.c line 102

Quoted 3 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +3 -0
+}
+
+static void phy_config(struct sdhci_host *host)

Ditto.

Quoted 5 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +5 -0
+{
+       sd4_set_dlyvr(host, REG_DELAY_DEFAULT, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_HS, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_SDR50, 0x06);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_DDR50, 0x16);

Hard-code board (or chip) specific parameters to the driver?

This should go to DT properties.

See Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml

Quoted 8 lines
Quoted 8 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +8 -0
+}
+
+static int elba_drv_init(struct platform_device *pdev)
+{
+       struct sdhci_host *host = platform_get_drvdata(pdev);
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       struct resource *iomem;
+       void __iomem *ioaddr;
Quoted 8 lines

drivers/mmc/host/sdhci-cadence-elba.c line 123

Quoted 8 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +8 -0
+
+       host->mmc->caps |= (MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA);
+       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       if (!iomem)
+               return -ENOMEM;
+       ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
+       if (IS_ERR(ioaddr))
+               return PTR_ERR(ioaddr);

Use devm_platform_ioremap_resource(pdev, 1)

Quoted 278 lines
Quoted 187 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +14 -0
+       priv->ctl_addr = ioaddr;
+       priv->priv_write_l = elba_priv_write_l;
+       spin_lock_init(&priv->wrlock);
+       writel(0x78, priv->ctl_addr);
+       phy_config(host);
+       return 0;
+}
+
+const struct sdhci_cdns_drv_data sdhci_elba_drv_data = {
+       .init = elba_drv_init,
+       .pltfm_data = {
+               .ops = &sdhci_elba_ops,
+       },
+};
drivers/mmc/host/sdhci-cadence.c +32 -41
index 6f2de54a5987..d1ae996c3824 100644
@@ -14,6 +14,7 @@
 #include <linux/of_device.h>
 
 #include "sdhci-pltfm.h"
+#include "sdhci-cadence.h"
 
 /* HRS - Host Register Set (specific to Cadence) */
 #define SDHCI_CDNS_HRS04               0x10            /* PHY access port */
@@ -59,23 +60,6 @@
  */
 #define SDHCI_CDNS_MAX_TUNING_LOOP     40
 
-struct sdhci_cdns_phy_param {
-       u8 addr;
-       u8 data;
-};
-
-struct sdhci_cdns_priv {
-       void __iomem *hrs_addr;
-       bool enhanced_strobe;
-       unsigned int nr_phy_params;
-       struct sdhci_cdns_phy_param phy_params[];
-};
-
-struct sdhci_cdns_phy_cfg {
-       const char *property;
-       u8 addr;
-};
-
 static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = {
        { "cdns,phy-input-delay-sd-highspeed", SDHCI_CDNS_PHY_DLY_SD_HS, },
        { "cdns,phy-input-delay-legacy", SDHCI_CDNS_PHY_DLY_SD_DEFAULT, },
@@ -104,17 +88,17 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv,
 
        tmp = FIELD_PREP(SDHCI_CDNS_HRS04_WDATA, data) |
              FIELD_PREP(SDHCI_CDNS_HRS04_ADDR, addr);
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        tmp |= SDHCI_CDNS_HRS04_WR;
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10);
        if (ret)
                return ret;
 
        tmp &= ~SDHCI_CDNS_HRS04_WR;
-       writel(tmp, reg);
+       sdhci_cdns_priv_writel(priv, tmp, reg);
 
        ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK),
                                 0, 10);
@@ -167,14 +151,7 @@ static int sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv)
        return 0;
 }
 
-static void *sdhci_cdns_priv(struct sdhci_host *host)
-{
-       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-
-       return sdhci_pltfm_priv(pltfm_host);
-}
-
-static unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
+unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host)
 {
        /*
         * Cadence's spec says the Timeout Clock Frequency is the same as the
@@ -191,7 +168,7 @@ static void sdhci_cdns_set_emmc_mode(struct sdhci_cdns_priv *priv, u32 mode)
        tmp = readl(priv->hrs_addr + SDHCI_CDNS_HRS06);
        tmp &= ~SDHCI_CDNS_HRS06_MODE;
        tmp |= FIELD_PREP(SDHCI_CDNS_HRS06_MODE, mode);
-       writel(tmp, priv->hrs_addr + SDHCI_CDNS_HRS06);
+       sdhci_cdns_priv_writel(priv, tmp, priv->hrs_addr + SDHCI_CDNS_HRS06);
 }
 
 static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv)
@@ -223,7 +200,7 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val)
         */
        for (i = 0; i < 2; i++) {
                tmp |= SDHCI_CDNS_HRS06_TUNE_UP;
-               writel(tmp, reg);
+               sdhci_cdns_priv_writel(priv, tmp, reg);
 
                ret = readl_poll_timeout(reg, tmp,
                                         !(tmp & SDHCI_CDNS_HRS06_TUNE_UP),
@@ -272,10 +249,13 @@ static int sdhci_cdns_execute_tuning(struct sdhci_host *host, u32 opcode)
                return -EIO;
        }
 
+       dev_info(mmc_dev(host->mmc), "tuning val %d streak end %d max %d\n",
+                end_of_streak - max_streak / 2, end_of_streak, max_streak);
+
        return sdhci_cdns_set_tune_val(host, end_of_streak - max_streak / 2);
 }
 
-static void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,
+void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host,
                                         unsigned int timing)
 {
        struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
@@ -318,13 +298,17 @@ static const struct sdhci_ops sdhci_cdns_ops = {
        .set_uhs_signaling = sdhci_cdns_set_uhs_signaling,
 };
 
-static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = {
-       .ops = &sdhci_cdns_ops,
-       .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+static const struct sdhci_cdns_drv_data sdhci_cdns_uniphier_drv_data = {
+       .pltfm_data = {
+               .ops = &sdhci_cdns_ops,
+               .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
+       },
 };
 
-static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = {
-       .ops = &sdhci_cdns_ops,
+static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = {
+       .pltfm_data = {
+               .ops = &sdhci_cdns_ops,
+       },
 };
 
 static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
@@ -350,7 +334,7 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
 static int sdhci_cdns_probe(struct platform_device *pdev)
 {
        struct sdhci_host *host;
-       const struct sdhci_pltfm_data *data;
+       const struct sdhci_cdns_drv_data *data;
        struct sdhci_pltfm_host *pltfm_host;
        struct sdhci_cdns_priv *priv;
        struct clk *clk;
@@ -369,10 +353,10 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
 
        data = of_device_get_match_data(dev);
        if (!data)
-               data = &sdhci_cdns_pltfm_data;
+               data = &sdhci_cdns_drv_data;
 
        nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node);
-       host = sdhci_pltfm_init(pdev, data,
+       host = sdhci_pltfm_init(pdev, &data->pltfm_data,
                                struct_size(priv, phy_params, nr_phy_params));
        if (IS_ERR(host)) {
                ret = PTR_ERR(host);
@@ -389,11 +373,18 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
        host->ioaddr += SDHCI_CDNS_SRS_BASE;
        host->mmc_host_ops.hs400_enhanced_strobe =
                                sdhci_cdns_hs400_enhanced_strobe;
-       sdhci_enable_v4_mode(host);
-       __sdhci_read_caps(host, &version, NULL, NULL);
 
        sdhci_get_of_property(pdev);
 
+       if (data->init) {
+               ret = data->init(pdev);
+               if (ret)
+                       goto free;
+       }
+
+       sdhci_enable_v4_mode(host);
+       __sdhci_read_caps(host, &version, NULL, NULL);
+
        ret = mmc_of_parse(host->mmc);
        if (ret)
                goto free;

drivers/mmc/host/sdhci-cadence.c static const struct dev_pm_ops sdhci_cdns_pm_ops = { · line 449

Quoted 7 lines
drivers/mmc/host/sdhci-cadence.c +2 -1
@@ -453,8 +444,14 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = {
 static const struct of_device_id sdhci_cdns_match[] = {
        {
                .compatible = "socionext,uniphier-sd4hc",
-               .data = &sdhci_cdns_uniphier_pltfm_data,
+               .data = &sdhci_cdns_uniphier_drv_data,
        },
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA

No need to hide this minor piece of code behind ifdefs.

drivers/mmc/host/sdhci-cadence.h

Quoted 13 lines
drivers/mmc/host/sdhci-cadence.c +5 -0
+       {
+               .compatible = "pensando,elba-emmc",
+               .data = &sdhci_elba_drv_data
+       },
+#endif
        { .compatible = "cdns,sd4hc" },
        { /* sentinel */ }
 };
drivers/mmc/host/sdhci-cadence.h new file +0 -0
new file mode 100644
index 000000000000..bf48e8d13430

This new header file can go away too, if you fold in all the code in the common c-file.

Quoted 64 lines
drivers/mmc/host/sdhci-cadence.h new file +63 -0
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2016 Socionext Inc.
+ *   Author: Masahiro Yamada <[email protected]>
+ */
+
+#ifndef _SDHCI_CADENCE_H_
+#define _SDHCI_CADENCE_H_
+
+struct sdhci_cdns_phy_param {
+       u8 addr;
+       u8 data;
+};
+
+struct sdhci_cdns_priv {
+       void __iomem *hrs_addr;
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA
+       void __iomem *ctl_addr; /* write control */
+       spinlock_t wrlock;      /* write lock */
+#endif
+       bool enhanced_strobe;
+       void (*priv_write_l)(struct sdhci_cdns_priv *priv, u32 val,
+                            void __iomem *reg); /* for cadence-elba.c */
+       unsigned int nr_phy_params;
+       struct sdhci_cdns_phy_param phy_params[];
+};
+
+struct sdhci_cdns_phy_cfg {
+       const char *property;
+       u8 addr;
+};
+
+struct sdhci_cdns_drv_data {
+       int (*init)(struct platform_device *pdev);
+       const struct sdhci_pltfm_data pltfm_data;
+};
+
+static inline void *sdhci_cdns_priv(struct sdhci_host *host)
+{
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+       return sdhci_pltfm_priv(pltfm_host);
+}
+
+/*
+ * The Pensando Elba SoC explicitly controls byte-lane enables on writes,
+ * which includes writes to the HRS registers.
+ * sdhci_cdns_priv_writel() is used in the common sdhci-cadence.c code
+ * to write HRS registers, and this function dispatches to the specific
+ * code.
+ */
+static inline void sdhci_cdns_priv_writel(struct sdhci_cdns_priv *priv,
+               u32 val, void __iomem *reg)
+{
+       if (unlikely(priv->priv_write_l))
+               priv->priv_write_l(priv, val, reg);
+       else
+               writel(val, reg);
+}
+
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA
+extern const struct sdhci_cdns_drv_data sdhci_elba_drv_data;
+#endif
Quoted 8 lines

drivers/mmc/host/sdhci-cadence.h line 68

Quoted 5 lines
drivers/mmc/host/sdhci-cadence.h new file +5 -0
+
+unsigned int sdhci_cdns_get_timeout_clock(struct sdhci_host *host);
+void sdhci_cdns_set_uhs_signaling(struct sdhci_host *host, unsigned int timing);
+
+#endif

Kind regards
Uffe

--
Best Regards
Masahiro Yamada

#22 lore raw

Re: [PATCH v2 05/13] mmc: sdhci-cadence: Add Pensando Elba SoC support

Hi Yamada-san,

Quoted 21 lines · Masahiro Yamada
Quoted 19 lines · Ulf Hansson

+ Masahiro Yamada (main author of the driver)

Quoted 10 lines · Brad Larson

Add support for Pensando Elba SoC which explicitly controls byte-lane enables on writes. Refactor to allow platform specific write ops.

---
 drivers/mmc/host/Kconfig              |  15 +++
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c | 137 ++++++++++++++++++++++++++

By looking at the amount of code changes that seem to be needed to support the Pensando Elba variant, I don't think it's necessary to split this into a separate file.

Quoted 5 lines
Quoted 2 lines

Unless Yamada-san has a different opinion, I would rather just stick with using sdhci-cadence.c.

I agree with Ulf.

I've folded Elba SoC support into sdhci-cadence.c.

Quoted 3 lines

BTW, this patch cannot probe
"pensando,elba-emmc"
when CONFIG_MMC_SDHCI_CADENCE_ELBA=m.

Right, that issue is gone now. There is no separate sdhci-cadence-elba.c

Quoted 20 lines
Quoted 1 line
Quoted 1 line

+#define SDIO_REG_HRS4 0x10

This is the same as SDHCI_CDNS_HRS04

Quoted 1 line
Quoted 1 line

+#define REG_DELAY_HS 0x00

This is the same as SDHCI_CDNS_PHY_DLY_SD_HS

Quoted 1 line
Quoted 1 line

+#define REG_DELAY_DEFAULT 0x01

This is the same as SDHCI_CDNS_PHY_DLY_SD_DEFAULT

Quoted 1 line
Quoted 1 line

+#define REG_DELAY_UHSI_SDR50 0x04

Quoted 9 lines

This is the same as SDHCI_CDNS_PHY_DLY_UHS_SDR50

Quoted 1 line
Quoted 1 line

+#define REG_DELAY_UHSI_DDR50 0x05

This is the same as SDHCI_CDNS_PHY_DLY_UHS_DDR50

All of those redundant definitions are gone, I'm now using the existing definitions you're identifying.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +11 -0
+
+static void elba_write_l(struct sdhci_host *host, u32 val, int reg)
+{
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, host->ioaddr + reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}

[...]

Quoted 25 lines
Quoted 10 lines

drivers/mmc/host/sdhci-cadence-elba.c line 71

Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+static void elba_priv_write_l(struct sdhci_cdns_priv *priv,
+               u32 val, void __iomem *reg)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->wrlock, flags);
+       writel(0x78, priv->ctl_addr);
+       writel(val, reg);
+       spin_unlock_irqrestore(&priv->wrlock, flags);
+}

Maybe, can this avoid code duplication?

static void elba_hrs_write_l(struct sdhci_cdns_priv *priv,
u32 val, int reg)

{
        unsigned long flags;

        spin_lock_irqsave(&priv->wrlock, flags);
        writel(0x78, priv->ctl_addr);
        writel(val, priv->hrs_addr + reg);
        spin_unlock_irqrestore(&priv->wrlock, flags);
}
Quoted 4 lines

static void elba_write_l(struct sdhci_host *host, u32 val, int reg)

{
        elba_hrs_write_l(sdhci_cdns_priv(host), val, SDHCI_CDNS_SRS_BASE + reg);
}

Yes, some code can be reduced. This is the current implementation I
propose to include with the v3 patchset

/*
* The Pensando Elba SoC explicitly controls byte-lane enables on writes
* which includes writes to the HRS registers.
*/
static void elba_priv_write_l(struct sdhci_cdns_priv *priv, u32 val,
void __iomem *reg)

{
        unsigned long flags;

        spin_lock_irqsave(&priv->wrlock, flags);
        writel(0x78, priv->ctl_addr);
        writel(val, reg);
        spin_unlock_irqrestore(&priv->wrlock, flags);
}

static void elba_write_l(struct sdhci_host *host, u32 val, int reg)

{
        elba_priv_write_l(sdhci_cdns_priv(host), val, host->ioaddr + reg);
}
Quoted 6 lines
Quoted 6 lines

drivers/mmc/host/sdhci-cadence-elba.c line 85

Quoted 2 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +2 -0
+static void sd4_set_dlyvr(struct sdhci_host *host,
+                         unsigned char addr, unsigned char data)

Please, try to think of a better function name that's more descriptive. Moreover, please use a common prefix for functions that is used on elba.

This function is removed and the existing sdhci_cdns_phy_init() is used with DT properties

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +9 -0
+{
+       unsigned long dlyrv_reg;
+
+       dlyrv_reg = ((unsigned long)data << 8);
+       dlyrv_reg |= addr;
+
+       // set data and address
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg |= (1uL << 24uL);
Quoted 8 lines
Quoted 5 lines

drivers/mmc/host/sdhci-cadence-elba.c line 99

Quoted 5 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +5 -0
+       // send write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg &= ~(1uL << 24);
+       // clear write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);

This seems to be equivalent to sdhci_cdns_write_phy_reg().

Yes after looking at the implementation it is, there was nothing special required for Elba. I've refactored and the function sdhci_cdns_write_phy_reg() which is used in sdhci_cdns_phy_init() dependent on DT properties is now used for Elba phy init.

Quoted 11 lines
Quoted 9 lines
Quoted 1 line

+static void phy_config(struct sdhci_host *host)

Ditto.

Quoted 5 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +5 -0
+{
+       sd4_set_dlyvr(host, REG_DELAY_DEFAULT, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_HS, 0x04);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_SDR50, 0x06);
+       sd4_set_dlyvr(host, REG_DELAY_UHSI_DDR50, 0x16);
Quoted 5 lines

Hard-code board (or chip) specific parameters to the driver?

This should go to DT properties.

See Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml

Exactly, v3 of the patchset will incorporate this recommendation. In the case of Elba SoC these are the DT properties being used

cdns,phy-input-delay-sd-highspeed = <0x4>;
cdns,phy-input-delay-legacy = <0x4>;
cdns,phy-input-delay-sd-uhs-sdr50 = <0x6>;
cdns,phy-input-delay-sd-uhs-ddr50 = <0x16>;

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +10 -0
+static int elba_drv_init(struct platform_device *pdev)
+{
+       struct sdhci_host *host = platform_get_drvdata(pdev);
+       struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
+       struct resource *iomem;
+       void __iomem *ioaddr;
+
+       host->mmc->caps |= (MMC_CAP_1_8V_DDR | MMC_CAP_8_BIT_DATA);
+       iomem = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+       if (!iomem)
Quoted 8 lines
Quoted 4 lines

drivers/mmc/host/sdhci-cadence-elba.c line 123

Quoted 4 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +4 -0
+               return -ENOMEM;
+       ioaddr = devm_ioremap_resource(&pdev->dev, iomem);
+       if (IS_ERR(ioaddr))
+               return PTR_ERR(ioaddr);

Use devm_platform_ioremap_resource(pdev, 1)

Replaced devm_ioremap_resource(&pdev->dev, iomem) with devm_platform_ioremap_resource(pdev, 1). The change will be in v3 of the patchset.

Regards,
Brad

#23 lore raw

Re: [PATCH v2 05/13] mmc: sdhci-cadence: Add Pensando Elba SoC support

In reply to Ulf Hansson

Hi Uffe,

Quoted 15 lines · Ulf Hansson

+ Masahiro Yamada (main author of the driver)

Quoted 10 lines · Brad Larson

Add support for Pensando Elba SoC which explicitly controls byte-lane enables on writes. Refactor to allow platform specific write ops.

---
 drivers/mmc/host/Kconfig              |  15 +++
 drivers/mmc/host/Makefile             |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c | 137 ++++++++++++++++++++++++++
Quoted 6 lines

By looking at the amount of code changes that seem to be needed to support the Pensando Elba variant, I don't think it's necessary to split this into a separate file.

Unless Yamada-san has a different opinion, I would rather just stick with using sdhci-cadence.c.

Yamada-san agreed with the recommendation. This is a summary of the changes for the updated patchset based upon all the review comments.

- Add Elba support into sdhci-cadence.c
- Removes new files sdhci-cadence-elba.c and sdhci-cadence.h.
- Remove Kconfig option MMC_SDHCI_CADENCE_ELBA
- Use the existing SDHCI_CDNS_* register defines
- Prefixed the remaining Elba SoC specific functions with elba_
- Use C Comment syntax
- The Elba specific phy init code is removed and the existing sdhci_cdns_phy_init() is used for these Elba properties set in the DT

cdns,phy-input-delay-sd-highspeed = <0x4>;
cdns,phy-input-delay-legacy = <0x4>;
cdns,phy-input-delay-sd-uhs-sdr50 = <0x6>;
cdns,phy-input-delay-sd-uhs-ddr50 = <0x16>;

Quoted 9 lines

drivers/mmc/host/Kconfig config MMC_SDHCI_CADENCE · line 260

Quoted 8 lines
drivers/mmc/host/Kconfig +8 -0
+config MMC_SDHCI_CADENCE_ELBA
+       tristate "SDHCI support for the Pensando/Cadence SD/SDIO/eMMC controller"
+       depends on ARCH_PENSANDO_ELBA_SOC
+       depends on MMC_SDHCI
+       depends on OF
+       depends on MMC_SDHCI_CADENCE
+       depends on MMC_SDHCI_PLTFM
+       select MMC_SDHCI_IO_ACCESSORS
Quoted 3 lines

According to the comment above - then you should probably just extend the conditions for when building MMC_SDHCI_CADENCE, rather than having to add a new Kconfig for "*_ELBA".

Yes, config MMC_SDHCI_CADENCE_ELBA is removed. Elba support is enabled with CONFIG_MMC_SDHCI_CADENCE.

Quoted 5 lines
Quoted 1 line

+// delay regs address

Please don't use "//" when adding comments, but instead "/* ... */". This applies to several more places of the patch.

Only C syntax is now used for comments.

Quoted 6 lines

drivers/mmc/host/sdhci-cadence-elba.c line 85

Quoted 2 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +2 -0
+static void sd4_set_dlyvr(struct sdhci_host *host,
+                         unsigned char addr, unsigned char data)

Please, try to think of a better function name that's more descriptive. Moreover, please use a common prefix for functions that is used on elba.

The Elba specific functions such as sd4_set_dlyvr() are deleted and the existing sdhci_cdns_phy_init() with DT properties are used for PHY init. The remaining Elba specific functions have the prefix elba_

Quoted 11 lines
Quoted 11 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +11 -0
+{
+       unsigned long dlyrv_reg;
+
+       dlyrv_reg = ((unsigned long)data << 8);
+       dlyrv_reg |= addr;
+
+       // set data and address
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+       dlyrv_reg |= (1uL << 24uL);
+       // send write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
Quoted 8 lines

drivers/mmc/host/sdhci-cadence-elba.c line 102

Quoted 6 lines
drivers/mmc/host/sdhci-cadence-elba.c new file +6 -0
+       dlyrv_reg &= ~(1uL << 24);
+       // clear write request
+       writel(dlyrv_reg, host->ioaddr + SDIO_REG_HRS4);
+}
+
+static void phy_config(struct sdhci_host *host)

Ditto.

Yes, C syntax only. Refactored to use existing sdhci_cdns_phy_init() and removed phy_config().

Quoted 10 lines

drivers/mmc/host/sdhci-cadence.c static const struct dev_pm_ops sdhci_cdns_pm_ops = { · line 449

Quoted 8 lines
drivers/mmc/host/sdhci-cadence.c +2 -1
@@ -453,8 +444,14 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = {
 static const struct of_device_id sdhci_cdns_match[] = {
        {
                .compatible = "socionext,uniphier-sd4hc",
-               .data = &sdhci_cdns_uniphier_pltfm_data,
+               .data = &sdhci_cdns_uniphier_drv_data,
        },
+#ifdef CONFIG_MMC_SDHCI_CADENCE_ELBA

No need to hide this minor piece of code behind ifdefs.

No longer hidden by an ifdef, the config option
CONFIG_MMC_SDHCI_CADENCE_ELBA is gone.

Quoted 5 lines

drivers/mmc/host/sdhci-cadence.h

Quoted 2 lines
drivers/mmc/host/sdhci-cadence.h new file +0 -0

This new header file can go away too, if you fold in all the code in the common c-file.

Exactly, the added file sdhci-cadence.h is gone.

Regards,
Brad

#24 lore raw

PATCH v2 6/13 arm64: Add config for Pensando SoC platforms

In reply to Brad Larson

Add ARCH_PENSANDO configuration option for Pensando SoC based platforms.

---
 arch/arm64/Kconfig.platforms | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/Kconfig.platforms +5 -0
index cdfd5fed457f..803e7cf1df55 100644
@@ -210,6 +210,11 @@ config ARCH_MXC
 	  This enables support for the ARMv8 based SoCs in the
 	  NXP i.MX family.
 
+config ARCH_PENSANDO
+	bool "Pensando Platforms"
+	help
+	  This enables support for the ARMv8 based Pensando chipsets
+
 config ARCH_QCOM
 	bool "Qualcomm Platforms"
 	select GPIOLIB
Signature · 1 line
2.17.1
#25 lore raw

PATCH v2 7/13 arm64: dts: Add Pensando Elba SoC support

In reply to Brad Larson

Add Pensando common and Elba SoC specific device nodes

---
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/pensando/Makefile         |   6 +
 arch/arm64/boot/dts/pensando/elba-16core.dtsi | 170 ++++++++++
 .../boot/dts/pensando/elba-asic-common.dtsi   | 112 +++++++
 arch/arm64/boot/dts/pensando/elba-asic.dts    |   7 +
 .../boot/dts/pensando/elba-flash-parts.dtsi   |  78 +++++
 arch/arm64/boot/dts/pensando/elba.dtsi        | 310 ++++++++++++++++++
 7 files changed, 684 insertions(+)
 create mode 100644 arch/arm64/boot/dts/pensando/Makefile
 create mode 100644 arch/arm64/boot/dts/pensando/elba-16core.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic-common.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic.dts
 create mode 100644 arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba.dtsi
arch/arm64/boot/dts/Makefile +1 -0
index f1173cd93594..c85db0a097fe 100644
@@ -19,6 +19,7 @@ subdir-y += marvell
 subdir-y += mediatek
 subdir-y += microchip
 subdir-y += nvidia
+subdir-y += pensando
 subdir-y += qcom
 subdir-y += realtek
 subdir-y += renesas
arch/arm64/boot/dts/pensando/Makefile new file +6 -0
new file mode 100644
index 000000000000..0c2c0961e64a
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_PENSANDO_ELBA_SOC) += elba-asic.dtb
+
+always-y	:= $(dtb-y)
+subdir-y	:= $(dts-dirs)
+clean-files	:= *.dtb
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +170 -0

170 lines not on this page · raw message

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +112 -0

112 lines not on this page · raw message

arch/arm64/boot/dts/pensando/elba-asic.dts new file +7 -0
new file mode 100644
index 000000000000..d074b1f1574a
@@ -0,0 +1,7 @@
+
+/dts-v1/;
+
+#include "elba.dtsi"
+#include "elba-16core.dtsi"
+#include "elba-asic-common.dtsi"
+#include "elba-flash-parts.dtsi"
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +78 -0

78 lines not on this page · raw message

arch/arm64/boot/dts/pensando/elba.dtsi new file +310 -0

310 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#26 lore raw

Re: [PATCH v2 07/13] arm64: dts: Add Pensando Elba SoC support

Quoted 1 line · Brad Larson

Add Pensando common and Elba SoC specific device nodes

Build your dtb with W=1 and 'make dtbs_check' and fix warnings.

Quoted 75 lines
---
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/pensando/Makefile         |   6 +
 arch/arm64/boot/dts/pensando/elba-16core.dtsi | 170 ++++++++++
 .../boot/dts/pensando/elba-asic-common.dtsi   | 112 +++++++
 arch/arm64/boot/dts/pensando/elba-asic.dts    |   7 +
 .../boot/dts/pensando/elba-flash-parts.dtsi   |  78 +++++
 arch/arm64/boot/dts/pensando/elba.dtsi        | 310 ++++++++++++++++++
 7 files changed, 684 insertions(+)
 create mode 100644 arch/arm64/boot/dts/pensando/Makefile
 create mode 100644 arch/arm64/boot/dts/pensando/elba-16core.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic-common.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic.dts
 create mode 100644 arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba.dtsi
arch/arm64/boot/dts/Makefile +1 -0
index f1173cd93594..c85db0a097fe 100644
@@ -19,6 +19,7 @@ subdir-y += marvell
 subdir-y += mediatek
 subdir-y += microchip
 subdir-y += nvidia
+subdir-y += pensando
 subdir-y += qcom
 subdir-y += realtek
 subdir-y += renesas
arch/arm64/boot/dts/pensando/Makefile new file +6 -0
new file mode 100644
index 000000000000..0c2c0961e64a
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_PENSANDO_ELBA_SOC) += elba-asic.dtb
+
+always-y	:= $(dtb-y)
+subdir-y	:= $(dts-dirs)
+clean-files	:= *.dtb
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +27 -0
new file mode 100644
index 000000000000..a6c47899b69a
@@ -0,0 +1,170 @@
+
+/ {
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu-map {
+			cluster0 {
+				core0 { cpu = <&cpu0>; };
+				core1 { cpu = <&cpu1>; };
+				core2 { cpu = <&cpu2>; };
+				core3 { cpu = <&cpu3>; };
+			};
+			cluster1 {
+				core0 { cpu = <&cpu4>; };
+				core1 { cpu = <&cpu5>; };
+				core2 { cpu = <&cpu6>; };
+				core3 { cpu = <&cpu7>; };
+			};
+			cluster2 {
+				core0 { cpu = <&cpu8>; };
+				core1 { cpu = <&cpu9>; };
+				core2 { cpu = <&cpu10>; };
+				core3 { cpu = <&cpu11>; };
+			};
+			cluster3 {
+				core0 { cpu = <&cpu12>; };

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 37

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +10 -0
+				core1 { cpu = <&cpu13>; };
+				core2 { cpu = <&cpu14>; };
+				core3 { cpu = <&cpu15>; };
+			};
+		};
+
+		// CLUSTER 0
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";

This should give you a warning.

Quoted 163 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +133 -0
+			reg = <0 0x0>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x1>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x2>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x3>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+
+		l2_0: l2-cache0 {
+			compatible = "cache";
+		};
+
+		// CLUSTER 1
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x100>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x101>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x102>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x103>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+
+		l2_1: l2-cache1 {
+			compatible = "cache";
+		};
+
+		// CLUSTER 2
+		cpu8: cpu@200 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x200>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu9: cpu@201 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x201>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu10: cpu@202 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x202>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu11: cpu@203 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x203>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+
+		l2_2: l2-cache2 {
+			compatible = "cache";
+		};
+
+		// CLUSTER 3
+		cpu12: cpu@300 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x300>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu13: cpu@301 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x301>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu14: cpu@302 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x302>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu15: cpu@303 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x303>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+
+		l2_3: l2-cache3 {
+			compatible = "cache";
+		};
+	};
+};
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +24 -0
new file mode 100644
index 000000000000..7de2c35e7fcc
@@ -0,0 +1,112 @@
+
+/ {
+	model = "Elba ASIC Board";
+
+	aliases {
+		serial0 = &uart0;
+                spi0 = &spi0;
+                spi1 = &qspi;
+	};
+
+	chosen {
+		stdout-path = "serial0:19200n8";
+	};
+};
+
+&ahb_clk {
+	clock-frequency = <400000000>;
+};
+
+&emmc_clk {
+	clock-frequency = <200000000>;
+};
+
+&flash_clk {

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 34

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +10 -0
+	clock-frequency = <400000000>;
+};
+
+&ref_clk {
+	clock-frequency = <156250000>;
+};
+
+&qspi {
+	status = "okay";
+	flash0: mt25q@0 {

flash@0

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 35

Quoted 1 line
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +1 -0
+		compatible = "jdec,spi-nor";

jedec,spi-nor

Quoted 37 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +37 -0
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		spi-rx-bus-width = <2>;
+		m25p,fast-read;
+		cdns,read-delay = <0>;
+		cdns,tshsl-ns = <0>;
+		cdns,tsd2d-ns = <0>;
+		cdns,tchsh-ns = <0>;
+		cdns,tslch-ns = <0>;
+	};
+};
+
+&gpio0 {
+	status = "ok";
+};
+
+&emmc {
+	bus-width = <8>;
+	status = "ok";
+};
+
+&wdt0 {
+	status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <100000>;
+	status = "okay";
+	tmp451@4c {
+		compatible = "ti,tmp451";
+		reg = <0x4c>;
+	};
+	tps53659@62 {
+		compatible = "ti,tps53659";
+		reg = <0x62>;
+	};
+	pcf85263@51 {

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 82

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +10 -0
+		compatible = "nxp,pcf85263";
+		reg = <0x51>;
+	};
+};
+
+&spi0 {
+	num-cs = <4>;
+	cs-gpios = <&spics 0 0>, <&spics 1 0>, <&porta 1 0>, <&porta 7 0>;
+	status = "okay";
+	spi@0 {

'spi@' is reserved for SPI controllers.

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 83

Quoted 1 line
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +1 -0
+		compatible = "pensando,cpld";

Any new compatibles need to be documented with schema.

Quoted 48 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +29 -0
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <0>;
+	};
+	spi@1 {
+		compatible = "pensando,cpld";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <1>;
+	};
+	spi@2 {
+		compatible = "pensando,cpld-rd1173";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <2>;
+		interrupt-parent = <&porta>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+	spi@3 {
+		compatible = "pensando,cpld";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <3>;
+	};
+};
arch/arm64/boot/dts/pensando/elba-asic.dts new file +7 -0
new file mode 100644
index 000000000000..d074b1f1574a
@@ -0,0 +1,7 @@
+
+/dts-v1/;
+
+#include "elba.dtsi"
+#include "elba-16core.dtsi"
+#include "elba-asic-common.dtsi"
+#include "elba-flash-parts.dtsi"
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +0 -0
new file mode 100644
index 000000000000..7fff1d653592

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 3

Quoted 3 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +3 -0
@@ -0,0 +1,78 @@
+&flash0 {
+	partitions {
+		compatible = "fixed-partitions";

This should just be moved into elba-asic-common.dtsi IMO unless you have good reasons to keep it separate.

Quoted 81 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +75 -0
+		#address-cells = <1>;
+		#size-cells = <1>;
+		partition@0 {
+			label = "flash";
+			reg = <0x00010000 0x0fff0000>;
+		};
+		partition@f0000 {
+			label = "golduenv";
+			reg = <0x000f0000 0x00010000>;
+		};
+		partition@100000 {
+			label = "boot0";
+			reg = <0x00100000 0x00080000>;
+		};
+		partition@180000 {
+			label = "golduboot";
+			reg = <0x00180000 0x00200000>;
+		};
+		partition@400000 {
+			label = "goldfw";
+			reg = <0x00400000 0x03c00000>;
+		};
+		partition@4010000 {
+			label = "fwmap";
+			reg = <0x04010000 0x00020000>;
+		};
+		partition@4030000 {
+			label = "fwsel";
+			reg = <0x04030000 0x00020000>;
+		};
+		partition@4090000 {
+			label = "bootlog";
+			reg = <0x04090000 0x00020000>;
+		};
+		partition@40b0000 {
+			label = "panicbuf";
+			reg = <0x040b0000 0x00020000>;
+		};
+		partition@40d0000 {
+			label = "uservars";
+			reg = <0x040d0000 0x00020000>;
+		};
+		partition@4200000 {
+			label = "uboota";
+			reg = <0x04200000 0x00400000>;
+		};
+		partition@4600000 {
+			label = "ubootb";
+			reg = <0x04600000 0x00400000>;
+		};
+		partition@4a00000 {
+			label = "mainfwa";
+			reg = <0x04a00000 0x01000000>;
+		};
+		partition@5a00000 {
+			label = "mainfwb";
+			reg = <0x05a00000 0x01000000>;
+		};
+		partition@8000000 {
+			label = "diagfw";
+			reg = <0x08000000 0x07fe0000>;
+		};
+		partition@ffe0000 {
+			label = "ubootenv";
+			reg = <0x0ffe0000 0x00010000>;
+		};
+	};
+};
+
+&soc {
+	panicdump@740b0000 {
+		compatible = "pensando,capri-crash";
+		reg = <0x0 0x740b0000 0x0 0x00020000>;
+	};
+};
arch/arm64/boot/dts/pensando/elba.dtsi new file +0 -0
new file mode 100644
index 000000000000..6f6cfab2b502

arch/arm64/boot/dts/pensando/elba.dtsi line 1

Quoted 1 line
arch/arm64/boot/dts/pensando/elba.dtsi new file +1 -0
@@ -0,0 +1,310 @@
+

You need SPDX license tags at the top of each file. checkpatch.pl should tell you this.

arch/arm64/boot/dts/pensando/elba.dtsi line 12

Quoted 11 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +11 -0
+/*
+ * Copyright (c) 2019, Pensando Systems Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "dt-bindings/interrupt-controller/arm-gic.h"
+
+/ {
+	compatible = "pensando,elba";

This needs an SoC family schema.

Generally this and 'model' should be in the same file (the board file).

arch/arm64/boot/dts/pensando/elba.dtsi line 18

Quoted 6 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +6 -0
+
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	clocks {

Drop this container node.

Quoted 30 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +30 -0
+		ahb_clk: oscillator0 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		emmc_clk: oscillator2 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		flash_clk: oscillator3 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		ref_clk: oscillator4 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>;
+	};
+

arch/arm64/boot/dts/pensando/elba.dtsi line 58

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+	pmu {
+		compatible = "arm,cortex-a72-pmu";
+		interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(1) |
+				IRQ_TYPE_LEVEL_LOW)>;
+	};
+
+	/* Common UIO device for MSI drivers */
+	uio_penmsi {
+		compatible = "pensando,uio_penmsi";
+		name = "uio_penmsi";

No. What's UIO?

arch/arm64/boot/dts/pensando/elba.dtsi line 68

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+	};
+
+
+	soc: soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller@800000 {

Order nodes by increasing unit address.

Quoted 17 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +17 -0
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <3>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			interrupt-controller;
+			reg = <0x0 0x800000 0x0 0x200000>,	// GICD
+			      <0x0 0xa00000 0x0 0x200000>;	// GICR
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+
+			its: interrupt-controller@820000 {
+				compatible = "arm,gic-v3-its";
+				msi-controller;
+				#msi-cells = <1>;
+				reg = <0x0 0x820000 0x0 0x10000>;
+				socionext,synquacer-pre-its =
+							<0xc00000 0x1000000>;

arch/arm64/boot/dts/pensando/elba.dtsi line 95

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+			};
+		};
+
+		/*
+		 * Until we  know the interrupt domain following this, we
+		 * are forced to use this is the place where interrupts from
+		 * PCI converge. In the ideal case, we use one domain higher,
+		 * where the PCI-ness has been shed.
+		 */
+		pxc0_intr: intc@20102200 {

interrupt-controller@...

arch/arm64/boot/dts/pensando/elba.dtsi line 106

Quoted 11 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +11 -0
+			compatible = "pensando,soc-ictlr-csrintr";
+			interrupt-controller;
+			reg = <0x0 0x20102200 0x0 0x4>;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "pxc0_intr";
+		};
+
+		uart0: serial@4800 {
+			device_type = "serial";

Drop 'device_type'. It's deprecated for all but memory and pci.

Quoted 20 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +20 -0
+			compatible = "ns16550a";
+			reg = <0x0 0x4800 0x0 0x100>;
+			clocks = <&ref_clk>;
+			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+		};
+
+		qspi: spi@2400 {
+			compatible = "pensando,cdns-qspi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x0 0x2400 0x0 0x400>,
+			      <0x0 0x7fff0000 0x0 0x1000>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&flash_clk>;
+			cdns,fifo-depth = <1024>;
+			cdns,fifo-width = <4>;
+			cdns,trigger-address = <0x7fff0000>;
+			status = "disabled";

arch/arm64/boot/dts/pensando/elba.dtsi line 136

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+		};
+
+		gpio0: gpio@4000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "snps,dw-apb-gpio";
+			reg = <0x0 0x4000 0x0 0x78>;
+			status = "disabled";
+
+			porta: gpio-controller@0 {

gpio@0

Quoted 22 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +22 -0
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <0>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				ngpios = <8>;
+				interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-controller;
+				interrupt-parent = <&gic>;
+				#interrupt-cells = <2>;
+			};
+			portb: gpio-controller@1 {
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <1>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				ngpios = <8>;
+			};
+		};
+
+		i2c0: i2c@400 {
+			compatible = "snps,designware-i2c";
+			reg = <0x0 0x400 0x0 0x100>;

arch/arm64/boot/dts/pensando/elba.dtsi line 168

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+			clocks = <&ahb_clk>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			i2c-sda-hold-time-ns = <480>;
+			snps,sda-timeout-ms = <750>;
+			interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		/* UIO device using interrupt line PCIEMAC */

UIO is a kernel thing. It doesn't belong in DT.

Quoted 4 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +4 -0
+		pciemac@20102200 {
+			#address-cells = <2>;
+			#size-cells = <2>;
+			#interrupt-cells = <3>;

arch/arm64/boot/dts/pensando/elba.dtsi line 182

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+
+			compatible = "pensando,uio_pciemac";
+			register-type = "csr-interrupt";
+			interrupt-parent = <&pxc0_intr>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			reg = <0x0 0x20102200 0x0 0x10>; /* pxc0_intr */
+
+			enable_csr_paddr = <0x0 0x20102200 0x0 0x10>;
+			enable_mask = <(1 << 0)>;
+		};

This needs some work, but no idea what the h/w is to give any guidance.

Quoted 45 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +45 -0
+
+		/* MSI UIO device 1 */
+		uio_penmsi1@520000 {
+			compatible = "pensando,uio_penmsi1";
+			reg = <0x0 0x520000 0x0 0x10000>;
+			msi-parent = <&its 0xa>;
+			num-interrupts = <16>;  /* # MSI interrupts to get */
+		};
+
+		spics: spics@307c2468 {
+			compatible = "pensando,elba-spics";
+			reg = <0x0 0x307c2468 0x0 0x4>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		spi0: spi@2800 {
+			compatible = "pensando,elba-spi";
+			reg = <0x0 0x2800 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			num-cs = <2>;
+			status = "disabled";
+		};
+
+		wdt0: watchdog@1400 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1400 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt1: watchdog@1800 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1800 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt2: watchdog@1c00 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1c00 0x0 0x100>;
+			clocks = <&ahb_clk>;

arch/arm64/boot/dts/pensando/elba.dtsi line 237

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +10 -0
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt3: watchdog@2000 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x2000 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};

4 watchdogs? Hope that's enough... ;)

arch/arm64/boot/dts/pensando/elba.dtsi line 244

Quoted 7 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +7 -0
+
+		emmc: mmc@30440000 {
+			compatible = "pensando,elba-emmc", "cdns,sd4hc";
+			clocks = <&emmc_clk>;
+			interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+			reg = <0x0 0x30440000 0x0 0x10000
+			       0x0 0x30480044 0x0 0x4>;

Use <> around each entry.

Quoted 69 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +66 -0
+			cdns,phy-input-delay-sd-highspeed = <0x4>;
+			cdns,phy-input-delay-legacy = <0x4>;
+			cdns,phy-input-delay-sd-uhs-sdr50 = <0x6>;
+			cdns,phy-input-delay-sd-uhs-ddr50 = <0x16>;
+			cdns,mmc-ddr-1_8v;
+			status = "disabled";
+		} ;
+
+		pcie@307c2480 {
+			compatible = "pensando,pcie";
+			reg = <0x0 0x307c2480 0x0 0x4   /* MS CFG_WDT */
+			       0x0 0x00001400 0x0 0x10  /* WDT0 */
+			       0x0 0x20000000 0x0 0x00380000>; /* PXB Base */
+		};
+
+		panic: panicdump@0 {
+			compatible = "pensando,pen-crash";
+			status = "disabled";
+		};
+
+		bsm@307c2080 {
+			compatible = "pensando,bsm";
+			reg = <0x0 0x307c2080 0x0 0x4>;
+		};
+	};
+	mnet0: mnet0 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x0>;
+	};
+	mnet1: mnet1 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x1>;
+	};
+	mnet2: mnet2 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x2>;
+	};
+	mnet3: mnet3 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x3>;
+	};
+	mnet4: mnet4 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x4>;
+	};
+	mnet5: mnet5 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x5>;
+	};
+	mnet6: mnet6 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x6>;
+	};
+	mnet7: mnet7 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x7>;
+	};
+	mnet8: mnet8 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x8>;
+	};
+	mnet9: mnet9 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x9>;
+	};
+};
Signature · 1 line
2.17.1
#27 lore raw

Re: [PATCH v2 07/13] arm64: dts: Add Pensando Elba SoC support

Hi Rob,

Quoted 5 lines · Rob Herring
Quoted 1 line · Brad Larson

Add Pensando common and Elba SoC specific device nodes

Build your dtb with W=1 and 'make dtbs_check' and fix warnings.

I'll do that thanks.

Quoted 7 lines

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 37

Quoted 5 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +5 -0
+
+             // CLUSTER 0
+             cpu0: cpu@0 {
+                     device_type = "cpu";
+                     compatible = "arm,cortex-a72", "arm,armv8";

This should give you a warning.

I'll be sure to W=1 and make dtbs_check. All the C++ comments are C syntax now.

Quoted 5 lines

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 34

Quoted 3 lines

+&qspi {

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +2 -0
+     status = "okay";
+     flash0: mt25q@0 {

flash@0

Yes, generic node name should be used. Changed mt25q to flash.
- flash0: mt25q@0 {
+ flash0: flash@0 {

Quoted 3 lines
Quoted 1 line

+ compatible = "jdec,spi-nor";

jedec,spi-nor

Changed jdec to jedec
- compatible = "jdec,spi-nor";
+ compatible = "jedec,spi-nor";

Quoted 3 lines
Quoted 1 line

+ spi@0 {

'spi@' is reserved for SPI controllers.

Changed the node name to indicate the spi bus number and chip select

&spi0 {
        num-cs = <4>;
        cs-gpios = <&spics 0 GPIO_ACTIVE_LOW>, <&spics 1 GPIO_ACTIVE_LOW>,
                   <&porta 1 GPIO_ACTIVE_LOW>, <&porta 7 GPIO_ACTIVE_LOW>;
        status = "okay";
-       spi@0 {
+       spi0_cs0@0 {
                compatible = "pensando,cpld";
                #address-cells = <1>;
                #size-cells = <1>;
                spi-max-frequency = <12000000>;
                reg = <0>;
        };
-       spi@1 {
+       spi0_cs1@1 {
        ...
Quoted 3 lines
Quoted 1 line

+ compatible = "pensando,cpld";

Any new compatibles need to be documented with schema.

I'll create the bindings file for the v3 patchset dependent on the discussion revolving around adding pensando,cpld to this list in spi/spidev.c.

static const struct of_device_id spidev_dt_ids[] = {
        { .compatible = "rohm,dh2228fv" },
        { .compatible = "lineartechnology,ltc2488" },
        { .compatible = "ge,achc" },
        { .compatible = "semtech,sx1301" },
        { .compatible = "lwn,bk4" },
        { .compatible = "dh,dhcom-board" },
        { .compatible = "menlo,m53cpld" },
        { .compatible = "pensando,cpld" },    <===
        {},
};

MODULE_DEVICE_TABLE(of, spidev_dt_ids);

Quoted 9 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 3

Quoted 6 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +3 -0
@@ -0,0 +1,78 @@
+&flash0 {
+     partitions {
+             compatible = "fixed-partitions";

This should just be moved into elba-asic-common.dtsi IMO unless you have good reasons to keep it separate.

This file is shared across platforms which have additional flash devices and partition schemes.

Quoted 2 lines

You need SPDX license tags at the top of each file. checkpatch.pl should tell you this.

I don't recall checkpatch.pl reporting that for device tree files. I've added to each file now.

Quoted 14 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 14

Quoted 11 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +11 -0
+/*
+ * Copyright (c) 2019, Pensando Systems Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "dt-bindings/interrupt-controller/arm-gic.h"
+
+/ {
+     compatible = "pensando,elba";

This needs an SoC family schema.

Quoted 1 line

Generally this and 'model' should be in the same file (the board file).

Will add schema for pensando,elba in the v3 patchset. The compatible and model are now in the board file elba-asic.dts as shown below

+/ {
+ model = "Elba ASIC Board";
+ compatible = "pensando,elba";
+
+ aliases {

+               serial0 = &uart0;
+               spi0 = &spi0;
+               spi1 = &qspi;

+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+};

Quoted 8 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 20

Quoted 6 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +6 -0
+
+     interrupt-parent = <&gic>;
+     #address-cells = <2>;
+     #size-cells = <2>;
+
+     clocks {

Drop this container node.

Removed the container node.

Quoted 6 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 24

Quoted 4 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +4 -0
+     /* Common UIO device for MSI drivers */
+     uio_penmsi {
+             compatible = "pensando,uio_penmsi";
+             name = "uio_penmsi";

No. What's UIO?

UIO nodes are removed, only core SoC support will be included

Quoted 9 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 31

Quoted 7 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +7 -0
+     soc: soc {
+             compatible = "simple-bus";
+             #address-cells = <2>;
+             #size-cells = <2>;
+             ranges;
+
+             gic: interrupt-controller@800000 {

Order nodes by increasing unit address.

Yes, I've done this and will be part of the v3 patchset

Quoted 9 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 38

Quoted 7 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +7 -0
+             /*
+              * Until we  know the interrupt domain following this, we
+              * are forced to use this is the place where interrupts from
+              * PCI converge. In the ideal case, we use one domain higher,
+              * where the PCI-ness has been shed.
+              */
+             pxc0_intr: intc@20102200 {

interrupt-controller@...

Changed intc to interrupt-controller

Quoted 12 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 49

Quoted 11 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +11 -0
+                     compatible = "pensando,soc-ictlr-csrintr";
+                     interrupt-controller;
+                     reg = <0x0 0x20102200 0x0 0x4>;
+                     #interrupt-cells = <3>;
+                     interrupt-parent = <&gic>;
+                     interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                     interrupt-names = "pxc0_intr";
+             };
+
+             uart0: serial@4800 {
+                     device_type = "serial";
Quoted 2 lines

Drop 'device_type'. It's deprecated for all but memory and pci.

Removed device_type = "serial";

Quoted 10 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 57

Quoted 8 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +8 -0
+             gpio0: gpio@4000 {
+                     #address-cells = <1>;
+                     #size-cells = <0>;
+                     compatible = "snps,dw-apb-gpio";
+                     reg = <0x0 0x4000 0x0 0x78>;
+                     status = "disabled";
+
+                     porta: gpio-controller@0 {

gpio@0

Changed from gpio@0 to gpio-port@0 based on additional reviewer input

- porta: gpio-controller@0 {
+ porta: gpio-port@0 {

Quoted 4 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 59

Quoted 2 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +2 -0
+
+             /* UIO device using interrupt line PCIEMAC */

UIO is a kernel thing. It doesn't belong in DT.

UIO nodes are removed for core SoC support patchset

Quoted 9 lines

arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi line 66

Quoted 7 lines
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +7 -0
+
+             emmc: mmc@30440000 {
+                     compatible = "pensando,elba-emmc", "cdns,sd4hc";
+                     clocks = <&emmc_clk>;
+                     interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+                     reg = <0x0 0x30440000 0x0 0x10000
+                            0x0 0x30480044 0x0 0x4>;

Use <> around each entry.

The system fails to boot if I make that change, mmc probe fails and rootfs not found

- reg = <0x0 0x30440000 0x0 0x10000
- 0x0 0x30480044 0x0 0x4>;
+ reg = <0x0 0x30440000 0x0 0x10000>,
+ <0x0 0x30480044 0x0 0x4>;

Regards,
Brad

#28 lore raw

Re: [PATCH v2 07/13] arm64: dts: Add Pensando Elba SoC support

In reply to Brad Larson

Rob,
Could you give your opinion on my comment regarding the nodes layout in this dts-file. I was told to fix a similar problem in one of patches submitted by me some time ago. Please see my last comment in this message.

Quoted 74 lines · Brad Larson

Add Pensando common and Elba SoC specific device nodes

---
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/pensando/Makefile         |   6 +
 arch/arm64/boot/dts/pensando/elba-16core.dtsi | 170 ++++++++++
 .../boot/dts/pensando/elba-asic-common.dtsi   | 112 +++++++
 arch/arm64/boot/dts/pensando/elba-asic.dts    |   7 +
 .../boot/dts/pensando/elba-flash-parts.dtsi   |  78 +++++
 arch/arm64/boot/dts/pensando/elba.dtsi        | 310 ++++++++++++++++++
 7 files changed, 684 insertions(+)
 create mode 100644 arch/arm64/boot/dts/pensando/Makefile
 create mode 100644 arch/arm64/boot/dts/pensando/elba-16core.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic-common.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic.dts
 create mode 100644 arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba.dtsi
arch/arm64/boot/dts/Makefile +1 -0
index f1173cd93594..c85db0a097fe 100644
@@ -19,6 +19,7 @@ subdir-y += marvell
 subdir-y += mediatek
 subdir-y += microchip
 subdir-y += nvidia
+subdir-y += pensando
 subdir-y += qcom
 subdir-y += realtek
 subdir-y += renesas
arch/arm64/boot/dts/pensando/Makefile new file +6 -0
new file mode 100644
index 000000000000..0c2c0961e64a
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_PENSANDO_ELBA_SOC) += elba-asic.dtb
+
+always-y	:= $(dtb-y)
+subdir-y	:= $(dts-dirs)
+clean-files	:= *.dtb
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +25 -0
new file mode 100644
index 000000000000..a6c47899b69a
@@ -0,0 +1,170 @@
+
+/ {
+	cpus {
+		#address-cells = <2>;
+		#size-cells = <0>;
+
+		cpu-map {
+			cluster0 {
+				core0 { cpu = <&cpu0>; };
+				core1 { cpu = <&cpu1>; };
+				core2 { cpu = <&cpu2>; };
+				core3 { cpu = <&cpu3>; };
+			};
+			cluster1 {
+				core0 { cpu = <&cpu4>; };
+				core1 { cpu = <&cpu5>; };
+				core2 { cpu = <&cpu6>; };
+				core3 { cpu = <&cpu7>; };
+			};
+			cluster2 {
+				core0 { cpu = <&cpu8>; };
+				core1 { cpu = <&cpu9>; };
+				core2 { cpu = <&cpu10>; };
+				core3 { cpu = <&cpu11>; };
+			};

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 34

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +9 -0
+			cluster3 {
+				core0 { cpu = <&cpu12>; };
+				core1 { cpu = <&cpu13>; };
+				core2 { cpu = <&cpu14>; };
+				core3 { cpu = <&cpu15>; };
+			};
+		};
+
 
+		// CLUSTER 0

What does chackpatch.pl tell you about C++ comment?

Quoted 25 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +25 -0
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x0>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x1>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x2>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x3>;

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 68

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +9 -0
+			enable-method = "spin-table";
+			next-level-cache = <&l2_0>;
+		};
+
+		l2_0: l2-cache0 {
+			compatible = "cache";
+		};
+
 
+		// CLUSTER 1

ditto

Quoted 25 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +25 -0
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x100>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x101>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x102>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x103>;

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 102

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +9 -0
+			enable-method = "spin-table";
+			next-level-cache = <&l2_1>;
+		};
+
+		l2_1: l2-cache1 {
+			compatible = "cache";
+		};
+
 
+		// CLUSTER 2

ditto

Quoted 25 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +25 -0
+		cpu8: cpu@200 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x200>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu9: cpu@201 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x201>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu10: cpu@202 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x202>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+		cpu11: cpu@203 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x203>;

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 136

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +9 -0
+			enable-method = "spin-table";
+			next-level-cache = <&l2_2>;
+		};
+
+		l2_2: l2-cache2 {
+			compatible = "cache";
+		};
+
 
+		// CLUSTER 3

ditto

Quoted 40 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +34 -0
+		cpu12: cpu@300 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x300>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu13: cpu@301 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x301>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu14: cpu@302 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x302>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+		cpu15: cpu@303 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a72", "arm,armv8";
+			reg = <0 0x303>;
+			enable-method = "spin-table";
+			next-level-cache = <&l2_3>;
+		};
+
+		l2_3: l2-cache3 {
+			compatible = "cache";
+		};
+	};
+};
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +0 -0
new file mode 100644
index 000000000000..7de2c35e7fcc

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 8

Quoted 9 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +8 -0
@@ -0,0 +1,112 @@
+
+/ {
+	model = "Elba ASIC Board";
+
+	aliases {
 
+		serial0 = &uart0;
+                spi0 = &spi0;
+                spi1 = &qspi;

Brad, if you checkpatch.pl'ed this patch, that would have told you regarding leading spaces here.

Quoted 296 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +104 -0
+	};
+
+	chosen {
+		stdout-path = "serial0:19200n8";
+	};
+};
+
+&ahb_clk {
+	clock-frequency = <400000000>;
+};
+
+&emmc_clk {
+	clock-frequency = <200000000>;
+};
+
+&flash_clk {
+	clock-frequency = <400000000>;
+};
+
+&ref_clk {
+	clock-frequency = <156250000>;
+};
+
+&qspi {
+	status = "okay";
+	flash0: mt25q@0 {
+		compatible = "jdec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+		spi-rx-bus-width = <2>;
+		m25p,fast-read;
+		cdns,read-delay = <0>;
+		cdns,tshsl-ns = <0>;
+		cdns,tsd2d-ns = <0>;
+		cdns,tchsh-ns = <0>;
+		cdns,tslch-ns = <0>;
+	};
+};
+
+&gpio0 {
+	status = "ok";
+};
+
+&emmc {
+	bus-width = <8>;
+	status = "ok";
+};
+
+&wdt0 {
+	status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <100000>;
+	status = "okay";
+	tmp451@4c {
+		compatible = "ti,tmp451";
+		reg = <0x4c>;
+	};
+	tps53659@62 {
+		compatible = "ti,tps53659";
+		reg = <0x62>;
+	};
+	pcf85263@51 {
+		compatible = "nxp,pcf85263";
+		reg = <0x51>;
+	};
+};
+
+&spi0 {
+	num-cs = <4>;
+	cs-gpios = <&spics 0 0>, <&spics 1 0>, <&porta 1 0>, <&porta 7 0>;
+	status = "okay";
+	spi@0 {
+		compatible = "pensando,cpld";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <0>;
+	};
+	spi@1 {
+		compatible = "pensando,cpld";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <1>;
+	};
+	spi@2 {
+		compatible = "pensando,cpld-rd1173";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <2>;
+		interrupt-parent = <&porta>;
+		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+	};
+	spi@3 {
+		compatible = "pensando,cpld";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <12000000>;
+		reg = <3>;
+	};
+};
arch/arm64/boot/dts/pensando/elba-asic.dts new file +7 -0
new file mode 100644
index 000000000000..d074b1f1574a
@@ -0,0 +1,7 @@
+
+/dts-v1/;
+
+#include "elba.dtsi"
+#include "elba-16core.dtsi"
+#include "elba-asic-common.dtsi"
+#include "elba-flash-parts.dtsi"
arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi new file +78 -0
new file mode 100644
index 000000000000..7fff1d653592
@@ -0,0 +1,78 @@
+&flash0 {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		partition@0 {
+			label = "flash";
+			reg = <0x00010000 0x0fff0000>;
+		};
+		partition@f0000 {
+			label = "golduenv";
+			reg = <0x000f0000 0x00010000>;
+		};
+		partition@100000 {
+			label = "boot0";
+			reg = <0x00100000 0x00080000>;
+		};
+		partition@180000 {
+			label = "golduboot";
+			reg = <0x00180000 0x00200000>;
+		};
+		partition@400000 {
+			label = "goldfw";
+			reg = <0x00400000 0x03c00000>;
+		};
+		partition@4010000 {
+			label = "fwmap";
+			reg = <0x04010000 0x00020000>;
+		};
+		partition@4030000 {
+			label = "fwsel";
+			reg = <0x04030000 0x00020000>;
+		};
+		partition@4090000 {
+			label = "bootlog";
+			reg = <0x04090000 0x00020000>;
+		};
+		partition@40b0000 {
+			label = "panicbuf";
+			reg = <0x040b0000 0x00020000>;
+		};
+		partition@40d0000 {
+			label = "uservars";
+			reg = <0x040d0000 0x00020000>;
+		};
+		partition@4200000 {
+			label = "uboota";
+			reg = <0x04200000 0x00400000>;
+		};
+		partition@4600000 {
+			label = "ubootb";
+			reg = <0x04600000 0x00400000>;
+		};
+		partition@4a00000 {
+			label = "mainfwa";
+			reg = <0x04a00000 0x01000000>;
+		};
+		partition@5a00000 {
+			label = "mainfwb";
+			reg = <0x05a00000 0x01000000>;
+		};
+		partition@8000000 {
+			label = "diagfw";
+			reg = <0x08000000 0x07fe0000>;
+		};
+		partition@ffe0000 {
+			label = "ubootenv";
+			reg = <0x0ffe0000 0x00010000>;
+		};
+	};
+};
+
+&soc {
+	panicdump@740b0000 {
+		compatible = "pensando,capri-crash";
+		reg = <0x0 0x740b0000 0x0 0x00020000>;
+	};
+};
arch/arm64/boot/dts/pensando/elba.dtsi new file +89 -0
new file mode 100644
index 000000000000..6f6cfab2b502
@@ -0,0 +1,310 @@
+
+/*
+ * Copyright (c) 2019, Pensando Systems Inc.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include "dt-bindings/interrupt-controller/arm-gic.h"
+
+/ {
+	compatible = "pensando,elba";
+
+	interrupt-parent = <&gic>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	clocks {
+		ahb_clk: oscillator0 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		emmc_clk: oscillator2 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		flash_clk: oscillator3 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+		ref_clk: oscillator4 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(1) |
+					IRQ_TYPE_LEVEL_LOW)>;
+	};
+
+	pmu {
+		compatible = "arm,cortex-a72-pmu";
+		interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(1) |
+				IRQ_TYPE_LEVEL_LOW)>;
+	};
+
+	/* Common UIO device for MSI drivers */
+	uio_penmsi {
+		compatible = "pensando,uio_penmsi";
+		name = "uio_penmsi";
+	};
+
+
+	soc: soc {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		gic: interrupt-controller@800000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <3>;
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			interrupt-controller;
+			reg = <0x0 0x800000 0x0 0x200000>,	// GICD
+			      <0x0 0xa00000 0x0 0x200000>;	// GICR
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
+
+			its: interrupt-controller@820000 {
+				compatible = "arm,gic-v3-its";
+				msi-controller;
+				#msi-cells = <1>;
+				reg = <0x0 0x820000 0x0 0x10000>;
+				socionext,synquacer-pre-its =
+							<0xc00000 0x1000000>;
+			};
+		};
+
+		/*

arch/arm64/boot/dts/pensando/elba.dtsi line 98

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +9 -0
+		 * Until we  know the interrupt domain following this, we
+		 * are forced to use this is the place where interrupts from
+		 * PCI converge. In the ideal case, we use one domain higher,
+		 * where the PCI-ness has been shed.
+		 */
+		pxc0_intr: intc@20102200 {
+			compatible = "pensando,soc-ictlr-csrintr";
+			interrupt-controller;
 
+			reg = <0x0 0x20102200 0x0 0x4>;

Rob, please note the reg-space size here.

Quoted 27 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +27 -0
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "pxc0_intr";
+		};
+
+		uart0: serial@4800 {
+			device_type = "serial";
+			compatible = "ns16550a";
+			reg = <0x0 0x4800 0x0 0x100>;
+			clocks = <&ref_clk>;
+			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+		};
+
+		qspi: spi@2400 {
+			compatible = "pensando,cdns-qspi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x0 0x2400 0x0 0x400>,
+			      <0x0 0x7fff0000 0x0 0x1000>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&flash_clk>;
+			cdns,fifo-depth = <1024>;
+			cdns,fifo-width = <4>;
+			cdns,trigger-address = <0x7fff0000>;

arch/arm64/boot/dts/pensando/elba.dtsi line 133

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +8 -0
+			status = "disabled";
+		};
+
+		gpio0: gpio@4000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "snps,dw-apb-gpio";
 
 
+			reg = <0x0 0x4000 0x0 0x78>;

Brad, are you sure the reg-space is just 0x78 bytes in this DW GPIO module? Normally the system bus blocks are aligned to something no less than 1KB...

arch/arm64/boot/dts/pensando/elba.dtsi line 136

Quoted 4 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +3 -0
+			status = "disabled";
+
 
+			porta: gpio-controller@0 {

Brad, I'd prefer to name the sub-nodes as "gpio-port" for DW APB GPIO because hardware considers each of them as dedicated port of the GPIO controller. I know the bindings file permits using "-controller" suffix, but that is allowed only because the bindings file was submitted much later than the driver was. So I didn't want to have the dtbs_check printing errors for already available dts-files.

Quoted 49 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +49 -0
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <0>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				ngpios = <8>;
+				interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+				interrupt-controller;
+				interrupt-parent = <&gic>;
+				#interrupt-cells = <2>;
+			};
+			portb: gpio-controller@1 {
+				compatible = "snps,dw-apb-gpio-port";
+				reg = <1>;
+				gpio-controller;
+				#gpio-cells = <2>;
+				ngpios = <8>;
+			};
+		};
+
+		i2c0: i2c@400 {
+			compatible = "snps,designware-i2c";
+			reg = <0x0 0x400 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			i2c-sda-hold-time-ns = <480>;
+			snps,sda-timeout-ms = <750>;
+			interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		/* UIO device using interrupt line PCIEMAC */
+		pciemac@20102200 {
+			#address-cells = <2>;
+			#size-cells = <2>;
+			#interrupt-cells = <3>;
+
+			compatible = "pensando,uio_pciemac";
+			register-type = "csr-interrupt";
+			interrupt-parent = <&pxc0_intr>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			reg = <0x0 0x20102200 0x0 0x10>; /* pxc0_intr */
+
+			enable_csr_paddr = <0x0 0x20102200 0x0 0x10>;
+			enable_mask = <(1 << 0)>;
+		};
+
+		/* MSI UIO device 1 */
+		uio_penmsi1@520000 {

arch/arm64/boot/dts/pensando/elba.dtsi line 194

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +9 -0
+			compatible = "pensando,uio_penmsi1";
+			reg = <0x0 0x520000 0x0 0x10000>;
+			msi-parent = <&its 0xa>;
+			num-interrupts = <16>;  /* # MSI interrupts to get */
+		};
+
+		spics: spics@307c2468 {
+			compatible = "pensando,elba-spics";
 
+			reg = <0x0 0x307c2468 0x0 0x4>;

Rob, please note the reg-space base address and size here.

Quoted 41 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +41 -0
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		spi0: spi@2800 {
+			compatible = "pensando,elba-spi";
+			reg = <0x0 0x2800 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			num-cs = <2>;
+			status = "disabled";
+		};
+
+		wdt0: watchdog@1400 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1400 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt1: watchdog@1800 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1800 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt2: watchdog@1c00 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x1c00 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+		wdt3: watchdog@2000 {
+			compatible = "snps,dw-wdt";
+			reg = <0x0 0x2000 0x0 0x100>;
+			clocks = <&ahb_clk>;
+			interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;

arch/arm64/boot/dts/pensando/elba.dtsi line 244

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +9 -0
+			status = "disabled";
+		};
+
+		emmc: mmc@30440000 {
+			compatible = "pensando,elba-emmc", "cdns,sd4hc";
+			clocks = <&emmc_clk>;
+			interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+			reg = <0x0 0x30440000 0x0 0x10000
 
+			       0x0 0x30480044 0x0 0x4>;

Rob, please also note the reg-space base address and size here. Brad just writes some magic numbers to this register in the MMC drive. The field is named as "ctl_addr" in the driver.

arch/arm64/boot/dts/pensando/elba.dtsi line 255

Quoted 12 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +11 -0
+			cdns,phy-input-delay-sd-highspeed = <0x4>;
+			cdns,phy-input-delay-legacy = <0x4>;
+			cdns,phy-input-delay-sd-uhs-sdr50 = <0x6>;
+			cdns,phy-input-delay-sd-uhs-ddr50 = <0x16>;
+			cdns,mmc-ddr-1_8v;
+			status = "disabled";
+		} ;
+
+		pcie@307c2480 {
+			compatible = "pensando,pcie";
 
+			reg = <0x0 0x307c2480 0x0 0x4   /* MS CFG_WDT */

Rob, please note the reg-space base address and size here.

arch/arm64/boot/dts/pensando/elba.dtsi line 267

Quoted 13 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +12 -0
+			       0x0 0x00001400 0x0 0x10  /* WDT0 */
+			       0x0 0x20000000 0x0 0x00380000>; /* PXB Base */
+		};
+
+		panic: panicdump@0 {
+			compatible = "pensando,pen-crash";
+			status = "disabled";
+		};
+
+		bsm@307c2080 {
+			compatible = "pensando,bsm";
 
+			reg = <0x0 0x307c2080 0x0 0x4>;

Rob, please see here having a small sized reg-space one more time. Having so many small-sized registers scattered around the dts file makes me thinking that most of them likely belong to some bigger block like "System Controller". If so then there must be a main node compatible with "syscon" device, which phandle would be referenced in the particular device nodes. Like this:

\ {
	soc {
		syscon: syscon@307c0000 {
			compatible = "pensando,elba-sys-con", "syscon", "simple-mfd";
			reg = <0x0 0x307c0000 0x0 0x10000>;

			spics: spics@307c2468 {
				compatible = "pensando,elba-spics";
				gpio-controller;
				#gpio-cells = <2>;
			};
		};

		pcie@307c2480 {
			compatible = "pensando,pcie";
			reg = <0x0 0x20000000 0x0 0x00380000>; /* PXB Base */

			syscon = <&syscon>;
		};

		/* etc */
	};
};

Rob, what do you think about that? Correct me if I am wrong.

Brad, it's not about "To us it was more understandable" like you responded to my comment in v1, but about having the DTS correctly describing the hardware. Splitting the system controller registers up isn't good in that regard even if you think it makes the driver code more "understandable" and so on.

Also Brad, don't hurry with re-sending the patchset before finishing all the discussions. I'd understand you doing so if noone would have given you any comment in a long time, but you've got tons of them nearly within one-two days after the v1 patchset submission. So you should have answered to the comments first, settled all the issues, then respined the series. Otherwise it seems as if you just disregard all the work the reviewers did giving you the comments.

-Sergey

Quoted 46 lines
arch/arm64/boot/dts/pensando/elba.dtsi new file +43 -0
+		};
+	};
+	mnet0: mnet0 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x0>;
+	};
+	mnet1: mnet1 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x1>;
+	};
+	mnet2: mnet2 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x2>;
+	};
+	mnet3: mnet3 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x3>;
+	};
+	mnet4: mnet4 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x4>;
+	};
+	mnet5: mnet5 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x5>;
+	};
+	mnet6: mnet6 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x6>;
+	};
+	mnet7: mnet7 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x7>;
+	};
+	mnet8: mnet8 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x8>;
+	};
+	mnet9: mnet9 {
+		compatible = "pensando,mnet";
+		msi-parent = <&its 0x9>;
+	};
+};
Signature · 1 line
2.17.1
#29 lore raw

Re: [PATCH v2 07/13] arm64: dts: Add Pensando Elba SoC support

Hi Sergey,

Quoted 9 lines · Serge Semin

Rob,
Could you give your opinion on my comment regarding the nodes layout in this dts-file. I was told to fix a similar problem in one of patches submitted by me some time ago. Please see my last comment in this message.

Quoted 1 line · Brad Larson

Add Pensando common and Elba SoC specific device nodes

[...]

Quoted 5 lines

arch/arm64/boot/dts/pensando/elba-16core.dtsi line 34

Quoted 3 lines
arch/arm64/boot/dts/pensando/elba-16core.dtsi new file +2 -0
+
 
+             // CLUSTER 0

What does chackpatch.pl tell you about C++ comment?

I don't recall a warning for this but I think I forgot to use W=1 to check dtbs. Will make sure it's clean before submitting the v3 patchset.

[...]

Quoted 3 lines
Quoted 1 line

+ // CLUSTER 1

ditto

I've changed all C++ comments to C syntax

[...]

Quoted 12 lines
Quoted 11 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +5 -0
new file mode 100644
index 000000000000..7de2c35e7fcc
@@ -0,0 +1,112 @@
+
+/ {
+     model = "Elba ASIC Board";
+
+     aliases {
Quoted 6 lines

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi line 8

Quoted 3 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +3 -0
+             serial0 = &uart0;
+                spi0 = &spi0;
+                spi1 = &qspi;

Brad, if you checkpatch.pl'ed this patch, that would have told you regarding leading spaces here.

I did run it but must have missed that or used it incorrectly for the dtsi files.

[...]

Quoted 44 lines

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi

Quoted 5 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +4 -0
+             pxc0_intr: intc@20102200 {
+                     compatible = "pensando,soc-ictlr-csrintr";
+                     interrupt-controller;
 
+                     reg = <0x0 0x20102200 0x0 0x4>;

Rob, please note the reg-space size here.

Quoted 34 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +34 -0
+                     #interrupt-cells = <3>;
+                     interrupt-parent = <&gic>;
+                     interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                     interrupt-names = "pxc0_intr";
+             };
+
+             uart0: serial@4800 {
+                     device_type = "serial";
+                     compatible = "ns16550a";
+                     reg = <0x0 0x4800 0x0 0x100>;
+                     clocks = <&ref_clk>;
+                     interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                     reg-shift = <2>;
+                     reg-io-width = <4>;
+             };
+
+             qspi: spi@2400 {
+                     compatible = "pensando,cdns-qspi";
+                     #address-cells = <1>;
+                     #size-cells = <0>;
+                     reg = <0x0 0x2400 0x0 0x400>,
+                           <0x0 0x7fff0000 0x0 0x1000>;
+                     interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                     clocks = <&flash_clk>;
+                     cdns,fifo-depth = <1024>;
+                     cdns,fifo-width = <4>;
+                     cdns,trigger-address = <0x7fff0000>;
+                     status = "disabled";
+             };
+
+             gpio0: gpio@4000 {
+                     #address-cells = <1>;
+                     #size-cells = <0>;
+                     compatible = "snps,dw-apb-gpio";
Quoted 5 lines
Quoted 1 line

+ reg = <0x0 0x4000 0x0 0x78>;

Brad, are you sure the reg-space is just 0x78 bytes in this DW GPIO module? Normally the system bus blocks are aligned to something no less than 1KB...

In the memory map the devices stride 1KB but the last register for this IP is at 0x74..0x77. Looks like this will need to be revisited should a working syscon usage be discovered.

Quoted 4 lines
Quoted 3 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +2 -0
+                     status = "disabled";
+
Quoted 9 lines
Quoted 1 line

+ porta: gpio-controller@0 {

Brad, I'd prefer to name the sub-nodes as "gpio-port" for DW APB GPIO because hardware considers each of them as dedicated port of the GPIO controller. I know the bindings file permits using "-controller" suffix, but that is allowed only because the bindings file was submitted much later than the driver was. So I didn't want to have the dtbs_check printing errors for already available dts-files.

Named these sub-nodes "gpio-port"

Quoted 186 lines
Quoted 49 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +49 -0
+                             compatible = "snps,dw-apb-gpio-port";
+                             reg = <0>;
+                             gpio-controller;
+                             #gpio-cells = <2>;
+                             ngpios = <8>;
+                             interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+                             interrupt-controller;
+                             interrupt-parent = <&gic>;
+                             #interrupt-cells = <2>;
+                     };
+                     portb: gpio-controller@1 {
+                             compatible = "snps,dw-apb-gpio-port";
+                             reg = <1>;
+                             gpio-controller;
+                             #gpio-cells = <2>;
+                             ngpios = <8>;
+                     };
+             };
+
+             i2c0: i2c@400 {
+                     compatible = "snps,designware-i2c";
+                     reg = <0x0 0x400 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     #address-cells = <1>;
+                     #size-cells = <0>;
+                     i2c-sda-hold-time-ns = <480>;
+                     snps,sda-timeout-ms = <750>;
+                     interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
+                     status = "disabled";
+             };
+
+             /* UIO device using interrupt line PCIEMAC */
+             pciemac@20102200 {
+                     #address-cells = <2>;
+                     #size-cells = <2>;
+                     #interrupt-cells = <3>;
+
+                     compatible = "pensando,uio_pciemac";
+                     register-type = "csr-interrupt";
+                     interrupt-parent = <&pxc0_intr>;
+                     interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                     reg = <0x0 0x20102200 0x0 0x10>; /* pxc0_intr */
+
+                     enable_csr_paddr = <0x0 0x20102200 0x0 0x10>;
+                     enable_mask = <(1 << 0)>;
+             };
+
+             /* MSI UIO device 1 */
+             uio_penmsi1@520000 {

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +9 -0
+                     compatible = "pensando,uio_penmsi1";
+                     reg = <0x0 0x520000 0x0 0x10000>;
+                     msi-parent = <&its 0xa>;
+                     num-interrupts = <16>;  /* # MSI interrupts to get */
+             };
+
+             spics: spics@307c2468 {
+                     compatible = "pensando,elba-spics";
 
+                     reg = <0x0 0x307c2468 0x0 0x4>;

Rob, please note the reg-space base address and size here.

Quoted 41 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +41 -0
+                     gpio-controller;
+                     #gpio-cells = <2>;
+             };
+
+             spi0: spi@2800 {
+                     compatible = "pensando,elba-spi";
+                     reg = <0x0 0x2800 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+                     #address-cells = <1>;
+                     #size-cells = <0>;
+                     num-cs = <2>;
+                     status = "disabled";
+             };
+
+             wdt0: watchdog@1400 {
+                     compatible = "snps,dw-wdt";
+                     reg = <0x0 0x1400 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+                     status = "disabled";
+             };
+             wdt1: watchdog@1800 {
+                     compatible = "snps,dw-wdt";
+                     reg = <0x0 0x1800 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+                     status = "disabled";
+             };
+             wdt2: watchdog@1c00 {
+                     compatible = "snps,dw-wdt";
+                     reg = <0x0 0x1c00 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+                     status = "disabled";
+             };
+             wdt3: watchdog@2000 {
+                     compatible = "snps,dw-wdt";
+                     reg = <0x0 0x2000 0x0 0x100>;
+                     clocks = <&ahb_clk>;
+                     interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi

Quoted 10 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +9 -0
+                     status = "disabled";
+             };
+
+             emmc: mmc@30440000 {
+                     compatible = "pensando,elba-emmc", "cdns,sd4hc";
+                     clocks = <&emmc_clk>;
+                     interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+                     reg = <0x0 0x30440000 0x0 0x10000
 
+                            0x0 0x30480044 0x0 0x4>;

Rob, please also note the reg-space base address and size here. Brad just writes some magic numbers to this register in the MMC drive. The field is named as "ctl_addr" in the driver.

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi

Quoted 12 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +11 -0
+                     cdns,phy-input-delay-sd-highspeed = <0x4>;
+                     cdns,phy-input-delay-legacy = <0x4>;
+                     cdns,phy-input-delay-sd-uhs-sdr50 = <0x6>;
+                     cdns,phy-input-delay-sd-uhs-ddr50 = <0x16>;
+                     cdns,mmc-ddr-1_8v;
+                     status = "disabled";
+             } ;
+
+             pcie@307c2480 {
+                     compatible = "pensando,pcie";
 
+                     reg = <0x0 0x307c2480 0x0 0x4   /* MS CFG_WDT */

Rob, please note the reg-space base address and size here.

arch/arm64/boot/dts/pensando/elba-asic-common.dtsi

Quoted 13 lines
arch/arm64/boot/dts/pensando/elba-asic-common.dtsi new file +12 -0
+                            0x0 0x00001400 0x0 0x10  /* WDT0 */
+                            0x0 0x20000000 0x0 0x00380000>; /* PXB Base */
+             };
+
+             panic: panicdump@0 {
+                     compatible = "pensando,pen-crash";
+                     status = "disabled";
+             };
+
+             bsm@307c2080 {
+                     compatible = "pensando,bsm";
 
+                     reg = <0x0 0x307c2080 0x0 0x4>;

Rob, please see here having a small sized reg-space one more time. Having so many small-sized registers scattered around the dts file makes me thinking that most of them likely belong to some bigger block like "System Controller". If so then there must be a main node compatible with "syscon" device, which phandle would be referenced in the particular device nodes. Like this:

\ {
        soc {
                syscon: syscon@307c0000 {
                        compatible = "pensando,elba-sys-con", "syscon", "simple-mfd";
                        reg = <0x0 0x307c0000 0x0 0x10000>;

                        spics: spics@307c2468 {
                                compatible = "pensando,elba-spics";
                                gpio-controller;
                                #gpio-cells = <2>;
                        };
                };

                pcie@307c2480 {
                        compatible = "pensando,pcie";
                        reg = <0x0 0x20000000 0x0 0x00380000>; /* PXB Base */

                        syscon = <&syscon>;
                };

                /* etc */
        };
};

Rob, what do you think about that? Correct me if I am wrong.

Brad, it's not about "To us it was more understandable" like you responded to my comment in v1, but about having the DTS correctly describing the hardware. Splitting the system controller registers up isn't good in that regard even if you think it makes the driver code more "understandable" and so on.

Quoted 7 lines

Also Brad, don't hurry with re-sending the patchset before finishing all the discussions. I'd understand you doing so if noone would have given you any comment in a long time, but you've got tons of them nearly within one-two days after the v1 patchset submission. So you should have answered to the comments first, settled all the issues, then respined the series. Otherwise it seems as if you just disregard all the work the reviewers did giving you the comments.

Yes I appreciate the feedback and only recently had time to go through all of the input, refactor, clean-up, and test on our 5.10 production server. Once all issues are resolved and tested on 5.10 and works then I can redo the series using the latest linux-next. Syscon in the DT as mentioned above I've taken a few passes at with DT and accompanying device driver changes and no joy yet.

Regards,
Brad

#30 lore raw

PATCH v2 8/13 dt-bindings: Add pensando vendor prefix

In reply to Brad Larson

Add vendor prefix for Pensando Systems, Inc.

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index f6064d84a424..9a21d780c5e1 100644
@@ -850,6 +850,8 @@ patternProperties:
     description: Parallax Inc.
   "^pda,.*":
     description: Precision Design Associates, Inc.
+  "^pensando,.*":
+    description: Pensando Systems Inc.
   "^pericom,.*":
     description: Pericom Technology Inc.
   "^pervasive,.*":
Signature · 1 line
2.17.1
#32 lore raw

PATCH v2 9/13 dt-bindings: mmc: Add Pensando Elba SoC binding

In reply to Brad Larson

Pensando Elba ARM 64-bit SoC is integrated with this IP

---
 Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml +1 -0
index af7442f73881..3e8eb3254b99 100644
@@ -18,6 +18,7 @@ properties:
     items:
       - enum:
           - socionext,uniphier-sd4hc
+          - pensando,elba-emmc
       - const: cdns,sd4hc
 
   reg:
Signature · 1 line
2.17.1
#34 lore raw

PATCH v2 10/13 dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC

In reply to Brad Larson

Add new vendor Pensando Systems Elba SoC compatible string and convert to json-schema.

---
 .../bindings/spi/cadence-quadspi.txt          |  68 --------
 .../bindings/spi/cadence-quadspi.yaml         | 153 ++++++++++++++++++
 2 files changed, 153 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.yaml
Documentation/devicetree/bindings/spi/cadence-quadspi.txt deleted +0 -68
deleted file mode 100644
index 8ace832a2d80..000000000000
@@ -1,68 +0,0 @@
-* Cadence Quad SPI controller
-
-Required properties:
-- compatible : should be one of the following:
-	Generic default - "cdns,qspi-nor".
-	For TI 66AK2G SoC - "ti,k2g-qspi", "cdns,qspi-nor".
-	For TI AM654 SoC  - "ti,am654-ospi", "cdns,qspi-nor".
-	For Intel LGM SoC - "intel,lgm-qspi", "cdns,qspi-nor".
-- reg : Contains two entries, each of which is a tuple consisting of a
-	physical address and length. The first entry is the address and
-	length of the controller register set. The second entry is the
-	address and length of the QSPI Controller data area.
-- interrupts : Unit interrupt specifier for the controller interrupt.
-- clocks : phandle to the Quad SPI clock.
-- cdns,fifo-depth : Size of the data FIFO in words.
-- cdns,fifo-width : Bus width of the data FIFO in bytes.
-- cdns,trigger-address : 32-bit indirect AHB trigger address.
-
-Optional properties:
-- cdns,is-decoded-cs : Flag to indicate whether decoder is used or not.
-- cdns,rclk-en : Flag to indicate that QSPI return clock is used to latch
-  the read data rather than the QSPI clock. Make sure that QSPI return
-  clock is populated on the board before using this property.
-
-Optional subnodes:
-Subnodes of the Cadence Quad SPI controller are spi slave nodes with additional
-custom properties:
-- cdns,read-delay : Delay for read capture logic, in clock cycles
-- cdns,tshsl-ns : Delay in nanoseconds for the length that the master
-                  mode chip select outputs are de-asserted between
-		  transactions.
-- cdns,tsd2d-ns : Delay in nanoseconds between one chip select being
-                  de-activated and the activation of another.
-- cdns,tchsh-ns : Delay in nanoseconds between last bit of current
-                  transaction and deasserting the device chip select
-		  (qspi_n_ss_out).
-- cdns,tslch-ns : Delay in nanoseconds between setting qspi_n_ss_out low
-                  and first bit transfer.
-- resets	: Must contain an entry for each entry in reset-names.
-		  See ../reset/reset.txt for details.
-- reset-names	: Must include either "qspi" and/or "qspi-ocp".
-
-Example:
-
-	qspi: spi@ff705000 {
-		compatible = "cdns,qspi-nor";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		reg = <0xff705000 0x1000>,
-		      <0xffa00000 0x1000>;
-		interrupts = <0 151 4>;
-		clocks = <&qspi_clk>;
-		cdns,is-decoded-cs;
-		cdns,fifo-depth = <128>;
-		cdns,fifo-width = <4>;
-		cdns,trigger-address = <0x00000000>;
-		resets = <&rst QSPI_RESET>, <&rst QSPI_OCP_RESET>;
-		reset-names = "qspi", "qspi-ocp";
-
-		flash0: n25q00@0 {
-			...
-			cdns,read-delay = <4>;
-			cdns,tshsl-ns = <50>;
-			cdns,tsd2d-ns = <50>;
-			cdns,tchsh-ns = <4>;
-			cdns,tslch-ns = <4>;
-		};
-	};
Documentation/devicetree/bindings/spi/cadence-quadspi.yaml new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.17.1
maintainer
#35 lore raw

Re: [PATCH v2 10/13] dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC

Quoted 2 lines · Brad Larson

Add new vendor Pensando Systems Elba SoC compatible string and convert to json-schema.

These are two unrelated changes and should be separate patches, again as covered in submitting-patches.rst. It is generally better to do the changes adding new stuff first and then convert to YAML as the final patches as the series since there is often a delay on reviews of YAML conversions.

#36 lore raw

Re: [PATCH v2 10/13] dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC

Quoted 10 lines · Mark Brown
Quoted 2 lines · Brad Larson

Add new vendor Pensando Systems Elba SoC compatible string and convert to json-schema.

These are two unrelated changes and should be separate patches, again as covered in submitting-patches.rst. It is generally better to do the changes adding new stuff first and then convert to YAML as the final patches as the series since there is often a delay on reviews of YAML conversions.

The initial patch set only changed the text file and a request was made to convert to YAML. I'll change this particular patch to modify just the text file as before and then the convert to YAML with a later patch in the set.

#37 lore raw

Re: [PATCH v2 10/13] dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC

In reply to Brad Larson

Hi Brad,

Quoted 102 lines · Brad Larson

Add new vendor Pensando Systems Elba SoC compatible string and convert to json-schema.

---
 .../bindings/spi/cadence-quadspi.txt          |  68 --------
 .../bindings/spi/cadence-quadspi.yaml         | 153 ++++++++++++++++++
 2 files changed, 153 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.yaml
Documentation/devicetree/bindings/spi/cadence-quadspi.txt deleted +0 -68
deleted file mode 100644
index 8ace832a2d80..000000000000
@@ -1,68 +0,0 @@
-* Cadence Quad SPI controller
-
-Required properties:
-- compatible : should be one of the following:
-	Generic default - "cdns,qspi-nor".
-	For TI 66AK2G SoC - "ti,k2g-qspi", "cdns,qspi-nor".
-	For TI AM654 SoC  - "ti,am654-ospi", "cdns,qspi-nor".
-	For Intel LGM SoC - "intel,lgm-qspi", "cdns,qspi-nor".
-- reg : Contains two entries, each of which is a tuple consisting of a
-	physical address and length. The first entry is the address and
-	length of the controller register set. The second entry is the
-	address and length of the QSPI Controller data area.
-- interrupts : Unit interrupt specifier for the controller interrupt.
-- clocks : phandle to the Quad SPI clock.
-- cdns,fifo-depth : Size of the data FIFO in words.
-- cdns,fifo-width : Bus width of the data FIFO in bytes.
-- cdns,trigger-address : 32-bit indirect AHB trigger address.
-
-Optional properties:
-- cdns,is-decoded-cs : Flag to indicate whether decoder is used or not.
-- cdns,rclk-en : Flag to indicate that QSPI return clock is used to latch
-  the read data rather than the QSPI clock. Make sure that QSPI return
-  clock is populated on the board before using this property.
-
-Optional subnodes:
-Subnodes of the Cadence Quad SPI controller are spi slave nodes with additional
-custom properties:
-- cdns,read-delay : Delay for read capture logic, in clock cycles
-- cdns,tshsl-ns : Delay in nanoseconds for the length that the master
-                  mode chip select outputs are de-asserted between
-		  transactions.
-- cdns,tsd2d-ns : Delay in nanoseconds between one chip select being
-                  de-activated and the activation of another.
-- cdns,tchsh-ns : Delay in nanoseconds between last bit of current
-                  transaction and deasserting the device chip select
-		  (qspi_n_ss_out).
-- cdns,tslch-ns : Delay in nanoseconds between setting qspi_n_ss_out low
-                  and first bit transfer.
-- resets	: Must contain an entry for each entry in reset-names.
-		  See ../reset/reset.txt for details.
-- reset-names	: Must include either "qspi" and/or "qspi-ocp".
-
-Example:
-
-	qspi: spi@ff705000 {
-		compatible = "cdns,qspi-nor";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		reg = <0xff705000 0x1000>,
-		      <0xffa00000 0x1000>;
-		interrupts = <0 151 4>;
-		clocks = <&qspi_clk>;
-		cdns,is-decoded-cs;
-		cdns,fifo-depth = <128>;
-		cdns,fifo-width = <4>;
-		cdns,trigger-address = <0x00000000>;
-		resets = <&rst QSPI_RESET>, <&rst QSPI_OCP_RESET>;
-		reset-names = "qspi", "qspi-ocp";
-
-		flash0: n25q00@0 {
-			...
-			cdns,read-delay = <4>;
-			cdns,tshsl-ns = <50>;
-			cdns,tsd2d-ns = <50>;
-			cdns,tchsh-ns = <4>;
-			cdns,tslch-ns = <4>;
-		};
-	};
Documentation/devicetree/bindings/spi/cadence-quadspi.yaml new file +11 -0
new file mode 100644
index 000000000000..94d631045153
@@ -0,0 +1,153 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/cadence-quadspi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Cadence Quad SPI controller
+
+maintainers:
+  - Ramuthevar Vadivel Murugan <[email protected]>
+  - Brad Larson <[email protected]>

Documentation/devicetree/bindings/spi/cadence-quadspi.yaml line 21

Quoted 10 lines
Documentation/devicetree/bindings/spi/cadence-quadspi.yaml new file +10 -0
+
+properties:
+  compatible:
+    contains:
+      enum:
+        - cdns,qspi-nor       # Generic default
+        - ti,k2g-qspi         # TI 66AK2G SoC
+        - ti,am654-ospi       # TI AM654 SoC
+        - intel,lgm-qspi      # Intel LGM SoC
+        - pensando,cdns-qspi  # Pensando Elba SoC

Wouldn't this allow any combination of all 5 strings? So for example this would allow "ti,am654-ospi", "pensando,cdns-qspi" which is obviously not correct.

I sent a patch recently [0] that does this correctly and it has gotten Rob's blessing. So I suggest you build your patch on top of that.

[...]

[0] https://patchwork.kernel.org/project/spi-devel-general/patch/[email protected]/

Signature · 3 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.
#38 lore raw

Re: [PATCH v2 10/13] dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC

Hi Pratyush,

Quoted 11 lines · Pratyush Yadav

Hi Brad,

Quoted 7 lines · Brad Larson

Add new vendor Pensando Systems Elba SoC compatible string and convert to json-schema.

---
 .../bindings/spi/cadence-quadspi.txt          |  68 --------
 .../bindings/spi/cadence-quadspi.yaml         | 153 ++++++++++++++++++

(...)

Quoted 10 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+properties:
+  compatible:
+    contains:
+      enum:
+        - cdns,qspi-nor       # Generic default
+        - ti,k2g-qspi         # TI 66AK2G SoC
+        - ti,am654-ospi       # TI AM654 SoC
+        - intel,lgm-qspi      # Intel LGM SoC
+        - pensando,cdns-qspi  # Pensando Elba SoC
Quoted 6 lines

Wouldn't this allow any combination of all 5 strings? So for example this would allow "ti,am654-ospi", "pensando,cdns-qspi" which is obviously not correct.

I sent a patch recently [0] that does this correctly and it has gotten Rob's blessing. So I suggest you build your patch on top of that.

Thanks for the pointer to the patch that creates yaml binding spi/cdns,qspi-nor.yaml. All I will need to do now for the updated patchset is this

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml +1 -0
@@ -20,6 +20,7 @@ properties:
               - ti,k2g-qspi
               - ti,am654-ospi
               - intel,lgm-qspi
+              - pensando,elba-qspi
           - const: cdns,qspi-nor
       - const: cdns,qspi-nor
 

Regards,
Brad

#39 lore raw

PATCH v2 11/13 dt-bindings: gpio: Add Pensando Elba SoC support

In reply to Brad Larson

The Pensando Elba SoC gpio driver provides control of four chip selects on two SPI busses.

---
 .../bindings/gpio/pensando,elba-spics.yaml    | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/pensando,elba-spics.yaml
Documentation/devicetree/bindings/gpio/pensando,elba-spics.yaml new file +50 -0
new file mode 100644
index 000000000000..c93b481d4ad3
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/pensando,elba-spics.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Pensando Elba SPI Chip Select Driver
+
+description: |
+  The Pensando Elba SoC provides four SPI bus chip selects.
+
+maintainers:
+  - Brad Larson <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "^spics@[0-9a-f]+$"
+  
+  compatible:
+    const: pensando,elba-spics
+
+  reg:
+    maxItems: 1
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - gpio-controller
+  - "#gpio-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        spics: spics@307c2468 {
+            compatible = "pensando,elba-spics";
+            reg = <0x0 0x307c2468 0x0 0x4>;
+            gpio-controller;
+            #gpio-cells = <2>;
+        };
+    };
Signature · 1 line
2.17.1
#40 lore raw

PATCH v2 12/13 MAINTAINERS: Add entry for PENSANDO

In reply to Brad Larson

Add entry for PENSANDO maintainer and files

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index fb2a3633b719..272c7a7fde75 100644
@@ -2246,6 +2246,15 @@ S:	Maintained
 W:	http://hackndev.com
 F:	arch/arm/mach-pxa/palmz72.*
 
+ARM/PENSANDO SUPPORT
+M:	Brad Larson <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/*/pensando*
+F:	arch/arm64/boot/dts/pensando/
+F:	drivers/gpio/gpio-elba-spics.c
+F:	drivers/mmc/host/sdhci-cadence-elba.c
+
 ARM/PLEB SUPPORT
 M:	Peter Chubb <[email protected]>
 S:	Maintained
Signature · 1 line
2.17.1
#41 lore raw

PATCH v2 13/13 gpio: Use linux/gpio/driver.h

In reply to Brad Larson

New drivers should include <linux/gpio/driver.h> instead of legacy <linux/gpio.h>.

---
 drivers/gpio/gpio-elba-spics.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-elba-spics.c +1 -2
index 351bbaeea033..c0dce5333f35 100644
@@ -6,11 +6,10 @@
  */
 
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/init.h>
-//#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
Signature · 1 line
2.17.1
#42 lore raw

Re: [PATCH v2 13/13] gpio: Use linux/gpio/driver.h

Quoted 28 lines · Brad Larson

New drivers should include <linux/gpio/driver.h> instead of legacy <linux/gpio.h>.

---
 drivers/gpio/gpio-elba-spics.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-elba-spics.c +1 -2
index 351bbaeea033..c0dce5333f35 100644
@@ -6,11 +6,10 @@
  */
 
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/init.h>
-//#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
Signature · 1 line
2.17.1

This should be part of patch 1/13, do not add a problem and then fix it up in the same patch series.

thanks,

greg k-h

#43 lore raw

Re: [PATCH v2 13/13] gpio: Use linux/gpio/driver.h

Quoted 34 lines · Greg KH
Quoted 26 lines · Brad Larson

New drivers should include <linux/gpio/driver.h> instead of legacy <linux/gpio.h>.

---
 drivers/gpio/gpio-elba-spics.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-elba-spics.c +1 -3
index 351bbaeea033..c0dce5333f35 100644
@@ -6,11 +6,10 @@
  */
 
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/init.h>
-//#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
--
Quoted 2 lines

2.17.1

This should be part of patch 1/13, do not add a problem and then fix it up in the same patch series.

Quoted 3 lines

thanks,

greg k-h

Yes, thanks. I'm laughing at myself today looking at that patch tagged at the end.

#45 lore raw

Re: [PATCH v2 13/13] gpio: Use linux/gpio/driver.h

Quoted 6 lines · Linus Walleij
Quoted 3 lines · Brad Larson

New drivers should include <linux/gpio/driver.h> instead of legacy <linux/gpio.h>.

Quoted 6 lines
Quoted 1 line

Fold into patch 1 as indicated by Greg.

Yours,
Linus Walleij

Yes, thanks for the quick review.

#46 lore raw
In reply to Brad Larson

Hi Brad

Quoted 15 lines · Brad Larson

This series enables support for 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

See below for an overview of changes since v1.

Quoted 7 lines

== Patch overview ==

- 01 Fix typo, return code value and log message.
- 03 Remove else clause, intrinsic DW chip-select is never used.
- 08-11 Split out dts and bindings to sub-patches
- 10 Converted existing cadence-quadspi.txt to YAML schema
- 13 New driver should use <linux/gpio/driver.h>

That would be super-useful if each changelog entry was also added to the individual patches below "---" splitter.

-Sergey

Quoted 58 lines

Brad Larson (13):
gpio: Add Elba SoC gpio driver for spi cs control
spi: cadence-quadspi: Add QSPI support for Pensando Elba SoC
spi: dw: Add support for Pensando Elba SoC SPI
spidev: Add Pensando CPLD compatible
mmc: sdhci-cadence: Add Pensando Elba SoC support
arm64: Add config for Pensando SoC platforms
arm64: dts: Add Pensando Elba SoC support
dt-bindings: Add pensando vendor prefix
dt-bindings: mmc: Add Pensando Elba SoC binding
dt-bindings: spi: cadence-qspi: Add support for Pensando Elba SoC
dt-bindings: gpio: Add Pensando Elba SoC support
MAINTAINERS: Add entry for PENSANDO
gpio: Use linux/gpio/driver.h

 .../bindings/gpio/pensando,elba-spics.yaml    |  50 +++
 .../devicetree/bindings/mmc/cdns,sdhci.yaml   |   1 +
 .../bindings/spi/cadence-quadspi.txt          |  68 ----
 .../bindings/spi/cadence-quadspi.yaml         | 153 +++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   9 +
 arch/arm64/Kconfig.platforms                  |   5 +
 arch/arm64/boot/dts/Makefile                  |   1 +
 arch/arm64/boot/dts/pensando/Makefile         |   6 +
 arch/arm64/boot/dts/pensando/elba-16core.dtsi | 170 ++++++++++
 .../boot/dts/pensando/elba-asic-common.dtsi   | 112 +++++++
 arch/arm64/boot/dts/pensando/elba-asic.dts    |   7 +
 .../boot/dts/pensando/elba-flash-parts.dtsi   |  78 +++++
 arch/arm64/boot/dts/pensando/elba.dtsi        | 310 ++++++++++++++++++
 drivers/gpio/Kconfig                          |   6 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-elba-spics.c                | 113 +++++++
 drivers/mmc/host/Kconfig                      |  15 +
 drivers/mmc/host/Makefile                     |   1 +
 drivers/mmc/host/sdhci-cadence-elba.c         | 137 ++++++++
 drivers/mmc/host/sdhci-cadence.c              |  81 +++--
 drivers/mmc/host/sdhci-cadence.h              |  68 ++++
 drivers/spi/spi-cadence-quadspi.c             |   9 +
 drivers/spi/spi-dw-mmio.c                     |  28 +-
 drivers/spi/spidev.c                          |   1 +
 25 files changed, 1321 insertions(+), 111 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/pensando,elba-spics.yaml
 delete mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cadence-quadspi.yaml
 create mode 100644 arch/arm64/boot/dts/pensando/Makefile
 create mode 100644 arch/arm64/boot/dts/pensando/elba-16core.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic-common.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba-asic.dts
 create mode 100644 arch/arm64/boot/dts/pensando/elba-flash-parts.dtsi
 create mode 100644 arch/arm64/boot/dts/pensando/elba.dtsi
 create mode 100644 drivers/gpio/gpio-elba-spics.c
 create mode 100644 drivers/mmc/host/sdhci-cadence-elba.c
 create mode 100644 drivers/mmc/host/sdhci-cadence.h
Signature · 1 line
2.17.1
#47 lore raw

Hi Sergey,

Quoted 6 lines · Serge Semin

Hi Brad

Quoted 2 lines · Brad Larson

This series enables support for Pensando Elba SoC based platforms. The Elba SoC has the following features:

[...]

Quoted 4 lines
Quoted 4 lines

See below for an overview of changes since v1.

== Patch overview ==

Quoted 8 lines
Quoted 5 lines

- 01 Fix typo, return code value and log message.
- 03 Remove else clause, intrinsic DW chip-select is never used.
- 08-11 Split out dts and bindings to sub-patches
- 10 Converted existing cadence-quadspi.txt to YAML schema
- 13 New driver should use <linux/gpio/driver.h>

That would be super-useful if each changelog entry was also added to the individual patches below "---" splitter.

I'll do that for the v3 patchset once the discussions are resolved.

Regards,
Brad