aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-27 19:47:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-27 19:47:35 -0400
commit66f03c614c0902ccf7d6160459362a9352f33271 (patch)
treeb9a8864efe5aa7fc5c96cc5ccbeca41f5cd6f6a7 /drivers/tty
parent34800598b2eebe061445216473b1e4c2ff5cba99 (diff)
parentcdc3df6f44f72c5924a16a47e1663c3fb0e57820 (diff)
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull "ARM: device tree work" from Arnd Bergmann: "Most of these patches convert code from using static platform data to describing the hardware in the device tree. This is only the first half of the changes for v3.4 because a lot of patches for this topic came in the last week before the merge window. Signed-off-by: Arnd Bergmann <arnd@arndb.de>" Fix up trivial conflicts in arch/arm/mach-vexpress/{Kconfig,core.h} * tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (86 commits) Document: devicetree: add OF documents for arch-mmp ARM: dts: append DTS file of pxa168 ARM: mmp: append OF support on pxa168 ARM: mmp: enable rtc clk in pxa168 i2c: pxa: add OF support serial: pxa: add OF support arm/dts: mt_ventoux: very basic support for TeeJet Mt.Ventoux board ARM: OMAP2+: Remove extra ifdefs for board-generic ARM: OMAP2+: Fix build error when only ARCH_OMAP2/3 or 4 is selected ASoC: DT: Add digital microphone binding to PAZ00 board. ARM: dt: Add ARM PMU to tegra*.dtsi ARM: at91: at91sam9x5cm/dt: add leds support ARM: at91: usb_a9g20/dt: add gpio-keys support ARM: at91: at91sam9m10g45ek/dt: add gpio-keys support ARM: at91: at91sam9m10g45ek/dt: add leds support ARM: at91: usb_a9g20/dt: add leds support ARM: at91/pio: add new PIO3 features ARM: at91: add sam9_smc.o to at91sam9x5 build ARM: at91/tc/clocksource: Add 32 bit variant to Timer Counter ARM: at91/tc: add device tree support to atmel_tclib ...
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/atmel_serial.c2
-rw-r--r--drivers/tty/serial/pxa.c49
2 files changed, 39 insertions, 12 deletions
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 10605ecc99a..f9a6be7a9be 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1526,6 +1526,8 @@ void __init atmel_register_uart_fns(struct atmel_port_fns *fns)
1526 atmel_pops.set_wake = fns->set_wake; 1526 atmel_pops.set_wake = fns->set_wake;
1527} 1527}
1528 1528
1529struct platform_device *atmel_default_console_device; /* the serial console device */
1530
1529#ifdef CONFIG_SERIAL_ATMEL_CONSOLE 1531#ifdef CONFIG_SERIAL_ATMEL_CONSOLE
1530static void atmel_console_putchar(struct uart_port *port, int ch) 1532static void atmel_console_putchar(struct uart_port *port, int ch)
1531{ 1533{
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index e2fd3d8e0ab..5847a4b855f 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -36,6 +36,7 @@
36#include <linux/circ_buf.h> 36#include <linux/circ_buf.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/of.h>
39#include <linux/platform_device.h> 40#include <linux/platform_device.h>
40#include <linux/tty.h> 41#include <linux/tty.h>
41#include <linux/tty_flip.h> 42#include <linux/tty_flip.h>
@@ -44,6 +45,8 @@
44#include <linux/io.h> 45#include <linux/io.h>
45#include <linux/slab.h> 46#include <linux/slab.h>
46 47
48#define PXA_NAME_LEN 8
49
47struct uart_pxa_port { 50struct uart_pxa_port {
48 struct uart_port port; 51 struct uart_port port;
49 unsigned char ier; 52 unsigned char ier;
@@ -51,7 +54,7 @@ struct uart_pxa_port {
51 unsigned char mcr; 54 unsigned char mcr;
52 unsigned int lsr_break_flag; 55 unsigned int lsr_break_flag;
53 struct clk *clk; 56 struct clk *clk;
54 char *name; 57 char name[PXA_NAME_LEN];
55}; 58};
56 59
57static inline unsigned int serial_in(struct uart_pxa_port *up, int offset) 60static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)
@@ -781,6 +784,31 @@ static const struct dev_pm_ops serial_pxa_pm_ops = {
781}; 784};
782#endif 785#endif
783 786
787static struct of_device_id serial_pxa_dt_ids[] = {
788 { .compatible = "mrvl,pxa-uart", },
789 { .compatible = "mrvl,mmp-uart", },
790 {}
791};
792MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
793
794static int serial_pxa_probe_dt(struct platform_device *pdev,
795 struct uart_pxa_port *sport)
796{
797 struct device_node *np = pdev->dev.of_node;
798 int ret;
799
800 if (!np)
801 return 1;
802
803 ret = of_alias_get_id(np, "serial");
804 if (ret < 0) {
805 dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
806 return ret;
807 }
808 sport->port.line = ret;
809 return 0;
810}
811
784static int serial_pxa_probe(struct platform_device *dev) 812static int serial_pxa_probe(struct platform_device *dev)
785{ 813{
786 struct uart_pxa_port *sport; 814 struct uart_pxa_port *sport;
@@ -808,20 +836,16 @@ static int serial_pxa_probe(struct platform_device *dev)
808 sport->port.irq = irqres->start; 836 sport->port.irq = irqres->start;
809 sport->port.fifosize = 64; 837 sport->port.fifosize = 64;
810 sport->port.ops = &serial_pxa_pops; 838 sport->port.ops = &serial_pxa_pops;
811 sport->port.line = dev->id;
812 sport->port.dev = &dev->dev; 839 sport->port.dev = &dev->dev;
813 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 840 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
814 sport->port.uartclk = clk_get_rate(sport->clk); 841 sport->port.uartclk = clk_get_rate(sport->clk);
815 842
816 switch (dev->id) { 843 ret = serial_pxa_probe_dt(dev, sport);
817 case 0: sport->name = "FFUART"; break; 844 if (ret > 0)
818 case 1: sport->name = "BTUART"; break; 845 sport->port.line = dev->id;
819 case 2: sport->name = "STUART"; break; 846 else if (ret < 0)
820 case 3: sport->name = "HWUART"; break; 847 goto err_clk;
821 default: 848 snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
822 sport->name = "???";
823 break;
824 }
825 849
826 sport->port.membase = ioremap(mmres->start, resource_size(mmres)); 850 sport->port.membase = ioremap(mmres->start, resource_size(mmres));
827 if (!sport->port.membase) { 851 if (!sport->port.membase) {
@@ -829,7 +853,7 @@ static int serial_pxa_probe(struct platform_device *dev)
829 goto err_clk; 853 goto err_clk;
830 } 854 }
831 855
832 serial_pxa_ports[dev->id] = sport; 856 serial_pxa_ports[sport->port.line] = sport;
833 857
834 uart_add_one_port(&serial_pxa_reg, &sport->port); 858 uart_add_one_port(&serial_pxa_reg, &sport->port);
835 platform_set_drvdata(dev, sport); 859 platform_set_drvdata(dev, sport);
@@ -866,6 +890,7 @@ static struct platform_driver serial_pxa_driver = {
866#ifdef CONFIG_PM 890#ifdef CONFIG_PM
867 .pm = &serial_pxa_pm_ops, 891 .pm = &serial_pxa_pm_ops,
868#endif 892#endif
893 .of_match_table = serial_pxa_dt_ids,
869 }, 894 },
870}; 895};
871 896