* [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver
@ 2012-10-08 22:39 ` Stan Hu
0 siblings, 0 replies; 5+ messages in thread
From: Stan Hu @ 2012-10-08 22:39 UTC (permalink / raw)
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Grant Likely,
Tony Lindgren, Mark Brown, Jarkko Nikula, Greg Kroah-Hartman,
Nicolas Pitre, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Stan Hu
McSPI driver previously assumed that D0 was input (MISO) and D1 was output (MOSI).
This forces the hardware designer to wire all SPI peripherals in this way when
it should be a software configuration option.
Signed-off-by: Stan Hu <stanhu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/spi/spi-omap2-mcspi.c | 11 +++++++++--
include/linux/platform_data/spi-omap2-mcspi.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 3542fdc..d7c7e13 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -740,6 +740,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
struct spi_transfer *t)
{
struct omap2_mcspi_cs *cs = spi->controller_state;
+ struct omap2_mcspi_device_config *cd = spi->controller_data;
struct omap2_mcspi *mcspi;
struct spi_master *spi_cntrl;
u32 l = 0, div = 0;
@@ -765,8 +766,14 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode.
*/
- l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
- l |= OMAP2_MCSPI_CHCONF_DPE0;
+ l &= ~(OMAP2_MCSPI_CHCONF_IS|
+ OMAP2_MCSPI_CHCONF_DPE0|OMAP2_MCSPI_CHCONF_DPE1);
+
+ /* set input selection for D0 and D1 */
+ if (cd->d0_is_output)
+ l |= OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1;
+ else
+ l |= OMAP2_MCSPI_CHCONF_DPE0;
/* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a357eb2..419d08a 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -18,6 +18,8 @@ struct omap2_mcspi_dev_attr {
struct omap2_mcspi_device_config {
unsigned turbo_mode:1;
+ /* 0 -> [D0 = MISO, D1 = MOSI], 1 -> [D0 = MOSI, D1 = MISO] */
+ unsigned d0_is_output:1;
};
#endif
--
1.7.9.5
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver
@ 2012-10-08 22:39 ` Stan Hu
0 siblings, 0 replies; 5+ messages in thread
From: Stan Hu @ 2012-10-08 22:39 UTC (permalink / raw)
To: spi-devel-general, Grant Likely, Tony Lindgren, Mark Brown,
Jarkko Nikula, Greg Kroah-Hartman, Nicolas Pitre, linux-kernel
Cc: Stan Hu
McSPI driver previously assumed that D0 was input (MISO) and D1 was output (MOSI).
This forces the hardware designer to wire all SPI peripherals in this way when
it should be a software configuration option.
Signed-off-by: Stan Hu <stanhu@gmail.com>
---
drivers/spi/spi-omap2-mcspi.c | 11 +++++++++--
include/linux/platform_data/spi-omap2-mcspi.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 3542fdc..d7c7e13 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -740,6 +740,7 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
struct spi_transfer *t)
{
struct omap2_mcspi_cs *cs = spi->controller_state;
+ struct omap2_mcspi_device_config *cd = spi->controller_data;
struct omap2_mcspi *mcspi;
struct spi_master *spi_cntrl;
u32 l = 0, div = 0;
@@ -765,8 +766,14 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
/* standard 4-wire master mode: SCK, MOSI/out, MISO/in, nCS
* REVISIT: this controller could support SPI_3WIRE mode.
*/
- l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1);
- l |= OMAP2_MCSPI_CHCONF_DPE0;
+ l &= ~(OMAP2_MCSPI_CHCONF_IS|
+ OMAP2_MCSPI_CHCONF_DPE0|OMAP2_MCSPI_CHCONF_DPE1);
+
+ /* set input selection for D0 and D1 */
+ if (cd->d0_is_output)
+ l |= OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1;
+ else
+ l |= OMAP2_MCSPI_CHCONF_DPE0;
/* wordlength */
l &= ~OMAP2_MCSPI_CHCONF_WL_MASK;
diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h
index a357eb2..419d08a 100644
--- a/include/linux/platform_data/spi-omap2-mcspi.h
+++ b/include/linux/platform_data/spi-omap2-mcspi.h
@@ -18,6 +18,8 @@ struct omap2_mcspi_dev_attr {
struct omap2_mcspi_device_config {
unsigned turbo_mode:1;
+ /* 0 -> [D0 = MISO, D1 = MOSI], 1 -> [D0 = MOSI, D1 = MISO] */
+ unsigned d0_is_output:1;
};
#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver
[not found] ` <CAM=Q2csxH_Mjq1WGR+0xHg8jVVbgGUJ-qP_8UEQ84Ex48fvWwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-10-09 18:40 ` Stan Hu
0 siblings, 0 replies; 5+ messages in thread
From: Stan Hu @ 2012-10-09 18:40 UTC (permalink / raw)
To: Shubhrajyoti Datta; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
The other configuration is used in the case when you have SPI devices wired
opposite to the default case. This was the case for a custom board using
the McSPI driver.
I tested it by just passing in the parameter in the device config data when
registering the device under the spidev driver.
I noticed a similar patch was submitted recently:
http://sourceforge.net/mailarchive/forum.php?thread_name=1349626784-22035-1-git-send-email-zonque%40gmail.com&forum_name=spi-devel-general
The reason I put it in the device config because I reasoned you could in
theory configure MOSI and MISO differently for each SPI device on the bus.
This seems unlikely, though, but it is within the power of a hardware
designer to do that.
Feel free to use the other patch if it's more complete.
On Tue, Oct 9, 2012 at 11:28 AM, Shubhrajyoti Datta <
omaplinuxkernel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Tue, Oct 9, 2012 at 4:09 AM, Stan Hu <stanhu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > McSPI driver previously assumed that D0 was input (MISO) and D1 was
> output (MOSI).
> > This forces the hardware designer to wire all SPI peripherals in this
> way when
> > it should be a software configuration option.
>
> Your change looks good.
>
> What is the other configuration used for?
>
> Also are you using a dt patch to test it?
>
> >
> > Signed-off-by: Stan Hu <stanhu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > ---
>
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver
2012-10-08 22:39 ` Stan Hu
@ 2012-10-17 7:27 ` Mark Brown
-1 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-10-17 7:27 UTC (permalink / raw)
To: Stan Hu
Cc: Nicolas Pitre, Tony Lindgren, Greg Kroah-Hartman,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Jarkko Nikula
On Mon, Oct 08, 2012 at 04:39:40PM -0600, Stan Hu wrote:
> McSPI driver previously assumed that D0 was input (MISO) and D1 was output (MOSI).
> This forces the hardware designer to wire all SPI peripherals in this way when
> it should be a software configuration option.
I applied a similar patch from Daniel Mack just now; please check if
there's anything he's missing. His patch was sent earlier and also adds
DT bindings.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver
@ 2012-10-17 7:27 ` Mark Brown
0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2012-10-17 7:27 UTC (permalink / raw)
To: Stan Hu
Cc: spi-devel-general, Grant Likely, Tony Lindgren, Jarkko Nikula,
Greg Kroah-Hartman, Nicolas Pitre, linux-kernel
On Mon, Oct 08, 2012 at 04:39:40PM -0600, Stan Hu wrote:
> McSPI driver previously assumed that D0 was input (MISO) and D1 was output (MOSI).
> This forces the hardware designer to wire all SPI peripherals in this way when
> it should be a software configuration option.
I applied a similar patch from Daniel Mack just now; please check if
there's anything he's missing. His patch was sent earlier and also adds
DT bindings.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-17 7:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 22:39 [PATCH 1/1] spi: omap2-mcspi: add option to configure output line for McSPI driver Stan Hu
2012-10-08 22:39 ` Stan Hu
[not found] ` <CAM=Q2csxH_Mjq1WGR+0xHg8jVVbgGUJ-qP_8UEQ84Ex48fvWwQ@mail.gmail.com>
[not found] ` <CAM=Q2csxH_Mjq1WGR+0xHg8jVVbgGUJ-qP_8UEQ84Ex48fvWwQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-09 18:40 ` Stan Hu
[not found] ` <1349735980-17015-1-git-send-email-stanhu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-17 7:27 ` Mark Brown
2012-10-17 7:27 ` Mark Brown
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.