All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] IFX6X60 patchset : 02/07/2011
       [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
@ 2011-02-07 20:02 ` Russ Gorby
  2011-02-07 20:02 ` [PATCH 1/6] serial: ifx6x60: fixed call to tty_port_init Russ Gorby
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

Hello SPI/Serial Maintainers,

I am sending a patchset for the ifx6x60 driver to be considered for
inclusion in the Linux kernel.
Patches were made against the following GIT repo
http://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
pull date: ~2/4/2011
A breif description of the patches follows:

[PATCH 1/6] serial: ifx6x60: fixed call to tty_port_init
       - fixed order of setting port ops
[PATCH 2/6] serial: ifx6x60: dma_alloc_coherent must use parent dev
       - fixed device for which the allocation is made
[PATCH 3/6] serial: ifx6x60: changed internal bpw from boolean to int
[PATCH 4/6] serial: ifx6x60: set SPI max_speed_hz based on platform type
       - set max speed based on platform data
[PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup
       - configured spi for the h/w device
[PATCH 6/6] serial: ifx6x60: cleanup

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

* [PATCH 1/6] serial: ifx6x60: fixed call to tty_port_init
       [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 ` Russ Gorby
  2011-02-07 20:02 ` [PATCH 2/6] serial: ifx6x60: dma_alloc_coherent must use parent dev Russ Gorby
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

The port ops must be set AFTER calling port init as that function
zeroes the structure

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

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index c42de71..972c04d 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -798,8 +798,8 @@ static int ifx_spi_create_port(struct ifx_spi_device *ifx_dev)
 		goto error_ret;
 	}
 
-	pport->ops = &ifx_tty_port_ops;
 	tty_port_init(pport);
+	pport->ops = &ifx_tty_port_ops;
 	ifx_dev->minor = IFX_SPI_TTY_ID;
 	ifx_dev->tty_dev = tty_register_device(tty_drv, ifx_dev->minor,
 					       &ifx_dev->spi_dev->dev);
-- 
1.7.3.4


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

* [PATCH 2/6] serial: ifx6x60: dma_alloc_coherent must use parent dev
       [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 ` Russ Gorby
  2011-02-07 20:02 ` [PATCH 3/6] serial: ifx6x60: changed internal bpw from boolean to int Russ Gorby
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

This driver is a SPI protocol driver and has no DMA ops
associated with the device so the call will fail. Furthermore,
the DMA allocation made here will be used by the SPI
controller driver (parent dev) so it makes sense to
pass that device instead.

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

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 972c04d..bb2ff20 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -998,7 +998,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 	ifx_dev->spi_slave_cts = 0;
 
 	/*initialize transfer and dma buffers */
-	ifx_dev->tx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev,
+	ifx_dev->tx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent,
 				IFX_SPI_TRANSFER_SIZE,
 				&ifx_dev->tx_bus,
 				GFP_KERNEL);
@@ -1007,7 +1007,7 @@ static int ifx_spi_spi_probe(struct spi_device *spi)
 		ret = -ENOMEM;
 		goto error_ret;
 	}
-	ifx_dev->rx_buffer = dma_alloc_coherent(&ifx_dev->spi_dev->dev,
+	ifx_dev->rx_buffer = dma_alloc_coherent(ifx_dev->spi_dev->dev.parent,
 				IFX_SPI_TRANSFER_SIZE,
 				&ifx_dev->rx_bus,
 				GFP_KERNEL);
-- 
1.7.3.4


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

* [PATCH 3/6] serial: ifx6x60: changed internal bpw from boolean to int
       [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
                   ` (2 preceding siblings ...)
  2011-02-07 20:02 ` [PATCH 2/6] serial: ifx6x60: dma_alloc_coherent must use parent dev Russ Gorby
@ 2011-02-07 20:02 ` Russ Gorby
  2011-02-07 20:02 ` [PATCH 4/6] serial: ifx6x60: set SPI max_speed_hz based on platform type Russ Gorby
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

driver should support 32bit SPI transfers. The boolean variable
only allowed 8/16.

Changed to support 8/16/32 for future enabling
of 32 bpw.

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

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index bb2ff20..9161cab 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -76,7 +76,7 @@
 static void ifx_spi_handle_srdy(struct ifx_spi_device *ifx_dev);
 
 /* local variables */
-static int spi_b16 = 1;			/* 8 or 16 bit word length */
+static int spi_bpw = 16;		/* 8, 16 or 32 bit word length */
 static struct tty_driver *tty_drv;
 static struct ifx_spi_device *saved_ifx_dev;
 static struct lock_class_key ifx_spi_key;
@@ -724,7 +724,7 @@ static void ifx_spi_io(unsigned long data)
 		ifx_dev->spi_xfer.cs_change = 0;
 		ifx_dev->spi_xfer.speed_hz = 12500000;
 		/* ifx_dev->spi_xfer.speed_hz = 390625; */
-		ifx_dev->spi_xfer.bits_per_word = spi_b16 ? 16 : 8;
+		ifx_dev->spi_xfer.bits_per_word = spi_bpw;
 
 		ifx_dev->spi_xfer.tx_buf = ifx_dev->tx_buffer;
 		ifx_dev->spi_xfer.rx_buf = ifx_dev->rx_buffer;
-- 
1.7.3.4


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

* [PATCH 4/6] serial: ifx6x60: set SPI max_speed_hz based on platform type
       [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
                   ` (3 preceding siblings ...)
  2011-02-07 20:02 ` [PATCH 3/6] serial: ifx6x60: changed internal bpw from boolean to int Russ Gorby
@ 2011-02-07 20:02 ` Russ Gorby
  2011-02-07 20:02 ` [PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup Russ Gorby
  2011-02-07 20:02 ` [PATCH 6/6] serial: ifx6x60: minor cleanup Russ Gorby
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

Platforms containing the 6260 can run up to 25Mhz.

For these platforms set max_speed_hz to 25Mhz.

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

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 9161cab..766f0c3 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -722,7 +722,7 @@ static void ifx_spi_io(unsigned long data)
 		/* note len is BYTES, not transfers */
 		ifx_dev->spi_xfer.len = IFX_SPI_TRANSFER_SIZE;
 		ifx_dev->spi_xfer.cs_change = 0;
-		ifx_dev->spi_xfer.speed_hz = 12500000;
+		ifx_dev->spi_xfer.speed_hz = ifx_dev->spi_dev->max_speed_hz;
 		/* ifx_dev->spi_xfer.speed_hz = 390625; */
 		ifx_dev->spi_xfer.bits_per_word = spi_bpw;
 
@@ -992,6 +992,7 @@ 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;
+	spi->max_speed_hz = ifx_dev->max_hz;
 
 	/* ensure SPI protocol flags are initialized to enable transfer */
 	ifx_dev->spi_more = 0;
-- 
1.7.3.4


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

* [PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup
       [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
                   ` (4 preceding siblings ...)
  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
  2011-02-07 20:02 ` [PATCH 6/6] serial: ifx6x60: minor cleanup Russ Gorby
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

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


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

* [PATCH 6/6] serial: ifx6x60: minor cleanup
       [not found] <[PATCH 0/6] IFX6X60 patchset : 02/07/2011>
                   ` (5 preceding siblings ...)
  2011-02-07 20:02 ` [PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup Russ Gorby
@ 2011-02-07 20:02 ` Russ Gorby
  6 siblings, 0 replies; 7+ messages in thread
From: Russ Gorby @ 2011-02-07 20:02 UTC (permalink / raw)
  To: Russ Gorby, Greg Kroah-Hartman, linux-kernel; +Cc: suhail.ahmed

renamed spi_driver variable to not be h/w specific
set driver name to use DRVNAME define
removed commented-out define

Signed-off-by: Russ Gorby <russ.gorby@intel.com>
---
 drivers/tty/serial/ifx6x60.c |    8 ++++----
 drivers/tty/serial/ifx6x60.h |    2 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 59e9cb8..b68b96f 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1333,9 +1333,9 @@ static const struct spi_device_id ifx_id_table[] = {
 MODULE_DEVICE_TABLE(spi, ifx_id_table);
 
 /* spi operations */
-static const struct spi_driver ifx_spi_driver_6160 = {
+static const struct spi_driver ifx_spi_driver = {
 	.driver = {
-		.name = "ifx6160",
+		.name = DRVNAME,
 		.bus = &spi_bus_type,
 		.pm = &ifx_spi_pm,
 		.owner = THIS_MODULE},
@@ -1357,7 +1357,7 @@ static void __exit ifx_spi_exit(void)
 {
 	/* unregister */
 	tty_unregister_driver(tty_drv);
-	spi_unregister_driver((void *)&ifx_spi_driver_6160);
+	spi_unregister_driver((void *)&ifx_spi_driver);
 }
 
 /**
@@ -1399,7 +1399,7 @@ static int __init ifx_spi_init(void)
 		return result;
 	}
 
-	result = spi_register_driver((void *)&ifx_spi_driver_6160);
+	result = spi_register_driver((void *)&ifx_spi_driver);
 	if (result) {
 		pr_err("%s: spi_register_driver failed(%d)",
 			DRVNAME, result);
diff --git a/drivers/tty/serial/ifx6x60.h b/drivers/tty/serial/ifx6x60.h
index 0ec39b5..e8464ba 100644
--- a/drivers/tty/serial/ifx6x60.h
+++ b/drivers/tty/serial/ifx6x60.h
@@ -29,8 +29,6 @@
 #define DRVNAME				"ifx6x60"
 #define TTYNAME				"ttyIFX"
 
-/* #define IFX_THROTTLE_CODE */
-
 #define IFX_SPI_MAX_MINORS		1
 #define IFX_SPI_TRANSFER_SIZE		2048
 #define IFX_SPI_FIFO_SIZE		4096
-- 
1.7.3.4


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

end of thread, other threads:[~2011-02-07 19:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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 ` [PATCH 5/6] serial: ifx6x60: probe routine needs to call spi_setup Russ Gorby
2011-02-07 20:02 ` [PATCH 6/6] serial: ifx6x60: minor cleanup Russ Gorby

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.