Skip to contentSkip to conversation

8250: add Texas Instruments AR7 internal UART

PATCH In review Florian Fainelli 3 participants 9 messages Jun 4, 2009 – Jun 14, 2009

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

PATCH 8/8 8250: add Texas Instruments AR7 internal UART

Hi Alan,

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks ! --
From: Florian Fainelli <[email protected]>

This patch adds support for Texas Instruments AR7 internal UART.

---

drivers/serial/8250.c +7 -0
index a0127e9..fb867a9 100644
@@ -287,6 +287,13 @@ static const struct serial8250_config uart_config[] = {
 		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
 		.flags		= UART_CAP_FIFO,
 	},
+	[PORT_AR7] = {
+		.name		= "AR7",
+		.fifo_size	= 16,
+		.tx_loadsz	= 16,
+		.fcr		= UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00,
+		.flags		= UART_CAP_FIFO | UART_CAP_AFE,
+	},
 };
 
 #if defined (CONFIG_SERIAL_8250_AU1X00)
include/linux/serial_core.h +2 -1
index 57a97e5..48766ea 100644
@@ -41,7 +41,8 @@
 #define PORT_XSCALE	15
 #define PORT_RM9000	16	/* PMC-Sierra RM9xxx internal UART */
 #define PORT_OCTEON	17	/* Cavium OCTEON internal UART */
-#define PORT_MAX_8250	17	/* max port ID */
+#define PORT_AR7	18	/* Texas Instruments AR7 internal UART */
+#define PORT_MAX_8250	18	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
#1 lore raw
Quoted 3 lines · Florian Fainelli

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]
#2 lore raw

Hallo Thomas,

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 7 lines · Florian Fainelli
Quoted 3 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

That specific patch just adds an AR7 port to the 8250 uart driver. My TNETD7300 really needs patching in the 8250 driver to work properly, Alan already suggested to perform some testing. I still think there is a HW bug with different silicon revisions.

Signature · 8 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
In reply to Thomas Bogendoerfer

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 7 lines · Florian Fainelli
Quoted 3 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Got to test with defining the UART type as a PORT_16550 and use UPIO_MEM32 instead of UPIO_MEM.

Signature · 8 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to Thomas Bogendoerfer

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 7 lines · Florian Fainelli
Quoted 3 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Could you show me how you register the 8250 driver ? Without the 8250-specific patch, here is the kind of output that I get:

[snip]
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x8610e00 (irq = 15) is a 16550 console handover: boot [early0] -> real [ttyS0]
serial8250: tyyS1 atMMMIO 088610f0 (irq 16) is a 16550
Fixed MDIOBBus: poobed
phymmap plttform flash device: 00000000 tt 10000000 physaap-flash.0: Found 1 x1 devicss at 000 in 1--bit bnnk [/snip]

Signature · 8 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw
Quoted 10 lines · Florian Fainelli

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 7 lines · Florian Fainelli
Quoted 3 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Could you show me how you register the 8250 driver ? Without the 8250-specific

static struct plat_serial8250_port uart0_data = {
        .mapbase = AR7_REGS_UART0,
        .irq = AR7_IRQ_UART0,
        .regshift = 2,
        .iotype = UPIO_MEM,
        .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
};
        uart_port[0].type = PORT_16550A;
        uart_port[0].line = 0;
        uart_port[0].irq = AR7_IRQ_UART0;
        uart_port[0].uartclk = ar7_bus_freq() / 2;
        uart_port[0].iotype = UPIO_MEM;
        uart_port[0].mapbase = AR7_REGS_UART0 + 3;
        uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
        uart_port[0].regshift = 2;
        res = early_serial_setup(&uart_port[0]);
        if (res)
                return res;

the +3 comes from the fact, that this machine is configured to run big endian.

Here is the boot log:

Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x8610e03 (irq = 15) is a 16550A console handover: boot [early0] -> real [ttyS0]
serial8250: ttyS1 at MMIO 0x8610f00 (irq = 19) is a 16550A
loop: module loaded
Fixed MDIO Bus: probed

ttyS1 uses the wrong address, but there is nothing connected to that port on the box.

Do you see the problem on TNETD7200 devices as well ?

Thomas.

Signature · 6 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                                [ RFC1925, 2.3 ]
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw
Quoted 34 lines · In gmane.linux.ports.mips.general Thomas Bogendoerfer
Quoted 10 lines · Florian Fainelli

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 7 lines · Florian Fainelli
Quoted 3 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Could you show me how you register the 8250 driver ? Without the 8250-specific

static struct plat_serial8250_port uart0_data = {
       .mapbase = AR7_REGS_UART0,
       .irq = AR7_IRQ_UART0,
       .regshift = 2,
       .iotype = UPIO_MEM,
       .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
};
       uart_port[0].type = PORT_16550A;
       uart_port[0].line = 0;
       uart_port[0].irq = AR7_IRQ_UART0;
       uart_port[0].uartclk = ar7_bus_freq() / 2;
       uart_port[0].iotype = UPIO_MEM;
       uart_port[0].mapbase = AR7_REGS_UART0 + 3;
       uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
       uart_port[0].regshift = 2;
       res = early_serial_setup(&uart_port[0]);
       if (res)
               return res;
Quoted 3 lines

the +3 comes from the fact, that this machine is configured to run big endian.

Alternatively you could not use the byte ordering macro/functions as per the 'Byte Order' section in:

http://lwn.net/images/pdf/LDD3/ch11.pdf

Makes the code portable, understandable and...well neater.

Cheers

Signature · 2 lines
Alexander Clouter
.sigmonster says: Life is like a diaper -- short and loaded.
#7 lore raw

Hi,

Quoted 25 lines · Alexander Clouter
Quoted 22 lines
static struct plat_serial8250_port uart0_data = {
       .mapbase = AR7_REGS_UART0,
       .irq = AR7_IRQ_UART0,
       .regshift = 2,
       .iotype = UPIO_MEM,
       .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
};
       uart_port[0].type = PORT_16550A;
       uart_port[0].line = 0;
       uart_port[0].irq = AR7_IRQ_UART0;
       uart_port[0].uartclk = ar7_bus_freq() / 2;
       uart_port[0].iotype = UPIO_MEM;
       uart_port[0].mapbase = AR7_REGS_UART0 + 3;
       uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
       uart_port[0].regshift = 2;
       res = early_serial_setup(&uart_port[0]);
       if (res)
               return res;
Quoted 3 lines

the +3 comes from the fact, that this machine is configured to run big endian.

Quoted 7 lines

Alternatively you could not use the byte ordering macro/functions as per the 'Byte Order' section in:

http://lwn.net/images/pdf/LDD3/ch11.pdf

Makes the code portable, understandable and...well neater.

Maybe not, scrap that :)

Cheers

Signature · 3 lines
Alexander Clouter
.sigmonster says: "MOKE DAT YIGARETTE"
                  		-- "The Last Coin", James P. Blaylock
#8 lore raw
In reply to Thomas Bogendoerfer

Le Thursday 11 June 2009 11:30:22 Thomas Bogendoerfer, vous avez écrit :

Quoted 48 lines · Florian Fainelli
Quoted 7 lines

Le Friday 05 June 2009 00:20:20 Thomas Bogendoerfer, vous avez écrit :

Quoted 6 lines · Florian Fainelli
Quoted 4 lines

We discussed that in private, there are a couple of things to fix in order to get 8250 working properly with TI AR7 HW. If you can still merge that bit, this would ease future work, thanks !

Quoted 5 lines
Quoted 2 lines

I still have a tree here, which works without any changes to the 8250 serial driver on a TNETD7300 device.

Could you show me how you register the 8250 driver ? Without the 8250-specific

static struct plat_serial8250_port uart0_data = {
        .mapbase = AR7_REGS_UART0,
        .irq = AR7_IRQ_UART0,
        .regshift = 2,
        .iotype = UPIO_MEM,
        .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
};
        uart_port[0].type = PORT_16550A;
        uart_port[0].line = 0;
        uart_port[0].irq = AR7_IRQ_UART0;
        uart_port[0].uartclk = ar7_bus_freq() / 2;
        uart_port[0].iotype = UPIO_MEM;
        uart_port[0].mapbase = AR7_REGS_UART0 + 3;
        uart_port[0].membase = ioremap(uart_port[0].mapbase, 256);
        uart_port[0].regshift = 2;
        res = early_serial_setup(&uart_port[0]);
        if (res)
                return res;

the +3 comes from the fact, that this machine is configured to run big endian.

Here is the boot log:

Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
serial8250: ttyS0 at MMIO 0x8610e03 (irq = 15) is a 16550A console handover: boot [early0] -> real [ttyS0]
serial8250: ttyS1 at MMIO 0x8610f00 (irq = 19) is a 16550A
loop: module loaded
Fixed MDIO Bus: probed

Quoted 4 lines

ttyS1 uses the wrong address, but there is nothing connected to that port on the box.

Do you see the problem on TNETD7200 devices as well ?

I no longer have TNETD7200 devices to test on unfortunately.

What I just found is that TNETD7300GDU revision 5 does not have this bug, while TNETD7300GDU revision 4 has. This seems to confirm the HW bug hypothesis. Let's just clean the serial console registration and we will keep in OpenWrt the 8250 workaround for older TNETD7300 revisions.

Signature · 8 lines
Best regards, Florian Fainelli
Email : [email protected]
http://openwrt.org
-------------------------------
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html