Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753488AbcDVHEm (ORCPT ); Fri, 22 Apr 2016 03:04:42 -0400 Received: from mail-by2on0116.outbound.protection.outlook.com ([207.46.100.116]:20256 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751681AbcDVHEl (ORCPT ); Fri, 22 Apr 2016 03:04:41 -0400 X-Greylist: delayed 917 seconds by postgrey-1.27 at vger.kernel.org; Fri, 22 Apr 2016 03:04:40 EDT Authentication-Results: spf=neutral (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=freescale.com; From: Yunhui Cui To: , , CC: , , , , Yunhui Cui Subject: [PATCH v2 5/9] mtd: spi-nor: fsl-quadspi:Support qspi for ls2080a Date: Fri, 22 Apr 2016 14:39:48 +0800 Message-ID: <1461307192-866-5-git-send-email-B56489@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1461307192-866-1-git-send-email-B56489@freescale.com> References: <1461307192-866-1-git-send-email-B56489@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(189002)(199003)(47776003)(5003940100001)(4001450100002)(48376002)(1096002)(105586002)(5008740100001)(586003)(76176999)(104016004)(229853001)(50986999)(2201001)(86362001)(6806005)(1220700001)(106466001)(4326007)(50466002)(19580395003)(87936001)(19580405001)(2950100001)(50226001)(11100500001)(81166005)(92566002)(5001770100001)(189998001)(77096005)(2906002)(36756003)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB074;H:az84smr01.freescale.net;FPR:;SPF:Neutral;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC001;1:R/lrdcxPumPN26ntEabZzJu5U5/fsxyN5mDLAX4bOyUrI4TCt8fm7XYSnEHQYPbFR8+bh9KxPo2aJ7kELeO10wz5InP/G9pXH/yj05FhaOnfuZa4b40i6vS5DHsC3uEmgaWYveZcf3+u2MJAwIO5HzF7XBjvgiDAOvpfehgFjqcibPy/5JZ45tTi99cOEb3t/lN1GQnfxy9QWgjFb80iVtoiR9fX4o5oRzlB0PQ8PfNQWOOBTU7KLVn755ZAFw8VaUhiS6jDyen/Y5Oya0OYyA5YedmS6nasYTlPUFjjJbn/D3CnbA2mSPB6Et4F38vlkG9KrVw+sxK0czua/0jfO8HHEyGwHSDMMUEfcgAWPl3+BpHAdJzZBID9pfpCYqKaqAcLi3c0u4uEM+8g3rMbsnXhRziYXBKltEaNFZPSyAhD2U8sQ0rtXTDSjBhaEahsHssoQhj31WdGhfS7iEtCXsrNOLIXb9jrcRg811fN6BXaOnD2h5O+qoNr2lglVmUIXryvBKfaWZKvRlbY+vhDdixNp1xPY9Bmx6fcW0cWX5AF3BoA1LDhJRUcA4mNgDJad0xpqnXQjQWgKtOKf1Qqow== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 53e2ce51-e5d7-48d1-96ed-08d36a7a3ce3 X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB074;2:LG6parGorWlyClONHykO6z03BnPu7eeoR6xs8+yHPk8gON0hRNBuKsQvRUSdH4frRKVgOpnvthqq9xXn3Z9CSxx0YegnekUiSi4/4dxyjfmnWidLXbOQDp54BCRv6s+JrDriUaJ+O2R5chW4zcvwa/a/2lTlNMTnuJTov1M0NLx9XueJbeYpNMwuobk+677q;3:Pq7OkL8TJkOxe2qZ8YN/cErWAjMKIJYbkWz7C1BOO94E0KcoTVnVN7UyXbl1h8xXhx4ob/r99V4Cb/ZYSpcfqY3oMpnkVx093fi/2IlDRZ/74WhCRKKk4cYdApwnjyOZ0wyX/sEuriupP2B8E9/jfyRmC8L55+Ct9rb4MKZs3z7fCX+Z2cAAw1z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A30cthYjJiBlccmO/dNIhy26yG4u3u90AxHO5YIM9+2eko2odzOlPJrrIbKot/dgfeeXE/usQ3iSQs3Lsy4eeNNjaJ8OwVOKVmIZJh2cZfLjgavEVHwW9GdYQXdsjgUiTl9uZRjF0dXsJbf/0mCtrM9apvFBPJQiq5eZpaUmkC9JS8latDQLK10DbRgP3H+j0aUcQzMwxyClge6xGYjIq1ytKXPMkGclJuYPS4N2SeexqfC;4:3m7kTKqgn8nzn1KpXzihduYfWKavtKUsaJBvRLgCUr48i7O8TShOCF53xhKSWoMenp1w7vywxBDjjxR89DGM+kcTMie8AlFnClLWRftfJ9W/T9C0HfC7VNN3Y27sGbdS/rsS2AosD4F0/e4YIa0nHyL4y6V94afphS8hFy3Z6bUZn7cZUDR+H2PkpgBaHPCHri1c8DN1qo6HAz6jgiPAAgpeDxEpvt++zvaeoDFy02TLSKRsuhLej4YHHxhkzkbNUou2XuUoH5AOszXcEVkbTOvjV6wRj+m4fmD9Df6R7Q53NrTx3n0mYdEaRlObwunhiEDzl7w88pPLGkbnw8UetNW497fCiXMEsunyltyMZ3I1B0BrLyeRvkc43d4P52bmPQ4HgR0lYIctAUHBvT3nq0ph23IeOHoMPxu/2jiaRHJVHP6xNIH3RujLwdcj1db9qyqJoGUpLdQQDdyy1/wx7AXI1JsdZdCfveUgFvzQfmDESFlWQCaP1ypGj2g3Jsh0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(8121501046)(13015025)(13017025)(5005006)(13018025)(13023025)(13024025)(3002001)(10201501046)(6055026);SRVR:BY2PR03MB074;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB074; X-Forefront-PRVS: 0920602B08 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB074;23:Tfy5bPLG7bEahQev/DDI8QNVxoUm6l5euVraRB/mrp?= =?us-ascii?Q?IWIBa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XyPWdkfbU+hzuysHbY88b?= =?us-ascii?Q?JN25lNjaEWZSKlT1vmQ9Sl4zVW3/7VL/t54iNjUTufjM/pB/03BXrKd07738?= =?us-ascii?Q?M31x8bPpewD79ojvp5BPDd?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB074;5:+FDkl+y9jJ5PFlVFeCsp14JzRp0VbDhph2xQ/pCeGCUrPiefJOLb/TgScF4gBCYni1NW3ab9Q2iG3PLAkrg9eJveQKu4JK7wE330uaxijZzBuZ4E9ZQ2LH0GYKUpXDSXyXyTs16j+r568qxtGihd8A==;24:xEugkDZthwFHBzPCdgm2ZlIXrsJhU22CbCG1Zvab427nd1+bgP3GUKCtGO2XrkVsf2WJTzOoWqeuj4TrKMxMy2zgsoMIDC9n+0HrkYbXDpg= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2016 06:49:22.7134 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB074 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2930 Lines: 82 There is a hardware feature that qspi_amba_base is added internally by SOC design on ls2080a. So as to software, the driver need support to the feature. Signed-off-by: Yunhui Cui Signed-off-by: Yunhui Cui --- drivers/mtd/spi-nor/fsl-quadspi.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 16ebabbd..5d9d192 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -41,6 +41,8 @@ #define QUADSPI_QUIRK_TKT253890 (1 << 2) /* Controller cannot wake up from wait mode, TKT245618 */ #define QUADSPI_QUIRK_TKT245618 (1 << 3) +/* QSPI_AMBA_BASE is internally added by SOC design */ +#define QUADSPI_AMBA_BASE_INTERNAL (0x10000) /* The registers */ #define QUADSPI_MCR 0x00 @@ -217,6 +219,7 @@ enum fsl_qspi_devtype { FSL_QUADSPI_IMX7D, FSL_QUADSPI_IMX6UL, FSL_QUADSPI_LS1021A, + FSL_QUADSPI_LS2080A, }; struct fsl_qspi_devtype_data { @@ -270,6 +273,14 @@ static struct fsl_qspi_devtype_data ls1021a_data = { .driver_data = 0, }; +static struct fsl_qspi_devtype_data ls2080a_data = { + .devtype = FSL_QUADSPI_LS2080A, + .rxfifo = 128, + .txfifo = 64, + .ahb_buf_size = 1024, + .driver_data = QUADSPI_AMBA_BASE_INTERNAL, +}; + #define FSL_QSPI_MAX_CHIP 4 struct fsl_qspi { struct spi_nor nor[FSL_QSPI_MAX_CHIP]; @@ -312,6 +323,11 @@ static inline int needs_wakeup_wait_mode(struct fsl_qspi *q) return q->devtype_data->driver_data & QUADSPI_QUIRK_TKT245618; } +static inline int has_added_amba_base_internal(struct fsl_qspi *q) +{ + return q->devtype_data->driver_data & QUADSPI_AMBA_BASE_INTERNAL; +} + /* * R/W functions for big- or little-endian registers: * The qSPI controller's endian is independent of the CPU core's endian. @@ -558,8 +574,11 @@ fsl_qspi_runcmd(struct fsl_qspi *q, u8 cmd, unsigned int addr, int len) /* save the reg */ reg = qspi_readl(q, base + QUADSPI_MCR); - qspi_writel(q, q->memmap_phy + q->chip_base_addr + addr, - base + QUADSPI_SFAR); + if (has_added_amba_base_internal(q)) + qspi_writel(q, q->chip_base_addr + addr, base + QUADSPI_SFAR); + else + qspi_writel(q, q->memmap_phy + q->chip_base_addr + addr, + base + QUADSPI_SFAR); qspi_writel(q, QUADSPI_RBCT_WMRK_MASK | QUADSPI_RBCT_RXBRD_USEIPS, base + QUADSPI_RBCT); qspi_writel(q, reg | QUADSPI_MCR_CLR_RXF_MASK, base + QUADSPI_MCR); @@ -849,6 +868,7 @@ static const struct of_device_id fsl_qspi_dt_ids[] = { { .compatible = "fsl,imx7d-qspi", .data = (void *)&imx7d_data, }, { .compatible = "fsl,imx6ul-qspi", .data = (void *)&imx6ul_data, }, { .compatible = "fsl,ls1021a-qspi", .data = (void *)&ls1021a_data, }, + { .compatible = "fsl,ls2080a-qspi", .data = (void *)&ls2080a_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, fsl_qspi_dt_ids); -- 2.1.0.27.g96db324