Skip to contentSkip to conversation

spi: DM_SPI migration timeout, remainder(2)

PATCH Superseded Jagan Teki 8 participants 49 messages Nov 25, 2018 – Dec 11, 2018

Subsystems (7)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

This series fix, build issues and comments from previous series [1].

We have not heard any positive feed back about dm-conversion on spi drivers along with no response for the work done by Akash and me.

Plan is to send the same series remainder recursively based on the dm conversion updates and finally merged into v2019.04 MW.

So expecting inputs from relevant developers to move their board/drivers to support DM_SPI.

- cf_spi, lpc32xx_ssp, mxs_spi, sh_spi, soft_spi_legacy, fsl_espi drivers are drooped with their respective CONFIG items. the spi/spi-flash usage commands still build but the used spi core function calls return 0.
- non-dm code in davinci, kirkwood, ti_qspi, mpc8xxx, mxc, omap3, atmel, fsl_dspi drivers were drooped and u-boot build system will trigger warning for the same.

Note:
- Let's discuss if any foot-print issues?

Any inputs,
Jagan.

[1] https://patchwork.ozlabs.org/cover/1000444/

Jagan Teki (15):
spi: davinci: Full dm conversion
spi: kirkwood: Full dm conversion
spi: ti_qspi: Full dm conversion
spi: mpc8xxx: Convert to DM
spi: Zap cf_spi driver-related code
spi: Zap lpc32xx_ssp driver-related code
spi: Zap mxs_spi driver-related code
spi: Zap sh_spi driver-related code
spi: Zap soft_spi_legacy driver-related code
spi: mxc: Drop non-dm code
spi: omap3: Drop non-dm code
spi: atmel: Drop non-dm code
spi: Zap fsl_espi driver-related code
spi: fsl_dspi: Drop non-dm code
dm: MIGRATION: spi: Update SPI driver status

Mario Six (17):
spi: mpc8xxx: Use short type names
spi: mpc8xxx: Fix comments
spi: mpc8xxx: Rename camel-case variables
spi: mpc8xxx: Fix space after cast
spi: mpc8xxx: Fix function names in strings
spi: mpc8xxx: Replace defines with enums
spi: mpc8xxx: Use IO accessors
spi: mpc8xxx: Simplify if
spi: mpc8xxx: Get rid of is_read
spi: mpc8xxx: Simplify logic a bit
spi: mpc8xxx: Reduce scope of loop variables
spi: mpc8xxx: Make code more readable
spi: mpc8xxx: Rename variable
spi: mpc8xxx: Document LEN setting better
spi: mpc8xxx: Re-order transfer setup
spi: mpc8xxx: Fix if check
spi: mpc8xxx: Use get_timer

 Makefile                                      |  11 +
 arch/m68k/cpu/mcf5227x/cpu_init.c             |  54 --
 arch/m68k/cpu/mcf5445x/cpu_init.c             | 113 ----
 board/Arcturus/ucp1020/ucp1020.c              |   6 +
 configs/M52277EVB_defconfig                   |   1 -
 configs/M52277EVB_stmicro_defconfig           |   1 -
 configs/M54418TWR_defconfig                   |   1 -
 configs/M54418TWR_nand_mii_defconfig          |   1 -
 configs/M54418TWR_nand_rmii_defconfig         |   1 -
 configs/M54418TWR_nand_rmii_lowfreq_defconfig |   1 -
 configs/M54418TWR_serial_mii_defconfig        |   1 -
 configs/M54418TWR_serial_rmii_defconfig       |   1 -
 configs/M54451EVB_defconfig                   |   1 -
 configs/M54451EVB_stmicro_defconfig           |   1 -
 configs/M54455EVB_a66_defconfig               |   1 -
 configs/M54455EVB_defconfig                   |   1 -
 configs/M54455EVB_i66_defconfig               |   1 -
 configs/M54455EVB_intel_defconfig             |   1 -
 configs/M54455EVB_stm33_defconfig             |   1 -
 configs/bg0900_defconfig                      |   1 -
 configs/devkit3250_defconfig                  |   1 -
 configs/mx28evk_auart_console_defconfig       |   1 -
 configs/mx28evk_defconfig                     |   1 -
 configs/mx28evk_nand_defconfig                |   1 -
 configs/mx28evk_spi_defconfig                 |   1 -
 configs/sh7752evb_defconfig                   |   1 -
 configs/sh7753evb_defconfig                   |   1 -
 configs/sh7757lcr_defconfig                   |   1 -
 configs/stmark2_defconfig                     |   1 -
 configs/work_92105_defconfig                  |   1 -
 doc/driver-model/MIGRATION.txt                |  18 +-
 drivers/spi/Kconfig                           |  42 +-
 drivers/spi/Makefile                          |  22 +-
 drivers/spi/atmel_spi.c                       | 198 -------
 drivers/spi/cf_spi.c                          | 335 ------------
 drivers/spi/davinci_spi.c                     | 157 ------
 drivers/spi/fsl_dspi.c                        | 132 -----
 drivers/spi/fsl_espi.c                        | 383 --------------
 drivers/spi/kirkwood_spi.c                    | 218 ++------
 drivers/spi/lpc32xx_ssp.c                     | 134 -----
 drivers/spi/mpc8xxx_spi.c                     | 279 ++++++----
 drivers/spi/mxc_spi.c                         | 123 +----
 drivers/spi/mxs_spi.c                         | 358 -------------
 drivers/spi/omap3_spi.c                       | 126 -----
 drivers/spi/sh_spi.c                          | 249 ---------
 drivers/spi/sh_spi.h                          |  67 ---
 drivers/spi/soft_spi_legacy.c                 | 168 ------
 drivers/spi/spi.c                             |  38 ++
 drivers/spi/ti_qspi.c                         | 490 +++++++-----------
 include/configs/M52277EVB.h                   |   1 -
 include/configs/M54418TWR.h                   |   1 -
 include/configs/M54451EVB.h                   |   1 -
 include/configs/M54455EVB.h                   |   1 -
 include/configs/MPC8349EMDS.h                 |   3 -
 include/configs/devkit3250.h                  |   5 -
 include/configs/sh7752evb.h                   |   3 -
 include/configs/sh7753evb.h                   |   3 -
 include/configs/sh7757lcr.h                   |   3 -
 include/configs/stmark2.h                     |   1 -
 include/configs/work_92105.h                  |   5 -
 include/configs/zipitz2.h                     |   1 -
 include/dm/platform_data/spi_kirkwood.h       |  15 +
 include/dm/platform_data/spi_ti_qspi.h        |  19 +
 scripts/config_whitelist.txt                  |   3 -
 64 files changed, 502 insertions(+), 3310 deletions(-)
 delete mode 100644 drivers/spi/cf_spi.c
 delete mode 100644 drivers/spi/fsl_espi.c
 delete mode 100644 drivers/spi/lpc32xx_ssp.c
 delete mode 100644 drivers/spi/mxs_spi.c
 delete mode 100644 drivers/spi/sh_spi.c
 delete mode 100644 drivers/spi/sh_spi.h
 delete mode 100644 drivers/spi/soft_spi_legacy.c
 create mode 100644 include/dm/platform_data/spi_kirkwood.h
 create mode 100644 include/dm/platform_data/spi_ti_qspi.h
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH v2 1/32 spi: davinci: Full dm conversion

davinci_spi now support dt along with platform data, respective boards need to switch into dm for the same.

Cc Adam Ford <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Peter Howard <[email protected]>
Cc Tom Rini <[email protected]>
---
 Makefile                  |   9 +++
 drivers/spi/Makefile      |   2 +-
 drivers/spi/davinci_spi.c | 157 --------------------------------------
 drivers/spi/spi.c         |  38 +++++++++
 4 files changed, 48 insertions(+), 158 deletions(-)
Makefile +9 -0
index 552687db53..d06cb5c287 100644
@@ -917,6 +917,15 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "(possibly in a subsequent patch in your series)"
 	@echo "before sending patches to the mailing list."
 	@echo "===================================================="
+endif
+ifeq ($(CONFIG_DM_SPI),)
+ifeq ($(CONFIG_DAVINCI_SPI),y)
+	@echo "===================== WARNING ======================"
+	@echo "This board uses SPI driver from drivers/spi/ without"
+	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
+	@echo "otherwise SPI on this board, cannot work."
+	@echo "===================================================="
+endif
 endif
 	@# Check that this build does not use CONFIG options that we do not
 	@# know about unless they are in Kconfig. All the existing CONFIG
drivers/spi/Makefile +1 -1
index 7242ea7e40..cf5a5cccc0 100644
@@ -6,6 +6,7 @@
 # There are many options which enable SPI, so make this library available
 ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
+obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -22,7 +23,6 @@ obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
-obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
drivers/spi/davinci_spi.c +0 -157

178 lines not on this page · raw message

drivers/spi/spi.c +38 -0
index 22910de0dd..4d1ade797b 100644
@@ -38,3 +38,41 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 
 	return ptr;
 }
+
+/**
+ * These are non-dm spi core operations, will remove once all driver
+ * converted into full driver model.
+ */
+__weak void spi_cs_activate(struct spi_slave *slave)
+{
+}
+
+__weak void spi_cs_deactivate(struct spi_slave *slave)
+{
+}
+
+__weak struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+					 unsigned int max_hz,
+					 unsigned int mode)
+{
+	return NULL;
+}
+
+__weak void spi_free_slave(struct spi_slave *slave)
+{
+}
+
+__weak int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
+		    const void *dout, void *din, unsigned long flags)
+{
+	return 0;
+}
+
+__weak int spi_claim_bus(struct spi_slave *slave)
+{
+	return 0;
+}
+
+__weak void spi_release_bus(struct spi_slave *slave)
+{
+}
Signature · 1 line
2.18.0.321.gffc6fa0e3
#2 lore raw

PATCH v2 1/32 spi: davinci: Full dm conversion

Quoted 10 lines · Jagan Teki

davinci_spi now support dt along with platform data, respective boards need to switch into dm for the same.

Cc Adam Ford <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Peter Howard <[email protected]>
Cc Tom Rini <[email protected]>

Jagan,

I tried to apply the entire series against a clean origin/master, but it's not applying cleanly.

adam

Quoted 282 lines
---
 Makefile                  |   9 +++
 drivers/spi/Makefile      |   2 +-
 drivers/spi/davinci_spi.c | 157 --------------------------------------
 drivers/spi/spi.c         |  38 +++++++++
 4 files changed, 48 insertions(+), 158 deletions(-)
Makefile +9 -0
index 552687db53..d06cb5c287 100644
@@ -917,6 +917,15 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
        @echo "(possibly in a subsequent patch in your series)"
        @echo "before sending patches to the mailing list."
        @echo "===================================================="
+endif
+ifeq ($(CONFIG_DM_SPI),)
+ifeq ($(CONFIG_DAVINCI_SPI),y)
+       @echo "===================== WARNING ======================"
+       @echo "This board uses SPI driver from drivers/spi/ without"
+       @echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
+       @echo "otherwise SPI on this board, cannot work."
+       @echo "===================================================="
+endif
 endif
        @# Check that this build does not use CONFIG options that we do not
        @# know about unless they are in Kconfig. All the existing CONFIG
drivers/spi/Makefile +1 -1
index 7242ea7e40..cf5a5cccc0 100644
@@ -6,6 +6,7 @@
 # There are many options which enable SPI, so make this library available
 ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
+obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -22,7 +23,6 @@ obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
-obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
drivers/spi/davinci_spi.c +0 -157
index 4d2c106440..c1646f6cdc 100644
@@ -52,41 +52,6 @@
 /* SPIDEF */
 #define SPIDEF_CSDEF0_MASK     BIT(0)
 
-#ifndef CONFIG_DM_SPI
-#define SPI0_BUS               0
-#define SPI0_BASE              CONFIG_SYS_SPI_BASE
-/*
- * Define default SPI0_NUM_CS as 1 for existing platforms that uses this
- * driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS
- * if more than one CS is supported and by defining CONFIG_SYS_SPI0.
- */
-#ifndef CONFIG_SYS_SPI0
-#define SPI0_NUM_CS            1
-#else
-#define SPI0_NUM_CS            CONFIG_SYS_SPI0_NUM_CS
-#endif
-
-/*
- * define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and
- * CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus
- */
-#ifdef CONFIG_SYS_SPI1
-#define SPI1_BUS               1
-#define SPI1_NUM_CS            CONFIG_SYS_SPI1_NUM_CS
-#define SPI1_BASE              CONFIG_SYS_SPI1_BASE
-#endif
-
-/*
- * define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and
- * CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus
- */
-#ifdef CONFIG_SYS_SPI2
-#define SPI2_BUS               2
-#define SPI2_NUM_CS            CONFIG_SYS_SPI2_NUM_CS
-#define SPI2_BASE              CONFIG_SYS_SPI2_BASE
-#endif
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /* davinci spi register set */
@@ -119,9 +84,6 @@ struct davinci_spi_regs {
 
 /* davinci spi slave */
 struct davinci_spi_slave {
-#ifndef CONFIG_DM_SPI
-       struct spi_slave slave;
-#endif
        struct davinci_spi_regs *regs;
        unsigned int freq; /* current SPI bus frequency */
        unsigned int mode; /* current SPI mode used */
@@ -343,124 +305,6 @@ out:
        return 0;
 }
 
-#ifndef CONFIG_DM_SPI
-
-static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave)
-{
-       return container_of(slave, struct davinci_spi_slave, slave);
-}
-
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
-{
-       int ret = 0;
-
-       switch (bus) {
-       case SPI0_BUS:
-               if (cs < SPI0_NUM_CS)
-                       ret = 1;
-               break;
-#ifdef CONFIG_SYS_SPI1
-       case SPI1_BUS:
-               if (cs < SPI1_NUM_CS)
-                       ret = 1;
-               break;
-#endif
-#ifdef CONFIG_SYS_SPI2
-       case SPI2_BUS:
-               if (cs < SPI2_NUM_CS)
-                       ret = 1;
-               break;
-#endif
-       default:
-               /* Invalid bus number. Do nothing */
-               break;
-       }
-       return ret;
-}
-
-void spi_cs_activate(struct spi_slave *slave)
-{
-       /* do nothing */
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
-       /* do nothing */
-}
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-                       unsigned int max_hz, unsigned int mode)
-{
-       struct davinci_spi_slave        *ds;
-
-       if (!spi_cs_is_valid(bus, cs))
-               return NULL;
-
-       ds = spi_alloc_slave(struct davinci_spi_slave, bus, cs);
-       if (!ds)
-               return NULL;
-
-       switch (bus) {
-       case SPI0_BUS:
-               ds->regs = (struct davinci_spi_regs *)SPI0_BASE;
-               break;
-#ifdef CONFIG_SYS_SPI1
-       case SPI1_BUS:
-               ds->regs = (struct davinci_spi_regs *)SPI1_BASE;
-               break;
-#endif
-#ifdef CONFIG_SYS_SPI2
-       case SPI2_BUS:
-               ds->regs = (struct davinci_spi_regs *)SPI2_BASE;
-               break;
-#endif
-       default: /* Invalid bus number */
-               return NULL;
-       }
-
-       ds->freq = max_hz;
-       ds->mode = mode;
-
-       return &ds->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
-       struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
-       free(ds);
-}
-
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
-            const void *dout, void *din, unsigned long flags)
-{
-       struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
-       ds->cur_cs = slave->cs;
-
-       return __davinci_spi_xfer(ds, bitlen, dout, din, flags);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
-       struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
-#ifdef CONFIG_SPI_HALF_DUPLEX
-       ds->half_duplex = true;
-#else
-       ds->half_duplex = false;
-#endif
-       return __davinci_spi_claim_bus(ds, ds->slave.cs);
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
-       struct davinci_spi_slave *ds = to_davinci_spi(slave);
-
-       __davinci_spi_release_bus(ds);
-}
-
-#else
 static int davinci_spi_set_speed(struct udevice *bus, uint max_hz)
 {
        struct davinci_spi_slave *ds = dev_get_priv(bus);
@@ -579,4 +423,3 @@ U_BOOT_DRIVER(davinci_spi) = {
        .ops = &davinci_spi_ops,
        .priv_auto_alloc_size = sizeof(struct davinci_spi_slave),
 };
-#endif
drivers/spi/spi.c +38 -1
index 22910de0dd..4d1ade797b 100644
@@ -38,3 +38,41 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,
 
        return ptr;
 }
+
+/**
+ * These are non-dm spi core operations, will remove once all driver
+ * converted into full driver model.
+ */
+__weak void spi_cs_activate(struct spi_slave *slave)
+{
+}
+
+__weak void spi_cs_deactivate(struct spi_slave *slave)
+{
+}
+
+__weak struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+                                        unsigned int max_hz,
+                                        unsigned int mode)
+{
+       return NULL;
+}
+
+__weak void spi_free_slave(struct spi_slave *slave)
+{
+}
+
+__weak int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
+                   const void *dout, void *din, unsigned long flags)
+{
+       return 0;
+}
+
+__weak int spi_claim_bus(struct spi_slave *slave)
+{
+       return 0;
+}
+
+__weak void spi_release_bus(struct spi_slave *slave)
+{
+}
--

2.18.0.321.gffc6fa0e3

author
#3 lore raw

PATCH v2 1/32 spi: davinci: Full dm conversion

Quoted 14 lines · Adam Ford
Quoted 10 lines · Jagan Teki

davinci_spi now support dt along with platform data, respective boards need to switch into dm for the same.

Cc Adam Ford <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Peter Howard <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 4 lines

Jagan,

I tried to apply the entire series against a clean origin/master, but it's not applying cleanly.

Yeah.. I have few patches before. anyway use spi-dm-migrate branch.

#4 lore raw

PATCH v2 1/32 spi: davinci: Full dm conversion

Quoted 16 lines · Jagan Teki
Quoted 14 lines · Adam Ford
Quoted 10 lines · Jagan Teki

davinci_spi now support dt along with platform data, respective boards need to switch into dm for the same.

Cc Adam Ford <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Peter Howard <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 6 lines
Quoted 4 lines

Jagan,

I tried to apply the entire series against a clean origin/master, but it's not applying cleanly.

Yeah.. I have few patches before. anyway use spi-dm-migrate branch.

I had to apply a pending patch [1] to make it work. Scripts/get_maintainer didn't flag you as a CC, but since I have your attention, can you pull in [1]? With that, I can read/write to SPI Flash again.

[1] - https://patchwork.ozlabs.org/patch/1000533/

With that other patch applied, go ahead and add

author
#5 lore raw

PATCH v2 2/32 spi: kirkwood: Full dm conversion

In reply to Jagan Teki

kirkwood now support dt along with platform data, respective boards need to switch into dm for the same.

---
 Makefile                                |   2 +-
 drivers/spi/Makefile                    |   2 +-
 drivers/spi/kirkwood_spi.c              | 218 ++++--------------------
 include/dm/platform_data/spi_kirkwood.h |  15 ++
 4 files changed, 47 insertions(+), 190 deletions(-)
 create mode 100644 include/dm/platform_data/spi_kirkwood.h
Makefile +1 -1
index d06cb5c287..214f1bcdbf 100644
@@ -919,7 +919,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================================================="
 endif
 ifeq ($(CONFIG_DM_SPI),)
-ifeq ($(CONFIG_DAVINCI_SPI),y)
+ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index cf5a5cccc0..3c74418992 100644
@@ -7,6 +7,7 @@
 ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
+obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -29,7 +30,6 @@ obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
 obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
-obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
drivers/spi/kirkwood_spi.c +30 -188

292 lines not on this page · raw message

include/dm/platform_data/spi_kirkwood.h new file +15 -0
new file mode 100644
index 0000000000..ae9b2783a9
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2018 Jagan Teki <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __spi_kirkwood_h
+#define __spi_kirkwood_h
+
+struct mvebu_spi_platdata {
+	struct kwspi_registers *spireg;
+	bool is_errata_50mhz_ac;
+};
+
+#endif /* __spi_kirkwood_h */
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#6 lore raw

PATCH v2 3/32 spi: ti_qspi: Full dm conversion

In reply to Jagan Teki

ti_qspi now support dt along with platform data, respective boards need to switch into dm for the same.

Cc Tom Rini <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Peter Howard <[email protected]>
---
 Makefile                               |   2 +-
 drivers/spi/Makefile                   |   2 +-
 drivers/spi/ti_qspi.c                  | 490 +++++++++----------------
 include/dm/platform_data/spi_ti_qspi.h |  19 +
 4 files changed, 198 insertions(+), 315 deletions(-)
 create mode 100644 include/dm/platform_data/spi_ti_qspi.h
Makefile +1 -1
index 214f1bcdbf..efa68e7343 100644
@@ -919,7 +919,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================================================="
 endif
 ifeq ($(CONFIG_DM_SPI),)
-ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI),y),y)
+ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index 3c74418992..748d9a90ab 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
+obj-$(CONFIG_TI_QSPI) += ti_qspi.o
 else
 obj-y += spi.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o
@@ -52,7 +53,6 @@ obj-$(CONFIG_TEGRA114_SPI) += tegra114_spi.o
 obj-$(CONFIG_TEGRA20_SFLASH) += tegra20_sflash.o
 obj-$(CONFIG_TEGRA20_SLINK) += tegra20_slink.o
 obj-$(CONFIG_TEGRA210_QSPI) += tegra210_qspi.o
-obj-$(CONFIG_TI_QSPI) += ti_qspi.o
 obj-$(CONFIG_XILINX_SPI) += xilinx_spi.o
 obj-$(CONFIG_ZYNQ_SPI) += zynq_spi.o
 obj-$(CONFIG_ZYNQ_QSPI) += zynq_qspi.o
drivers/spi/ti_qspi.c +177 -313

658 lines not on this page · raw message

include/dm/platform_data/spi_ti_qspi.h new file +19 -0
new file mode 100644
index 0000000000..3f5355284e
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2018 Jagan Teki <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef __spi_ti_qspi_h
+#define __spi_ti_qspi_h
+
+struct ti_qspi_platdata {
+	struct ti_qspi_regs *base;
+	void *ctrl_mod_mmap;
+	ulong fclk;
+	void *memory_map;
+	uint max_hz;
+	u32 num_cs;
+};
+
+#endif /* __spi_ti_qspi_h */
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#7 lore raw

PATCH v2 4/32 spi: mpc8xxx: Use short type names

In reply to Jagan Teki

From: Mario Six <[email protected]>

The function signatures in the driver are quite long as is. Use short type names (uint etc.) to make them more readable.

---
 drivers/spi/mpc8xxx_spi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -7
index 8d6d86d2b0..0c77f95159 100644
@@ -20,8 +20,7 @@
 
 #define SPI_TIMEOUT	1000
 
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-		unsigned int max_hz, unsigned int mode)
+struct spi_slave *spi_setup_slave(uint bus, uint cs, uint max_hz, uint mode)
 {
 	struct spi_slave *slave;
 
@@ -68,17 +67,16 @@ int spi_claim_bus(struct spi_slave *slave)
 
 void spi_release_bus(struct spi_slave *slave)
 {
-
 }
 
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
-		void *din, unsigned long flags)
+int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
+	     ulong flags)
 {
 	volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi;
-	unsigned int tmpdout, tmpdin, event;
+	uint tmpdout, tmpdin, event;
 	int numBlks = DIV_ROUND_UP(bitlen, 32);
 	int tm, isRead = 0;
-	unsigned char charSize = 32;
+	uchar charSize = 32;
 
 	debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
 	      slave->bus, slave->cs, *(uint *) dout, *(uint *) din, bitlen);
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#8 lore raw

PATCH v2 5/32 spi: mpc8xxx: Fix comments

In reply to Jagan Teki

From: Mario Six <[email protected]>

There are some comments on the same line as the code they document. Put comments above the code lines they document, so the line length is not unnecessarily increased.

---
 drivers/spi/mpc8xxx_spi.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/spi/mpc8xxx_spi.c +14 -8
index 0c77f95159..3016cfe2ca 100644
@@ -53,11 +53,14 @@ void spi_init(void)
 	 * some registers
 	 */
 	spi->mode = SPI_MODE_REV | SPI_MODE_MS | SPI_MODE_EN;
-	spi->mode = (spi->mode & 0xfff0ffff) | BIT(16); /* Use SYSCLK / 8
-							     (16.67MHz typ.) */
-	spi->event = 0xffffffff;	/* Clear all SPI events */
-	spi->mask = 0x00000000;	/* Mask  all SPI interrupts */
-	spi->com = 0;		/* LST bit doesn't do anything, so disregard */
+	/* Use SYSCLK / 8 (16.67MHz typ.) */
+	spi->mode = (spi->mode & 0xfff0ffff) | BIT(16);
+	/* Clear all SPI events */
+	spi->event = 0xffffffff;
+	/* Mask  all SPI interrupts */
+	spi->mask = 0x00000000;
+	/* LST bit doesn't do anything, so disregard */
+	spi->com = 0;
 }
 
 int spi_claim_bus(struct spi_slave *slave)
@@ -84,9 +87,10 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	if (flags & SPI_XFER_BEGIN)
 		spi_cs_activate(slave);
 
-	spi->event = 0xffffffff;	/* Clear all SPI events */
+	/* Clear all SPI events */
+	spi->event = 0xffffffff;
 
-	/* handle data in 32-bit chunks */
+	/* Handle data in 32-bit chunks */
 	while (numBlks--) {
 		tmpdout = 0;
 		charSize = (bitlen >= 32 ? 32 : bitlen);
@@ -120,7 +124,9 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
 		spi->mode |= SPI_MODE_EN;
 
-		spi->tx = tmpdout;	/* Write the data out */
+		/* Write the data out */
+		spi->tx = tmpdout;
+
 		debug("*** spi_xfer: ... %08x written\n", tmpdout);
 
 		/*
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#9 lore raw

PATCH v2 6/32 spi: mpc8xxx: Rename camel-case variables

In reply to Jagan Teki

From: Mario Six <[email protected]>

There are three variables that have camel-case names, which is not the preferred naming style.

Give those variables more compliant names instead.

---
 drivers/spi/mpc8xxx_spi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/spi/mpc8xxx_spi.c +11 -11
index 3016cfe2ca..0393765b6f 100644
@@ -77,9 +77,9 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 {
 	volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi;
 	uint tmpdout, tmpdin, event;
-	int numBlks = DIV_ROUND_UP(bitlen, 32);
-	int tm, isRead = 0;
-	uchar charSize = 32;
+	int num_blks = DIV_ROUND_UP(bitlen, 32);
+	int tm, is_read = 0;
+	uchar char_size = 32;
 
 	debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
 	      slave->bus, slave->cs, *(uint *) dout, *(uint *) din, bitlen);
@@ -91,12 +91,12 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	spi->event = 0xffffffff;
 
 	/* Handle data in 32-bit chunks */
-	while (numBlks--) {
+	while (num_blks--) {
 		tmpdout = 0;
-		charSize = (bitlen >= 32 ? 32 : bitlen);
+		char_size = (bitlen >= 32 ? 32 : bitlen);
 
 		/* Shift data so it's msb-justified */
-		tmpdout = *(u32 *) dout >> (32 - charSize);
+		tmpdout = *(u32 *) dout >> (32 - char_size);
 
 		/* The LEN field of the SPMODE register is set as follows:
 		 *
@@ -134,15 +134,15 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * or time out (1 second = 1000 ms)
 		 * The NE event must be read and cleared first
 		 */
-		for (tm = 0, isRead = 0; tm < SPI_TIMEOUT; ++tm) {
+		for (tm = 0, is_read = 0; tm < SPI_TIMEOUT; ++tm) {
 			event = spi->event;
 			if (event & SPI_EV_NE) {
 				tmpdin = spi->rx;
 				spi->event |= SPI_EV_NE;
-				isRead = 1;
+				is_read = 1;
 
-				*(u32 *) din = (tmpdin << (32 - charSize));
-				if (charSize == 32) {
+				*(u32 *) din = (tmpdin << (32 - char_size));
+				if (char_size == 32) {
 					/* Advance output buffer by 32 bits */
 					din += 4;
 				}
@@ -153,7 +153,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 			 * in the future put an arbitrary delay after writing
 			 * the device.  Arbitrary delays suck, though...
 			 */
-			if (isRead && (event & SPI_EV_NF))
+			if (is_read && (event & SPI_EV_NF))
 				break;
 		}
 		if (tm >= SPI_TIMEOUT)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#10 lore raw

PATCH v2 7/32 spi: mpc8xxx: Fix space after cast

In reply to Jagan Teki

From: Mario Six <[email protected]>

Fix all "superfluous space after case" style errors.

---
 drivers/spi/mpc8xxx_spi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/mpc8xxx_spi.c +3 -3
index 0393765b6f..1424e7febe 100644
@@ -82,7 +82,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	uchar char_size = 32;
 
 	debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
-	      slave->bus, slave->cs, *(uint *) dout, *(uint *) din, bitlen);
+	      slave->bus, slave->cs, *(uint *)dout, *(uint *)din, bitlen);
 
 	if (flags & SPI_XFER_BEGIN)
 		spi_cs_activate(slave);
@@ -96,7 +96,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		char_size = (bitlen >= 32 ? 32 : bitlen);
 
 		/* Shift data so it's msb-justified */
-		tmpdout = *(u32 *) dout >> (32 - char_size);
+		tmpdout = *(u32 *)dout >> (32 - char_size);
 
 		/* The LEN field of the SPMODE register is set as follows:
 		 *
@@ -141,7 +141,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 				spi->event |= SPI_EV_NE;
 				is_read = 1;
 
-				*(u32 *) din = (tmpdin << (32 - char_size));
+				*(u32 *)din = (tmpdin << (32 - char_size));
 				if (char_size == 32) {
 					/* Advance output buffer by 32 bits */
 					din += 4;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#11 lore raw

PATCH v2 8/32 spi: mpc8xxx: Fix function names in strings

In reply to Jagan Teki

From: Mario Six <[email protected]>

Replace the function name with a "%s" format string and the __func__ variable in debug statements (as proposed by checkpatch).

---
 drivers/spi/mpc8xxx_spi.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -4
index 1424e7febe..91b639f1e6 100644
@@ -81,7 +81,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	int tm, is_read = 0;
 	uchar char_size = 32;
 
-	debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
+	debug("%s: slave %u:%u dout %08X din %08X bitlen %u\n", __func__,
 	      slave->bus, slave->cs, *(uint *)dout, *(uint *)din, bitlen);
 
 	if (flags & SPI_XFER_BEGIN)
@@ -127,7 +127,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		/* Write the data out */
 		spi->tx = tmpdout;
 
-		debug("*** spi_xfer: ... %08x written\n", tmpdout);
+		debug("*** %s: ... %08x written\n", __func__, tmpdout);
 
 		/*
 		 * Wait for SPI transmit to get out
@@ -157,9 +157,10 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 				break;
 		}
 		if (tm >= SPI_TIMEOUT)
-			puts("*** spi_xfer: Time out during SPI transfer");
+			debug("*** %s: Time out during SPI transfer\n",
+			      __func__);
 
-		debug("*** spi_xfer: transfer ended. Value=%08x\n", tmpdin);
+		debug("*** %s: transfer ended. Value=%08x\n", __func__, tmpdin);
 	}
 
 	if (flags & SPI_XFER_END)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#12 lore raw

PATCH v2 9/32 spi: mpc8xxx: Replace defines with enums

In reply to Jagan Teki

From: Mario Six <[email protected]>

Replace pre-processor defines with proper enums, and use the BIT macro where applicable.

---
 drivers/spi/mpc8xxx_spi.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/spi/mpc8xxx_spi.c +19 -7
index 91b639f1e6..7b2ab1e4af 100644
@@ -10,13 +10,25 @@
 #include <spi.h>
 #include <asm/mpc8xxx_spi.h>
 
-#define SPI_EV_NE	(0x80000000 >> 22)	/* Receiver Not Empty */
-#define SPI_EV_NF	(0x80000000 >> 23)	/* Transmitter Not Full */
-
-#define SPI_MODE_LOOP	(0x80000000 >> 1)	/* Loopback mode */
-#define SPI_MODE_REV	(0x80000000 >> 5)	/* Reverse mode - MSB first */
-#define SPI_MODE_MS	(0x80000000 >> 6)	/* Always master */
-#define SPI_MODE_EN	(0x80000000 >> 7)	/* Enable interface */
+enum {
+	SPI_EV_NE = BIT(31 - 22),	/* Receiver Not Empty */
+	SPI_EV_NF = BIT(31 - 23),	/* Transmitter Not Full */
+};
+
+enum {
+	SPI_MODE_LOOP  = BIT(31 - 1),	/* Loopback mode */
+	SPI_MODE_CI    = BIT(31 - 2),	/* Clock invert */
+	SPI_MODE_CP    = BIT(31 - 3),	/* Clock phase */
+	SPI_MODE_DIV16 = BIT(31 - 4),	/* Divide clock source by 16 */
+	SPI_MODE_REV   = BIT(31 - 5),	/* Reverse mode - MSB first */
+	SPI_MODE_MS    = BIT(31 - 6),	/* Always master */
+	SPI_MODE_EN    = BIT(31 - 7),	/* Enable interface */
+
+	SPI_MODE_LEN_MASK = 0xf00000,
+	SPI_MODE_PM_MASK = 0xf0000,
+
+	SPI_COM_LST = BIT(31 - 9),
+};
 
 #define SPI_TIMEOUT	1000
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#13 lore raw

PATCH v2 10/32 spi: mpc8xxx: Use IO accessors

In reply to Jagan Teki

From: Mario Six <[email protected]>

Accesses to the register map are currently done by directly reading and writing the structure.

Switch to the appropriate IO accessors instead.

---
 drivers/spi/mpc8xxx_spi.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/spi/mpc8xxx_spi.c +19 -19
index 7b2ab1e4af..da9e1e3f98 100644
@@ -58,21 +58,21 @@ void spi_free_slave(struct spi_slave *slave)
 
 void spi_init(void)
 {
-	volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi;
+	spi8xxx_t *spi = &((immap_t *)(CONFIG_SYS_IMMR))->spi;
 
 	/*
 	 * SPI pins on the MPC83xx are not muxed, so all we do is initialize
 	 * some registers
 	 */
-	spi->mode = SPI_MODE_REV | SPI_MODE_MS | SPI_MODE_EN;
+	out_be32(&spi->mode, SPI_MODE_REV | SPI_MODE_MS | SPI_MODE_EN);
 	/* Use SYSCLK / 8 (16.67MHz typ.) */
-	spi->mode = (spi->mode & 0xfff0ffff) | BIT(16);
+	clrsetbits_be32(&spi->mode, 0x000f0000, BIT(16));
 	/* Clear all SPI events */
-	spi->event = 0xffffffff;
+	setbits_be32(&spi->event, 0xffffffff);
 	/* Mask  all SPI interrupts */
-	spi->mask = 0x00000000;
+	clrbits_be32(&spi->mask, 0xffffffff);
 	/* LST bit doesn't do anything, so disregard */
-	spi->com = 0;
+	out_be32(&spi->com, 0);
 }
 
 int spi_claim_bus(struct spi_slave *slave)
@@ -87,7 +87,7 @@ void spi_release_bus(struct spi_slave *slave)
 int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	     ulong flags)
 {
-	volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi;
+	spi8xxx_t *spi = &((immap_t *)(CONFIG_SYS_IMMR))->spi;
 	uint tmpdout, tmpdin, event;
 	int num_blks = DIV_ROUND_UP(bitlen, 32);
 	int tm, is_read = 0;
@@ -100,7 +100,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		spi_cs_activate(slave);
 
 	/* Clear all SPI events */
-	spi->event = 0xffffffff;
+	setbits_be32(&spi->event, 0xffffffff);
 
 	/* Handle data in 32-bit chunks */
 	while (num_blks--) {
@@ -118,26 +118,26 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * len > 16               0
 		 */
 
-		spi->mode &= ~SPI_MODE_EN;
+		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
 		if (bitlen <= 16) {
 			if (bitlen <= 4)
-				spi->mode = (spi->mode & 0xff0fffff) |
-					    (3 << 20);
+				clrsetbits_be32(&spi->mode, 0x00f00000,
+						(3 << 20));
 			else
-				spi->mode = (spi->mode & 0xff0fffff) |
-					    ((bitlen - 1) << 20);
+				clrsetbits_be32(&spi->mode, 0x00f00000,
+						((bitlen - 1) << 20));
 		} else {
-			spi->mode = (spi->mode & 0xff0fffff);
+			clrbits_be32(&spi->mode, 0x00f00000);
 			/* Set up the next iteration if sending > 32 bits */
 			bitlen -= 32;
 			dout += 4;
 		}
 
-		spi->mode |= SPI_MODE_EN;
+		setbits_be32(&spi->mode, SPI_MODE_EN);
 
 		/* Write the data out */
-		spi->tx = tmpdout;
+		out_be32(&spi->tx, tmpdout);
 
 		debug("*** %s: ... %08x written\n", __func__, tmpdout);
 
@@ -147,10 +147,10 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * The NE event must be read and cleared first
 		 */
 		for (tm = 0, is_read = 0; tm < SPI_TIMEOUT; ++tm) {
-			event = spi->event;
+			event = in_be32(&spi->event);
 			if (event & SPI_EV_NE) {
-				tmpdin = spi->rx;
-				spi->event |= SPI_EV_NE;
+				tmpdin = in_be32(&spi->rx);
+				setbits_be32(&spi->event, SPI_EV_NE);
 				is_read = 1;
 
 				*(u32 *)din = (tmpdin << (32 - char_size));
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#14 lore raw

PATCH v2 11/32 spi: mpc8xxx: Simplify if

In reply to Jagan Teki

From: Mario Six <[email protected]>

Instead of having a nested if block, just have two branches within the overarching if block to eliminate one nesting level.

---
 drivers/spi/mpc8xxx_spi.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -7
index da9e1e3f98..ca34570901 100644
@@ -120,13 +120,11 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
 		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
-		if (bitlen <= 16) {
-			if (bitlen <= 4)
-				clrsetbits_be32(&spi->mode, 0x00f00000,
-						(3 << 20));
-			else
-				clrsetbits_be32(&spi->mode, 0x00f00000,
-						((bitlen - 1) << 20));
+		if (bitlen <= 4) {
+			clrsetbits_be32(&spi->mode, 0x00f00000, (3 << 20));
+		} else if (bitlen <= 16) {
+			clrsetbits_be32(&spi->mode, 0x00f00000,
+					((bitlen - 1) << 20));
 		} else {
 			clrbits_be32(&spi->mode, 0x00f00000);
 			/* Set up the next iteration if sending > 32 bits */
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#15 lore raw

PATCH v2 12/32 spi: mpc8xxx: Get rid of is_read

In reply to Jagan Teki

From: Mario Six <[email protected]>

Get rid of the is_read variable, and just keep the state of the "not empty" and "not full" events in two boolean variables within the loop body.

---
 drivers/spi/mpc8xxx_spi.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/spi/mpc8xxx_spi.c +7 -5
index ca34570901..962ef710f8 100644
@@ -90,7 +90,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	spi8xxx_t *spi = &((immap_t *)(CONFIG_SYS_IMMR))->spi;
 	uint tmpdout, tmpdin, event;
 	int num_blks = DIV_ROUND_UP(bitlen, 32);
-	int tm, is_read = 0;
+	int tm;
 	uchar char_size = 32;
 
 	debug("%s: slave %u:%u dout %08X din %08X bitlen %u\n", __func__,
@@ -144,12 +144,14 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * or time out (1 second = 1000 ms)
 		 * The NE event must be read and cleared first
 		 */
-		for (tm = 0, is_read = 0; tm < SPI_TIMEOUT; ++tm) {
+		for (tm = 0; tm < SPI_TIMEOUT; ++tm) {
 			event = in_be32(&spi->event);
-			if (event & SPI_EV_NE) {
+			bool have_ne = event & SPI_EV_NE;
+			bool have_nf = event & SPI_EV_NF;
+
+			if (have_ne) {
 				tmpdin = in_be32(&spi->rx);
 				setbits_be32(&spi->event, SPI_EV_NE);
-				is_read = 1;
 
 				*(u32 *)din = (tmpdin << (32 - char_size));
 				if (char_size == 32) {
@@ -163,7 +165,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 			 * in the future put an arbitrary delay after writing
 			 * the device.  Arbitrary delays suck, though...
 			 */
-			if (is_read && (event & SPI_EV_NF))
+			if (have_ne && have_nf)
 				break;
 		}
 		if (tm >= SPI_TIMEOUT)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#16 lore raw

PATCH v2 13/32 spi: mpc8xxx: Simplify logic a bit

In reply to Jagan Teki

From: Mario Six <[email protected]>

We do nothing in the loop if the "not empty" event was not detected. To simplify the logic, check if this is the case, and skip the execution of the loop early to reduce the nesting level and flag checking.

---
 drivers/spi/mpc8xxx_spi.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/spi/mpc8xxx_spi.c +13 -10
index 962ef710f8..a2e698ea17 100644
@@ -149,25 +149,28 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 			bool have_ne = event & SPI_EV_NE;
 			bool have_nf = event & SPI_EV_NF;
 
-			if (have_ne) {
-				tmpdin = in_be32(&spi->rx);
-				setbits_be32(&spi->event, SPI_EV_NE);
-
-				*(u32 *)din = (tmpdin << (32 - char_size));
-				if (char_size == 32) {
-					/* Advance output buffer by 32 bits */
-					din += 4;
-				}
+			if (!have_ne)
+				continue;
+
+			tmpdin = in_be32(&spi->rx);
+			setbits_be32(&spi->event, SPI_EV_NE);
+
+			*(u32 *)din = (tmpdin << (32 - char_size));
+			if (char_size == 32) {
+				/* Advance output buffer by 32 bits */
+				din += 4;
 			}
+
 			/*
 			 * Only bail when we've had both NE and NF events.
 			 * This will cause timeouts on RO devices, so maybe
 			 * in the future put an arbitrary delay after writing
 			 * the device.  Arbitrary delays suck, though...
 			 */
-			if (have_ne && have_nf)
+			if (have_nf)
 				break;
 		}
+
 		if (tm >= SPI_TIMEOUT)
 			debug("*** %s: Time out during SPI transfer\n",
 			      __func__);
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#17 lore raw

PATCH v2 14/32 spi: mpc8xxx: Reduce scope of loop variables

In reply to Jagan Teki

From: Mario Six <[email protected]>

The transmission loop starts with setting some variables, which are only used inside the loop. Reduce the scope to the loop to make the declaration and initialization of these variables coincide.

In the case of char_size this also always initializes the variable immediately with the final value actually used in the loop (instead of the placeholder value 32).

---
 drivers/spi/mpc8xxx_spi.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -6
index a2e698ea17..2a0f3cc06a 100644
@@ -88,10 +88,8 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	     ulong flags)
 {
 	spi8xxx_t *spi = &((immap_t *)(CONFIG_SYS_IMMR))->spi;
-	uint tmpdout, tmpdin, event;
+	u32 tmpdin;
 	int num_blks = DIV_ROUND_UP(bitlen, 32);
-	int tm;
-	uchar char_size = 32;
 
 	debug("%s: slave %u:%u dout %08X din %08X bitlen %u\n", __func__,
 	      slave->bus, slave->cs, *(uint *)dout, *(uint *)din, bitlen);
@@ -104,8 +102,9 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
 	/* Handle data in 32-bit chunks */
 	while (num_blks--) {
-		tmpdout = 0;
-		char_size = (bitlen >= 32 ? 32 : bitlen);
+		int tm;
+		u32 tmpdout = 0;
+		uchar char_size = (bitlen >= 32 ? 32 : bitlen);
 
 		/* Shift data so it's msb-justified */
 		tmpdout = *(u32 *)dout >> (32 - char_size);
@@ -145,7 +144,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * The NE event must be read and cleared first
 		 */
 		for (tm = 0; tm < SPI_TIMEOUT; ++tm) {
-			event = in_be32(&spi->event);
+			u32 event = in_be32(&spi->event);
 			bool have_ne = event & SPI_EV_NE;
 			bool have_nf = event & SPI_EV_NF;
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#18 lore raw

PATCH v2 15/32 spi: mpc8xxx: Make code more readable

In reply to Jagan Teki

From: Mario Six <[email protected]>

Introduce the to_prescale_mod and set_char_len inline functions to make the code more readable.

Note that the added "if (bitlen > 16)" check does not change the semantics of the current code, and hence only preserves the current error (this will be fixed in a later patch in the series).

---
 drivers/spi/mpc8xxx_spi.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/spi/mpc8xxx_spi.c +19 -8
index 2a0f3cc06a..83fd8b3cc1 100644
@@ -30,6 +30,16 @@ enum {
 	SPI_COM_LST = BIT(31 - 9),
 };
 
+static inline u32 to_prescale_mod(u32 val)
+{
+	return (min(val, (u32)15) << 16);
+}
+
+static void set_char_len(spi8xxx_t *spi, u32 val)
+{
+	clrsetbits_be32(&spi->mode, SPI_MODE_LEN_MASK, (val << 20));
+}
+
 #define SPI_TIMEOUT	1000
 
 struct spi_slave *spi_setup_slave(uint bus, uint cs, uint max_hz, uint mode)
@@ -66,7 +76,7 @@ void spi_init(void)
 	 */
 	out_be32(&spi->mode, SPI_MODE_REV | SPI_MODE_MS | SPI_MODE_EN);
 	/* Use SYSCLK / 8 (16.67MHz typ.) */
-	clrsetbits_be32(&spi->mode, 0x000f0000, BIT(16));
+	clrsetbits_be32(&spi->mode, SPI_MODE_PM_MASK, to_prescale_mod(1));
 	/* Clear all SPI events */
 	setbits_be32(&spi->event, 0xffffffff);
 	/* Mask  all SPI interrupts */
@@ -119,13 +129,14 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
 		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
-		if (bitlen <= 4) {
-			clrsetbits_be32(&spi->mode, 0x00f00000, (3 << 20));
-		} else if (bitlen <= 16) {
-			clrsetbits_be32(&spi->mode, 0x00f00000,
-					((bitlen - 1) << 20));
-		} else {
-			clrbits_be32(&spi->mode, 0x00f00000);
+		if (bitlen <= 4)
+			set_char_len(spi, 3);
+		else if (bitlen <= 16)
+			set_char_len(spi, bitlen - 1);
+		else
+			set_char_len(spi, 0);
+
+		if (bitlen > 16) {
 			/* Set up the next iteration if sending > 32 bits */
 			bitlen -= 32;
 			dout += 4;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#19 lore raw

PATCH v2 16/32 spi: mpc8xxx: Rename variable

In reply to Jagan Teki

From: Mario Six <[email protected]>

The variable "char_size" holds the number of bits to be transferred in the current loop iteration. A better name would be "xfer_bitlen", which we rename this variable to.

---
 drivers/spi/mpc8xxx_spi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/mpc8xxx_spi.c +4 -4
index 83fd8b3cc1..63d956a295 100644
@@ -114,10 +114,10 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 	while (num_blks--) {
 		int tm;
 		u32 tmpdout = 0;
-		uchar char_size = (bitlen >= 32 ? 32 : bitlen);
+		uchar xfer_bitlen = (bitlen >= 32 ? 32 : bitlen);
 
 		/* Shift data so it's msb-justified */
-		tmpdout = *(u32 *)dout >> (32 - char_size);
+		tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
 
 		/* The LEN field of the SPMODE register is set as follows:
 		 *
@@ -165,8 +165,8 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 			tmpdin = in_be32(&spi->rx);
 			setbits_be32(&spi->event, SPI_EV_NE);
 
-			*(u32 *)din = (tmpdin << (32 - char_size));
-			if (char_size == 32) {
+			*(u32 *)din = (tmpdin << (32 - xfer_bitlen));
+			if (xfer_bitlen == 32) {
 				/* Advance output buffer by 32 bits */
 				din += 4;
 			}
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#20 lore raw

PATCH v2 17/32 spi: mpc8xxx: Document LEN setting better

In reply to Jagan Teki

From: Mario Six <[email protected]>

Instead of having a table right before the code implementing the length setting for documentation, have inline comments for the if branches actually implementing the length setting described table's entries (which is readable thanks to the set_char_len function).

---
 drivers/spi/mpc8xxx_spi.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -11
index 63d956a295..1dd5bd9799 100644
@@ -119,21 +119,15 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		/* Shift data so it's msb-justified */
 		tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
 
-		/* The LEN field of the SPMODE register is set as follows:
-		 *
-		 * Bit length             setting
-		 * len <= 4               3
-		 * 4 < len <= 16          len - 1
-		 * len > 16               0
-		 */
-
 		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
-		if (bitlen <= 4)
+		/* Set up length for this transfer */
+
+		if (bitlen <= 4) /* 4 bits or less */
 			set_char_len(spi, 3);
-		else if (bitlen <= 16)
+		else if (bitlen <= 16) /*@most 16 bits */
 			set_char_len(spi, bitlen - 1);
-		else
+		else /* more than 16 bits -> full 32 bit transfer */
 			set_char_len(spi, 0);
 
 		if (bitlen > 16) {
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#21 lore raw

PATCH v2 18/32 spi: mpc8xxx: Re-order transfer setup

In reply to Jagan Teki

From: Mario Six <[email protected]>

Minize the time the adapter is disabled (via SPI_MODE_EN clearing/setting) to just the character length setting, and only set up the temporary data writing variable right before we need it, so there is a more clear distinction between setting up the SPI adapter, and setting up the data to be written.

---
 drivers/spi/mpc8xxx_spi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/spi/mpc8xxx_spi.c +5 -5
index 1dd5bd9799..1e7c0144c2 100644
@@ -116,9 +116,6 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		u32 tmpdout = 0;
 		uchar xfer_bitlen = (bitlen >= 32 ? 32 : bitlen);
 
-		/* Shift data so it's msb-justified */
-		tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
-
 		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
 		/* Set up length for this transfer */
@@ -130,14 +127,17 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		else /* more than 16 bits -> full 32 bit transfer */
 			set_char_len(spi, 0);
 
+		setbits_be32(&spi->mode, SPI_MODE_EN);
+
+		/* Shift data so it's msb-justified */
+		tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
+
 		if (bitlen > 16) {
 			/* Set up the next iteration if sending > 32 bits */
 			bitlen -= 32;
 			dout += 4;
 		}
 
-		setbits_be32(&spi->mode, SPI_MODE_EN);
-
 		/* Write the data out */
 		out_be32(&spi->tx, tmpdout);
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#22 lore raw

PATCH v2 19/32 spi: mpc8xxx: Fix if check

In reply to Jagan Teki

From: Mario Six <[email protected]>

Decreasing the bit length and increasing the write data pointer should be done when there are more than 32 bit of data, not 16 bit.

This did not produce incorrect behavior, because the only time where the two checks produce different outcomes is the case of 16 < bitlen < 32, and in this case the subsequent transmission is the last one regardless, hence the additional bit length decrease and write data pointer increase has no effect anyway.

Still, the correct check is the check for "bitlen > 32", so correct this behavior.

---
 drivers/spi/mpc8xxx_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/mpc8xxx_spi.c +1 -1
index 1e7c0144c2..e09e91c8e9 100644
@@ -132,7 +132,7 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		/* Shift data so it's msb-justified */
 		tmpdout = *(u32 *)dout >> (32 - xfer_bitlen);
 
-		if (bitlen > 16) {
+		if (bitlen > 32) {
 			/* Set up the next iteration if sending > 32 bits */
 			bitlen -= 32;
 			dout += 4;
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#23 lore raw

PATCH v2 20/32 spi: mpc8xxx: Use get_timer

In reply to Jagan Teki

From: Mario Six <[email protected]>

The comment before the transmission loop in conjunction with the definition of SPI_TIMEOUT as 1000 implies that the loop is supposed to have a timeout value of 1000 ms. But since there is no mdelay(1) or similar in the loop body, the loop just runs 1000 times, without regard for the time elapsed.

To correct this, use the standard get_timer functionality to properly time out the loop after 1000 ms.

---
 drivers/spi/mpc8xxx_spi.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/spi/mpc8xxx_spi.c +7 -4
index e09e91c8e9..63e1a150f8 100644
@@ -112,9 +112,9 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 
 	/* Handle data in 32-bit chunks */
 	while (num_blks--) {
-		int tm;
 		u32 tmpdout = 0;
 		uchar xfer_bitlen = (bitlen >= 32 ? 32 : bitlen);
+		ulong start;
 
 		clrbits_be32(&spi->mode, SPI_MODE_EN);
 
@@ -148,7 +148,8 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 		 * or time out (1 second = 1000 ms)
 		 * The NE event must be read and cleared first
 		 */
-		for (tm = 0; tm < SPI_TIMEOUT; ++tm) {
+		start = get_timer(0);
+		do {
 			u32 event = in_be32(&spi->event);
 			bool have_ne = event & SPI_EV_NE;
 			bool have_nf = event & SPI_EV_NF;
@@ -173,9 +174,11 @@ int spi_xfer(struct spi_slave *slave, uint bitlen, const void *dout, void *din,
 			 */
 			if (have_nf)
 				break;
-		}
 
-		if (tm >= SPI_TIMEOUT)
+			mdelay(1);
+		} while (get_timer(start) < SPI_TIMEOUT);
+
+		if (get_timer(start) >= SPI_TIMEOUT)
 			debug("*** %s: Time out during SPI transfer\n",
 			      __func__);
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#24 lore raw

PATCH v2 21/32 spi: mpc8xxx: Convert to DM

In reply to Jagan Teki

Support DM in the MPC8xxx SPI driver, and remove the legacy SPI interface.

[jagan: build for board which doesn't enable DM_SPI]
---
 Makefile                  |   3 +-
 drivers/spi/Makefile      |   2 +-
 drivers/spi/mpc8xxx_spi.c | 144 ++++++++++++++++++++++++++++----------
 3 files changed, 110 insertions(+), 39 deletions(-)
Makefile +2 -1
index efa68e7343..7c1d934493 100644
@@ -919,7 +919,8 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================================================="
 endif
 ifeq ($(CONFIG_DM_SPI),)
-ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_TI_QSPI),y),y)
+ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \
+	       $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index 748d9a90ab..19aa95b2ca 100644
@@ -8,6 +8,7 @@ ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
+obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -33,7 +34,6 @@ obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
-obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
drivers/spi/mpc8xxx_spi.c +107 -37

208 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#25 lore raw

PATCH v2 22/32 spi: Zap cf_spi driver-related code

In reply to Jagan Teki

Dropped
- cf_spi driver
- CF_DSPI code
- CONFIG_CF_SPI, CF_DSPI items

Dropped becuase
- no active usage
- no dm conversion
- multiple pings for asking dm-conversion
- driver-model migration expiry

---
 arch/m68k/cpu/mcf5227x/cpu_init.c             |  54 ---
 arch/m68k/cpu/mcf5445x/cpu_init.c             | 113 ------
 configs/M52277EVB_defconfig                   |   1 -
 configs/M52277EVB_stmicro_defconfig           |   1 -
 configs/M54418TWR_defconfig                   |   1 -
 configs/M54418TWR_nand_mii_defconfig          |   1 -
 configs/M54418TWR_nand_rmii_defconfig         |   1 -
 configs/M54418TWR_nand_rmii_lowfreq_defconfig |   1 -
 configs/M54418TWR_serial_mii_defconfig        |   1 -
 configs/M54418TWR_serial_rmii_defconfig       |   1 -
 configs/M54451EVB_defconfig                   |   1 -
 configs/M54451EVB_stmicro_defconfig           |   1 -
 configs/M54455EVB_a66_defconfig               |   1 -
 configs/M54455EVB_defconfig                   |   1 -
 configs/M54455EVB_i66_defconfig               |   1 -
 configs/M54455EVB_intel_defconfig             |   1 -
 configs/M54455EVB_stm33_defconfig             |   1 -
 configs/stmark2_defconfig                     |   1 -
 drivers/spi/Kconfig                           |   6 -
 drivers/spi/Makefile                          |   1 -
 drivers/spi/cf_spi.c                          | 335 ------------------
 include/configs/M52277EVB.h                   |   1 -
 include/configs/M54418TWR.h                   |   1 -
 include/configs/M54451EVB.h                   |   1 -
 include/configs/M54455EVB.h                   |   1 -
 include/configs/stmark2.h                     |   1 -
 scripts/config_whitelist.txt                  |   1 -
 27 files changed, 531 deletions(-)
 delete mode 100644 drivers/spi/cf_spi.c
arch/m68k/cpu/mcf5227x/cpu_init.c +0 -54
index 0d6a484a45..76f4fb34bc 100644
@@ -137,57 +137,3 @@ void uart_port_conf(int port)
 		break;
 	}
 }
-
-#ifdef CONFIG_CF_DSPI
-void cfspi_port_conf(void)
-{
-	gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-	out_8(&gpio->par_dspi,
-		GPIO_PAR_DSPI_SIN_SIN | GPIO_PAR_DSPI_SOUT_SOUT |
-		GPIO_PAR_DSPI_SCK_SCK);
-}
-
-int cfspi_claim_bus(uint bus, uint cs)
-{
-	dspi_t *dspi = (dspi_t *) MMAP_DSPI;
-	gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-	if ((in_be32(&dspi->sr) & DSPI_SR_TXRXS) != DSPI_SR_TXRXS)
-		return -1;
-
-	/* Clear FIFO and resume transfer */
-	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);
-
-	switch (cs) {
-	case 0:
-		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_UNMASK);
-		setbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-		break;
-	case 2:
-		clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
-		setbits_8(&gpio->par_timer, GPIO_PAR_TIMER_T2IN_DSPIPCS2);
-		break;
-	}
-
-	return 0;
-}
-
-void cfspi_release_bus(uint bus, uint cs)
-{
-	dspi_t *dspi = (dspi_t *) MMAP_DSPI;
-	gpio_t *gpio = (gpio_t *) MMAP_GPIO;
-
-	/* Clear FIFO */
-	clrbits_be32(&dspi->mcr, DSPI_MCR_CTXF | DSPI_MCR_CRXF);
-
-	switch (cs) {
-	case 0:
-		clrbits_8(&gpio->par_dspi, GPIO_PAR_DSPI_PCS0_PCS0);
-		break;
-	case 2:
-		clrbits_8(&gpio->par_timer, ~GPIO_PAR_TIMER_T2IN_UNMASK);
-		break;
-	}
-}
-#endif
arch/m68k/cpu/mcf5445x/cpu_init.c +0 -113

116 lines not on this page · raw message

configs/M52277EVB_defconfig +0 -1
index efa5e7102b..882aefd78c 100644
@@ -25,4 +25,3 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M52277EVB_stmicro_defconfig +0 -1
index 3628729a48..f8be2e322e 100644
@@ -24,4 +24,3 @@ CONFIG_SYS_FLASH_CFI=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_defconfig +0 -1
index f69f405d5a..d204066232 100644
@@ -24,4 +24,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_nand_mii_defconfig +0 -1
index 04ca3a8114..c37a79b9a3 100644
@@ -23,4 +23,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_nand_rmii_defconfig +0 -1
index f6acf6019d..0db0e3a836 100644
@@ -23,4 +23,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_nand_rmii_lowfreq_defconfig +0 -1
index 6b631d6d4b..7e01cd78be 100644
@@ -23,4 +23,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_serial_mii_defconfig +0 -1
index b2266a0577..01c572782c 100644
@@ -24,4 +24,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54418TWR_serial_rmii_defconfig +0 -1
index f69f405d5a..d204066232 100644
@@ -24,4 +24,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54451EVB_defconfig +0 -1
index 8448b6cfbf..f3ecbfe952 100644
@@ -30,4 +30,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54451EVB_stmicro_defconfig +0 -1
index ce5f65666c..b8c3cb1cf0 100644
@@ -29,4 +29,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54455EVB_a66_defconfig +0 -1
index f9be1c3773..af375de1a0 100644
@@ -34,4 +34,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54455EVB_defconfig +0 -1
index abb69a966a..cd6aca9923 100644
@@ -35,4 +35,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54455EVB_i66_defconfig +0 -1
index 6050df5d51..a9815ae702 100644
@@ -34,4 +34,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54455EVB_intel_defconfig +0 -1
index 686c00e318..99ae04ead3 100644
@@ -34,4 +34,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/M54455EVB_stm33_defconfig +0 -1
index fc19de50d1..e122bdf724 100644
@@ -34,4 +34,3 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
configs/stmark2_defconfig +0 -1
index 48e851d4a4..613b7af1dd 100644
@@ -26,5 +26,4 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ISSI=y
 CONFIG_SPI_FLASH_MTD=y
 CONFIG_SPI=y
-CONFIG_CF_SPI=y
 CONFIG_REGEX=y
drivers/spi/Kconfig +0 -6
index 56f5d30c74..ed72f401ca 100644
@@ -278,12 +278,6 @@ config SOFT_SPI
 	 Enable Soft SPI driver. This driver is to use GPIO simulate
 	 the SPI protocol.
 
-config CF_SPI
-	bool "ColdFire SPI driver"
-	help
-	  Enable the ColdFire SPI driver. This driver can be used on
-	  some m68k SoCs.
-
 config FSL_ESPI
 	bool "Freescale eSPI driver"
 	help
drivers/spi/Makefile +0 -1
index 19aa95b2ca..890e919f49 100644
@@ -25,7 +25,6 @@ obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
-obj-$(CONFIG_CF_SPI) += cf_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
drivers/spi/cf_spi.c deleted +0 -335

335 lines not on this page · raw message

include/configs/M52277EVB.h +0 -1
index 83d774527a..fbaef5ffa9 100644
@@ -101,7 +101,6 @@
 #define CONFIG_SYS_IMMR			CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_DSPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
 #ifdef CONFIG_CMD_SPI
 #	define CONFIG_SYS_DSPI_CS2
include/configs/M54418TWR.h +0 -1
index 4b8ef38c0b..ea416c4aa1 100644
@@ -149,7 +149,6 @@
 #define CONFIG_SYS_IMMR		CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_DSPI
 #define CONFIG_SERIAL_FLASH
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
 #ifdef CONFIG_CMD_SPI
include/configs/M54451EVB.h +0 -1
index 87cdbae1db..158d0f6f84 100644
@@ -114,7 +114,6 @@
 #define CONFIG_SYS_IMMR			CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_DSPI
 #define CONFIG_SERIAL_FLASH
 #define CONFIG_SYS_SBFHDR_SIZE		0x7
 #ifdef CONFIG_CMD_SPI
include/configs/M54455EVB.h +0 -1
index d41b7c4492..54af5790ab 100644
@@ -141,7 +141,6 @@
 #define CONFIG_SYS_IMMR		CONFIG_SYS_MBAR
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_DSPI
 #define CONFIG_SYS_SBFHDR_SIZE		0x13
 #ifdef CONFIG_CMD_SPI
 
include/configs/stmark2.h +0 -1
index 33ddc67bf4..4b069543ec 100644
@@ -63,7 +63,6 @@
 #undef CONFIG_MCFPIT
 
 /* DSPI and Serial Flash */
-#define CONFIG_CF_DSPI
 #define CONFIG_SF_DEFAULT_SPEED		50000000
 #define CONFIG_SERIAL_FLASH
 #define CONFIG_ENV_SPI_BUS		0
scripts/config_whitelist.txt +0 -1
index 1404fd855b..760d5e05dc 100644
@@ -198,7 +198,6 @@ CONFIG_CDP_TRIGGER
 CONFIG_CDP_VERSION
 CONFIG_CFG_DATA_SECTOR
 CONFIG_CFI_FLASH_USE_WEAK_ACCESSORS
-CONFIG_CF_DSPI
 CONFIG_CF_SBF
 CONFIG_CF_V2
 CONFIG_CF_V3
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#26 lore raw

PATCH v2 23/32 spi: Zap lpc32xx_ssp driver-related code

In reply to Jagan Teki

Dropped
- lpc32xx_ssp driver
- CONFIG_LPC32XX_SSP, LPC32XX_SSP_TIMEOUT items

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion
- no reponse for dm converted patch
- driver-model migration expiry

---
 configs/devkit3250_defconfig |   1 -
 configs/work_92105_defconfig |   1 -
 drivers/spi/Kconfig          |   5 --
 drivers/spi/Makefile         |   1 -
 drivers/spi/lpc32xx_ssp.c    | 134 -----------------------------------
 include/configs/devkit3250.h |   5 --
 include/configs/work_92105.h |   5 --
 scripts/config_whitelist.txt |   1 -
 8 files changed, 153 deletions(-)
 delete mode 100644 drivers/spi/lpc32xx_ssp.c
configs/devkit3250_defconfig +0 -1
index b739f27803..8fc7763c3a 100644
@@ -42,7 +42,6 @@ CONFIG_PHY_ADDR_ENABLE=y
 CONFIG_PHY_ADDR=31
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
-CONFIG_LPC32XX_SSP=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
configs/work_92105_defconfig +0 -1
index 105e51a400..61863abeb7 100644
@@ -38,4 +38,3 @@ CONFIG_PHYLIB=y
 CONFIG_PHY_ADDR_ENABLE=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
-CONFIG_LPC32XX_SSP=y
drivers/spi/Kconfig +0 -5
index ed72f401ca..ebe3ba3bcc 100644
@@ -322,11 +322,6 @@ config KIRKWOOD_SPI
 	  Enable support for SPI on various Marvell SoCs, such as
 	  Kirkwood and Armada 375.
 
-config LPC32XX_SSP
-	bool "LPC32XX SPI Driver"
-	help
-	  Enable support for SPI on LPC32xx
-
 config MPC8XX_SPI
 	bool "MPC8XX SPI Driver"
 	depends on MPC8xx
drivers/spi/Makefile +0 -1
index 890e919f49..7d676988fd 100644
@@ -31,7 +31,6 @@ obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
 obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
-obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
drivers/spi/lpc32xx_ssp.c deleted +0 -134

134 lines not on this page · raw message

include/configs/devkit3250.h +0 -5
index 2f8c655b2c..e1f729a854 100644
@@ -58,11 +58,6 @@
  */
 #define CONFIG_LPC32XX_GPIO
 
-/*
- * SSP/SPI
- */
-#define CONFIG_LPC32XX_SSP_TIMEOUT	100000
-
 /*
  * Ethernet
  */
include/configs/work_92105.h +0 -5
index 67b5e9aa11..9d9a53ef09 100644
@@ -109,11 +109,6 @@
 
 #define CONFIG_LPC32XX_GPIO
 
-/*
- * SSP/SPI/DISPLAY
- */
-
-#define CONFIG_LPC32XX_SSP_TIMEOUT 100000
 /*
  * Environment
  */
scripts/config_whitelist.txt +0 -1
index 760d5e05dc..6b8c1ddb35 100644
@@ -1170,7 +1170,6 @@ CONFIG_LPC32XX_NAND_SLC_WDR_CLKS
 CONFIG_LPC32XX_NAND_SLC_WHOLD
 CONFIG_LPC32XX_NAND_SLC_WSETUP
 CONFIG_LPC32XX_NAND_SLC_WWIDTH
-CONFIG_LPC32XX_SSP_TIMEOUT
 CONFIG_LPC_BASE
 CONFIG_LPC_IO_BASE
 CONFIG_LPUART
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#27 lore raw

PATCH v2 24/32 spi: Zap mxs_spi driver-related code

In reply to Jagan Teki

Dropped
- mxs_spi driver
- CONFIG_MXS_SPI

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion
- no reponse for dm converted patch
- driver-model migration expiry

---
 configs/bg0900_defconfig                |   1 -
 configs/mx28evk_auart_console_defconfig |   1 -
 configs/mx28evk_defconfig               |   1 -
 configs/mx28evk_nand_defconfig          |   1 -
 configs/mx28evk_spi_defconfig           |   1 -
 drivers/spi/Kconfig                     |   6 -
 drivers/spi/Makefile                    |   1 -
 drivers/spi/mxs_spi.c                   | 358 ------------------------
 8 files changed, 370 deletions(-)
 delete mode 100644 drivers/spi/mxs_spi.c
configs/bg0900_defconfig +0 -1
index 6de81621cd..1883e28dee 100644
@@ -37,5 +37,4 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_MII=y
 CONFIG_CONS_INDEX=0
 CONFIG_SPI=y
-CONFIG_MXS_SPI=y
 CONFIG_OF_LIBFDT=y
configs/mx28evk_auart_console_defconfig +0 -1
index d0572212f1..c9a2a7daf8 100644
@@ -47,7 +47,6 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_MII=y
 CONFIG_CONS_INDEX=0
 CONFIG_SPI=y
-CONFIG_MXS_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
configs/mx28evk_defconfig +0 -1
index ab59d7599b..c2fbbfe6ec 100644
@@ -47,7 +47,6 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_MII=y
 CONFIG_CONS_INDEX=0
 CONFIG_SPI=y
-CONFIG_MXS_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
configs/mx28evk_nand_defconfig +0 -1
index 6b774cf248..80e82a7c4b 100644
@@ -46,7 +46,6 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_MII=y
 CONFIG_CONS_INDEX=0
 CONFIG_SPI=y
-CONFIG_MXS_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
configs/mx28evk_spi_defconfig +0 -1
index 0a77e6e9f7..77123153cb 100644
@@ -46,7 +46,6 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_MII=y
 CONFIG_CONS_INDEX=0
 CONFIG_SPI=y
-CONFIG_MXS_SPI=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
drivers/spi/Kconfig +0 -6
index ebe3ba3bcc..797ca80be7 100644
@@ -334,12 +334,6 @@ config MXC_SPI
 	  Enable the MXC SPI controller driver. This driver can be used
 	  on various i.MX SoCs such as i.MX31/35/51/6/7.
 
-config MXS_SPI
-	bool "MXS SPI Driver"
-	help
-	  Enable the MXS SPI controller driver. This driver can be used
-	  on the i.MX23 and i.MX28 SoCs.
-
 config OMAP3_SPI
 	bool "McSPI driver for OMAP"
 	help
drivers/spi/Makefile +0 -1
index 7d676988fd..c4c9d2f393 100644
@@ -35,7 +35,6 @@ obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
-obj-$(CONFIG_MXS_SPI) += mxs_spi.o
 obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o
 obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
drivers/spi/mxs_spi.c deleted +0 -358

358 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#28 lore raw

PATCH v2 25/32 spi: Zap sh_spi driver-related code

In reply to Jagan Teki

Dropped
- sh_spi driver
- CONFIG_SH_SPI,SH_SPI_BASE

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion
- no reponse for dm converted patch
- driver-model migration expiry

---
 configs/sh7752evb_defconfig  |   1 -
 configs/sh7753evb_defconfig  |   1 -
 configs/sh7757lcr_defconfig  |   1 -
 drivers/spi/Kconfig          |   6 -
 drivers/spi/Makefile         |   1 -
 drivers/spi/sh_spi.c         | 249 -----------------------------------
 drivers/spi/sh_spi.h         |  67 ----------
 include/configs/sh7752evb.h  |   3 -
 include/configs/sh7753evb.h  |   3 -
 include/configs/sh7757lcr.h  |   3 -
 scripts/config_whitelist.txt |   1 -
 11 files changed, 336 deletions(-)
 delete mode 100644 drivers/spi/sh_spi.c
 delete mode 100644 drivers/spi/sh_spi.h
configs/sh7752evb_defconfig +0 -1
index b34709d1ea..425f194c95 100644
@@ -38,5 +38,4 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_SPI=y
-CONFIG_SH_SPI=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/sh7753evb_defconfig +0 -1
index 857e90b86a..3904e1b39d 100644
@@ -37,5 +37,4 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_SPI=y
-CONFIG_SH_SPI=y
 CONFIG_USE_PRIVATE_LIBGCC=y
configs/sh7757lcr_defconfig +0 -1
index 8314435b93..d4a132f50b 100644
@@ -39,5 +39,4 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SH_ETHER=y
 CONFIG_SCIF_CONSOLE=y
 CONFIG_SPI=y
-CONFIG_SH_SPI=y
 CONFIG_USE_PRIVATE_LIBGCC=y
drivers/spi/Kconfig +0 -6
index 797ca80be7..1d0d7b7bb9 100644
@@ -298,12 +298,6 @@ config DAVINCI_SPI
 	help
 	  Enable the Davinci SPI driver
 
-config SH_SPI
-	bool "SuperH SPI driver"
-	help
-	  Enable the SuperH SPI controller driver. This driver can be used
-	  on various SuperH SoCs, such as SH7757.
-
 config SH_QSPI
 	bool "Renesas Quad SPI driver"
 	help
drivers/spi/Makefile +0 -1
index c4c9d2f393..b531ebbf83 100644
@@ -42,7 +42,6 @@ obj-$(CONFIG_PL022_SPI) += pl022_spi.o
 obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o
 obj-$(CONFIG_ROCKCHIP_SPI) += rk_spi.o
 obj-$(CONFIG_SANDBOX_SPI) += sandbox_spi.o
-obj-$(CONFIG_SH_SPI) += sh_spi.o
 obj-$(CONFIG_SH_QSPI) += sh_qspi.o
 obj-$(CONFIG_STM32_QSPI) += stm32_qspi.o
 obj-$(CONFIG_SUN4I_SPI) += sun4i_spi.o
drivers/spi/sh_spi.c deleted +0 -249

249 lines not on this page · raw message

drivers/spi/sh_spi.h deleted +0 -67

67 lines not on this page · raw message

include/configs/sh7752evb.h +0 -3
index 1f29e3d221..c52d0f64de 100644
@@ -55,9 +55,6 @@
 #define SH7752EVB_ETHERNET_MAC_SIZE	17
 #define SH7752EVB_ETHERNET_NUM_CH	2
 
-/* SPI */
-#define CONFIG_SH_SPI_BASE		0xfe002000
-
 /* MMCIF */
 #define CONFIG_SH_MMCIF_ADDR		0xffcb0000
 #define CONFIG_SH_MMCIF_CLK		48000000
include/configs/sh7753evb.h +0 -3
index 0693fb5a3c..c6da7a2848 100644
@@ -55,9 +55,6 @@
 #define SH7753EVB_ETHERNET_MAC_SIZE	17
 #define SH7753EVB_ETHERNET_NUM_CH	2
 
-/* SPI */
-#define CONFIG_SH_SPI_BASE		0xfe002000
-
 /* MMCIF */
 #define CONFIG_SH_MMCIF_ADDR		0xffcb0000
 #define CONFIG_SH_MMCIF_CLK		48000000
include/configs/sh7757lcr.h +0 -3
index 05b2f01c15..2bd430f5d1 100644
@@ -59,9 +59,6 @@
 /* Gigabit Ether */
 #define SH7757LCR_GIGA_ETHERNET_NUM_CH	2
 
-/* SPI */
-#define CONFIG_SH_SPI_BASE		0xfe002000
-
 /* MMCIF */
 #define CONFIG_SH_MMCIF_ADDR		0xffcb0000
 #define CONFIG_SH_MMCIF_CLK		48000000
scripts/config_whitelist.txt +0 -1
index 6b8c1ddb35..5f20ad1a12 100644
@@ -1767,7 +1767,6 @@ CONFIG_SH_QSPI_BASE
 CONFIG_SH_SCIF_CLK_FREQ
 CONFIG_SH_SDHI_FREQ
 CONFIG_SH_SDRAM_OFFSET
-CONFIG_SH_SPI_BASE
 CONFIG_SIEMENS_MACH_TYPE
 CONFIG_SIMU
 CONFIG_SKIP_LOCAL_MAC_RANDOMIZATION
Signature · 1 line
2.18.0.321.gffc6fa0e3
#29 lore raw

PATCH v2 25/32 spi: Zap sh_spi driver-related code

On 11/25/2018 06:28 PM, Jagan Teki wrote:

(trimming the insane and utterly useless To: list)

Quoted 8 lines

Dropped
- sh_spi driver
- CONFIG_SH_SPI,SH_SPI_BASE

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion

I haven't received a single notification, this is even worse than the horrible botched handling of BLK conversion series.

Quoted 2 lines

- no reponse for dm converted patch
- driver-model migration expiry

NAK, this patch breaks multiple boards which are in active use. The SPL on those boards has size limitations which do not permit DM.

Signature · 2 lines
Best regards,
Marek Vasut
author
#30 lore raw

PATCH v2 25/32 spi: Zap sh_spi driver-related code

Quoted 16 lines · Marek Vasut

On 11/25/2018 06:28 PM, Jagan Teki wrote:

(trimming the insane and utterly useless To: list)

Quoted 8 lines

Dropped
- sh_spi driver
- CONFIG_SH_SPI,SH_SPI_BASE

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion

I haven't received a single notification, this is even worse than the horrible botched handling of BLK conversion series.

Quoted 9 lines · Marek Vasut

On 11/25/2018 06:28 PM, Jagan Teki wrote:

(trimming the insane and utterly useless To: list)

Quoted 4 lines

Dropped
- sh_spi driver
- CONFIG_SH_SPI,SH_SPI_BASE

Quoted 7 lines
Quoted 4 lines

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion

I haven't received a single notification, this is even worse than the horrible botched handling of BLK conversion series.

Been in ML [1] since from last May.

Quoted 6 lines
Quoted 3 lines

- no reponse for dm converted patch
- driver-model migration expiry

NAK, this patch breaks multiple boards which are in active use. The SPL on those boards has size limitations which do not permit DM.

What about using platdata in above patch?

[1] https://patchwork.ozlabs.org/patch/911393/

author
#31 lore raw

PATCH v2 26/32 spi: Zap soft_spi_legacy driver-related code

In reply to Jagan Teki

Dropped
- soft_spi_legacy driver
- CONFIG_SOFT_SPI

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion
- driver-model migration expiry

---
 drivers/spi/Kconfig           |  12 +--
 drivers/spi/Makefile          |   1 -
 drivers/spi/soft_spi_legacy.c | 168 ----------------------------------
 include/configs/MPC8349EMDS.h |   3 -
 include/configs/zipitz2.h     |   1 -
 5 files changed, 6 insertions(+), 179 deletions(-)
 delete mode 100644 drivers/spi/soft_spi_legacy.c
drivers/spi/Kconfig +6 -6
index 1d0d7b7bb9..faed69bd03 100644
@@ -194,6 +194,12 @@ config SANDBOX_SPI
 		};
 	  };
 
+config SOFT_SPI
+	bool "Soft SPI driver"
+	help
+	 Enable Soft SPI driver. This driver is to use GPIO simulate
+	 the SPI protocol.
+
 config STM32_QSPI
 	bool "STM32F7 QSPI driver"
 	depends on STM32F7
@@ -272,12 +278,6 @@ config ZYNQMP_GQSPI
 
 endif # if DM_SPI
 
-config SOFT_SPI
-	bool "Soft SPI driver"
-	help
-	 Enable Soft SPI driver. This driver is to use GPIO simulate
-	 the SPI protocol.
-
 config FSL_ESPI
 	bool "Freescale eSPI driver"
 	help
drivers/spi/Makefile +0 -1
index b531ebbf83..49e614e124 100644
@@ -15,7 +15,6 @@ obj-$(CONFIG_SPI_MEM) += spi-mem.o
 obj-$(CONFIG_TI_QSPI) += ti_qspi.o
 else
 obj-y += spi.o
-obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o
 endif
 
 obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
drivers/spi/soft_spi_legacy.c deleted +0 -168

168 lines not on this page · raw message

include/configs/MPC8349EMDS.h +0 -3
index bda477cc16..a54f4ca251 100644
@@ -320,9 +320,6 @@
 #define CONFIG_SYS_FSL_I2C2_OFFSET	0x3100
 #define CONFIG_SYS_I2C_NOPROBES		{ {0, 0x69} }
 
-/* SPI */
-#undef CONFIG_SOFT_SPI			/* SPI bit-banged */
-
 /* GPIOs.  Used as SPI chip selects */
 #define CONFIG_SYS_GPIO1_PRELIM
 #define CONFIG_SYS_GPIO1_DIR		0xC0000000  /* SPI CS on 0, LED on 1 */
include/configs/zipitz2.h +0 -1
index 24fea68a11..baf3e6e130 100644
@@ -59,7 +59,6 @@
  * SPI and LCD
  */
 #ifdef	CONFIG_CMD_SPI
-#define	CONFIG_SOFT_SPI
 #define	CONFIG_LCD_ROTATION
 #define	CONFIG_PXA_LCD
 #define	CONFIG_LMS283GF05
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#32 lore raw

PATCH v2 27/32 spi: mxc: Drop non-dm code

In reply to Jagan Teki

Drop the non-dm code, those board which uses non-dm need to define DM_SPI. u-boot build trigger the warning for the same.

---
 Makefile              |   2 +-
 drivers/spi/Makefile  |   2 +-
 drivers/spi/mxc_spi.c | 123 ++----------------------------------------
 3 files changed, 5 insertions(+), 122 deletions(-)
Makefile +1 -1
index 7c1d934493..3be3bb3118 100644
@@ -920,7 +920,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 endif
 ifeq ($(CONFIG_DM_SPI),)
 ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \
-	       $(CONFIG_TI_QSPI),y),y)
+	       $(CONFIG_MXC_SPI) $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index 49e614e124..c682b014e7 100644
@@ -9,6 +9,7 @@ obj-y += spi-uclass.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
+obj-$(CONFIG_MXC_SPI) += mxc_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -33,7 +34,6 @@ obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
-obj-$(CONFIG_MXC_SPI) += mxc_spi.o
 obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o
 obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
drivers/spi/mxc_spi.c +3 -120

150 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#33 lore raw

PATCH v2 28/32 spi: omap3: Drop non-dm code

In reply to Jagan Teki

Drop the non-dm code, those board which uses non-dm need to define DM_SPI. u-boot build trigger the warning for the same.

---
 Makefile                |   2 +-
 drivers/spi/Makefile    |   2 +-
 drivers/spi/omap3_spi.c | 126 ----------------------------------------
 3 files changed, 2 insertions(+), 128 deletions(-)
Makefile +1 -1
index 3be3bb3118..00f0117b16 100644
@@ -920,7 +920,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 endif
 ifeq ($(CONFIG_DM_SPI),)
 ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \
-	       $(CONFIG_MXC_SPI) $(CONFIG_TI_QSPI),y),y)
+	       $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index c682b014e7..6b8b92434c 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
+obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -35,7 +36,6 @@ obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
 obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o
-obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
 obj-$(CONFIG_PL022_SPI) += pl022_spi.o
 obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o
drivers/spi/omap3_spi.c +0 -126

141 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
#34 lore raw

PATCH v2 28/32 spi: omap3: Drop non-dm code

Quoted 6 lines · Jagan Teki

Drop the non-dm code, those board which uses non-dm need to define DM_SPI. u-boot build trigger the warning for the same.

I don't have a good way to read/write SPI, but my omap3_logic board shows the SPI bus in the 'dm tree' so from that perspective, I am not seeing any issues with SPI.

Quoted 190 lines
---
 Makefile                |   2 +-
 drivers/spi/Makefile    |   2 +-
 drivers/spi/omap3_spi.c | 126 ----------------------------------------
 3 files changed, 2 insertions(+), 128 deletions(-)
Makefile +1 -1
index 3be3bb3118..00f0117b16 100644
@@ -920,7 +920,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 endif
 ifeq ($(CONFIG_DM_SPI),)
 ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \
-              $(CONFIG_MXC_SPI) $(CONFIG_TI_QSPI),y),y)
+              $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) $(CONFIG_TI_QSPI),y),y)
        @echo "===================== WARNING ======================"
        @echo "This board uses SPI driver from drivers/spi/ without"
        @echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index c682b014e7..6b8b92434c 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
+obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o
 obj-$(CONFIG_SOFT_SPI) += soft_spi.o
 obj-$(CONFIG_SPI_MEM) += spi-mem.o
@@ -35,7 +36,6 @@ obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
 obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o
-obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
 obj-$(CONFIG_PL022_SPI) += pl022_spi.o
 obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o
drivers/spi/omap3_spi.c +0 -127
index c7fcf050a5..5e267d88d7 100644
@@ -108,9 +108,6 @@ struct mcspi {
 };
 
 struct omap3_spi_priv {
-#ifndef CONFIG_DM_SPI
-       struct spi_slave slave;
-#endif
        struct mcspi *regs;
        unsigned int cs;
        unsigned int freq;
@@ -454,128 +451,6 @@ static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv)
        writel(conf, &priv->regs->modulctrl);
 }
 
-#ifndef CONFIG_DM_SPI
-
-static inline struct omap3_spi_priv *to_omap3_spi(struct spi_slave *slave)
-{
-       return container_of(slave, struct omap3_spi_priv, slave);
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
-       struct omap3_spi_priv *priv = to_omap3_spi(slave);
-
-       free(priv);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
-       struct omap3_spi_priv *priv = to_omap3_spi(slave);
-
-       spi_reset(priv->regs);
-
-       _omap3_spi_claim_bus(priv);
-       _omap3_spi_set_wordlen(priv);
-       _omap3_spi_set_mode(priv);
-       _omap3_spi_set_speed(priv);
-
-       return 0;
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
-       struct omap3_spi_priv *priv = to_omap3_spi(slave);
-
-       writel(OMAP3_MCSPI_MODULCTRL_MS, &priv->regs->modulctrl);
-}
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-                                    unsigned int max_hz, unsigned int mode)
-{
-       struct omap3_spi_priv *priv;
-       struct mcspi *regs;
-
-       /*
-        * OMAP3 McSPI (MultiChannel SPI) has 4 busses (modules)
-        * with different number of chip selects (CS, channels):
-        * McSPI1 has 4 CS (bus 0, cs 0 - 3)
-        * McSPI2 has 2 CS (bus 1, cs 0 - 1)
-        * McSPI3 has 2 CS (bus 2, cs 0 - 1)
-        * McSPI4 has 1 CS (bus 3, cs 0)
-        */
-
-       switch (bus) {
-       case 0:
-                regs = (struct mcspi *)OMAP3_MCSPI1_BASE;
-                break;
-#ifdef OMAP3_MCSPI2_BASE
-       case 1:
-                regs = (struct mcspi *)OMAP3_MCSPI2_BASE;
-                break;
-#endif
-#ifdef OMAP3_MCSPI3_BASE
-       case 2:
-                regs = (struct mcspi *)OMAP3_MCSPI3_BASE;
-                break;
-#endif
-#ifdef OMAP3_MCSPI4_BASE
-       case 3:
-                regs = (struct mcspi *)OMAP3_MCSPI4_BASE;
-                break;
-#endif
-       default:
-                printf("SPI error: unsupported bus %i.  Supported busses 0 - 3\n", bus);
-                return NULL;
-       }
-
-       if (((bus == 0) && (cs > 3)) ||
-           ((bus == 1) && (cs > 1)) ||
-           ((bus == 2) && (cs > 1)) ||
-           ((bus == 3) && (cs > 0))) {
-               printf("SPI error: unsupported chip select %i on bus %i\n", cs, bus);
-               return NULL;
-       }
-
-       if (max_hz > OMAP3_MCSPI_MAX_FREQ) {
-               printf("SPI error: unsupported frequency %i Hz. Max frequency is 48 MHz\n",
-                      max_hz);
-               return NULL;
-       }
-
-       if (mode > SPI_MODE_3) {
-               printf("SPI error: unsupported SPI mode %i\n", mode);
-               return NULL;
-       }
-
-       priv = spi_alloc_slave(struct omap3_spi_priv, bus, cs);
-       if (!priv) {
-               printf("SPI error: malloc of SPI structure failed\n");
-               return NULL;
-       }
-
-       priv->regs = regs;
-       priv->cs = cs;
-       priv->freq = max_hz;
-       priv->mode = mode;
-       priv->wordlen = priv->slave.wordlen;
-#if 0
-       /* Please migrate to DM_SPI support for this feature. */
-       priv->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
-#endif
-
-       return &priv->slave;
-}
-
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
-            const void *dout, void *din, unsigned long flags)
-{
-       struct omap3_spi_priv *priv = to_omap3_spi(slave);
-
-       return _spi_xfer(priv, bitlen, dout, din, flags);
-}
-
-#else
-
 static int omap3_spi_claim_bus(struct udevice *dev)
 {
        struct udevice *bus = dev->parent;
@@ -700,4 +575,3 @@ U_BOOT_DRIVER(omap3_spi) = {
        .ops    = &omap3_spi_ops,
        .priv_auto_alloc_size = sizeof(struct omap3_spi_priv),
 };
-#endif
--

2.18.0.321.gffc6fa0e3

author
#35 lore raw

PATCH v2 29/32 spi: atmel: Drop non-dm code

In reply to Jagan Teki

Drop the non-dm code, those board which uses non-dm need to define DM_SPI. u-boot build trigger the warning for the same.

---
 Makefile                |   5 +-
 drivers/spi/Makefile    |   2 +-
 drivers/spi/atmel_spi.c | 198 ----------------------------------------
 3 files changed, 4 insertions(+), 201 deletions(-)
Makefile +3 -2
index 00f0117b16..502a8e15f8 100644
@@ -919,8 +919,9 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================================================="
 endif
 ifeq ($(CONFIG_DM_SPI),)
-ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \
-	       $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) $(CONFIG_TI_QSPI),y),y)
+ifeq ($(filter $(CONFIG_ATMEL_SPI) $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) \
+	       $(CONFIG_MPC8XXX_SPI) $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) \
+	       $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index 6b8b92434c..e2c6435402 100644
@@ -6,6 +6,7 @@
 # There are many options which enable SPI, so make this library available
 ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
+obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
@@ -21,7 +22,6 @@ endif
 
 obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
 obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
-obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_BCM63XX_HSSPI) += bcm63xx_hsspi.o
 obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
drivers/spi/atmel_spi.c +0 -198

214 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#36 lore raw

PATCH v2 30/32 spi: Zap fsl_espi driver-related code

In reply to Jagan Teki

Dropped
- fsl_espi driver

Dropped becuase
- no active updates
- no dm conversion
- multiple pings for asking dm-conversion
- driver-model migration expiry

---
 board/Arcturus/ucp1020/ucp1020.c |   6 +
 drivers/spi/Kconfig              |   7 -
 drivers/spi/Makefile             |   1 -
 drivers/spi/fsl_espi.c           | 383 -------------------------------
 4 files changed, 6 insertions(+), 391 deletions(-)
 delete mode 100644 drivers/spi/fsl_espi.c
board/Arcturus/ucp1020/ucp1020.c +6 -0
index 1a1fcb9be9..b07ba60671 100644
@@ -43,6 +43,12 @@ void spi_set_speed(struct spi_slave *slave, uint hz)
 	/* TO DO: It's actially have to be in spi/ */
 }
 
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+	/* do nothing, there is no spi driver */
+	return 0;
+}
+
 /*
  * To be compatible with cmd_gpio
  */
drivers/spi/Kconfig +0 -7
index faed69bd03..be87e82699 100644
@@ -278,13 +278,6 @@ config ZYNQMP_GQSPI
 
 endif # if DM_SPI
 
-config FSL_ESPI
-	bool "Freescale eSPI driver"
-	help
-	  Enable the Freescale eSPI driver. This driver can be used to
-	  access the SPI interface and SPI NOR flash on platforms embedding
-	  this Freescale eSPI IP core.
-
 config FSL_QSPI
 	bool "Freescale QSPI driver"
 	help
drivers/spi/Makefile +0 -1
index e2c6435402..5d14b11b1d 100644
@@ -29,7 +29,6 @@ obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
 obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
-obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
 obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
drivers/spi/fsl_espi.c deleted +0 -383

383 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#37 lore raw

PATCH v2 31/32 spi: fsl_dspi: Drop non-dm code

In reply to Jagan Teki

Look like all defconfigs are using DM_SPI, but it may grow the size if enable it globally. but due to DM_SPI migration policy remove non-dm code, and will discuss footprint issues if any?

---
 Makefile               |   6 +-
 drivers/spi/Makefile   |   2 +-
 drivers/spi/fsl_dspi.c | 132 -----------------------------------------
 3 files changed, 4 insertions(+), 136 deletions(-)
Makefile +3 -3
index 502a8e15f8..4639a9fb41 100644
@@ -919,9 +919,9 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y)
 	@echo "===================================================="
 endif
 ifeq ($(CONFIG_DM_SPI),)
-ifeq ($(filter $(CONFIG_ATMEL_SPI) $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) \
-	       $(CONFIG_MPC8XXX_SPI) $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) \
-	       $(CONFIG_TI_QSPI),y),y)
+ifeq ($(filter $(CONFIG_ATMEL_SPI) $(CONFIG_DAVINCI_SPI) $(CONFIG_FSL_DSPI) \
+	       $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) $(CONFIG_MXC_SPI) \
+	       $(CONFIG_OMAP3_SPI) $(CONFIG_TI_QSPI),y),y)
 	@echo "===================== WARNING ======================"
 	@echo "This board uses SPI driver from drivers/spi/ without"
 	@echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI"
drivers/spi/Makefile +1 -1
index 5d14b11b1d..4e8f0b0993 100644
@@ -8,6 +8,7 @@ ifdef CONFIG_DM_SPI
 obj-y += spi-uclass.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
+obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
 obj-$(CONFIG_MXC_SPI) += mxc_spi.o
@@ -28,7 +29,6 @@ obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
-obj-$(CONFIG_FSL_DSPI) += fsl_dspi.o
 obj-$(CONFIG_FSL_QSPI) += fsl_qspi.o
 obj-$(CONFIG_ICH_SPI) +=  ich.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
drivers/spi/fsl_dspi.c +0 -132

148 lines not on this page · raw message

Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#38 lore raw

PATCH v2 32/32 dm: MIGRATION: spi: Update SPI driver status

In reply to Jagan Teki

Update the spi driver dm-conversion status.

---
 doc/driver-model/MIGRATION.txt | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
doc/driver-model/MIGRATION.txt +1 -17
index 5ebefd608b..b2d1488aeb 100644
@@ -30,25 +30,9 @@ Status: In progress
 Deadline: 2018.09
 
 No dm conversion yet:
-	drivers/spi/cf_spi.c
-	drivers/spi/fsl_espi.c
-	drivers/spi/lpc32xx_ssp.c
-	drivers/spi/mpc8xx_spi.c
-	drivers/spi/mpc8xxx_spi.c
-	drivers/spi/mxs_spi.c
-	drivers/spi/sh_qspi.c
-	drivers/spi/sh_spi.c
-	drivers/spi/soft_spi_legacy.c
 
 Partially converted:
-	drivers/spi/atcspi200_spi.c
-	drivers/spi/davinci_spi.c
-	drivers/spi/fsl_dspi.c
-	drivers/spi/fsl_qspi.c
-	drivers/spi/kirkwood_spi.c
-	drivers/spi/mxc_spi.c
-	drivers/spi/omap3_spi.c
-	drivers/spi/ti_qspi.c
+	drivers/spi/sh_qspi.c
 
 --
 Jagan Teki <[email protected]>
Signature · 1 line
2.18.0.321.gffc6fa0e3
#40 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

In reply to Jagan Teki

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

Thanks,
Peng.

Quoted 205 lines

-----Original Message-----
From: Jagan Teki [mailto:jagan at amarulasolutions.com]
Sent: 2018年11月26日 1:28
To: Adam Ford <[email protected]>; Vitaly Andrianov <[email protected]>; Stefano Babic <[email protected]>; Peter Howard <[email protected]>; Tom Rini <[email protected]>; Walter Schweizer <[email protected]>; Valentin Longchamp <[email protected]>; Phil Sutter <[email protected]>; Stefan Roese <[email protected]>; Simon Glass <[email protected]>; Tuomas Tynkkynen <[email protected]>; Sam Protsenko <[email protected]>; Dirk Eibach <[email protected]>; Mario Six <[email protected]>; Simon Guinot <[email protected]>; Konstantin Porotchkin <[email protected]>; Jason Cooper <[email protected]>; Marek Behún <[email protected]>; Lokesh Vutla <[email protected]>; Andrew F . Davis <[email protected]>; Uri Mashiach <[email protected]>; Heiko Schocher <[email protected]>; Tc Liew <[email protected]>; Joe Hershberger <[email protected]>; Angelo Dureghello <[email protected]>; Vladimir Zapolskiy <[email protected]>; Albert ARIBAUD <[email protected]>; Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; Nikita Kiryanov <[email protected]>; Lukasz Majewski <[email protected]>; Markus Niebel <[email protected]>; Troy Kisky <[email protected]>; Akshay Bhat <[email protected]>; Ken Lin <[email protected]>; Peng Fan <[email protected]>; Magnus Lilja <[email protected]>; Christian Gmeiner <[email protected]>; Eric Bénard <[email protected]>; Ian Ray <[email protected]>; Otavio Salvador <[email protected]>; Andreas Geisreiter <[email protected]>; Ludwig Zenz <[email protected]>; Dmitry Lifshitz <[email protected]>; Roger Meier <[email protected]>; Gilles Gameiro <[email protected]>; Lothar Felten <[email protected]>; Tapani Utriainen <[email protected]>; Steve Sakoman <[email protected]>; Pali Rohár <[email protected]>; Marcin Niestroj <[email protected]>; Nishanth Menon <[email protected]>; Lars Poeschel <[email protected]>; Enric Balletbo i Serra <[email protected]>; Yegor Yefremov <[email protected]>; Ash Charles <[email protected]>; Grazvydas Ignotas <[email protected]>; Igor Grinberg <[email protected]>; Derald D . Woods <[email protected]>; Hannes Schmelzer <[email protected]>; Eugen Hristev <[email protected]>; Ludovic Desroches <[email protected]>; Stelian Pop <[email protected]>; Mateusz Kulikowski <[email protected]>; Ilko Iliev <[email protected]>; Daniel Gorsulowski <[email protected]>; Ben Whitten <[email protected]>; Andreas Bießmann <[email protected]>; Erik van Luijk <[email protected]>; Gregory CLEMENT <[email protected]>; Prabhakar Kushwaha <[email protected]>; Sumit Garg <[email protected]>; York Sun <[email protected]>; Yinbo Zhu <[email protected]>; Priyanka Jain <[email protected]>; Mingkai Hu <[email protected]>; Alison Wang <[email protected]>; Ashish Kumar <[email protected]>; Udit Agarwal <[email protected]>; VINITHA V PILLAI <[email protected]>; Feng Li <[email protected]>; Qiang Zhao <[email protected]>; Naveen Burmi <[email protected]>; Shengzhou Liu <[email protected]>; Ruchika Gupta <[email protected]>; Poonam Aggrwal <[email protected]>; Timur Tabi <[email protected]>; Xiaobo Xie <[email protected]>; PO LIU <[email protected]>
Cc: u-boot at lists.denx.de; Jagan Teki <[email protected]>
Subject: [PATCH v2 00/32] spi: DM_SPI migration timeout, remainder(2)

This series fix, build issues and comments from previous series [1].

We have not heard any positive feed back about dm-conversion on spi drivers along with no response for the work done by Akash and me.

Plan is to send the same series remainder recursively based on the dm conversion updates and finally merged into v2019.04 MW.

So expecting inputs from relevant developers to move their board/drivers to support DM_SPI.

- cf_spi, lpc32xx_ssp, mxs_spi, sh_spi, soft_spi_legacy, fsl_espi drivers are drooped with their respective CONFIG items.
the spi/spi-flash usage commands still build but the used spi core function calls return 0.
- non-dm code in davinci, kirkwood, ti_qspi, mpc8xxx, mxc, omap3, atmel, fsl_dspi drivers were drooped and u-boot build system will trigger warning for the same.

Note:
- Let's discuss if any foot-print issues?

Any inputs,
Jagan.

[1]
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc
hwork.ozlabs.org%2Fcover%2F1000444%2F&amp;data=02%7C01%7Cpeng.fa n%40nxp.com%7C575d95c25be74fc237bb08d652fb8b34%7C686ea1d3bc2b4 c6fa92cd99c5c301635%7C0%7C0%7C636787637664212094&amp;sdata=Wy H54iAVB%2BRPIVvgpQsw1T3cG5UUtNRKbFR08wibgOg%3D&amp;reserved= 0

Jagan Teki (15):
spi: davinci: Full dm conversion
spi: kirkwood: Full dm conversion
spi: ti_qspi: Full dm conversion
spi: mpc8xxx: Convert to DM
spi: Zap cf_spi driver-related code
spi: Zap lpc32xx_ssp driver-related code
spi: Zap mxs_spi driver-related code
spi: Zap sh_spi driver-related code
spi: Zap soft_spi_legacy driver-related code
spi: mxc: Drop non-dm code
spi: omap3: Drop non-dm code
spi: atmel: Drop non-dm code
spi: Zap fsl_espi driver-related code
spi: fsl_dspi: Drop non-dm code
dm: MIGRATION: spi: Update SPI driver status

Mario Six (17):
spi: mpc8xxx: Use short type names
spi: mpc8xxx: Fix comments
spi: mpc8xxx: Rename camel-case variables
spi: mpc8xxx: Fix space after cast
spi: mpc8xxx: Fix function names in strings
spi: mpc8xxx: Replace defines with enums
spi: mpc8xxx: Use IO accessors
spi: mpc8xxx: Simplify if
spi: mpc8xxx: Get rid of is_read
spi: mpc8xxx: Simplify logic a bit
spi: mpc8xxx: Reduce scope of loop variables
spi: mpc8xxx: Make code more readable
spi: mpc8xxx: Rename variable
spi: mpc8xxx: Document LEN setting better
spi: mpc8xxx: Re-order transfer setup
spi: mpc8xxx: Fix if check
spi: mpc8xxx: Use get_timer

 Makefile                                      |  11 +
 arch/m68k/cpu/mcf5227x/cpu_init.c             |  54 --
 arch/m68k/cpu/mcf5445x/cpu_init.c             | 113 ----
 board/Arcturus/ucp1020/ucp1020.c              |   6 +
 configs/M52277EVB_defconfig                   |   1 -
 configs/M52277EVB_stmicro_defconfig           |   1 -
 configs/M54418TWR_defconfig                   |   1 -
 configs/M54418TWR_nand_mii_defconfig          |   1 -
 configs/M54418TWR_nand_rmii_defconfig         |   1 -
 configs/M54418TWR_nand_rmii_lowfreq_defconfig |   1 -
 configs/M54418TWR_serial_mii_defconfig        |   1 -
 configs/M54418TWR_serial_rmii_defconfig       |   1 -
 configs/M54451EVB_defconfig                   |   1 -
 configs/M54451EVB_stmicro_defconfig           |   1 -
 configs/M54455EVB_a66_defconfig               |   1 -
 configs/M54455EVB_defconfig                   |   1 -
 configs/M54455EVB_i66_defconfig               |   1 -
 configs/M54455EVB_intel_defconfig             |   1 -
 configs/M54455EVB_stm33_defconfig             |   1 -
 configs/bg0900_defconfig                      |   1 -
 configs/devkit3250_defconfig                  |   1 -
 configs/mx28evk_auart_console_defconfig       |   1 -
 configs/mx28evk_defconfig                     |   1 -
 configs/mx28evk_nand_defconfig                |   1 -
 configs/mx28evk_spi_defconfig                 |   1 -
 configs/sh7752evb_defconfig                   |   1 -
 configs/sh7753evb_defconfig                   |   1 -
 configs/sh7757lcr_defconfig                   |   1 -
 configs/stmark2_defconfig                     |   1 -
 configs/work_92105_defconfig                  |   1 -
 doc/driver-model/MIGRATION.txt                |  18 +-
 drivers/spi/Kconfig                           |  42 +-
 drivers/spi/Makefile                          |  22 +-
 drivers/spi/atmel_spi.c                       | 198 -------
 drivers/spi/cf_spi.c                          | 335 ------------
 drivers/spi/davinci_spi.c                     | 157 ------
 drivers/spi/fsl_dspi.c                        | 132 -----
 drivers/spi/fsl_espi.c                        | 383 --------------
 drivers/spi/kirkwood_spi.c                    | 218 ++------
 drivers/spi/lpc32xx_ssp.c                     | 134 -----
 drivers/spi/mpc8xxx_spi.c                     | 279 ++++++----
 drivers/spi/mxc_spi.c                         | 123 +----
 drivers/spi/mxs_spi.c                         | 358 -------------
 drivers/spi/omap3_spi.c                       | 126 -----
 drivers/spi/sh_spi.c                          | 249 ---------
 drivers/spi/sh_spi.h                          |  67 ---
 drivers/spi/soft_spi_legacy.c                 | 168 ------
 drivers/spi/spi.c                             |  38 ++
 drivers/spi/ti_qspi.c                         | 490 +++++++-----------
 include/configs/M52277EVB.h                   |   1 -
 include/configs/M54418TWR.h                   |   1 -
 include/configs/M54451EVB.h                   |   1 -
 include/configs/M54455EVB.h                   |   1 -
 include/configs/MPC8349EMDS.h                 |   3 -
 include/configs/devkit3250.h                  |   5 -
 include/configs/sh7752evb.h                   |   3 -
 include/configs/sh7753evb.h                   |   3 -
 include/configs/sh7757lcr.h                   |   3 -
 include/configs/stmark2.h                     |   1 -
 include/configs/work_92105.h                  |   5 -
 include/configs/zipitz2.h                     |   1 -
 include/dm/platform_data/spi_kirkwood.h       |  15 +
 include/dm/platform_data/spi_ti_qspi.h        |  19 +
 scripts/config_whitelist.txt                  |   3 -
 64 files changed, 502 insertions(+), 3310 deletions(-)  delete mode 100644

drivers/spi/cf_spi.c delete mode 100644 drivers/spi/fsl_espi.c delete mode 100644 drivers/spi/lpc32xx_ssp.c delete mode 100644 drivers/spi/mxs_spi.c delete mode 100644 drivers/spi/sh_spi.c delete mode 100644 drivers/spi/sh_spi.h delete mode 100644 drivers/spi/soft_spi_legacy.c create mode 100644 include/dm/platform_data/spi_kirkwood.h

 create mode 100644 include/dm/platform_data/spi_ti_qspi.h

--
2.18.0.321.gffc6fa0e3

author
#41 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL
2) try PLATDATA
3) try TPL for truly small size

if none works, we can see the other option. may be some glue code to read flash for SPL or something else.

#42 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Quoted 10 lines · Jagan Teki
Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

Not possible

Quoted 1 line

2) try PLATDATA

Adds extra bloat to SPLs which are already borderline, so not possible.

Quoted 1 line

3) try TPL for truly small size

How would that help ? I don't need extra level of bootloader, I can use SPL right now.

Quoted 2 lines

if none works, we can see the other option. may be some glue code to read flash for SPL or something else.

I'll have to take a look at the Renesas Gen2, but probably next year.

Signature · 2 lines
Best regards,
Marek Vasut
#43 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Hello Marek, Jagan,

Am 27.11.2018 um 13:10 schrieb Marek Vasut:

Quoted 14 lines · Jagan Teki
Quoted 10 lines · Peng Fan
Quoted 6 lines

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

Not possible

Quoted 8 lines
Quoted 1 line

2) try PLATDATA

Adds extra bloat to SPLs which are already borderline, so not possible.

Quoted 1 line

3) try TPL for truly small size

How would that help ? I don't need extra level of bootloader, I can use SPL right now.

Exactly my thoughts too. I have a at91 based board (smartweb) in mainline where the SPL fits into 4k sram ... no chance for 1) or 2) ...

I see the reasons for integrating more and more stuff into SPL, but it should be possible to build a small SPL ...

Hopefully TPL stays really small ...

Hmm.. while writting (did not actually looked into TPL ...):

Is it possible to boot U-boot directly from TPL ?

Quoted 4 lines
Quoted 2 lines

if none works, we can see the other option. may be some glue code to read flash for SPL or something else.

I'll have to take a look at the Renesas Gen2, but probably next year.

I talk with customers to get time for converting, but this also may take some time ...

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#44 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Quoted 26 lines · Heiko Schocher

Hello Marek, Jagan,

Am 27.11.2018 um 13:10 schrieb Marek Vasut:

Quoted 14 lines · Jagan Teki
Quoted 10 lines · Peng Fan
Quoted 6 lines

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

Not possible

Quoted 8 lines
Quoted 1 line

2) try PLATDATA

Adds extra bloat to SPLs which are already borderline, so not possible.

Quoted 1 line

3) try TPL for truly small size

How would that help ? I don't need extra level of bootloader, I can use SPL right now.

Quoted 7 lines

Exactly my thoughts too. I have a at91 based board (smartweb) in mainline where the SPL fits into 4k sram ... no chance for 1) or 2) ...

I see the reasons for integrating more and more stuff into SPL, but it should be possible to build a small SPL ...

Hopefully TPL stays really small ...

Staying small is the stated goal of TPL. And it's not impossible that something like smartweb will need to switch to something like TPL->U-Boot.

Quoted 3 lines

Hmm.. while writting (did not actually looked into TPL ...):

Is it possible to boot U-boot directly from TPL ?

No reason why not, so long as everything U-Boot needs is setup, just like always.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

if none works, we can see the other option. may be some glue code to read flash for SPL or something else.

I'll have to take a look at the Renesas Gen2, but probably next year.

I talk with customers to get time for converting, but this also may take some time ...

I understand this concern, but, things have been converting for years. I continue to be happy to hear and welcome additional technical problems that need to be solved, but by that same token, I want to be clear that "I think we just can't convert $X to DM for full U-Boot" or similar aren't arguments I'm very receptive to.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181127/bbb6dae0/attachment.sig>
#45 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

In reply to Jagan Teki

Hi Jagan,

(CCing the world looks to me quite a terror attack, nevertheless):

Quoted 8 lines · Jagan Teki
Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

I can understand the reasons to switch completely to DM code, but let's face some real facts:

- dropping legacy code requires to use SPL_OF_CONTROL into SPL, and yes, footprint steadily increases. We are getting rid of place for MX6 Solo, and this is not an ancient processor we can forget.
Size of SRAM is not something we can discuss - it is. Other features (secure boot, etc.) were pushed to SPL, and these features were requested by real projects. We cannot get rid of these feature just to make place for DM.

- the benefits cannot be really understood by the manufacturers or owners of boards, because they can see a step in the past if they have to forget some features they are currently using.

- TPL adds an additional step and this increases the boottime - another *real* and *important* feature for most projects.

Quoted 2 lines

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

There is no enough place for most SOCs, even quite recent. This is not due just to the size of SRAM, but also by some restriction on the usage of the SRAM itself by the internal BootROM.

Quoted 1 line

2) try PLATDATA

This is even not footprint friendly.

Quoted 2 lines

3) try TPL for truly small size

See above. There is an additional layer without evident advantages for manufacturers and / or customers.

Quoted 3 lines

if none works, we can see the other option. may be some glue code to read flash for SPL or something else.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#46 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Quoted 17 lines · Stefano Babic

Hi Jagan,

(CCing the world looks to me quite a terror attack, nevertheless):

Quoted 8 lines · Jagan Teki
Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

I can understand the reasons to switch completely to DM code, but let's face some real facts:

Quoted 7 lines

- dropping legacy code requires to use SPL_OF_CONTROL into SPL, and yes, footprint steadily increases. We are getting rid of place for MX6 Solo, and this is not an ancient processor we can forget.
Size of SRAM is not something we can discuss - it is. Other features (secure boot, etc.) were pushed to SPL, and these features were requested by real projects. We cannot get rid of these feature just to make place for DM.

Just what is the limit on MX6 Solo, worst case? And what boot methods do we have to support there too? The am335x with secure boot case is small, but might not be as small as you have to worry about here.

Quoted 3 lines

- the benefits cannot be really understood by the manufacturers or owners of boards, because they can see a step in the past if they have to forget some features they are currently using.

Yes, we need to make sure that we don't just drop functionality for no apparent reason. But we can't use that as a reason to maintain wholly separate subsystems for some platforms either.

Quoted 2 lines

- TPL adds an additional step and this increases the boottime - another *real* and *important* feature for most projects.

I _really_ want to see this measured so we know what time is being added so we can think about what to do about it, too. Yes, adding a few kilobytes is a few cycles, and a few is more than zero, and there are use cases that have demands screaming for less cycles to be used, not more (aside, when this is coupled with "But we're moving to aarch64" and that requires more firmware layers makes me shake my head internally a little). But by that same token, part of the notion behind TPL->SPL->U-Boot or Linux is that some functionality is moved from SPL to TPL.

Quoted 6 lines
Quoted 2 lines

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

There is no enough place for most SOCs, even quite recent. This is not due just to the size of SRAM, but also by some restriction on the usage of the SRAM itself by the internal BootROM.

This is debatable, frankly. But yes, we do have modern platforms with a still small usable by first non-ROM-application amount of memory. So we must have a solution.

Quoted 3 lines
Quoted 1 line

2) try PLATDATA

This is even not footprint friendly.

Why? This is in fact our current method for "we need something more footprint friendly to feed enough info in to get to the next application".

Quoted 4 lines
Quoted 1 line

3) try TPL for truly small size

See above. There is an additional layer without evident advantages for manufacturers and / or customers.

"You need this in order to boot now". Just like moving from say DCD files to SPL required convincing manufacturers and customers that it was a win even if you could do everything with DCD scripts and plugins, this too requires explanation.

But also, I keep saying, and it feels like I keep not being heard, we aren't declaring the death of non-DM for SPL for all platforms just yet. There's likely a few more technical challenges to sort out, and some explanation of why the world isn't static required before we can do that.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181127/5c3c9482/attachment.sig>
#47 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Hi Tom,

Quoted 26 lines · Tom Rini
Quoted 17 lines · Stefano Babic

Hi Jagan,

(CCing the world looks to me quite a terror attack, nevertheless):

Quoted 8 lines · Jagan Teki
Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

I can understand the reasons to switch completely to DM code, but let's face some real facts:

Quoted 7 lines

- dropping legacy code requires to use SPL_OF_CONTROL into SPL, and yes, footprint steadily increases. We are getting rid of place for MX6 Solo, and this is not an ancient processor we can forget.
Size of SRAM is not something we can discuss - it is. Other features (secure boot, etc.) were pushed to SPL, and these features were requested by real projects. We cannot get rid of these feature just to make place for DM.

Quoted 1 line

Just what is the limit on MX6 Solo, worst case?

Solo has 68KB OCRAM available - if I remember well, letting some space for early stack and some other thigs, there is still 49K available. This was big enough when SPL was ported to MX, now we are approaching the limit.

This is worst when for some projects there is the need for some customization, like additional code to get device data or calibration for RAM. In some cases, it is becoming tricky.

Anyway, my concern is that the OCRAM is not so small, but nevertheless we have now reached the point where the SPL has grown so much to take all available size.

Quoted 2 lines

And what boot methods
do we have to support there too?

I can imagine that at least booting from storages (NAND, SPI, SD) and from SDP (usb gadget) should be supported in the same SPL. Maybe just a couple of storages at the same time (main boot device and "backup" to restore it).

Quoted 2 lines

The am335x with secure boot case is
small, but might not be as small as you have to worry about here.

It looks to me that size is quite comparable to AM335x.

Quoted 7 lines
Quoted 4 lines

- the benefits cannot be really understood by the manufacturers or owners of boards, because they can see a step in the past if they have to forget some features they are currently using.

Yes, we need to make sure that we don't just drop functionality for no apparent reason.

Fully agree.

Quoted 2 lines

But we can't use that as a reason to maintain wholly
separate subsystems for some platforms either.

Right, but we have to find a solution.

Quoted 4 lines
Quoted 3 lines

- TPL adds an additional step and this increases the boottime - another *real* and *important* feature for most projects.

Quoted 9 lines

I _really_ want to see this measured so we know what time is being added so we can think about what to do about it, too. Yes, adding a few kilobytes is a few cycles, and a few is more than zero, and there are use cases that have demands screaming for less cycles to be used, not more (aside, when this is coupled with "But we're moving to aarch64" and that requires more firmware layers makes me shake my head internally a little). But by that same token, part of the notion behind TPL->SPL->U-Boot or Linux is that some functionality is moved from SPL to TPL.

I have no measures - this can be done after moving one of these i.MX6 to a TPL based bootloader. I am just thinking about when we introduced SPL some years ago. One goal was to have a "simpler" loader that provides the first initialization (just RAM and console), letting u-boot to do the rest. This sounds weird now - these are the requirement we ask for TPL. So TPL looks to me an early SPL - can we just have a simpler SPL, that just does the simple initialization ? TPL was initially thought for SOCs having a very small RAM on board, and then they can boot from a single storage only. This is also not the requirement for more complex SOC, and even with TPL, a i.MX should boot from SPI, NAND / SD. And to maintain the trust of chain, TPL should able to load just signed images, too (it is another step and add complexity).

For aarch64, I agree with you and there is nothing we can do against it. More layers were also introduced due to increased requirements for security.On the other side, these SOCs could be faster during boot due to better CPU.

What about the drivers we need in TPL ? They cannot be a DM driver, so we still need some legacy drivers for storage. We should still have both type of drivers (DM and not DM), and dropping current legacy drivers from SPL does not help.

Quoted 11 lines
Quoted 7 lines
Quoted 3 lines

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

There is no enough place for most SOCs, even quite recent. This is not due just to the size of SRAM, but also by some restriction on the usage of the SRAM itself by the internal BootROM.

This is debatable, frankly. But yes, we do have modern platforms with a still small usable by first non-ROM-application amount of memory. So we must have a solution.

Fully agree.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

2) try PLATDATA

This is even not footprint friendly.

Why? This is in fact our current method for "we need something more footprint friendly to feed enough info in to get to the next application".

I think I need some measure - if size remains small enough, it could be a suitable way.

Quoted 10 lines
Quoted 5 lines
Quoted 2 lines

3) try TPL for truly small size

See above. There is an additional layer without evident advantages for manufacturers and / or customers.

"You need this in order to boot now". Just like moving from say DCD files to SPL required convincing manufacturers and customers that it was a win even if you could do everything with DCD scripts and plugins, this too requires explanation.

I agree - but let's me say that the advantages in that case were very clear (no fixed RAM setup bound to the HW, run time detection, single binary for multiple variants in case of i.MX6,..) and most important, these advantages meant for manufacturers less costs. Less cost because it is easier to relace a chip that reached EOL, or because they do not have different part number for each bootloader (they have just one), or...

The same should happens now to convince again manufacturers and customers.

Quoted 3 lines

But also, I keep saying, and it feels like I keep not being heard, we aren't declaring the death of non-DM for SPL for all platforms just yet.

Nice to listen this - I was already scared from this thread and last "CONFIG_BLK" :-)

Quoted 4 lines

There's likely a few more technical challenges to sort out, and some explanation of why the world isn't static required before we can do that.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#48 lore raw

v2 cover spi: DM_SPI migration timeout, remainder(2)

Quoted 29 lines · Stefano Babic

Hi Tom,

Quoted 26 lines · Tom Rini
Quoted 24 lines · Stefano Babic

Hi Jagan,

(CCing the world looks to me quite a terror attack, nevertheless):

Quoted 8 lines · Jagan Teki
Quoted 6 lines · Peng Fan

Hi Jagan,

Just have a quick question here.

After dropping non-DM code, for SPL use non-DM code should switch to SPL_DM and use SPL OF CONTROL?

I can understand the reasons to switch completely to DM code, but let's face some real facts:

- dropping legacy code requires to use SPL_OF_CONTROL into SPL, and yes, footprint steadily increases. We are getting rid of place for MX6 Solo, and this is not an ancient processor we can forget.
Size of SRAM is not something we can discuss - it is. Other features (secure boot, etc.) were pushed to SPL, and these features were requested by real projects. We cannot get rid of these feature just to make place for DM.

Quoted 5 lines
Quoted 1 line

Just what is the limit on MX6 Solo, worst case?

Solo has 68KB OCRAM available - if I remember well, letting some space for early stack and some other thigs, there is still 49K available. This was big enough when SPL was ported to MX, now we are approaching the limit.

OK, so yes, we're both in the same ballpark wrt size constraints.

Quoted 7 lines

This is worst when for some projects there is the need for some customization, like additional code to get device data or calibration for RAM. In some cases, it is becoming tricky.

Anyway, my concern is that the OCRAM is not so small, but nevertheless we have now reached the point where the SPL has grown so much to take all available size.

Right, and we'll need to take a look at what tricks we have available and what we've already used.

Quoted 7 lines
Quoted 2 lines

And what boot methods
do we have to support there too?

I can imagine that at least booting from storages (NAND, SPI, SD) and from SDP (usb gadget) should be supported in the same SPL. Maybe just a couple of storages at the same time (main boot device and "backup" to restore it).

Yeah, that's probably one of the things that'll need to be changed then is moving from "look we can do anything" to more production "here's what the design has for regular and recovery". We had to do that for the longest time, again on am33xx to put USB SPL stuff in its own build but we're now finally looking at being able to perhaps pull that back in to the kitchen-sink EVM builds.

And part of moving from "edit the config file" to "enable what you want via Kconfig" makes me feel less bad / worried about not showcasing every possible feature of a SoC in all builds since it becomes easier to document and less potentially error-prone to change what's configured.

Quoted 13 lines
Quoted 2 lines

The am335x with secure boot case is
small, but might not be as small as you have to worry about here.

It looks to me that size is quite comparable to AM335x.

Quoted 7 lines
Quoted 4 lines

- the benefits cannot be really understood by the manufacturers or owners of boards, because they can see a step in the past if they have to forget some features they are currently using.

Yes, we need to make sure that we don't just drop functionality for no apparent reason.

Quoted 6 lines

Fully agree.

Quoted 2 lines

But we can't use that as a reason to maintain wholly
separate subsystems for some platforms either.

Right, but we have to find a solution.

Fully agree.

Quoted 13 lines
Quoted 12 lines
Quoted 2 lines

- TPL adds an additional step and this increases the boottime - another *real* and *important* feature for most projects.

I _really_ want to see this measured so we know what time is being added so we can think about what to do about it, too. Yes, adding a few kilobytes is a few cycles, and a few is more than zero, and there are use cases that have demands screaming for less cycles to be used, not more (aside, when this is coupled with "But we're moving to aarch64" and that requires more firmware layers makes me shake my head internally a little). But by that same token, part of the notion behind TPL->SPL->U-Boot or Linux is that some functionality is moved from SPL to TPL.

Quoted 1 line

I have no measures - this can be done after moving one of these i.MX6 to

OK, so lets not worry too much about that part then until it's something we can see is a real concern.

Quoted 11 lines

a TPL based bootloader. I am just thinking about when we introduced SPL some years ago. One goal was to have a "simpler" loader that provides the first initialization (just RAM and console), letting u-boot to do the rest. This sounds weird now - these are the requirement we ask for TPL. So TPL looks to me an early SPL - can we just have a simpler SPL, that just does the simple initialization ? TPL was initially thought for SOCs having a very small RAM on board, and then they can boot from a single storage only. This is also not the requirement for more complex SOC, and even with TPL, a i.MX should boot from SPI, NAND / SD. And to maintain the trust of chain, TPL should able to load just signed images, too (it is another step and add complexity).

I suppose part of the problem is that we had "SPL" for dealing with NAND booting, where we couldn't do what we used to do, and then we had "SPL" for "lets allow ourselves to do a bunch of neat things". Moving forward it's more "TPL" is "we need one-off (or near enough) code to get ourselves started" and "SPL" for "We need to handle a bunch of neat things very early".

Quoted 9 lines

For aarch64, I agree with you and there is nothing we can do against it. More layers were also introduced due to increased requirements for security.On the other side, these SOCs could be faster during boot due to better CPU.

What about the drivers we need in TPL ? They cannot be a DM driver, so we still need some legacy drivers for storage. We should still have both type of drivers (DM and not DM), and dropping current legacy drivers from SPL does not help.

So yes, TPL is where we're going to have to, and will live with one-off SoC-centric and lack of framework drivers to Just Work.

Quoted 16 lines
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

Here are the options, that we dealt based on the size constraints
1) try to use DM_SPL with SPL OF_CONTROL

There is no enough place for most SOCs, even quite recent. This is not due just to the size of SRAM, but also by some restriction on the usage of the SRAM itself by the internal BootROM.

This is debatable, frankly. But yes, we do have modern platforms with a still small usable by first non-ROM-application amount of memory. So we must have a solution.

Fully agree.

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

2) try PLATDATA

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This is even not footprint friendly.

Why? This is in fact our current method for "we need something more footprint friendly to feed enough info in to get to the next application".

I think I need some measure - if size remains small enough, it could be a suitable way.

Please, yes.

Quoted 17 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line

3) try TPL for truly small size

See above. There is an additional layer without evident advantages for manufacturers and / or customers.

"You need this in order to boot now". Just like moving from say DCD files to SPL required convincing manufacturers and customers that it was a win even if you could do everything with DCD scripts and plugins, this too requires explanation.

I agree - but let's me say that the advantages in that case were very clear (no fixed RAM setup bound to the HW, run time detection, single binary for multiple variants in case of i.MX6,..) and most important, these advantages meant for manufacturers less costs. Less cost because it is easier to relace a chip that reached EOL, or because they do not have different part number for each bootloader (they have just one), or...

Quoted 12 lines

The same should happens now to convince again manufacturers and customers.

Quoted 3 lines

But also, I keep saying, and it feels like I keep not being heard, we aren't declaring the death of non-DM for SPL for all platforms just yet.

Nice to listen this - I was already scared from this thread and last "CONFIG_BLK" :-)

Quoted 3 lines

There's likely a few more technical challenges to sort out, and some explanation of why the world isn't static required before we can do that.

So, I think we're largely in agreement here. What I'd really like to see happen next is get enough of what's remaining and not DM'ified on the full U-Boot side of things (where the why is because that's what drivers look like now) so that we can enable them for SPL too and see where we really do hit a problem. I'm sure we will, and the situations like at91 where we have single-digit kilobytes to work with are going to be hard. But for i.MX, we're in the same ballpark as other platforms that have been converted.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181128/87c75971/attachment.sig>