mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russ Gorby <russ.gorby@intel.com>
To: Russ Gorby <russ.gorby@intel.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-kernel@vger.kernel.org
Cc: suhail.ahmed@intel.com
Subject: [PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup
Date: Mon,  7 Feb 2011 12:02:31 -0800	[thread overview]
Message-ID: <1297108952-27371-6-git-send-email-russ.gorby@intel.com> (raw)
In-Reply-To: <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>

The probe routine should call spi_setup() to configure
the SPI bus so it can properly communicate with the device.
E.g. the device operates in SPI mode 1.

Called spi_setup to configure SPI mode, max_speed_hz, and bpw

Signed-off-by: Russ Gorby <russ.gorby@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 766f0c3..59e9cb8 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -67,6 +67,7 @@
 #define IFX_SPI_MORE_MASK		0x10
 #define IFX_SPI_MORE_BIT		12	/* bit position in u16 */
 #define IFX_SPI_CTS_BIT			13	/* bit position in u16 */
+#define IFX_SPI_MODE			SPI_MODE_1
 #define IFX_SPI_TTY_ID			0
 #define IFX_SPI_TIMEOUT_SEC		2
 #define IFX_SPI_HEADER_0		(-1)
@@ -992,7 +993,15 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 	ifx_dev->modem = pl_data->modem_type;
 	ifx_dev->use_dma = pl_data->use_dma;
 	ifx_dev->max_hz = pl_data->max_hz;
+	/* initialize spi mode, etc */
 	spi->max_speed_hz = ifx_dev->max_hz;
+	spi->mode = IFX_SPI_MODE | (SPI_LOOP & spi->mode);
+	spi->bits_per_word = spi_bpw;
+	ret = spi_setup(spi);
+	if (ret) {
+		dev_err(&spi->dev, "SPI setup wasn't successful %d", ret);
+		return -ENODEV;
+	}
 
 	/* ensure SPI protocol flags are initialized to enable transfer */
 	ifx_dev->spi_more = 0;
-- 
1.7.3.4


  parent reply	other threads:[~2011-02-07 19:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
2011-02-07 20:02 ` [PATCH 0/6] IFX6X60 patchset : 02/07/2011 Russ Gorby
2011-02-07 20:02 ` [PATCH 1/6] serial: ifx6x60: fixed call to tty_port_init Russ Gorby
2011-02-07 20:02 ` [PATCH 2/6] serial: ifx6x60: dma_alloc_coherent must use parent dev Russ Gorby
2011-02-07 20:02 ` [PATCH 3/6] serial: ifx6x60: changed internal bpw from boolean to int Russ Gorby
2011-02-07 20:02 ` [PATCH 4/6] serial: ifx6x60: set SPI max_speed_hz based on platform type Russ Gorby
2011-02-07 20:02 ` Russ Gorby [this message]
2011-02-07 20:02 ` [PATCH 6/6] serial: ifx6x60: minor cleanup Russ Gorby

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=1297108952-27371-6-git-send-email-russ.gorby@intel.com \
    --to=russ.gorby@intel.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suhail.ahmed@intel.com \
    /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

all inboxes | Powered by JetHome®