Re: [PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-28 Thread Govindraj
On Thu, May 27, 2010 at 9:30 PM, Luke-Jr l...@dashjr.org wrote:
 On Wednesday 26 May 2010 05:48:58 pm Kevin Hilman wrote:
 FYI... this also works on OMAP2.

 I tested it on my n810 along with UART hwmod conversion and it works
 just fine there.

 Is it somehow different from the basic 8250 driver on OMAP2? I've been
 struggling to figure out why my N810's GPS isn't working when I change kernels
 (I've already made sure ttyS0 is the correct major/minor and adjusted the GPIO
 calls; gpiodriver is talking to the chip, but not getting anywhere).

You need to use ttyO0 [%s/ttyS*/ttyO*]

Since uart tty interface name as been modified with this driver.

+#define OMAP_SERIAL_NAME   ttyO

---
Regards,
Govindraj.R


 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-28 Thread Govindraj
On Mon, May 24, 2010 at 7:13 PM, Govindraj.R govindraj.r...@ti.com wrote:
 This patch adds driver support for OMAP3/4 high speed UART.

 The driver is made separate from 8250 driver as we cannot
 over load 8250 driver with omap platform specific configuration for
 features like DMA, it makes easier to implement features like DMA and
 hardware flow control and software flow control configuration with
 this driver as required for the omap-platform.This patch involves only
 the core driver and its dependent.

 Cc: Tony Lindgren t...@atomide.com
 Tested-by: Kevin Hilman khil...@deeprootsystems.com
 Signed-off-by: Govindraj.R govindraj.r...@ti.com
 ---
 Platform data support for this driver is currently
 present in Kevin's PM tree remotes/origin/pm-wip/uart branch
 This branch contains uart-hwmod platform conversion which
 utilizes the omap-hwmod framework. Tested using OMAP
 3430/3630/4430SDP boards.

  arch/arm/plat-omap/include/plat/omap-serial.h |  129 +++
  drivers/serial/Kconfig                        |   27 +
  drivers/serial/Makefile                       |    1 +
  drivers/serial/omap-serial.c                  | 1318 
 +
  include/linux/serial_core.h                   |    3 +
  5 files changed, 1478 insertions(+), 0 deletions(-)
  create mode 100644 arch/arm/plat-omap/include/plat/omap-serial.h
  create mode 100644 drivers/serial/omap-serial.c

Update:

Populating following changes for v3:
Will be posting in couple of days.

1.)  Replace platform_get_resource with platform_get_resource_byname
 Reference :
 http://marc.info/?l=linux-omapm=127479257522952w=2

2.)  Update kconfig to add OMAP2 support also
  [Thanks to Kevin for testing it on n810(omap2)]
  Reference :
 http://marc.info/?l=linux-serialm=127491414713957w=2

Please let me know if there are any further comments.
Thanks for the reviews and testing.

---
Regards,
Govindraj.R
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-28 Thread Luke-Jr
On Friday 28 May 2010 02:11:29 am you wrote:
 On Thu, May 27, 2010 at 9:30 PM, Luke-Jr l...@dashjr.org wrote:
  On Wednesday 26 May 2010 05:48:58 pm Kevin Hilman wrote:
  FYI... this also works on OMAP2.
 
  I tested it on my n810 along with UART hwmod conversion and it works
  just fine there.
 
  Is it somehow different from the basic 8250 driver on OMAP2? I've been
  struggling to figure out why my N810's GPS isn't working when I change
  kernels (I've already made sure ttyS0 is the correct major/minor and
  adjusted the GPIO calls; gpiodriver is talking to the chip, but not
  getting anywhere).
 
 You need to use ttyO0 [%s/ttyS*/ttyO*]
 
 Since uart tty interface name as been modified with this driver.
 
 +#define OMAP_SERIAL_NAME   ttyO

Beyond the fact that this is hard-coded into Nokia's blob and thus not 
something trivial to change, I meant it doesn't work with the 8250 driver. My 
question pertains to if this driver does anything different that would make it 
possibly work.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-27 Thread Luke-Jr
On Wednesday 26 May 2010 05:48:58 pm Kevin Hilman wrote:
 FYI... this also works on OMAP2.
 
 I tested it on my n810 along with UART hwmod conversion and it works
 just fine there.

Is it somehow different from the basic 8250 driver on OMAP2? I've been 
struggling to figure out why my N810's GPS isn't working when I change kernels 
(I've already made sure ttyS0 is the correct major/minor and adjusted the GPIO 
calls; gpiodriver is talking to the chip, but not getting anywhere).
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-26 Thread Kevin Hilman
Govindraj.R govindraj.r...@ti.com writes:

 This patch adds driver support for OMAP3/4 high speed UART.

 The driver is made separate from 8250 driver as we cannot
 over load 8250 driver with omap platform specific configuration for
 features like DMA, it makes easier to implement features like DMA and
 hardware flow control and software flow control configuration with
 this driver as required for the omap-platform.This patch involves only
 the core driver and its dependent.

 Cc: Tony Lindgren t...@atomide.com
 Tested-by: Kevin Hilman khil...@deeprootsystems.com
 Signed-off-by: Govindraj.R govindraj.r...@ti.com
 ---
 Platform data support for this driver is currently
 present in Kevin's PM tree remotes/origin/pm-wip/uart branch
 This branch contains uart-hwmod platform conversion which
 utilizes the omap-hwmod framework. Tested using OMAP
 3430/3630/4430SDP boards.

  arch/arm/plat-omap/include/plat/omap-serial.h |  129 +++
  drivers/serial/Kconfig|   27 +
  drivers/serial/Makefile   |1 +
  drivers/serial/omap-serial.c  | 1318 
 +
  include/linux/serial_core.h   |3 +
  5 files changed, 1478 insertions(+), 0 deletions(-)

[...]

 diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
 index f55c494..4346bfa 100644
 --- a/drivers/serial/Kconfig
 +++ b/drivers/serial/Kconfig
 @@ -1387,6 +1387,33 @@ config SERIAL_OF_PLATFORM
 Currently, only 8250 compatible ports are supported, but
 others can easily be added.

 +config SERIAL_OMAP
 + tristate OMAP serial port support
 + depends on ARCH_OMAP3 || ARCH_OMAP4

FYI... this also works on OMAP2.  

I tested it on my n810 along with UART hwmod conversion and it works
just fine there.

Kevin
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] serial: Add OMAP high-speed UART driver

2010-05-24 Thread Govindraj.R
This patch adds driver support for OMAP3/4 high speed UART.

The driver is made separate from 8250 driver as we cannot
over load 8250 driver with omap platform specific configuration for
features like DMA, it makes easier to implement features like DMA and
hardware flow control and software flow control configuration with
this driver as required for the omap-platform.This patch involves only
the core driver and its dependent.

Cc: Tony Lindgren t...@atomide.com
Tested-by: Kevin Hilman khil...@deeprootsystems.com
Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
Platform data support for this driver is currently
present in Kevin's PM tree remotes/origin/pm-wip/uart branch
This branch contains uart-hwmod platform conversion which
utilizes the omap-hwmod framework. Tested using OMAP
3430/3630/4430SDP boards.

 arch/arm/plat-omap/include/plat/omap-serial.h |  129 +++
 drivers/serial/Kconfig|   27 +
 drivers/serial/Makefile   |1 +
 drivers/serial/omap-serial.c  | 1318 +
 include/linux/serial_core.h   |3 +
 5 files changed, 1478 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/plat/omap-serial.h
 create mode 100644 drivers/serial/omap-serial.c

diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h
b/arch/arm/plat-omap/include/plat/omap-serial.h
new file mode 100644
index 000..0d6f076
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -0,0 +1,129 @@
+/*
+ * Driver for OMAP-UART controller.
+ * Based on drivers/serial/8250.c
+ *
+ * Copyright (C) 2010 Texas Instruments.
+ *
+ * Authors:
+ * Govindraj R govindraj.r...@ti.com
+ * Thara Gopinath  th...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __OMAP_SERIAL_H__
+#define __OMAP_SERIAL_H__
+
+#include linux/serial_core.h
+#include linux/platform_device.h
+
+#include plat/control.h
+#include plat/mux.h
+
+#define DRIVER_NAMEomap-hsuart
+
+/*
+ * Use tty device name as ttyO, [O - OMAP]
+ * in bootargs we specify as console=ttyO0 if uart1
+ * is used as console uart.
+ */
+#define OMAP_SERIAL_NAME   ttyO
+
+#define OMAP_MDR1_DISABLE  0x07
+#define OMAP_MDR1_MODE13X  0x03
+#define OMAP_MDR1_MODE16X  0x00
+#define OMAP_MODE13X_SPEED 230400
+
+/*
+ * LCR = 0XBF: Switch to Configuration Mode B.
+ * In configuration mode b allow access
+ * to EFR,DLL,DLH.
+ * Reference OMAP TRM Chapter 17
+ * Section: 1.4.3 Mode Selection
+ */
+#define OMAP_UART_LCR_CONF_MDB 0XBF
+
+/* WER = 0x7F
+ * Enable module level wakeup in WER reg
+ */
+#define OMAP_UART_WER_MOD_WKUP 0X7F
+
+/* Enable XON/XOFF flow control on output */
+#define OMAP_UART_SW_TX0x04
+
+/* Enable XON/XOFF flow control on input */
+#define OMAP_UART_SW_RX0x04
+
+#define OMAP_UART_SYSC_RESET   0X07
+#define OMAP_UART_TCR_TRIG 0X0F
+#define OMAP_UART_SW_CLR   0XF0
+#define OMAP_UART_FIFO_CLR 0X06
+
+#define OMAP_UART_DMA_CH_FREE  -1
+
+#define RX_TIMEOUT (3 * HZ)
+#define OMAP_MAX_HSUART_PORTS  4
+
+#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
+
+struct omap_uart_port_info {
+   booldma_enabled;/* To specify DMA Mode */
+   unsigned intuartclk;/* UART clock rate */
+   void __iomem*membase;   /* ioremap cookie or NULL */
+   resource_size_t mapbase;/* resource base */
+   unsigned long   irqflags;   /* request_irq flags */
+   upf_t   flags;  /* UPF_* flags */
+};
+
+struct uart_omap_dma {
+   u8  uart_dma_tx;
+   u8  uart_dma_rx;
+   int rx_dma_channel;
+   int tx_dma_channel;
+   dma_addr_t  rx_buf_dma_phys;
+   dma_addr_t  tx_buf_dma_phys;
+   unsigned intuart_base;
+   /*
+* Buffer for rx dma.It is not required for tx because the buffer
+* comes from port structure.
+*/
+   unsigned char   *rx_buf;
+   unsigned intprev_rx_dma_pos;
+   int tx_buf_size;
+   int tx_dma_used;
+   int rx_dma_used;
+   spinlock_t  tx_lock;
+   spinlock_t  rx_lock;
+   /* timer to poll activity on rx dma */
+   struct timer_list   rx_timer;
+   int rx_buf_size;
+   int rx_timeout;
+};
+
+struct uart_omap_port {
+   struct uart_portport;
+   struct uart_omap_dmauart_dma;
+   struct platform_device  *pdev;
+
+   unsigned char