Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875AbdFMDCj (ORCPT ); Mon, 12 Jun 2017 23:02:39 -0400 Received: from mail-eopbgr30075.outbound.protection.outlook.com ([40.107.3.75]:41440 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751768AbdFMDCh (ORCPT ); Mon, 12 Jun 2017 23:02:37 -0400 From: Andy Duan To: "A.s. Dong" , "linux-serial@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "gregkh@linuxfoundation.org" , "jslaby@suse.com" , "stefan@agner.ch" , Mingkai Hu , "Y.b. Lu" , "nikita.yoush@cogentembedded.com" , "andy.shevchenko@gmail.com" , "dongas86@gmail.com" , "A.s. Dong" Subject: RE: [PATCH V3 5/7] tty: serial: lpuart: add imx7ulp support Thread-Topic: [PATCH V3 5/7] tty: serial: lpuart: add imx7ulp support Thread-Index: AQHS45HTSLj7uFYtZ0+jgzg+FOoUiKIiGkXA Date: Tue, 13 Jun 2017 03:02:27 +0000 Message-ID: References: <1497281848-12995-1-git-send-email-aisheng.dong@nxp.com> <1497281848-12995-6-git-send-email-aisheng.dong@nxp.com> In-Reply-To: <1497281848-12995-6-git-send-email-aisheng.dong@nxp.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; x-originating-ip: [199.59.230.102] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;HE1PR0401MB2537;7:dEVO5u8fKulq6NiwbzrVN6bKcrMyK0636OWoqY4iYmW+dIJHNwA1GEWMhVshphVfpEKEkRyHf+tV0gjwjUdaUZe74V9xF9TV+wG/F+aqsVKhaBm2CYXxHfU9tnuMSbCPgjhMDHugqMS7Irgsjkazh2tk0xIWaa3m91i6mMa1tagtWACTuFkVhqDchuym15LGWzff5dYTpedORpW6kkN0fPJUvmyhfeU69H6lU/qlbWusQ4LXVSfdxEAypVHIuKOzSrXRCNcCqPEAvOkrKnhrgvnO5zHdIk/ufbB+93jEfZDzxnWSag6Y95xEB2r7k9Zf1H7UZ53vuZQ9Erkbtb05MQ== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(39850400002)(39400400002)(39410400002)(39840400002)(39450400003)(377454003)(54534003)(3280700002)(38730400002)(54906002)(39060400002)(6246003)(74316002)(3660700001)(2900100001)(189998001)(6116002)(4326008)(3846002)(25786009)(305945005)(55016002)(99286003)(6506006)(14454004)(575784001)(86362001)(6436002)(9686003)(478600001)(5660300001)(7736002)(53936002)(102836003)(5250100002)(54356999)(76176999)(50986999)(2501003)(66066001)(8936002)(81166006)(8676002)(2906002)(7696004)(33656002)(2950100002)(229853002);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0401MB2537;H:AM4PR0401MB2260.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; x-ms-office365-filtering-correlation-id: 3d0657c5-350a-44dc-e451-08d4b2089fc6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075);SRVR:HE1PR0401MB2537; x-ms-traffictypediagnostic: HE1PR0401MB2537: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:HE1PR0401MB2537;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:HE1PR0401MB2537; x-forefront-prvs: 0337AFFE9A spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2017 03:02:27.5239 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2537 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5D32ikb007147 Content-Length: 2694 Lines: 83 From: Dong Aisheng Sent: Monday, June 12, 2017 11:37 PM >The lpuart of imx7ulp is basically the same as ls1021a. It's also >32 bit width register, but unlike ls1021a, it's little endian. >Besides that, imx7ulp lpuart has a minor different register layout from ls1021a >that it has four extra registers (verid, param, global, >pincfg) located at the beginning of register map, which are currently not used >by the driver and less to be used later. > >To ease the register difference handling, we add a reg_off member in >lpuart_soc_data structure to represent if the normal lpuart32_{read|write} >requires plus a offset to hide the issue. > >Cc: Greg Kroah-Hartman >Cc: Jiri Slaby >Cc: Stefan Agner >Cc: Mingkai Hu >Cc: Yangbo Lu >Cc: Fugang Duan >Signed-off-by: Dong Aisheng > >--- >ChangeLog: >v2->v3: > * use standard port->iotype to represent the endians. >v1->v2: > * remove lpuart_reg_off according to Stefan's suggestion >--- > drivers/tty/serial/fsl_lpuart.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > >diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index >bbf47a0..9d05e53 100644 >--- a/drivers/tty/serial/fsl_lpuart.c >+++ b/drivers/tty/serial/fsl_lpuart.c >@@ -231,6 +231,9 @@ > #define DEV_NAME "ttyLP" > #define UART_NR 6 > >+/* IMX lpuart has four extra unused regs located at the beginning */ >+#define IMX_REG_OFF 0x10 >+ > struct lpuart_port { > struct uart_port port; > struct clk *clk; >@@ -259,6 +262,7 @@ struct lpuart_port { > > struct lpuart_soc_data { > char iotype; >+ u8 reg_off; > }; > > static const struct lpuart_soc_data vf_data = { @@ -267,12 +271,17 @@ static >const struct lpuart_soc_data vf_data = { > > static const struct lpuart_soc_data ls_data = { > .iotype = UPIO_MEM32BE, >+}; > >+static struct lpuart_soc_data imx_data = { >+ .iotype = UPIO_MEM32, >+ .reg_off = IMX_REG_OFF, > }; > > static const struct of_device_id lpuart_dt_ids[] = { > { .compatible = "fsl,vf610-lpuart", .data = &vf_data, }, > { .compatible = "fsl,ls1021a-lpuart", .data = &ls_data, }, >+ { .compatible = "fsl,imx7ulp-lpuart", .data = &imx_data, }, > { /* sentinel */ } > }; > MODULE_DEVICE_TABLE(of, lpuart_dt_ids); @@ -2020,6 +2029,7 @@ static >int lpuart_probe(struct platform_device *pdev) > if (IS_ERR(sport->port.membase)) > return PTR_ERR(sport->port.membase); > >+ sport->port.membase += sdata->reg_off; > sport->port.mapbase = res->start; Also update the mapbase. > sport->port.dev = &pdev->dev; > sport->port.type = PORT_LPUART; >-- >2.7.4