linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14
@ 2013-12-24 14:14 Simon Horman
  2013-12-24 14:14 ` [PATCH 01/11] serial: sh-sci: Sort headers alphabetically Simon Horman
                   ` (12 more replies)
  0 siblings, 13 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Kevin, Hi Olof, Hi Arnd,

please consider this second round of Renesas SH SCI updates for v3.14.

They have been acked by Greg Kroah-Hartman to be taken
through my tree. The reason for this is that they are dependencies
for subsequent changes to use the common clock framework.

This pull-request is based on the first round of such changes,
tagged as renesas-sh-sci-for-v3.14, which I have previously sent
a pull-request for.


The following changes since commit b016b646e8676858f39ea9be760494b04b9ee0af:

  serial: sh-sci: Convert to clk_prepare/unprepare (2013-12-14 09:59:31 +0900)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-sh-sci2-for-v3.14

for you to fetch changes up to ec09c5eb491834d4011c72538e58d8b7096076bd:

  serial: sh-sci: Rework baud rate calculation (2013-12-24 11:17:53 +0900)

----------------------------------------------------------------
Second Round of Renesas SH SCI updates for v3.14

* Rework baud rate calculation
* Compute overrun_bit without using baud rate algo
* Remove unused GPIO request code
* Move overrun_bit and error_mask fields out of pdata
* Support resources passed through platform resources
* Don't check IRQ in verify port operation
* Set the UPF_FIXED_PORT flag
* Remove duplicate interrupt check in verify port op
* Simplify baud rate calculation algorithms
* Remove baud rate calculation algorithm 5
* Sort headers alphabetically

----------------------------------------------------------------
Laurent Pinchart (11):
      serial: sh-sci: Sort headers alphabetically
      serial: sh-sci: Remove baud rate calculation algorithm 5
      serial: sh-sci: Simplify baud rate calculation algorithms
      serial: sh-sci: Remove duplicate interrupt check in verify port op
      serial: sh-sci: Set the UPF_FIXED_PORT flag
      serial: sh-sci: Don't check IRQ in verify port operation
      serial: sh-sci: Support resources passed through platform resources
      serial: sh-sci: Move overrun_bit and error_mask fields out of pdata
      serial: sh-sci: Remove unused GPIO request code
      serial: sh-sci: Compute overrun_bit without using baud rate algo
      serial: sh-sci: Rework baud rate calculation

 drivers/tty/serial/sh-sci.c | 281 +++++++++++++++++++++-----------------------
 drivers/tty/serial/sh-sci.h |   2 +-
 include/linux/serial_sci.h  |  34 ++----
 3 files changed, 142 insertions(+), 175 deletions(-)

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

* [PATCH 01/11] serial: sh-sci: Sort headers alphabetically
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 02/11] serial: sh-sci: Remove baud rate calculation algorithm 5 Simon Horman
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

This helps locating duplicates.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 1a3fc7a..e98a217 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -23,35 +23,35 @@
 
 #undef DEBUG
 
-#include <linux/module.h>
+#include <linux/clk.h>
+#include <linux/console.h>
+#include <linux/ctype.h>
+#include <linux/cpufreq.h>
+#include <linux/delay.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/err.h>
 #include <linux/errno.h>
-#include <linux/sh_dma.h>
-#include <linux/timer.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial.h>
-#include <linux/major.h>
-#include <linux/string.h>
-#include <linux/sysrq.h>
 #include <linux/ioport.h>
+#include <linux/major.h>
+#include <linux/module.h>
 #include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/console.h>
-#include <linux/platform_device.h>
-#include <linux/serial_sci.h>
 #include <linux/notifier.h>
+#include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-#include <linux/cpufreq.h>
-#include <linux/clk.h>
-#include <linux/ctype.h>
-#include <linux/err.h>
-#include <linux/dmaengine.h>
-#include <linux/dma-mapping.h>
 #include <linux/scatterlist.h>
+#include <linux/serial.h>
+#include <linux/serial_sci.h>
+#include <linux/sh_dma.h>
 #include <linux/slab.h>
-#include <linux/gpio.h>
+#include <linux/string.h>
+#include <linux/sysrq.h>
+#include <linux/timer.h>
+#include <linux/tty.h>
+#include <linux/tty_flip.h>
 
 #ifdef CONFIG_SUPERH
 #include <asm/sh_bios.h>
-- 
1.8.4


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

* [PATCH 02/11] serial: sh-sci: Remove baud rate calculation algorithm 5
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
  2013-12-24 14:14 ` [PATCH 01/11] serial: sh-sci: Sort headers alphabetically Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 03/11] serial: sh-sci: Simplify baud rate calculation algorithms Simon Horman
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The algorithm isn't used, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 2 --
 include/linux/serial_sci.h  | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index e98a217..eb59bb2 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1825,8 +1825,6 @@ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
 		return (((freq * 2) + 16 * bps) / (16 * bps) - 1);
 	case SCBRR_ALGO_4:
 		return (((freq * 2) + 16 * bps) / (32 * bps) - 1);
-	case SCBRR_ALGO_5:
-		return (((freq * 1000 / 32) / bps) - 1);
 	}
 
 	/* Warn, but use a safe default */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 50fe651..babc5fe 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -15,7 +15,6 @@ enum {
 	SCBRR_ALGO_2,		/* ((clk + 16 * bps) / (32 * bps) - 1) */
 	SCBRR_ALGO_3,		/* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
 	SCBRR_ALGO_4,		/* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
-	SCBRR_ALGO_5,		/* (((clk * 1000 / 32) / bps) - 1) */
 	SCBRR_ALGO_6,		/* HSCIF variable sample rate algorithm */
 };
 
-- 
1.8.4


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

* [PATCH 03/11] serial: sh-sci: Simplify baud rate calculation algorithms
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
  2013-12-24 14:14 ` [PATCH 01/11] serial: sh-sci: Sort headers alphabetically Simon Horman
  2013-12-24 14:14 ` [PATCH 02/11] serial: sh-sci: Remove baud rate calculation algorithm 5 Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 04/11] serial: sh-sci: Remove duplicate interrupt check in verify port op Simon Horman
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Rewrite the baud rate register value calculations in easier to read
forms. The computed value isn't modified.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 8 ++++----
 include/linux/serial_sci.h  | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index eb59bb2..f2fad4d 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1818,13 +1818,13 @@ static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
 {
 	switch (algo_id) {
 	case SCBRR_ALGO_1:
-		return ((freq + 16 * bps) / (16 * bps) - 1);
+		return freq / (16 * bps);
 	case SCBRR_ALGO_2:
-		return ((freq + 16 * bps) / (32 * bps) - 1);
+		return DIV_ROUND_CLOSEST(freq, 32 * bps) - 1;
 	case SCBRR_ALGO_3:
-		return (((freq * 2) + 16 * bps) / (16 * bps) - 1);
+		return freq / (8 * bps);
 	case SCBRR_ALGO_4:
-		return (((freq * 2) + 16 * bps) / (32 * bps) - 1);
+		return DIV_ROUND_CLOSEST(freq, 16 * bps) - 1;
 	}
 
 	/* Warn, but use a safe default */
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index babc5fe..12cf50c 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -11,10 +11,10 @@
 #define SCIx_NOT_SUPPORTED	(-1)
 
 enum {
-	SCBRR_ALGO_1,		/* ((clk + 16 * bps) / (16 * bps) - 1) */
-	SCBRR_ALGO_2,		/* ((clk + 16 * bps) / (32 * bps) - 1) */
-	SCBRR_ALGO_3,		/* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
-	SCBRR_ALGO_4,		/* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
+	SCBRR_ALGO_1,		/* clk / (16 * bps) */
+	SCBRR_ALGO_2,		/* DIV_ROUND_CLOSEST(clk, 32 * bps) - 1 */
+	SCBRR_ALGO_3,		/* clk / (8 * bps) */
+	SCBRR_ALGO_4,		/* DIV_ROUND_CLOSEST(clk, 16 * bps) - 1 */
 	SCBRR_ALGO_6,		/* HSCIF variable sample rate algorithm */
 };
 
-- 
1.8.4


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

* [PATCH 04/11] serial: sh-sci: Remove duplicate interrupt check in verify port op
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (2 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 03/11] serial: sh-sci: Simplify baud rate calculation algorithms Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 05/11] serial: sh-sci: Set the UPF_FIXED_PORT flag Simon Horman
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The driver checks if the interrupt number is greater than nr_irqs and
returns an error in that case. The same check is already performed by
the caller, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index f2fad4d..8c17d55 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2120,7 +2120,7 @@ static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
 	struct sci_port *s = to_sci_port(port);
 
-	if (ser->irq != s->cfg->irqs[SCIx_TXI_IRQ] || ser->irq > nr_irqs)
+	if (ser->irq != s->cfg->irqs[SCIx_TXI_IRQ])
 		return -EINVAL;
 	if (ser->baud_base < 2400)
 		/* No paper tape reader for Mitch.. */
-- 
1.8.4


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

* [PATCH 05/11] serial: sh-sci: Set the UPF_FIXED_PORT flag
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (3 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 04/11] serial: sh-sci: Remove duplicate interrupt check in verify port op Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 06/11] serial: sh-sci: Don't check IRQ in verify port operation Simon Horman
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The base address, IRQ and baud rate generator parent clock rate can't be
changed by userspace. Mark the port as fixed.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 8c17d55..67dadbd 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2248,7 +2248,7 @@ static int sci_init_single(struct platform_device *dev,
 
 	port->mapbase		= p->mapbase;
 	port->type		= p->type;
-	port->flags		= p->flags;
+	port->flags		= UPF_FIXED_PORT | p->flags;
 	port->regshift		= p->regshift;
 
 	/*
-- 
1.8.4


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

* [PATCH 06/11] serial: sh-sci: Don't check IRQ in verify port operation
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (4 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 05/11] serial: sh-sci: Set the UPF_FIXED_PORT flag Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 07/11] serial: sh-sci: Support resources passed through platform resources Simon Horman
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The IRQ number can't be modified by the user as the port is fixed.
There's no need to check the new IRQ number as it will be ignored by the
core.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 67dadbd..b3d0e00 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2118,10 +2118,6 @@ static void sci_config_port(struct uart_port *port, int flags)
 
 static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
-	struct sci_port *s = to_sci_port(port);
-
-	if (ser->irq != s->cfg->irqs[SCIx_TXI_IRQ])
-		return -EINVAL;
 	if (ser->baud_base < 2400)
 		/* No paper tape reader for Mitch.. */
 		return -EINVAL;
-- 
1.8.4


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

* [PATCH 07/11] serial: sh-sci: Support resources passed through platform resources
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (5 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 06/11] serial: sh-sci: Don't check IRQ in verify port operation Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 08/11] serial: sh-sci: Move overrun_bit and error_mask fields out of pdata Simon Horman
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Memory and IRQ resources are currently passed to the driver through
platform data. Support passing them through the standard platform
resources mechanism instead. This deprecates platform data resources.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 65 ++++++++++++++++++++++++++++++++++-----------
 include/linux/serial_sci.h  |  8 +++---
 2 files changed, 53 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index b3d0e00..e9c6e23 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -74,6 +74,7 @@ struct sci_port {
 	/* Function clock */
 	struct clk		*fclk;
 
+	int			irqs[SCIx_NR_IRQS];
 	char			*irqstr[SCIx_NR_IRQS];
 	char			*gpiostr[SCIx_NR_FNS];
 
@@ -1079,19 +1080,19 @@ static int sci_request_irq(struct sci_port *port)
 
 	for (i = j = 0; i < SCIx_NR_IRQS; i++, j++) {
 		struct sci_irq_desc *desc;
-		unsigned int irq;
+		int irq;
 
 		if (SCIx_IRQ_IS_MUXED(port)) {
 			i = SCIx_MUX_IRQ;
 			irq = up->irq;
 		} else {
-			irq = port->cfg->irqs[i];
+			irq = port->irqs[i];
 
 			/*
 			 * Certain port types won't support all of the
 			 * available interrupt sources.
 			 */
-			if (unlikely(!irq))
+			if (unlikely(irq < 0))
 				continue;
 		}
 
@@ -1116,7 +1117,7 @@ static int sci_request_irq(struct sci_port *port)
 
 out_noirq:
 	while (--i >= 0)
-		free_irq(port->cfg->irqs[i], port);
+		free_irq(port->irqs[i], port);
 
 out_nomem:
 	while (--j >= 0)
@@ -1134,16 +1135,16 @@ static void sci_free_irq(struct sci_port *port)
 	 * IRQ first.
 	 */
 	for (i = 0; i < SCIx_NR_IRQS; i++) {
-		unsigned int irq = port->cfg->irqs[i];
+		int irq = port->irqs[i];
 
 		/*
 		 * Certain port types won't support all of the available
 		 * interrupt sources.
 		 */
-		if (unlikely(!irq))
+		if (unlikely(irq < 0))
 			continue;
 
-		free_irq(port->cfg->irqs[i], port);
+		free_irq(port->irqs[i], port);
 		kfree(port->irqstr[i]);
 
 		if (SCIx_IRQ_IS_MUXED(port)) {
@@ -1659,7 +1660,7 @@ static void rx_timer_fn(unsigned long arg)
 
 	if (port->type = PORT_SCIFA || port->type = PORT_SCIFB) {
 		scr &= ~0x4000;
-		enable_irq(s->cfg->irqs[1]);
+		enable_irq(s->irqs[SCIx_RXI_IRQ]);
 	}
 	serial_port_out(port, SCSCR, scr | SCSCR_RIE);
 	dev_dbg(port->dev, "DMA Rx timed out\n");
@@ -2150,11 +2151,12 @@ static struct uart_ops sci_uart_ops = {
 };
 
 static int sci_init_single(struct platform_device *dev,
-				     struct sci_port *sci_port,
-				     unsigned int index,
-				     struct plat_sci_port *p)
+			   struct sci_port *sci_port, unsigned int index,
+			   struct plat_sci_port *p, bool early)
 {
 	struct uart_port *port = &sci_port->port;
+	const struct resource *res;
+	unsigned int i;
 	int ret;
 
 	sci_port->cfg	= p;
@@ -2163,6 +2165,38 @@ static int sci_init_single(struct platform_device *dev,
 	port->iotype	= UPIO_MEM;
 	port->line	= index;
 
+	if (dev->num_resources) {
+		/* Device has resources, use them. */
+		res = platform_get_resource(dev, IORESOURCE_MEM, 0);
+		if (res = NULL)
+			return -ENOMEM;
+
+		port->mapbase = res->start;
+
+		for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i)
+			sci_port->irqs[i] = platform_get_irq(dev, i);
+
+		/* The SCI generates several interrupts. They can be muxed
+		 * together or connected to different interrupt lines. In the
+		 * muxed case only one interrupt resource is specified. In the
+		 * non-muxed case three or four interrupt resources are
+		 * specified, as the BRI interrupt is optional.
+		 */
+		if (sci_port->irqs[0] < 0)
+			return -ENXIO;
+
+		if (sci_port->irqs[1] < 0) {
+			sci_port->irqs[1] = sci_port->irqs[0];
+			sci_port->irqs[2] = sci_port->irqs[0];
+			sci_port->irqs[3] = sci_port->irqs[0];
+		}
+	} else {
+		/* No resources, use old-style platform data. */
+		port->mapbase = p->mapbase;
+		for (i = 0; i < ARRAY_SIZE(sci_port->irqs); ++i)
+			sci_port->irqs[i] = p->irqs[i] ? p->irqs[i] : -ENXIO;
+	}
+
 	switch (p->type) {
 	case PORT_SCIFB:
 		port->fifosize = 256;
@@ -2187,7 +2221,7 @@ static int sci_init_single(struct platform_device *dev,
 			return ret;
 	}
 
-	if (dev) {
+	if (!early) {
 		sci_port->iclk = clk_get(&dev->dev, "sci_ick");
 		if (IS_ERR(sci_port->iclk)) {
 			sci_port->iclk = clk_get(&dev->dev, "peripheral_clk");
@@ -2242,7 +2276,6 @@ static int sci_init_single(struct platform_device *dev,
 		p->error_mask |= (1 << p->overrun_bit);
 	}
 
-	port->mapbase		= p->mapbase;
 	port->type		= p->type;
 	port->flags		= UPF_FIXED_PORT | p->flags;
 	port->regshift		= p->regshift;
@@ -2254,7 +2287,7 @@ static int sci_init_single(struct platform_device *dev,
 	 *
 	 * For the muxed case there's nothing more to do.
 	 */
-	port->irq		= p->irqs[SCIx_RXI_IRQ];
+	port->irq		= sci_port->irqs[SCIx_RXI_IRQ];
 	port->irqflags		= 0;
 
 	port->serial_in		= sci_serial_in;
@@ -2386,7 +2419,7 @@ static int sci_probe_earlyprintk(struct platform_device *pdev)
 
 	early_serial_console.index = pdev->id;
 
-	sci_init_single(NULL, &sci_ports[pdev->id], pdev->id, cfg);
+	sci_init_single(pdev, &sci_ports[pdev->id], pdev->id, cfg, true);
 
 	serial_console_setup(&early_serial_console, early_serial_buf);
 
@@ -2453,7 +2486,7 @@ static int sci_probe_single(struct platform_device *dev,
 		return -EINVAL;
 	}
 
-	ret = sci_init_single(dev, sciport, index, p);
+	ret = sci_init_single(dev, sciport, index, p, false);
 	if (ret)
 		return ret;
 
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 12cf50c..42620f1 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -107,10 +107,10 @@ enum {
 }
 
 #define SCIx_IRQ_IS_MUXED(port)			\
-	((port)->cfg->irqs[SCIx_ERI_IRQ] =	\
-	 (port)->cfg->irqs[SCIx_RXI_IRQ]) ||	\
-	((port)->cfg->irqs[SCIx_ERI_IRQ] &&	\
-	 !(port)->cfg->irqs[SCIx_RXI_IRQ])
+	((port)->irqs[SCIx_ERI_IRQ] =	\
+	 (port)->irqs[SCIx_RXI_IRQ]) ||	\
+	((port)->irqs[SCIx_ERI_IRQ] &&	\
+	 ((port)->irqs[SCIx_RXI_IRQ] < 0))
 /*
  * SCI register subset common for all port types.
  * Not all registers will exist on all parts.
-- 
1.8.4


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

* [PATCH 08/11] serial: sh-sci: Move overrun_bit and error_mask fields out of pdata
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (6 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 07/11] serial: sh-sci: Support resources passed through platform resources Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 09/11] serial: sh-sci: Remove unused GPIO request code Simon Horman
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

None of the fields is ever set by board code, and both of them are set
in the driver at probe time. Move them out of struct plat_sci_port to
struct sci_port.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 50 +++++++++++++++++++++------------------------
 drivers/tty/serial/sh-sci.h |  2 +-
 include/linux/serial_sci.h  |  3 ---
 3 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index e9c6e23..98b8e3c 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -64,6 +64,9 @@ struct sci_port {
 
 	/* Platform configuration */
 	struct plat_sci_port	*cfg;
+	int			overrun_bit;
+	unsigned int		error_mask;
+
 
 	/* Break timer */
 	struct timer_list	break_timer;
@@ -760,19 +763,15 @@ static int sci_handle_errors(struct uart_port *port)
 	struct tty_port *tport = &port->state->port;
 	struct sci_port *s = to_sci_port(port);
 
-	/*
-	 * Handle overruns, if supported.
-	 */
-	if (s->cfg->overrun_bit != SCIx_NOT_SUPPORTED) {
-		if (status & (1 << s->cfg->overrun_bit)) {
-			port->icount.overrun++;
+	/* Handle overruns */
+	if (status & (1 << s->overrun_bit)) {
+		port->icount.overrun++;
 
-			/* overrun error */
-			if (tty_insert_flip_char(tport, 0, TTY_OVERRUN))
-				copied++;
+		/* overrun error */
+		if (tty_insert_flip_char(tport, 0, TTY_OVERRUN))
+			copied++;
 
-			dev_notice(port->dev, "overrun error");
-		}
+		dev_notice(port->dev, "overrun error");
 	}
 
 	if (status & SCxSR_FER(port)) {
@@ -834,7 +833,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port)
 	if (!reg->size)
 		return 0;
 
-	if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) {
+	if ((serial_port_in(port, SCLSR) & (1 << s->overrun_bit))) {
 		serial_port_out(port, SCLSR, 0);
 
 		port->icount.overrun++;
@@ -2253,28 +2252,25 @@ static int sci_init_single(struct platform_device *dev,
 	/*
 	 * Establish some sensible defaults for the error detection.
 	 */
-	if (!p->error_mask)
-		p->error_mask = (p->type = PORT_SCI) ?
+	sci_port->error_mask = (p->type = PORT_SCI) ?
 			SCI_DEFAULT_ERROR_MASK : SCIF_DEFAULT_ERROR_MASK;
 
 	/*
 	 * Establish sensible defaults for the overrun detection, unless
 	 * the part has explicitly disabled support for it.
 	 */
-	if (p->overrun_bit != SCIx_NOT_SUPPORTED) {
-		if (p->type = PORT_SCI)
-			p->overrun_bit = 5;
-		else if (p->scbrr_algo_id = SCBRR_ALGO_4)
-			p->overrun_bit = 9;
-		else
-			p->overrun_bit = 0;
+	if (p->type = PORT_SCI)
+		sci_port->overrun_bit = 5;
+	else if (p->scbrr_algo_id = SCBRR_ALGO_4)
+		sci_port->overrun_bit = 9;
+	else
+		sci_port->overrun_bit = 0;
 
-		/*
-		 * Make the error mask inclusive of overrun detection, if
-		 * supported.
-		 */
-		p->error_mask |= (1 << p->overrun_bit);
-	}
+	/*
+	 * Make the error mask inclusive of overrun detection, if
+	 * supported.
+	 */
+	sci_port->error_mask |= 1 << sci_port->overrun_bit;
 
 	port->type		= p->type;
 	port->flags		= UPF_FIXED_PORT | p->flags;
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index 5aca736..d5db81a 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -9,7 +9,7 @@
 #define SCxSR_PER(port)		(((port)->type = PORT_SCI) ? SCI_PER    : SCIF_PER)
 #define SCxSR_BRK(port)		(((port)->type = PORT_SCI) ? 0x00       : SCIF_BRK)
 
-#define SCxSR_ERRORS(port)	(to_sci_port(port)->cfg->error_mask)
+#define SCxSR_ERRORS(port)	(to_sci_port(port)->error_mask)
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7720) || \
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 42620f1..af9834b 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -152,9 +152,6 @@ struct plat_sci_port {
 	/*
 	 * Platform overrides if necessary, defaults otherwise.
 	 */
-	int		overrun_bit;
-	unsigned int	error_mask;
-
 	int		port_reg;
 	unsigned char	regshift;
 	unsigned char	regtype;
-- 
1.8.4


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

* [PATCH 09/11] serial: sh-sci: Remove unused GPIO request code
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (7 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 08/11] serial: sh-sci: Move overrun_bit and error_mask fields out of pdata Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 10/11] serial: sh-sci: Compute overrun_bit without using baud rate algo Simon Horman
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The driver requests at initialization time GPIOs passed through platform
data. No platform makes use of this feature, remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 67 ---------------------------------------------
 include/linux/serial_sci.h  | 12 --------
 2 files changed, 79 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 98b8e3c..99a64fd 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -32,7 +32,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/errno.h>
-#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -79,7 +78,6 @@ struct sci_port {
 
 	int			irqs[SCIx_NR_IRQS];
 	char			*irqstr[SCIx_NR_IRQS];
-	char			*gpiostr[SCIx_NR_FNS];
 
 	struct dma_chan			*chan_tx;
 	struct dma_chan			*chan_rx;
@@ -1153,67 +1151,6 @@ static void sci_free_irq(struct sci_port *port)
 	}
 }
 
-static const char *sci_gpio_names[SCIx_NR_FNS] = {
-	"sck", "rxd", "txd", "cts", "rts",
-};
-
-static const char *sci_gpio_str(unsigned int index)
-{
-	return sci_gpio_names[index];
-}
-
-static void sci_init_gpios(struct sci_port *port)
-{
-	struct uart_port *up = &port->port;
-	int i;
-
-	if (!port->cfg)
-		return;
-
-	for (i = 0; i < SCIx_NR_FNS; i++) {
-		const char *desc;
-		int ret;
-
-		if (!port->cfg->gpios[i])
-			continue;
-
-		desc = sci_gpio_str(i);
-
-		port->gpiostr[i] = kasprintf(GFP_KERNEL, "%s:%s",
-					     dev_name(up->dev), desc);
-
-		/*
-		 * If we've failed the allocation, we can still continue
-		 * on with a NULL string.
-		 */
-		if (!port->gpiostr[i])
-			dev_notice(up->dev, "%s string allocation failure\n",
-				   desc);
-
-		ret = gpio_request(port->cfg->gpios[i], port->gpiostr[i]);
-		if (unlikely(ret != 0)) {
-			dev_notice(up->dev, "failed %s gpio request\n", desc);
-
-			/*
-			 * If we can't get the GPIO for whatever reason,
-			 * no point in keeping the verbose string around.
-			 */
-			kfree(port->gpiostr[i]);
-		}
-	}
-}
-
-static void sci_free_gpios(struct sci_port *port)
-{
-	int i;
-
-	for (i = 0; i < SCIx_NR_FNS; i++)
-		if (port->cfg->gpios[i]) {
-			gpio_free(port->cfg->gpios[i]);
-			kfree(port->gpiostr[i]);
-		}
-}
-
 static unsigned int sci_tx_empty(struct uart_port *port)
 {
 	unsigned short status = serial_port_in(port, SCxSR);
@@ -2240,8 +2177,6 @@ static int sci_init_single(struct platform_device *dev,
 
 		port->dev = &dev->dev;
 
-		sci_init_gpios(sci_port);
-
 		pm_runtime_enable(&dev->dev);
 	}
 
@@ -2298,8 +2233,6 @@ static int sci_init_single(struct platform_device *dev,
 
 static void sci_cleanup_single(struct sci_port *port)
 {
-	sci_free_gpios(port);
-
 	clk_put(port->iclk);
 	clk_put(port->fclk);
 
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index af9834b..e9c3021 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -69,17 +69,6 @@ enum {
 	SCIx_MUX_IRQ = SCIx_NR_IRQS,	/* special case */
 };
 
-/* Offsets into the sci_port->gpios array */
-enum {
-	SCIx_SCK,
-	SCIx_RXD,
-	SCIx_TXD,
-	SCIx_CTS,
-	SCIx_RTS,
-
-	SCIx_NR_FNS,
-};
-
 enum {
 	SCIx_PROBE_REGTYPE,
 
@@ -141,7 +130,6 @@ struct plat_sci_port_ops {
 struct plat_sci_port {
 	unsigned long	mapbase;		/* resource base */
 	unsigned int	irqs[SCIx_NR_IRQS];	/* ERI, RXI, TXI, BRI */
-	unsigned int	gpios[SCIx_NR_FNS];	/* SCK, RXD, TXD, CTS, RTS */
 	unsigned int	type;			/* SCI / SCIF / IRDA / HSCIF */
 	upf_t		flags;			/* UPF_* flags */
 	unsigned long	capabilities;		/* Port features/capabilities */
-- 
1.8.4


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

* [PATCH 10/11] serial: sh-sci: Compute overrun_bit without using baud rate algo
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (8 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 09/11] serial: sh-sci: Remove unused GPIO request code Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2013-12-24 14:14 ` [PATCH 11/11] serial: sh-sci: Rework baud rate calculation Simon Horman
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

The overrun bit index is a property of the hardware. It's currently
computed based on a different and unrelated hardware property, the baud
rate calculation algorithm. Compute it using hardware identification
information only.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 99a64fd..d5239d5 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2133,30 +2133,38 @@ static int sci_init_single(struct platform_device *dev,
 			sci_port->irqs[i] = p->irqs[i] ? p->irqs[i] : -ENXIO;
 	}
 
+	if (p->regtype = SCIx_PROBE_REGTYPE) {
+		ret = sci_probe_regmap(p);
+		if (unlikely(ret))
+			return ret;
+	}
+
 	switch (p->type) {
 	case PORT_SCIFB:
 		port->fifosize = 256;
+		sci_port->overrun_bit = 9;
 		break;
 	case PORT_HSCIF:
 		port->fifosize = 128;
+		sci_port->overrun_bit = 0;
 		break;
 	case PORT_SCIFA:
 		port->fifosize = 64;
+		sci_port->overrun_bit = 9;
 		break;
 	case PORT_SCIF:
 		port->fifosize = 16;
+		if (p->regtype = SCIx_SH7705_SCIF_REGTYPE)
+			sci_port->overrun_bit = 9;
+		else
+			sci_port->overrun_bit = 0;
 		break;
 	default:
 		port->fifosize = 1;
+		sci_port->overrun_bit = 5;
 		break;
 	}
 
-	if (p->regtype = SCIx_PROBE_REGTYPE) {
-		ret = sci_probe_regmap(p);
-		if (unlikely(ret))
-			return ret;
-	}
-
 	if (!early) {
 		sci_port->iclk = clk_get(&dev->dev, "sci_ick");
 		if (IS_ERR(sci_port->iclk)) {
@@ -2194,12 +2202,6 @@ static int sci_init_single(struct platform_device *dev,
 	 * Establish sensible defaults for the overrun detection, unless
 	 * the part has explicitly disabled support for it.
 	 */
-	if (p->type = PORT_SCI)
-		sci_port->overrun_bit = 5;
-	else if (p->scbrr_algo_id = SCBRR_ALGO_4)
-		sci_port->overrun_bit = 9;
-	else
-		sci_port->overrun_bit = 0;
 
 	/*
 	 * Make the error mask inclusive of overrun detection, if
-- 
1.8.4


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

* [PATCH 11/11] serial: sh-sci: Rework baud rate calculation
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (9 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 10/11] serial: sh-sci: Compute overrun_bit without using baud rate algo Simon Horman
@ 2013-12-24 14:14 ` Simon Horman
  2014-01-02 18:33 ` [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Olof Johansson
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
  12 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2013-12-24 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Computing the baud rate register value requires knowledge of the
hardware sampling rate. This information is currently encoded in a baud
rate calculation algorithm ID passed through platform data. However, it
can be derived from the port type directly in most cases.

Compute the sampling rate internally in the driver if the baud rate
calculation algorithm ID isn't specified, and allow platforms to
override the sampling rate through platform data in special cases (this
is only required for SCIFA ports on sh7723 and sh7724, the reason needs
to be investigated).

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 drivers/tty/serial/sh-sci.c | 37 ++++++++++++++++++++++++++++++-------
 include/linux/serial_sci.h  |  2 ++
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d5239d5..e4bf0e4 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -65,6 +65,7 @@ struct sci_port {
 	struct plat_sci_port	*cfg;
 	int			overrun_bit;
 	unsigned int		error_mask;
+	unsigned int		sampling_rate;
 
 
 	/* Break timer */
@@ -1750,10 +1751,13 @@ static void sci_shutdown(struct uart_port *port)
 	sci_free_irq(s);
 }
 
-static unsigned int sci_scbrr_calc(unsigned int algo_id, unsigned int bps,
+static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,
 				   unsigned long freq)
 {
-	switch (algo_id) {
+	if (s->sampling_rate)
+		return DIV_ROUND_CLOSEST(freq, s->sampling_rate * bps) - 1;
+
+	switch (s->cfg->scbrr_algo_id) {
 	case SCBRR_ALGO_1:
 		return freq / (16 * bps);
 	case SCBRR_ALGO_2:
@@ -1843,12 +1847,11 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	baud = uart_get_baud_rate(port, termios, old, 0, max_baud);
 	if (likely(baud && port->uartclk)) {
-		if (s->cfg->scbrr_algo_id = SCBRR_ALGO_6) {
+		if (s->cfg->type = PORT_HSCIF) {
 			sci_baud_calc_hscif(baud, port->uartclk, &t, &srr,
 					    &cks);
 		} else {
-			t = sci_scbrr_calc(s->cfg->scbrr_algo_id, baud,
-					   port->uartclk);
+			t = sci_scbrr_calc(s, baud, port->uartclk);
 			for (cks = 0; t >= 256 && cks <= 3; cks++)
 				t >>= 2;
 		}
@@ -2092,6 +2095,7 @@ static int sci_init_single(struct platform_device *dev,
 {
 	struct uart_port *port = &sci_port->port;
 	const struct resource *res;
+	unsigned int sampling_rate;
 	unsigned int i;
 	int ret;
 
@@ -2143,28 +2147,47 @@ static int sci_init_single(struct platform_device *dev,
 	case PORT_SCIFB:
 		port->fifosize = 256;
 		sci_port->overrun_bit = 9;
+		sampling_rate = 16;
 		break;
 	case PORT_HSCIF:
 		port->fifosize = 128;
+		sampling_rate = 0;
 		sci_port->overrun_bit = 0;
 		break;
 	case PORT_SCIFA:
 		port->fifosize = 64;
 		sci_port->overrun_bit = 9;
+		sampling_rate = 16;
 		break;
 	case PORT_SCIF:
 		port->fifosize = 16;
-		if (p->regtype = SCIx_SH7705_SCIF_REGTYPE)
+		if (p->regtype = SCIx_SH7705_SCIF_REGTYPE) {
 			sci_port->overrun_bit = 9;
-		else
+			sampling_rate = 16;
+		} else {
 			sci_port->overrun_bit = 0;
+			sampling_rate = 32;
+		}
 		break;
 	default:
 		port->fifosize = 1;
 		sci_port->overrun_bit = 5;
+		sampling_rate = 32;
 		break;
 	}
 
+	/* Set the sampling rate if the baud rate calculation algorithm isn't
+	 * specified.
+	 */
+	if (p->scbrr_algo_id = SCBRR_ALGO_NONE) {
+		/* SCIFA on sh7723 and sh7724 need a custom sampling rate that
+		 * doesn't match the SoC datasheet, this should be investigated.
+		 * Let platform data override the sampling rate for now.
+		 */
+		sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate
+					: sampling_rate;
+	}
+
 	if (!early) {
 		sci_port->iclk = clk_get(&dev->dev, "sci_ick");
 		if (IS_ERR(sci_port->iclk)) {
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index e9c3021..af414e1 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -11,6 +11,7 @@
 #define SCIx_NOT_SUPPORTED	(-1)
 
 enum {
+	SCBRR_ALGO_NONE,	/* Compute sampling rate in the driver */
 	SCBRR_ALGO_1,		/* clk / (16 * bps) */
 	SCBRR_ALGO_2,		/* DIV_ROUND_CLOSEST(clk, 32 * bps) - 1 */
 	SCBRR_ALGO_3,		/* clk / (8 * bps) */
@@ -134,6 +135,7 @@ struct plat_sci_port {
 	upf_t		flags;			/* UPF_* flags */
 	unsigned long	capabilities;		/* Port features/capabilities */
 
+	unsigned int	sampling_rate;
 	unsigned int	scbrr_algo_id;		/* SCBRR calculation algo */
 	unsigned int	scscr;			/* SCSCR initialization */
 
-- 
1.8.4


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

* Re: [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (10 preceding siblings ...)
  2013-12-24 14:14 ` [PATCH 11/11] serial: sh-sci: Rework baud rate calculation Simon Horman
@ 2014-01-02 18:33 ` Olof Johansson
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
  12 siblings, 0 replies; 26+ messages in thread
From: Olof Johansson @ 2014-01-02 18:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Dec 24, 2013 at 11:14:11PM +0900, Simon Horman wrote:
> Hi Kevin, Hi Olof, Hi Arnd,
> 
> please consider this second round of Renesas SH SCI updates for v3.14.
> 
> They have been acked by Greg Kroah-Hartman to be taken
> through my tree. The reason for this is that they are dependencies
> for subsequent changes to use the common clock framework.
> 
> This pull-request is based on the first round of such changes,
> tagged as renesas-sh-sci-for-v3.14, which I have previously sent
> a pull-request for.
> 
> 
> The following changes since commit b016b646e8676858f39ea9be760494b04b9ee0af:
> 
>   serial: sh-sci: Convert to clk_prepare/unprepare (2013-12-14 09:59:31 +0900)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-sh-sci2-for-v3.14


Pulled, thanks.

-Olof

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

* [PATCH 01/11] ARM: shmobile: Lager: pass Ether PHY IRQ
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 02/11] ARM: shmobile: Koelsch: " Simon Horman
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Pass Ether's PHY IRQ (which is IRQC's IRQ0) to the 'sh_eth' driver. Set the IRQ
trigger type to be low-level as per the Micrel PHY driver's setup.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-lager.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index fdcc868..30ebd08 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -22,6 +22,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/mmc/host.h>
@@ -233,6 +234,7 @@ static const struct resource mmcif1_resources[] __initconst = {
 /* Ether */
 static const struct sh_eth_plat_data ether_pdata __initconst = {
 	.phy			= 0x1,
+	.phy_irq		= irq_pin(0),
 	.edmac_endian		= EDMAC_LITTLE_ENDIAN,
 	.phy_interface		= PHY_INTERFACE_MODE_RMII,
 	.ether_link_active_low	= 1,
@@ -618,6 +620,8 @@ static void __init lager_init(void)
 {
 	lager_add_standard_devices();
 
+	irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
+
 	if (IS_ENABLED(CONFIG_PHYLIB))
 		phy_register_fixup_for_id("r8a7790-ether-ff:01",
 					  lager_ksz8041_fixup);
-- 
1.8.5.2


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

* [PATCH 02/11] ARM: shmobile: Koelsch: pass Ether PHY IRQ
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
  2014-02-13  8:03   ` [PATCH 01/11] ARM: shmobile: Lager: pass Ether PHY IRQ Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 03/11] ARM: shmobile: koelsch: Add I2C support Simon Horman
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Pass Ether's PHY IRQ (which is IRQC's IRQ0) to the 'sh_eth' driver. Set the IRQ
trigger type to be low-level as per the Micrel PHY driver's setup.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-koelsch.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 2ab5c75..1ec3b91 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -23,6 +23,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/input.h>
+#include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
 #include <linux/phy.h>
@@ -92,6 +93,7 @@ static void __init koelsch_add_du_device(void)
 /* Ether */
 static const struct sh_eth_plat_data ether_pdata __initconst = {
 	.phy			= 0x1,
+	.phy_irq		= irq_pin(0),
 	.edmac_endian		= EDMAC_LITTLE_ENDIAN,
 	.phy_interface		= PHY_INTERFACE_MODE_RMII,
 	.ether_link_active_low	= 1,
@@ -232,6 +234,8 @@ static void __init koelsch_init(void)
 {
 	koelsch_add_standard_devices();
 
+	irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW);
+
 	if (IS_ENABLED(CONFIG_PHYLIB))
 		phy_register_fixup_for_id("r8a7791-ether-ff:01",
 					  koelsch_ksz8041_fixup);
-- 
1.8.5.2


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

* [PATCH 03/11] ARM: shmobile: koelsch: Add I2C support
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
  2014-02-13  8:03   ` [PATCH 01/11] ARM: shmobile: Lager: pass Ether PHY IRQ Simon Horman
  2014-02-13  8:03   ` [PATCH 02/11] ARM: shmobile: Koelsch: " Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 04/11] ARM: shmobile: bockw: use wp-gpios instead of WP pin Simon Horman
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Valentine Barshak <valentine.barshak@cogentembedded.com>

This adds I2C[1245] busses support to Koelsch board.
I2C[03] do not have any slave devices connected and
are not used because of the following:
* I2C0 pins are multiplexed with LBSC pins;
* I2C3 pins are multiplexed with EtherMAC and VIN0 pins.

Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-koelsch.c | 46 ++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 1ec3b91..2741dba 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -165,6 +165,38 @@ static const struct platform_device_info sata0_info __initconst = {
 	.dma_mask	= DMA_BIT_MASK(32),
 };
 
+/* I2C */
+static const struct resource i2c_resources[] __initconst = {
+	/* I2C0 */
+	DEFINE_RES_MEM(0xE6508000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(287)),
+	/* I2C1 */
+	DEFINE_RES_MEM(0xE6518000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(288)),
+	/* I2C2 */
+	DEFINE_RES_MEM(0xE6530000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(286)),
+	/* I2C3 */
+	DEFINE_RES_MEM(0xE6540000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(290)),
+	/* I2C4 */
+	DEFINE_RES_MEM(0xE6520000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(19)),
+	/* I2C5 */
+	DEFINE_RES_MEM(0xE6528000, 0x40),
+	DEFINE_RES_IRQ(gic_spi(20)),
+};
+
+static void __init koelsch_add_i2c(unsigned idx)
+{
+	unsigned res_idx = idx * 2;
+
+	BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources));
+
+	platform_device_register_simple("i2c-rcar_gen2", idx,
+					i2c_resources + res_idx, 2);
+}
+
 static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* DU */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791",
@@ -188,6 +220,15 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = {
 	/* SCIF1 (CN20: DEBUG SERIAL1) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791",
 				  "scif1_data_d", "scif1"),
+	/* I2C1 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791",
+				  "i2c1_e", "i2c1"),
+	/* I2C2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791",
+				  "i2c2", "i2c2"),
+	/* I2C4 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791",
+				  "i2c4_c", "i2c4"),
 };
 
 static void __init koelsch_add_standard_devices(void)
@@ -211,6 +252,11 @@ static void __init koelsch_add_standard_devices(void)
 	koelsch_add_du_device();
 
 	platform_device_register_full(&sata0_info);
+
+	koelsch_add_i2c(1);
+	koelsch_add_i2c(2);
+	koelsch_add_i2c(4);
+	koelsch_add_i2c(5);
 }
 
 /*
-- 
1.8.5.2


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

* [PATCH 04/11] ARM: shmobile: bockw: use wp-gpios instead of WP pin
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (2 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 03/11] ARM: shmobile: koelsch: Add I2C support Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 05/11] ARM: shmobile: Lager USB0 cable detection workaround Simon Horman
                     ` (7 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Latest Renesas Chip has some SDHI channels and the WP pin
availability depends on its channel or HW implementation.
Thus, this patch decides new policy whch indicates
WP is disabled as default.
But, we can use wp-gpios property to enable it as
other method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/r8a7778-bockw-reference.dts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7778-bockw-reference.dts b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
index bb62c7a..06cda19 100644
--- a/arch/arm/boot/dts/r8a7778-bockw-reference.dts
+++ b/arch/arm/boot/dts/r8a7778-bockw-reference.dts
@@ -17,6 +17,7 @@
 /dts-v1/;
 #include "r8a7778.dtsi"
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "bockw";
@@ -84,7 +85,7 @@
 
 	sdhi0_pins: sd0 {
 		renesas,groups = "sdhi0_data4", "sdhi0_ctrl",
-				  "sdhi0_cd", "sdhi0_wp";
+				  "sdhi0_cd";
 		renesas,function = "sdhi0";
 	};
 
@@ -101,6 +102,7 @@
 	vmmc-supply = <&fixedregulator3v3>;
 	bus-width = <4>;
 	status = "okay";
+	wp-gpios = <&gpio3 18 GPIO_ACTIVE_HIGH>;
 };
 
 &hspi0 {
-- 
1.8.5.2


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

* [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15
  2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
                   ` (11 preceding siblings ...)
  2014-01-02 18:33 ` [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Olof Johansson
@ 2014-02-13  8:03 ` Simon Horman
  2014-02-13  8:03   ` [PATCH 01/11] ARM: shmobile: Lager: pass Ether PHY IRQ Simon Horman
                     ` (11 more replies)
  12 siblings, 12 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Olof, Hi Kevin, Hi Arnd,

please consider this second round of Renesas ARM based SoC board updates
for v3.15.

This pull-request is based on the first round of such updates,
tagged as renesas-boards-for-v3.15, which I have previously sent a
pull-request for.


The following changes since commit 235cda29e4d5047622ff9b82b1f0b4cb6cf95f6c:

  ARM: shmobile: Remove Lager USBHS UDC ifdefs (2014-02-04 14:28:33 +0900)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-boards2-for-v3.15

for you to fetch changes up to 03fec7dee502d43114f384a1588ce84a3c9bf38d:

  ARM: shmobile: genmai: Enable r7s72100-ether (2014-02-07 09:20:03 +0900)

----------------------------------------------------------------
Second Round of Renesas ARM Based SoC Board Updates for v3.15

* r7s72100 (RZ/A1H) based Genmai board
  - Enable SH ethernet
  - Add RSPI support

* r8a7791 (R-Car M2) based Koelsch board
  - Add QSPI support
  - Add I2C support
  - Pass SH ethernet PHY IRQ

* r8a7790 (R-Car H2) based Lager board
  - Switch QSPI to named IRQs
  - Add sound support
  - Add USB0 cable detection workaround
  - Pass SH ethernet PHY IRQ

* r8a7779 (R-Car H1) based Marzen board
  - Revert conditional selection of SMSC_PHY

* r8a7778 (R-Car M1) based Bock-W board
  - Use wp-gpios instead of WP pin

----------------------------------------------------------------
Geert Uytterhoeven (3):
      ARM: shmobile: genmai legacy: Add RSPI support
      ARM: shmobile: koelsch legacy: Add QSPI support
      ARM: shmobile: lager legacy: Switch QSPI to named IRQs

Kuninori Morimoto (2):
      ARM: shmobile: bockw: use wp-gpios instead of WP pin
      ARM: shmobile: lager: add sound support

Magnus Damm (1):
      ARM: shmobile: Lager USB0 cable detection workaround

Sergei Shtylyov (2):
      ARM: shmobile: Lager: pass Ether PHY IRQ
      ARM: shmobile: Koelsch: pass Ether PHY IRQ

Simon Horman (2):
      Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY"
      ARM: shmobile: genmai: Enable r7s72100-ether

Valentine Barshak (1):
      ARM: shmobile: koelsch: Add I2C support

 arch/arm/boot/dts/r8a7778-bockw-reference.dts |   4 +-
 arch/arm/mach-shmobile/Kconfig                |   3 +-
 arch/arm/mach-shmobile/board-genmai.c         |  64 +++++++++++++
 arch/arm/mach-shmobile/board-koelsch.c        | 114 ++++++++++++++++++++++
 arch/arm/mach-shmobile/board-lager.c          | 131 +++++++++++++++++++++++++-
 5 files changed, 309 insertions(+), 7 deletions(-)

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

* [PATCH 05/11] ARM: shmobile: Lager USB0 cable detection workaround
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (3 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 04/11] ARM: shmobile: bockw: use wp-gpios instead of WP pin Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 06/11] ARM: shmobile: lager: add sound support Simon Horman
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Magnus Damm <damm@opensource.se>

Add Lager board code to check the PWEN GPIO signal and refuse to
allow probe of the USBHS driver in case of DIP misconfiguration.

For correct operation Lager DIP switches SW5 and SW6 shall be
configured in 2-3 position to enable USB Function support.

If the DIP switch is configured incorrectly then the user can
simply adjust the hardware and either reboot or use the bind interface
to try to probe again:

# echo renesas_usbhs > /sys/bus/platform/drivers/renesas_usbhs/bind

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-lager.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 30ebd08..6a7041f 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -408,13 +408,30 @@ static int usbhs_hardware_init(struct platform_device *pdev)
 {
 	struct usbhs_private *priv = usbhs_get_priv(pdev);
 	struct usb_phy *phy;
+	int ret;
+
+	/* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5
+	 * setting to avoid VBUS short circuit due to wrong cable.
+	 * PWEN should be pulled up high if USB Function is selected by SW5
+	 */
+	gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */
+	if (!gpio_get_value(RCAR_GP_PIN(5, 18))) {
+		pr_warn("Error: USB Function not selected - check SW5 + SW6\n");
+		ret = -ENOTSUPP;
+		goto error;
+	}
 
 	phy = usb_get_phy_dev(&pdev->dev, 0);
-	if (IS_ERR(phy))
-		return PTR_ERR(phy);
+	if (IS_ERR(phy)) {
+		ret = PTR_ERR(phy);
+		goto error;
+	}
 
 	priv->phy = phy;
 	return 0;
+ error:
+	gpio_free(RCAR_GP_PIN(5, 18));
+	return ret;
 }
 
 static int usbhs_hardware_exit(struct platform_device *pdev)
@@ -426,6 +443,8 @@ static int usbhs_hardware_exit(struct platform_device *pdev)
 
 	usb_put_phy(priv->phy);
 	priv->phy = NULL;
+
+	gpio_free(RCAR_GP_PIN(5, 18));
 	return 0;
 }
 
@@ -536,7 +555,7 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "vin1_clk", "vin1"),
 	/* USB0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790",
-				  "usb0", "usb0"),
+				  "usb0_ovc_vbus", "usb0"),
 };
 
 static void __init lager_add_standard_devices(void)
-- 
1.8.5.2


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

* [PATCH 06/11] ARM: shmobile: lager: add sound support
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (4 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 05/11] ARM: shmobile: Lager USB0 cable detection workaround Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 07/11] Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY" Simon Horman
                     ` (5 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

This patch adds sound support for Lager board.
But, it is using PIO transfer at this point.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
[horms+renesas@verge.net.au: resolved conflicts]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/Kconfig       |   1 +
 arch/arm/mach-shmobile/board-lager.c | 100 +++++++++++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 7e3f42b..bcbd74c 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -272,6 +272,7 @@ config MACH_LAGER
 	depends on ARCH_R8A7790
 	select USE_OF
 	select MICREL_PHY if SH_ETH
+	select SND_SOC_AK4642 if SND_SIMPLE_CARD
 
 config MACH_KOELSCH
 	bool "Koelsch board"
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 6a7041f..e8242c5 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -20,6 +20,7 @@
 
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
+#include <linux/i2c.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -52,6 +53,20 @@
 #include <linux/spi/flash.h>
 #include <linux/spi/rspi.h>
 #include <linux/spi/spi.h>
+#include <sound/rcar_snd.h>
+#include <sound/simple_card.h>
+
+/*
+ * SSI-AK4643
+ *
+ * SW1: 1: AK4643
+ *      2: CN22
+ *      3: ADV7511
+ *
+ * this command is required when playback.
+ *
+ * # amixer set "LINEOUT Mixer DACL" on
+ */
 
 /* DU */
 static struct rcar_du_encoder_data lager_du_encoders[] = {
@@ -509,6 +524,77 @@ static const struct resource usbhs_phy_resources[] __initconst = {
 	DEFINE_RES_MEM(0xe6590100, 0x100),
 };
 
+/* I2C */
+static struct i2c_board_info i2c2_devices[] = {
+	{
+		I2C_BOARD_INFO("ak4643", 0x12),
+	}
+};
+
+/* Sound */
+static struct resource rsnd_resources[] __initdata = {
+	[RSND_GEN2_SCU]  = DEFINE_RES_MEM(0xec500000, 0x1000),
+	[RSND_GEN2_ADG]  = DEFINE_RES_MEM(0xec5a0000, 0x100),
+	[RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000),
+	[RSND_GEN2_SSI]  = DEFINE_RES_MEM(0xec541000, 0x1280),
+};
+
+static struct rsnd_ssi_platform_info rsnd_ssi[] = {
+	RSND_SSI_SET(0, 0, gic_spi(370), RSND_SSI_PLAY),
+	RSND_SSI_SET(0, 0, gic_spi(371), RSND_SSI_CLK_PIN_SHARE),
+};
+
+static struct rsnd_scu_platform_info rsnd_scu[2] = {
+	/* no member at this point */
+};
+
+static struct rcar_snd_info rsnd_info = {
+	.flags		= RSND_GEN2,
+	.ssi_info	= rsnd_ssi,
+	.ssi_info_nr	= ARRAY_SIZE(rsnd_ssi),
+	.scu_info	= rsnd_scu,
+	.scu_info_nr	= ARRAY_SIZE(rsnd_scu),
+};
+
+static struct asoc_simple_card_info rsnd_card_info = {
+	.name		= "AK4643",
+	.card		= "SSI01-AK4643",
+	.codec		= "ak4642-codec.2-0012",
+	.platform	= "rcar_sound",
+	.daifmt		= SND_SOC_DAIFMT_LEFT_J,
+	.cpu_dai = {
+		.name	= "rcar_sound",
+		.fmt	= SND_SOC_DAIFMT_CBS_CFS,
+	},
+	.codec_dai = {
+		.name	= "ak4642-hifi",
+		.fmt	= SND_SOC_DAIFMT_CBM_CFM,
+		.sysclk	= 11289600,
+	},
+};
+
+static void __init lager_add_rsnd_device(void)
+{
+	struct platform_device_info cardinfo = {
+		.parent         = &platform_bus,
+		.name           = "asoc-simple-card",
+		.id             = -1,
+		.data           = &rsnd_card_info,
+		.size_data      = sizeof(struct asoc_simple_card_info),
+		.dma_mask       = DMA_BIT_MASK(32),
+	};
+
+	i2c_register_board_info(2, i2c2_devices,
+				ARRAY_SIZE(i2c2_devices));
+
+	platform_device_register_resndata(
+		&platform_bus, "rcar_sound", -1,
+		rsnd_resources, ARRAY_SIZE(rsnd_resources),
+		&rsnd_info, sizeof(rsnd_info));
+
+	platform_device_register_full(&cardinfo);
+}
+
 static const struct pinctrl_map lager_pinctrl_map[] = {
 	/* DU (CN10: ARGB0, CN13: LVDS) */
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
@@ -517,12 +603,24 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
 				  "du_sync_1", "du"),
 	PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790",
 				  "du_clk_out_0", "du"),
+	/* I2C2 */
+	PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar.2", "pfc-r8a7790",
+				  "i2c2", "i2c2"),
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790",
 				  "scif0_data", "scif0"),
 	/* SCIF1 (CN20: DEBUG SERIAL1) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790",
 				  "scif1_data", "scif1"),
+	/* SSI (CN17: sound) */
+	PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
+				  "ssi0129_ctrl", "ssi"),
+	PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
+				  "ssi0_data", "ssi"),
+	PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
+				  "ssi1_data", "ssi"),
+	PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790",
+				  "audio_clk_a", "audio_clk"),
 	/* MMCIF1 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790",
 				  "mmc1_data8", "mmc1"),
@@ -616,6 +714,8 @@ static void __init lager_add_standard_devices(void)
 					  &usbhs_phy_pdata,
 					  sizeof(usbhs_phy_pdata));
 	lager_register_usbhs();
+
+	lager_add_rsnd_device();
 }
 
 /*
-- 
1.8.5.2


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

* [PATCH 07/11] Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY"
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (5 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 06/11] ARM: shmobile: lager: add sound support Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 08/11] ARM: shmobile: genmai legacy: Add RSPI support Simon Horman
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

This reverts commit 317af6612ee29dfcb5ae04df9c58e9f79fc8d4ff.

This seems to prevent the board from booting now that the tree has been
rebased on v3.14-rc1.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/Kconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index bcbd74c..c431114 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -250,7 +250,6 @@ config MACH_MARZEN
 	depends on ARCH_R8A7779
 	select ARCH_REQUIRE_GPIOLIB
 	select REGULATOR_FIXED_VOLTAGE if REGULATOR
-	select SMSC_PHY if SMSC911X
 	select USE_OF
 
 config MACH_MARZEN_REFERENCE
@@ -258,7 +257,6 @@ config MACH_MARZEN_REFERENCE
 	depends on ARCH_R8A7779
 	select ARCH_REQUIRE_GPIOLIB
 	select REGULATOR_FIXED_VOLTAGE if REGULATOR
-	select SMSC_PHY if SMSC911X
 	select USE_OF
 	---help---
 	   Use reference implementation of Marzen board support
-- 
1.8.5.2


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

* [PATCH 08/11] ARM: shmobile: genmai legacy: Add RSPI support
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (6 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 07/11] Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY" Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 09/11] ARM: shmobile: koelsch legacy: Add QSPI support Simon Horman
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>

Add RSPI platform device, resources, platform data, and SPI child.

On this board, only rspi4 is in use. Its bus contains a single device
(a wm8978 audio codec).

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-genmai.c | 44 +++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index 3e92e3c..c406461 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -20,15 +20,59 @@
 
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/spi/rspi.h>
+#include <linux/spi/spi.h>
 #include <mach/common.h>
+#include <mach/irqs.h>
 #include <mach/r7s72100.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* RSPI */
+#define RSPI_RESOURCE(idx, baseaddr, irq)				\
+static const struct resource rspi##idx##_resources[] __initconst = {	\
+	DEFINE_RES_MEM(baseaddr, 0x24),					\
+	DEFINE_RES_IRQ_NAMED(irq, "error"),				\
+	DEFINE_RES_IRQ_NAMED(irq + 1, "rx"),				\
+	DEFINE_RES_IRQ_NAMED(irq + 2, "tx"),				\
+}
+
+RSPI_RESOURCE(0, 0xe800c800, gic_iid(270));
+RSPI_RESOURCE(1, 0xe800d000, gic_iid(273));
+RSPI_RESOURCE(2, 0xe800d800, gic_iid(276));
+RSPI_RESOURCE(3, 0xe800e000, gic_iid(279));
+RSPI_RESOURCE(4, 0xe800e800, gic_iid(282));
+
+static const struct rspi_plat_data rspi_pdata __initconst = {
+	.num_chipselect	= 1,
+};
+
+#define r7s72100_register_rspi(idx)					   \
+	platform_device_register_resndata(&platform_bus, "rspi-rz", idx,   \
+					rspi##idx##_resources,		   \
+					ARRAY_SIZE(rspi##idx##_resources), \
+					&rspi_pdata, sizeof(rspi_pdata))
+
+static const struct spi_board_info spi_info[] __initconst = {
+	{
+		.modalias               = "wm8978",
+		.max_speed_hz           = 5000000,
+		.bus_num                = 4,
+		.chip_select            = 0,
+	},
+};
+
 static void __init genmai_add_standard_devices(void)
 {
 	r7s72100_clock_init();
 	r7s72100_add_dt_devices();
+
+	r7s72100_register_rspi(0);
+	r7s72100_register_rspi(1);
+	r7s72100_register_rspi(2);
+	r7s72100_register_rspi(3);
+	r7s72100_register_rspi(4);
+	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
 }
 
 static const char * const genmai_boards_compat_dt[] __initconst = {
-- 
1.8.5.2


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

* [PATCH 09/11] ARM: shmobile: koelsch legacy: Add QSPI support
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (7 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 08/11] ARM: shmobile: genmai legacy: Add RSPI support Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 10/11] ARM: shmobile: lager legacy: Switch QSPI to named IRQs Simon Horman
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>

Enable support for the Spansion s25fl512s SPI FLASH on the Koelsch board:
  - Add QSPI platform device, resources, platform data, and pinmux,
  - Add FLASH data and MTD partitions.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-koelsch.c | 64 ++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index 2741dba..d42637d 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -26,12 +26,17 @@
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 #include <linux/phy.h>
 #include <linux/pinctrl/machine.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/rcar-du.h>
 #include <linux/platform_device.h>
 #include <linux/sh_eth.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/rspi.h>
+#include <linux/spi/spi.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/r8a7791.h>
@@ -150,6 +155,55 @@ static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = {
 	.nbuttons	= ARRAY_SIZE(gpio_buttons),
 };
 
+/* QSPI */
+static const struct resource qspi_resources[] __initconst = {
+	DEFINE_RES_MEM(0xe6b10000, 0x1000),
+	DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
+};
+
+static const struct rspi_plat_data qspi_pdata __initconst = {
+	.num_chipselect = 1,
+};
+
+/* SPI Flash memory (Spansion S25FL512SAGMFIG11 64 MiB) */
+static struct mtd_partition spi_flash_part[] = {
+	{
+		.name		= "loader",
+		.offset		= 0x00000000,
+		.size		= 512 * 1024,
+		.mask_flags	= MTD_WRITEABLE,
+	},
+	{
+		.name		= "bootenv",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= 512 * 1024,
+		.mask_flags	= MTD_WRITEABLE,
+	},
+	{
+		.name		= "data",
+		.offset		= MTDPART_OFS_APPEND,
+		.size		= MTDPART_SIZ_FULL,
+	},
+};
+
+static const struct flash_platform_data spi_flash_data = {
+	.name		= "m25p80",
+	.parts		= spi_flash_part,
+	.nr_parts	= ARRAY_SIZE(spi_flash_part),
+	.type		= "s25fl512s",
+};
+
+static const struct spi_board_info spi_info[] __initconst = {
+	{
+		.modalias	= "m25p80",
+		.platform_data	= &spi_flash_data,
+		.mode		= SPI_MODE_0,
+		.max_speed_hz	= 30000000,
+		.bus_num	= 0,
+		.chip_select	= 0,
+	},
+};
+
 /* SATA0 */
 static const struct resource sata0_resources[] __initconst = {
 	DEFINE_RES_MEM(0xee300000, 0x2000),
@@ -214,6 +268,11 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = {
 				  "eth_rmii", "eth"),
 	PIN_MAP_MUX_GROUP_DEFAULT("r8a7791-ether", "pfc-r8a7791",
 				  "intc_irq0", "intc"),
+	/* QSPI */
+	PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
+				  "qspi_ctrl", "qspi"),
+	PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7791",
+				  "qspi_data4", "qspi"),
 	/* SCIF0 (CN19: DEBUG SERIAL0) */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7791",
 				  "scif0_data_d", "scif0"),
@@ -248,6 +307,11 @@ static void __init koelsch_add_standard_devices(void)
 	platform_device_register_data(&platform_bus, "gpio-keys", -1,
 				      &koelsch_keys_pdata,
 				      sizeof(koelsch_keys_pdata));
+	platform_device_register_resndata(&platform_bus, "qspi", 0,
+					  qspi_resources,
+					  ARRAY_SIZE(qspi_resources),
+					  &qspi_pdata, sizeof(qspi_pdata));
+	spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
 
 	koelsch_add_du_device();
 
-- 
1.8.5.2


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

* [PATCH 10/11] ARM: shmobile: lager legacy: Switch QSPI to named IRQs
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (8 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 09/11] ARM: shmobile: koelsch legacy: Add QSPI support Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-13  8:03   ` [PATCH 11/11] ARM: shmobile: genmai: Enable r7s72100-ether Simon Horman
  2014-02-20  9:26   ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Olof Johansson
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Geert Uytterhoeven <geert+renesas@linux-m68k.org>

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/mach-shmobile/board-lager.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index e8242c5..3175748 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -310,7 +310,7 @@ static const struct spi_board_info spi_info[] __initconst = {
 /* QSPI resource */
 static const struct resource qspi_resources[] __initconst = {
 	DEFINE_RES_MEM(0xe6b10000, 0x1000),
-	DEFINE_RES_IRQ(gic_spi(184)),
+	DEFINE_RES_IRQ_NAMED(gic_spi(184), "mux"),
 };
 
 /* VIN */
-- 
1.8.5.2


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

* [PATCH 11/11] ARM: shmobile: genmai: Enable r7s72100-ether
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (9 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 10/11] ARM: shmobile: lager legacy: Switch QSPI to named IRQs Simon Horman
@ 2014-02-13  8:03   ` Simon Horman
  2014-02-20  9:26   ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Olof Johansson
  11 siblings, 0 replies; 26+ messages in thread
From: Simon Horman @ 2014-02-13  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 arch/arm/mach-shmobile/board-genmai.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-shmobile/board-genmai.c b/arch/arm/mach-shmobile/board-genmai.c
index c406461..e240980 100644
--- a/arch/arm/mach-shmobile/board-genmai.c
+++ b/arch/arm/mach-shmobile/board-genmai.c
@@ -20,6 +20,7 @@
 
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/sh_eth.h>
 #include <linux/spi/rspi.h>
 #include <linux/spi/spi.h>
 #include <mach/common.h>
@@ -28,6 +29,20 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 
+/* Ether */
+static const struct sh_eth_plat_data ether_pdata __initconst = {
+	.phy			= 0x00, /* PD60610 */
+	.edmac_endian		= EDMAC_LITTLE_ENDIAN,
+	.phy_interface		= PHY_INTERFACE_MODE_MII,
+	.no_ether_link		= 1
+};
+
+static const struct resource ether_resources[] __initconst = {
+	DEFINE_RES_MEM(0xe8203000, 0x800),
+	DEFINE_RES_MEM(0xe8204800, 0x200),
+	DEFINE_RES_IRQ(gic_iid(359)),
+};
+
 /* RSPI */
 #define RSPI_RESOURCE(idx, baseaddr, irq)				\
 static const struct resource rspi##idx##_resources[] __initconst = {	\
@@ -67,6 +82,11 @@ static void __init genmai_add_standard_devices(void)
 	r7s72100_clock_init();
 	r7s72100_add_dt_devices();
 
+	platform_device_register_resndata(&platform_bus, "r7s72100-ether", -1,
+					  ether_resources,
+					  ARRAY_SIZE(ether_resources),
+					  &ether_pdata, sizeof(ether_pdata));
+
 	r7s72100_register_rspi(0);
 	r7s72100_register_rspi(1);
 	r7s72100_register_rspi(2);
-- 
1.8.5.2


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

* Re: [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15
  2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
                     ` (10 preceding siblings ...)
  2014-02-13  8:03   ` [PATCH 11/11] ARM: shmobile: genmai: Enable r7s72100-ether Simon Horman
@ 2014-02-20  9:26   ` Olof Johansson
  11 siblings, 0 replies; 26+ messages in thread
From: Olof Johansson @ 2014-02-20  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Feb 13, 2014 at 05:03:52PM +0900, Simon Horman wrote:
> Hi Olof, Hi Kevin, Hi Arnd,
> 
> please consider this second round of Renesas ARM based SoC board updates
> for v3.15.
> 
> This pull-request is based on the first round of such updates,
> tagged as renesas-boards-for-v3.15, which I have previously sent a
> pull-request for.
> 
> 
> The following changes since commit 235cda29e4d5047622ff9b82b1f0b4cb6cf95f6c:
> 
>   ARM: shmobile: Remove Lager USBHS UDC ifdefs (2014-02-04 14:28:33 +0900)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-boards2-for-v3.15
> 
> for you to fetch changes up to 03fec7dee502d43114f384a1588ce84a3c9bf38d:
> 
>   ARM: shmobile: genmai: Enable r7s72100-ether (2014-02-07 09:20:03 +0900)

Merged, thanks. Same comment as last board pull request reply though. :)


-Olof

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

end of thread, other threads:[~2014-02-20  9:26 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-24 14:14 [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Simon Horman
2013-12-24 14:14 ` [PATCH 01/11] serial: sh-sci: Sort headers alphabetically Simon Horman
2013-12-24 14:14 ` [PATCH 02/11] serial: sh-sci: Remove baud rate calculation algorithm 5 Simon Horman
2013-12-24 14:14 ` [PATCH 03/11] serial: sh-sci: Simplify baud rate calculation algorithms Simon Horman
2013-12-24 14:14 ` [PATCH 04/11] serial: sh-sci: Remove duplicate interrupt check in verify port op Simon Horman
2013-12-24 14:14 ` [PATCH 05/11] serial: sh-sci: Set the UPF_FIXED_PORT flag Simon Horman
2013-12-24 14:14 ` [PATCH 06/11] serial: sh-sci: Don't check IRQ in verify port operation Simon Horman
2013-12-24 14:14 ` [PATCH 07/11] serial: sh-sci: Support resources passed through platform resources Simon Horman
2013-12-24 14:14 ` [PATCH 08/11] serial: sh-sci: Move overrun_bit and error_mask fields out of pdata Simon Horman
2013-12-24 14:14 ` [PATCH 09/11] serial: sh-sci: Remove unused GPIO request code Simon Horman
2013-12-24 14:14 ` [PATCH 10/11] serial: sh-sci: Compute overrun_bit without using baud rate algo Simon Horman
2013-12-24 14:14 ` [PATCH 11/11] serial: sh-sci: Rework baud rate calculation Simon Horman
2014-01-02 18:33 ` [GIT PULL 00/11] Second Round of Renesas SH SCI updates for v3.14 Olof Johansson
2014-02-13  8:03 ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Simon Horman
2014-02-13  8:03   ` [PATCH 01/11] ARM: shmobile: Lager: pass Ether PHY IRQ Simon Horman
2014-02-13  8:03   ` [PATCH 02/11] ARM: shmobile: Koelsch: " Simon Horman
2014-02-13  8:03   ` [PATCH 03/11] ARM: shmobile: koelsch: Add I2C support Simon Horman
2014-02-13  8:03   ` [PATCH 04/11] ARM: shmobile: bockw: use wp-gpios instead of WP pin Simon Horman
2014-02-13  8:03   ` [PATCH 05/11] ARM: shmobile: Lager USB0 cable detection workaround Simon Horman
2014-02-13  8:03   ` [PATCH 06/11] ARM: shmobile: lager: add sound support Simon Horman
2014-02-13  8:03   ` [PATCH 07/11] Revert "ARM: shmobile: marzen: Conditionally select SMSC_PHY" Simon Horman
2014-02-13  8:03   ` [PATCH 08/11] ARM: shmobile: genmai legacy: Add RSPI support Simon Horman
2014-02-13  8:03   ` [PATCH 09/11] ARM: shmobile: koelsch legacy: Add QSPI support Simon Horman
2014-02-13  8:03   ` [PATCH 10/11] ARM: shmobile: lager legacy: Switch QSPI to named IRQs Simon Horman
2014-02-13  8:03   ` [PATCH 11/11] ARM: shmobile: genmai: Enable r7s72100-ether Simon Horman
2014-02-20  9:26   ` [GIT PULL 00/11] Second Round of Renesas ARM Based SoC Board Updates for v3.15 Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).