serial: ifx6x60: dma_alloc_coherent must use parent dev
A message that is not in the archive (sent off-list or not yet received): [PATCH 0/6] IFX6X60 patchset : 02/07/2011
PATCH 1/6 serial: ifx6x60: fixed call to tty_port_init
The port ops must be set AFTER calling port init as that function zeroes the structure
--- drivers/tty/serial/ifx6x60.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/ifx6x60.c +1 -1
@@ -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);
Signature · 1 line
1.7.3.4
PATCH 2/6 serial: ifx6x60: dma_alloc_coherent must use parent dev
In reply to a message not in the archiveThis 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.
--- drivers/tty/serial/ifx6x60.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/ifx6x60.c +2 -2
@@ -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 );
Signature · 1 line
1.7.3.4
PATCH 3/6 serial: ifx6x60: changed internal bpw from boolean to int
In reply to a message not in the archivedriver should support 32bit SPI transfers. The boolean variable only allowed 8/16.
Changed to support 8/16/32 for future enabling
of 32 bpw.
--- drivers/tty/serial/ifx6x60.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/ifx6x60.c +2 -2
@@ -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;
Signature · 1 line
1.7.3.4
PATCH 4/6 serial: ifx6x60: set SPI max_speed_hz based on platform type
In reply to a message not in the archivePlatforms containing the 6260 can run up to 25Mhz.
For these platforms set max_speed_hz to 25Mhz.
--- drivers/tty/serial/ifx6x60.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/tty/serial/ifx6x60.c +2 -1
@@ -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 ;
Signature · 1 line
1.7.3.4
cover IFX6X60 patchset : 02/07/2011
In reply to a message not in the archiveHello 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
PATCH 5/6 serial: ifx6x60: probe routine needs to call spi_setup
In reply to a message not in the archiveThe 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
--- drivers/tty/serial/ifx6x60.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/tty/serial/ifx6x60.c +9 -0
@@ -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 ;
Signature · 1 line
1.7.3.4
PATCH 6/6 serial: ifx6x60: minor cleanup
In reply to a message not in the archiverenamed spi_driver variable to not be h/w specific set driver name to use DRVNAME define removed commented-out define
--- drivers/tty/serial/ifx6x60.c | 8 ++++---- drivers/tty/serial/ifx6x60.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/tty/serial/ifx6x60.c +4 -4
@@ -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);
drivers/tty/serial/ifx6x60.h +0 -2
@@ -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
Signature · 1 line
1.7.3.4