Skip to contentSkip to conversation

This driver supports UART-DM HW on MSM platforms. It uses the on chip DMA to drive data transfers and has optional support for UART power management independent of Linux suspend/resume and wakeup from Rx.

PATCH In review Mayank Rana 3 participants 4 messages Dec 14, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 This driver supports UART-DM HW on MSM platforms. It uses the on chip DMA to drive data transfers and has optional support for UART power management independent of Linux suspend/resume and wakeup from Rx.

The driver was originally developed by Google. It is functionally equivalent to the version available at:
http://android.git.kernel.org/?p=kernel/experimental.git
the differences being:
1) Remove wakelocks and change unsupported DMA API.
2) Replace clock selection register codes by macros.
3) Fix checkpatch errors and add inline documentation.
4) Add runtime PM hooks for active power state transitions.

---
 drivers/serial/Kconfig                      |   12 +
 drivers/serial/Makefile                     |    1 +
 drivers/serial/msm_serial_hs.c              | 1680 +++++++++++++++++++++++++++
 drivers/serial/msm_serial_hs_hwreg.h        |  167 +++
 include/linux/platform_data/msm_serial_hs.h |   49 +
 5 files changed, 1909 insertions(+), 0 deletions(-)
 create mode 100644 drivers/serial/msm_serial_hs.c
 create mode 100644 drivers/serial/msm_serial_hs_hwreg.h
 create mode 100644 include/linux/platform_data/msm_serial_hs.h
drivers/serial/Kconfig +12 -0
index aff9dcd..0a935ee 100644
@@ -1381,6 +1381,18 @@ config SERIAL_MSM_CONSOLE
 	depends on SERIAL_MSM=y
 	select SERIAL_CORE_CONSOLE
 
+config SERIAL_MSM_HS
+	tristate "MSM UART High Speed: Serial Driver"
+	depends on ARM && ARCH_MSM
+	select SERIAL_CORE
+	help
+	  If you have a machine based on MSM family of SoCs, you
+	  can enable its onboard high speed serial port by enabling
+	  this option.
+
+	  Choose M here to compile it as a module. The module will be
+	  called msm_serial_hs.
+
 config SERIAL_NETX
 	tristate "NetX serial port support"
 	depends on ARM && ARCH_NETX
drivers/serial/Makefile +1 -0
index c570576..667de45 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o
 obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
 obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
 obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
+obj-$(CONFIG_SERIAL_MSM_HS) += msm_serial_hs.o
 obj-$(CONFIG_SERIAL_NETX) += netx-serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o
 obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o
drivers/serial/msm_serial_hs.c new file +1680 -0

1,680 lines not on this page · raw message

drivers/serial/msm_serial_hs_hwreg.h new file +167 -0

167 lines not on this page · raw message

include/linux/platform_data/msm_serial_hs.h new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.7.3.2
#1 lore raw

That's some subject: are you sure that should really be the subject?

Quoted 9 lines · Mayank Rana

The driver was originally developed by Google. It is functionally equivalent to the version available at:
http://android.git.kernel.org/?p=kernel/experimental.git
the differences being:
1) Remove wakelocks and change unsupported DMA API.
2) Replace clock selection register codes by macros.
3) Fix checkpatch errors and add inline documentation.
4) Add runtime PM hooks for active power state transitions.

Quoted 3 lines

<snip>

I don't see the previous review comments I made addressed here, what happened?

Specifically, you need to sort out the ownership of this file (who wrote the thing, why you are submitting something written by someone else without their approval, etc.) and the like.

drivers/serial/msm_serial_hs.c line 10

Quoted 13 lines
drivers/serial/msm_serial_hs.c new file +10 -0
@@ -0,0 +1,1680 @@
+/* drivers/serial/msm_serial_hs.c
+ *
+ * MSM 7k/8k High speed uart driver
+ *
+ * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008 Google Inc.
+ * Modified: Nick Pelly <[email protected]>
+ *
+ * All source code in this file is licensed under the following license
+ * except where indicated.

Is anything indicated? If not, drop it please.

drivers/serial/msm_serial_hs.c line 22

Quoted 12 lines
drivers/serial/msm_serial_hs.c new file +12 -0
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can find it at http://www.fsf.org

These last two paragraphs can be deleted, they are useless.

Quoted 36 lines
drivers/serial/msm_serial_hs.c new file +36 -0
+ */
+
+/*
+ * MSM 7k/8k High speed uart driver
+ *
+ * Has optional support for uart power management independent of linux
+ * suspend/resume:
+ *
+ * RX wakeup.
+ * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the
+ * UART RX pin). This should only be used if there is not a wakeup
+ * GPIO on the UART CTS, and the first RX byte is known (for example, with the
+ * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will
+ * always be lost. RTS will be asserted even while the UART is off in this mode
+ * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq.
+ */
+
+#include <linux/module.h>
+
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/clk.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/dma-mapping.h>
+#include <linux/dmapool.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>

drivers/serial/msm_serial_hs.c line 68

Quoted 10 lines
drivers/serial/msm_serial_hs.c new file +10 -0
+
+#include <linux/atomic.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+
+#include <mach/hardware.h>
+#include <mach/dma.h>
+#include <linux/platform_data/msm_serial_hs.h>
+
+#include "msm_serial_hs_hwreg.h"

Why do you need this .h file at all? Just roll it into this .c file please.

Quoted 11 lines
drivers/serial/msm_serial_hs.c new file +11 -0
+/**
+ * msm_hs_request_clock_off - request to (i.e. asynchronously) turn off uart
+ * clock once pending TX is flushed and Rx DMA command is terminated.
+ * @uport: uart_port structure for the device instance.
+ *
+ * This functions puts the device into a partially active low power mode. It
+ * waits to complete all pending tx transactions, flushes ongoing Rx DMA
+ * command and terminates UART side Rx transaction, puts UART HW in non DMA
+ * mode and then clocks off the device. A client calls this when no UART
+ * data is expected. msm_request_clock_on() must be called before any further
+ * UART can be sent or received.

drivers/serial/msm_serial_hs.c line 1149

Quoted 10 lines
drivers/serial/msm_serial_hs.c new file +10 -0
+ */
+void msm_hs_request_clock_off(struct uart_port *uport)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&uport->lock, flags);
+	msm_hs_request_clock_off_locked(uport);
+	spin_unlock_irqrestore(&uport->lock, flags);
+}
+EXPORT_SYMBOL(msm_hs_request_clock_off);

EXPORT_SYMBOL_GPL?

And why is this function exported at all anyway? Who is going to call it?

Same goes for the other exported function.

thanks,

greg k-h

#2 lore raw
Quoted 17 lines · Greg KH

That's some subject: are you sure that should really be the subject?

Quoted 9 lines · Mayank Rana

The driver was originally developed by Google. It is functionally equivalent to the version available at:
http://android.git.kernel.org/?p=kernel/experimental.git
the differences being:
1) Remove wakelocks and change unsupported DMA API.
2) Replace clock selection register codes by macros.
3) Fix checkpatch errors and add inline documentation.
4) Add runtime PM hooks for active power state transitions.

Quoted 3 lines
Quoted 8 lines

<snip>

I don't see the previous review comments I made addressed here, what happened?

Specifically, you need to sort out the ownership of this file (who wrote the thing, why you are submitting something written by someone else without their approval, etc.) and the like.

Glad someone is trying to get the patch upstream, but I think Mayank has taken it a step backwards from the version on Android open source.

Removing the wakelock's are fine since they are somewhat controversial, and not core to the driver.

But adding all the boilerplate comments on each function? They add no value.

As far as authorship, I took the original Qualcomm driver and re-wrote it. There is probably not a lot of code the same. The original driver was very useful for regression testing though.

Quoted 115 lines
Quoted 4 lines

drivers/serial/msm_serial_hs.c line 10

Quoted 10 lines
drivers/serial/msm_serial_hs.c new file +10 -0
@@ -0,0 +1,1680 @@
+/* drivers/serial/msm_serial_hs.c
+ *
+ * MSM 7k/8k High speed uart driver
+ *
+ * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2008 Google Inc.
+ * Modified: Nick Pelly <[email protected]>
+ *
+ * All source code in this file is licensed under the following license
+ * except where indicated.

Is anything indicated?  If not, drop it please.

drivers/serial/msm_serial_hs.c line 22

Quoted 12 lines
drivers/serial/msm_serial_hs.c new file +12 -0
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can find it at http://www.fsf.org

These last two paragraphs can be deleted, they are useless.

Quoted 36 lines
drivers/serial/msm_serial_hs.c new file +36 -0
+ */
+
+/*
+ * MSM 7k/8k High speed uart driver
+ *
+ * Has optional support for uart power management independent of linux
+ * suspend/resume:
+ *
+ * RX wakeup.
+ * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the
+ * UART RX pin). This should only be used if there is not a wakeup
+ * GPIO on the UART CTS, and the first RX byte is known (for example, with the
+ * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will
+ * always be lost. RTS will be asserted even while the UART is off in this mode
+ * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq.
+ */
+
+#include <linux/module.h>
+
+#include <linux/serial.h>
+#include <linux/serial_core.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/clk.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/dma-mapping.h>
+#include <linux/dmapool.h>
+#include <linux/wait.h>
+#include <linux/workqueue.h>

drivers/serial/msm_serial_hs.c line 68

Quoted 10 lines
drivers/serial/msm_serial_hs.c new file +10 -0
+
+#include <linux/atomic.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+
+#include <mach/hardware.h>
+#include <mach/dma.h>
+#include <linux/platform_data/msm_serial_hs.h>
+
+#include "msm_serial_hs_hwreg.h"

Why do you need this .h file at all?  Just roll it into this .c file please.

Quoted 11 lines
drivers/serial/msm_serial_hs.c new file +11 -0
+/**
+ * msm_hs_request_clock_off - request to (i.e. asynchronously) turn off uart
+ * clock once pending TX is flushed and Rx DMA command is terminated.
+ * @uport: uart_port structure for the device instance.
+ *
+ * This functions puts the device into a partially active low power mode. It
+ * waits to complete all pending tx transactions, flushes ongoing Rx DMA
+ * command and terminates UART side Rx transaction, puts UART HW in non DMA
+ * mode and then clocks off the device. A client calls this when no UART
+ * data is expected. msm_request_clock_on() must be called before any further
+ * UART can be sent or received.

drivers/serial/msm_serial_hs.c line 1149

Quoted 10 lines
drivers/serial/msm_serial_hs.c new file +10 -0
+ */
+void msm_hs_request_clock_off(struct uart_port *uport)
+{
+     unsigned long flags;
+
+     spin_lock_irqsave(&uport->lock, flags);
+     msm_hs_request_clock_off_locked(uport);
+     spin_unlock_irqrestore(&uport->lock, flags);
+}
+EXPORT_SYMBOL(msm_hs_request_clock_off);

EXPORT_SYMBOL_GPL?

And why is this function exported at all anyway?  Who is going to call it?

Same goes for the other exported function.

thanks,

greg k-h

#3 lore raw
Quoted 27 lines · Nick Pelly
Quoted 17 lines · Greg KH

That's some subject: are you sure that should really be the subject?

Quoted 9 lines · Mayank Rana

The driver was originally developed by Google. It is functionally equivalent to the version available at:
http://android.git.kernel.org/?p=kernel/experimental.git
the differences being:
1) Remove wakelocks and change unsupported DMA API.
2) Replace clock selection register codes by macros.
3) Fix checkpatch errors and add inline documentation.
4) Add runtime PM hooks for active power state transitions.

Quoted 3 lines
Quoted 8 lines

<snip>

I don't see the previous review comments I made addressed here, what happened?

Specifically, you need to sort out the ownership of this file (who wrote the thing, why you are submitting something written by someone else without their approval, etc.) and the like.

Quoted 5 lines

Glad someone is trying to get the patch upstream, but I think Mayank has taken it a step backwards from the version on Android open source.

Removing the wakelock's are fine since they are somewhat controversial, and not core to the driver.

Why are they removed? We now have the infrastructure in the kernel to keep them. I say put them back so you can use the same driver in the Android builds as well.

Quoted 1 line

But adding all the boilerplate comments on each function? They add no value.

For some functions, they can be helpful.

Quoted 3 lines

As far as authorship, I took the original Qualcomm driver and re-wrote it. There is probably not a lot of code the same. The original driver was very useful for regression testing though.

A pointer to the original driver, and the copyright notice from it, and authorship information is needed in this version of the driver then.

thanks,

greg k-h