* [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init
@ 2018-11-24 12:13 Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 2/6] spi: Remove used spi_init Jagan Teki
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
Remove spi_init definition which never used on
respective code since from many years.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/net/e1000_spi.c | 3 ---
drivers/spi/atmel_spi.c | 5 -----
drivers/spi/davinci_spi.c | 5 -----
drivers/spi/fsl_dspi.c | 5 -----
drivers/spi/fsl_espi.c | 5 -----
drivers/spi/lpc32xx_ssp.c | 9 ---------
drivers/spi/mxc_spi.c | 4 ----
drivers/spi/mxs_spi.c | 4 ----
drivers/spi/omap3_spi.c | 5 -----
drivers/spi/sh_qspi.c | 5 -----
drivers/spi/sh_spi.c | 4 ----
drivers/spi/soft_spi_legacy.c | 7 -------
include/spi.h | 7 -------
13 files changed, 68 deletions(-)
diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c
index b38f4df9f3..aecd290d72 100644
--- a/drivers/net/e1000_spi.c
+++ b/drivers/net/e1000_spi.c
@@ -77,9 +77,6 @@ static inline struct e1000_hw *e1000_hw_from_spi(struct spi_slave *spi)
return container_of(spi, struct e1000_hw, spi);
}
-/* Not sure why all of these are necessary */
-void spi_init(void) { /* Nothing to do */ }
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
{
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 1db8bbef2b..cf4de9ee1a 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -34,11 +34,6 @@ static int spi_has_wdrbt(struct atmel_spi_slave *slave)
return (ATMEL_SPI_VERSION_REV(ver) >= 0x210);
}
-void spi_init()
-{
-
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
{
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 07fa5e3b8a..4d2c106440 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -388,11 +388,6 @@ void spi_cs_deactivate(struct spi_slave *slave)
/* do nothing */
}
-void spi_init(void)
-{
- /* do nothing */
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
{
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index f7ed8fbe08..764c94215e 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -390,11 +390,6 @@ static int fsl_dspi_cfg_speed(struct fsl_dspi_priv *priv, uint speed)
return 0;
}
#ifndef CONFIG_DM_SPI
-void spi_init(void)
-{
- /* Nothing to do */
-}
-
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
{
if (((cs >= 0) && (cs < 8)) && ((bus >= 0) && (bus < 8)))
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index e9941593f5..7444ae1a06 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -118,11 +118,6 @@ void spi_free_slave(struct spi_slave *slave)
free(fsl);
}
-void spi_init(void)
-{
-
-}
-
int spi_claim_bus(struct spi_slave *slave)
{
struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
diff --git a/drivers/spi/lpc32xx_ssp.c b/drivers/spi/lpc32xx_ssp.c
index ce12eee657..4b09366317 100644
--- a/drivers/spi/lpc32xx_ssp.c
+++ b/drivers/spi/lpc32xx_ssp.c
@@ -47,15 +47,6 @@ static inline struct lpc32xx_spi_slave *to_lpc32xx_spi_slave(
return container_of(slave, struct lpc32xx_spi_slave, slave);
}
-/* spi_init is called during boot when CONFIG_CMD_SPI is defined */
-void spi_init(void)
-{
- /*
- * nothing to do: clocking was enabled in lpc32xx_ssp_enable()
- * and configuration will be done in spi_setup_slave()
- */
-}
-
/* the following is called in sequence by do_spi_xfer() */
struct spi_slave *spi_setup_slave(uint bus, uint cs, uint max_hz, uint mode)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 0dccc38b82..b2636909ce 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -400,10 +400,6 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
return mxc_spi_xfer_internal(mxcs, bitlen, dout, din, flags);
}
-void spi_init(void)
-{
-}
-
/*
* Some SPI devices require active chip-select over multiple
* transactions, we achieve this using a GPIO. Still, the SPI
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 006fe8281c..5065e407f8 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -39,10 +39,6 @@ static inline struct mxs_spi_slave *to_mxs_slave(struct spi_slave *slave)
return container_of(slave, struct mxs_spi_slave, slave);
}
-void spi_init(void)
-{
-}
-
int spi_cs_is_valid(unsigned int bus, unsigned int cs)
{
/* MXS SPI: 4 ports and 3 chip selects maximum */
diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index ecf54bb714..c7fcf050a5 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -461,11 +461,6 @@ static inline struct omap3_spi_priv *to_omap3_spi(struct spi_slave *slave)
return container_of(slave, struct omap3_spi_priv, slave);
}
-void spi_init(void)
-{
- /* do nothing */
-}
-
void spi_free_slave(struct spi_slave *slave)
{
struct omap3_spi_priv *priv = to_omap3_spi(slave);
diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
index 64dfd748d6..5ae203d8d4 100644
--- a/drivers/spi/sh_qspi.c
+++ b/drivers/spi/sh_qspi.c
@@ -247,11 +247,6 @@ void spi_cs_deactivate(struct spi_slave *slave)
sh_qspi_cs_deactivate(ss);
}
-void spi_init(void)
-{
- /* nothing to do */
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
{
diff --git a/drivers/spi/sh_spi.c b/drivers/spi/sh_spi.c
index bc2bd638e6..c58fd0ebc4 100644
--- a/drivers/spi/sh_spi.c
+++ b/drivers/spi/sh_spi.c
@@ -66,10 +66,6 @@ static int write_fifo_empty_wait(struct sh_spi *ss)
return 0;
}
-void spi_init(void)
-{
-}
-
static void sh_spi_set_cs(struct sh_spi *ss, unsigned int cs)
{
unsigned long val = 0;
diff --git a/drivers/spi/soft_spi_legacy.c b/drivers/spi/soft_spi_legacy.c
index 0aac0c065d..cc5ab5f991 100644
--- a/drivers/spi/soft_spi_legacy.c
+++ b/drivers/spi/soft_spi_legacy.c
@@ -36,13 +36,6 @@ static inline struct soft_spi_slave *to_soft_spi(struct spi_slave *slave)
/* Public Functions */
/*=====================================================================*/
-/*-----------------------------------------------------------------------
- * Initialization
- */
-void spi_init (void)
-{
-}
-
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
{
diff --git a/include/spi.h b/include/spi.h
index 938627bc01..92427e5f32 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -117,13 +117,6 @@ struct spi_slave {
#define SPI_XFER_MMAP_END BIT(3) /* Memory Mapped End */
};
-/**
- * Initialization, must be called once on start up.
- *
- * TODO: I don't think we really need this.
- */
-void spi_init(void);
-
/**
* spi_do_alloc_slave - Allocate a new SPI slave (internal)
*
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 2/6] spi: Remove used spi_init
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
@ 2018-11-24 12:13 ` Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 3/6] spi: mpc8xx: Migrate to DM_SPI Jagan Teki
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
spi_init used in some areas in tree, but the respective
drivers will remove in future patches.
So remove the same instances.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
common/board_f.c | 2 --
doc/driver-model/spi-howto.txt | 5 -----
examples/standalone/atmel_df_pow2.c | 2 --
include/_exports.h | 2 --
4 files changed, 11 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index f1a1432d86..60634e52cd 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -23,7 +23,6 @@
#include <os.h>
#include <post.h>
#include <relocate.h>
-#include <spi.h>
#include <status_led.h>
#include <sysreset.h>
#include <timer.h>
@@ -262,7 +261,6 @@ __weak int init_func_vid(void)
static int init_func_spi(void)
{
puts("SPI: ");
- spi_init();
puts("ready\n");
return 0;
}
diff --git a/doc/driver-model/spi-howto.txt b/doc/driver-model/spi-howto.txt
index 1955ffe284..38c26f642b 100644
--- a/doc/driver-model/spi-howto.txt
+++ b/doc/driver-model/spi-howto.txt
@@ -163,11 +163,6 @@ At this point you should be able to build U-Boot for your board with the
empty SPI driver. You still have empty methods in your driver, but we will
write these one by one.
-If you have spi_init() functions or the like that are called from your
-board then the build will fail. Remove these calls and make a note of the
-init that needs to be done.
-
-
7. Set up your platform data structure
This will hold the information your driver to operate, like its hardware
diff --git a/examples/standalone/atmel_df_pow2.c b/examples/standalone/atmel_df_pow2.c
index 2e14aba390..b7bd243730 100644
--- a/examples/standalone/atmel_df_pow2.c
+++ b/examples/standalone/atmel_df_pow2.c
@@ -126,8 +126,6 @@ int atmel_df_pow2(int argc, char * const argv[])
return 1;
}
- spi_init();
-
while (1) {
struct spi_slave *slave;
char *line, *p;
diff --git a/include/_exports.h b/include/_exports.h
index 5416041243..c15050e30b 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -50,11 +50,9 @@
#endif
#if !defined(CONFIG_CMD_SPI) || defined(CONFIG_DM_SPI)
- EXPORT_FUNC(dummy, void, spi_init, void)
EXPORT_FUNC(dummy, void, spi_setup_slave, void)
EXPORT_FUNC(dummy, void, spi_free_slave, void)
#else
- EXPORT_FUNC(spi_init, void, spi_init, void)
EXPORT_FUNC(spi_setup_slave, struct spi_slave *, spi_setup_slave,
unsigned int, unsigned int, unsigned int, unsigned int)
EXPORT_FUNC(spi_free_slave, void, spi_free_slave, struct spi_slave *)
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 3/6] spi: mpc8xx: Migrate to DM_SPI
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 2/6] spi: Remove used spi_init Jagan Teki
@ 2018-11-24 12:13 ` Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 4/6] spi: Remove unused mpc8xx code Jagan Teki
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
From: Christophe Leroy <christophe.leroy@c-s.fr>
Drop non-dm code and migrate into DM_SPI.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
[jagan: Move config menu in DM_SPI area]
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/Kconfig | 12 +--
drivers/spi/mpc8xx_spi.c | 179 +++++++--------------------------------
2 files changed, 36 insertions(+), 155 deletions(-)
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 4a8a38b863..a7bb5b35c2 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -124,6 +124,12 @@ config MESON_SPIFC
This driver can be used to access the SPI NOR flash chips on
Amlogic Meson SoCs.
+config MPC8XX_SPI
+ bool "MPC8XX SPI Driver"
+ depends on MPC8xx
+ help
+ Enable support for SPI on MPC8XX
+
config MT7621_SPI
bool "MediaTek MT7621 SPI driver"
depends on ARCH_MT7620
@@ -343,12 +349,6 @@ config LPC32XX_SSP
help
Enable support for SPI on LPC32xx
-config MPC8XX_SPI
- bool "MPC8XX SPI Driver"
- depends on MPC8xx
- help
- Enable support for SPI on MPC8XX
-
config MPC8XXX_SPI
bool "MPC8XXX SPI Driver"
help
diff --git a/drivers/spi/mpc8xx_spi.c b/drivers/spi/mpc8xx_spi.c
index 285fd4d2cc..b020ce2b9d 100644
--- a/drivers/spi/mpc8xx_spi.c
+++ b/drivers/spi/mpc8xx_spi.c
@@ -17,64 +17,19 @@
*/
#include <common.h>
+#include <dm.h>
#include <mpc8xx.h>
+#include <spi.h>
+
#include <asm/cpm_8xx.h>
-#include <linux/ctype.h>
-#include <malloc.h>
-#include <post.h>
-#include <serial.h>
-
-#define SPI_EEPROM_WREN 0x06
-#define SPI_EEPROM_RDSR 0x05
-#define SPI_EEPROM_READ 0x03
-#define SPI_EEPROM_WRITE 0x02
-
-/* ---------------------------------------------------------------
- * Offset for initial SPI buffers in DPRAM:
- * We need a 520 byte scratch DPRAM area to use at an early stage.
- * It is used between the two initialization calls (spi_init_f()
- * and spi_init_r()).
- * The value 0xb00 makes it far enough from the start of the data
- * area (as well as from the stack pointer).
- * --------------------------------------------------------------- */
-#ifndef CONFIG_SYS_SPI_INIT_OFFSET
-#define CONFIG_SYS_SPI_INIT_OFFSET 0xB00
-#endif
+#include <asm/io.h>
#define CPM_SPI_BASE_RX CPM_SPI_BASE
#define CPM_SPI_BASE_TX (CPM_SPI_BASE + sizeof(cbd_t))
-/* -------------------
- * Function prototypes
- * ------------------- */
-ssize_t spi_xfer(size_t);
-
-/* -------------------
- * Variables
- * ------------------- */
-
#define MAX_BUFFER 0x104
-/* ----------------------------------------------------------------------
- * Initially we place the RX and TX buffers at a fixed location in DPRAM!
- * ---------------------------------------------------------------------- */
-static uchar *rxbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
- [CONFIG_SYS_SPI_INIT_OFFSET];
-static uchar *txbuf =
- (uchar *)&((cpm8xx_t *)&((immap_t *)CONFIG_SYS_IMMR)->im_cpm)->cp_dpmem
- [CONFIG_SYS_SPI_INIT_OFFSET+MAX_BUFFER];
-
-/* **************************************************************************
- *
- * Function: spi_init_f
- *
- * Description: Init SPI-Controller (ROM part)
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_f(void)
+static int mpc8xx_spi_probe(struct udevice *dev)
{
immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
cpm8xx_t __iomem *cp = &immr->im_cpm;
@@ -180,117 +135,24 @@ void spi_init_f(void)
clrbits_be16(&tbdf->cbd_sc, BD_SC_READY);
clrbits_be16(&rbdf->cbd_sc, BD_SC_EMPTY);
- /* Set the bd's rx and tx buffer address pointers */
- out_be32(&rbdf->cbd_bufaddr, (ulong)rxbuf);
- out_be32(&tbdf->cbd_bufaddr, (ulong)txbuf);
-
/* 10 + 11 */
out_8(&cp->cp_spim, 0); /* Mask all SPI events */
out_8(&cp->cp_spie, SPI_EMASK); /* Clear all SPI events */
- return;
+ return 0;
}
-/* **************************************************************************
- *
- * Function: spi_init_r
- *
- * Description: Init SPI-Controller (RAM part) -
- * The malloc engine is ready and we can move our buffers to
- * normal RAM
- *
- * return: ---
- *
- * *********************************************************************** */
-void spi_init_r(void)
+static int mpc8xx_spi_xfer(struct udevice *dev, unsigned int bitlen,
+ const void *dout, void *din, unsigned long flags)
{
immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
cpm8xx_t __iomem *cp = &immr->im_cpm;
- spi_t __iomem *spi = (spi_t __iomem *)&cp->cp_dparam[PROFF_SPI];
- cbd_t __iomem *tbdf, *rbdf;
-
- /* Disable relocation */
- out_be16(&spi->spi_rpbase, 0);
-
- /* tx and rx buffer descriptors */
- tbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_TX];
- rbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_RX];
-
- /* Allocate memory for RX and TX buffers */
- rxbuf = (uchar *)malloc(MAX_BUFFER);
- txbuf = (uchar *)malloc(MAX_BUFFER);
-
- out_be32(&rbdf->cbd_bufaddr, (ulong)rxbuf);
- out_be32(&tbdf->cbd_bufaddr, (ulong)txbuf);
-
- return;
-}
-
-/****************************************************************************
- * Function: spi_write
- **************************************************************************** */
-ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
-{
- int i;
-
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- *txbuf = SPI_EEPROM_WREN; /* write enable */
- spi_xfer(1);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_WRITE; /* WRITE memory array */
- memcpy(alen + txbuf, buffer, len);
- spi_xfer(alen + len);
- /* ignore received data */
- for (i = 0; i < 1000; i++) {
- *txbuf = SPI_EEPROM_RDSR; /* read status */
- txbuf[1] = 0;
- spi_xfer(2);
- if (!(rxbuf[1] & 1))
- break;
- udelay(1000);
- }
- if (i >= 1000)
- printf("*** spi_write: Time out while writing!\n");
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_read
- **************************************************************************** */
-ssize_t spi_read(uchar *addr, int alen, uchar *buffer, int len)
-{
- memset(rxbuf, 0, MAX_BUFFER);
- memset(txbuf, 0, MAX_BUFFER);
- memcpy(txbuf, addr, alen);
- *txbuf = SPI_EEPROM_READ; /* READ memory array */
-
- /*
- * There is a bug in 860T (?) that cuts the last byte of input
- * if we're reading into DPRAM. The solution we choose here is
- * to always read len+1 bytes (we have one extra byte at the
- * end of the buffer).
- */
- spi_xfer(alen + len + 1);
- memcpy(buffer, alen + rxbuf, len);
-
- return len;
-}
-
-/****************************************************************************
- * Function: spi_xfer
- **************************************************************************** */
-ssize_t spi_xfer(size_t count)
-{
- immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR;
- cpm8xx_t __iomem *cp = &immr->im_cpm;
- spi_t __iomem *spi = (spi_t __iomem *)&cp->cp_dparam[PROFF_SPI];
cbd_t __iomem *tbdf, *rbdf;
int tm;
+ size_t count = (bitlen + 7) / 8;
- /* Disable relocation */
- out_be16(&spi->spi_rpbase, 0);
+ if (count > MAX_BUFFER)
+ return -EINVAL;
tbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_TX];
rbdf = (cbd_t __iomem *)&cp->cp_dpmem[CPM_SPI_BASE_RX];
@@ -299,10 +161,12 @@ ssize_t spi_xfer(size_t count)
clrbits_be32(&cp->cp_pbdat, 0x0001);
/* Setting tx bd status and data length */
+ out_be32(&tbdf->cbd_bufaddr, (ulong)dout);
out_be16(&tbdf->cbd_sc, BD_SC_READY | BD_SC_LAST | BD_SC_WRAP);
out_be16(&tbdf->cbd_datlen, count);
/* Setting rx bd status and data length */
+ out_be32(&rbdf->cbd_bufaddr, (ulong)din);
out_be16(&rbdf->cbd_sc, BD_SC_EMPTY | BD_SC_WRAP);
out_be16(&rbdf->cbd_datlen, 0); /* rx length has no significance */
@@ -333,3 +197,20 @@ ssize_t spi_xfer(size_t count)
return count;
}
+
+static const struct dm_spi_ops mpc8xx_spi_ops = {
+ .xfer = mpc8xx_spi_xfer,
+};
+
+static const struct udevice_id mpc8xx_spi_ids[] = {
+ { .compatible = "fsl,mpc8xx-spi" },
+ { }
+};
+
+U_BOOT_DRIVER(mpc8xx_spi) = {
+ .name = "mpc8xx_spi",
+ .id = UCLASS_SPI,
+ .of_match = mpc8xx_spi_ids,
+ .ops = &mpc8xx_spi_ops,
+ .probe = mpc8xx_spi_probe,
+};
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 4/6] spi: Remove unused mpc8xx code
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 2/6] spi: Remove used spi_init Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 3/6] spi: mpc8xx: Migrate to DM_SPI Jagan Teki
@ 2018-11-24 12:13 ` Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 5/6] spi: Zap CONFIG_HARD_SPI Jagan Teki
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
- spi_init_f
- spi_init_r
- spi_read
- spi_write
these spi calls are exclusively for mpc8xx, but
the relevant driver is not available so remove it.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
cmd/eeprom.c | 15 +--------------
common/board_r.c | 7 -------
include/common.h | 7 -------
3 files changed, 1 insertion(+), 28 deletions(-)
diff --git a/cmd/eeprom.c b/cmd/eeprom.c
index 4052cf494a..9136630ada 100644
--- a/cmd/eeprom.c
+++ b/cmd/eeprom.c
@@ -66,11 +66,6 @@ __weak int eeprom_write_enable(unsigned dev_addr, int state)
void eeprom_init(int bus)
{
- /* SPI EEPROM */
-#if defined(CONFIG_MPC8XX_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
- spi_init_f();
-#endif
-
/* I2C EEPROM */
#if defined(CONFIG_SYS_I2C)
if (bus >= 0)
@@ -129,14 +124,6 @@ static int eeprom_rw_block(unsigned offset, uchar *addr, unsigned alen,
{
int ret = 0;
- /* SPI */
-#if defined(CONFIG_MPC8XX_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
- if (read)
- spi_read(addr, alen, buffer, len);
- else
- spi_write(addr, alen, buffer, len);
-#else /* I2C */
-
#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS);
#endif
@@ -148,7 +135,7 @@ static int eeprom_rw_block(unsigned offset, uchar *addr, unsigned alen,
if (ret)
ret = 1;
-#endif
+
return ret;
}
diff --git a/common/board_r.c b/common/board_r.c
index c55e33eec2..3ccef5467b 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -382,13 +382,6 @@ static int initr_flash(void)
#if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI)
static int initr_spi(void)
{
- /* MPC8xx does this here */
-#ifdef CONFIG_MPC8XX_SPI
-#if !defined(CONFIG_ENV_IS_IN_EEPROM)
- spi_init_f();
-#endif
- spi_init_r();
-#endif
return 0;
}
#endif
diff --git a/include/common.h b/include/common.h
index 3f69943887..cfbdf7ebcb 100644
--- a/include/common.h
+++ b/include/common.h
@@ -276,13 +276,6 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned c
# define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
#endif
-#if defined(CONFIG_MPC8XX_SPI)
-extern void spi_init_f (void);
-extern void spi_init_r (void);
-extern ssize_t spi_read (uchar *, int, uchar *, int);
-extern ssize_t spi_write (uchar *, int, uchar *, int);
-#endif
-
/* $(BOARD)/$(BOARD).c */
int board_early_init_f (void);
int board_fix_fdt (void *rw_fdt_blob); /* manipulate the U-Boot fdt before its relocation */
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 5/6] spi: Zap CONFIG_HARD_SPI
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
` (2 preceding siblings ...)
2018-11-24 12:13 ` [U-Boot] [PATCH v2 4/6] spi: Remove unused mpc8xx code Jagan Teki
@ 2018-11-24 12:13 ` Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 6/6] board_r: Remove initr_spi Jagan Teki
2018-11-27 15:42 ` [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
In legacy CONFIG_HARD_SPI initalizing spi_init code, which
was removed during dm conversion cleanup.
So remove the dead instances of CONFIG_HARD_SPI, and related
code.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
README | 8 --------
arch/powerpc/include/asm/config.h | 7 -------
board/freescale/mpc8349emds/mpc8349emds.c | 2 +-
board/ids/ids8313/ids8313.c | 2 +-
common/board_f.c | 12 ------------
include/configs/M52277EVB.h | 1 -
include/configs/M54418TWR.h | 1 -
include/configs/M54451EVB.h | 1 -
include/configs/M54455EVB.h | 1 -
include/configs/MPC8536DS.h | 5 -----
include/configs/P1022DS.h | 6 ------
include/configs/UCP1020.h | 5 -----
include/configs/controlcenterd.h | 4 ----
include/configs/dreamplug.h | 1 -
include/configs/ds109.h | 1 -
include/configs/ids8313.h | 10 ----------
include/configs/mx31pdk.h | 1 -
include/configs/mxs.h | 1 -
include/configs/p1_p2_rdb_pc.h | 5 -----
include/configs/p1_twr.h | 5 -----
include/configs/stmark2.h | 1 -
include/configs/ts4800.h | 5 -----
scripts/config_whitelist.txt | 1 -
23 files changed, 2 insertions(+), 84 deletions(-)
diff --git a/README b/README
index a46c7c63a4..17d56b8034 100644
--- a/README
+++ b/README
@@ -1932,14 +1932,6 @@ The following options need to be configured:
SPI configuration items (port pins to use, etc). For
an example, see include/configs/sacsng.h.
- CONFIG_HARD_SPI
-
- Enables a hardware SPI driver for general-purpose reads
- and writes. As with CONFIG_SOFT_SPI, the board configuration
- must define a list of chip-select function pointers.
- Currently supported on some MPC8xxx processors. For an
- example, see include/configs/mpc8349emds.h.
-
CONFIG_SYS_SPI_MXC_WAIT
Timeout for waiting until spi transfer completed.
default: (CONFIG_SYS_HZ/100) /* 10 ms */
diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h
index 849a69aced..c9c9964630 100644
--- a/arch/powerpc/include/asm/config.h
+++ b/arch/powerpc/include/asm/config.h
@@ -18,13 +18,6 @@
#define HWCONFIG_BUFFER_SIZE 256
#endif
-/* CONFIG_HARD_SPI triggers SPI bus initialization in PowerPC */
-#if defined(CONFIG_MPC8XXX_SPI) || defined(CONFIG_FSL_ESPI)
-# ifndef CONFIG_HARD_SPI
-# define CONFIG_HARD_SPI
-# endif
-#endif
-
#define CONFIG_LMB
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c
index 4ec0af4d1c..d40ed3742e 100644
--- a/board/freescale/mpc8349emds/mpc8349emds.c
+++ b/board/freescale/mpc8349emds/mpc8349emds.c
@@ -273,7 +273,7 @@ void spi_cs_deactivate(struct spi_slave *slave)
iopd->dat |= SPI_CS_MASK;
}
-#endif /* CONFIG_HARD_SPI */
+#endif
#if defined(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, bd_t *bd)
diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c
index a411d4e7f6..d547af4b05 100644
--- a/board/ids/ids8313/ids8313.c
+++ b/board/ids/ids8313/ids8313.c
@@ -208,4 +208,4 @@ void spi_cs_deactivate(struct spi_slave *slave)
/* deactivate the spi_cs */
setbits_be32(&iopd->dat, IDSCPLD_SPI_CS_MASK);
}
-#endif /* CONFIG_HARD_SPI */
+#endif
diff --git a/common/board_f.c b/common/board_f.c
index 60634e52cd..a3e80ca951 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -257,15 +257,6 @@ __weak int init_func_vid(void)
}
#endif
-#if defined(CONFIG_HARD_SPI)
-static int init_func_spi(void)
-{
- puts("SPI: ");
- puts("ready\n");
- return 0;
-}
-#endif
-
static int setup_mon_len(void)
{
#if defined(__ARM__) || defined(__MICROBLAZE__)
@@ -863,9 +854,6 @@ static const init_fnc_t init_sequence_f[] = {
#endif
#if defined(CONFIG_VID) && !defined(CONFIG_SPL)
init_func_vid,
-#endif
-#if defined(CONFIG_HARD_SPI)
- init_func_spi,
#endif
announce_dram_init,
dram_init, /* configure available RAM banks */
diff --git a/include/configs/M52277EVB.h b/include/configs/M52277EVB.h
index 11cb3955da..83d774527a 100644
--- a/include/configs/M52277EVB.h
+++ b/include/configs/M52277EVB.h
@@ -102,7 +102,6 @@
/* DSPI and Serial Flash */
#define CONFIG_CF_DSPI
-#define CONFIG_HARD_SPI
#define CONFIG_SYS_SBFHDR_SIZE 0x7
#ifdef CONFIG_CMD_SPI
# define CONFIG_SYS_DSPI_CS2
diff --git a/include/configs/M54418TWR.h b/include/configs/M54418TWR.h
index f08896ef0a..4b8ef38c0b 100644
--- a/include/configs/M54418TWR.h
+++ b/include/configs/M54418TWR.h
@@ -151,7 +151,6 @@
/* DSPI and Serial Flash */
#define CONFIG_CF_DSPI
#define CONFIG_SERIAL_FLASH
-#define CONFIG_HARD_SPI
#define CONFIG_SYS_SBFHDR_SIZE 0x7
#ifdef CONFIG_CMD_SPI
diff --git a/include/configs/M54451EVB.h b/include/configs/M54451EVB.h
index 16becbdbed..87cdbae1db 100644
--- a/include/configs/M54451EVB.h
+++ b/include/configs/M54451EVB.h
@@ -116,7 +116,6 @@
/* DSPI and Serial Flash */
#define CONFIG_CF_DSPI
#define CONFIG_SERIAL_FLASH
-#define CONFIG_HARD_SPI
#define CONFIG_SYS_SBFHDR_SIZE 0x7
#ifdef CONFIG_CMD_SPI
diff --git a/include/configs/M54455EVB.h b/include/configs/M54455EVB.h
index 99b60d5d82..d41b7c4492 100644
--- a/include/configs/M54455EVB.h
+++ b/include/configs/M54455EVB.h
@@ -142,7 +142,6 @@
/* DSPI and Serial Flash */
#define CONFIG_CF_DSPI
-#define CONFIG_HARD_SPI
#define CONFIG_SYS_SBFHDR_SIZE 0x13
#ifdef CONFIG_CMD_SPI
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 524a10fc95..86a1233e32 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -370,11 +370,6 @@
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
#define CONFIG_SYS_EEPROM_BUS_NUM 1
-/*
- * eSPI - Enhanced SPI
- */
-#define CONFIG_HARD_SPI
-
#if defined(CONFIG_SPI_FLASH)
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE 0
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index c9ed70ca4c..eeb19a9fa6 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -386,12 +386,6 @@
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
#define CONFIG_SYS_EEPROM_BUS_NUM 1
-/*
- * eSPI - Enhanced SPI
- */
-
-#define CONFIG_HARD_SPI
-
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE 0
diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h
index 423ecd71c2..1bbe9d9b37 100644
--- a/include/configs/UCP1020.h
+++ b/include/configs/UCP1020.h
@@ -287,11 +287,6 @@
#define CONFIG_SYS_I2C_NCT72_ADDR 0x4C
#define CONFIG_SYS_I2C_IDT6V49205B 0x69
-/*
- * eSPI - Enhanced SPI
- */
-#define CONFIG_HARD_SPI
-
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
diff --git a/include/configs/controlcenterd.h b/include/configs/controlcenterd.h
index 4adcd956ef..1908d35bcc 100644
--- a/include/configs/controlcenterd.h
+++ b/include/configs/controlcenterd.h
@@ -182,10 +182,6 @@
#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
#ifndef CONFIG_TRAILBLAZER
-/*
- * eSPI - Enhanced SPI
- */
-#define CONFIG_HARD_SPI
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE 0
diff --git a/include/configs/dreamplug.h b/include/configs/dreamplug.h
index 1c94bf9fa1..f4d717213c 100644
--- a/include/configs/dreamplug.h
+++ b/include/configs/dreamplug.h
@@ -35,7 +35,6 @@
#endif
#ifdef CONFIG_CMD_SF
-#define CONFIG_HARD_SPI 1
#define CONFIG_ENV_SPI_BUS 0
#define CONFIG_ENV_SPI_CS 0
#define CONFIG_ENV_SPI_MAX_HZ 50000000 /* 50 MHz */
diff --git a/include/configs/ds109.h b/include/configs/ds109.h
index c06f0058de..2c7928e88c 100644
--- a/include/configs/ds109.h
+++ b/include/configs/ds109.h
@@ -38,7 +38,6 @@
#endif
#ifdef CONFIG_CMD_SF
-#define CONFIG_HARD_SPI 1
#define CONFIG_ENV_SPI_BUS 0
#define CONFIG_ENV_SPI_CS 0
#define CONFIG_ENV_SPI_MAX_HZ 50000000 /* 50 MHz */
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 28124dd4b1..7e4c497fe0 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -159,7 +159,6 @@
*/
#define CONFIG_TSEC1
#define CONFIG_TSEC2
-#define CONFIG_HARD_SPI
/*
* NOR FLASH setup
@@ -273,15 +272,6 @@
#define CONFIG_RTC_PCF8563
#define CONFIG_SYS_I2C_RTC_ADDR 0x51
-/*
- * SPI setup
- */
-#ifdef CONFIG_HARD_SPI
-#define CONFIG_SYS_GPIO1_PRELIM
-#define CONFIG_SYS_GPIO1_DIR 0x00000001
-#define CONFIG_SYS_GPIO1_DAT 0x00000001
-#endif
-
/*
* Ethernet setup
*/
diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
index 7d84d160b4..4765764f83 100644
--- a/include/configs/mx31pdk.h
+++ b/include/configs/mx31pdk.h
@@ -43,7 +43,6 @@
#define CONFIG_MXC_UART
#define CONFIG_MXC_UART_BASE UART1_BASE
-#define CONFIG_HARD_SPI
#define CONFIG_DEFAULT_SPI_BUS 1
#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_0 | SPI_CS_HIGH)
diff --git a/include/configs/mxs.h b/include/configs/mxs.h
index 9e59e7a4dc..4bb3621a42 100644
--- a/include/configs/mxs.h
+++ b/include/configs/mxs.h
@@ -143,7 +143,6 @@
/* SPI */
#ifdef CONFIG_CMD_SPI
-#define CONFIG_HARD_SPI
#define CONFIG_SPI_HALF_DUPLEX
#endif
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index 9465fb4702..459ecf328f 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -576,11 +576,6 @@
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
-/*
- * eSPI - Enhanced SPI
- */
-#define CONFIG_HARD_SPI
-
#if defined(CONFIG_SPI_FLASH)
#define CONFIG_SF_DEFAULT_SPEED 10000000
#define CONFIG_SF_DEFAULT_MODE 0
diff --git a/include/configs/p1_twr.h b/include/configs/p1_twr.h
index d018c22afd..4f48370648 100644
--- a/include/configs/p1_twr.h
+++ b/include/configs/p1_twr.h
@@ -214,11 +214,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
-/*
- * eSPI - Enhanced SPI
- */
-#define CONFIG_HARD_SPI
-
#if defined(CONFIG_PCI)
/*
* General PCI
diff --git a/include/configs/stmark2.h b/include/configs/stmark2.h
index c408db865e..33ddc67bf4 100644
--- a/include/configs/stmark2.h
+++ b/include/configs/stmark2.h
@@ -66,7 +66,6 @@
#define CONFIG_CF_DSPI
#define CONFIG_SF_DEFAULT_SPEED 50000000
#define CONFIG_SERIAL_FLASH
-#define CONFIG_HARD_SPI
#define CONFIG_ENV_SPI_BUS 0
#define CONFIG_ENV_SPI_CS 1
diff --git a/include/configs/ts4800.h b/include/configs/ts4800.h
index 956f7795f1..4e274bd414 100644
--- a/include/configs/ts4800.h
+++ b/include/configs/ts4800.h
@@ -42,11 +42,6 @@
#define CONFIG_MXC_UART
#define CONFIG_MXC_UART_BASE UART1_BASE
-/*
- * SPI Configs
- * */
-#define CONFIG_HARD_SPI /* puts SPI: ready */
-
/*
* MMC Configs
* */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index abfb0ff89f..1404fd855b 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -750,7 +750,6 @@ CONFIG_G_DNL_UMS_PRODUCT_NUM
CONFIG_G_DNL_UMS_VENDOR_NUM
CONFIG_H264_FREQ
CONFIG_H8300
-CONFIG_HARD_SPI
CONFIG_HAS_ETH0
CONFIG_HAS_ETH1
CONFIG_HAS_ETH2
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 6/6] board_r: Remove initr_spi
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
` (3 preceding siblings ...)
2018-11-24 12:13 ` [U-Boot] [PATCH v2 5/6] spi: Zap CONFIG_HARD_SPI Jagan Teki
@ 2018-11-24 12:13 ` Jagan Teki
2018-11-27 15:42 ` [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-24 12:13 UTC (permalink / raw)
To: u-boot
Drop unused initr_spi, which just return 0, no usage.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
common/board_r.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/common/board_r.c b/common/board_r.c
index 3ccef5467b..2f982b1646 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -36,7 +36,6 @@
#include <onenand_uboot.h>
#include <scsi.h>
#include <serial.h>
-#include <spi.h>
#include <stdio_dev.h>
#include <timer.h>
#include <trace.h>
@@ -379,13 +378,6 @@ static int initr_flash(void)
}
#endif
-#if defined(CONFIG_PPC) && !defined(CONFIG_DM_SPI)
-static int initr_spi(void)
-{
- return 0;
-}
-#endif
-
#ifdef CONFIG_CMD_NAND
/* go init the NAND */
static int initr_nand(void)
@@ -736,9 +728,6 @@ static init_fnc_t init_sequence_r[] = {
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
#endif
-#ifdef CONFIG_PPC
- initr_spi,
-#endif
#ifdef CONFIG_CMD_NAND
initr_nand,
#endif
--
2.18.0.321.gffc6fa0e3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
` (4 preceding siblings ...)
2018-11-24 12:13 ` [U-Boot] [PATCH v2 6/6] board_r: Remove initr_spi Jagan Teki
@ 2018-11-27 15:42 ` Jagan Teki
5 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2018-11-27 15:42 UTC (permalink / raw)
To: u-boot
On Sat, Nov 24, 2018 at 5:43 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> Remove spi_init definition which never used on
> respective code since from many years.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
All patches,
Applied to u-boot-spi/maste
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-11-27 15:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-24 12:13 [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 2/6] spi: Remove used spi_init Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 3/6] spi: mpc8xx: Migrate to DM_SPI Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 4/6] spi: Remove unused mpc8xx code Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 5/6] spi: Zap CONFIG_HARD_SPI Jagan Teki
2018-11-24 12:13 ` [U-Boot] [PATCH v2 6/6] board_r: Remove initr_spi Jagan Teki
2018-11-27 15:42 ` [U-Boot] [PATCH v2 1/6] spi: Remove unused spi_init Jagan Teki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.