From patchwork Thu Dec 26 10:26:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagannadha Sutradharudu Teki X-Patchwork-Id: 305220 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 5F9A82C009C for ; Thu, 26 Dec 2013 21:27:53 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D1A64A080; Thu, 26 Dec 2013 11:27:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 vxbyay3-sXsj; Thu, 26 Dec 2013 11:27:51 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E69BF4A99C; Thu, 26 Dec 2013 11:27:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D17A64A075 for ; Thu, 26 Dec 2013 11:27:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 LJHECd4C-f2D for ; Thu, 26 Dec 2013 11:27:18 +0100 (CET) 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 db9outboundpool.messaging.microsoft.com (mail-db9lp0251.outbound.messaging.microsoft.com [213.199.154.251]) by theia.denx.de (Postfix) with ESMTPS id C7CCB4A076 for ; Thu, 26 Dec 2013 11:27:03 +0100 (CET) Received: from mail139-db9-R.bigfish.com (10.174.16.231) by DB9EHSOBE018.bigfish.com (10.174.14.81) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 Dec 2013 10:27:01 +0000 Received: from mail139-db9 (localhost [127.0.0.1]) by mail139-db9-R.bigfish.com (Postfix) with ESMTP id C333A160136; Thu, 26 Dec 2013 10:27:01 +0000 (UTC) X-Forefront-Antispam-Report: CIP:149.199.60.83; KIP:(null); UIP:(null); IPV:NLI; H:xsj-gw1; RD:unknown-60-83.xilinx.com; EFVD:NLI X-SpamScore: 1 X-BigFish: VPS1(zzzz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2fh95h839hd24hf0ah119dh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1b0ah224fh1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h1fe8h1ff5h2218h2216h226dh2327h2336h906i1155h) Received-SPF: pass (mail139-db9: domain of xilinx.com designates 149.199.60.83 as permitted sender) client-ip=149.199.60.83; envelope-from=jagannadha.sutradharudu-teki@xilinx.com; helo=xsj-gw1 ; helo=xsj-gw1 ; Received: from mail139-db9 (localhost.localdomain [127.0.0.1]) by mail139-db9 (MessageSwitch) id 1388053619943234_21783; Thu, 26 Dec 2013 10:26:59 +0000 (UTC) Received: from DB9EHSMHS032.bigfish.com (unknown [10.174.16.235]) by mail139-db9.bigfish.com (Postfix) with ESMTP id E0EA1C01A5; Thu, 26 Dec 2013 10:26:59 +0000 (UTC) Received: from xsj-gw1 (149.199.60.83) by DB9EHSMHS032.bigfish.com (10.174.14.42) with Microsoft SMTP Server id 14.16.227.3; Thu, 26 Dec 2013 10:26:58 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-smtp1) by xsj-gw1 with esmtp (Exim 4.63) (envelope-from ) id 1Vw89Z-0001oF-RR; Thu, 26 Dec 2013 02:26:57 -0800 From: Jagannadha Sutradharudu Teki To: Date: Thu, 26 Dec 2013 15:56:20 +0530 X-Mailer: git-send-email 1.8.3 In-Reply-To: <1388053587-6421-1-git-send-email-jaganna@xilinx.com> References: <1388053587-6421-1-git-send-email-jaganna@xilinx.com> X-RCIS-Action: ALLOW MIME-Version: 1.0 Message-ID: <440055f8-bf38-4a0e-8512-6bfe046924a2@DB9EHSMHS032.ehs.local> X-OriginatorOrg: xilinx.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: trini@ti.com, sourav.poddar@ti.com, Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH v5 03/10] sf: ops: Add configuration register writing support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch provides support to program a flash config register. Configuration register contains the control bits used to configure the different configurations and security features of a device. Signed-off-by: Jagannadha Sutradharudu Teki --- drivers/mtd/spi/sf_ops.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c index 3d304ce..39e06ec 100644 --- a/drivers/mtd/spi/sf_ops.c +++ b/drivers/mtd/spi/sf_ops.c @@ -38,6 +38,30 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr) return 0; } +static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr) +{ + u8 data[2]; + u8 cmd; + int ret; + + cmd = CMD_READ_STATUS; + ret = spi_flash_read_common(flash, &cmd, 1, &data[0], 1); + if (ret < 0) { + debug("SF: fail to read status register\n"); + return ret; + } + + cmd = CMD_WRITE_STATUS; + data[1] = cr; + ret = spi_flash_write_common(flash, &cmd, 1, &data, 2); + if (ret) { + debug("SF: fail to write config register\n"); + return ret; + } + + return 0; +} + #ifdef CONFIG_SPI_FLASH_BAR static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel) {