* [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing [not found] <1339774557-23588-1-git-send-email-fabio.estevam@freescale.com> @ 2012-06-15 15:35 ` Fabio Estevam 2012-06-15 15:48 ` Marek Vasut 2012-06-15 16:06 ` Shawn Guo 2012-06-18 13:06 ` [PATCH v4 " Fabio Estevam 1 sibling, 2 replies; 17+ messages in thread From: Fabio Estevam @ 2012-06-15 15:35 UTC (permalink / raw) To: linux-arm-kernel Cc: shawn.guo, kernel, marex, matt, snijsure, rob.herring, Fabio Estevam, Grant Likely, Alan Cox, linux-serial Allow device tree probing. Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Alan Cox <alan@linux.intel.com> Cc: <linux-serial@vger.kernel.org> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- Changes since v2: - Change compatible string - Add aliases information in bindings doc - Remove unneeded mxs_auart_probe_pdev function - Remove "ifdef CONFIG_OF" - Remove of_match_ptr wrapper Changes since v1: - Merged patches 3 and 5 from v1 into this one .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++ drivers/tty/serial/mxs-auart.c | 49 +++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt new file mode 100644 index 0000000..2ee903f --- /dev/null +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt @@ -0,0 +1,27 @@ +* Freescale MXS Application UART (AUART) + +Required properties: +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include + imx23 and imx28. +- reg : Address and length of the register set for the device +- interrupts : Should contain the auart interrupt numbers + +Example: +auart0: serial@8006a000 { + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; + reg = <0x8006a000 0x2000>; + interrupts = <112 70 71>; +}; + +Note: Each auart port should have an alias correctly numbered in "aliases" +node. + +Example: + +aliases { + serial0 = &auart0; + serial1 = &auart1; + serial2 = &auart2; + serial3 = &auart3; + serial4 = &auart4; +}; diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index ec56d83..87bbe9c 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -33,6 +33,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <linux/pinctrl/consumer.h> +#include <linux/of_device.h> #include <asm/cacheflush.h> @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { #endif }; +/* + * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it + * could successfully get all information from dt or a negative errno. + */ +static int serial_mxs_probe_dt(struct mxs_auart_port *s, + struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + int ret; + + if (!np) + /* no device tree device */ + return 1; + + ret = of_alias_get_id(np, "serial"); + if (ret < 0) { + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); + return ret; + } + s->port.line = ret; + + return 0; +} + static int __devinit mxs_auart_probe(struct platform_device *pdev) { struct mxs_auart_port *s; @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) goto out; } + ret = serial_mxs_probe_dt(s, pdev); + if (ret > 0) + s->port.line = pdev->id < 0 ? 0 : pdev->id; + else if (ret < 0) + goto out_free; + pinctrl = devm_pinctrl_get_select_default(&pdev->dev); if (IS_ERR(pinctrl)) { ret = PTR_ERR(pinctrl); @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) s->port.membase = ioremap(r->start, resource_size(r)); s->port.ops = &mxs_auart_ops; s->port.iotype = UPIO_MEM; - s->port.line = pdev->id < 0 ? 0 : pdev->id; s->port.fifosize = 16; s->port.uartclk = clk_get_rate(s->clk); s->port.type = PORT_IMX; @@ -769,13 +799,29 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev) return 0; } +static struct platform_device_id mxs_auart_devtype[] = { + { + .name = "mxs-auart", + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); + +static struct of_device_id mxs_auart_dt_ids[] = { + { .compatible = "fsl,imx23-auart", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); + static struct platform_driver mxs_auart_driver = { .probe = mxs_auart_probe, .remove = __devexit_p(mxs_auart_remove), .driver = { .name = "mxs-auart", .owner = THIS_MODULE, + .of_match_table = mxs_auart_dt_ids, }, + .id_table = mxs_auart_devtype, }; static int __init mxs_auart_init(void) @@ -807,3 +853,4 @@ module_init(mxs_auart_init); module_exit(mxs_auart_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Freescale MXS application uart driver"); +MODULE_ALIAS("platform:mxs-auart"); -- 1.7.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 15:35 ` [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing Fabio Estevam @ 2012-06-15 15:48 ` Marek Vasut 2012-06-15 16:06 ` Shawn Guo 1 sibling, 0 replies; 17+ messages in thread From: Marek Vasut @ 2012-06-15 15:48 UTC (permalink / raw) To: Fabio Estevam Cc: linux-arm-kernel, shawn.guo, kernel, matt, snijsure, rob.herring, Grant Likely, Alan Cox, linux-serial Dear Fabio Estevam, > Allow device tree probing. > > Cc: Grant Likely <grant.likely@secretlab.ca> > Cc: Rob Herring <rob.herring@calxeda.com> > Cc: Alan Cox <alan@linux.intel.com> > Cc: <linux-serial@vger.kernel.org> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> > --- > Changes since v2: > - Change compatible string > - Add aliases information in bindings doc > - Remove unneeded mxs_auart_probe_pdev function > - Remove "ifdef CONFIG_OF" > - Remove of_match_ptr wrapper > Changes since v1: > - Merged patches 3 and 5 from v1 into this one > .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++ > drivers/tty/serial/mxs-auart.c | 49 > +++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletions(-) > create mode 100644 > Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > > diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt new file > mode 100644 > index 0000000..2ee903f > --- /dev/null > +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > @@ -0,0 +1,27 @@ > +* Freescale MXS Application UART (AUART) > + > +Required properties: > +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include > + imx23 and imx28. > +- reg : Address and length of the register set for the device > +- interrupts : Should contain the auart interrupt numbers > + > +Example: > +auart0: serial@8006a000 { > + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; > + reg = <0x8006a000 0x2000>; > + interrupts = <112 70 71>; > +}; > + > +Note: Each auart port should have an alias correctly numbered in "aliases" > +node. > + > +Example: > + > +aliases { > + serial0 = &auart0; > + serial1 = &auart1; > + serial2 = &auart2; > + serial3 = &auart3; > + serial4 = &auart4; > +}; > diff --git a/drivers/tty/serial/mxs-auart.c > b/drivers/tty/serial/mxs-auart.c index ec56d83..87bbe9c 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -33,6 +33,7 @@ > #include <linux/delay.h> > #include <linux/io.h> > #include <linux/pinctrl/consumer.h> > +#include <linux/of_device.h> > > #include <asm/cacheflush.h> > > @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { > #endif > }; > > +/* > + * This function returns 1 if pdev isn't a device instatiated by dt, 0 if > it + * could successfully get all information from dt or a negative errno. > + */ > +static int serial_mxs_probe_dt(struct mxs_auart_port *s, > + struct platform_device *pdev) > +{ > + struct device_node *np = pdev->dev.of_node; > + int ret; > + > + if (!np) > + /* no device tree device */ > + return 1; > + > + ret = of_alias_get_id(np, "serial"); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); > + return ret; > + } > + s->port.line = ret; > + > + return 0; > +} > + > static int __devinit mxs_auart_probe(struct platform_device *pdev) > { > struct mxs_auart_port *s; > @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct > platform_device *pdev) goto out; > } > > + ret = serial_mxs_probe_dt(s, pdev); > + if (ret > 0) > + s->port.line = pdev->id < 0 ? 0 : pdev->id; > + else if (ret < 0) > + goto out_free; > + > pinctrl = devm_pinctrl_get_select_default(&pdev->dev); > if (IS_ERR(pinctrl)) { > ret = PTR_ERR(pinctrl); > @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct > platform_device *pdev) s->port.membase = ioremap(r->start, > resource_size(r)); > s->port.ops = &mxs_auart_ops; > s->port.iotype = UPIO_MEM; > - s->port.line = pdev->id < 0 ? 0 : pdev->id; > s->port.fifosize = 16; > s->port.uartclk = clk_get_rate(s->clk); > s->port.type = PORT_IMX; > @@ -769,13 +799,29 @@ static int __devexit mxs_auart_remove(struct > platform_device *pdev) return 0; > } > > +static struct platform_device_id mxs_auart_devtype[] = { > + { > + .name = "mxs-auart", > + /* sentinel */ > + } > +}; > +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); > + > +static struct of_device_id mxs_auart_dt_ids[] = { > + { .compatible = "fsl,imx23-auart", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); > + > static struct platform_driver mxs_auart_driver = { > .probe = mxs_auart_probe, > .remove = __devexit_p(mxs_auart_remove), > .driver = { > .name = "mxs-auart", > .owner = THIS_MODULE, > + .of_match_table = mxs_auart_dt_ids, > }, > + .id_table = mxs_auart_devtype, > }; > > static int __init mxs_auart_init(void) > @@ -807,3 +853,4 @@ module_init(mxs_auart_init); > module_exit(mxs_auart_exit); > MODULE_LICENSE("GPL"); > MODULE_DESCRIPTION("Freescale MXS application uart driver"); > +MODULE_ALIAS("platform:mxs-auart"); Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 15:35 ` [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing Fabio Estevam 2012-06-15 15:48 ` Marek Vasut @ 2012-06-15 16:06 ` Shawn Guo 2012-06-15 16:11 ` Fabio Estevam 1 sibling, 1 reply; 17+ messages in thread From: Shawn Guo @ 2012-06-15 16:06 UTC (permalink / raw) To: Fabio Estevam Cc: linux-arm-kernel, kernel, marex, matt, snijsure, rob.herring, Grant Likely, Alan Cox, linux-serial On Fri, Jun 15, 2012 at 12:35:57PM -0300, Fabio Estevam wrote: > +static struct platform_device_id mxs_auart_devtype[] = { > + { > + .name = "mxs-auart", > + /* sentinel */ > + } > +}; > +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); ... > + .id_table = mxs_auart_devtype, I do not think we need these. -- Regards, Shawn ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 16:06 ` Shawn Guo @ 2012-06-15 16:11 ` Fabio Estevam 2012-06-15 16:16 ` Marek Vasut 2012-06-16 1:59 ` Shawn Guo 0 siblings, 2 replies; 17+ messages in thread From: Fabio Estevam @ 2012-06-15 16:11 UTC (permalink / raw) To: Shawn Guo Cc: Fabio Estevam, marex, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox On Fri, Jun 15, 2012 at 1:06 PM, Shawn Guo <shawn.guo@linaro.org> wrote: >> +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); > ... >> + .id_table = mxs_auart_devtype, > > I do not think we need these. WIthout this, the non-dt kernel does not probe correctly. -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 16:11 ` Fabio Estevam @ 2012-06-15 16:16 ` Marek Vasut 2012-06-15 16:18 ` Fabio Estevam 2012-06-16 1:59 ` Shawn Guo 1 sibling, 1 reply; 17+ messages in thread From: Marek Vasut @ 2012-06-15 16:16 UTC (permalink / raw) To: Fabio Estevam Cc: Shawn Guo, Fabio Estevam, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox Dear Fabio Estevam, > On Fri, Jun 15, 2012 at 1:06 PM, Shawn Guo <shawn.guo@linaro.org> wrote: > >> +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); > > > > ... > > > >> + .id_table = mxs_auart_devtype, > > > > I do not think we need these. > > WIthout this, the non-dt kernel does not probe correctly. But we don't support non-DT kernel anymore. Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 16:16 ` Marek Vasut @ 2012-06-15 16:18 ` Fabio Estevam 2012-06-15 17:00 ` Marek Vasut 0 siblings, 1 reply; 17+ messages in thread From: Fabio Estevam @ 2012-06-15 16:18 UTC (permalink / raw) To: Marek Vasut Cc: Shawn Guo, Fabio Estevam, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox On Fri, Jun 15, 2012 at 1:16 PM, Marek Vasut <marex@denx.de> wrote: > Dear Fabio Estevam, > >> On Fri, Jun 15, 2012 at 1:06 PM, Shawn Guo <shawn.guo@linaro.org> wrote: >> >> +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); >> > >> > ... >> > >> >> + .id_table = mxs_auart_devtype, >> > >> > I do not think we need these. >> >> WIthout this, the non-dt kernel does not probe correctly. > > But we don't support non-DT kernel anymore. but I don't want my patch to break something that has been working for a long time. -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 16:18 ` Fabio Estevam @ 2012-06-15 17:00 ` Marek Vasut 2012-06-16 2:01 ` Shawn Guo 0 siblings, 1 reply; 17+ messages in thread From: Marek Vasut @ 2012-06-15 17:00 UTC (permalink / raw) To: Fabio Estevam Cc: Shawn Guo, Fabio Estevam, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox Dear Fabio Estevam, > On Fri, Jun 15, 2012 at 1:16 PM, Marek Vasut <marex@denx.de> wrote: > > Dear Fabio Estevam, > > > >> On Fri, Jun 15, 2012 at 1:06 PM, Shawn Guo <shawn.guo@linaro.org> wrote: > >> >> +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); > >> > > >> > ... > >> > > >> >> + .id_table = mxs_auart_devtype, > >> > > >> > I do not think we need these. > >> > >> WIthout this, the non-dt kernel does not probe correctly. > > > > But we don't support non-DT kernel anymore. > > but I don't want my patch to break something that has been working for > a long time. But we don't care if the non-DT case gets broken anyway *. It's unsupported and will be removed. * that's how I understand it. Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 17:00 ` Marek Vasut @ 2012-06-16 2:01 ` Shawn Guo 0 siblings, 0 replies; 17+ messages in thread From: Shawn Guo @ 2012-06-16 2:01 UTC (permalink / raw) To: Marek Vasut Cc: Fabio Estevam, Fabio Estevam, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox On Fri, Jun 15, 2012 at 07:00:21PM +0200, Marek Vasut wrote: > But we don't care if the non-DT case gets broken anyway *. It's unsupported and > will be removed. > We have to care about non-DT case before all those non-DT users (board files) get removed from the tree. -- Regards, Shawn ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing 2012-06-15 16:11 ` Fabio Estevam 2012-06-15 16:16 ` Marek Vasut @ 2012-06-16 1:59 ` Shawn Guo 1 sibling, 0 replies; 17+ messages in thread From: Shawn Guo @ 2012-06-16 1:59 UTC (permalink / raw) To: Fabio Estevam Cc: Fabio Estevam, marex, snijsure, rob.herring, Grant Likely, kernel, linux-serial, matt, linux-arm-kernel, Alan Cox On Fri, Jun 15, 2012 at 01:11:12PM -0300, Fabio Estevam wrote: > On Fri, Jun 15, 2012 at 1:06 PM, Shawn Guo <shawn.guo@linaro.org> wrote: > > >> +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); > > ... > >> + .id_table = mxs_auart_devtype, > > > > I do not think we need these. > > WIthout this, the non-dt kernel does not probe correctly. Are you sure about that? I just tried to removed those and still saw the following with non-DT boot. [ 0.810000] mxs-auart.0: ttyAPP0 at MMIO 0x8006a000 (irq = 112) is a mxs-auar t.0 [ 0.820000] mxs-auart mxs-auart.0: Found APPUART 3.1.0 [ 0.830000] mxs-auart.3: ttyAPP3 at MMIO 0x80070000 (irq = 115) is a mxs-auar t.3 [ 0.840000] mxs-auart mxs-auart.3: Found APPUART 3.1.0 -- Regards, Shawn -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing [not found] <1339774557-23588-1-git-send-email-fabio.estevam@freescale.com> 2012-06-15 15:35 ` [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing Fabio Estevam @ 2012-06-18 13:06 ` Fabio Estevam 2012-06-18 13:33 ` Shawn Guo 2012-06-18 20:42 ` Subodh Nijsure 1 sibling, 2 replies; 17+ messages in thread From: Fabio Estevam @ 2012-06-18 13:06 UTC (permalink / raw) To: linux-arm-kernel Cc: shawn.guo, kernel, marex, rob.herring, Fabio Estevam, Grant Likely, Alan Cox, linux-serial Allow device tree probing. Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Alan Cox <alan@linux.intel.com> Cc: <linux-serial@vger.kernel.org> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> --- Changes since v3: - Remove unneeded mxs_auart_devtype Changes since v2: - Change compatible string - Add aliases information in bindings doc - Remove unneeded mxs_auart_probe_pdev function - Remove "ifdef CONFIG_OF" - Remove of_match_ptr wrapper Changes since v1: - Merged patches 3 and 5 from v1 into this one .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++++ drivers/tty/serial/mxs-auart.c | 40 +++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt new file mode 100644 index 0000000..2ee903f --- /dev/null +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt @@ -0,0 +1,27 @@ +* Freescale MXS Application UART (AUART) + +Required properties: +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include + imx23 and imx28. +- reg : Address and length of the register set for the device +- interrupts : Should contain the auart interrupt numbers + +Example: +auart0: serial@8006a000 { + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; + reg = <0x8006a000 0x2000>; + interrupts = <112 70 71>; +}; + +Note: Each auart port should have an alias correctly numbered in "aliases" +node. + +Example: + +aliases { + serial0 = &auart0; + serial1 = &auart1; + serial2 = &auart2; + serial3 = &auart3; + serial4 = &auart4; +}; diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index ec56d83..103087d 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -33,6 +33,7 @@ #include <linux/delay.h> #include <linux/io.h> #include <linux/pinctrl/consumer.h> +#include <linux/of_device.h> #include <asm/cacheflush.h> @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { #endif }; +/* + * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it + * could successfully get all information from dt or a negative errno. + */ +static int serial_mxs_probe_dt(struct mxs_auart_port *s, + struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + int ret; + + if (!np) + /* no device tree device */ + return 1; + + ret = of_alias_get_id(np, "serial"); + if (ret < 0) { + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); + return ret; + } + s->port.line = ret; + + return 0; +} + static int __devinit mxs_auart_probe(struct platform_device *pdev) { struct mxs_auart_port *s; @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) goto out; } + ret = serial_mxs_probe_dt(s, pdev); + if (ret > 0) + s->port.line = pdev->id < 0 ? 0 : pdev->id; + else if (ret < 0) + goto out_free; + pinctrl = devm_pinctrl_get_select_default(&pdev->dev); if (IS_ERR(pinctrl)) { ret = PTR_ERR(pinctrl); @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) s->port.membase = ioremap(r->start, resource_size(r)); s->port.ops = &mxs_auart_ops; s->port.iotype = UPIO_MEM; - s->port.line = pdev->id < 0 ? 0 : pdev->id; s->port.fifosize = 16; s->port.uartclk = clk_get_rate(s->clk); s->port.type = PORT_IMX; @@ -769,12 +799,19 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev) return 0; } +static struct of_device_id mxs_auart_dt_ids[] = { + { .compatible = "fsl,imx23-auart", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); + static struct platform_driver mxs_auart_driver = { .probe = mxs_auart_probe, .remove = __devexit_p(mxs_auart_remove), .driver = { .name = "mxs-auart", .owner = THIS_MODULE, + .of_match_table = mxs_auart_dt_ids, }, }; @@ -807,3 +844,4 @@ module_init(mxs_auart_init); module_exit(mxs_auart_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Freescale MXS application uart driver"); +MODULE_ALIAS("platform:mxs-auart"); -- 1.7.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 13:06 ` [PATCH v4 " Fabio Estevam @ 2012-06-18 13:33 ` Shawn Guo 2012-06-18 13:36 ` Marek Vasut 2012-06-18 15:25 ` Greg Kroah-Hartman 2012-06-18 20:42 ` Subodh Nijsure 1 sibling, 2 replies; 17+ messages in thread From: Shawn Guo @ 2012-06-18 13:33 UTC (permalink / raw) To: Fabio Estevam, Greg Kroah-Hartman Cc: linux-arm-kernel, kernel, marex, rob.herring, Grant Likely, Alan Cox, linux-serial On Mon, Jun 18, 2012 at 10:06:09AM -0300, Fabio Estevam wrote: > Allow device tree probing. > > Cc: Grant Likely <grant.likely@secretlab.ca> > Cc: Rob Herring <rob.herring@calxeda.com> > Cc: Alan Cox <alan@linux.intel.com> > Cc: <linux-serial@vger.kernel.org> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > --- > Changes since v3: > - Remove unneeded mxs_auart_devtype > Changes since v2: > - Change compatible string > - Add aliases information in bindings doc > - Remove unneeded mxs_auart_probe_pdev function > - Remove "ifdef CONFIG_OF" > - Remove of_match_ptr wrapper > Changes since v1: > - Merged patches 3 and 5 from v1 into this one Hi Greg, May I have your ack to have the patch go through arm-soc tree, so that we can possibly start converting those non-DT board files over to DT? Regards, Shawn > .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++++ > drivers/tty/serial/mxs-auart.c | 40 +++++++++++++++++++- > 2 files changed, 66 insertions(+), 1 deletions(-) > create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > > diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > new file mode 100644 > index 0000000..2ee903f > --- /dev/null > +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > @@ -0,0 +1,27 @@ > +* Freescale MXS Application UART (AUART) > + > +Required properties: > +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include > + imx23 and imx28. > +- reg : Address and length of the register set for the device > +- interrupts : Should contain the auart interrupt numbers > + > +Example: > +auart0: serial@8006a000 { > + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; > + reg = <0x8006a000 0x2000>; > + interrupts = <112 70 71>; > +}; > + > +Note: Each auart port should have an alias correctly numbered in "aliases" > +node. > + > +Example: > + > +aliases { > + serial0 = &auart0; > + serial1 = &auart1; > + serial2 = &auart2; > + serial3 = &auart3; > + serial4 = &auart4; > +}; > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c > index ec56d83..103087d 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -33,6 +33,7 @@ > #include <linux/delay.h> > #include <linux/io.h> > #include <linux/pinctrl/consumer.h> > +#include <linux/of_device.h> > > #include <asm/cacheflush.h> > > @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { > #endif > }; > > +/* > + * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it > + * could successfully get all information from dt or a negative errno. > + */ > +static int serial_mxs_probe_dt(struct mxs_auart_port *s, > + struct platform_device *pdev) > +{ > + struct device_node *np = pdev->dev.of_node; > + int ret; > + > + if (!np) > + /* no device tree device */ > + return 1; > + > + ret = of_alias_get_id(np, "serial"); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); > + return ret; > + } > + s->port.line = ret; > + > + return 0; > +} > + > static int __devinit mxs_auart_probe(struct platform_device *pdev) > { > struct mxs_auart_port *s; > @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) > goto out; > } > > + ret = serial_mxs_probe_dt(s, pdev); > + if (ret > 0) > + s->port.line = pdev->id < 0 ? 0 : pdev->id; > + else if (ret < 0) > + goto out_free; > + > pinctrl = devm_pinctrl_get_select_default(&pdev->dev); > if (IS_ERR(pinctrl)) { > ret = PTR_ERR(pinctrl); > @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) > s->port.membase = ioremap(r->start, resource_size(r)); > s->port.ops = &mxs_auart_ops; > s->port.iotype = UPIO_MEM; > - s->port.line = pdev->id < 0 ? 0 : pdev->id; > s->port.fifosize = 16; > s->port.uartclk = clk_get_rate(s->clk); > s->port.type = PORT_IMX; > @@ -769,12 +799,19 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev) > return 0; > } > > +static struct of_device_id mxs_auart_dt_ids[] = { > + { .compatible = "fsl,imx23-auart", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); > + > static struct platform_driver mxs_auart_driver = { > .probe = mxs_auart_probe, > .remove = __devexit_p(mxs_auart_remove), > .driver = { > .name = "mxs-auart", > .owner = THIS_MODULE, > + .of_match_table = mxs_auart_dt_ids, > }, > }; > > @@ -807,3 +844,4 @@ module_init(mxs_auart_init); > module_exit(mxs_auart_exit); > MODULE_LICENSE("GPL"); > MODULE_DESCRIPTION("Freescale MXS application uart driver"); > +MODULE_ALIAS("platform:mxs-auart"); > -- > 1.7.1 > > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 13:33 ` Shawn Guo @ 2012-06-18 13:36 ` Marek Vasut 2012-06-18 15:25 ` Greg Kroah-Hartman 1 sibling, 0 replies; 17+ messages in thread From: Marek Vasut @ 2012-06-18 13:36 UTC (permalink / raw) To: Shawn Guo Cc: Fabio Estevam, Greg Kroah-Hartman, linux-arm-kernel, kernel, rob.herring, Grant Likely, Alan Cox, linux-serial Dear Shawn Guo, > On Mon, Jun 18, 2012 at 10:06:09AM -0300, Fabio Estevam wrote: > > Allow device tree probing. > > > > Cc: Grant Likely <grant.likely@secretlab.ca> > > Cc: Rob Herring <rob.herring@calxeda.com> > > Cc: Alan Cox <alan@linux.intel.com> > > Cc: <linux-serial@vger.kernel.org> > > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > > --- > > Changes since v3: > > - Remove unneeded mxs_auart_devtype > > Changes since v2: > > - Change compatible string > > - Add aliases information in bindings doc > > - Remove unneeded mxs_auart_probe_pdev function > > - Remove "ifdef CONFIG_OF" > > - Remove of_match_ptr wrapper > > Changes since v1: > > - Merged patches 3 and 5 from v1 into this one > > Hi Greg, > > May I have your ack to have the patch go through arm-soc tree, so that > we can possibly start converting those non-DT board files over to DT? > > Regards, > Shawn Good, I should be back on 20th to the denx board. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 13:33 ` Shawn Guo 2012-06-18 13:36 ` Marek Vasut @ 2012-06-18 15:25 ` Greg Kroah-Hartman 1 sibling, 0 replies; 17+ messages in thread From: Greg Kroah-Hartman @ 2012-06-18 15:25 UTC (permalink / raw) To: Shawn Guo Cc: Fabio Estevam, linux-arm-kernel, kernel, marex, rob.herring, Grant Likely, Alan Cox, linux-serial On Mon, Jun 18, 2012 at 09:33:40PM +0800, Shawn Guo wrote: > On Mon, Jun 18, 2012 at 10:06:09AM -0300, Fabio Estevam wrote: > > Allow device tree probing. > > > > Cc: Grant Likely <grant.likely@secretlab.ca> > > Cc: Rob Herring <rob.herring@calxeda.com> > > Cc: Alan Cox <alan@linux.intel.com> > > Cc: <linux-serial@vger.kernel.org> > > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> > > --- > > Changes since v3: > > - Remove unneeded mxs_auart_devtype > > Changes since v2: > > - Change compatible string > > - Add aliases information in bindings doc > > - Remove unneeded mxs_auart_probe_pdev function > > - Remove "ifdef CONFIG_OF" > > - Remove of_match_ptr wrapper > > Changes since v1: > > - Merged patches 3 and 5 from v1 into this one > > Hi Greg, > > May I have your ack to have the patch go through arm-soc tree, so that > we can possibly start converting those non-DT board files over to DT? Fine with me: Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 13:06 ` [PATCH v4 " Fabio Estevam 2012-06-18 13:33 ` Shawn Guo @ 2012-06-18 20:42 ` Subodh Nijsure 2012-06-18 20:50 ` Fabio Estevam 2012-07-13 10:33 ` Marc Kleine-Budde 1 sibling, 2 replies; 17+ messages in thread From: Subodh Nijsure @ 2012-06-18 20:42 UTC (permalink / raw) To: Fabio Estevam Cc: marex, kernel, rob.herring, Grant Likely, linux-serial, shawn.guo, Matt@grid-net.com, linux-arm-kernel, Alan Cox If one were to try run console on one of the /dev/ttyAPP* ports, as is the case for hardware I am working with, console output wouldn't show up without the following diff: Let me know if should send formal patch or we can include it as part of v5? diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index ca3d25e..2ced332 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -761,7 +761,7 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) platform_set_drvdata(pdev, s); - auart_port[pdev->id] = s; + auart_port[s->port.line] = s; mxs_auart_reset(&s->port) -Subodh On 06/18/2012 06:06 AM, Fabio Estevam wrote: > Allow device tree probing. > > Cc: Grant Likely<grant.likely@secretlab.ca> > Cc: Rob Herring<rob.herring@calxeda.com> > Cc: Alan Cox<alan@linux.intel.com> > Cc:<linux-serial@vger.kernel.org> > Signed-off-by: Fabio Estevam<fabio.estevam@freescale.com> > --- > Changes since v3: > - Remove unneeded mxs_auart_devtype > Changes since v2: > - Change compatible string > - Add aliases information in bindings doc > - Remove unneeded mxs_auart_probe_pdev function > - Remove "ifdef CONFIG_OF" > - Remove of_match_ptr wrapper > Changes since v1: > - Merged patches 3 and 5 from v1 into this one > .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++++ > drivers/tty/serial/mxs-auart.c | 40 +++++++++++++++++++- > 2 files changed, 66 insertions(+), 1 deletions(-) > create mode 100644 Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > > diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > new file mode 100644 > index 0000000..2ee903f > --- /dev/null > +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt > @@ -0,0 +1,27 @@ > +* Freescale MXS Application UART (AUART) > + > +Required properties: > +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include > + imx23 and imx28. > +- reg : Address and length of the register set for the device > +- interrupts : Should contain the auart interrupt numbers > + > +Example: > +auart0: serial@8006a000 { > + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; > + reg =<0x8006a000 0x2000>; > + interrupts =<112 70 71>; > +}; > + > +Note: Each auart port should have an alias correctly numbered in "aliases" > +node. > + > +Example: > + > +aliases { > + serial0 =&auart0; > + serial1 =&auart1; > + serial2 =&auart2; > + serial3 =&auart3; > + serial4 =&auart4; > +}; > diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c > index ec56d83..103087d 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -33,6 +33,7 @@ > #include<linux/delay.h> > #include<linux/io.h> > #include<linux/pinctrl/consumer.h> > +#include<linux/of_device.h> > > #include<asm/cacheflush.h> > > @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { > #endif > }; > > +/* > + * This function returns 1 if pdev isn't a device instatiated by dt, 0 if it > + * could successfully get all information from dt or a negative errno. > + */ > +static int serial_mxs_probe_dt(struct mxs_auart_port *s, > + struct platform_device *pdev) > +{ > + struct device_node *np = pdev->dev.of_node; > + int ret; > + > + if (!np) > + /* no device tree device */ > + return 1; > + > + ret = of_alias_get_id(np, "serial"); > + if (ret< 0) { > + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); > + return ret; > + } > + s->port.line = ret; > + > + return 0; > +} > + > static int __devinit mxs_auart_probe(struct platform_device *pdev) > { > struct mxs_auart_port *s; > @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) > goto out; > } > > + ret = serial_mxs_probe_dt(s, pdev); > + if (ret> 0) > + s->port.line = pdev->id< 0 ? 0 : pdev->id; > + else if (ret< 0) > + goto out_free; > + > pinctrl = devm_pinctrl_get_select_default(&pdev->dev); > if (IS_ERR(pinctrl)) { > ret = PTR_ERR(pinctrl); > @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) > s->port.membase = ioremap(r->start, resource_size(r)); > s->port.ops =&mxs_auart_ops; > s->port.iotype = UPIO_MEM; > - s->port.line = pdev->id< 0 ? 0 : pdev->id; > s->port.fifosize = 16; > s->port.uartclk = clk_get_rate(s->clk); > s->port.type = PORT_IMX; > @@ -769,12 +799,19 @@ static int __devexit mxs_auart_remove(struct platform_device *pdev) > return 0; > } > > +static struct of_device_id mxs_auart_dt_ids[] = { > + { .compatible = "fsl,imx23-auart", }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); > + > static struct platform_driver mxs_auart_driver = { > .probe = mxs_auart_probe, > .remove = __devexit_p(mxs_auart_remove), > .driver = { > .name = "mxs-auart", > .owner = THIS_MODULE, > + .of_match_table = mxs_auart_dt_ids, > }, > }; > > @@ -807,3 +844,4 @@ module_init(mxs_auart_init); > module_exit(mxs_auart_exit); > MODULE_LICENSE("GPL"); > MODULE_DESCRIPTION("Freescale MXS application uart driver"); > +MODULE_ALIAS("platform:mxs-auart"); ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 20:42 ` Subodh Nijsure @ 2012-06-18 20:50 ` Fabio Estevam 2012-07-13 10:33 ` Marc Kleine-Budde 1 sibling, 0 replies; 17+ messages in thread From: Fabio Estevam @ 2012-06-18 20:50 UTC (permalink / raw) To: Subodh Nijsure Cc: Fabio Estevam, marex, kernel, rob.herring, Grant Likely, linux-serial, shawn.guo, Matt@grid-net.com, linux-arm-kernel, Alan Cox On Mon, Jun 18, 2012 at 5:42 PM, Subodh Nijsure <snijsure@grid-net.com> wrote: > > If one were to try run console on one of the /dev/ttyAPP* ports, as is the > case for hardware I am working with, console output wouldn't show up without > the following diff: > > Let me know if should send formal patch or we can include it as part of v5? Please send a formal patch. Shawn has already applied my patch into his tree: http://git.linaro.org/gitweb?p=people/shawnguo/linux-2.6.git;a=shortlog;h=refs/heads/mxs/for-next ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-06-18 20:42 ` Subodh Nijsure 2012-06-18 20:50 ` Fabio Estevam @ 2012-07-13 10:33 ` Marc Kleine-Budde 2012-07-13 10:35 ` Marc Kleine-Budde 1 sibling, 1 reply; 17+ messages in thread From: Marc Kleine-Budde @ 2012-07-13 10:33 UTC (permalink / raw) To: Subodh Nijsure Cc: Fabio Estevam, marex, kernel, rob.herring, Grant Likely, linux-serial, shawn.guo, Matt@grid-net.com, linux-arm-kernel, Alan Cox [-- Attachment #1: Type: text/plain, Size: 6431 bytes --] On 06/18/2012 10:42 PM, Subodh Nijsure wrote: > > If one were to try run console on one of the /dev/ttyAPP* ports, as is > the case for hardware I am working with, console output wouldn't show up > without the following diff: > > Let me know if should send formal patch or we can include it as part of v5? Has this patch been applied? Marc > > diff --git a/drivers/tty/serial/mxs-auart.c > b/drivers/tty/serial/mxs-auart.c > index ca3d25e..2ced332 100644 > --- a/drivers/tty/serial/mxs-auart.c > +++ b/drivers/tty/serial/mxs-auart.c > @@ -761,7 +761,7 @@ static int __devinit mxs_auart_probe(struct > platform_device *pdev) > > platform_set_drvdata(pdev, s); > > - auart_port[pdev->id] = s; > + auart_port[s->port.line] = s; > > mxs_auart_reset(&s->port) > > -Subodh > > On 06/18/2012 06:06 AM, Fabio Estevam wrote: >> Allow device tree probing. >> >> Cc: Grant Likely<grant.likely@secretlab.ca> >> Cc: Rob Herring<rob.herring@calxeda.com> >> Cc: Alan Cox<alan@linux.intel.com> >> Cc:<linux-serial@vger.kernel.org> >> Signed-off-by: Fabio Estevam<fabio.estevam@freescale.com> >> --- >> Changes since v3: >> - Remove unneeded mxs_auart_devtype >> Changes since v2: >> - Change compatible string >> - Add aliases information in bindings doc >> - Remove unneeded mxs_auart_probe_pdev function >> - Remove "ifdef CONFIG_OF" >> - Remove of_match_ptr wrapper >> Changes since v1: >> - Merged patches 3 and 5 from v1 into this one >> .../bindings/tty/serial/fsl-mxs-auart.txt | 27 +++++++++++++ >> drivers/tty/serial/mxs-auart.c | 40 >> +++++++++++++++++++- >> 2 files changed, 66 insertions(+), 1 deletions(-) >> create mode 100644 >> Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt >> >> diff --git >> a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt >> b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt >> new file mode 100644 >> index 0000000..2ee903f >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt >> @@ -0,0 +1,27 @@ >> +* Freescale MXS Application UART (AUART) >> + >> +Required properties: >> +- compatible : Should be "fsl,<soc>-auart". The supported SoCs include >> + imx23 and imx28. >> +- reg : Address and length of the register set for the device >> +- interrupts : Should contain the auart interrupt numbers >> + >> +Example: >> +auart0: serial@8006a000 { >> + compatible = "fsl,imx28-auart", "fsl,imx23-auart"; >> + reg =<0x8006a000 0x2000>; >> + interrupts =<112 70 71>; >> +}; >> + >> +Note: Each auart port should have an alias correctly numbered in >> "aliases" >> +node. >> + >> +Example: >> + >> +aliases { >> + serial0 =&auart0; >> + serial1 =&auart1; >> + serial2 =&auart2; >> + serial3 =&auart3; >> + serial4 =&auart4; >> +}; >> diff --git a/drivers/tty/serial/mxs-auart.c >> b/drivers/tty/serial/mxs-auart.c >> index ec56d83..103087d 100644 >> --- a/drivers/tty/serial/mxs-auart.c >> +++ b/drivers/tty/serial/mxs-auart.c >> @@ -33,6 +33,7 @@ >> #include<linux/delay.h> >> #include<linux/io.h> >> #include<linux/pinctrl/consumer.h> >> +#include<linux/of_device.h> >> >> #include<asm/cacheflush.h> >> >> @@ -675,6 +676,30 @@ static struct uart_driver auart_driver = { >> #endif >> }; >> >> +/* >> + * This function returns 1 if pdev isn't a device instatiated by dt, >> 0 if it >> + * could successfully get all information from dt or a negative errno. >> + */ >> +static int serial_mxs_probe_dt(struct mxs_auart_port *s, >> + struct platform_device *pdev) >> +{ >> + struct device_node *np = pdev->dev.of_node; >> + int ret; >> + >> + if (!np) >> + /* no device tree device */ >> + return 1; >> + >> + ret = of_alias_get_id(np, "serial"); >> + if (ret< 0) { >> + dev_err(&pdev->dev, "failed to get alias id: %d\n", ret); >> + return ret; >> + } >> + s->port.line = ret; >> + >> + return 0; >> +} >> + >> static int __devinit mxs_auart_probe(struct platform_device *pdev) >> { >> struct mxs_auart_port *s; >> @@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct >> platform_device *pdev) >> goto out; >> } >> >> + ret = serial_mxs_probe_dt(s, pdev); >> + if (ret> 0) >> + s->port.line = pdev->id< 0 ? 0 : pdev->id; >> + else if (ret< 0) >> + goto out_free; >> + >> pinctrl = devm_pinctrl_get_select_default(&pdev->dev); >> if (IS_ERR(pinctrl)) { >> ret = PTR_ERR(pinctrl); >> @@ -711,7 +742,6 @@ static int __devinit mxs_auart_probe(struct >> platform_device *pdev) >> s->port.membase = ioremap(r->start, resource_size(r)); >> s->port.ops =&mxs_auart_ops; >> s->port.iotype = UPIO_MEM; >> - s->port.line = pdev->id< 0 ? 0 : pdev->id; >> s->port.fifosize = 16; >> s->port.uartclk = clk_get_rate(s->clk); >> s->port.type = PORT_IMX; >> @@ -769,12 +799,19 @@ static int __devexit mxs_auart_remove(struct >> platform_device *pdev) >> return 0; >> } >> >> +static struct of_device_id mxs_auart_dt_ids[] = { >> + { .compatible = "fsl,imx23-auart", }, >> + { /* sentinel */ } >> +}; >> +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); >> + >> static struct platform_driver mxs_auart_driver = { >> .probe = mxs_auart_probe, >> .remove = __devexit_p(mxs_auart_remove), >> .driver = { >> .name = "mxs-auart", >> .owner = THIS_MODULE, >> + .of_match_table = mxs_auart_dt_ids, >> }, >> }; >> >> @@ -807,3 +844,4 @@ module_init(mxs_auart_init); >> module_exit(mxs_auart_exit); >> MODULE_LICENSE("GPL"); >> MODULE_DESCRIPTION("Freescale MXS application uart driver"); >> +MODULE_ALIAS("platform:mxs-auart"); > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 262 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 2/2] serial: mxs-auart: Allow device tree probing 2012-07-13 10:33 ` Marc Kleine-Budde @ 2012-07-13 10:35 ` Marc Kleine-Budde 0 siblings, 0 replies; 17+ messages in thread From: Marc Kleine-Budde @ 2012-07-13 10:35 UTC (permalink / raw) To: Subodh Nijsure Cc: Fabio Estevam, marex, kernel, rob.herring, Grant Likely, linux-serial, shawn.guo, Matt@grid-net.com, linux-arm-kernel, Alan Cox [-- Attachment #1: Type: text/plain, Size: 823 bytes --] On 07/13/2012 12:33 PM, Marc Kleine-Budde wrote: > On 06/18/2012 10:42 PM, Subodh Nijsure wrote: >> >> If one were to try run console on one of the /dev/ttyAPP* ports, as is >> the case for hardware I am working with, console output wouldn't show up >> without the following diff: >> >> Let me know if should send formal patch or we can include it as part of v5? > > Has this patch been applied? Yes. [1] Marc [1] http://git.linaro.org/gitweb?p=people/shawnguo/linux-2.6.git;a=commit;h=1ea6607d4cdc917987e7e6cfaafc4a630d97a297 -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 262 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2012-07-13 10:35 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1339774557-23588-1-git-send-email-fabio.estevam@freescale.com> 2012-06-15 15:35 ` [PATCH v3 2/2] serial: mxs-auart: Allow device tree probing Fabio Estevam 2012-06-15 15:48 ` Marek Vasut 2012-06-15 16:06 ` Shawn Guo 2012-06-15 16:11 ` Fabio Estevam 2012-06-15 16:16 ` Marek Vasut 2012-06-15 16:18 ` Fabio Estevam 2012-06-15 17:00 ` Marek Vasut 2012-06-16 2:01 ` Shawn Guo 2012-06-16 1:59 ` Shawn Guo 2012-06-18 13:06 ` [PATCH v4 " Fabio Estevam 2012-06-18 13:33 ` Shawn Guo 2012-06-18 13:36 ` Marek Vasut 2012-06-18 15:25 ` Greg Kroah-Hartman 2012-06-18 20:42 ` Subodh Nijsure 2012-06-18 20:50 ` Fabio Estevam 2012-07-13 10:33 ` Marc Kleine-Budde 2012-07-13 10:35 ` Marc Kleine-Budde
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).