linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/10] spi: fsl-espi: remove usage of pdata->initial_spmode
       [not found] ` <882d05f1-a963-c03a-38ae-2dd701f561a6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-11-13 13:36   ` Heiner Kallweit
  0 siblings, 0 replies; 3+ messages in thread
From: Heiner Kallweit @ 2016-11-13 13:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Remove pdata->initial_spmode as it is nowhere set.

Signed-off-by: Heiner Kallweit <hkallweit1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-fsl-espi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 6624c5a..a1e1b68 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -661,7 +661,7 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem,
 	}
 
 	/* Enable SPI interface */
-	regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;
+	regval = SPMODE_INIT_VAL | SPMODE_ENABLE;
 
 	fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODE, regval);
 
@@ -786,7 +786,7 @@ static int of_fsl_espi_resume(struct device *dev)
 				      CSMODE_INIT_VAL);
 
 	/* Enable SPI interface */
-	regval = pdata->initial_spmode | SPMODE_INIT_VAL | SPMODE_ENABLE;
+	regval = SPMODE_INIT_VAL | SPMODE_ENABLE;
 
 	fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODE, regval);
 
-- 
2.10.1


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 03/10] spi: fsl-espi: remove remaining usage of struct fsl_spi_platform_data
       [not found]   ` <46d0ab77-d645-1db3-cca4-99b1b04d599c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-11-13 13:36     ` Heiner Kallweit
       [not found]       ` <75bd88e0-e1bf-9729-6cd0-e88633d940e6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2016-11-13 13:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Use master->num_chipselect directly instead of pdata->max_chipselect.
In this context let of_fsl_espi_get_chipselects return max_chipselect.

This change allows us to get rid of struct fsl_spi_platform_data
completely in the fsl-espi driver.

Signed-off-by: Heiner Kallweit <hkallweit1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-fsl-espi.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index e5d7164..29cd4e0 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -573,9 +573,8 @@ static size_t fsl_espi_max_message_size(struct spi_device *spi)
 }
 
 static int fsl_espi_probe(struct device *dev, struct resource *mem,
-			  unsigned int irq)
+			  unsigned int irq, unsigned int num_cs)
 {
-	struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
 	struct spi_master *master;
 	struct mpc8xxx_spi *mpc8xxx_spi;
 	struct device_node *nc;
@@ -597,6 +596,7 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem,
 	master->transfer_one_message = fsl_espi_do_one_msg;
 	master->auto_runtime_pm = true;
 	master->max_message_size = fsl_espi_max_message_size;
+	master->num_chipselect = num_cs;
 
 	mpc8xxx_spi = spi_master_get_devdata(master);
 	spin_lock_init(&mpc8xxx_spi->lock);
@@ -636,7 +636,7 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem,
 	for_each_available_child_of_node(master->dev.of_node, nc) {
 		/* get chip select */
 		ret = of_property_read_u32(nc, "reg", &cs);
-		if (ret || cs >= pdata->max_chipselect)
+		if (ret || cs >= num_cs)
 			continue;
 
 		csmode = CSMODE_INIT_VAL;
@@ -695,19 +695,16 @@ static int fsl_espi_probe(struct device *dev, struct resource *mem,
 static int of_fsl_espi_get_chipselects(struct device *dev)
 {
 	struct device_node *np = dev->of_node;
-	struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
 	u32 num_cs;
 	int ret;
 
 	ret = of_property_read_u32(np, "fsl,espi-num-chipselects", &num_cs);
 	if (ret) {
 		dev_err(dev, "No 'fsl,espi-num-chipselects' property\n");
-		return -EINVAL;
+		return 0;
 	}
 
-	pdata->max_chipselect = num_cs;
-
-	return 0;
+	return num_cs;
 }
 
 static int of_fsl_espi_probe(struct platform_device *ofdev)
@@ -715,16 +712,16 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
 	struct device *dev = &ofdev->dev;
 	struct device_node *np = ofdev->dev.of_node;
 	struct resource mem;
-	unsigned int irq;
+	unsigned int irq, num_cs;
 	int ret;
 
 	ret = of_mpc8xxx_spi_probe(ofdev);
 	if (ret)
 		return ret;
 
-	ret = of_fsl_espi_get_chipselects(dev);
-	if (ret)
-		return ret;
+	num_cs = of_fsl_espi_get_chipselects(dev);
+	if (!num_cs)
+		return -EINVAL;
 
 	ret = of_address_to_resource(np, 0, &mem);
 	if (ret)
@@ -734,7 +731,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
 	if (!irq)
 		return -EINVAL;
 
-	return fsl_espi_probe(dev, &mem, irq);
+	return fsl_espi_probe(dev, &mem, irq, num_cs);
 }
 
 static int of_fsl_espi_remove(struct platform_device *dev)
@@ -765,7 +762,6 @@ static int of_fsl_espi_suspend(struct device *dev)
 
 static int of_fsl_espi_resume(struct device *dev)
 {
-	struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
 	struct spi_master *master = dev_get_drvdata(dev);
 	struct mpc8xxx_spi *mpc8xxx_spi;
 	u32 regval;
@@ -780,7 +776,7 @@ static int of_fsl_espi_resume(struct device *dev)
 	fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPIE, 0xffffffff);
 
 	/* Init eSPI CS mode register */
-	for (i = 0; i < pdata->max_chipselect; i++)
+	for (i = 0; i < master->num_chipselect; i++)
 		fsl_espi_write_reg(mpc8xxx_spi, ESPI_SPMODEx(i),
 				      CSMODE_INIT_VAL);
 
-- 
2.10.1


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 03/10] spi: fsl-espi: remove remaining usage of struct fsl_spi_platform_data
       [not found]       ` <75bd88e0-e1bf-9729-6cd0-e88633d940e6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-11-14 10:35         ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2016-11-14 10:35 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

[-- Attachment #1: Type: text/plain, Size: 473 bytes --]

On Sun, Nov 13, 2016 at 02:36:39PM +0100, Heiner Kallweit wrote:
> Use master->num_chipselect directly instead of pdata->max_chipselect.
> In this context let of_fsl_espi_get_chipselects return max_chipselect.

Something is screwed up with the way you're sending these - none of this
series is threaded together except this which is threaded with patch 1.
Generally it's best to use git send-email to send patches, it will get
things right with little effort on your part.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-14 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <882d05f1-a963-c03a-38ae-2dd701f561a6@gmail.com>
     [not found] ` <882d05f1-a963-c03a-38ae-2dd701f561a6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-13 13:36   ` [PATCH 01/10] spi: fsl-espi: remove usage of pdata->initial_spmode Heiner Kallweit
     [not found] ` <46d0ab77-d645-1db3-cca4-99b1b04d599c@gmail.com>
     [not found]   ` <46d0ab77-d645-1db3-cca4-99b1b04d599c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-13 13:36     ` [PATCH 03/10] spi: fsl-espi: remove remaining usage of struct fsl_spi_platform_data Heiner Kallweit
     [not found]       ` <75bd88e0-e1bf-9729-6cd0-e88633d940e6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-14 10:35         ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).