aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 19:17:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 19:17:43 -0400
commit4f2d658b2f09c41677871a4285a09cf35f954dad (patch)
treeec0a626a598530203871bbc37a340224e5ac87ad /drivers/tty
parente66d637134b7045ea6f14bdd416cd3695f73ed42 (diff)
parent1fc5f7d5c680ac36bd41e13a3d77cbe2eaa312e0 (diff)
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm-soc device tree description updates from Arnd Bergmann: "This branch contains two kinds of updates: Some platforms in the process of getting converted to device tree based booting, and the platform specific patches necessary for that are included here. Other platforms are already converted, so we just need to update the actual device tree source files and the binding documents to add support for new board and new drivers. In the future we will probably separate those into two branches, and in the long run, the plan is to move the device tree source files out of the kernel repository, but that has to wait until we have completed a much larger portion of the binding documents." Fix up trivial conflicts in arch/arm/mach-imx/clk-imx6q.c due to newly added clkdev registers next to a few removed unnecessary ones. * tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (119 commits) ARM: LPC32xx: Add PWM to base dts file ARM: EXYNOS: mark the DMA channel binding for SPI as preliminary ARM: dts: Add nodes for spi controllers for SAMSUNG EXYNOS5 platforms ARM: EXYNOS: Enable platform support for SPI controllers for EXYNOS5 ARM: EXYNOS: Add spi clock support for EXYNOS5 ARM: dts: Add nodes for spi controllers for SAMSUNG EXYNOS4 platforms ARM: EXYNOS: Enable platform support for SPI controllers for EXYNOX4 ARM: EXYNOS: Fix the incorrect hierarchy of spi controller bus clock ARM: ux500: Remove PMU platform registration when booting with DT ARM: ux500: Remove temporary snowball_of_platform_devs enablement structure ARM: ux500: Ensure vendor specific properties have the vendor's identifier pinctrl: pinctrl-nomadik: Append sleepmode property with vendor specific prefixes ARM: ux500: Move rtc-pl031 registration to Device Tree when enabled ARM: ux500: Enable the AB8500 RTC for all DT:ed DB8500 based devices ARM: ux500: Correctly reference IRQs supplied by the AB8500 from Device Tree ARM: ux500: Apply ab8500-debug node do the db8500 DT structure ARM: ux500: Add a ab8500-usb Device Tree node for db8500 based devices ARM: ux500: Add db8500 Device Tree node for misc/ab8500-pwm ARM: ux500: Add db8500 Device Tree node for ab8500-sysctrl ARM: ux500: Enable LED heartbeat functionality on Snowbal via DT ...
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/mxs-auart.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index ec56d8397aae..2e341b81ff89 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -33,6 +33,7 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/pinctrl/consumer.h> 35#include <linux/pinctrl/consumer.h>
36#include <linux/of_device.h>
36 37
37#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
38 39
@@ -675,6 +676,30 @@ static struct uart_driver auart_driver = {
675#endif 676#endif
676}; 677};
677 678
679/*
680 * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it
681 * could successfully get all information from dt or a negative errno.
682 */
683static int serial_mxs_probe_dt(struct mxs_auart_port *s,
684 struct platform_device *pdev)
685{
686 struct device_node *np = pdev->dev.of_node;
687 int ret;
688
689 if (!np)
690 /* no device tree device */
691 return 1;
692
693 ret = of_alias_get_id(np, "serial");
694 if (ret < 0) {
695 dev_err(&pdev->dev, "failed to get alias id: %d\n", ret);
696 return ret;
697 }
698 s->port.line = ret;
699
700 return 0;
701}
702
678static int __devinit mxs_auart_probe(struct platform_device *pdev) 703static int __devinit mxs_auart_probe(struct platform_device *pdev)
679{ 704{
680 struct mxs_auart_port *s; 705 struct mxs_auart_port *s;
@@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)
689 goto out; 714 goto out;
690 } 715 }
691 716
717 ret = serial_mxs_probe_dt(s, pdev);
718 if (ret > 0)
719 s->port.line = pdev->id < 0 ? 0 : pdev->id;
720 else if (ret < 0)
721 goto out_free;
722
692 pinctrl = devm_pinctrl_get_select_default(&pdev->dev); 723 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
693 if (IS_ERR(pinctrl)) { 724 if (IS_ERR(pinctrl)) {
694 ret = PTR_ERR(pinctrl); 725 ret = PTR_ERR(pinctrl);
@@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)
711 s->port.membase = ioremap(r->start, resource_size(r)); 742 s->port.membase = ioremap(r->start, resource_size(r));
712 s->port.ops = &mxs_auart_ops; 743 s->port.ops = &mxs_auart_ops;
713 s->port.iotype = UPIO_MEM; 744 s->port.iotype = UPIO_MEM;
714 s->port.line = pdev->id < 0 ? 0 : pdev->id;
715 s->port.fifosize = 16; 745 s->port.fifosize = 16;
716 s->port.uartclk = clk_get_rate(s->clk); 746 s->port.uartclk = clk_get_rate(s->clk);
717 s->port.type = PORT_IMX; 747 s->port.type = PORT_IMX;
@@ -728,7 +758,7 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)
728 758
729 platform_set_drvdata(pdev, s); 759 platform_set_drvdata(pdev, s);
730 760
731 auart_port[pdev->id] = s; 761 auart_port[s->port.line] = s;
732 762
733 mxs_auart_reset(&s->port); 763 mxs_auart_reset(&s->port);
734 764
@@ -769,12 +799,19 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev)
769 return 0; 799 return 0;
770} 800}
771 801
802static struct of_device_id mxs_auart_dt_ids[] = {
803 { .compatible = "fsl,imx23-auart", },
804 { /* sentinel */ }
805};
806MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);
807
772static struct platform_driver mxs_auart_driver = { 808static struct platform_driver mxs_auart_driver = {
773 .probe = mxs_auart_probe, 809 .probe = mxs_auart_probe,
774 .remove = __devexit_p(mxs_auart_remove), 810 .remove = __devexit_p(mxs_auart_remove),
775 .driver = { 811 .driver = {
776 .name = "mxs-auart", 812 .name = "mxs-auart",
777 .owner = THIS_MODULE, 813 .owner = THIS_MODULE,
814 .of_match_table = mxs_auart_dt_ids,
778 }, 815 },
779}; 816};
780 817
@@ -807,3 +844,4 @@ module_init(mxs_auart_init);
807module_exit(mxs_auart_exit); 844module_exit(mxs_auart_exit);
808MODULE_LICENSE("GPL"); 845MODULE_LICENSE("GPL");
809MODULE_DESCRIPTION("Freescale MXS application uart driver"); 846MODULE_DESCRIPTION("Freescale MXS application uart driver");
847MODULE_ALIAS("platform:mxs-auart");