lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1294272313-15899-6-git-send-email-russ.gorby@intel.com>
Date:	Wed,  5 Jan 2011 16:05:11 -0800
From:	Russ Gorby <russ.gorby@...el.com>
To:	Greg@...r.kernel.org, Kroah-Hartman@...r.kernel.org,
	<gregkh@...e.de>, Vasiliy@...r.kernel.org, Kulikov@...r.kernel.org,
	<segoon@...nwall.com>, Alan@...r.kernel.org, Cox@...r.kernel.org,
	<alan@...ux.intel.com>, Russ@...r.kernel.org,
	Gorby@...r.kernel.org, <richardx.r.gorby@...el.com>,
	linux-kernel@...r.kernel.org
Cc:	suhail.ahmed@...el.com
Subject: [PATCH 5/7] serial: ifx6x60: probe routine needs to call spi_setup

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@...el.com>
---
 drivers/serial/ifx6x60.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/ifx6x60.c b/drivers/serial/ifx6x60.c
index b54a990..6dfb47a 100644
--- a/drivers/serial/ifx6x60.c
+++ b/drivers/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)
@@ -984,10 +985,18 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 	ifx_dev->spi_timer.function = ifx_spi_timeout;
 	ifx_dev->spi_timer.data = (unsigned long)ifx_dev;
 	ifx_dev->is_6160 = pl_data->is_6160;
+	/* initialize spi mode, etc */
 	if (ifx_dev->is_6160)
 		spi->max_speed_hz = 12500000;
 	else
 		spi->max_speed_hz = 25000000;
+	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.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ