From patchwork Wed Oct 24 10:27:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Shijie X-Patchwork-Id: 1637581 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 483CE3FD4E for ; Wed, 24 Oct 2012 11:04:34 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TQyjD-0007Mn-7c; Wed, 24 Oct 2012 11:02:27 +0000 Received: from tx2ehsobe001.messaging.microsoft.com ([65.55.88.11] helo=tx2outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TQyj3-0007K1-BH for linux-arm-kernel@lists.infradead.org; Wed, 24 Oct 2012 11:02:19 +0000 Received: from mail111-tx2-R.bigfish.com (10.9.14.243) by TX2EHSOBE008.bigfish.com (10.9.40.28) with Microsoft SMTP Server id 14.1.225.23; Wed, 24 Oct 2012 11:02:15 +0000 Received: from mail111-tx2 (localhost [127.0.0.1]) by mail111-tx2-R.bigfish.com (Postfix) with ESMTP id 71E901801A0; Wed, 24 Oct 2012 11:02:15 +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(zzzz1202h1d1ah1d2ah1082kzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h1354h137ah139eh13b6h1441h1504h1537h1155h) Received: from mail111-tx2 (localhost.localdomain [127.0.0.1]) by mail111-tx2 (MessageSwitch) id 1351076533673410_1294; Wed, 24 Oct 2012 11:02:13 +0000 (UTC) Received: from TX2EHSMHS037.bigfish.com (unknown [10.9.14.247]) by mail111-tx2.bigfish.com (Postfix) with ESMTP id 9626F80185; Wed, 24 Oct 2012 11:02:13 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS037.bigfish.com (10.9.99.137) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 24 Oct 2012 11:02:13 +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.318.3; Wed, 24 Oct 2012 11:02:12 +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 q9OB1oan031305; Wed, 24 Oct 2012 04:02:00 -0700 From: Huang Shijie To: Subject: [PATCH v2 1/3] serial: mxs-auart: distinguish the different SOCs Date: Wed, 24 Oct 2012 18:27:34 +0800 Message-ID: <1351074456-25863-2-git-send-email-b32955@freescale.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1351074456-25863-1-git-send-email-b32955@freescale.com> References: <1351074456-25863-1-git-send-email-b32955@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [65.55.88.11 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, 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 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 distinguish the distinguish SOCs. This patch adds a new platform_device_id table and a inline function is_imx28_auart() to distinguish the mx23 and mx28. Signed-off-by: Huang Shijie --- drivers/tty/serial/mxs-auart.c | 42 ++++++++++++++++++++++++++++++++++----- 1 files changed, 36 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 6db3baa..06d7271 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c @@ -114,11 +114,17 @@ static struct uart_driver auart_driver; +enum mxs_auart_type { + IMX23_AUART, + IMX28_AUART, +}; + struct mxs_auart_port { struct uart_port port; unsigned int flags; unsigned int ctrl; + enum mxs_auart_type devtype; unsigned int irq; @@ -126,6 +132,29 @@ struct mxs_auart_port { struct device *dev; }; +static struct platform_device_id mxs_auart_devtype[] = { + { .name = "mxs-auart-imx23", .driver_data = IMX23_AUART }, + { .name = "mxs-auart-imx28", .driver_data = IMX28_AUART }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(platform, mxs_auart_devtype); + +static struct of_device_id mxs_auart_dt_ids[] = { + { + .compatible = "fsl,imx28-auart", + .data = &mxs_auart_devtype[IMX28_AUART] + }, { + .compatible = "fsl,imx23-auart", + .data = &mxs_auart_devtype[IMX23_AUART] + }, { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, mxs_auart_dt_ids); + +static inline int is_imx28_auart(struct mxs_auart_port *s) +{ + return s->devtype == IMX28_AUART; +} + static void mxs_auart_stop_tx(struct uart_port *u); #define to_auart_port(u) container_of(u, struct mxs_auart_port, port) @@ -706,6 +735,8 @@ static int serial_mxs_probe_dt(struct mxs_auart_port *s, static int __devinit mxs_auart_probe(struct platform_device *pdev) { + const struct of_device_id *of_id = + of_match_device(mxs_auart_dt_ids, &pdev->dev); struct mxs_auart_port *s; u32 version; int ret = 0; @@ -730,6 +761,11 @@ static int __devinit mxs_auart_probe(struct platform_device *pdev) goto out_free; } + if (of_id) { + pdev->id_entry = of_id->data; + s->devtype = pdev->id_entry->driver_data; + } + s->clk = clk_get(&pdev->dev, NULL); if (IS_ERR(s->clk)) { ret = PTR_ERR(s->clk); @@ -805,12 +841,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),