From patchwork Tue Jul 21 09:45:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yangbo lu X-Patchwork-Id: 6834221 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D2069F358 for ; Tue, 21 Jul 2015 09:50:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A91402064B for ; Tue, 21 Jul 2015 09:50:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A03C620648 for ; Tue, 21 Jul 2015 09:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754156AbbGUJui (ORCPT ); Tue, 21 Jul 2015 05:50:38 -0400 Received: from mail-bn1bbn0101.outbound.protection.outlook.com ([157.56.111.101]:56768 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752757AbbGUJue (ORCPT ); Tue, 21 Jul 2015 05:50:34 -0400 Received: from DM2PR03CA0002.namprd03.prod.outlook.com (10.141.96.12) by CY1PR0301MB1195.namprd03.prod.outlook.com (10.160.165.26) with Microsoft SMTP Server (TLS) id 15.1.219.17; Tue, 21 Jul 2015 09:50:32 +0000 Received: from BN1AFFO11FD042.protection.gbl (2a01:111:f400:7c10::193) by DM2PR03CA0002.outlook.office365.com (2a01:111:e400:2428::12) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 21 Jul 2015 09:50:32 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD042.mail.protection.outlook.com (10.58.52.253) with Microsoft SMTP Server (TLS) id 15.1.213.8 via Frontend Transport; Tue, 21 Jul 2015 09:50:31 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t6L9oSkA022171; Tue, 21 Jul 2015 02:50:29 -0700 From: Yangbo Lu To: , , , CC: Yangbo Lu Subject: [PATCH 3/3] mmc: sdhci-of-esdhc: add workaround for T4240 incorrect HOSTVER value Date: Tue, 21 Jul 2015 17:45:37 +0800 Message-ID: <1437471937-34218-1-git-send-email-yangbo.lu@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD042; 1:51X6Zw6yjc7v157gJwCBJJyObEdtBxJplQ8PEHoh4FMyKn9dlUDO4U51jnw1z6gMeQ1aEONccSpzH7S7vF41us9Q2h5BgeO/pnasOq6rOl/NFELAhvx4d/JSQ2rvoVuoxE98I58U0rcBOJ3XX9eGuYW5cEHXaxOdm0kf2/wG1PZxdAp2J2ElzoyznCFNjbitPGpO0p/QSwNHH3hQfj9hsEmsrlFbxTIao5VtILrZLogsjCqS3/EpPYamuxEDU+UK7eMJSQOjXtb0TZ0X4Vy4LkcHsccOSryFvuAWhDhVliEDRigSWfWeLgNt4dp0QqLSNNr/9KboGvzLFCZu240UBuCgv3WJM+wodKZOrqTQV4NXGPi76BKlKCUTrRNA0EyyaJf7U71CRxXo7ZWCKXJejy3FmMxtb//0994HiyV1WHiOEzvQ0i3xaQoF1tehBC7N X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(339900001)(199003)(189002)(104016003)(5001920100001)(50226001)(62966003)(5001770100001)(5003940100001)(229853001)(77156002)(106466001)(50986999)(105606002)(86362001)(36756003)(230783001)(107886002)(92566002)(77096005)(33646002)(189998001)(5001960100002)(46102003)(87936001)(19580405001)(48376002)(85426001)(19580395003)(2201001)(50466002)(47776003)(6806004)(575784001)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1195; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1195; 2:EHR2kjouDH1u3mZ1v56+BygXytPHT0E+St3lxZDYEXh/SXV5lhFjwxnwxZp7+1Ji; 3:rmc8cqBWtyXgWq+hO7Xp+x8YAajDyWG3lzjEf44uQjStKTRTFnfvlw1M7fLVtTmaSMzHwPw43I4rElH+JA7BMUX5rEhI7w015DzSDU62vq1GrBusdawtII+7SFhptFUueICATVWnfaH8Ssesfzvsuujsp0hN2IAbHWNZF16QFitfyISCl+m3/QRBfNXT4uYeCJNQeExvbx192tAyn4ZpKlr0ai28sQFvUjf1rVPib50=; 25:XQE+KrfVUdcf95Im4lJTC2/RvC7dk+LuxQlHA4GnANntgGsjtBKMggAP3+7eRiPPrf2GNxCpLRB2P9Wocwsidx1NMVhhu8eO17N9xarZwQChdNyIdUToplYHsKcwyfn8oqQesJYklTTBvxwaUL79xBjKjqc35mk0UKC4LwjGWO1QH76TgyFRCkNZouVe71rhXSK/5szC5hGAW06sNakCaq0IKn7PSSR1GFHuxIYZl57PojSfXMIeJc0tK8nJ7g7Y5ENk8g9EulifRGrwykbzZA==; 20:EH03EWlojZr2jJOjeYkk73vbF5eu1/cos3IDbQnKLl7vBLYwqadYyGecxDOk1QLWpqxa1npzWxBenG5eJi4lY8Lc88JmssUfBakEwqAFhLb6AF3DKbjcVrp9td5TRNoJ5RYhCtt7f1A30Y7aVKG9rxlYmUgJDMqCKS/4F/yIVUSXNAnkzl3lkuTwEE6PA811SWYgiq2mMPX77R2/QOsFoq1rz+FsJod1769cD+wBqMmg1A4oQRbkGKBPD2f/BBjkkBD1NM0QKN3zdFRtQhyD8yxr6zOpkpK94ed8FspwdY20Z+vqd+q+/+8TJHpteLtfcfXkikiWspwJzdW+G1NCO3O64 OtU/jf+dntPgn19BT4= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1195; CY1PR0301MB1195: X-MS-Exchange-Organization-RulesExecuted X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:CY1PR0301MB1195; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1195; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1195; 4:MJFjnizg5xsJpCbRPgZ+HDPmyx1lOpIURTdvBZkfqt6D2VzM/y9jjSvTetb2HOia4bgD792ZJyMl0B94Ri+59UuFKANHef4lAwjY4kU2XOYH76/3slSvLtZ9nUhw8i5afzMnJFiV0Si4gs0PuNkei9G3uoWl6PpcerSadToJC7GfsnrmDgkSy5bExUfxqI55ZWlpoMw/xlG5xxfrObvOUMyp5H83wakS/bUGoEhW82ZoUojJvlP1VmntOZVYGMOTiVqoJs82rjL+4uvv7GG6+sfRNS0Zg2srk+o1duOu34k= X-Forefront-PRVS: 0644578634 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1195; 23:KsHeNXchAzBl2NGwFHjKVdx25CSFMp7x9CMIgNl?= =?us-ascii?Q?MTK9KFVFvtdwHYyygwcH+7jAZISVPMm1QtTLnnS2HncNSqTZ7EIMFzsBQZ0T?= =?us-ascii?Q?tIaFYpAJCRtKFNEVzPs34ymCB+eVni1viSJ3NvVlyBcoTJw8Am6HIqAouVuv?= =?us-ascii?Q?Y0IyrOQCjxC0BpCGRlExHaZH/T3WG1gplBctVE0FYuLZBZOIjYarEvKc/a5g?= =?us-ascii?Q?98nPcmob1N00pYLGGTlgN5EbiZH4GPfvkRoPwsH9VbuiIkDVhAGTSg7vAPmf?= =?us-ascii?Q?SVvlDT+YHaKOL5z5GFAd6OOAc3dm9QB5ShINl+83Ym6MgANvboSsIFdC5XES?= =?us-ascii?Q?rDtQZXNWkW7gODu/wtIXfhWSUXEFPSYK6jGVuRbRfUhkqE2fJ+Ej00OCzbxt?= =?us-ascii?Q?1uxt9dAVxkWEebgUp8ZQeUFHa2wEfBv3SxDdQipVskOJh16wxEnkdW9JXLsD?= =?us-ascii?Q?ehh6Mg4I9xocezXvYezC0hdE60stNdXVWm//uvzDcaXvfOmIQBmK5Mje5bzQ?= =?us-ascii?Q?r4xfLA3UfAXyARGIopqxoXzE00pjj0coeyhTOJTouQFMIqH3v6rZb/QVOBfY?= =?us-ascii?Q?CjqwO9t1lB3YDmz5fmRrJ8SN/iZS/LIHTJhfPHmV3tyF8/bnJQ57ed29OrFS?= =?us-ascii?Q?wIuBbX6XhBJoztw3M+WXaebTaGNU3NZcdF0l/OqlbrbRvtAMcxXNHuRe2cNU?= =?us-ascii?Q?7xF3zG56ZhRUG9yzTIp6/cfYpo0x1exHtUjAROxIc1WGPXo7s72mikpWQd1B?= =?us-ascii?Q?vd7sMLowGtEM0JASAKTW7OO26+stoTADKp2qawT63kzpQbaUQ+EBjaFxrFS6?= =?us-ascii?Q?1umXlZlRr7VawIN/0KNInQjOZNzP8TkZQ5XOYzPXc0RgRoUofuuhktqkAIGv?= =?us-ascii?Q?wZ6TU6C/t3pLgi9bqcPa4a0SUZCjIASyx903V6L3jcANYITddiskkpgUi2wg?= =?us-ascii?Q?sZ9kNm134Wulmmh9i6ervpx69jIOzuuT4wz+S+ZqaN110TuTuQGXxvbA737Z?= =?us-ascii?Q?YhkrCWg3p0Ys5Y95fO/9Ng6bf?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1195; 5:72WH4G4aQzQMQdkhTouJHgxwOGhI95JH1WufFrx9Xd7YCimvIt12thACRbJPMgWzvTBWGXGdH4sF/m4w5qV4dzGJa0raUVJm/L6FwMoJmkdLKkAarqZ3f6GCOjvZBs9SvhwX0aM4QNic/AZi421Uwg==; 24:dFdqX5OB/Q+wYiYO5GnTyRdKzTlzSblYAeMwKsxZw/pxX+a/2VSC9PCkhWr1mXnQZeynq8Yk5n2ZbyliF4KK5VGGifs6EqluP+Hq5pvZJ10=; 20:V4AYsJQBHs4DTP9DSvaJ8trt+oTMm26lsVbmRLC3cScngE4noryNgejN7+P2CP4TKNS4GnYwS3YecdNdti2kxQ== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2015 09:50:31.2854 (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.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1195 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For T4240-R1.0-R2.0, the HOSTVER register has incorrcet vender version value and sdhc spec version value. This will break down the ADMA data transfer. So add workaround to get right value VVN=0x13, SVN = 0x1. Signed-off-by: Yangbo Lu --- drivers/mmc/host/sdhci-esdhc.h | 5 +++++ drivers/mmc/host/sdhci-of-esdhc.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index 3497cfa..5174233 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -47,4 +47,9 @@ #define ESDHC_HOST_CONTROL_RES 0x05 +unsigned int esdhc_errata; + +/* Incorrect host version in T4240 HOSTVER register */ +#define ESDHC_ERRATA_T4240_ERROR_HOSTVER (1<<0) + #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 1295a96..c0ad765 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -59,6 +59,11 @@ static u16 esdhc_readw(struct sdhci_host *host, int reg) ret = in_be32(host->ioaddr + base) & 0xffff; else ret = (in_be32(host->ioaddr + base) >> shift) & 0xffff; + + if ((reg == SDHCI_HOST_VERSION) && + (esdhc_errata & ESDHC_ERRATA_T4240_ERROR_HOSTVER)) + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; + return ret; } @@ -352,6 +357,9 @@ static void esdhc_get_property(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct sdhci_host *host = platform_get_drvdata(pdev); + struct device_node *cpus; + const u32 *prop; + u8 rev = 0xff; sdhci_get_of_property(pdev); @@ -359,6 +367,11 @@ static void esdhc_get_property(struct platform_device *pdev) mmc_of_parse(host->mmc); mmc_of_parse_voltage(np, &host->ocr_mask); + cpus = of_find_node_by_path("/cpus"); + prop = of_get_property(cpus, "cpu-rev", NULL); + if (prop) + rev = *(u8 *)prop; + if (of_device_is_compatible(np, "fsl,p5040-esdhc") || of_device_is_compatible(np, "fsl,p5020-esdhc") || of_device_is_compatible(np, "fsl,p4080-esdhc") || @@ -373,6 +386,11 @@ static void esdhc_get_property(struct platform_device *pdev) */ host->quirks2 |= SDHCI_QUIRK2_BROKEN_HOST_CONTROL; } + + esdhc_errata = 0; + + if (of_device_is_compatible(np, "fsl,t4240-esdhc") && rev <= 0x20) + esdhc_errata |= ESDHC_ERRATA_T4240_ERROR_HOSTVER; } static int sdhci_esdhc_probe(struct platform_device *pdev)