Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp254945imm; Tue, 12 Jun 2018 23:10:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKN0oDgxxUNjXUMz77mrpRB3nD3KEhB7y7bv884Ksj3BxUpuJWVd7rBtXlVmfqOzwGUBZuy X-Received: by 2002:a63:8c10:: with SMTP id m16-v6mr3009328pgd.120.1528870230200; Tue, 12 Jun 2018 23:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528870230; cv=none; d=google.com; s=arc-20160816; b=tcww8xOYFbhY+bjnF/qGZKSD3I06g2ssVTYArl4QQ+2KKfvd8GYSboBlhFEwdVU/px hlsUgGohBBIsaQu3hiCJeV0SbsV+Z6hC9SpV9iS4FQ/1eQlRxd+hiT3iWWqIRQZuosRc aeuMLoiOpPlxqcvVM7XQpZCcD5wP9ElovW1WV/lQvOBQ7dSKHSfS5hFjZdCjZAWouirk KogVD/H1hpCWfJaHhtGPuuwZugPgabY7IG/F6J5QrAGeBWr19mQLy/1XNezwWmaWHlMa lHy9+rJlwImFDwcWuTvbGVTENfZfxVtSgfTabARsGkpKUGBu6b9XUXFzeg2KrAuf8Ijt 9sww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=Gh//wxILlwghAkKbK/VQG/ZPAIKnYD/teoCB7miznVc=; b=BnljjMeKc9Mn9OFWMEQi6ZyC3dt9H5gZNlq6ufuFhV0Y14A6FRuolaGn43kbg6rlXX Qstq/QCVZ6ECzd68A2xuhbpooYGgfuvrLp9FeO6l8BnzOa76FewcbfKnQOmnKCJG3DVi isgAxuN9bBHvnaWTCw3RGUDa92wHWya9GM0ymqdqAHQbutAoiXS9h/9fbsA7E44Wm2hf SXKcS+IejnxrZ3OlwG70b8Q2Pz+e2FYfGQ3VSaj8Xe8EIzHU4jXSngT17mAzQEfswWT3 OKk88i44666AStsxHCL0IxCI1y8QOCo5MfxARS2Yx6ah1a0s+ozZkwFqip+L5FNthnyI nQWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=lwCJiVBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x70-v6si1963309pfj.347.2018.06.12.23.10.15; Tue, 12 Jun 2018 23:10:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=lwCJiVBW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754499AbeFMGJq (ORCPT + 99 others); Wed, 13 Jun 2018 02:09:46 -0400 Received: from mail-eopbgr10045.outbound.protection.outlook.com ([40.107.1.45]:32386 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754404AbeFMGJn (ORCPT ); Wed, 13 Jun 2018 02:09:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Gh//wxILlwghAkKbK/VQG/ZPAIKnYD/teoCB7miznVc=; b=lwCJiVBW8yDgem1q/7aRbFcANp/3DPwgcDxE4lZEA0iRXIgk18sgVdvPbkFnpOOr35niltQuRo5thqfPJc7EcZd13oiDAGbQb6RKJFtUtdQZkThBKsu3Sjw/LJ8hkWVC9xfU5beLn+842BUqFA7h4LCTEJK4ESx9U4UMJ3E5/Tc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yogeshnarayan.gaur@nxp.com; Received: from idcbfarm.ap.freescale.net (14.142.187.166) by DB6PR0402MB2840.eurprd04.prod.outlook.com (2603:10a6:4:98::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.17; Wed, 13 Jun 2018 06:09:36 +0000 From: Yogesh Gaur To: linux-mtd@lists.infradead.org Cc: boris.brezillon@bootlin.com, frieder.schrempf@exceet.de, computersforpeace@gmail.com, david.wolfe@nxp.com, han.xu@nxp.com, festevam@gmail.com, marek.vasut@gmail.com, prabhakar.kushwaha@nxp.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Yogesh Gaur Subject: [PATCH] mtd: spi-nor: Support controllers with limited TX FIFO size Date: Wed, 13 Jun 2018 11:38:12 +0530 Message-Id: <1528870092-14526-1-git-send-email-yogeshnarayan.gaur@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: SG2PR06CA0183.apcprd06.prod.outlook.com (2603:1096:4:1::15) To DB6PR0402MB2840.eurprd04.prod.outlook.com (2603:10a6:4:98::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bd5294d4-e87a-43c6-ad26-08d5d0f43fcc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:DB6PR0402MB2840; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0402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Q06G3UcrBgdiTUPFktSQl7mGrahKoakWncOAU6XUDdxmoh9iKWGaUBzPWfqhAhCcDIZmHLq3YdwdXOixEUI2TzoTd8T5c4J+JKugT4EzKMPmbmvy+8J7x/TzioaZ55PNjHJSfAmyyl3j8FfhP9XTPNOr7kTk/fJXXJrFcW2U3sanAsU1XhGczm6Jf/xUMVtYmGGNKKmQ2VSV4SD0sWGQ14T7CKsE1NihqiF0YfFm5YqkMu4G0ThSXonikU1/YXNET2gmUbcAkmwxLxF9qz4a+5ZfDqdQe1mcKZTigNOUQATKxS2TAG7xNJ+MFOD4oRICEonCP15eUVl84YV4gUNOGYS5dkL855zJ;4:5SZbM7QgR0yR5oc4L4o9k9d4ONiub73/MZMT7XDQIeXAhs7nffBJYmA7s26pkLVF64jhHBqP3NjrE38dsbZgnnC1Fn13ZW0NOwelD+ygW/GCbzWO04igxORKnED1w7PYdoFn26GX208WaO64Kq7DzWOC8jnceUXB05w7mj1HWFni9rw4vq9rqzKUAY38IjGFah1A6/hlmlPQaasims/TsEwrxTSsx59y1XMtqrFI+xXKzYsr4gFLWRLMiVGhw8ch5GVuEgFlyD/5EEuPh/UP+86sDHIDDgWko2scPVJy3SM/CC6KXI6npbI//frVFRbJ1Ag5zh2u4XDDgtNR2RolhUSW8aAV9XeTtSBQEYNw958= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(84791874153150); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:DB6PR0402MB2840;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0402MB2840; X-Forefront-PRVS: 07025866F6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39380400002)(39860400002)(376002)(346002)(199004)(189003)(305945005)(6306002)(4326008)(106356001)(6512007)(51416003)(8676002)(2906002)(6666003)(386003)(6506007)(55236004)(25786009)(66066001)(68736007)(52116002)(5660300001)(48376002)(6916009)(81166006)(81156014)(6116002)(6486002)(3846002)(7736002)(50226002)(53936002)(50466002)(2351001)(2361001)(105586002)(47776003)(39060400002)(8936002)(16526019)(86362001)(186003)(97736004)(1857600001)(2616005)(316002)(486006)(26005)(476003)(36756003)(956004)(478600001)(5009440100003)(16586007)(110426005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0402MB2840;H:idcbfarm.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB6PR0402MB2840;23:I9LTH1w4w4L+Cm+hF4+WkyeCnx19TO1MrSnSMtU?= =?us-ascii?Q?HxYBOS9FS2Myo/63oymQo2ADyHF48VdEgRo2yvJZYCfpVMggYbNgy2iT2r9P?= =?us-ascii?Q?kXVV0ZD4LYBgBPi1NhKKWvOWEMA3lYDZ/6eiGk4V4YJ0NDT6wQ+xWCmMmsSU?= =?us-ascii?Q?T3ihDOTGVOeo4xOPVHVPDVljDZgHWaYStFX9efbNw15f2YHb0QC/Pz1TjCNC?= =?us-ascii?Q?O2ky7wLlqo2pXSgFKq/uuNEbpa3ewl0GaIh+se4ZM42SNLRoGrEL+05YZ79Y?= =?us-ascii?Q?pBAW7OlAxGQ8CauzJb8agqOn6Bn/FPTB1N9OHA2kXjijbjFsqqAR9Ru9X+bM?= =?us-ascii?Q?AcixA8seBsXBEKR+erLd9gEFyLhafMbOeMd3DlwedXsLyLho18Wcb5So73za?= =?us-ascii?Q?jcHJEvMrof9ACNOF3PIOWj9ph8fXHkFxKidw1qH+hkdi2XjVYpmCdsay83LO?= =?us-ascii?Q?dQjqKNReESKRzUSjBrVDuzemjUmqAyuaMRE4JwMD4ubO74PqqTEkfSHqjAst?= =?us-ascii?Q?0U2Pi+XzhImRusnNnf2VRTYRrngHo1HSSTbeb8uZCYh9DzCEMcWeNt/BCTs+?= =?us-ascii?Q?6tVQkcdeWxBNbnxaCeALtYTBVOIdd0hm/UDib3BrLEN0Gxt2vsI7xW2+JlbN?= =?us-ascii?Q?zJ58+caJW9IrHXeLR7iNMSF1di/zRosbulhBmZfWXge4uMew99DjP4hzId9Z?= =?us-ascii?Q?P3TLy83MstNdvLzEntpbo+Uo+2x7pe0zi94XF6xVe8+XuWM/kBnRiF7FehDa?= =?us-ascii?Q?qKkgoJpa3RKOCG9fJzbB8CmJ4tqDct58j6uI64oAKdAcqjFknWgF9hyuL6rA?= =?us-ascii?Q?O19qltVBMr8RmtSoEYvfd08wV4OGum7Gm0POXARMzMcP5gLtiLBD+Cfth6hT?= =?us-ascii?Q?LEPo9CHia4eKYHLOG/1TVspu1UacMNPr+hbOn0kI2G3CPZ5iJC6bN/MU9rO7?= =?us-ascii?Q?OIpfOgTprnXVdhq3sLGZN2oh+g9amXlky4VaJ4bLuKR0HUpS+vH/g35RGPDr?= =?us-ascii?Q?FOxHrTWITBziXqvsD9pyEEa2+WNoyLaMxJolkK4rks09LBUpdv+IsGKgemxe?= =?us-ascii?Q?4hDb/a7aKmNAYzNeaDgSXUp93z9R0vwsRpXpzGChus6bjUMt46WBGfq3aVYS?= =?us-ascii?Q?5B3hjTJaSswI1Xq09y2cqUQLI9sjKmaLTA7bczgGD2evBxVRuK+yMBoQNYc6?= =?us-ascii?Q?5S7J1dgwg6v+sYVGkca2naMEBME8uGQUNNtaAd8Byef96Strf1Kx9qsmaWQV?= =?us-ascii?Q?vyL8qMilIgcKxsfLD+4NrejrF7bkJF6nWVKMbYOMbZXjd/gdTvtmB7ghRmzu?= =?us-ascii?Q?iTWHzBqngrFNSWC5DkingL8I=3D?= X-Microsoft-Antispam-Message-Info: XbU+MzrS5SAnLqSDVJ0BAfDLT+llQ7bvMjbJvit3SGTmm4mjSZP3oES7rb8PuXZcdVoDsJNLD8VgeQV4oBopon/ATlu/NQIiG6kr4ABUhSdceEJMXnxmA6HrhMKIa8U9XEWt8F9Ozftdbx1xdEGOj8UEsrrnqU3mWQJxbdq5VHWSYE7LTod4OSPQYQk3X/jE X-Microsoft-Exchange-Diagnostics: 1;DB6PR0402MB2840;6:y7RiIzOIPeP3lOKbGEvguH7qS3pT5tx5geXsJczLLooJ0XR73jlLFQwRjqlO0p+nVZyU1444RA9pvVbWIZHFG1Pi1/c6KnsNuQpYktlnS0+5iJFe/gJNiB4Ag3U5FWBOzi1CyzFGLhdOdGYeQWt3rP5HHJyrHMxmRJ3oyVUZEYSqDkEVoOFoomFlq6osDYsEV7L7fLpwPSzH6532QzukaSCBcqkkFoJw31+X7fe8ZrURyh/ZWV79Ujibc5YFyLIrkB2Edx893eAp+AdMUsQsORhYCNSSeNlOT7dYQNoAqfqGK1OOQLBqZK/GWuIM6C7sfiYJpb/7160KPNHiVbtbTAnZOxI5/BCSAYPbmeAONupuCxH02MQ2+OsrhZ4mfqQPmTqyxv+l2k7fcFCOrYBOSDi3VfYOBNm+IV9/IKnF2ejAlKspa0V12biEBgpKatAjBDRyXZAWhzTqgEeIGdVWpA==;5:PmXVsJOUKHmsWZBPrNNXvMolqrRchK4QkBhOTST6u584vYkiyvM73lphvfwl30eHBqP0IFs7wt1I6k3GOGXvU5lLZPMeDubkPPNvEwqY4KZfneWg7AZ7OE+iEa3qyoYOeRZRtoLftkKcUCsOD0kTOjtfYEEmfNCTXbLmZQjIK+Q=;24:9loRNfpbhc8GcaiZaiPXoGSCCQim6uTcaRlyF8H+W/ITm7+3nP2MklPikLsBmP8axhbdRltf3PnNWZBHD8DiVp/zEQgcGcznJDQqZhSzl8Q= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0402MB2840;7:nVKE03mvZt33UDjN9k0twv3MMVaiGT0FQjnp0ra/ae8NxTKvolDM/nMbPOAjKI6BQo8IPj48+Epcms+fvW5iVg1dyriBwMEsV2sSEglxMviREAsKVSnC6LJRhpXMDJ3ARgJzuU9zHcQw5K3mUT2UC7KtWllG4R4aDRqMYq60x1Z+XUYk3lAiXOnR7Bthpu0/ykmZLw0pGtxfrcTltNdGRR9CJtAK5IR5RomM1Q0B0qxUAnFkKHdpVelnpFj6i6eO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2018 06:09:36.3886 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd5294d4-e87a-43c6-ad26-08d5d0f43fcc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0402MB2840 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some SPI controllers can't write nor->page_size bytes in a single step because their TX FIFO is too small. Allow nor->write() to return a size that is smaller than the requested write size to gracefully handle this case. Signed-off-by: Yogesh Gaur --- drivers/mtd/spi-nor/spi-nor.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 5bfa36e..3e63543 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -1431,13 +1431,6 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, goto write_err; *retlen += written; i += written; - if (written != page_remain) { - dev_err(nor->dev, - "While writing %zu bytes written %zd bytes\n", - page_remain, written); - ret = -EIO; - goto write_err; - } } write_err: -- 2.7.4 Patch is based on the spi-mem framework[1] [1]https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git/log/?h=for-4.18