All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Gamari <bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org
Cc: spi-devel-general-TtF/mJH4Jtrk1uMJSBkQmQ@public.gmane.org
Subject: [PATCH 1/2] mcspi: Add support for GPIO chip select lines
Date: Sun, 13 Feb 2011 17:10:33 -0500	[thread overview]
Message-ID: <1297635034-24504-1-git-send-email-bgamari.foss@gmail.com> (raw)
In-Reply-To: <c0ffcf4415b8edbf55d653a620b92fbbbcd8fed7>

Many applications require more chip select lines than the board or
processor allow. Introduce a mechanism to allow use of GPIO pins as chip
select lines with the McSPI controller.  To use this functionality, one
simply specifies the GPIO number in spi_board_info.controller_data.

Signed-off-by: Ben Gamari <bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/omap2_mcspi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 951a160..ca4a7dc 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -35,6 +35,7 @@
 #include <linux/slab.h>
 
 #include <linux/spi/spi.h>
+#include <linux/gpio.h>
 
 #include <plat/dma.h>
 #include <plat/clock.h>
@@ -235,11 +236,13 @@ static void omap2_mcspi_set_enable(const struct spi_device *spi, int enable)
 
 static void omap2_mcspi_force_cs(struct spi_device *spi, int cs_active)
 {
-	u32 l;
-
-	l = mcspi_cached_chconf0(spi);
-	MOD_REG_BIT(l, OMAP2_MCSPI_CHCONF_FORCE, cs_active);
-	mcspi_write_chconf0(spi, l);
+	if (spi->controller_data) {
+                gpio_set_value((unsigned) spi->controller_data, cs_active);
+	} else {
+		u32 l = mcspi_cached_chconf0(spi);
+		MOD_REG_BIT(l, OMAP2_MCSPI_CHCONF_FORCE, cs_active);
+		mcspi_write_chconf0(spi, l);
+	}
 }
 
 static void omap2_mcspi_set_master_mode(struct spi_master *master)
-- 
1.7.0.4


------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb

       reply	other threads:[~2011-02-13 22:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c0ffcf4415b8edbf55d653a620b92fbbbcd8fed7>
2011-02-13 22:10 ` Ben Gamari [this message]
     [not found]   ` <1297635034-24504-1-git-send-email-bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-02 21:50     ` [PATCH 1/2] mcspi: Add support for GPIO chip select lines Grant Likely
     [not found]       ` <20110302215026.GA22854-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-02 22:19         ` Ben Gamari
     [not found]           ` <87sjv517yd.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 21:42             ` Grant Likely
2011-03-13 19:04               ` GPIO chip select support in McSPI Ben Gamari
2011-03-13 19:05                 ` [PATCH] mcspi: Add support for GPIO chip select lines Ben Gamari
2011-03-14 19:27                   ` Grant Likely
2011-03-15  2:06                     ` Ben Gamari
2011-03-15  2:10                       ` Grant Likely
     [not found]                 ` <87ipvmx2ok.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-14 19:25                   ` GPIO chip select support in McSPI Grant Likely
2011-03-14 19:25                 ` Grant Likely
     [not found]                   ` <20110314192536.GF16096-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-15  2:22                     ` Ben Gamari
2011-03-15  2:22                   ` Ben Gamari
2011-03-15  3:29                     ` Grant Likely
     [not found]                     ` <877hc1t95k.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-15  3:29                       ` Grant Likely
     [not found]               ` <f7a269db-3bcf-4bac-8c38-b363e5c7bd0b-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2011-03-13 19:04                 ` Ben Gamari
2011-02-13 22:10 ` [PATCH 2/2] beagle-daq: Initial commit of board devices setup Ben Gamari

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=1297635034-24504-1-git-send-email-bgamari.foss@gmail.com \
    --to=bgamari.foss-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=spi-devel-general-TtF/mJH4Jtrk1uMJSBkQmQ@public.gmane.org \
    /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 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.