Skip to contentSkip to conversation

ifx6x60: SPI protocol driver for Infineon 6x60 modem

PATCH In review Alan Cox 3 participants 3 messages Oct 26, 2010 – Nov 11, 2010

Subsystems (2)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 ifx6x60: SPI protocol driver for Infineon 6x60 modem

From: Russ Gorby <[email protected]>

Prototype driver for the IFX6x60 series of SPI attached modems by Jim Stanley and Russ Gorby

[Some reworking and a major cleanup]

---

 drivers/serial/Kconfig        |    6 
 drivers/serial/Makefile       |    1 
 drivers/serial/ifx6x60.c      | 1402 +++++++++++++++++++++++++++++++++++++++++
 drivers/serial/ifx6x60.h      |  129 ++++
 include/linux/spi/ifx_modem.h |   14 
 5 files changed, 1552 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/ifx6x60.c
 create mode 100644 drivers/serial/ifx6x60.h
 create mode 100644 include/linux/spi/ifx_modem.h
drivers/serial/Kconfig +6 -0
index aff9dcd..0b9cc17 100644
@@ -1632,4 +1632,10 @@ config SERIAL_ALTERA_UART_CONSOLE
 	help
 	  Enable a Altera UART port to be the system console.
 
+config SERIAL_IFX6X60
+        tristate "SPI protocol driver for Infineon 6x60 modem (EXPERIMENTAL)"
+	depends on GPIOLIB && EXPERIMENTAL
+	help
+	  Support for the IFX6x60 modem devices on Intel MID platforms.
+
 endmenu
drivers/serial/Makefile +1 -0
index c570576..783638b 100644
@@ -89,3 +89,4 @@ obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_SERIAL_MRST_MAX3110)	+= mrst_max3110.o
 obj-$(CONFIG_SERIAL_MFD_HSU)	+= mfd.o
 obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
+obj-$(CONFIG_SERIAL_IFX6X60)  	+= ifx6x60.o
drivers/serial/ifx6x60.c new file +1402 -0

1,402 lines not on this page · raw message

drivers/serial/ifx6x60.h new file +129 -0

129 lines not on this page · raw message

include/linux/spi/ifx_modem.h new file +14 -0
new file mode 100644
index 0000000..a68f3b1
@@ -0,0 +1,14 @@
+#ifndef LINUX_IFX_MODEM_H
+#define LINUX_IFX_MODEM_H
+
+struct ifx_modem_platform_data {
+	unsigned short rst_out; /* modem reset out */
+	unsigned short pwr_on;  /* power on */
+	unsigned short rst_pmu; /* reset modem */
+	unsigned short tx_pwr;  /* modem power threshold */
+	unsigned short srdy;    /* SRDY */
+	unsigned short mrdy;    /* MRDY */
+	unsigned short is_6160;	/* Modem type */
+};
+
+#endif

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev

#1 lore raw

2010/10/26 Alan Cox <[email protected]>:

Sorry for just reviewing the structs at this point but I hope it helps out...

Quoted 17 lines
drivers/serial/ifx6x60.h new file +11 -0
new file mode 100644
index 0000000..deb7b8d
(...)
+struct ifx_spi_device {
+       /* Our SPI device */
+       struct spi_device *spi_dev;
+
+       /* Port specific data */
+       struct kfifo tx_fifo;
+       spinlock_t fifo_lock;
+       unsigned long signal_state;
+
+       /* TTY Layer logic */
+       struct tty_port tty_port;

drivers/serial/ifx6x60.h line 91

Quoted 10 lines
drivers/serial/ifx6x60.h new file +10 -0
+       struct device *tty_dev;
+       int minor;
+
+       /* Low level I/O work */
+       struct tasklet_struct io_work_tasklet;
+       unsigned long flags;
+       dma_addr_t rx_dma;
+       dma_addr_t tx_dma;
+
+       int is_6160;                            /* Modem type */

Should this be a bool? It is suspiciously named much like something boolean.

Quoted 3 lines

+
+       spinlock_t write_lock;
+       int write_pending;

This should be a bool.

Quoted 2 lines

+       spinlock_t power_lock;
+       unsigned char power_status;

This piece of comments from the ifx_spi_power_state_clear kerneldoc:
"+ * ifx_spi_power_state_clear - clear power bit"
Actually indicates that this is also a bool, albeit using some opaque "val" to set/clear it. The code handling this flag really needs an overhaul or I'm not reading it right.

Quoted 9 lines

+       unsigned char *rx_buffer;
+       unsigned char *tx_buffer;
+       dma_addr_t rx_bus;
+       dma_addr_t tx_bus;
+       unsigned char spi_more;
+       unsigned char spi_slave_cts;

drivers/serial/ifx6x60.h new file +3 -0
+
+       struct timer_list spi_timer;
+

drivers/serial/ifx6x60.h line 116

Quoted 10 lines
drivers/serial/ifx6x60.h new file +10 -0
+       struct spi_message spi_msg;
+       struct spi_transfer spi_xfer;
+
+       struct {
+               /* gpio lines */
+               unsigned short srdy;            /* slave-ready gpio */
+               unsigned short mrdy;            /* master-ready gpio */
+               unsigned short reset;           /* modem-reset gpio */
+               unsigned short po;              /* modem-on gpio */
+               unsigned short reset_out;       /* modem-in-reset gpio */

Is there something wrong about using u16 for these? If it's to fit the gpio function it ought to be unsigned int I believe.

Quoted 2 lines

+               /* state/stats */
+               int unack_srdy_int_nb;

I don't get that comment above. This seems to be some interrupt counter, this whole struct may need some kerneldoc.

Quoted 17 lines

+       } gpio;

drivers/serial/ifx6x60.h new file +10 -0
+
+       /* modem reset */
+       unsigned long mdm_reset_state;
+#define MR_START       0
+#define MR_INPROGRESS  1
+#define MR_COMPLETE    2
+       wait_queue_head_t mdm_reset_wait;
+};
+
+#endif /* _IFX6X60_H */
include/linux/spi/ifx_modem.h new file +0 -0
new file mode 100644
index 0000000..a68f3b1

include/linux/spi/ifx_modem.h line 3

Quoted 3 lines
include/linux/spi/ifx_modem.h new file +3 -0
@@ -0,0 +1,14 @@
+#ifndef LINUX_IFX_MODEM_H
+#define LINUX_IFX_MODEM_H
+

/**
* Insert some kerneldoc of struct fields here, I think
* it'd be nice.
*/

include/linux/spi/ifx_modem.h line 10

Quoted 7 lines
include/linux/spi/ifx_modem.h new file +7 -0
+struct ifx_modem_platform_data {
+       unsigned short rst_out; /* modem reset out */
+       unsigned short pwr_on;  /* power on */
+       unsigned short rst_pmu; /* reset modem */
+       unsigned short tx_pwr;  /* modem power threshold */
+       unsigned short srdy;    /* SRDY */
+       unsigned short mrdy;    /* MRDY */

If these are GPIO pins they should be unsigned int I believe.

include/linux/spi/ifx_modem.h line 11

Quoted 1 line
include/linux/spi/ifx_modem.h new file +1 -0
+       unsigned short is_6160; /* Modem type */

.. is this bool?

include/linux/spi/ifx_modem.h line 14

Quoted 3 lines
include/linux/spi/ifx_modem.h new file +3 -0
+};
+
+#endif

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Alan Cox
Quoted 28 lines · Alan Cox

From: Russ Gorby <[email protected]>

Prototype driver for the IFX6x60 series of SPI attached modems by Jim Stanley and Russ Gorby

[Some reworking and a major cleanup]

---

 drivers/serial/Kconfig        |    6 
 drivers/serial/Makefile       |    1 
 drivers/serial/ifx6x60.c      | 1402 +++++++++++++++++++++++++++++++++++++++++
 drivers/serial/ifx6x60.h      |  129 ++++
 include/linux/spi/ifx_modem.h |   14 
 5 files changed, 1552 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/ifx6x60.c
 create mode 100644 drivers/serial/ifx6x60.h
 create mode 100644 include/linux/spi/ifx_modem.h
drivers/serial/Kconfig +0 -0
index aff9dcd..0b9cc17 100644

drivers/serial/Kconfig config SERIAL_ALTERA_UART_CONSOLE · line 1637

Quoted 6 lines
drivers/serial/Kconfig +3 -0
@@ -1632,4 +1632,10 @@ config SERIAL_ALTERA_UART_CONSOLE
 	help
 	  Enable a Altera UART port to be the system console.
 
+config SERIAL_IFX6X60
+        tristate "SPI protocol driver for Infineon 6x60 modem (EXPERIMENTAL)"
+	depends on GPIOLIB && EXPERIMENTAL

You also need to depend on SPI here as well, otherwise the build will break.

Care to send a follow-up patch that does this?

thanks,

greg k-h