@@ -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 at 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;+};
@@ -675,6 +676,30 @@ static struct uart_driver auart_driver = {#endif};+/*+*Thisfunctionreturns1ifpdevisn'tadeviceinstatiatedbydt,0ifit+*couldsuccessfullygetallinformationfromdtoranegativeerrno.+*/+staticintserial_mxs_probe_dt(structmxs_auart_port*s,+structplatform_device*pdev)+{+structdevice_node*np=pdev->dev.of_node;+intret;++if(!np)+/* no device tree device */+return1;++ret=of_alias_get_id(np,"serial");+if(ret<0){+dev_err(&pdev->dev,"failed to get alias id: %d\n",ret);+returnret;+}+s->port.line=ret;++return0;+}+staticint__devinitmxs_auart_probe(structplatform_device*pdev){structmxs_auart_port*s;
@@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)gotoout;}+ret=serial_mxs_probe_dt(s,pdev);+if(ret>0)+s->port.line=pdev->id<0?0:pdev->id;+elseif(ret<0)+gotoout_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;
@@ -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 at 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
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
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
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
@@ -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 at 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;+};
@@ -675,6 +676,30 @@ static struct uart_driver auart_driver = {#endif};+/*+*Thisfunctionreturns1ifpdevisn'tadeviceinstatiatedbydt,0ifit+*couldsuccessfullygetallinformationfromdtoranegativeerrno.+*/+staticintserial_mxs_probe_dt(structmxs_auart_port*s,+structplatform_device*pdev)+{+structdevice_node*np=pdev->dev.of_node;+intret;++if(!np)+/* no device tree device */+return1;++ret=of_alias_get_id(np,"serial");+if(ret<0){+dev_err(&pdev->dev,"failed to get alias id: %d\n",ret);+returnret;+}+s->port.line=ret;++return0;+}+staticint__devinitmxs_auart_probe(structplatform_device*pdev){structmxs_auart_port*s;
@@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)gotoout;}+ret=serial_mxs_probe_dt(s,pdev);+if(ret>0)+s->port.line=pdev->id<0?0:pdev->id;+elseif(ret<0)+gotoout_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;
On Mon, Jun 18, 2012 at 10:06:09AM -0300, Fabio Estevam wrote:
Allow device tree probing.
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: Alan Cox <redacted>
Cc: <redacted>
Signed-off-by: Fabio Estevam <redacted>
---
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
@@ -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 at 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;+};
@@ -675,6 +676,30 @@ static struct uart_driver auart_driver = {#endif};+/*+*Thisfunctionreturns1ifpdevisn'tadeviceinstatiatedbydt,0ifit+*couldsuccessfullygetallinformationfromdtoranegativeerrno.+*/+staticintserial_mxs_probe_dt(structmxs_auart_port*s,+structplatform_device*pdev)+{+structdevice_node*np=pdev->dev.of_node;+intret;++if(!np)+/* no device tree device */+return1;++ret=of_alias_get_id(np,"serial");+if(ret<0){+dev_err(&pdev->dev,"failed to get alias id: %d\n",ret);+returnret;+}+s->port.line=ret;++return0;+}+staticint__devinitmxs_auart_probe(structplatform_device*pdev){structmxs_auart_port*s;
@@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)gotoout;}+ret=serial_mxs_probe_dt(s,pdev);+if(ret>0)+s->port.line=pdev->id<0?0:pdev->id;+elseif(ret<0)+gotoout_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;
On Mon, Jun 18, 2012 at 10:06:09AM -0300, Fabio Estevam wrote:
quoted
Allow device tree probing.
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: Alan Cox <redacted>
Cc: <redacted>
Signed-off-by: Fabio Estevam <redacted>
---
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
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:
quoted
Allow device tree probing.
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: Alan Cox <redacted>
Cc: <redacted>
Signed-off-by: Fabio Estevam <redacted>
---
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>
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?
@@ -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 at 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;+};
@@ -675,6 +676,30 @@ static struct uart_driver auart_driver = {#endif};+/*+*Thisfunctionreturns1ifpdevisn'tadeviceinstatiatedbydt,0ifit+*couldsuccessfullygetallinformationfromdtoranegativeerrno.+*/+staticintserial_mxs_probe_dt(structmxs_auart_port*s,+structplatform_device*pdev)+{+structdevice_node*np=pdev->dev.of_node;+intret;++if(!np)+/* no device tree device */+return1;++ret=of_alias_get_id(np,"serial");+if(ret<0){+dev_err(&pdev->dev,"failed to get alias id: %d\n",ret);+returnret;+}+s->port.line=ret;++return0;+}+staticint__devinitmxs_auart_probe(structplatform_device*pdev){structmxs_auart_port*s;
@@ -689,6 +714,12 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)gotoout;}+ret=serial_mxs_probe_dt(s,pdev);+if(ret>0)+s->port.line=pdev->id<0?0:pdev->id;+elseif(ret<0)+gotoout_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;
On Mon, Jun 18, 2012 at 5:42 PM, Subodh Nijsure [off-list ref] 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?
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
quoted hunk
diff --git a/drivers/tty/serial/mxs-auart.c
b/drivers/tty/serial/mxs-auart.c
index ca3d25e..2ced332 100644
@@ -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 at 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
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
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?