Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757275AbcDLWE4 (ORCPT ); Tue, 12 Apr 2016 18:04:56 -0400 Received: from mail-am1on0072.outbound.protection.outlook.com ([157.56.112.72]:64275 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753645AbcDLWEy (ORCPT ); Tue, 12 Apr 2016 18:04:54 -0400 Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; From: Han Xu To: , , , , CC: , Subject: [PATCH] mtd: nand: gpmi: get correct free oob space Date: Tue, 12 Apr 2016 17:06:33 -0500 Message-ID: <1460498793-19431-1-git-send-email-han.xu@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.88.168.49] X-ClientProxiedBy: SN1PR12CA0019.namprd12.prod.outlook.com (10.162.96.157) To AM4PR0401MB1842.eurprd04.prod.outlook.com (10.165.245.17) X-MS-Office365-Filtering-Correlation-Id: c90043d3-5893-475c-fe4a-08d3631e78cc X-Microsoft-Exchange-Diagnostics: 1;AM4PR0401MB1842;2:Zmqwt9dsMlbVcR2smgz7gglZ9ol66RxKovh4o1njrsIWWidYNm3vXGSz/SqEQfLsvsSFUtMqzWseexRCuY3A6YyQZ95X1Koo0MxPmUw5cj/XMaSwUmjVKnlBOWwVFY7pa2tZpiChLiy9Kf/J1rT91p2Z/pyuuyZnsUiAnfGHuy7BGs/31486ccTTZ1MzF/El;3:gHkjJaQSU8kji7SBNiAtmNqXzku2SZa/nDjXdOa3J9g8DIQQlaWoZ2uNRrxN5aQZXPZBCBQs49u1QdTnzwSivVLEUFWcaT3xw4+zQ6V+UsyWGLqiTtajvVzyp6PthUTw;25:C12K9Zef6StGJp0t3UN2/GQZ8aVL4CCL+Am4F/pxju6fJMaoYUCs/re6JCgMIWqiGIT7F0GN+KF5H5xmQqbBDPuXZFIQw2x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oe5r4jP5Wq+J3YNgg+rRLpDVaLtx0MDxze6EmUUHZ6B6h7OK713UoSQlAnoCTKCGXkKKc8zeWXxH5rGUy9kmxQ6vhSOmrC8oYMUEMhwtTpXxbVOC4zYWQneAI/XAm/fZkLx4KVtYtlkiDHZsBg6KhB8zStx0asPZvBYxb2JHnGYL5+a5pihWPQEdVyZqbkEoYndA4RENl5i+ub0YsA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:AM4PR0401MB1842;BCL:0;PCL:0;RULEID:;SRVR:AM4PR0401MB1842; X-Forefront-PRVS: 0910AAF391 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(48376002)(36756003)(86362001)(5001770100001)(2906002)(81166005)(189998001)(50466002)(1096002)(50226001)(92566002)(33646002)(50986999)(19580395003)(586003)(2201001)(47776003)(5008740100001)(19580405001)(5004730100002)(42186005)(229853001)(5003940100001)(3846002)(4326007)(6116002)(77096005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR0401MB1842;H:Cayman.am.freescale.net;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM4PR0401MB1842;23:+oEPmT7GasVp+n9VPwzD34tReCWC7u15Ir3k49KiIPWTA773iv9Ba9Yxm/aO19N7e6zOBaj0T9N0TNS+CcBWmXyp8C7/fx/9fI7HmDaJfUuLX+ug4o9Gkx0iXxDDcduerOypJxhRi7qNRXkVMSi4L1gZjJppBgjN84crJLEAvoiaEcJGyOfwU9FWCjLwAQMP8Ykep98/61kGSfh3xMC/6HrjbVqn+GSz8HiUIGw12SbF73NmeJJdsVGsvXevcTQD2/Nv13/1ZqN7pZFsgk6O4URRitxiycLxnrdFN7vWAcXVIqArrxx3Q/LiNm805dvvNGJWBHb/H4ARY5SOUc3TblmhUMYBP1JQHUJcVDFfq80BqczaRZQaM5UcooC1jWohgX3Hle9oNNOXpdqjFguLl9CUKWdndDeQvTWU0ef0LhhD6IZLDp8a6TzXQseJYWRSWoBYrA21CJoeC8gwhHnXtNNQ+MDXKifq1I+uxqb0DPtwEerf77GisKBTO6uSa+mTZ+G4HhJu8NJlN0gLQdwKDLlL+pLS2gMxop/MUeMEIAyab4qvkADJ7z0AdQToYC5h8szPakCdpaQAKCGkfKfVxmsTTz1DXXec5azTLWzLVn2NQDttNm7lo6aV3nwgkwOPTgUs/ldp6uOYXDK3OOukX+RpmAPSxv4+CbXKNabI6kcmM8zoLfE4xESj0EYjBeYiXxEgB4PWRGkSO4wbAql/Fm0aB6Evn1dY9U51rY27o/pH+VN7O1LG2hib/IKUmJK+wOuws+cFO3k+OmrmwA6G/+4iLi4aN/xg7pGnWgCe2hCTBOc4kj07328UlnZzKo5CJmMfB3bKRAiES3M/0bWPQA== X-Microsoft-Exchange-Diagnostics: 1;AM4PR0401MB1842;5:1SdvqaJGL3yCtpU+/c7TCqhPhVLlKp+ST6kDE5dt26DUeFLuizdkWz1qB8UDJnEwTYGzw1VT+YyyToiP73A8mTJy5U4C2lUkX18scOnljvMGvPdhM3XArdtkQwhjzS9NGKwpXE+Z4qx1PCkCZqltzA==;24:ZLKgO6orVw5IcSmpAbfZUZX9DItDDw/UMSMNvP941DzcZRGlsal/+6rJPus/DP33seKAOH0iIzz2PSI2IJ60tgmtyYOluDD7vSsQqgJFvZE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2016 22:04:50.4209 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB1842 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 787 Lines: 24 change the way to calculate pagesize to get correct free oob space for legacy_set_geometry function. Signed-off-by: Han Xu --- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 316b5ac..bda77a9 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -319,7 +319,8 @@ static int legacy_set_geometry(struct gpmi_nand_data *this) return -EINVAL; } - geo->page_size = mtd->writesize + mtd->oobsize; + geo->page_size = mtd->writesize + geo->metadata_size + + (geo->gf_len * geo->ecc_strength * geo->ecc_chunk_count) / 8; geo->payload_size = mtd->writesize; /* -- 1.9.1