Skip to contentSkip to conversation

ARM: sa1100: refactor sa1100 serial driver

PATCH New Jochen Friedrich 3 participants 6 messages Nov 20, 2011 – Nov 21, 2011

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

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

- move pin initialization into board files
- make use of resources in platform device
rather than hardcoding them in the driver
- add DT support

---
 .../devicetree/bindings/tty/serial/sa1100-uart.txt |   20 ++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 arch/arm/include/asm/mach/serial_sa1100.h          |    5 +-
 arch/arm/mach-sa1100/badge4.c                      |    3 +
 arch/arm/mach-sa1100/cerf.c                        |    3 +
 arch/arm/mach-sa1100/collie.c                      |    2 +
 arch/arm/mach-sa1100/generic.c                     |   85 +++++++-
 arch/arm/mach-sa1100/generic.h                     |    2 +
 arch/arm/mach-sa1100/h3xxx.c                       |    3 +-
 arch/arm/mach-sa1100/hackkit.c                     |    3 +
 arch/arm/mach-sa1100/jornada720.c                  |    3 +
 arch/arm/mach-sa1100/lart.c                        |    3 +
 arch/arm/mach-sa1100/pleb.c                        |    3 +
 arch/arm/mach-sa1100/shannon.c                     |    3 +
 arch/arm/mach-sa1100/simpad.c                      |    5 +-
 drivers/tty/serial/sa1100.c                        |  240 +++++++++++---------
 16 files changed, 261 insertions(+), 123 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/tty/serial/sa1100-uart.txt
Documentation/devicetree/bindings/tty/serial/sa1100-uart.txt new file +20 -0
new file mode 100644
index 0000000..3dc76ca
@@ -0,0 +1,20 @@
+* SA11x0 Universal Asynchronous Receiver/Transmitter (UART)
+
+Required properties:
+- compatible: Should be "intel,<chip>-uart"
+  The compatible <chip> indicated will be the first SoC to support an
+  additional mode or an UART new feature.
+- reg: Should contain registers location and length
+- interrupts: Should contain interrupt
+
+<chip> compatible description:
+- sa1100: generic UART implementation for SA11x0 SoCs
+
+Example:
+
+	uart0: serial at 0x80010000 {
+		compatible = "intel,sa1100-uart";
+		reg = <0x80010000 0x24>;
+		interrupts = <15>;
+	};
+
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index e855278..5b14518 100644
@@ -19,6 +19,7 @@ gef	GE Fanuc Intelligent Platforms Embedded Systems, Inc.
 hp	Hewlett Packard
 ibm	International Business Machines (IBM)
 idt	Integrated Device Technologies, Inc.
+intel	Intel
 intercontrol	Inter Control Group
 linux	Linux-specific binding
 marvell	Marvell Technology Group Ltd.
arch/arm/include/asm/mach/serial_sa1100.h +2 -3
index d09064b..8305ab5 100644
@@ -9,7 +9,6 @@
  */
 
 struct uart_port;
-struct uart_info;
 
 /*
  * This is a temporary structure for registering these
@@ -22,10 +21,10 @@ struct sa1100_port_fns {
 	int	(*set_wake)(struct uart_port *, u_int);
 };
 
+struct platform_device *sa1100_get_uart(int id);
+
 #ifdef CONFIG_SERIAL_SA1100
 void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
-void sa1100_register_uart(int idx, int port);
 #else
 #define sa1100_register_uart_fns(fns) do { } while (0)
-#define sa1100_register_uart(idx,port) do { } while (0)
 #endif
arch/arm/mach-sa1100/badge4.c +3 -0
index bda83e1..505645e 100644
@@ -296,6 +296,9 @@ static void __init badge4_map_io(void)
 	sa1100_map_io();
 	iotable_init(badge4_io_desc, ARRAY_SIZE(badge4_io_desc));
 
+	PPDR |= PPC_TXD1 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
 	sa1100_register_uart_fns(&badge4_port_fns);
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
arch/arm/mach-sa1100/cerf.c +3 -0
index 7f3da4b..a626790 100644
@@ -113,6 +113,9 @@ static void __init cerf_map_io(void)
 	sa1100_map_io();
 	iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
 
+	PPDR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
 	sa1100_register_uart(2, 1);
arch/arm/mach-sa1100/collie.c +2 -0
index 2965cc9..7a17703 100644
@@ -330,6 +330,8 @@ static void __init collie_init(void)
 		PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
 		PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
 
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
 	PWER = _COLLIE_GPIO_AC_IN | _COLLIE_GPIO_CO | _COLLIE_GPIO_ON_KEY |
 		_COLLIE_GPIO_WAKEUP | _COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
 
arch/arm/mach-sa1100/generic.c +78 -7

127 lines not on this page · raw message

arch/arm/mach-sa1100/generic.h +2 -0
index b7a9a60..d5a51d0 100644
@@ -39,3 +39,5 @@ void sa11x0_register_irda(struct irda_platform_data *irda);
 
 struct mcp_plat_data;
 void sa11x0_register_mcp(struct mcp_plat_data *data);
+
+extern void sa1100_register_uart(int hw, int id);
arch/arm/mach-sa1100/h3xxx.c +2 -1
index b0784c9..f3c3ba9 100644
@@ -299,7 +299,8 @@ void __init h3xxx_map_io(void)
 //	sa1100_register_uart(1, 1); /* Microcontroller on 3100/3600 */
 
 	/* Ensure those pins are outputs and driving low  */
-	PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
+	PPDR |= PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
+	PPSR |= PPC_TXD3;
 	PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
 
 	/* Configure suspend conditions */
arch/arm/mach-sa1100/hackkit.c +3 -0
index 30f4a55..e852a87 100644
@@ -80,6 +80,9 @@ static void __init hackkit_map_io(void)
 	sa1100_map_io();
 	iotable_init(hackkit_io_desc, ARRAY_SIZE(hackkit_io_desc));
 
+	PPDR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+
 	sa1100_register_uart_fns(&hackkit_port_fns);
 	sa1100_register_uart(0, 1);	/* com port */
 	sa1100_register_uart(1, 2);
arch/arm/mach-sa1100/jornada720.c +3 -0
index 77198fe..d99e00a 100644
@@ -297,6 +297,9 @@ static void __init jornada720_map_io(void)
 	sa1100_map_io();
 	iotable_init(jornada720_io_desc, ARRAY_SIZE(jornada720_io_desc));
 
+	PPDR |= PPC_TXD1 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 }
arch/arm/mach-sa1100/lart.c +3 -0
index 5bc59d0..a8fae5b 100644
@@ -50,6 +50,9 @@ static void __init lart_map_io(void)
 	sa1100_map_io();
 	iotable_init(lart_io_desc, ARRAY_SIZE(lart_io_desc));
 
+	PPDR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD2 | PPC_TXD3;
+
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 	sa1100_register_uart(2, 2);
arch/arm/mach-sa1100/pleb.c +3 -0
index 65161f2..b8fced0 100644
@@ -121,6 +121,9 @@ static void __init pleb_map_io(void)
 {
 	sa1100_map_io();
 
+	PPDR |= PPC_TXD1 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 
arch/arm/mach-sa1100/shannon.c +3 -0
index 1cccbf5..84f5b14 100644
@@ -67,6 +67,9 @@ static void __init shannon_map_io(void)
 {
 	sa1100_map_io();
 
+	PPDR |= PPC_TXD1 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 
arch/arm/mach-sa1100/simpad.c +4 -1
index 4790f3f..d3c9d2b 100644
@@ -206,7 +206,10 @@ static void __init simpad_map_io(void)
 		RS232_ON | ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
 	__simpad_write_cs3(); /* Spinlocks not yet initialized */
 
-        sa1100_register_uart_fns(&simpad_port_fns);
+	PPDR |= PPC_TXD1 | PPC_TXD3;
+	PPSR |= PPC_TXD1 | PPC_TXD3;
+
+	sa1100_register_uart_fns(&simpad_port_fns);
 	sa1100_register_uart(0, 3);  /* serial interface */
 	sa1100_register_uart(1, 1);  /* DECT             */
 
drivers/tty/serial/sa1100.c +129 -111

378 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

Quoted 4 lines · Jochen Friedrich

- move pin initialization into board files
- make use of resources in platform device
rather than hardcoding them in the driver
- add DT support

trivia:

arch/arm/mach-sa1100/generic.c

Quoted 1 line
arch/arm/mach-sa1100/generic.c +0 -0

[]

arch/arm/mach-sa1100/generic.c static struct platform_device sa11x0udc_device = { · line 169

Quoted 6 lines
arch/arm/mach-sa1100/generic.c +1 -1
@@ -166,7 +166,7 @@ static struct platform_device sa11x0udc_device = {
 static struct resource sa11x0uart1_resources[] = {
 	[0] = {
 		.start	= __PREG(Ser1UTCR0),
-		.end	= __PREG(Ser1UTCR0) + 0xffff,
+		.end	= __PREG(Ser1UTCR0) + 0x24,

#define for 0x24? or is it really 0x23?
(start + size - 1)

arch/arm/mach-sa1100/generic.c static struct resource sa11x0uart1_resources[] = {

Quoted 1 line
arch/arm/mach-sa1100/generic.c +0 -0
@@ -178,15 +178,35 @@ static struct resource sa11x0uart1_resources[] = {

[]

arch/arm/mach-sa1100/generic.c static struct resource sa11x0uart1_resources[] = { · line 189

Quoted 4 lines
arch/arm/mach-sa1100/generic.c +4 -0
+static struct resource sa11x0uart2_resources[] = {
+	[0] = {
+		.start	= __PREG(Ser2UTCR0),
+		.end	= __PREG(Ser2UTCR0) + 0x24,

here too

arch/arm/mach-sa1100/generic.c static struct resource sa11x0uart1_resources[] = { · line 209

Quoted 12 lines
arch/arm/mach-sa1100/generic.c +8 -1
+static struct platform_device sa11x0uart2_device = {
+	.name		= "sa11x0-uart",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(sa11x0uart2_resources),
+	.resource	= sa11x0uart2_resources,
+};
+
 static struct resource sa11x0uart3_resources[] = {
 	[0] = {
 		.start	= __PREG(Ser3UTCR0),
-		.end	= __PREG(Ser3UTCR0) + 0xffff,
+		.end	= __PREG(Ser3UTCR0) + 0x24,

etc

#2 lore raw

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

Quoted 7 lines · Joe Perches
Quoted 4 lines · Jochen Friedrich

- move pin initialization into board files
- make use of resources in platform device
rather than hardcoding them in the driver
- add DT support

trivia:

I get these bounce messages a lot.
Any clue how to resolve them?

Failed to deliver to 'jochen at scram.de'
SMTP module(domain @206.117.179.246:scram.de) reports:
return-path address <[email protected]> rejected by mail1.scram.de:
?c?s?1
0 U
TR10U
ANKARA1V0TU

Failed to deliver to 'devicetree-discuss at lists.ozlabs.org' SMTP module(domain @206.117.179.246:lists.ozlabs.org) reports:
return-path address <[email protected]> rejected by mx.ozlabs.org:
aat der Nederlanden1+0)U
"Staat der Nederlanden Root CA - G2

#3 lore raw

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

Hi Joe,

Quoted 7 lines

I get these bounce messages a lot.
Any clue how to resolve them?

Failed to deliver to 'jochen at scram.de'
SMTP module(domain @206.117.179.246:scram.de) reports:
return-path address<[email protected]> rejected by mail1.scram.de:
?c?s?1

0 U
TR10U
ANKARA1V0TU

This seems to be TLS related:

Nov 20 21:47:51 amavis postfix/smtpd[9708]: connect from perches-mx.perches.com[206.117.179.246]
Nov 20 21:47:51 amavis postfix/smtpd[9708]: setting up TLS connection from perches-mx.perches.com[206.117.179.246]
Nov 20 21:47:53 amavis postfix/smtpd[9708]: SSL_accept error from perches-mx.perches.com[206.117.179.246]: 0
Nov 20 21:47:53 amavis postfix/smtpd[9708]: warning: TLS library problem: 9708:error:1409441A:SSL routines:SSL3_READ_BYTES:tlsv1 alert decode error:s3_pkt.c:1086:SSL alert number 50:
Nov 20 21:47:53 amavis postfix/smtpd[9708]: lost connection after STARTTLS from perches-mx.perches.com[206.117.179.246]
Nov 20 21:47:53 amavis postfix/smtpd[9708]: disconnect from perches-mx.perches.com[206.117.179.246]
Nov 20 21:47:53 amavis postfix/smtpd[13209]: connect from unknown[188.48.229.10]

Thanks,
Jochen

#4 lore raw

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

In reply to Joe Perches

Hi Joe,

Quoted 4 lines

trivia:

arch/arm/mach-sa1100/generic.c

Quoted 1 line
arch/arm/mach-sa1100/generic.c +0 -0

[]

Quoted 9 lines

arch/arm/mach-sa1100/generic.c static struct platform_device sa11x0udc_device = { · line 169

Quoted 6 lines
arch/arm/mach-sa1100/generic.c +1 -1
@@ -166,7 +166,7 @@ static struct platform_device sa11x0udc_device = {
  static struct resource sa11x0uart1_resources[] = {
  	[0] = {
  		.start	= __PREG(Ser1UTCR0),
-		.end	= __PREG(Ser1UTCR0) + 0xffff,
+		.end	= __PREG(Ser1UTCR0) + 0x24,

#define for 0x24? or is it really 0x23?
(start + size - 1)

Thanks, I'll fix this.

Jochen.

#5 lore raw

PATCH 1/1 ARM: sa1100: refactor sa1100 serial driver

Quoted 16 lines · Jochen Friedrich

Hi Joe,

Quoted 4 lines

trivia:

arch/arm/mach-sa1100/generic.c

Quoted 1 line
arch/arm/mach-sa1100/generic.c +0 -0

[]

Quoted 9 lines

arch/arm/mach-sa1100/generic.c static struct platform_device sa11x0udc_device = { · line 169

Quoted 6 lines
arch/arm/mach-sa1100/generic.c +1 -1
@@ -166,7 +166,7 @@ static struct platform_device sa11x0udc_device = {
 static struct resource sa11x0uart1_resources[] = {
 	[0] = {
 		.start	= __PREG(Ser1UTCR0),
-		.end	= __PREG(Ser1UTCR0) + 0xffff,
+		.end	= __PREG(Ser1UTCR0) + 0x24,

#define for 0x24? or is it really 0x23?
(start + size - 1)

Quoted 1 line

Thanks, I'll fix this.

It may even be worth looking at the DEFINE_RES_MEM() type macros in include/linux/ioport.h, but I'm not sure that's essential!

Jamie