public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 33/34] spi: fsl_dspi: Drop non-dm code
Date: Tue, 20 Nov 2018 18:18:13 +0530	[thread overview]
Message-ID: <20181120124814.23293-34-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20181120124814.23293-1-jagan@amarulasolutions.com>

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?

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/spi/fsl_dspi.c | 132 -----------------------------------------
 1 file changed, 132 deletions(-)

diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index 764c94215e..2e1cf22eb0 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -97,13 +97,6 @@ struct fsl_dspi_priv {
 	struct dspi *regs;
 };
 
-#ifndef CONFIG_DM_SPI
-struct fsl_dspi {
-	struct spi_slave slave;
-	struct fsl_dspi_priv priv;
-};
-#endif
-
 __weak void cpu_dspi_port_conf(void)
 {
 }
@@ -389,131 +382,7 @@ static int fsl_dspi_cfg_speed(struct fsl_dspi_priv *priv, uint speed)
 
 	return 0;
 }
-#ifndef CONFIG_DM_SPI
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
-{
-	if (((cs >= 0) && (cs < 8)) && ((bus >= 0) && (bus < 8)))
-		return 1;
-	else
-		return 0;
-}
-
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
-				  unsigned int max_hz, unsigned int mode)
-{
-	struct fsl_dspi *dspi;
-	uint mcr_cfg_val;
-
-	dspi = spi_alloc_slave(struct fsl_dspi, bus, cs);
-	if (!dspi)
-		return NULL;
-
-	cpu_dspi_port_conf();
-
-#ifdef CONFIG_SYS_FSL_DSPI_BE
-	dspi->priv.flags |= DSPI_FLAG_REGMAP_ENDIAN_BIG;
-#endif
-
-	dspi->priv.regs = (struct dspi *)MMAP_DSPI;
-
-#ifdef CONFIG_M68K
-	dspi->priv.bus_clk = gd->bus_clk;
-#else
-	dspi->priv.bus_clk = mxc_get_clock(MXC_DSPI_CLK);
-#endif
-	dspi->priv.speed_hz = FSL_DSPI_DEFAULT_SCK_FREQ;
-
-	/* default: all CS signals inactive state is high */
-	mcr_cfg_val = DSPI_MCR_MSTR | DSPI_MCR_PCSIS_MASK |
-		DSPI_MCR_CRXF | DSPI_MCR_CTXF;
-	fsl_dspi_init_mcr(&dspi->priv, mcr_cfg_val);
-
-	for (i = 0; i < FSL_DSPI_MAX_CHIPSELECT; i++)
-		dspi->priv.ctar_val[i] = DSPI_CTAR_DEFAULT_VALUE;
-
-#ifdef CONFIG_SYS_DSPI_CTAR0
-	if (FSL_DSPI_MAX_CHIPSELECT > 0)
-		dspi->priv.ctar_val[0] = CONFIG_SYS_DSPI_CTAR0;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR1
-	if (FSL_DSPI_MAX_CHIPSELECT > 1)
-		dspi->priv.ctar_val[1] = CONFIG_SYS_DSPI_CTAR1;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR2
-	if (FSL_DSPI_MAX_CHIPSELECT > 2)
-		dspi->priv.ctar_val[2] = CONFIG_SYS_DSPI_CTAR2;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR3
-	if (FSL_DSPI_MAX_CHIPSELECT > 3)
-		dspi->priv.ctar_val[3] = CONFIG_SYS_DSPI_CTAR3;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR4
-	if (FSL_DSPI_MAX_CHIPSELECT > 4)
-		dspi->priv.ctar_val[4] = CONFIG_SYS_DSPI_CTAR4;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR5
-	if (FSL_DSPI_MAX_CHIPSELECT > 5)
-		dspi->priv.ctar_val[5] = CONFIG_SYS_DSPI_CTAR5;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR6
-	if (FSL_DSPI_MAX_CHIPSELECT > 6)
-		dspi->priv.ctar_val[6] = CONFIG_SYS_DSPI_CTAR6;
-#endif
-#ifdef CONFIG_SYS_DSPI_CTAR7
-	if (FSL_DSPI_MAX_CHIPSELECT > 7)
-		dspi->priv.ctar_val[7] = CONFIG_SYS_DSPI_CTAR7;
-#endif
 
-	fsl_dspi_cfg_speed(&dspi->priv, max_hz);
-
-	/* configure transfer mode */
-	fsl_dspi_cfg_ctar_mode(&dspi->priv, cs, mode);
-
-	/* configure active state of CSX */
-	fsl_dspi_cfg_cs_active_state(&dspi->priv, cs, mode);
-
-	return &dspi->slave;
-}
-
-void spi_free_slave(struct spi_slave *slave)
-{
-	free(slave);
-}
-
-int spi_claim_bus(struct spi_slave *slave)
-{
-	uint sr_val;
-	struct fsl_dspi *dspi = (struct fsl_dspi *)slave;
-
-	cpu_dspi_claim_bus(slave->bus, slave->cs);
-
-	fsl_dspi_clr_fifo(&dspi->priv);
-
-	/* check module TX and RX status */
-	sr_val = dspi_read32(dspi->priv.flags, &dspi->priv.regs->sr);
-	if ((sr_val & DSPI_SR_TXRXS) != DSPI_SR_TXRXS) {
-		debug("DSPI RX/TX not ready!\n");
-		return -EIO;
-	}
-
-	return 0;
-}
-
-void spi_release_bus(struct spi_slave *slave)
-{
-	struct fsl_dspi *dspi = (struct fsl_dspi *)slave;
-
-	dspi_halt(&dspi->priv, 1);
-	cpu_dspi_release_bus(slave->bus.slave->cs);
-}
-
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
-	     void *din, unsigned long flags)
-{
-	struct fsl_dspi *dspi = (struct fsl_dspi *)slave;
-	return dspi_xfer(&dspi->priv, slave->cs, bitlen, dout, din, flags);
-}
-#else
 static int fsl_dspi_child_pre_probe(struct udevice *dev)
 {
 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
@@ -720,4 +589,3 @@ U_BOOT_DRIVER(fsl_dspi) = {
 	.child_pre_probe = fsl_dspi_child_pre_probe,
 	.bind = fsl_dspi_bind,
 };
-#endif
-- 
2.18.0.321.gffc6fa0e3

  parent reply	other threads:[~2018-11-20 12:48 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 12:47 [U-Boot] [PATCH 00/34] spi: DM_SPI migration timeout! Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 01/34] spi: Remove unused spi_init Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 02/34] spi: Remove used spi_init Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 03/34] spi: davinci: Full dm conversion Jagan Teki
2018-11-20 14:45   ` Adam Ford
2018-11-21  9:33   ` Chris Packham
2018-11-20 12:47 ` [U-Boot] [PATCH 04/34] spi: kirkwood: " Jagan Teki
2018-11-21  7:52   ` Chris Packham
2018-11-21  8:39     ` Jagan Teki
2018-11-21  8:59       ` Chris Packham
2018-11-21  9:04         ` Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 05/34] spi: ti_qspi: " Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 06/34] spi: mpc8xxx: Use short type names Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 07/34] spi: mpc8xxx: Fix comments Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 08/34] spi: mpc8xxx: Rename camel-case variables Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 09/34] spi: mpc8xxx: Fix space after cast Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 10/34] spi: mpc8xxx: Fix function names in strings Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 11/34] spi: mpc8xxx: Replace defines with enums Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 12/34] spi: mpc8xxx: Use IO accessors Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 13/34] spi: mpc8xxx: Simplify if Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 14/34] spi: mpc8xxx: Get rid of is_read Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 15/34] spi: mpc8xxx: Simplify logic a bit Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 16/34] spi: mpc8xxx: Reduce scope of loop variables Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 17/34] spi: mpc8xxx: Make code more readable Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 18/34] spi: mpc8xxx: Rename variable Jagan Teki
2018-11-20 12:47 ` [U-Boot] [PATCH 19/34] spi: mpc8xxx: Document LEN setting better Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 20/34] spi: mpc8xxx: Re-order transfer setup Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 21/34] spi: mpc8xxx: Fix if check Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 22/34] spi: mpc8xxx: Use get_timer Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 23/34] spi: mpc8xxx: Convert to DM Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 24/34] spi: Zap cf_spi driver-related code Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 25/34] spi: Zap lpc32xx_ssp " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 26/34] spi: Zap mxs_spi " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 27/34] spi: Zap sh_spi " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 28/34] spi: Zap soft_spi_legacy " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 29/34] spi: Zap mpc8xx_spi " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 30/34] spi: Zap mxc_spi " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 31/34] spi: Zap omap3_spi " Jagan Teki
2018-11-20 12:48 ` [U-Boot] [PATCH 32/34] spi: Zap atmel_spi " Jagan Teki
2018-11-20 12:48 ` Jagan Teki [this message]
2018-11-20 12:48 ` [U-Boot] [PATCH 34/34] dm: MIGRATION: spi: Update SPI driver status Jagan Teki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181120124814.23293-34-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox