Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] 5541/1: serial/amba-pl011.c: add support for the modified port found in Nomadik

The Nomadik 8815 SoC has a slightly modified version of the PL011 block.
The patch uses the different ID value as a key to select a vendor
structure that is used to keep track of the differences, as suggested
by Russell King.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Andrea Gallo <andrea.gallo@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Alessandro Rubini and committed by
Russell King
5926a295 c7f7ff17

+30 -3
+27 -3
drivers/serial/amba-pl011.c
··· 70 70 struct clk *clk; 71 71 unsigned int im; /* interrupt mask */ 72 72 unsigned int old_status; 73 + unsigned int ifls; /* vendor-specific */ 74 + }; 75 + 76 + /* There is by now at least one vendor with differing details, so handle it */ 77 + struct vendor_data { 78 + unsigned int ifls; 79 + unsigned int fifosize; 80 + }; 81 + 82 + static struct vendor_data vendor_arm = { 83 + .ifls = UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, 84 + .fifosize = 16, 85 + }; 86 + 87 + static struct vendor_data vendor_st = { 88 + .ifls = UART011_IFLS_RX_HALF|UART011_IFLS_TX_HALF, 89 + .fifosize = 64, 73 90 }; 74 91 75 92 static void pl011_stop_tx(struct uart_port *port) ··· 377 360 if (retval) 378 361 goto clk_dis; 379 362 380 - writew(UART011_IFLS_RX4_8|UART011_IFLS_TX4_8, 381 - uap->port.membase + UART011_IFLS); 363 + writew(uap->ifls, uap->port.membase + UART011_IFLS); 382 364 383 365 /* 384 366 * Provoke TX FIFO interrupt into asserting. ··· 748 732 static int pl011_probe(struct amba_device *dev, struct amba_id *id) 749 733 { 750 734 struct uart_amba_port *uap; 735 + struct vendor_data *vendor = id->data; 751 736 void __iomem *base; 752 737 int i, ret; 753 738 ··· 779 762 goto unmap; 780 763 } 781 764 765 + uap->ifls = vendor->ifls; 782 766 uap->port.dev = &dev->dev; 783 767 uap->port.mapbase = dev->res.start; 784 768 uap->port.membase = base; 785 769 uap->port.iotype = UPIO_MEM; 786 770 uap->port.irq = dev->irq[0]; 787 - uap->port.fifosize = 16; 771 + uap->port.fifosize = vendor->fifosize; 788 772 uap->port.ops = &amba_pl011_pops; 789 773 uap->port.flags = UPF_BOOT_AUTOCONF; 790 774 uap->port.line = i; ··· 830 812 { 831 813 .id = 0x00041011, 832 814 .mask = 0x000fffff, 815 + .data = &vendor_arm, 816 + }, 817 + { 818 + .id = 0x00380802, 819 + .mask = 0x00ffffff, 820 + .data = &vendor_st, 833 821 }, 834 822 { 0, 0 }, 835 823 };
+3
include/linux/amba/serial.h
··· 114 114 #define UART011_IFLS_TX4_8 (2 << 0) 115 115 #define UART011_IFLS_TX6_8 (3 << 0) 116 116 #define UART011_IFLS_TX7_8 (4 << 0) 117 + /* special values for ST vendor with deeper fifo */ 118 + #define UART011_IFLS_RX_HALF (5 << 3) 119 + #define UART011_IFLS_TX_HALF (5 << 0) 117 120 118 121 #define UART011_OEIM (1 << 10) /* overrun error interrupt mask */ 119 122 #define UART011_BEIM (1 << 9) /* break error interrupt mask */