Skip to contentSkip to conversation

spl: dm: disable SPI DM flash for non-DM SPL

PATCH New Xiaowei Bao 4 participants 26 messages Aug 20, 2019 – Jan 7, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
include/config_uncmd_spl.h +1 -0
index c2f9735..da94b3d 100644
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
Signature · 1 line
2.9.5
#1 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

===================== WARNING ====================== This board does not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion
and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This board does not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

---
Changes in v5:
- Modify the function spi_cs_activate to fsl_spi_cs_activate.
- Move cs to the parameter of the fsl_spi_cs_activate function.
Changes in v4:
- Update copyright information.
- Move the fsl_espi_platdata data structure to the
include/dm/platform_data/.
- Merge the contents of the fsl_espi_priv structure into
the fsl_spi_slave structure.
- Implement the fsl_espi_set_speed function.
- Implement the fsl_espi_set_mode function.
- Implement the espi_release_bus function.
- Remove unwanted fsl_espi_bind functions.
- Implement the fsl_espi_child_pre_probe function as needed.
- Use #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA).
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- The fsl_espi driver support both OF_CONTROL and PLATDATA.

 drivers/spi/fsl_espi.c              | 445 ++++++++++++++++++++++++++----------
 include/dm/platform_data/fsl_espi.h |  16 ++
 2 files changed, 337 insertions(+), 124 deletions(-)
 create mode 100644 include/dm/platform_data/fsl_espi.h
drivers/spi/fsl_espi.c +321 -124
index 7444ae1..4b33fae 100644
@@ -3,18 +3,25 @@
  * eSPI controller driver.
  *
  * Copyright 2010-2011 Freescale Semiconductor, Inc.
+ * Copyright 2019 NXP
  * Author: Mingkai Hu (Mingkai.hu at freescale.com)
+ *	   Chuanhua Han (chuanhua.han at nxp.com)
  */
 
 #include <common.h>
-
 #include <malloc.h>
 #include <spi.h>
 #include <asm/immap_85xx.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <dm/platform_data/fsl_espi.h>
 
 struct fsl_spi_slave {
 	struct spi_slave slave;
 	ccsr_espi_t	*espi;
+	u32 speed_hz;
+	unsigned int cs;
 	unsigned int	div16;
 	unsigned int	pm;
 	int		tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave {
 #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave)
 #define US_PER_SECOND		1000000UL
 
+/* default SCK frequency, unit: HZ */
+#define FSL_ESPI_DEFAULT_SCK_FREQ   10000000
+
 #define ESPI_MAX_CS_NUM		4
 #define ESPI_FIFO_WIDTH_BIT	32
 
@@ -62,116 +72,27 @@ struct fsl_spi_slave {
 
 #define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
 
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-		unsigned int max_hz, unsigned int mode)
-{
-	struct fsl_spi_slave *fsl;
-	sys_info_t sysinfo;
-	unsigned long spibrg = 0;
-	unsigned long spi_freq = 0;
-	unsigned char pm = 0;
-
-	if (!spi_cs_is_valid(bus, cs))
-		return NULL;
-
-	fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
-	if (!fsl)
-		return NULL;
-
-	fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
-	fsl->mode = mode;
-	fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
-
-	/* Set eSPI BRG clock source */
-	get_sys_info(&sysinfo);
-	spibrg = sysinfo.freq_systembus / 2;
-	fsl->div16 = 0;
-	if ((spibrg / max_hz) > 32) {
-		fsl->div16 = ESPI_CSMODE_DIV16;
-		pm = spibrg / (max_hz * 16 * 2);
-		if (pm > 16) {
-			pm = 16;
-			debug("Requested speed is too low: %d Hz, %ld Hz "
-				"is used.\n", max_hz, spibrg / (32 * 16));
-		}
-	} else
-		pm = spibrg / (max_hz * 2);
-	if (pm)
-		pm--;
-	fsl->pm = pm;
-
-	if (fsl->div16)
-		spi_freq = spibrg / ((pm + 1) * 2 * 16);
-	else
-		spi_freq = spibrg / ((pm + 1) * 2);
-
-	/* set tx_timeout to 10 times of one espi FIFO entry go out */
-	fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT
-				* 10), spi_freq);
-
-	return &fsl->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
-	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-	free(fsl);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
+void fsl_spi_cs_activate(struct spi_slave *slave, uint cs)
 {
 	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
 	ccsr_espi_t *espi = fsl->espi;
-	unsigned char pm = fsl->pm;
-	unsigned int cs = slave->cs;
-	unsigned int mode =  fsl->mode;
-	unsigned int div16 = fsl->div16;
-	int i;
-
-	debug("%s: bus:%i cs:%i\n", __func__, slave->bus, cs);
-
-	/* Enable eSPI interface */
-	out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
-			| ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
-
-	out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
-	out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI interrupts */
-
-	/* Init CS mode interface */
-	for (i = 0; i < ESPI_MAX_CS_NUM; i++)
-		out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
-
-	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
-		~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
-		| ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK
-		| ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
-
-	/* Set eSPI BRG clock source */
-	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-		| ESPI_CSMODE_PM(pm) | div16);
-
-	/* Set eSPI mode */
-	if (mode & SPI_CPHA)
-		out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-			| ESPI_CSMODE_CP_BEGIN_EDGCLK);
-	if (mode & SPI_CPOL)
-		out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-			| ESPI_CSMODE_CI_INACTIVEHIGH);
-
-	/* Character bit order: msb first */
-	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-		| ESPI_CSMODE_REV_MSB_FIRST);
-
-	/* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
-	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-		| ESPI_CSMODE_LEN(7));
+	unsigned int com = 0;
+	size_t data_len = fsl->data_len;
 
-	return 0;
+	com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
+	com |= ESPI_COM_CS(cs);
+	com |= ESPI_COM_TRANLEN(data_len - 1);
+	out_be32(&espi->com, com);
 }
 
-void spi_release_bus(struct spi_slave *slave)
+void fsl_spi_cs_deactivate(struct spi_slave *slave)
 {
+	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+	ccsr_espi_t *espi = fsl->espi;
 
+	/* clear the RXCNT and TXCNT */
+	out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
+	out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
 }
 
 static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout)
@@ -204,7 +125,8 @@ static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout)
 		debug("***spi_xfer:...Tx timeout! event = %08x\n", event);
 }
 
-static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes)
+static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din,
+		       unsigned int bytes)
 {
 	ccsr_espi_t *espi = fsl->espi;
 	unsigned int tmpdin, rx_times;
@@ -236,10 +158,17 @@ static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes)
 	return bytes;
 }
 
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
-		void *data_in, unsigned long flags)
+void  espi_release_bus(struct fsl_spi_slave *fsl)
 {
-	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+	/* Disable the SPI hardware */
+	 out_be32(&fsl->espi->mode,
+		  in_be32(&fsl->espi->mode) & (~ESPI_MODE_EN));
+}
+
+int espi_xfer(struct fsl_spi_slave *fsl,  uint cs, unsigned int bitlen,
+	      const void *data_out, void *data_in, unsigned long flags)
+{
+	struct spi_slave *slave = &fsl->slave;
 	ccsr_espi_t *espi = fsl->espi;
 	unsigned int event, rx_bytes;
 	const void *dout = NULL;
@@ -258,13 +187,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
 	max_tran_len = fsl->max_transfer_length;
 	switch (flags) {
 	case SPI_XFER_BEGIN:
-		cmd_len = fsl->cmd_len = data_len;
+		cmd_len = data_len;
+		fsl->cmd_len = cmd_len;
 		memcpy(cmd_buf, data_out, cmd_len);
 		return 0;
 	case 0:
 	case SPI_XFER_END:
 		if (bitlen == 0) {
-			spi_cs_deactivate(slave);
+			fsl_spi_cs_deactivate(slave);
 			return 0;
 		}
 		buf_len = 2 * cmd_len + min(data_len, (size_t)max_tran_len);
@@ -304,7 +234,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
 		num_blks = DIV_ROUND_UP(tran_len + cmd_len, 4);
 		num_bytes = (tran_len + cmd_len) % 4;
 		fsl->data_len = tran_len + cmd_len;
-		spi_cs_activate(slave);
+		fsl_spi_cs_activate(slave, cs);
 
 		/* Clear all eSPI events */
 		out_be32(&espi->event , 0xffffffff);
@@ -347,37 +277,304 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
 				*(int *)buffer += tran_len;
 			}
 		}
-		spi_cs_deactivate(slave);
+		fsl_spi_cs_deactivate(slave);
 	}
 
 	free(buffer);
 	return 0;
 }
 
+void espi_claim_bus(struct fsl_spi_slave *fsl, unsigned int cs)
+{
+	ccsr_espi_t *espi = fsl->espi;
+	unsigned char pm = fsl->pm;
+	unsigned int mode =  fsl->mode;
+	unsigned int div16 = fsl->div16;
+	int i;
+
+	/* Enable eSPI interface */
+	out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
+			| ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
+
+	out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
+	out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI interrupts */
+
+	/* Init CS mode interface */
+	for (i = 0; i < ESPI_MAX_CS_NUM; i++)
+		out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
+
+	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
+		~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
+		| ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK
+		| ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
+
+	/* Set eSPI BRG clock source */
+	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+		| ESPI_CSMODE_PM(pm) | div16);
+
+	/* Set eSPI mode */
+	if (mode & SPI_CPHA)
+		out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+			| ESPI_CSMODE_CP_BEGIN_EDGCLK);
+	if (mode & SPI_CPOL)
+		out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+			| ESPI_CSMODE_CI_INACTIVEHIGH);
+
+	/* Character bit order: msb first */
+	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+		| ESPI_CSMODE_REV_MSB_FIRST);
+
+	/* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
+	out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+		| ESPI_CSMODE_LEN(7));
+}
+
+void espi_setup_slave(struct fsl_spi_slave *fsl)
+{
+	unsigned int max_hz;
+	sys_info_t sysinfo;
+	unsigned long spibrg = 0;
+	unsigned long spi_freq = 0;
+	unsigned char pm = 0;
+
+	max_hz = fsl->speed_hz;
+
+	get_sys_info(&sysinfo);
+	spibrg = sysinfo.freq_systembus / 2;
+	fsl->div16 = 0;
+	if ((spibrg / max_hz) > 32) {
+		fsl->div16 = ESPI_CSMODE_DIV16;
+		pm = spibrg / (max_hz * 16 * 2);
+		if (pm > 16) {
+			pm = 16;
+			debug("max_hz is too low: %d Hz, %ld Hz is used.\n",
+			      max_hz, spibrg / (32 * 16));
+		}
+	} else {
+		pm = spibrg / (max_hz * 2);
+	}
+	if (pm)
+		pm--;
+	fsl->pm = pm;
+
+	if (fsl->div16)
+		spi_freq = spibrg / ((pm + 1) * 2 * 16);
+	else
+		spi_freq = spibrg / ((pm + 1) * 2);
+
+	/* set tx_timeout to 10 times of one espi FIFO entry go out */
+	fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT
+				* 10), spi_freq);/* Set eSPI BRG clock source */
+}
+
+#ifndef CONFIG_DM_SPI
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
 	return bus == 0 && cs < ESPI_MAX_CS_NUM;
 }
 
-void spi_cs_activate(struct spi_slave *slave)
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+				  unsigned int max_hz, unsigned int mode)
+{
+	struct fsl_spi_slave *fsl;
+
+	if (!spi_cs_is_valid(bus, cs))
+		return NULL;
+
+	fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
+	if (!fsl)
+		return NULL;
+
+	fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
+	fsl->mode = mode;
+	fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+	fsl->speed_hz = max_hz;
+
+	espi_setup_slave(fsl);
+
+	return &fsl->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
 {
 	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-	ccsr_espi_t *espi = fsl->espi;
-	unsigned int com = 0;
-	size_t data_len = fsl->data_len;
 
-	com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
-	com |= ESPI_COM_CS(slave->cs);
-	com |= ESPI_COM_TRANLEN(data_len - 1);
-	out_be32(&espi->com, com);
+	free(fsl);
 }
 
-void spi_cs_deactivate(struct spi_slave *slave)
+int spi_claim_bus(struct spi_slave *slave)
 {
 	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-	ccsr_espi_t *espi = fsl->espi;
 
-	/* clear the RXCNT and TXCNT */
-	out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
-	out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
+	espi_claim_bus(fsl, slave->cs);
+
+	return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+	struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+
+	espi_release_bus(fsl);
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+	     void *din, unsigned long flags)
+{
+	struct fsl_spi_slave *fsl = (struct fsl_spi_slave *)slave;
+
+	return espi_xfer(fsl, slave->cs, bitlen, dout, din, flags);
+}
+#else
+static void __espi_set_speed(struct fsl_spi_slave *fsl)
+{
+	espi_setup_slave(fsl);
+
+	/* Set eSPI BRG clock source */
+	out_be32(&fsl->espi->csmode[fsl->cs],
+		 in_be32(&fsl->espi->csmode[fsl->cs])
+			 | ESPI_CSMODE_PM(fsl->pm) | fsl->div16);
+}
+
+static void __espi_set_mode(struct fsl_spi_slave *fsl)
+{
+	/* Set eSPI mode */
+	if (fsl->mode & SPI_CPHA)
+		out_be32(&fsl->espi->csmode[fsl->cs],
+			 in_be32(&fsl->espi->csmode[fsl->cs])
+				| ESPI_CSMODE_CP_BEGIN_EDGCLK);
+	if (fsl->mode & SPI_CPOL)
+		out_be32(&fsl->espi->csmode[fsl->cs],
+			 in_be32(&fsl->espi->csmode[fsl->cs])
+				| ESPI_CSMODE_CI_INACTIVEHIGH);
+}
+
+static int fsl_espi_claim_bus(struct udevice *dev)
+{
+	struct udevice *bus = dev->parent;
+	struct fsl_spi_slave  *fsl =  dev_get_priv(bus);
+
+	espi_claim_bus(fsl, fsl->cs);
+
+	return 0;
+}
+
+static int fsl_espi_release_bus(struct udevice *dev)
+{
+	struct udevice *bus = dev->parent;
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	espi_release_bus(fsl);
+
+	return 0;
+}
+
+static int fsl_espi_xfer(struct udevice *dev, unsigned int bitlen,
+			 const void *dout, void *din, unsigned long flags)
+{
+	struct udevice *bus = dev->parent;
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	return espi_xfer(fsl, fsl->cs, bitlen, dout, din, flags);
+}
+
+static int fsl_espi_set_speed(struct udevice *bus, uint speed)
+{
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	debug("%s speed %u\n", __func__, speed);
+	fsl->speed_hz = speed;
+
+	__espi_set_speed(fsl);
+
+	return 0;
+}
+
+static int fsl_espi_set_mode(struct udevice *bus, uint mode)
+{
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	debug("%s mode %u\n", __func__, mode);
+	fsl->mode = mode;
+
+	__espi_set_mode(fsl);
+
+	return 0;
 }
+
+static int fsl_espi_child_pre_probe(struct udevice *dev)
+{
+	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+	struct udevice *bus = dev->parent;
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	debug("%s cs %u\n", __func__, slave_plat->cs);
+	fsl->cs = slave_plat->cs;
+
+	return 0;
+}
+
+static int fsl_espi_probe(struct udevice *bus)
+{
+	struct fsl_espi_platdata *plat = dev_get_platdata(bus);
+	struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+	fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr);
+	fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+	fsl->speed_hz = plat->speed_hz;
+
+	debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
+
+	return 0;
+}
+
+static const struct dm_spi_ops fsl_espi_ops = {
+	.claim_bus	= fsl_espi_claim_bus,
+	.release_bus	= fsl_espi_release_bus,
+	.xfer		= fsl_espi_xfer,
+	.set_speed	= fsl_espi_set_speed,
+	.set_mode	= fsl_espi_set_mode,
+};
+
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+static int fsl_espi_ofdata_to_platdata(struct udevice *bus)
+{
+	fdt_addr_t addr;
+	struct fsl_espi_platdata   *plat = bus->platdata;
+	const void *blob = gd->fdt_blob;
+	int node = dev_of_offset(bus);
+
+	addr = dev_read_addr(bus);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	plat->regs_addr = lower_32_bits(addr);
+	plat->speed_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
+					FSL_ESPI_DEFAULT_SCK_FREQ);
+
+	debug("ESPI: regs=%p, max-frequency=%d\n",
+	      &plat->regs_addr, plat->speed_hz);
+
+	return 0;
+}
+
+static const struct udevice_id fsl_espi_ids[] = {
+	{ .compatible = "fsl,mpc8536-espi" },
+	{ }
+};
+#endif
+
+U_BOOT_DRIVER(fsl_espi) = {
+	.name	= "fsl_espi",
+	.id	= UCLASS_SPI,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+	.of_match = fsl_espi_ids,
+	.ofdata_to_platdata = fsl_espi_ofdata_to_platdata,
+#endif
+	.ops	= &fsl_espi_ops,
+	.platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata),
+	.priv_auto_alloc_size = sizeof(struct fsl_spi_slave),
+	.probe	= fsl_espi_probe,
+	.child_pre_probe = fsl_espi_child_pre_probe,
+};
+#endif
include/dm/platform_data/fsl_espi.h new file +16 -0
new file mode 100644
index 0000000..812933f
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __fsl_espi_h
+#define __fsl_espi_h
+
+struct fsl_espi_platdata {
+	uint flags;
+	uint speed_hz;
+	uint num_chipselect;
+	fdt_addr_t regs_addr;
+};
+
+#endif /* __fsl_espi_h */
Signature · 1 line
2.9.5
#2 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

Quoted 6 lines · Xiaowei Bao

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

Quoted 13 lines

===================== WARNING ====================== This board does not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion
and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This board does not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

These are not the only problems with this driver it is borken for anything but loading small amount of data from SPI NOR flash.
Look at spi_xfer:
overuse of malloc/memcpy
misuse of word size(always 32 bits) making proper of ESPI_EV_RNE/ESPI_EV_TNF impossible. random test of 0x0b:

  		memcpy(data_in, buffer + 2 * cmd_len, tran_len);
		if (*buffer == 0x0b) {
			data_in += tran_len;
			data_len -= tran_len;
			*(int *)buffer += tran_len;
		}

I think fixing the driver to work properly first is preferable to DM conversion.

Jocke

Quoted 599 lines

---
Changes in v5:
- Modify the function spi_cs_activate to fsl_spi_cs_activate.
- Move cs to the parameter of the fsl_spi_cs_activate function.
Changes in v4:
- Update copyright information.
- Move the fsl_espi_platdata data structure to the
include/dm/platform_data/.
- Merge the contents of the fsl_espi_priv structure into
the fsl_spi_slave structure.
- Implement the fsl_espi_set_speed function.
- Implement the fsl_espi_set_mode function.
- Implement the espi_release_bus function.
- Remove unwanted fsl_espi_bind functions.
- Implement the fsl_espi_child_pre_probe function as needed.
- Use #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA).
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- The fsl_espi driver support both OF_CONTROL and PLATDATA.

 drivers/spi/fsl_espi.c              | 445 ++++++++++++++++++++++++++----------
 include/dm/platform_data/fsl_espi.h |  16 ++
 2 files changed, 337 insertions(+), 124 deletions(-)
 create mode 100644 include/dm/platform_data/fsl_espi.h
drivers/spi/fsl_espi.c +321 -124
index 7444ae1..4b33fae 100644
@@ -3,18 +3,25 @@
  * eSPI controller driver.
  *
  * Copyright 2010-2011 Freescale Semiconductor, Inc.
+ * Copyright 2019 NXP
  * Author: Mingkai Hu (Mingkai.hu at freescale.com)
+ *        Chuanhua Han (chuanhua.han at nxp.com)
  */
 
 #include <common.h>
-
 #include <malloc.h>
 #include <spi.h>
 #include <asm/immap_85xx.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <dm/platform_data/fsl_espi.h>
 
 struct fsl_spi_slave {
        struct spi_slave slave;
        ccsr_espi_t     *espi;
+       u32 speed_hz;
+       unsigned int cs;
        unsigned int    div16;
        unsigned int    pm;
        int             tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave {
 #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave)
 #define US_PER_SECOND          1000000UL
 
+/* default SCK frequency, unit: HZ */
+#define FSL_ESPI_DEFAULT_SCK_FREQ   10000000
+
 #define ESPI_MAX_CS_NUM                4
 #define ESPI_FIFO_WIDTH_BIT    32
 
@@ -62,116 +72,27 @@ struct fsl_spi_slave {
 
 #define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
 
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-               unsigned int max_hz, unsigned int mode)
-{
-       struct fsl_spi_slave *fsl;
-       sys_info_t sysinfo;
-       unsigned long spibrg = 0;
-       unsigned long spi_freq = 0;
-       unsigned char pm = 0;
-
-       if (!spi_cs_is_valid(bus, cs))
-               return NULL;
-
-       fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
-       if (!fsl)
-               return NULL;
-
-       fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
-       fsl->mode = mode;
-       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
-
-       /* Set eSPI BRG clock source */
-       get_sys_info(&sysinfo);
-       spibrg = sysinfo.freq_systembus / 2;
-       fsl->div16 = 0;
-       if ((spibrg / max_hz) > 32) {
-               fsl->div16 = ESPI_CSMODE_DIV16;
-               pm = spibrg / (max_hz * 16 * 2);
-               if (pm > 16) {
-                       pm = 16;
-                       debug("Requested speed is too low: %d Hz, %ld Hz "
-                               "is used.\n", max_hz, spibrg / (32 * 16));
-               }
-       } else
-               pm = spibrg / (max_hz * 2);
-       if (pm)
-               pm--;
-       fsl->pm = pm;
-
-       if (fsl->div16)
-               spi_freq = spibrg / ((pm + 1) * 2 * 16);
-       else
-               spi_freq = spibrg / ((pm + 1) * 2);
-
-       /* set tx_timeout to 10 times of one espi FIFO entry go out */
-       fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT
-                               * 10), spi_freq);
-
-       return &fsl->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
-       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       free(fsl);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
+void fsl_spi_cs_activate(struct spi_slave *slave, uint cs)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
        ccsr_espi_t *espi = fsl->espi;
-       unsigned char pm = fsl->pm;
-       unsigned int cs = slave->cs;
-       unsigned int mode =  fsl->mode;
-       unsigned int div16 = fsl->div16;
-       int i;
-
-       debug("%s: bus:%i cs:%i\n", __func__, slave->bus, cs);
-
-       /* Enable eSPI interface */
-       out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
-                       | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
-
-       out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
-       out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI interrupts */
-
-       /* Init CS mode interface */
-       for (i = 0; i < ESPI_MAX_CS_NUM; i++)
-               out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
-
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
-               ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
-               | ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK
-               | ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
-
-       /* Set eSPI BRG clock source */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_PM(pm) | div16);
-
-       /* Set eSPI mode */
-       if (mode & SPI_CPHA)
-               out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-                       | ESPI_CSMODE_CP_BEGIN_EDGCLK);
-       if (mode & SPI_CPOL)
-               out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-                       | ESPI_CSMODE_CI_INACTIVEHIGH);
-
-       /* Character bit order: msb first */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_REV_MSB_FIRST);
-
-       /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_LEN(7));
+       unsigned int com = 0;
+       size_t data_len = fsl->data_len;
 
-       return 0;
+       com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
+       com |= ESPI_COM_CS(cs);
+       com |= ESPI_COM_TRANLEN(data_len - 1);
+       out_be32(&espi->com, com);
 }
 
-void spi_release_bus(struct spi_slave *slave)
+void fsl_spi_cs_deactivate(struct spi_slave *slave)
 {
+       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+       ccsr_espi_t *espi = fsl->espi;
 
+       /* clear the RXCNT and TXCNT */
+       out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
+       out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
 }
 
 static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout)
@@ -204,7 +125,8 @@ static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout)
                debug("***spi_xfer:...Tx timeout! event = %08x\n", event);
 }
 
-static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes)
+static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din,
+                      unsigned int bytes)
 {
        ccsr_espi_t *espi = fsl->espi;
        unsigned int tmpdin, rx_times;
@@ -236,10 +158,17 @@ static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes)
        return bytes;
 }
 
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
-               void *data_in, unsigned long flags)
+void  espi_release_bus(struct fsl_spi_slave *fsl)
 {
-       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+       /* Disable the SPI hardware */
+        out_be32(&fsl->espi->mode,
+                 in_be32(&fsl->espi->mode) & (~ESPI_MODE_EN));
+}
+
+int espi_xfer(struct fsl_spi_slave *fsl,  uint cs, unsigned int bitlen,
+             const void *data_out, void *data_in, unsigned long flags)
+{
+       struct spi_slave *slave = &fsl->slave;
        ccsr_espi_t *espi = fsl->espi;
        unsigned int event, rx_bytes;
        const void *dout = NULL;
@@ -258,13 +187,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
        max_tran_len = fsl->max_transfer_length;
        switch (flags) {
        case SPI_XFER_BEGIN:
-               cmd_len = fsl->cmd_len = data_len;
+               cmd_len = data_len;
+               fsl->cmd_len = cmd_len;
                memcpy(cmd_buf, data_out, cmd_len);
                return 0;
        case 0:
        case SPI_XFER_END:
                if (bitlen == 0) {
-                       spi_cs_deactivate(slave);
+                       fsl_spi_cs_deactivate(slave);
                        return 0;
                }
                buf_len = 2 * cmd_len + min(data_len, (size_t)max_tran_len);
@@ -304,7 +234,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
                num_blks = DIV_ROUND_UP(tran_len + cmd_len, 4);
                num_bytes = (tran_len + cmd_len) % 4;
                fsl->data_len = tran_len + cmd_len;
-               spi_cs_activate(slave);
+               fsl_spi_cs_activate(slave, cs);
 
                /* Clear all eSPI events */
                out_be32(&espi->event , 0xffffffff);
@@ -347,37 +277,304 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
                                *(int *)buffer += tran_len;
                        }
                }
-               spi_cs_deactivate(slave);
+               fsl_spi_cs_deactivate(slave);
        }
 
        free(buffer);
        return 0;
 }
 
+void espi_claim_bus(struct fsl_spi_slave *fsl, unsigned int cs)
+{
+       ccsr_espi_t *espi = fsl->espi;
+       unsigned char pm = fsl->pm;
+       unsigned int mode =  fsl->mode;
+       unsigned int div16 = fsl->div16;
+       int i;
+
+       /* Enable eSPI interface */
+       out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
+                       | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
+
+       out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
+       out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI interrupts */
+
+       /* Init CS mode interface */
+       for (i = 0; i < ESPI_MAX_CS_NUM; i++)
+               out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
+
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
+               ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
+               | ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK
+               | ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
+
+       /* Set eSPI BRG clock source */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_PM(pm) | div16);
+
+       /* Set eSPI mode */
+       if (mode & SPI_CPHA)
+               out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+                       | ESPI_CSMODE_CP_BEGIN_EDGCLK);
+       if (mode & SPI_CPOL)
+               out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+                       | ESPI_CSMODE_CI_INACTIVEHIGH);
+
+       /* Character bit order: msb first */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_REV_MSB_FIRST);
+
+       /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_LEN(7));
+}
+
+void espi_setup_slave(struct fsl_spi_slave *fsl)
+{
+       unsigned int max_hz;
+       sys_info_t sysinfo;
+       unsigned long spibrg = 0;
+       unsigned long spi_freq = 0;
+       unsigned char pm = 0;
+
+       max_hz = fsl->speed_hz;
+
+       get_sys_info(&sysinfo);
+       spibrg = sysinfo.freq_systembus / 2;
+       fsl->div16 = 0;
+       if ((spibrg / max_hz) > 32) {
+               fsl->div16 = ESPI_CSMODE_DIV16;
+               pm = spibrg / (max_hz * 16 * 2);
+               if (pm > 16) {
+                       pm = 16;
+                       debug("max_hz is too low: %d Hz, %ld Hz is used.\n",
+                             max_hz, spibrg / (32 * 16));
+               }
+       } else {
+               pm = spibrg / (max_hz * 2);
+       }
+       if (pm)
+               pm--;
+       fsl->pm = pm;
+
+       if (fsl->div16)
+               spi_freq = spibrg / ((pm + 1) * 2 * 16);
+       else
+               spi_freq = spibrg / ((pm + 1) * 2);
+
+       /* set tx_timeout to 10 times of one espi FIFO entry go out */
+       fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT
+                               * 10), spi_freq);/* Set eSPI BRG clock source */
+}
+
+#ifndef CONFIG_DM_SPI
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
        return bus == 0 && cs < ESPI_MAX_CS_NUM;
 }
 
-void spi_cs_activate(struct spi_slave *slave)
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                                 unsigned int max_hz, unsigned int mode)
+{
+       struct fsl_spi_slave *fsl;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
+       if (!fsl)
+               return NULL;
+
+       fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
+       fsl->mode = mode;
+       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+       fsl->speed_hz = max_hz;
+
+       espi_setup_slave(fsl);
+
+       return &fsl->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       ccsr_espi_t *espi = fsl->espi;
-       unsigned int com = 0;
-       size_t data_len = fsl->data_len;
 
-       com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
-       com |= ESPI_COM_CS(slave->cs);
-       com |= ESPI_COM_TRANLEN(data_len - 1);
-       out_be32(&espi->com, com);
+       free(fsl);
 }
 
-void spi_cs_deactivate(struct spi_slave *slave)
+int spi_claim_bus(struct spi_slave *slave)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       ccsr_espi_t *espi = fsl->espi;
 
-       /* clear the RXCNT and TXCNT */
-       out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
-       out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
+       espi_claim_bus(fsl, slave->cs);
+
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+
+       espi_release_bus(fsl);
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+            void *din, unsigned long flags)
+{
+       struct fsl_spi_slave *fsl = (struct fsl_spi_slave *)slave;
+
+       return espi_xfer(fsl, slave->cs, bitlen, dout, din, flags);
+}
+#else
+static void __espi_set_speed(struct fsl_spi_slave *fsl)
+{
+       espi_setup_slave(fsl);
+
+       /* Set eSPI BRG clock source */
+       out_be32(&fsl->espi->csmode[fsl->cs],
+                in_be32(&fsl->espi->csmode[fsl->cs])
+                        | ESPI_CSMODE_PM(fsl->pm) | fsl->div16);
+}
+
+static void __espi_set_mode(struct fsl_spi_slave *fsl)
+{
+       /* Set eSPI mode */
+       if (fsl->mode & SPI_CPHA)
+               out_be32(&fsl->espi->csmode[fsl->cs],
+                        in_be32(&fsl->espi->csmode[fsl->cs])
+                               | ESPI_CSMODE_CP_BEGIN_EDGCLK);
+       if (fsl->mode & SPI_CPOL)
+               out_be32(&fsl->espi->csmode[fsl->cs],
+                        in_be32(&fsl->espi->csmode[fsl->cs])
+                               | ESPI_CSMODE_CI_INACTIVEHIGH);
+}
+
+static int fsl_espi_claim_bus(struct udevice *dev)
+{
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave  *fsl =  dev_get_priv(bus);
+
+       espi_claim_bus(fsl, fsl->cs);
+
+       return 0;
+}
+
+static int fsl_espi_release_bus(struct udevice *dev)
+{
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       espi_release_bus(fsl);
+
+       return 0;
+}
+
+static int fsl_espi_xfer(struct udevice *dev, unsigned int bitlen,
+                        const void *dout, void *din, unsigned long flags)
+{
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       return espi_xfer(fsl, fsl->cs, bitlen, dout, din, flags);
+}
+
+static int fsl_espi_set_speed(struct udevice *bus, uint speed)
+{
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       debug("%s speed %u\n", __func__, speed);
+       fsl->speed_hz = speed;
+
+       __espi_set_speed(fsl);
+
+       return 0;
+}
+
+static int fsl_espi_set_mode(struct udevice *bus, uint mode)
+{
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       debug("%s mode %u\n", __func__, mode);
+       fsl->mode = mode;
+
+       __espi_set_mode(fsl);
+
+       return 0;
 }
+
+static int fsl_espi_child_pre_probe(struct udevice *dev)
+{
+       struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       debug("%s cs %u\n", __func__, slave_plat->cs);
+       fsl->cs = slave_plat->cs;
+
+       return 0;
+}
+
+static int fsl_espi_probe(struct udevice *bus)
+{
+       struct fsl_espi_platdata *plat = dev_get_platdata(bus);
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr);
+       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+       fsl->speed_hz = plat->speed_hz;
+
+       debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
+
+       return 0;
+}
+
+static const struct dm_spi_ops fsl_espi_ops = {
+       .claim_bus      = fsl_espi_claim_bus,
+       .release_bus    = fsl_espi_release_bus,
+       .xfer           = fsl_espi_xfer,
+       .set_speed      = fsl_espi_set_speed,
+       .set_mode       = fsl_espi_set_mode,
+};
+
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+static int fsl_espi_ofdata_to_platdata(struct udevice *bus)
+{
+       fdt_addr_t addr;
+       struct fsl_espi_platdata   *plat = bus->platdata;
+       const void *blob = gd->fdt_blob;
+       int node = dev_of_offset(bus);
+
+       addr = dev_read_addr(bus);
+       if (addr == FDT_ADDR_T_NONE)
+               return -EINVAL;
+
+       plat->regs_addr = lower_32_bits(addr);
+       plat->speed_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
+                                       FSL_ESPI_DEFAULT_SCK_FREQ);
+
+       debug("ESPI: regs=%p, max-frequency=%d\n",
+             &plat->regs_addr, plat->speed_hz);
+
+       return 0;
+}
+
+static const struct udevice_id fsl_espi_ids[] = {
+       { .compatible = "fsl,mpc8536-espi" },
+       { }
+};
+#endif
+
+U_BOOT_DRIVER(fsl_espi) = {
+       .name   = "fsl_espi",
+       .id     = UCLASS_SPI,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
+       .of_match = fsl_espi_ids,
+       .ofdata_to_platdata = fsl_espi_ofdata_to_platdata,
+#endif
+       .ops    = &fsl_espi_ops,
+       .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata),
+       .priv_auto_alloc_size = sizeof(struct fsl_spi_slave),
+       .probe  = fsl_espi_probe,
+       .child_pre_probe = fsl_espi_child_pre_probe,
+};
+#endif
include/dm/platform_data/fsl_espi.h new file +16 -1
new file mode 100644
index 0000000..812933f
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __fsl_espi_h
+#define __fsl_espi_h
+
+struct fsl_espi_platdata {
+       uint flags;
+       uint speed_hz;
+       uint num_chipselect;
+       fdt_addr_t regs_addr;
+};
+
+#endif /* __fsl_espi_h */
--

2.9.5

#3 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

Quoted 43 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月20日 19:04
To: Prabhakar Kushwaha <[email protected]>; Ruchika Gupta <[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 7 lines · Xiaowei Bao

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

===================== WARNING ====================== This

board does

Quoted 6 lines

not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This

board does

Quoted 5 lines

not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

These are not the only problems with this driver it is borken for anything but loading small amount of data from SPI NOR flash.
Look at spi_xfer:
overuse of malloc/memcpy
misuse of word size(always 32 bits) making proper of
ESPI_EV_RNE/ESPI_EV_TNF impossible.
random test of 0x0b:

Quoted 8 lines
  		memcpy(data_in, buffer + 2 * cmd_len, tran_len);
		if (*buffer == 0x0b) {
			data_in += tran_len;
			data_len -= tran_len;
			*(int *)buffer += tran_len;
		}

I think fixing the driver to work properly first is preferable to DM conversion.

Thanks a lot for your comments, in fact, these code exist all the time, I never modify this part code, and I have verified the SPI flash use 4K data, the test result is ok, I will check and analyze this part code, and give the reply later, thanks.

Quoted 611 lines

Jocke

Quoted 18 lines

---
Changes in v5:
- Modify the function spi_cs_activate to fsl_spi_cs_activate.
- Move cs to the parameter of the fsl_spi_cs_activate function.
Changes in v4:
- Update copyright information.
- Move the fsl_espi_platdata data structure to the
include/dm/platform_data/.
- Merge the contents of the fsl_espi_priv structure into the
fsl_spi_slave structure.
- Implement the fsl_espi_set_speed function.
- Implement the fsl_espi_set_mode function.
- Implement the espi_release_bus function.
- Remove unwanted fsl_espi_bind functions.
- Implement the fsl_espi_child_pre_probe function as needed.
- Use #if CONFIG_IS_ENABLED(OF_CONTROL)

&& !CONFIG_IS_ENABLED(OF_PLATDATA).

Quoted 6 lines

Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- The fsl_espi driver support both OF_CONTROL and PLATDATA.

 drivers/spi/fsl_espi.c              | 445

++++++++++++++++++++++++++----------

Quoted 69 lines
 include/dm/platform_data/fsl_espi.h |  16 ++
 2 files changed, 337 insertions(+), 124 deletions(-)  create mode

100644 include/dm/platform_data/fsl_espi.h

drivers/spi/fsl_espi.c index renamed from drivers/spi/fsl_espi.c +0 -0

7444ae1..4b33fae 100644

drivers/spi/fsl_espi.c +11 -21
@@ -3,18 +3,25 @@
  * eSPI controller driver.
  *
  * Copyright 2010-2011 Freescale Semiconductor, Inc.
+ * Copyright 2019 NXP
  * Author: Mingkai Hu (Mingkai.hu at freescale.com)
+ *        Chuanhua Han (chuanhua.han at nxp.com)
  */
 
 #include <common.h>
-
 #include <malloc.h>
 #include <spi.h>
 #include <asm/immap_85xx.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <dm/platform_data/fsl_espi.h>
 
 struct fsl_spi_slave {
        struct spi_slave slave;
        ccsr_espi_t     *espi;
+       u32 speed_hz;
+       unsigned int cs;
        unsigned int    div16;
        unsigned int    pm;
        int             tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave {  #define to_fsl_spi_slave(s)
 container_of(s, struct fsl_spi_slave, slave)
 #define US_PER_SECOND          1000000UL
 
+/* default SCK frequency, unit: HZ */
+#define FSL_ESPI_DEFAULT_SCK_FREQ   10000000
+
 #define ESPI_MAX_CS_NUM                4
 #define ESPI_FIFO_WIDTH_BIT    32
 
@@ -62,116 +72,27 @@ struct fsl_spi_slave {
 
 #define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
 
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-               unsigned int max_hz, unsigned int mode)
-{
-       struct fsl_spi_slave *fsl;
-       sys_info_t sysinfo;
-       unsigned long spibrg = 0;
-       unsigned long spi_freq = 0;
-       unsigned char pm = 0;
-
-       if (!spi_cs_is_valid(bus, cs))
-               return NULL;
-
-       fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
-       if (!fsl)
-               return NULL;
-
-       fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
-       fsl->mode = mode;
-       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
-

drivers/spi/fsl_espi.c struct fsl_spi_slave { · line 94

Quoted 10 lines
drivers/spi/fsl_espi.c +0 -10
-       /* Set eSPI BRG clock source */
-       get_sys_info(&sysinfo);
-       spibrg = sysinfo.freq_systembus / 2;
-       fsl->div16 = 0;
-       if ((spibrg / max_hz) > 32) {
-               fsl->div16 = ESPI_CSMODE_DIV16;
-               pm = spibrg / (max_hz * 16 * 2);
-               if (pm > 16) {
-                       pm = 16;
-                       debug("Requested speed is too low: %d

Hz, %ld Hz "

drivers/spi/fsl_espi.c struct fsl_spi_slave { · line 95

Quoted 1 line
drivers/spi/fsl_espi.c +0 -1
-                               "is used.\n", max_hz, spibrg / (32 *

16));

Quoted 4 lines
drivers/spi/fsl_espi.c +0 -4
-               }
-       } else
-               pm = spibrg / (max_hz * 2);
-       if (pm)

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 10 lines
drivers/spi/fsl_espi.c +0 -10
-               pm--;
-       fsl->pm = pm;
-
-       if (fsl->div16)
-               spi_freq = spibrg / ((pm + 1) * 2 * 16);
-       else
-               spi_freq = spibrg / ((pm + 1) * 2);
-
-       /* set tx_timeout to 10 times of one espi FIFO entry go out */
-       fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *

ESPI_FIFO_WIDTH_BIT

Quoted 19 lines
drivers/spi/fsl_espi.c +1 -15
-                               * 10), spi_freq);
-
-       return &fsl->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave) -{
-       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       free(fsl);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
+void fsl_spi_cs_activate(struct spi_slave *slave, uint cs)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
        ccsr_espi_t *espi = fsl->espi;
-       unsigned char pm = fsl->pm;
-       unsigned int cs = slave->cs;
-       unsigned int mode =  fsl->mode;
-       unsigned int div16 = fsl->div16;

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 10 lines
drivers/spi/fsl_espi.c +0 -10
-       int i;
-
-       debug("%s: bus:%i cs:%i\n", __func__, slave->bus, cs);
-
-       /* Enable eSPI interface */
-       out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
-                       | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
-
-       out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
-       out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI

interrupts */

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 8 lines
drivers/spi/fsl_espi.c +0 -8
-
-       /* Init CS mode interface */
-       for (i = 0; i < ESPI_MAX_CS_NUM; i++)
-               out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
-
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
-               ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
-               | ESPI_CSMODE_CI_INACTIVEHIGH |

ESPI_CSMODE_CP_BEGIN_EDGCLK

drivers/spi/fsl_espi.c struct fsl_spi_slave { · line 146

Quoted 1 line
drivers/spi/fsl_espi.c +0 -1
-               | ESPI_CSMODE_REV_MSB_FIRST |

ESPI_CSMODE_LEN(0xF)));

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 8 lines
drivers/spi/fsl_espi.c +0 -8
-
-       /* Set eSPI BRG clock source */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_PM(pm) | div16);
-
-       /* Set eSPI mode */
-       if (mode & SPI_CPHA)
-               out_be32(&espi->csmode[cs],

in_be32(&espi->csmode[cs])

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 3 lines
drivers/spi/fsl_espi.c +0 -3
-                       | ESPI_CSMODE_CP_BEGIN_EDGCLK);
-       if (mode & SPI_CPOL)
-               out_be32(&espi->csmode[cs],

in_be32(&espi->csmode[cs])

Quoted 17 lines
drivers/spi/fsl_espi.c +6 -10
-                       | ESPI_CSMODE_CI_INACTIVEHIGH);
-
-       /* Character bit order: msb first */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_REV_MSB_FIRST);
-
-       /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
-       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
-               | ESPI_CSMODE_LEN(7));
+       unsigned int com = 0;
+       size_t data_len = fsl->data_len;
 
-       return 0;
+       com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
+       com |= ESPI_COM_CS(cs);
+       com |= ESPI_COM_TRANLEN(data_len - 1);
+       out_be32(&espi->com, com);

drivers/spi/fsl_espi.c struct fsl_spi_slave {

Quoted 10 lines
drivers/spi/fsl_espi.c +5 -1
 }
 
-void spi_release_bus(struct spi_slave *slave)
+void fsl_spi_cs_deactivate(struct spi_slave *slave)
 {
+       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+       ccsr_espi_t *espi = fsl->espi;
 
+       /* clear the RXCNT and TXCNT */
+       out_be32(&espi->mode, in_be32(&espi->mode) &

(~ESPI_MODE_EN));

drivers/spi/fsl_espi.c struct fsl_spi_slave { · line 95

Quoted 1 line
drivers/spi/fsl_espi.c +1 -0
+       out_be32(&espi->mode, in_be32(&espi->mode) |

ESPI_MODE_EN);

drivers/spi/fsl_espi.c static void fsl_espi_tx(struct fsl_spi_slave *fsl, const

Quoted 4 lines
drivers/spi/fsl_espi.c +0 -0
 }
 
 static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout)
@@ -204,7 +125,8 @@ static void fsl_espi_tx(struct fsl_spi_slave *fsl, const

void *dout)

Quoted 12 lines
drivers/spi/fsl_espi.c +2 -1
                debug("***spi_xfer:...Tx timeout! event = %08x\n",
 event);  }
 
-static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned
 int bytes)
+static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din,
+                      unsigned int bytes)
 {
        ccsr_espi_t *espi = fsl->espi;
        unsigned int tmpdin, rx_times; @@ -236,10 +158,17 @@ static
int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes)
        return bytes;
Quoted 3 lines

}

-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void

*data_out,

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int

Quoted 16 lines
drivers/spi/fsl_espi.c +9 -2
-               void *data_in, unsigned long flags)
+void  espi_release_bus(struct fsl_spi_slave *fsl)
 {
-       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+       /* Disable the SPI hardware */
+        out_be32(&fsl->espi->mode,
+                 in_be32(&fsl->espi->mode) & (~ESPI_MODE_EN)); }
+
+int espi_xfer(struct fsl_spi_slave *fsl,  uint cs, unsigned int bitlen,
+             const void *data_out, void *data_in, unsigned long
+flags) {
+       struct spi_slave *slave = &fsl->slave;
        ccsr_espi_t *espi = fsl->espi;
        unsigned int event, rx_bytes;
        const void *dout = NULL;
@@ -258,13 +187,14 @@ int spi_xfer(struct spi_slave *slave, unsigned int

bitlen, const void *data_out,

Quoted 16 lines
drivers/spi/fsl_espi.c +3 -2
        max_tran_len = fsl->max_transfer_length;
        switch (flags) {
        case SPI_XFER_BEGIN:
-               cmd_len = fsl->cmd_len = data_len;
+               cmd_len = data_len;
+               fsl->cmd_len = cmd_len;
                memcpy(cmd_buf, data_out, cmd_len);
                return 0;
        case 0:
        case SPI_XFER_END:
                if (bitlen == 0) {
-                       spi_cs_deactivate(slave);
+                       fsl_spi_cs_deactivate(slave);
                        return 0;
                }
                buf_len = 2 * cmd_len + min(data_len,
Quoted 1 line

(size_t)max_tran_len); @@ -304,7 +234,7 @@ int spi_xfer(struct spi_slave

*slave, unsigned int bitlen, const void *data_out,

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 9 lines
                num_blks = DIV_ROUND_UP(tran_len + cmd_len, 4);
                num_bytes = (tran_len + cmd_len) % 4;
                fsl->data_len = tran_len + cmd_len;
drivers/spi/fsl_espi.c +2 -1
-               spi_cs_activate(slave);
+               fsl_spi_cs_activate(slave, cs);
 
                /* Clear all eSPI events */
                out_be32(&espi->event , 0xffffffff); @@ -347,37
+277,304 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const

void *data_out,

Quoted 23 lines
                                *(int *)buffer += tran_len;
                        }
                }
drivers/spi/fsl_espi.c +13 -1
-               spi_cs_deactivate(slave);
+               fsl_spi_cs_deactivate(slave);
        }
 
        free(buffer);
        return 0;
 }
 
+void espi_claim_bus(struct fsl_spi_slave *fsl, unsigned int cs) {
+       ccsr_espi_t *espi = fsl->espi;
+       unsigned char pm = fsl->pm;
+       unsigned int mode =  fsl->mode;
+       unsigned int div16 = fsl->div16;
+       int i;
+
+       /* Enable eSPI interface */
+       out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
+                       | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
+
+       out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+       out_be32(&espi->mask, 0x00000000); /* Mask  all eSPI
+ interrupts */
+
+       /* Init CS mode interface */
+       for (i = 0; i < ESPI_MAX_CS_NUM; i++)
+               out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
+
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
+               ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
+               | ESPI_CSMODE_CI_INACTIVEHIGH |

ESPI_CSMODE_CP_BEGIN_EDGCLK

Quoted 1 line

+ | ESPI_CSMODE_REV_MSB_FIRST |

ESPI_CSMODE_LEN(0xF)));

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 8 lines
drivers/spi/fsl_espi.c +8 -0
+
+       /* Set eSPI BRG clock source */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_PM(pm) | div16);
+
+       /* Set eSPI mode */
+       if (mode & SPI_CPHA)
+               out_be32(&espi->csmode[cs],

in_be32(&espi->csmode[cs])

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 3 lines
drivers/spi/fsl_espi.c +3 -0
+                       | ESPI_CSMODE_CP_BEGIN_EDGCLK);
+       if (mode & SPI_CPOL)
+               out_be32(&espi->csmode[cs],

in_be32(&espi->csmode[cs])

Quoted 18 lines
drivers/spi/fsl_espi.c +18 -0
+                       | ESPI_CSMODE_CI_INACTIVEHIGH);
+
+       /* Character bit order: msb first */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_REV_MSB_FIRST);
+
+       /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
+       out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
+               | ESPI_CSMODE_LEN(7)); }
+
+void espi_setup_slave(struct fsl_spi_slave *fsl) {
+       unsigned int max_hz;
+       sys_info_t sysinfo;
+       unsigned long spibrg = 0;
+       unsigned long spi_freq = 0;
+       unsigned char pm = 0;
+
+       max_hz = fsl->speed_hz;

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+
+       get_sys_info(&sysinfo);
+       spibrg = sysinfo.freq_systembus / 2;
+       fsl->div16 = 0;
+       if ((spibrg / max_hz) > 32) {
+               fsl->div16 = ESPI_CSMODE_DIV16;
+               pm = spibrg / (max_hz * 16 * 2);
+               if (pm > 16) {
+                       pm = 16;
+                       debug("max_hz is too low: %d Hz, %ld Hz is

used.\n",

Quoted 6 lines
drivers/spi/fsl_espi.c +6 -0
+                             max_hz, spibrg / (32 * 16));
+               }
+       } else {
+               pm = spibrg / (max_hz * 2);
+       }
+       if (pm)

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+               pm--;
+       fsl->pm = pm;
+
+       if (fsl->div16)
+               spi_freq = spibrg / ((pm + 1) * 2 * 16);
+       else
+               spi_freq = spibrg / ((pm + 1) * 2);
+
+       /* set tx_timeout to 10 times of one espi FIFO entry go out */
+       fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *

ESPI_FIFO_WIDTH_BIT

Quoted 1 line

+ * 10), spi_freq);/* Set eSPI BRG

clock

Quoted 41 lines
drivers/spi/fsl_espi.c +27 -8
+source */ }
+
+#ifndef CONFIG_DM_SPI
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)  {
        return bus == 0 && cs < ESPI_MAX_CS_NUM;  }
 
-void spi_cs_activate(struct spi_slave *slave)
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                                 unsigned int max_hz, unsigned int
+mode) {
+       struct fsl_spi_slave *fsl;
+
+       if (!spi_cs_is_valid(bus, cs))
+               return NULL;
+
+       fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
+       if (!fsl)
+               return NULL;
+
+       fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
+       fsl->mode = mode;
+       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+       fsl->speed_hz = max_hz;
+
+       espi_setup_slave(fsl);
+
+       return &fsl->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       ccsr_espi_t *espi = fsl->espi;
-       unsigned int com = 0;
-       size_t data_len = fsl->data_len;
 
-       com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
-       com |= ESPI_COM_CS(slave->cs);
-       com |= ESPI_COM_TRANLEN(data_len - 1);
-       out_be32(&espi->com, com);
+       free(fsl);

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +1 -4
 }
 
-void spi_cs_deactivate(struct spi_slave *slave)
+int spi_claim_bus(struct spi_slave *slave)
 {
        struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
-       ccsr_espi_t *espi = fsl->espi;
 
-       /* clear the RXCNT and TXCNT */
-       out_be32(&espi->mode, in_be32(&espi->mode) &

(~ESPI_MODE_EN));

Quoted 1 line

- out_be32(&espi->mode, in_be32(&espi->mode) |

ESPI_MODE_EN);

Quoted 20 lines
drivers/spi/fsl_espi.c +20 -0
+       espi_claim_bus(fsl, slave->cs);
+
+       return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave) {
+       struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
+
+       espi_release_bus(fsl);
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+            void *din, unsigned long flags) {
+       struct fsl_spi_slave *fsl = (struct fsl_spi_slave *)slave;
+
+       return espi_xfer(fsl, slave->cs, bitlen, dout, din, flags); }
+#else static void __espi_set_speed(struct fsl_spi_slave *fsl) {
+       espi_setup_slave(fsl);
+
+       /* Set eSPI BRG clock source */

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+       out_be32(&fsl->espi->csmode[fsl->cs],
+                in_be32(&fsl->espi->csmode[fsl->cs])
+                        | ESPI_CSMODE_PM(fsl->pm) | fsl->div16); }
+
+static void __espi_set_mode(struct fsl_spi_slave *fsl) {
+       /* Set eSPI mode */
+       if (fsl->mode & SPI_CPHA)
+               out_be32(&fsl->espi->csmode[fsl->cs],
+                        in_be32(&fsl->espi->csmode[fsl->cs])
+                               |

ESPI_CSMODE_CP_BEGIN_EDGCLK);

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 4 lines
drivers/spi/fsl_espi.c +4 -0
+       if (fsl->mode & SPI_CPOL)
+               out_be32(&fsl->espi->csmode[fsl->cs],
+                        in_be32(&fsl->espi->csmode[fsl->cs])
+                               |

ESPI_CSMODE_CI_INACTIVEHIGH); }

Quoted 41 lines
drivers/spi/fsl_espi.c +41 -0
+
+static int fsl_espi_claim_bus(struct udevice *dev) {
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave  *fsl =  dev_get_priv(bus);
+
+       espi_claim_bus(fsl, fsl->cs);
+
+       return 0;
+}
+
+static int fsl_espi_release_bus(struct udevice *dev) {
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       espi_release_bus(fsl);
+
+       return 0;
+}
+
+static int fsl_espi_xfer(struct udevice *dev, unsigned int bitlen,
+                        const void *dout, void *din, unsigned long
+flags) {
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       return espi_xfer(fsl, fsl->cs, bitlen, dout, din, flags); }
+
+static int fsl_espi_set_speed(struct udevice *bus, uint speed) {
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       debug("%s speed %u\n", __func__, speed);
+       fsl->speed_hz = speed;
+
+       __espi_set_speed(fsl);
+
+       return 0;
+}
+
+static int fsl_espi_set_mode(struct udevice *bus, uint mode) {
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +9 -0
+       debug("%s mode %u\n", __func__, mode);
+       fsl->mode = mode;
+
+       __espi_set_mode(fsl);
+
+       return 0;
 }
+
+static int fsl_espi_child_pre_probe(struct udevice *dev) {
+       struct dm_spi_slave_platdata *slave_plat =

dev_get_parent_platdata(dev);

Quoted 21 lines
drivers/spi/fsl_espi.c +21 -0
+       struct udevice *bus = dev->parent;
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       debug("%s cs %u\n", __func__, slave_plat->cs);
+       fsl->cs = slave_plat->cs;
+
+       return 0;
+}
+
+static int fsl_espi_probe(struct udevice *bus) {
+       struct fsl_espi_platdata *plat = dev_get_platdata(bus);
+       struct fsl_spi_slave *fsl = dev_get_priv(bus);
+
+       fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr);
+       fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
+       fsl->speed_hz = plat->speed_hz;
+
+       debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
+
+       return 0;
+}

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+
+static const struct dm_spi_ops fsl_espi_ops = {
+       .claim_bus      = fsl_espi_claim_bus,
+       .release_bus    = fsl_espi_release_bus,
+       .xfer           = fsl_espi_xfer,
+       .set_speed      = fsl_espi_set_speed,
+       .set_mode       = fsl_espi_set_mode,
+};
+
+#if CONFIG_IS_ENABLED(OF_CONTROL)

&& !CONFIG_IS_ENABLED(OF_PLATDATA)

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, · line 554

Quoted 13 lines
drivers/spi/fsl_espi.c +13 -0
+static int fsl_espi_ofdata_to_platdata(struct udevice *bus) {
+       fdt_addr_t addr;
+       struct fsl_espi_platdata   *plat = bus->platdata;
+       const void *blob = gd->fdt_blob;
+       int node = dev_of_offset(bus);
+
+       addr = dev_read_addr(bus);
+       if (addr == FDT_ADDR_T_NONE)
+               return -EINVAL;
+
+       plat->regs_addr = lower_32_bits(addr);
+       plat->speed_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
+

FSL_ESPI_DEFAULT_SCK_FREQ);

Quoted 7 lines
drivers/spi/fsl_espi.c +7 -0
+
+       debug("ESPI: regs=%p, max-frequency=%d\n",
+             &plat->regs_addr, plat->speed_hz);
+
+       return 0;
+}
+

drivers/spi/fsl_espi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,

Quoted 10 lines
drivers/spi/fsl_espi.c +10 -0
+static const struct udevice_id fsl_espi_ids[] = {
+       { .compatible = "fsl,mpc8536-espi" },
+       { }
+};
+#endif
+
+U_BOOT_DRIVER(fsl_espi) = {
+       .name   = "fsl_espi",
+       .id     = UCLASS_SPI,
+#if CONFIG_IS_ENABLED(OF_CONTROL)

&& !CONFIG_IS_ENABLED(OF_PLATDATA)

Quoted 32 lines
drivers/spi/fsl_espi.c +7 -0
+       .of_match = fsl_espi_ids,
+       .ofdata_to_platdata = fsl_espi_ofdata_to_platdata, #endif
+       .ops    = &fsl_espi_ops,
+       .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata),
+       .priv_auto_alloc_size = sizeof(struct fsl_spi_slave),
+       .probe  = fsl_espi_probe,
+       .child_pre_probe = fsl_espi_child_pre_probe, }; #endif
include/dm/platform_data/fsl_espi.h new file +16 -1
new file mode 100644
index 0000000..812933f
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2019 NXP
+ */
+
+#ifndef __fsl_espi_h
+#define __fsl_espi_h
+
+struct fsl_espi_platdata {
+       uint flags;
+       uint speed_hz;
+       uint num_chipselect;
+       fdt_addr_t regs_addr;
+};
+
+#endif /* __fsl_espi_h */
--

2.9.5

#4 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

Quoted 48 lines · Xiaowei Bao
Quoted 48 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月20日 19:04
To: Prabhakar Kushwaha <[email protected]>; Ruchika Gupta <[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 6 lines · Xiaowei Bao

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

===================== WARNING ====================== This

board does

Quoted 6 lines

not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This

board does

Quoted 5 lines

not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

These are not the only problems with this driver it is borken for anything but loading small amount of data from SPI NOR flash.
Look at spi_xfer:
overuse of malloc/memcpy
misuse of word size(always 32 bits) making proper of
ESPI_EV_RNE/ESPI_EV_TNF impossible.
random test of 0x0b:

              memcpy(data_in, buffer + 2 * cmd_len, tran_len);
              if (*buffer == 0x0b) {
                      data_in += tran_len;
                      data_len -= tran_len;
                      *(int *)buffer += tran_len;
              }
Quoted 4 lines
Quoted 1 line

I think fixing the driver to work properly first is preferable to DM conversion.

Thanks a lot for your comments, in fact, these code exist all the time, I never modify this part code, and I have verified the SPI flash use 4K data, the test result is ok, I will check and analyze this part code, and give the reply later, thanks.

Yes, this code has been borken for years and like I said, it only works for SPI NOR flash which is what you tested. Try a simple SPI device, reading and writing registers.

Here is an old hack for loading FPGAs using ESPI_COM_TO, hopefully this can be of some use:
https://patchwork.ozlabs.org/patch/330242/

In short, the inner working of spi_xfer() needs a full rewrite, using the proper SPI word size, you have no chance of supporting SPI_LSB_FIRST without correct word size.

Jocke

Quoted 1 line
Quoted 1 line

Jocke

#5 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

Quoted 84 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月21日 15:52
To: Prabhakar Kushwaha <[email protected]>; Ruchika Gupta <[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 5 lines · Xiaowei Bao
Quoted 5 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月20日 19:04
To: Prabhakar Kushwaha <[email protected]>; Ruchika

Gupta

Quoted 43 lines
Quoted 43 lines

<[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 6 lines · Xiaowei Bao

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

===================== WARNING ====================== This

board does

Quoted 6 lines

not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This

board does

Quoted 5 lines

not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

These are not the only problems with this driver it is borken for anything but loading small amount of data from SPI NOR flash. Look at spi_xfer:
overuse of malloc/memcpy
misuse of word size(always 32 bits) making proper of
ESPI_EV_RNE/ESPI_EV_TNF impossible.
random test of 0x0b:

              memcpy(data_in, buffer + 2 * cmd_len, tran_len);
              if (*buffer == 0x0b) {
                      data_in += tran_len;
                      data_len -= tran_len;
                      *(int *)buffer += tran_len;
              }
Quoted 1 line
Quoted 1 line

I think fixing the driver to work properly first is preferable to DM

conversion.

Quoted 3 lines

Thanks a lot for your comments, in fact, these code exist all the time, I never modify this part code, and I have verified the SPI flash use 4K data, the test result is ok, I will check and analyze this part code, and

give the reply later, thanks.

Yes, this code has been borken for years and like I said, it only works for SPI NOR flash which is what you tested.
Try a simple SPI device, reading and writing registers.

Here is an old hack for loading FPGAs using ESPI_COM_TO, hopefully this can be of some use:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
work.ozlabs.org%2Fpatch%2F330242%2F&amp;data=02%7C01%7Cxiaowei.b ao%40nxp.com%7Cbb03e40adaf14ddabb3308d7260c624a%7C686ea1d3bc2 b4c6fa92cd99c5c301635%7C0%7C0%7C637019706960729747&amp;sdata= LBnGwExukwfx4Txln7gbC797CK0Nuu1Q%2BG8iK4lCR4M%3D&amp;reserved =0

Quoted 3 lines

In short, the inner working of spi_xfer() needs a full rewrite, using the proper SPI word size, you have no chance of supporting SPI_LSB_FIRST without correct word size.

Thanks a lot, I think I need to do another new patch which reimplement the xfer function, This is better, because this issue fix should not in DM patch, I will submit another new patch to fix this issue, but maybe spend some time, because I am not very clear about the FSL ESPI driver, and the verification will be a problem, because I don't find other SPI device except SPI flash device in our RDB or QDS board, but I am going to do this.

Quoted 4 lines

Jocke

Quoted 1 line
Quoted 1 line

Jocke

#6 lore raw

PATCH v5 2/5 dm: spi: Convert Freescale ESPI driver to driver model

Quoted 81 lines · Xiaowei Bao
Quoted 81 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月21日 15:52
To: Prabhakar Kushwaha <[email protected]>; Ruchika Gupta <[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 4 lines · Xiaowei Bao
Quoted 4 lines

-----Original Message-----
From: Joakim Tjernlund <[email protected]>
Sent: 2019年8月20日 19:04
To: Prabhakar Kushwaha <[email protected]>; Ruchika

Gupta

Quoted 43 lines
Quoted 43 lines

<[email protected]>; Xiaowei Bao <[email protected]>; Shengzhou Liu <[email protected]>; wd at denx.de;
jagan at amarulasolutions.com
Cc: u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model

Quoted 6 lines · Xiaowei Bao

From: Chuanhua Han <[email protected]>

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:

===================== WARNING ====================== This

board does

Quoted 6 lines

not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info.
====================================================
===================== WARNING ====================== This

board does

Quoted 5 lines

not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info.
====================================================

These are not the only problems with this driver it is borken for anything but loading small amount of data from SPI NOR flash. Look at spi_xfer:
overuse of malloc/memcpy
misuse of word size(always 32 bits) making proper of
ESPI_EV_RNE/ESPI_EV_TNF impossible.
random test of 0x0b:

              memcpy(data_in, buffer + 2 * cmd_len, tran_len);
              if (*buffer == 0x0b) {
                      data_in += tran_len;
                      data_len -= tran_len;
                      *(int *)buffer += tran_len;
              }
Quoted 1 line
Quoted 1 line

I think fixing the driver to work properly first is preferable to DM

conversion.

Quoted 3 lines

Thanks a lot for your comments, in fact, these code exist all the time, I never modify this part code, and I have verified the SPI flash use 4K data, the test result is ok, I will check and analyze this part code, and

give the reply later, thanks.

Yes, this code has been borken for years and like I said, it only works for SPI NOR flash which is what you tested.
Try a simple SPI device, reading and writing registers.

Here is an old hack for loading FPGAs using ESPI_COM_TO, hopefully this can be of some use:
https://patch
work.ozlabs.org%2Fpatch%2F330242%2F&amp;data=02%7C01%7Cxiaowei.b ao%40nxp.com%7Cbb03e40adaf14ddabb3308d7260c624a%7C686ea1d3bc2 b4c6fa92cd99c5c301635%7C0%7C0%7C637019706960729747&amp;sdata= LBnGwExukwfx4Txln7gbC797CK0Nuu1Q%2BG8iK4lCR4M%3D&amp;reserved =0

Quoted 8 lines
Quoted 3 lines

In short, the inner working of spi_xfer() needs a full rewrite, using the proper SPI word size, you have no chance of supporting SPI_LSB_FIRST without correct word size.

Thanks a lot, I think I need to do another new patch which reimplement the xfer function, This is better, because this issue fix should not in DM patch, I will submit another new patch to fix this issue, but maybe spend some time, because I am not very clear about the FSL ESPI driver, and the verification will be a problem, because I don't find other SPI device except SPI flash device in our RDB or QDS board, but I am going to do this.

Thanks, I think random access(read/write) to SPI NOR flash will be enough for testing. It won't be any worse than today as it is broken already.

Jocke

Quoted 3 lines
Quoted 3 lines

Jocke

Quoted 1 line
Quoted 1 line

Jocke

#7 lore raw

PATCH v5 3/5 powerpc: dts: t2080: add espi controller node support

In reply to Xiaowei Bao

From: Chuanhua Han <[email protected]>

Add espi controller node to support t2080.

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 arch/powerpc/dts/t2080.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/powerpc/dts/t2080.dtsi +10 -0
index d2bebb0..e3970d3 100644
@@ -69,6 +69,16 @@
 			voltage-ranges = <1800 1800 3300 3300>;
 		};
 
+		espi0: spi at 110000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "fsl,mpc8536-espi";
+			reg = <0x110000 0x1000>;
+			interrupts = <53 0x2 0 0>;
+			fsl,espi-num-chipselects = <4>;
+			status = "disabled";
+		};
+
 		usb0: usb at 210000 {
 			compatible = "fsl-usb2-mph";
 			reg = <0x210000 0x1000>;
Signature · 1 line
2.9.5
#8 lore raw

PATCH v5 4/5 powerpc: dts: t2080qds: add espi slave nodes support

In reply to Xiaowei Bao

From: Chuanhua Han <[email protected]>

Add espi slave nodes to support t2080qds.

---
Changes in v5:
- No change.
Changes in v4:
- Modify the spi-max-frequency attribute value of the
flash at x node of the device tree.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 arch/powerpc/dts/t2080qds.dts | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/powerpc/dts/t2080qds.dts +33 -0
index 1819a08..f9e786b 100644
@@ -14,4 +14,37 @@
 	#address-cells = <2>;
 	#size-cells = <2>;
 	interrupt-parent = <&mpic>;
+
+	aliases {
+		spi0 = &espi0;
+	};
+};
+
+&espi0 {
+
+	status = "okay";
+	flash at 0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "micron,n25q128a11", "jedec,spi-nor"; /* 16MB */
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+	};
+
+	flash at 1 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "sst,sst25wf040", "jedec,spi-nor";
+		reg = <1>;
+		spi-max-frequency = <10000000>;
+	};
+
+	flash at 2 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "eon,en25s64", "jedec,spi-nor";
+		reg = <2>;
+		spi-max-frequency = <10000000>;
+	};
+
 };
Signature · 1 line
2.9.5
#9 lore raw

PATCH v5 5/5 configs: enable espi device module in T2080QDS

In reply to Xiaowei Bao

From: Chuanhua Han <[email protected]>

This patch is to enable espi DM for T2080QDS in uboot

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 configs/T2080QDS_NAND_defconfig           | 2 ++
 configs/T2080QDS_SDCARD_defconfig         | 2 ++
 configs/T2080QDS_SECURE_BOOT_defconfig    | 2 ++
 configs/T2080QDS_SPIFLASH_defconfig       | 2 ++
 configs/T2080QDS_SRIO_PCIE_BOOT_defconfig | 2 ++
 configs/T2080QDS_defconfig                | 2 ++
 6 files changed, 12 insertions(+)
configs/T2080QDS_NAND_defconfig +2 -0
index f7dfb94..91030e1 100644
@@ -75,3 +75,5 @@ CONFIG_FSL_ESPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
configs/T2080QDS_SDCARD_defconfig +2 -0
index a89c410..f7d39d4 100644
@@ -72,3 +72,5 @@ CONFIG_FSL_ESPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
configs/T2080QDS_SECURE_BOOT_defconfig +2 -0
index 6996f85..912e6b2 100644
@@ -62,3 +62,5 @@ CONFIG_USB_STORAGE=y
 CONFIG_RSA=y
 CONFIG_SPL_RSA=y
 CONFIG_RSA_SOFTWARE_EXP=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
configs/T2080QDS_SPIFLASH_defconfig +2 -0
index 101e23d..5d2e3ce 100644
@@ -73,3 +73,5 @@ CONFIG_FSL_ESPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
configs/T2080QDS_SRIO_PCIE_BOOT_defconfig +2 -0
index 1346d5e..437d5cc 100644
@@ -52,3 +52,5 @@ CONFIG_FSL_ESPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
configs/T2080QDS_defconfig +2 -0
index bcbd276..1ed592e 100644
@@ -59,3 +59,5 @@ CONFIG_FSL_ESPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_STORAGE=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
Signature · 1 line
2.9.5
#10 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

In reply to Xiaowei Bao

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Quoted 21 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
include/config_uncmd_spl.h +0 -0
index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190820/431d21e5/attachment.sig>

#11 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 18 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 2 lines

From: Chuanhua Han <[email protected]>

Quoted 8 lines
Quoted 2 lines

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline? Do I need to depend on your patches? If yes, please provide the full patches link, I can't see the contents of this set of patches.

Quoted 42 lines
Quoted 22 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
include/config_uncmd_spl.h +0 -0
index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#12 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 19 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 19 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link,
I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 34 lines
Quoted 34 lines
Quoted 22 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN  

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190820/adfafea0/attachment.sig>

#13 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 57 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 14 lines
Quoted 14 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

Quoted 7 lines

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

Quoted 56 lines
Quoted 35 lines
Quoted 35 lines
Quoted 23 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#14 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 59 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 59 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 6 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 14 lines
Quoted 14 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

Quoted 6 lines
Quoted 4 lines

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Quoted 48 lines
Quoted 48 lines
Quoted 35 lines
Quoted 35 lines
Quoted 23 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN  

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190820/de357bf2/attachment.sig>

#15 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 81 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 7 lines
Quoted 7 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 8 lines
Quoted 2 lines

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

include/config_uncmd_spl.h +0 -1
index da94b3d..c2f9735 100644
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
include/configs/T208xQDS.h +7 -0
index 98bb334..b45ec4a 100644
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif
+
Quoted 71 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 24 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN

Best regards,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#16 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 106 lines · On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 80 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 6 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 7 lines
Quoted 7 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 8 lines
Quoted 2 lines

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

include/config_uncmd_spl.h +0 -1
index da94b3d..c2f9735 100644
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
include/configs/T208xQDS.h +0 -0
index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif

The whole point is to avoid adding the above code.

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Quoted 64 lines
include/configs/T208xQDS.h +1 -0
+
Quoted 63 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 24 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN  

Best regards,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190820/1bc109c1/attachment.sig>

#17 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 136 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 17:50
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 81 lines
Quoted 55 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 8 lines
Quoted 2 lines

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

include/config_uncmd_spl.h +0 -1
index da94b3d..c2f9735 100644
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
include/configs/T208xQDS.h +0 -0
index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif

The whole point is to avoid adding the above code.

Quoted 2 lines

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Hi Lukasz, thanks for your comments, ask a question, I modify my driver like this:

drivers/spi/fsl_espi.c +1 -0
index fd5ac97..54be036 100644
@@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave *fsl)
                                * 10), spi_freq);/* Set eSPI BRG clock source */
 }
 
 #ifndef CONFIG_DM_SPI
+#if !CONFIG_IS_ENABLED(DM_SPI)
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
configs/T2080QDS_SPIFLASH_defconfig +2 -0
index 7a1c580..cf53e54 100644
@@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
 

When I compile the driver with SPL mode, the DM or non DM mode cod will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or 1, so the DM code or non DM code will be compiled, but not both, this make me confused, do I miss something, could you tell me the reason? Thanks a lot.

Quoted 87 lines
Quoted 50 lines
include/configs/T208xQDS.h +1 -0
+
Quoted 48 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 24 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644

include/config_uncmd_spl.h line 21

Quoted 7 lines
include/config_uncmd_spl.h +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN

Best regards,

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#18 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 161 lines · On Thu, 22 Aug 2019 01:56:48 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 136 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 17:50
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 6 lines · On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]> Subject: Re: [U-Boot] [PATCH v5 1/5]
spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 82 lines
Quoted 59 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 33 lines
Quoted 33 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

Quoted 7 lines
Quoted 4 lines

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

Quoted 5 lines

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

(quoted diff) +0 -0

b/include/config_uncmd_spl.h index da94b3d..c2f9735 100644

include/config_uncmd_spl.h +0 -1
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
(quoted diff) +0 -0

b/include/configs/T208xQDS.h index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif  

The whole point is to avoid adding the above code.

Quoted 2 lines

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Hi Lukasz, thanks for your comments, ask a question, I modify my driver like this: diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index fd5ac97..54be036 100644

drivers/spi/fsl_espi.c +1 -0
@@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave *fsl)
                                * 10), spi_freq);/* Set eSPI BRG
 clock source */ }
 
 #ifndef CONFIG_DM_SPI
+#if !CONFIG_IS_ENABLED(DM_SPI)
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
(quoted diff) +0 -0

b/configs/T2080QDS_SPIFLASH_defconfig index 7a1c580..cf53e54 100644

configs/T2080QDS_SPIFLASH_defconfig +2 -0
@@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
 
Quoted 5 lines

When I compile the driver with SPL mode, the DM or non DM mode cod will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or 1, so the DM code or non DM code will be compiled, but not both, this make me confused, do I miss something, could you tell me the reason? Thanks a lot.

So the CONFIG_IS_ENABLED(FOO) is true if:

1. The CONFIG_FOO is defined in Kconfig files (if it is defined in ./include/configs/<board.h> then CONFIG_IS_ENABLED will return false, which is wrong).

2. The CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_FOO

3. CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_SPL_FOO

So the CONFIG_IS_ENABLED(FOO) shall be used in conjunction with CONFIG_DM_FOO (SPI in your case).

Quoted 81 lines
Quoted 81 lines
Quoted 52 lines
include/configs/T208xQDS.h +1 -0
+  
Quoted 49 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 36 lines
Quoted 24 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644 --- a/include/config_uncmd_spl.h
+++ b/include/config_uncmd_spl.h

Review line 21

Quoted 7 lines
(quoted diff) +1 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN  

Best regards,

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190822/e8069327/attachment.sig>

#19 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 189 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月23日 4:48
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Thu, 22 Aug 2019 01:56:48 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 17:50
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 123 lines
Quoted 115 lines

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]> Subject: Re: [U-Boot] [PATCH v5 1/5]
spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 81 lines
Quoted 55 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 8 lines
Quoted 2 lines

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

(quoted diff) +0 -0

b/include/config_uncmd_spl.h index da94b3d..c2f9735 100644

include/config_uncmd_spl.h +0 -1
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
(quoted diff) +0 -0

b/include/configs/T208xQDS.h index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif

The whole point is to avoid adding the above code.

Quoted 2 lines

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Hi Lukasz, thanks for your comments, ask a question, I modify my driver like this: diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index fd5ac97..54be036 100644

drivers/spi/fsl_espi.c void espi_setup_slave(struct fsl_spi_slave *fsl) · line 367

Quoted 1 line
drivers/spi/fsl_espi.c +0 -0
@@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave *fsl)
                                * 10), spi_freq);/* Set eSPI BRG

clock

Quoted 15 lines
drivers/spi/fsl_espi.c +1 -0
 source */ }
 
 #ifndef CONFIG_DM_SPI
+#if !CONFIG_IS_ENABLED(DM_SPI)
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)  {
 
(quoted diff) +0 -0

b/configs/T2080QDS_SPIFLASH_defconfig index 7a1c580..cf53e54 100644

configs/T2080QDS_SPIFLASH_defconfig +2 -0
@@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
 
Quoted 5 lines

When I compile the driver with SPL mode, the DM or non DM mode cod will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or 1, so the DM code or non DM code will be compiled, but not both, this make me confused, do I miss something, could you tell me the reason? Thanks a lot.

So the CONFIG_IS_ENABLED(FOO) is true if:

1. The CONFIG_FOO is defined in Kconfig files (if it is defined in ./include/configs/<board.h> then CONFIG_IS_ENABLED will return false, which is wrong).

Quoted 8 lines

2. The CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_FOO

3. CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_SPL_FOO

So the CONFIG_IS_ENABLED(FOO) shall be used in conjunction with CONFIG_DM_FOO (SPI in your case).

Thanks a lot, got it.

Quoted 105 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
include/configs/T208xQDS.h +1 -0
+
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Review line 15

Quoted 6 lines
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644 --- a/include/config_uncmd_spl.h
+++ b/include/config_uncmd_spl.h

(quoted diff) +0 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO  #undef CONFIG_DM_I2C

#undef

Quoted 37 lines
Quoted 37 lines
Quoted 23 lines
Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
#endif

#undef CONFIG_DM_WARN

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#20 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

In reply to Lukasz Majewski

Hi Lukasz,

My patches depends on your patches https://patchwork.ozlabs.org/project/uboot/list/?series=129069, do you have plan to update it? I saw that the status is "changes required", any comments?

Thanks
Xiaowei

Quoted 300 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月23日 4:48
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Thu, 22 Aug 2019 01:56:48 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 17:50
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 123 lines
Quoted 115 lines

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]> Subject: Re: [U-Boot] [PATCH v5 1/5]
spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines · On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 81 lines
Quoted 55 lines
Quoted 11 lines
Quoted 11 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 5 lines · On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 5 lines
Quoted 5 lines

Liu

Quoted 4 lines
Quoted 4 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 37 lines
Quoted 37 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot cannot be performed in non-DM SPL.

Quoted 6 lines
Quoted 5 lines

I've posted recently a set of patches to move setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

Quoted 8 lines
Quoted 2 lines

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of POWERPC.

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

(quoted diff) +0 -0

b/include/config_uncmd_spl.h index da94b3d..c2f9735 100644

include/config_uncmd_spl.h +0 -1
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
(quoted diff) +0 -0

b/include/configs/T208xQDS.h index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif

The whole point is to avoid adding the above code.

Quoted 2 lines

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Hi Lukasz, thanks for your comments, ask a question, I modify my driver like this: diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index fd5ac97..54be036 100644

drivers/spi/fsl_espi.c void espi_setup_slave(struct fsl_spi_slave *fsl) · line 367

Quoted 1 line
drivers/spi/fsl_espi.c +0 -0
@@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave *fsl)
                                * 10), spi_freq);/* Set eSPI BRG

clock

Quoted 15 lines
drivers/spi/fsl_espi.c +1 -0
 source */ }
 
 #ifndef CONFIG_DM_SPI
+#if !CONFIG_IS_ENABLED(DM_SPI)
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)  {
 
(quoted diff) +0 -0

b/configs/T2080QDS_SPIFLASH_defconfig index 7a1c580..cf53e54 100644

configs/T2080QDS_SPIFLASH_defconfig +2 -0
@@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
 
Quoted 5 lines

When I compile the driver with SPL mode, the DM or non DM mode cod will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or 1, so the DM code or non DM code will be compiled, but not both, this make me confused, do I miss something, could you tell me the reason? Thanks a lot.

So the CONFIG_IS_ENABLED(FOO) is true if:

1. The CONFIG_FOO is defined in Kconfig files (if it is defined in ./include/configs/<board.h> then CONFIG_IS_ENABLED will return false, which is wrong).

2. The CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_FOO

3. CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_SPL_FOO

So the CONFIG_IS_ENABLED(FOO) shall be used in conjunction with CONFIG_DM_FOO (SPI in your case).

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
include/configs/T208xQDS.h +1 -0
+
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Review line 15

Quoted 6 lines
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index c2f9735..da94b3d 100644 --- a/include/config_uncmd_spl.h
+++ b/include/config_uncmd_spl.h

(quoted diff) +0 -0
@@ -15,6 +15,7 @@
 #undef CONFIG_DM_GPIO  #undef CONFIG_DM_I2C

#undef

Quoted 37 lines
Quoted 37 lines
Quoted 23 lines
Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
#endif

#undef CONFIG_DM_WARN

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

A message that is not in the archive (sent off-list or not yet received): AM5PR04MB3299E725CEF5540D8B44F76EF5680@AM5PR04MB3299.eurprd04.prod.outlook.com

#22 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 6 lines

Hi Lukasz,

My patches depends on your patches
https://patchwork.ozlabs.org/project/uboot/list/?series=129069, do you have plan to update it? I saw that the status is "changes required", any comments?

There was some discussion regarding this work with Frieder (CC'ed), who has prepared similar patch set.

Some portions of this series:
spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

has been applied.

However, I don't know if Frieder is going (or already has) to prepare new version of this patch set.

Quoted 342 lines

Thanks
Xiaowei

Quoted 338 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年10月21日 11:51
To: Lukasz Majewski <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar X <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Peng Ma <[email protected]>
Subject: RE: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Lukasz,

My patches depends on your patches
https://patchwork.ozlabs.org/project/uboot/list/?series=129069, do you have plan to update it? I saw that the status is "changes required", any comments?

Thanks
Xiaowei

Quoted 31 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月23日 4:48
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou Liu <[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]> Subject: Re: [U-Boot] [PATCH v5 1/5] spl:
dm: disable SPI DM flash for non-DM SPL

Quoted 6 lines · On Thu, 22 Aug 2019 01:56:48 +0000 Xiaowei Bao <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 17:50
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>; Shengzhou

Liu

Quoted 10 lines
Quoted 10 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]>
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

On Tue, 20 Aug 2019 09:00:40 +0000 Xiaowei Bao
<[email protected]> wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 16:20
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta <[email protected]>;

Shengzhou

Quoted 2 lines
Quoted 2 lines

Liu

Quoted 1 line
Quoted 1 line

<[email protected]>; jagan at amarulasolutions.com;

Prabhakar

Quoted 78 lines
Quoted 78 lines
Quoted 78 lines
Quoted 9 lines
Quoted 9 lines

Kushwaha <[email protected]>;
u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Chuanhua Han <[email protected]> Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

On Tue, 20 Aug 2019 07:51:18 +0000 Xiaowei Bao <[email protected]> wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:43
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta
<[email protected]>;

Shengzhou

Quoted 6 lines
Quoted 6 lines

Liu

Quoted 5 lines
Quoted 5 lines

<[email protected]>; jagan at amarulasolutions.com; Prabhakar Kushwaha <[email protected]>; u-boot at lists.denx.de; Jiafei Pan <[email protected]>; Pan Jiafei <[email protected]>; Chuanhua Han

<[email protected]>

Quoted 55 lines
Quoted 55 lines
Quoted 6 lines
Quoted 6 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao <[email protected]> wrote:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski <[email protected]>
Sent: 2019年8月20日 15:14
To: Xiaowei Bao <[email protected]>
Cc: wd at denx.de; Ruchika Gupta
<[email protected]>;

Shengzhou

Quoted 7 lines
Quoted 7 lines

Liu

Quoted 6 lines
Quoted 6 lines

<[email protected]>;
jagan at amarulasolutions.com; Prabhakar Kushwaha
<[email protected]>;
u-boot at lists.denx.de; Jiafei Pan
<[email protected]>; Pan Jiafei
<[email protected]>; Chuanhua Han

<[email protected]>

Quoted 34 lines
Quoted 34 lines
Quoted 10 lines
Quoted 10 lines

Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm:
disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 4 lines

From: Chuanhua Han <[email protected]>

This patch solves the problem that spiboot
cannot be performed in non-DM SPL.

Quoted 7 lines
Quoted 5 lines

I've posted recently a set of patches to move
setting of DM_SPI_FLASH to Kconfig:
https://patchwork.ozlabs.org/cover/1146494/

Please rebase your work on top of it.

Did this set of patches merge to the u-boot
mainline?

Those patches were not yet accepted to mainline.

Quoted 2 lines

Do I need to
depend on your patches?

It would be best to avoid duplicating the effort.

Quoted 2 lines

If yes, please provide the full patches link, I
can't see the contents of this set of patches.

When you open the link:
https://patchwork.ozlabs.org/cover/1146494/

On top left you have:
"Related" -> "show"

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

After clicking on it you will see the list of patches.

You may also want to use "Series" on top right and download the whole patch series.

I have check these set of patches, it don't impact my patches, my patches implemented the ESPI DM driver of

POWERPC.

Quoted 181 lines
Quoted 47 lines
Quoted 37 lines
Quoted 25 lines
Quoted 7 lines

But you add:

+#undef CONFIG_DM_SPI_FLASH

for SPL, Which is problematic as explained in the patch set.

Can I modify the patches like this?

(quoted diff) +0 -0

b/include/config_uncmd_spl.h index da94b3d..c2f9735 100644

include/config_uncmd_spl.h +0 -1
@@ -15,7 +15,6 @@
 #undef CONFIG_DM_GPIO
 #undef CONFIG_DM_I2C
 #undef CONFIG_DM_SPI
-#undef CONFIG_DM_SPI_FLASH
 #endif
 
 #undef CONFIG_DM_WARN
(quoted diff) +0 -0

b/include/configs/T208xQDS.h index 98bb334..b45ec4a 100644

include/configs/T208xQDS.h line 18

Quoted 9 lines
include/configs/T208xQDS.h +6 -0
@@ -10,6 +10,13 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+/* SPI Flash Configs */
+#if defined(CONFIG_SPL_BUILD)
+#undef CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
+#undef CONFIG_SPI_FLASH_MTD
+#endif  

The whole point is to avoid adding the above code.

Quoted 2 lines

The rationale for this can be found in the commit message:
https://patchwork.ozlabs.org/patch/1146375/

Hi Lukasz, thanks for your comments, ask a question, I modify my driver like this: diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index fd5ac97..54be036 100644

drivers/spi/fsl_espi.c +0 -0
@@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave
 *fsl)
                                * 10), spi_freq);/* Set eSPI
Quoted 1 line

BRG

clock

Quoted 15 lines

source */ }

#ifndef CONFIG_DM_SPI

drivers/spi/fsl_espi.c +1 -0
+#if !CONFIG_IS_ENABLED(DM_SPI)
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)  {
(quoted diff) +0 -0

b/configs/T2080QDS_SPIFLASH_defconfig index 7a1c580..cf53e54 100644 --- a/configs/T2080QDS_SPIFLASH_defconfig +++ b/configs/T2080QDS_SPIFLASH_defconfig

configs/T2080QDS_SPIFLASH_defconfig +2 -0
@@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_SPL_DM_SPI=y
+CONFIG_SPL_DM_SPI_FLASH=y
 
Quoted 5 lines

When I compile the driver with SPL mode, the DM or non DM mode cod will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or 1, so the DM code or non DM code will be compiled, but not both, this make me confused, do I miss something, could you tell me the reason? Thanks a lot.

So the CONFIG_IS_ENABLED(FOO) is true if:

1. The CONFIG_FOO is defined in Kconfig files (if it is defined in ./include/configs/<board.h> then CONFIG_IS_ENABLED will return false, which is wrong).

2. The CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_FOO

3. CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined CONFIG_SPL_FOO

So the CONFIG_IS_ENABLED(FOO) shall be used in conjunction with CONFIG_DM_FOO (SPI in your case).

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
include/configs/T208xQDS.h +1 -0
+  
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines

Signed-off-by: Pan Jiafei
<[email protected]> Signed-off-by:
Chuanhua Han <[email protected]> ---
Changes in v5:
- No change.
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.

 include/config_uncmd_spl.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0 -0

b/include/config_uncmd_spl.h index
c2f9735..da94b3d 100644 ---
a/include/config_uncmd_spl.h +++
b/include/config_uncmd_spl.h @@ -15,6 +15,7 @@
#undef CONFIG_DM_GPIO #undef CONFIG_DM_I2C

#undef

Quoted 39 lines
Quoted 39 lines
Quoted 24 lines
Quoted 24 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines

CONFIG_DM_SPI
+#undef CONFIG_DM_SPI_FLASH
#endif

#undef CONFIG_DM_WARN

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5,
D-82194 Groebenzell, Germany Phone:
(+49)-8142-66989-59 Fax: (+49)-8142-66989-80
Email: lukma at denx.de

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:
Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang

Denk

Quoted 3 lines

HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191022/057d1d99/attachment.sig>

#23 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Hi Lukasz, hi Xiaowei,

Quoted 12 lines · Lukasz Majewski

Hi Xiaowei,

Quoted 6 lines

Hi Lukasz,

My patches depends on your patches
https://patchwork.ozlabs.org/project/uboot/list/?series=129069, do you have plan to update it? I saw that the status is "changes required", any comments?

There was some discussion regarding this work with Frieder (CC'ed), who has prepared similar patch set.

Quoted 7 lines

Some portions of this series:
spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

has been applied.

However, I don't know if Frieder is going (or already has) to prepare new version of this patch set.

I have sent one part of the necessary changes: [1].
The latest version of the whole conversion can be found here: [2]. I need to test these changes with buildman before I send the remaining parts. I hope I will find some time to do this in the next days.

Regards,
Frieder

[1] https://patchwork.ozlabs.org/patch/1162265/
[2] https://github.com/fschrempf/u-boot/commits/spi_flash_kconfig_cleanup

#24 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 37 lines

-----Original Message-----
From: Schrempf Frieder <[email protected]>
Sent: 2019年10月22日 21:03
To: Lukasz Majewski <[email protected]>; Xiaowei Bao <[email protected]>; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Hi Lukasz, hi Xiaowei,

Quoted 7 lines · Lukasz Majewski

Hi Xiaowei,

Quoted 5 lines

Hi Lukasz,

My patches depends on your patches
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat

chwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D129069&am p;d

Quoted 1 line
Quoted 1 line

ata=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508d7 56f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6370734 62083854046&amp;sdata=H%2FbP2%2BlrtoktSegAIkwWImNoNJSGxN4wzTb wAe1oMk0%3D&amp;reserved=0, do you have plan to update it? I saw that the status is "changes required", any comments?

Quoted 9 lines

There was some discussion regarding this work with Frieder (CC'ed), who has prepared similar patch set.

Some portions of this series:
spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

has been applied.

Quoted 8 lines
Quoted 2 lines

However, I don't know if Frieder is going (or already has) to prepare new version of this patch set.

I have sent one part of the necessary changes: [1].
The latest version of the whole conversion can be found here: [2]. I need to test these changes with buildman before I send the remaining parts. I hope I will find some time to do this in the next days.

Thanks Lukasz and Schrempf, got it.

Quoted 17 lines

Regards,
Frieder

[1]
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
work.ozlabs.org%2Fpatch%2F1162265%2F&amp;data=02%7C01%7Cxiaowei. bao%40nxp.com%7Cd125df94364d44ecb97508d756f03935%7C686ea1d3bc2 b4c6fa92cd99c5c301635%7C0%7C0%7C637073462083854046&amp;sdata= 80bOgepTBhXP%2FpDRMBAeNezJV4akrOoH04%2F8A%2BUjMOo%3D&amp; reserved=0
[2]
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
com%2Ffschrempf%2Fu-boot%2Fcommits%2Fspi_flash_kconfig_cleanup&am p;data=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508 d756f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63707 3462083854046&amp;sdata=f%2BZDhMDbg8Hx%2F3ISB1D10yI2OT0HpPTu6 ZANAlGS5bU%3D&amp;reserved=0

#25 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Quoted 58 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年10月23日 11:26
To: Schrempf Frieder <[email protected]>; Lukasz Majewski <[email protected]>; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines

-----Original Message-----
From: Schrempf Frieder <[email protected]>
Sent: 2019年10月22日 21:03
To: Lukasz Majewski <[email protected]>; Xiaowei Bao <[email protected]>; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 12 lines

Hi Lukasz, hi Xiaowei,

Quoted 8 lines · Lukasz Majewski

Hi Xiaowei,

Quoted 6 lines

Hi Lukasz,

My patches depends on your patches
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fp
at

chwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D129069&am

Quoted 3 lines

p;d

Quoted 1 line
Quoted 1 line

ata=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508d7

Quoted 1 line

56f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6370734

Quoted 1 line

62083854046&amp;sdata=H%2FbP2%2BlrtoktSegAIkwWImNoNJSGxN4wzTb

Quoted 9 lines

wAe1oMk0%3D&amp;reserved=0, do you have plan to update it? I saw that the status is "changes required", any comments?

Quoted 7 lines

There was some discussion regarding this work with Frieder (CC'ed), who has prepared similar patch set.

Some portions of this series:
spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

Quoted 8 lines
Quoted 4 lines

has been applied.

However, I don't know if Frieder is going (or already has) to prepare new version of this patch set.

I have sent one part of the necessary changes: [1].
The latest version of the whole conversion can be found here: [2]. I need to test these changes with buildman before I send the remaining

Quoted 6 lines

parts.

Quoted 2 lines

I hope I will find some time to do this in the next days.

Thanks Lukasz and Schrempf, got it.

Hi Frieder,

Do you complete the test of changes, I have some patches depend on your patches, Thanks a lot.

Best regards
Xiaowei

Quoted 30 lines
Quoted 7 lines

Regards,
Frieder

[1]
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
h

work.ozlabs.org%2Fpatch%2F1162265%2F&amp;data=02%7C01%7Cxiaowei.

Quoted 1 line

bao%40nxp.com%7Cd125df94364d44ecb97508d756f03935%7C686ea1d3bc2

Quoted 1 line

b4c6fa92cd99c5c301635%7C0%7C0%7C637073462083854046&amp;sdata=

Quoted 1 line

80bOgepTBhXP%2FpDRMBAeNezJV4akrOoH04%2F8A%2BUjMOo%3D&amp;

Quoted 3 lines

reserved=0
[2]

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.

Quoted 1 line

com%2Ffschrempf%2Fu-boot%2Fcommits%2Fspi_flash_kconfig_cleanup&am

Quoted 1 line

p;data=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508

Quoted 1 line

d756f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63707

Quoted 1 line

3462083854046&amp;sdata=f%2BZDhMDbg8Hx%2F3ISB1D10yI2OT0HpPTu6

Quoted 1 line

ZANAlGS5bU%3D&amp;reserved=0

#26 lore raw

PATCH v5 1/5 spl: dm: disable SPI DM flash for non-DM SPL

Hi Xiaowei,

Quoted 63 lines · Xiaowei Bao
Quoted 63 lines

-----Original Message-----
From: Xiaowei Bao
Sent: 2019年10月23日 11:26
To: Schrempf Frieder <[email protected]>; Lukasz Majewski <[email protected]>; u-boot at lists.denx.de
Subject: RE: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 8 lines

-----Original Message-----
From: Schrempf Frieder <[email protected]>
Sent: 2019年10月22日 21:03
To: Lukasz Majewski <[email protected]>; Xiaowei Bao <[email protected]>; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL

Quoted 12 lines

Hi Lukasz, hi Xiaowei,

Quoted 8 lines · Lukasz Majewski

Hi Xiaowei,

Quoted 6 lines

Hi Lukasz,

My patches depends on your patches
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fp
at

chwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D129069&am

Quoted 3 lines

p;d

Quoted 1 line
Quoted 1 line

ata=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508d7

Quoted 1 line

56f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6370734

Quoted 1 line

62083854046&amp;sdata=H%2FbP2%2BlrtoktSegAIkwWImNoNJSGxN4wzTb

Quoted 9 lines

wAe1oMk0%3D&amp;reserved=0, do you have plan to update it? I saw that the status is "changes required", any comments?

Quoted 7 lines

There was some discussion regarding this work with Frieder (CC'ed), who has prepared similar patch set.

Some portions of this series:
spi: Split CONFIG_DM_SPI* to CONFIG_{SPL_TPL}DM_SPI*

Quoted 8 lines
Quoted 4 lines

has been applied.

However, I don't know if Frieder is going (or already has) to prepare new version of this patch set.

I have sent one part of the necessary changes: [1].
The latest version of the whole conversion can be found here: [2]. I need to test these changes with buildman before I send the remaining

parts.

Quoted 2 lines

I hope I will find some time to do this in the next days.

Quoted 6 lines
Quoted 1 line

Thanks Lukasz and Schrempf, got it.

Hi Frieder,

Do you complete the test of changes, I have some patches depend on your patches, Thanks a lot.

Sorry, the CONFIG_SPI_FLASH_MTD is merged, but the other remaining patches for CONFIG_DM_SPI_FLASH, etc. are not.
The last time I tried to get them ready I once again got caught in an endless loop of fixing Kconfig issues and testing.

If you need some of the fixes, you could try adding them to your own patchset and test and resend them.

Regards,
Frieder

Quoted 36 lines

Best regards
Xiaowei

Quoted 30 lines
Quoted 7 lines

Regards,
Frieder

[1]
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
h

work.ozlabs.org%2Fpatch%2F1162265%2F&amp;data=02%7C01%7Cxiaowei.

Quoted 1 line

bao%40nxp.com%7Cd125df94364d44ecb97508d756f03935%7C686ea1d3bc2

Quoted 1 line

b4c6fa92cd99c5c301635%7C0%7C0%7C637073462083854046&amp;sdata=

Quoted 1 line

80bOgepTBhXP%2FpDRMBAeNezJV4akrOoH04%2F8A%2BUjMOo%3D&amp;

Quoted 3 lines

reserved=0
[2]

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.

Quoted 1 line

com%2Ffschrempf%2Fu-boot%2Fcommits%2Fspi_flash_kconfig_cleanup&am

Quoted 1 line

p;data=02%7C01%7Cxiaowei.bao%40nxp.com%7Cd125df94364d44ecb97508

Quoted 1 line

d756f03935%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63707

Quoted 1 line

3462083854046&amp;sdata=f%2BZDhMDbg8Hx%2F3ISB1D10yI2OT0HpPTu6

Quoted 1 line

ZANAlGS5bU%3D&amp;reserved=0