From patchwork Tue Jul 19 09:10:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Durga Prasad Paladugu X-Patchwork-Id: 650038 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rtvRZ2r61z9s1h for ; Tue, 19 Jul 2016 19:11:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0319CA7578; Tue, 19 Jul 2016 11:11:08 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I5dKrEAgRTdT; Tue, 19 Jul 2016 11:11:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E10C3A7516; Tue, 19 Jul 2016 11:10:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B3220A7514 for ; Tue, 19 Jul 2016 11:10:44 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lNxghDZW23C8 for ; Tue, 19 Jul 2016 11:10:44 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0075.outbound.protection.outlook.com [104.47.36.75]) by theia.denx.de (Postfix) with ESMTPS id 047B5A74FF for ; Tue, 19 Jul 2016 11:10:39 +0200 (CEST) Received: from BL2NAM02FT029.eop-nam02.prod.protection.outlook.com (10.152.76.56) by BL2NAM02HT128.eop-nam02.prod.protection.outlook.com (10.152.76.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.539.16; Tue, 19 Jul 2016 09:10:37 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT029.mail.protection.outlook.com (10.152.77.100) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.539.16 via Frontend Transport; Tue, 19 Jul 2016 09:10:35 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1bPR2s-0000Pv-Lp; Tue, 19 Jul 2016 02:10:30 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1bPR2w-0003UU-T2; Tue, 19 Jul 2016 02:10:34 -0700 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u6J9AQgL000840; Tue, 19 Jul 2016 02:10:26 -0700 Received: from [172.23.146.171] (helo=xhdl3763.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1bPR2n-0003SS-Uq; Tue, 19 Jul 2016 02:10:26 -0700 Received: by xhdl3763.xilinx.com (Postfix, from userid 13899) id 29B0B2CE04ED; Tue, 19 Jul 2016 14:40:25 +0530 (IST) From: Siva Durga Prasad Paladugu To: Date: Tue, 19 Jul 2016 14:40:20 +0530 Message-ID: <1468919422-39845-2-git-send-email-sivadur@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1468919422-39845-1-git-send-email-sivadur@xilinx.com> References: <1468919422-39845-1-git-send-email-sivadur@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22460.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(199003)(189002)(2950100001)(50466002)(586003)(33646002)(50226002)(2351001)(8936002)(110136002)(189998001)(107886002)(52956003)(229853001)(48376002)(81166006)(11100500001)(7846002)(81156014)(305945005)(103686003)(2906002)(106466001)(8676002)(19580405001)(47776003)(19580395003)(36386004)(90966002)(575784001)(46386002)(92566002)(4001430100002)(36756003)(86362001)(42186005)(76176999)(4326007)(50986999)(45336002)(87936001)(63266004)(5003940100001)(356003)(192303002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2NAM02HT128; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 226f1ded-b787-4886-dfb8-08d3afb48be2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(8251501002); SRVR:BL2NAM02HT128; X-Microsoft-Antispam-PRVS: <55adaa8a7ae2495d8a4d51b92db1f8f1@BL2NAM02HT128.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(5005006)(8121501046)(13018025)(13024025)(13017025)(13015025)(3002001)(10201501046)(6055026); SRVR:BL2NAM02HT128; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT128; X-Forefront-PRVS: 000800954F X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2016 09:10:35.6653 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT128 Cc: michals@xilinx.com, Siva Durga Prasad Paladugu Subject: [U-Boot] [PATCH v3 1/3] spi: spi_flash: Dont set quad enable for micron in all cases X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Dont set quad enable for micron devices in all cases Setting the quad enable bit in micron expects all other commands like register reads on quad lines which may not be supported by some controllers. Hence, dont set the quad enable if controller driver sets the no_all_quad. Signed-off-by: Siva Durga Prasad Paladugu --- Changes for v3: - None Changes for v2: - Newly added in series. --- drivers/mtd/spi/spi_flash.c | 13 ++++++++++++- include/spi.h | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 64d4e0f..1be3e56 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -926,6 +926,8 @@ static int micron_quad_enable(struct spi_flash *flash) static int set_quad_mode(struct spi_flash *flash, u8 idcode0) { + struct spi_slave *spi = flash->spi; + switch (idcode0) { #ifdef CONFIG_SPI_FLASH_MACRONIX case SPI_FLASH_CFI_MFR_MACRONIX: @@ -938,7 +940,16 @@ static int set_quad_mode(struct spi_flash *flash, u8 idcode0) #endif #ifdef CONFIG_SPI_FLASH_STMICRO case SPI_FLASH_CFI_MFR_STMICRO: - return micron_quad_enable(flash); + /* + * Set quad enable for micron only + * if controller supports sending of + * all commands on quad lines, otherwise + * dont enable it + */ + if (spi->no_all_quad) + return 0; + else + return micron_quad_enable(flash); #endif default: printf("SF: Need set QEB func for %02x flash\n", idcode0); diff --git a/include/spi.h b/include/spi.h index ca96fa4..e43c864 100644 --- a/include/spi.h +++ b/include/spi.h @@ -117,7 +117,7 @@ struct spi_slave { unsigned int max_write_size; void *memory_map; u8 option; - + u8 no_all_quad; u8 flags; #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */ #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */