From patchwork Mon Mar 1 10:32:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuldeep Singh X-Patchwork-Id: 12109419 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A7ADC4332D for ; Mon, 1 Mar 2021 10:35:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4838464D9A for ; Mon, 1 Mar 2021 10:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234140AbhCAKfi (ORCPT ); Mon, 1 Mar 2021 05:35:38 -0500 Received: from mail-am6eur05on2086.outbound.protection.outlook.com ([40.107.22.86]:13344 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234512AbhCAKeO (ORCPT ); Mon, 1 Mar 2021 05:34:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UTQ60qbteh1P+Umtqb9XmamT+pwJsuYLvBFj9IqxHp4ukjSX3tcM2k3CYwht774R0OTng8h2fecU6ZZM8BiakbLljXkGn4RmUsnI3ZXsryIXc1ZXpJaZH8EFFrFLuph3sc7NY9ev30xTufdUVqx4yXNPo2G7yE8Rt9QAKSrlMYmFfaqRfMucHcwalMQoc13BnKtG7p7ptXfGQGjzHLNP7kGN4gGyOdldfGQ8jAH7briBafiBh+LJBTUz9zolVlPQAI7T6C1+M9Sd5QC9T4iogZNx9EQgukA9rx8wj9HIU9ImCxl0YltcovyA9EmfXLEygOuHMcE9w+sLfbQ3fEhA6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+KdcLIJuE20GDPx8dfX8Ryie72EJbuU70G1qnuuEqnY=; b=JNGf5OIZL75cjsnwhOlYls3Yx5EG0Vo3JxHNEL5X/OjyiE8zNxltgFXWbidDk4JZqQeFFGIFpsg/CC1NoIFYd/SSKBwAUv9bijDsedEmrsuchncpu3ppqEK9cMvE9iQMTuKWkZ06fEAYxm7nW9Yb+HbBmaX9bulLvLscDeqWOVbiRDv7kszuTJ4+ee2uzGIdE2In70TcXSmO5Bv90s0HaQUY6DJ32c5xwusoVG/lPv3lJW+otdpjVRKOPVCM0H120cB5HnLm+VTMOJ7eYCYGw7jU48aAgzzQOSAvqheAQ80YHgEeLKBwVOOgQ+dstk4+xFacYSs2OV4sgNshRmqDsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+KdcLIJuE20GDPx8dfX8Ryie72EJbuU70G1qnuuEqnY=; b=L+SI0WWz7qhZqitAQ7EhbaYYmxK/H7aWO5NQ/+JU+jQNUgKsGniVR8sKadZaJochjx3Ykk4FqPK4a57UrKD/4N6QOgkPzzf0a6kzNiLGlqN8QEH9PnVef9CrmVR5ccfkXN4OeeIAnUg2oOUkqjqs08lWoHCvPKn9VdIJpEQcZkY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) by DB7PR04MB4236.eurprd04.prod.outlook.com (2603:10a6:5:27::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Mon, 1 Mar 2021 10:32:54 +0000 Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8]) by DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8%5]) with mapi id 15.20.3890.028; Mon, 1 Mar 2021 10:32:54 +0000 From: Kuldeep Singh To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ashish Kumar , Mark Brown , Kuldeep Singh Subject: [PATCH 1/3] spi: spi-nxp-fspi: Add support for IP read only Date: Mon, 1 Mar 2021 16:02:28 +0530 Message-Id: <20210301103230.1816168-2-kuldeep.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210301103230.1816168-1-kuldeep.singh@nxp.com> References: <20210301103230.1816168-1-kuldeep.singh@nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) To DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03378.swis.in-blr01.nxp.com (14.142.151.118) by HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Mon, 1 Mar 2021 10:32:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e3b0ac76-8df3-4e03-ac58-08d8dc9d5f39 X-MS-TrafficTypeDiagnostic: DB7PR04MB4236: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2wiAcurn/i5GSEroKiZ3hd+BiH/+zaJpPwdESsKBmm2cXxhJ8m80nndOXkw81LLOI8UiOAFFdOJiPTajXWi7Yvj+iEMw9jgTFwGMYcdo/FO6ZdzAxx25hCuzY1ivguYTAGtBMeMsIJ8PurU0qlQ86D0PVskV4CjNi2nXWwNUnYKISaJKbS0735tT5HPH4zPewfR54JGlJp0eajJ8FViZpg2/y8/+M/6WsemzbD7/hJH0duwXACLZlCunfCMak9HZBJDSU0AboSzbYZNj4poHe8nulPppQkmFmX22CqzzWSLLdlB4s1u9jR2Kn0qKUdSbehxGN4t8E2YVEyz7Z/mo893POjAvaMC1d/YjXkaIjgkmXW/i5kKBhvc6p96Wb1YkJDjqFazkCVrIeSOWTtu0xljyIhsW4oyBHATG4X14nJS+HtFf8yvzsd1mUbZzal2dC+v/lNCoDqGC8eCk/qhpvWyFQ8YB9a/DhL7FBRJkv1WTZYT/jlvChnR9MVqHo/0rGxLykkjPQU6AIT+48K1oC5TzwfwFRBVNFFuKxRSX62Vu7xfrfQUeTpWodmhIGpuXmug9Cf0YEFhidWwNBXV7FQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB6PR0402MB2758.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(376002)(346002)(39860400002)(136003)(86362001)(1006002)(5660300002)(7696005)(52116002)(6666004)(66556008)(66476007)(66946007)(54906003)(316002)(478600001)(16526019)(1076003)(55236004)(36756003)(186003)(4326008)(26005)(956004)(2906002)(44832011)(8676002)(6486002)(8936002)(2616005)(83380400001)(110426009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fbvse6f/8naleQZh69EZjT4Rz7AZU0e8qUfauQK3Z1vV9TqkOFoZ/rRSKdIkLXzWkCopC1j9XiqcJ7G3F8tcN6Fn3VLhLOF6eOjspJHBJlk8vAbm9zI7PRTDOi3o7uIFwFZ0lIIRZopTQoXyYAKWsHLd94jJNsr0IrLOGj6u26Z3FtWJnfUFz1kSZjUDiW3I1mevW5qUbQv/czgLob+Y6C9H2Kfq8gBnLk5ri/Bl9wm2cRavWPakOzbIp6UGH5GFSFwVDJrf9a2Ylu+QoLXw3bAe4kSVSx3OAp2nQmYgSVo1NqOmGGlzzCaP4FRM4Up3JPehx2x8G6AHL0j58mqfFRhdutxlzduyXCL9ZsFXQvWSy8DBiRnqcYWW8X90hmBTB0TQJtoEQI9a6aq077PyoLwxjhsMn8SZh2c8Kd10Is6CdejON0uV0SVJnJtmK4Gc1AuhQuu4uCAa1w/jVnkR9h+l5lbd0XpvR0ywEehURcZZIPqmBGO+qlpsBTKy2Bykx8MCT9CdVD7JJSKdvp2Q8Os4UejrrYhKL+TM5qtlVX3QI6266MwEqfWHzngq7RFUe9lYmFP/8i/jNjUSlBn0ZJSc9SAMFmVZ781R3ZhdNCfXNkc0eNhK2hJJfa4gb3aXtqkMh3cxIdmjoZ3UAZYuTa1zQnuPHmXess5AH3fQZHDNvbEC1gUV6+fuWJfc9rtxuYmY++Kqmc4loEGcqEr4rwg/3L6w5ENNK/ocLnTn0nmDLgwU/q1maddIAHAXyzSqiGR8hTQqLVj83vH0koc6ozIODcIqIE6FWYfW+hg523nyiIQD+jxfOPs7CXpW01SLpa6XLbtba2fo6yTTR4v6QlctWRtufOBEX0AtpuD7rYC+3FLWHQXDmH2RHbi+ZpWxj2oXNYq03ixc7aBn2o1SkgP4FLXMXt2S5q6hI3pCaoIyHpIrFOujJMh5GgYkllqo9jpO668PHBslgBMRgK4DU1Nd2fFKCSOM3AAJQqob2RMOJGYqBF/mw9IsbdQryXpIk+zRMBVcFW3mnYAYVccjAsRCaYkORONxKequrOFaWdz+qqTZYOJZlAsMVuj/DJhCOZrAwxrLP001WX1ZJyXyFGLcyK5jIBNrQISHez6mu6tDmR3zzQhTt/iP+ZZM16Kjyw3i+exciQ1pd+f7F25jSN3GX5IXEo34zjUQCLL6RkxhJXUcZBiAWsuJoLph9JUad9CK+6sF5LFCs4yw3jnGFqoJiuGJJcn8oCZ8hrAWjVVzq9C62+EUPjK2I8BJHSFOu/33d9N5Rae98x42lW1HeV/Pil28ZS/C+zj3RAcIwsilayUKeUfyL68YwmybmHKa X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3b0ac76-8df3-4e03-ac58-08d8dc9d5f39 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2758.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 10:32:54.1215 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x2Df8ROzFs9YfDAMG8PZ6QbwqsQsoQZU4UrvcXWz3xkooZUYRSrgHM/+vmW10BROYnlJ/XuAscHrwcE73ji5aw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4236 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add support for disabling AHB bus and read entire flash contents via IP only. Please note, this enables IP bus read using a quirk which can be enabled directly in device-type data or in existence of an errata where AHB bus may need to be disabled. Signed-off-by: Kuldeep Singh --- drivers/spi/spi-nxp-fspi.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index ab9035662717..829391e20e92 100644 --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c @@ -311,6 +311,9 @@ #define NXP_FSPI_MAX_CHIPSELECT 4 #define NXP_FSPI_MIN_IOMAP SZ_4M +/* Access flash memory using IP bus only */ +#define FSPI_QUIRK_USE_IP_ONLY BIT(0) + struct nxp_fspi_devtype_data { unsigned int rxfifo; unsigned int txfifo; @@ -359,6 +362,11 @@ struct nxp_fspi { int selected; }; +static inline int needs_ip_only(struct nxp_fspi *f) +{ + return f->devtype_data->quirks & FSPI_QUIRK_USE_IP_ONLY; +} + /* * R/W functions for big- or little-endian registers: * The FSPI controller's endianness is independent of @@ -553,8 +561,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f, for (i = 0; i < ARRAY_SIZE(lutval); i++) fspi_writel(f, lutval[i], base + FSPI_LUT_REG(i)); - dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x]\n", - op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]); + dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x], size: 0x%08x\n", + op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3], op->data.nbytes); /* lock LUT */ fspi_writel(f, FSPI_LUTKEY_VALUE, f->iobase + FSPI_LUTKEY); @@ -852,12 +860,14 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) nxp_fspi_prepare_lut(f, op); /* - * If we have large chunks of data, we read them through the AHB bus - * by accessing the mapped memory. In all other cases we use - * IP commands to access the flash. + * If we have large chunks of data, we read them through the AHB bus by + * accessing the mapped memory. In all other cases we use IP commands + * to access the flash. Read via AHB bus may be corrupted due to + * existence of an errata and therefore discard AHB read in such cases. */ if (op->data.nbytes > (f->devtype_data->rxfifo - 4) && - op->data.dir == SPI_MEM_DATA_IN) { + op->data.dir == SPI_MEM_DATA_IN && + !needs_ip_only(f)) { err = nxp_fspi_read_ahb(f, op); } else { if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) @@ -888,6 +898,12 @@ static int nxp_fspi_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) op->data.nbytes = ALIGN_DOWN(op->data.nbytes, 8); } + /* Limit data bytes to RX FIFO in case of IP read only */ + if (op->data.dir == SPI_MEM_DATA_IN && + needs_ip_only(f) && + op->data.nbytes > f->devtype_data->rxfifo) + op->data.nbytes = f->devtype_data->rxfifo; + return 0; } From patchwork Mon Mar 1 10:32:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuldeep Singh X-Patchwork-Id: 12109417 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38532C43381 for ; Mon, 1 Mar 2021 10:35:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0CCD064E2E for ; Mon, 1 Mar 2021 10:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234546AbhCAKfN (ORCPT ); Mon, 1 Mar 2021 05:35:13 -0500 Received: from mail-am6eur05on2089.outbound.protection.outlook.com ([40.107.22.89]:55680 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234581AbhCAKdu (ORCPT ); Mon, 1 Mar 2021 05:33:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VH8g8cXNcnaQYMRTTclYMlfj5Z9n+4HL3TpqVfx154TyX9qHEjDEy4NcCZGQMiIB2v2ud6pPVEKzLvJ8bsB3baCFLiJjYRSy5xjAywjkiS1EDlH4Tv68ZhycDq1uteE5SJ5OokobjKucxdYnQ5vOhQJH89dDAzpJE6x+69q2QNu2tZ6ksdudW2CElts/P1wGqLeDdz/YNZVpTC/iEX95fC/npYvgTtlz/rWZahgaI9ytZ+kME+b0HRsIxR9iomyt2U/A/08y7z4G37t0zaDLe6YEyL5pyCLNXvnNfYPbgReDCDX141f+xM4/Utg8xUPGrinwaeFMMeSN0QPBeqIIaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1+SVYIWvq9PJTpZM8DucAP1a2Hl/FFE729zmW4OtalQ=; b=FKZESkYKfRcm8SSqjQkWG3F9BFUXqNyF+Eyr0y0ILEjJCIahPsL1ZHmfdPVy1Ssk9TsqWWxR1tqz1Kwt+gvx6MG1/kh7gvj1+pV4V98QrPSOW2ENHrlgEv5AC5t0d4GpXIhIxoGHApRZRj6w/Qr/+4OzHlPoKSk+gh178aeeYLS2sDqygZ/O3Zg5P3e1jibxQhWnCprJfNOS6xoxJyPEaDK25DgDG1sapqsy483GGURMW1dxRmTpZ8CWzVFm22ZzK7mMRkooyA6kJqF/VC/uINqXkmzVXRh26GdTTyANKnqK3Ws0lTERB5n5dStSluJCf1bxAko7o1RlCn5lAJBU5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1+SVYIWvq9PJTpZM8DucAP1a2Hl/FFE729zmW4OtalQ=; b=cXqqo10Yt+N1CTdB+SDUy7Hk7xr1YESWK4Yd5eYz8iZob06oFWvp3V+DV6JWwbPGPtLncitX7sgAQ1Cr/p/ejOih21ltLbJ3lfpyswA0Z2TwH+gcz5bHwbi4iuIjyyxE0znZtAIXYbagHkv+SmnLJrMsBT3bwamy9T7ewWVDcB8= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) by DBBPR04MB7563.eurprd04.prod.outlook.com (2603:10a6:10:206::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Mon, 1 Mar 2021 10:32:57 +0000 Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8]) by DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8%5]) with mapi id 15.20.3890.028; Mon, 1 Mar 2021 10:32:57 +0000 From: Kuldeep Singh To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ashish Kumar , Mark Brown , Han Xu , Kuldeep Singh Subject: [PATCH 2/3] spi: spi-nxp-fspi: Add driver support for imx8dxl Date: Mon, 1 Mar 2021 16:02:29 +0530 Message-Id: <20210301103230.1816168-3-kuldeep.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210301103230.1816168-1-kuldeep.singh@nxp.com> References: <20210301103230.1816168-1-kuldeep.singh@nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) To DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03378.swis.in-blr01.nxp.com (14.142.151.118) by HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Mon, 1 Mar 2021 10:32:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: ce17b3ac-36f9-4a6c-a4df-08d8dc9d60ee X-MS-TrafficTypeDiagnostic: DBBPR04MB7563: X-MS-Exchange-MinimumUrlDomainAge: kernel.org#8760 X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DKp5V0yiAavs0HRlxubeTiPck1jVxgkCpwNiUWBlzkjfxbBBu3w35LcJ3vY9OX+OWPmipHIy13p7W6AmxtY/c7w4O1vpr+U9eREX0kLAhO3gC9i923x7DVf9+9IxC+aBkdnkrecnAXEu+VkgxmRuLqKuml5DCqHpv3KRwbS0FNk116XmviJ7MBS/hw8pFJJhxMnVw87MwE27ILOgXJwdA3XKYp3GJMKkHYKqXkNkt2vq6whooTqAzm2Mdou4BRZ26EK77mt5ayUrSbGW69YWRH2ZpcHjX7YJ1xNtUkCgZosE9GDYQIpW1rRXRIxvwJ+ll5M3EGaBRwG5Dvrzxg+8jAUoZBYx30XUiocSiVFExyjfx3Uex10S1KT7LPzNvJfgh3zPXhLpbhsvhwWtv8HGM3iWM9hzMBxM+tsNqS7BfHpiV4DYQzkrXfHUDOyGJ1wuRvYzuZN6sfXl5A20udOcYLGDhtEhmD2DUpb3eDopAmwUeFdaEdRZZExnJVngtR54MskaX1R6YQrA25jFjqRbMZIXH0wKZ2rLiPihKMUT3G9MT1nGA3J2h7z0T0UYpCvQjEWpuR2HRzQXkFR0tfftnhSUyV5NyaIfLE6gidjk205jAT8DKadX9g7Ls3fZ+Shu81Fjn1lREFGE/713nmUDW2jmYC8grRONJvt5FZRyWTk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB6PR0402MB2758.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(136003)(396003)(376002)(366004)(39860400002)(346002)(956004)(2616005)(1076003)(66556008)(8936002)(478600001)(66476007)(8676002)(966005)(4326008)(55236004)(2906002)(44832011)(1006002)(6666004)(66946007)(6486002)(16526019)(186003)(86362001)(26005)(5660300002)(36756003)(54906003)(316002)(52116002)(7696005)(110426009)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Dw0/ZI56v1TVU0n84KEyuBscQcZW7uWG3t8ZgQUB0rt/IOL1hhoIUgud6PX1fR4GkCtkusk0hU6+ZKwVta8AYNXE+dyMIGIuQh7D9V5Y3uZj87SqNXtTqcUtCmWW3TArW1ul9G2c7EtxlVMtRBzPGO9P/CIhoILNlJXbkgRo6Rkk+rwZk/f8IAH9F/FmOBkAQqZreULTBOmYDw8Ktgly8a/KwGc6ij36X/CS4jHc2jpvA36UUyrLFoZ01Ai37uUs8ssiHZ7SW0vqkarbtzLxR2f6D3n6xz6ehCPeIn/QMiWSq6H/zLZvCy6yKmHTck92P/AUoiIxAvNrtMSPqOo99fwjiDWq3U3YVptfjDegk+5FzXgZj1zP48XTleMkpAaBmY8iye5Cc2AuFRFvURgX5TgiXg3YFjgtR2CEssExZex6Zpl4LDLfKIEURC75250A5cV1h6YixRu7SY0agm5ChAAsax+/LzQ3zizzjZ0btIZMPx2EBpmYR54efLPzOdgoPXd+VWPpqzg9kHWkDJBWpRw5Yf4bitbAhka9mbaE+Ap4qxD3UJ914w6nm61Ri/+d4FNdBic5zXNIF+h24zC6YNQI4KmXQMDkauUXBSXNbAUEDkoXrGDzO442NSMXIfQ79pW9a7BMcBBiXKoRPX1m15FrhezzR/1lR7F20oO+E1R0Leu1iBVDP5KdXWeE7fTjz9Y1OFkdIlHZhHydqikqBE0Je033C8IG5K13UXoReW2CKvZof6+OeEImG1/ILpt6Gc1gHkyrVicu11JvCZWn6ixto8cSkbCpMiZ5bvnejKhMW428B8pqTFcaWRwtmwqTdPCnb+oj0+ATbq+Vp3KRvXe2sb2l5rwIxKLhnOpsjBwogR34s2tt4mb+EuYI1PxFGrvavW9f++efI0EjrIPtDTdtnQ1mHLFpS6GE+t1KNFf8LsUh9iTN57K4QZkymSYYfXW/vc9A0NrHilBJf8SgKbbSlhFf2TIvhhUVpaDgv5yiJ3RkcFiWxClme+N/zKbG10xuyitYvdfO5Hhz26jXYbWRstRMyyypTqbnWuf/jhwcb4D+JSdvH62qUAgcTOlSfM6cFST6ifEfnygIwFyU8RbpjztnW4bGfn3TtkHJWybcteawp2D7hv16VtcB9Bg7hWQG2FLjXvfnMv87RbO301TkLQHtcGSm1wNCdy5lQuadTSQ5WmdyDHLP9+FnOZKZ8nR7kczjTMcD+yPr2qJg+qT//keugQg/EBVo6RnVvpRfIyMFtfUyUpy7s80lLTvUfEWNkMWrngn3tg9dOFEeMTbvP7VaRLbSlUK3ccRlgHDrqLD5EX0YsgPzYcQFSW95 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce17b3ac-36f9-4a6c-a4df-08d8dc9d60ee X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2758.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 10:32:56.9432 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: y+s5x9QOEyIANyX+Nu477OnAEs0e4AbOGnNkXWM1Cf3GvkFddphaX9Q+fBHKQOv8lADcoPebk/hdBqQyGKUJvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7563 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org From: Han Xu Add driver support for imx8dxl which support read through IP bus only and disable AHB bus due to an IC errata. Use the pre-defined quirk FSPI_QUIRK_USE_IP_ONLY directly in device-type data to disable AHB read. Signed-off-by: Han Xu Signed-off-by: Kuldeep Singh --- Hi Mark, This patch is dependent on https://patchwork.kernel.org/project/spi-devel-general/patch/1614593046-23832-1-git-send-email-kuldeep.singh@nxp.com/ drivers/spi/spi-nxp-fspi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index 829391e20e92..80a9278d91ed 100644 --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c @@ -346,6 +346,14 @@ static const struct nxp_fspi_devtype_data imx8qxp_data = { .little_endian = true, /* little-endian */ }; +static const struct nxp_fspi_devtype_data imx8dxl_data = { + .rxfifo = SZ_512, /* (64 * 64 bits) */ + .txfifo = SZ_1K, /* (128 * 64 bits) */ + .ahb_buf_size = SZ_2K, /* (256 * 64 bits) */ + .quirks = FSPI_QUIRK_USE_IP_ONLY, + .little_endian = true, /* little-endian */ +}; + struct nxp_fspi { void __iomem *iobase; void __iomem *ahb_addr; @@ -1168,6 +1176,7 @@ static const struct of_device_id nxp_fspi_dt_ids[] = { { .compatible = "nxp,lx2160a-fspi", .data = (void *)&lx2160a_data, }, { .compatible = "nxp,imx8mm-fspi", .data = (void *)&imx8mm_data, }, { .compatible = "nxp,imx8qxp-fspi", .data = (void *)&imx8qxp_data, }, + { .compatible = "nxp,imx8dxl-fspi", .data = (void *)&imx8dxl_data, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, nxp_fspi_dt_ids); From patchwork Mon Mar 1 10:32:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuldeep Singh X-Patchwork-Id: 12109421 X-Patchwork-Delegate: broonie@sirena.org.uk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED124C433DB for ; Mon, 1 Mar 2021 10:38:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A42F64D9A for ; Mon, 1 Mar 2021 10:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234553AbhCAKfn (ORCPT ); Mon, 1 Mar 2021 05:35:43 -0500 Received: from mail-db8eur05on2058.outbound.protection.outlook.com ([40.107.20.58]:30065 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234529AbhCAKer (ORCPT ); Mon, 1 Mar 2021 05:34:47 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j5JUjav6wHy1WXxBIp4LBBhLN2UBa8QwgMkGUbd8/xBtv1pAGtJ4oSHZHasfTJp2gzk33fZoYflaxaBmXI7up6ySP3c9vt3PoZesUFtiWgnLAM4yurqh8cqjIYpBj+45U6URro/3ct4fxdLzPZ7r6Zb58NtRu6mvMixMFdPyoYVABN7nCDwF2se5IcdyO1c9pHNETcBZwk3zCQKdupW4zwl/DvSkhXL7W66aNZX+Thvu4pY+gpR1vIeCk7xqp7ce844Co91GaYM6Ta0mtBr7MXXJPRm8NAVQIk95kD30UA0YtGfcBp+MPd0IhD8Xev/iVeg5dI/mpqgnm/jx483ZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t+nFiHfFsRaPkGmsIh+NQxftSzcBvei4591GfU8ZTPQ=; b=F7MaveRBzUOEXR4mNLHYXZHnWXmU+4VnwewWkm1hkl71+Wc0KhEBFwZo6JKm6ojbDZyH9xYszDjML8XyP38941/56nZxitqoaXocwhAPiKYTyUhWlzGXxhs+tK3muhit3HGsSWQLftm1NzkyFuLXjw5WKzNFh0dXpry0KvjE0FTDhW6hf1uz1hK/R2tSaUQP4KrerPJsQOaBdkqliwvhKiix5elPtA746kt6jeC5Ijsr1Z6epe/5NsYK/rlgvJmegdBOfzU1ZBe9r3BOBQXNKyVA14D0rDHPTQTJzsBn2ifaB2b3PAtTKtIX3EBa+PhGaOS7EUB6MxVCHPnO0HLU6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t+nFiHfFsRaPkGmsIh+NQxftSzcBvei4591GfU8ZTPQ=; b=iioPvQuqh/6e+dr7cHGjrVxXFgwsi9aGIJs2vKNKDJude6Vg1evA0wrffyj+X3AtNDB7f6EjIu5x16ML+O4b046OoVJ8a03aOz2KVPXxhveNlDuN5cOA/QRzh54/AxjyI3sRFrcSY5j37tPXwClyBnFMLw059JMN6FBUjnWNbKc= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) by DB7PR04MB4236.eurprd04.prod.outlook.com (2603:10a6:5:27::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Mon, 1 Mar 2021 10:32:59 +0000 Received: from DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8]) by DB6PR0402MB2758.eurprd04.prod.outlook.com ([fe80::c99c:dbc3:ed75:e6e8%5]) with mapi id 15.20.3890.028; Mon, 1 Mar 2021 10:32:59 +0000 From: Kuldeep Singh To: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ashish Kumar , Mark Brown , Kuldeep Singh Subject: [PATCH 3/3] spi: spi-nxp-fspi: Implement errata workaround for LS1028A Date: Mon, 1 Mar 2021 16:02:30 +0530 Message-Id: <20210301103230.1816168-4-kuldeep.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210301103230.1816168-1-kuldeep.singh@nxp.com> References: <20210301103230.1816168-1-kuldeep.singh@nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) To DB6PR0402MB2758.eurprd04.prod.outlook.com (2603:10a6:4:96::7) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03378.swis.in-blr01.nxp.com (14.142.151.118) by HK2PR02CA0142.apcprd02.prod.outlook.com (2603:1096:202:16::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20 via Frontend Transport; Mon, 1 Mar 2021 10:32:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: dad9ab8a-f4c3-41bb-ca8c-08d8dc9d6274 X-MS-TrafficTypeDiagnostic: DB7PR04MB4236: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SnOzIUOKT8KS9oCQmR8TMcjucD1bQK8PqOjV8G13PSRJ+JgIMDCwuPcDXSwgYbmaBjaT6N3z/X92HrFb1MSCKgoeEIqO9sPTd6UEQViStFO9Ax2cuEx7DFeNLg36CBKHN1f3xo20A+wD3v3oveMjWia0T7HVMUznDYVchCRSgrrUhPBPERmYhOyJC31p52j5D8eJa6HQEr3iCnQnwDSrKyFsCzeyYTbAOSBzMlyDVg8tKh4UHhZSixCPpXs84sF/3bXZNMubMvV7NCU8mi3TFH8Mo5/QzsUUz/1D+QiVbQ+g/iu019h5t89VnD1MRjDaIsMQxPrxT/UxQ0d4zi3HIRRxQT8eUEx0a+LwauU8I86xTIXuPxkWNyOgB0ToEh3Prd33zRg2RsIaJBgdjzgOTj8FHPtKU8NfmFo/mrM1u3e2AsytWKodYfXKFJYQDnYYU24ii21RmmGGhEIVIYzzlHOLSd49GxXv7jtsnkx8C8hckPIX38pXeZrJiERAUA7GrbBURpk/Mrq7kPwGJrJE7bcrKTS1ps5XvxSwgqyqRGY2y2niteDvTlrFD9tDLsHqLKI6MJcTNk0dgBZeX7bL0g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB6PR0402MB2758.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(396003)(376002)(346002)(39860400002)(136003)(86362001)(1006002)(5660300002)(7696005)(52116002)(6666004)(66556008)(66476007)(66946007)(54906003)(316002)(478600001)(16526019)(1076003)(55236004)(36756003)(186003)(4326008)(26005)(956004)(2906002)(44832011)(8676002)(6486002)(8936002)(2616005)(83380400001)(110426009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ns3BVE/HaIMQXXRZnSfXh0+KiJOyFkRmelu9QepZNF4T1wMtD1HOsRwDPnVaPgIsutXxO7dcaOks47EJG2rnI/lQEDHOEcPe7D9SDPIkpOOtMjiarKCPvNcH8SeFwkY2SH62ojZQDQxe8PZTDI4IKzTr128eaWxy7FK2TVeecQq5VLfPuTN6JL4UHydHL5ymBACUdzei/p0tdGGtQm5e5junE7jcw7UqbGIF0p62MejwNTjbkvd+82oe3K/RzwrVpddieqh3HjMXBXp6FKeb58J907L2QP+TEYta6ImTVuPqhW+pzWsEcxPiIKaStrJKscD/i8oq7zPJfLpkJydcYMbzTefLKXKgSt+P68kk4YNS267Zt94eEO5Il2YfYzNumRP7g4RKuUkkhorbbCRad675FFU9wm/wwYba/nX4QqwtKKuRCyYeSRPcWBFEuKeZhKEa8W+t8X8sPdrSOnFquJujJpFazxaXdcKp540jRSI7RLqV23DbFCU6NVZRRn7f8uesmxJvbNp9OPVBU8i2cbf3Q0uUpjARc807QgXgqr8ufR/0sezuOGTMwTHjbCji3GfpsmAFMrpLfbbJtDxwkQJetKlJk4x7nxx89IyQ33G5Ime6J1698YSDZqHfkjzCHE5SCvCjsb7pYYSHwODj9r+3T9E1Cr8pVCF0Bn9LK9gmNU3w8geOcRgiF70oqriFq5/EaGQKZ6mmtxLhL+KFa/vmmxAdTIYJ+0GB9OCHYafbpgavry/APX3o+wIfbij06ppG2++8zPGNp5HyeoSAisKDK2txZBxaqT40mPHmMPMTfFImO2FAQ5GNFKv0C7O3KOlVqaYav360IlHAdrzrCHBfej7QrRRLmWZMgEmDpoWzAiDTQ85hCXO8RPRqNfLVv3ltQnV46+oUPZv44rmEJ4EA7mjPBkasqGk4kGC49Nlkq4f6lKXBVepUtNnLfJJXfG3F3yxkTvNm/oxy1oTYVWYsr10hZ7A2WWxCRzc+6uLnmjwYEW0u3r1IklfUaOOO1++D5CaYRJkvpdX+4ADZ8cisGjmTP93K+BDm1RgcpvV8AURSoersTJfia9xmuYhzZSstzSHIjyP9SskzIf5+TOp0KMzS2GEafIpkmKh7AL1h0o+fgJcA8XaMEwWun85XspLOZS86pZcjid6HCrwSA3ekAwR0Acy0UD3AHZrKEMROaLWXqNR6gT514y56Nt945SJXhVbE99W0LBfyr5FcE1l0YEA2S1jR84mhJqnNR3t3XrO+kix30/9FpXjc5l7uPQks2IqOs5GZdaMjUc50/d68/S8OKCca8JLkmNjIm0mJarESmBPlZHZU0SDh7PrO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dad9ab8a-f4c3-41bb-ca8c-08d8dc9d6274 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0402MB2758.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 10:32:59.4751 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E42hychlzlUKNJObIc8SeosfCQrxEyI0wvtBbuVhTexza8yoS2tEDL37PwqKtCRNY60JB/QMV4LJ0ClwTYPg8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4236 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Errata ERR050568 description says that "Flash access by FlexSPI AHB command may not work with platform frequency equal to 300 MHz" on LS1028A. By default, smaller length reads(equal to RX FIFO size) are done by IP bus and larger length reads using AHB bus. For adding errata workaround, use IP bus to read entire flash contents and disable AHB path when platform frequency is 300Mhz. Signed-off-by: Kuldeep Singh --- drivers/spi/spi-nxp-fspi.c | 79 +++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index 80a9278d91ed..ed1e888c7ece 100644 --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c @@ -49,8 +49,11 @@ #include #include #include +#include #include +#include +#include #include #include @@ -311,6 +314,8 @@ #define NXP_FSPI_MAX_CHIPSELECT 4 #define NXP_FSPI_MIN_IOMAP SZ_4M +#define DCFG_RCWSR1 0x100 + /* Access flash memory using IP bus only */ #define FSPI_QUIRK_USE_IP_ONLY BIT(0) @@ -322,7 +327,7 @@ struct nxp_fspi_devtype_data { bool little_endian; }; -static const struct nxp_fspi_devtype_data lx2160a_data = { +static struct nxp_fspi_devtype_data lx2160a_data = { .rxfifo = SZ_512, /* (64 * 64 bits) */ .txfifo = SZ_1K, /* (128 * 64 bits) */ .ahb_buf_size = SZ_2K, /* (256 * 64 bits) */ @@ -330,7 +335,7 @@ static const struct nxp_fspi_devtype_data lx2160a_data = { .little_endian = true, /* little-endian */ }; -static const struct nxp_fspi_devtype_data imx8mm_data = { +static struct nxp_fspi_devtype_data imx8mm_data = { .rxfifo = SZ_512, /* (64 * 64 bits) */ .txfifo = SZ_1K, /* (128 * 64 bits) */ .ahb_buf_size = SZ_2K, /* (256 * 64 bits) */ @@ -338,7 +343,7 @@ static const struct nxp_fspi_devtype_data imx8mm_data = { .little_endian = true, /* little-endian */ }; -static const struct nxp_fspi_devtype_data imx8qxp_data = { +static struct nxp_fspi_devtype_data imx8qxp_data = { .rxfifo = SZ_512, /* (64 * 64 bits) */ .txfifo = SZ_1K, /* (128 * 64 bits) */ .ahb_buf_size = SZ_2K, /* (256 * 64 bits) */ @@ -346,7 +351,7 @@ static const struct nxp_fspi_devtype_data imx8qxp_data = { .little_endian = true, /* little-endian */ }; -static const struct nxp_fspi_devtype_data imx8dxl_data = { +static struct nxp_fspi_devtype_data imx8dxl_data = { .rxfifo = SZ_512, /* (64 * 64 bits) */ .txfifo = SZ_1K, /* (128 * 64 bits) */ .ahb_buf_size = SZ_2K, /* (256 * 64 bits) */ @@ -364,7 +369,7 @@ struct nxp_fspi { struct clk *clk, *clk_en; struct device *dev; struct completion c; - const struct nxp_fspi_devtype_data *devtype_data; + struct nxp_fspi_devtype_data *devtype_data; struct mutex lock; struct pm_qos_request pm_qos_req; int selected; @@ -915,6 +920,59 @@ static int nxp_fspi_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) return 0; } +static void erratum_err050568(struct nxp_fspi *f) +{ + const struct soc_device_attribute ls1028a_soc_attr[] = { + { .family = "QorIQ LS1028A" }, + { /* sentinel */ } + }; + struct device_node *np; + struct regmap *map; + u32 val = 0, sysclk = 0; + int ret; + + /* Check for LS1028A family */ + if (!soc_device_match(ls1028a_soc_attr)) { + dev_dbg(f->dev, "Errata applicable only for LS1028A\n"); + return; + } + + /* Compute system clock frequency multiplier ratio */ + map = syscon_regmap_lookup_by_compatible("fsl,ls1028a-dcfg"); + if (IS_ERR(map)) { + dev_err(f->dev, "No syscon regmap\n"); + goto err; + } + + ret = regmap_read(map, DCFG_RCWSR1, &val); + if (ret < 0) + goto err; + + /* Strap bits 6:2 define SYS_PLL_RAT i.e frequency multiplier ratio */ + val = (val >> 2) & 0x1F; + WARN(val == 0, "Strapping is zero: Cannot determine ratio"); + + /* Compute system clock frequency */ + np = of_find_node_by_name(NULL, "clock-sysclk"); + if (!np) + goto err; + + if (of_property_read_u32(np, "clock-frequency", &sysclk)) + goto err; + + sysclk = (sysclk * val) / 1000000; /* Convert sysclk to Mhz */ + dev_dbg(f->dev, "val: 0x%08x, sysclk: %dMhz\n", val, sysclk); + + /* Use IP bus only if PLL is 300MHz */ + if (sysclk == 300) + f->devtype_data->quirks |= FSPI_QUIRK_USE_IP_ONLY; + + return; + +err: + dev_err(f->dev, "Errata cannot be executed. Read via IP bus may not work\n"); +} + static int nxp_fspi_default_setup(struct nxp_fspi *f) { void __iomem *base = f->iobase; @@ -933,6 +991,15 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f) if (ret) return ret; + /* + * ERR050568: Flash access by FlexSPI AHB command may not work with + * platform frequency equal to 300 MHz on LS1028A. + * LS1028A reuses LX2160A compatible entry. Make errata applicable for + * Layerscape LS1028A platform. + */ + if (of_device_is_compatible(f->dev->of_node, "nxp,lx2160a-fspi")) + erratum_err050568(f); + /* Reset the module */ /* w1c register, wait unit clear */ ret = fspi_readl_poll_tout(f, f->iobase + FSPI_MCR0, @@ -1036,7 +1103,7 @@ static int nxp_fspi_probe(struct platform_device *pdev) f = spi_controller_get_devdata(ctlr); f->dev = dev; - f->devtype_data = device_get_match_data(dev); + f->devtype_data = (struct nxp_fspi_devtype_data *)device_get_match_data(dev); if (!f->devtype_data) { ret = -ENODEV; goto err_put_ctrl;