From: b32955@freescale.com (Huang Shijie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] serial: mxs-auart: distinguish the different SOCs
Date: Tue, 16 Oct 2012 14:03:04 +0800 [thread overview]
Message-ID: <1350367386-7742-2-git-send-email-b32955@freescale.com> (raw)
In-Reply-To: <1350367386-7742-1-git-send-email-b32955@freescale.com>
From: Huang Shijie <shijie8@gmail.com>
The current mxs-auart driver is used for both mx23 and mx28.
But in mx23, the DMA has a bug(see errata:2836). We can not add the
DMA support in mx23, but we can add DMA support to auart in mx28.
So in order to add the DMA support for the auart in mx28, we should add
the platform_device_id to distinguish the distinguish SOCs.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
.../bindings/tty/serial/fsl-mxs-auart.txt | 2 +-
arch/arm/boot/dts/imx28.dtsi | 10 +++---
drivers/tty/serial/mxs-auart.c | 28 +++++++++++++++----
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
index 2ee903f..a154bf1 100644
--- a/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
+++ b/Documentation/devicetree/bindings/tty/serial/fsl-mxs-auart.txt
@@ -8,7 +8,7 @@ Required properties:
Example:
auart0: serial at 8006a000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x8006a000 0x2000>;
interrupts = <112 70 71>;
};
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index e16d631..6ed9215 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -795,7 +795,7 @@
};
auart0: serial at 8006a000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x8006a000 0x2000>;
interrupts = <112 70 71>;
clocks = <&clks 45>;
@@ -803,7 +803,7 @@
};
auart1: serial at 8006c000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x8006c000 0x2000>;
interrupts = <113 72 73>;
clocks = <&clks 45>;
@@ -811,7 +811,7 @@
};
auart2: serial at 8006e000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x8006e000 0x2000>;
interrupts = <114 74 75>;
clocks = <&clks 45>;
@@ -819,7 +819,7 @@
};
auart3: serial at 80070000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x80070000 0x2000>;
interrupts = <115 76 77>;
clocks = <&clks 45>;
@@ -827,7 +827,7 @@
};
auart4: serial at 80072000 {
- compatible = "fsl,imx28-auart", "fsl,imx23-auart";
+ compatible = "fsl,imx28-auart";
reg = <0x80072000 0x2000>;
interrupts = <116 78 79>;
clocks = <&clks 45>;
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 6db3baa..cd9ec1d 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -37,6 +37,11 @@
#include <asm/cacheflush.h>
+/* Use the platform_id to distinguish different Archs. */
+#define IS_MX23 0x0
+#define IS_MX28 0x1
+#define AUART_IS_MX23(x) ((x)->pdev->id_entry->driver_data == IS_MX23)
+
#define MXS_AUART_PORTS 5
#define AUART_CTRL0 0x00000000
@@ -124,6 +129,7 @@ struct mxs_auart_port {
struct clk *clk;
struct device *dev;
+ struct platform_device *pdev;
};
static void mxs_auart_stop_tx(struct uart_port *u);
@@ -680,6 +686,19 @@ static struct uart_driver auart_driver = {
#endif
};
+static const struct platform_device_id auart_ids[] = {
+ { .name = "imx23-auart", .driver_data = IS_MX23, },
+ { .name = "imx28-auart", .driver_data = IS_MX28, },
+ {},
+};
+
+static struct of_device_id mxs_auart_dt_ids[] = {
+ { .compatible = "fsl,imx23-auart", .data = (void *)&auart_ids[0] },
+ { .compatible = "fsl,imx28-auart", .data = (void *)&auart_ids[1] },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids);
+
/*
* 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.
@@ -701,6 +720,8 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s,
}
s->port.line = ret;
+ pdev->id_entry = of_match_device(mxs_auart_dt_ids, &pdev->dev)->data;
+
return 0;
}
@@ -753,6 +774,7 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev)
s->flags = 0;
s->ctrl = 0;
+ s->pdev = pdev;
s->irq = platform_get_irq(pdev, 0);
s->port.irq = s->irq;
@@ -805,12 +827,6 @@ 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),
--
1.7.0.4
next prev parent reply other threads:[~2012-10-16 6:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 6:03 [PATCH 0/3] serial: mxs-auart: add DMA support for auart in mx28 Huang Shijie
2012-10-16 6:03 ` Huang Shijie [this message]
2012-10-18 2:44 ` [PATCH 1/3] serial: mxs-auart: distinguish the different SOCs Shawn Guo
2012-10-16 6:03 ` [PATCH 2/3] serial: mxs-auart: add the DMA support for mx28 Huang Shijie
2012-10-18 3:20 ` Shawn Guo
2012-10-18 6:22 ` Huang Shijie
2012-10-16 6:03 ` [PATCH 3/3] ARM: dts: enable dma support for auart0 in mx28 Huang Shijie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1350367386-7742-2-git-send-email-b32955@freescale.com \
--to=b32955@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).