linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/6] SPI omap2_mcspi.c: Use num chipselects from platform data
@ 2010-03-12 15:22 Scott Ellis
  2010-05-24 15:14 ` Scott Ellis
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Ellis @ 2010-03-12 15:22 UTC (permalink / raw)
  To: spi-devel-general
  Cc: David Brownell, Grant Likely, Tony Lindgren, Andrew Morton,
	Roman Tereshonkov, linux-omap, Aaro Koskinen, Kevin Hilman

The platform data already has the number of chip select lines 
for each McSPI module. No need to figure it out again in 
probe().

Signed-off-by: Scott Ellis <scott@jumpnowtek.com>

 drivers/spi/omap2_mcspi.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index cce23c5..cd9fdc2 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1058,33 +1058,28 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	struct resource		*r;
 	int			status = 0, i;
 	const u8		*rxdma_id, *txdma_id;
-	unsigned		num_chipselect;
 	struct omap2_mcspi_platform_config *pdata;
 
 	switch (pdev->id) {
 	case 1:
 		rxdma_id = spi1_rxdma_id;
 		txdma_id = spi1_txdma_id;
-		num_chipselect = 4;
 		break;
 	case 2:
 		rxdma_id = spi2_rxdma_id;
 		txdma_id = spi2_txdma_id;
-		num_chipselect = 2;
 		break;
 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) \
 	|| defined(CONFIG_ARCH_OMAP4)
 	case 3:
 		rxdma_id = spi3_rxdma_id;
 		txdma_id = spi3_txdma_id;
-		num_chipselect = 2;
 		break;
 #endif
 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
 	case 4:
 		rxdma_id = spi4_rxdma_id;
 		txdma_id = spi4_txdma_id;
-		num_chipselect = 1;
 		break;
 #endif
 	default:
@@ -1106,7 +1101,6 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	master->setup = omap2_mcspi_setup;
 	master->transfer = omap2_mcspi_transfer;
 	master->cleanup = omap2_mcspi_cleanup;
-	master->num_chipselect = num_chipselect;
 
 	dev_set_drvdata(&pdev->dev, master);
 
@@ -1114,6 +1108,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	mcspi->master = master;
 	pdata = (struct omap2_mcspi_platform_config *)pdev->dev.platform_data;
 	mcspi->max_clk_div = pdata->max_clk_div;
+	master->num_chipselect = pdata->num_cs;
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (r == NULL) {
@@ -1160,7 +1155,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)
 	if (mcspi->dma_channels == NULL)
 		goto err3;
 
-	for (i = 0; i < num_chipselect; i++) {
+	for (i = 0; i < master->num_chipselect; i++) {
 		mcspi->dma_channels[i].dma_rx_channel = -1;
 		mcspi->dma_channels[i].dma_rx_sync_dev = rxdma_id[i];
 		mcspi->dma_channels[i].dma_tx_channel = -1;






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

end of thread, other threads:[~2010-05-24 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 15:22 [PATCH 5/6] SPI omap2_mcspi.c: Use num chipselects from platform data Scott Ellis
2010-05-24 15:14 ` Scott Ellis

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).