From patchwork Tue Oct 16 06:03:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 1598901 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 935883FD4F for ; Tue, 16 Oct 2012 06:37:22 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TO0km-0001BX-3q; Tue, 16 Oct 2012 06:35:48 +0000 Received: from ch1ehsobe003.messaging.microsoft.com ([216.32.181.183] helo=ch1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TO0ki-0001AH-D9 for linux-arm-kernel@lists.infradead.org; Tue, 16 Oct 2012 06:35:45 +0000 Received: from mail149-ch1-R.bigfish.com (10.43.68.245) by CH1EHSOBE014.bigfish.com (10.43.70.64) with Microsoft SMTP Server id 14.1.225.23; Tue, 16 Oct 2012 06:35:41 +0000 Received: from mail149-ch1 (localhost [127.0.0.1]) by mail149-ch1-R.bigfish.com (Postfix) with ESMTP id 1F1183800FD; Tue, 16 Oct 2012 06:35:41 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzzz1202h1d1ah1d2ah1082kzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h1441h1155h) Received: from mail149-ch1 (localhost.localdomain [127.0.0.1]) by mail149-ch1 (MessageSwitch) id 1350369338701249_17714; Tue, 16 Oct 2012 06:35:38 +0000 (UTC) Received: from CH1EHSMHS031.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.250]) by mail149-ch1.bigfish.com (Postfix) with ESMTP id A741820068; Tue, 16 Oct 2012 06:35:38 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS031.bigfish.com (10.43.70.31) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 16 Oct 2012 06:35:36 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.309.3; Tue, 16 Oct 2012 06:35:35 +0000 Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q9G6ZJEM023050; Mon, 15 Oct 2012 23:35:32 -0700 From: Huang Shijie To: Subject: [PATCH 1/3] serial: mxs-auart: distinguish the different SOCs Date: Tue, 16 Oct 2012 14:03:04 +0800 Message-ID: <1350367386-7742-2-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1350367386-7742-1-git-send-email-b32955@freescale.com> References: <1350367386-7742-1-git-send-email-b32955@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.181.183 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux@arm.linux.org.uk, vinod.koul@intel.com, lauri.hintsala@bluegiga.com, Huang Shijie , linux-serial@vger.kernel.org, shawn.guo@linaro.org, Huang Shijie , linux-arm-kernel@lists.infradead.org, alan@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Huang Shijie 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 --- .../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@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@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@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@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@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@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 +/* 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),