linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
To: linux-sh@vger.kernel.org
Cc: linux-serial@vger.kernel.org,
	Bastian Hecht <hechtb+renesas@gmail.com>,
	Paul Mundt <lethal@linux-sh.org>
Subject: [PATCH v3 10/29] ARM: shmobile: r8a7740: Use macros to declare SCIF devices
Date: Tue, 19 Nov 2013 14:02:11 +0000	[thread overview]
Message-ID: <1384869751-9786-11-git-send-email-laurent.pinchart+renesas@ideasonboard.com> (raw)
In-Reply-To: <1384869751-9786-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

Replace copy-n-paste SCIF platform data and device declaration with a
macro. This reduces the amount of code and improves readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 arch/arm/mach-shmobile/setup-r8a7740.c | 191 +++++----------------------------
 1 file changed, 29 insertions(+), 162 deletions(-)

diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index b7d4b2c..8778b57 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -203,167 +203,34 @@ static struct platform_device irqpin3_device = {
 	},
 };
 
-/* SCIFA0 */
-static struct plat_sci_port scif0_platform_data = {
-	.mapbase	= 0xe6c40000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(100)),
-};
-
-static struct platform_device scif0_device = {
-	.name		= "sh-sci",
-	.id		= 0,
-	.dev		= {
-		.platform_data	= &scif0_platform_data,
-	},
-};
-
-/* SCIFA1 */
-static struct plat_sci_port scif1_platform_data = {
-	.mapbase	= 0xe6c50000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(101)),
-};
-
-static struct platform_device scif1_device = {
-	.name		= "sh-sci",
-	.id		= 1,
-	.dev		= {
-		.platform_data	= &scif1_platform_data,
-	},
-};
-
-/* SCIFA2 */
-static struct plat_sci_port scif2_platform_data = {
-	.mapbase	= 0xe6c60000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(102)),
-};
-
-static struct platform_device scif2_device = {
-	.name		= "sh-sci",
-	.id		= 2,
-	.dev		= {
-		.platform_data	= &scif2_platform_data,
-	},
-};
-
-/* SCIFA3 */
-static struct plat_sci_port scif3_platform_data = {
-	.mapbase	= 0xe6c70000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(103)),
-};
-
-static struct platform_device scif3_device = {
-	.name		= "sh-sci",
-	.id		= 3,
-	.dev		= {
-		.platform_data	= &scif3_platform_data,
-	},
-};
-
-/* SCIFA4 */
-static struct plat_sci_port scif4_platform_data = {
-	.mapbase	= 0xe6c80000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(104)),
-};
-
-static struct platform_device scif4_device = {
-	.name		= "sh-sci",
-	.id		= 4,
-	.dev		= {
-		.platform_data	= &scif4_platform_data,
-	},
-};
-
-/* SCIFA5 */
-static struct plat_sci_port scif5_platform_data = {
-	.mapbase	= 0xe6cb0000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(105)),
-};
-
-static struct platform_device scif5_device = {
-	.name		= "sh-sci",
-	.id		= 5,
-	.dev		= {
-		.platform_data	= &scif5_platform_data,
-	},
-};
-
-/* SCIFA6 */
-static struct plat_sci_port scif6_platform_data = {
-	.mapbase	= 0xe6cc0000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(106)),
-};
-
-static struct platform_device scif6_device = {
-	.name		= "sh-sci",
-	.id		= 6,
-	.dev		= {
-		.platform_data	= &scif6_platform_data,
-	},
-};
-
-/* SCIFA7 */
-static struct plat_sci_port scif7_platform_data = {
-	.mapbase	= 0xe6cd0000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFA,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(107)),
-};
-
-static struct platform_device scif7_device = {
-	.name		= "sh-sci",
-	.id		= 7,
-	.dev		= {
-		.platform_data	= &scif7_platform_data,
-	},
-};
-
-/* SCIFB */
-static struct plat_sci_port scifb_platform_data = {
-	.mapbase	= 0xe6c30000,
-	.flags		= UPF_BOOT_AUTOCONF,
-	.scscr		= SCSCR_RE | SCSCR_TE,
-	.scbrr_algo_id	= SCBRR_ALGO_4,
-	.type		= PORT_SCIFB,
-	.irqs		= SCIx_IRQ_MUXED(gic_spi(108)),
-};
+/* SCIF */
+#define R8A7740_SCIF(scif_type, index, baseaddr, irq)		\
+static struct plat_sci_port scif##index##_platform_data = {	\
+	.type		= scif_type,				\
+	.mapbase	= baseaddr,				\
+	.flags		= UPF_BOOT_AUTOCONF,			\
+	.irqs		= SCIx_IRQ_MUXED(irq),			\
+	.scbrr_algo_id	= SCBRR_ALGO_4,				\
+	.scscr		= SCSCR_RE | SCSCR_TE,			\
+};								\
+								\
+static struct platform_device scif##index##_device = {		\
+	.name		= "sh-sci",				\
+	.id		= index,				\
+	.dev		= {					\
+		.platform_data	= &scif##index##_platform_data,	\
+	},							\
+}
 
-static struct platform_device scifb_device = {
-	.name		= "sh-sci",
-	.id		= 8,
-	.dev		= {
-		.platform_data	= &scifb_platform_data,
-	},
-};
+R8A7740_SCIF(PORT_SCIFA, 0, 0xe6c40000, gic_spi(100));
+R8A7740_SCIF(PORT_SCIFA, 1, 0xe6c50000, gic_spi(101));
+R8A7740_SCIF(PORT_SCIFA, 2, 0xe6c60000, gic_spi(102));
+R8A7740_SCIF(PORT_SCIFA, 3, 0xe6c70000, gic_spi(103));
+R8A7740_SCIF(PORT_SCIFA, 4, 0xe6c80000, gic_spi(104));
+R8A7740_SCIF(PORT_SCIFA, 5, 0xe6cb0000, gic_spi(105));
+R8A7740_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(106));
+R8A7740_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(107));
+R8A7740_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(108));
 
 /* CMT */
 static struct sh_timer_config cmt10_platform_data = {
@@ -528,7 +395,7 @@ static struct platform_device *r8a7740_devices_dt[] __initdata = {
 	&scif5_device,
 	&scif6_device,
 	&scif7_device,
-	&scifb_device,
+	&scif8_device,
 	&cmt10_device,
 };
 
@@ -981,7 +848,7 @@ void __init r8a7740_add_standard_devices(void)
 	rmobile_add_device_to_domain("A3SP",	&scif5_device);
 	rmobile_add_device_to_domain("A3SP",	&scif6_device);
 	rmobile_add_device_to_domain("A3SP",	&scif7_device);
-	rmobile_add_device_to_domain("A3SP",	&scifb_device);
+	rmobile_add_device_to_domain("A3SP",	&scif8_device);
 	rmobile_add_device_to_domain("A3SP",	&i2c1_device);
 }
 
-- 
1.8.3.2


  parent reply	other threads:[~2013-11-19 14:02 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-19 14:02 [PATCH v3 00/29] Add OF support to the sh-sci serial port driver Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 01/29] serial: sh-sci: Sort headers alphabetically Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 02/29] serial: sh-sci: Remove baud rate calculation algorithm 5 Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 03/29] serial: sh-sci: Simplify baud rate calculation algorithms Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 04/29] serial: sh-sci: Remove duplicate interrupt check in verify port op Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 05/29] serial: sh-sci: Set the UPF_FIXED_PORT flag Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 06/29] serial: sh-sci: Don't check IRQ in verify port operation Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 07/29] serial: sh-sci: Support resources passed through platform resources Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 08/29] ARM: shmobile: sh7372: Use macros to declare SCIF devices Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 09/29] ARM: shmobile: sh73a0: " Laurent Pinchart
2013-11-19 14:02 ` Laurent Pinchart [this message]
2013-11-19 14:02 ` [PATCH v3 11/29] ARM: shmobile: r8a7779: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 12/29] ARM: shmobile: r7s72100: Don't define SCIF platform data in an array Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 13/29] ARM: shmobile: r8a73a4: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 14/29] ARM: shmobile: r8a7778: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 15/29] ARM: shmobile: r8a7790: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 16/29] ARM: shmobile: r8a7791: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 17/29] ARM: shmobile: sh7372: Declare SCIF register base and IRQ as resources Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 18/29] ARM: shmobile: sh73a0: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 19/29] ARM: shmobile: r7s72100: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 20/29] ARM: shmobile: r8a73a4: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 21/29] ARM: shmobile: r8a7740: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 22/29] ARM: shmobile: r8a7778: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 23/29] ARM: shmobile: r8a7779: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 24/29] ARM: shmobile: r8a7790: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 25/29] ARM: shmobile: r8a7791: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 26/29] sh: " Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 27/29] serial: sh-sci: Remove platform data mapbase and irqs fields Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 28/29] serial: sh-sci: Add device tree bindings documentation Laurent Pinchart
2013-11-19 14:02 ` [PATCH v3 29/29] serial: sh-sci: Add OF support Laurent Pinchart
2013-11-21  4:40 ` [PATCH v3 00/29] Add OF support to the sh-sci serial port driver Simon Horman
2013-11-21  7:17   ` Laurent Pinchart
2013-12-03 18:09     ` Greg KH
2013-12-03 18:28       ` Laurent Pinchart
2013-12-05  3:33         ` Simon Horman
2013-12-05  5:53           ` Laurent Pinchart
2013-12-05  7:03             ` Simon Horman
2013-12-05 10:13               ` Laurent Pinchart
2013-12-05 14:38                 ` Simon Horman
2013-12-09 18:59               ` Olof Johansson
2013-12-09 23:42                 ` Simon Horman
2013-12-10  1:03                   ` Laurent Pinchart
2013-12-20  1:48                   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384869751-9786-11-git-send-email-laurent.pinchart+renesas@ideasonboard.com \
    --to=laurent.pinchart+renesas@ideasonboard.com \
    --cc=hechtb+renesas@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).