From patchwork Sun Jan 5 18:49:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagannadha Sutradharudu Teki X-Patchwork-Id: 307011 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 CFF462C00C1 for ; Mon, 6 Jan 2014 05:50:04 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9CAD14B0C0; Sun, 5 Jan 2014 19:50:00 +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 yN65kWjayA3O; Sun, 5 Jan 2014 19:50:00 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EF804B0C1; Sun, 5 Jan 2014 19:49:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4F4564B0C0 for ; Sun, 5 Jan 2014 19:49:50 +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 poTUb6dB6kaR for ; Sun, 5 Jan 2014 19:49:44 +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 co1outboundpool.messaging.microsoft.com (co1ehsobe004.messaging.microsoft.com [216.32.180.187]) by theia.denx.de (Postfix) with ESMTPS id 2B9CA4B0C1 for ; Sun, 5 Jan 2014 19:49:37 +0100 (CET) Received: from mail63-co1-R.bigfish.com (10.243.78.228) by CO1EHSOBE035.bigfish.com (10.243.66.100) with Microsoft SMTP Server id 14.1.225.22; Sun, 5 Jan 2014 18:49:35 +0000 Received: from mail63-co1 (localhost [127.0.0.1]) by mail63-co1-R.bigfish.com (Postfix) with ESMTP id AC148300315; Sun, 5 Jan 2014 18:49:35 +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 (mail63-co1: 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 mail63-co1 (localhost.localdomain [127.0.0.1]) by mail63-co1 (MessageSwitch) id 1388947774115806_1313; Sun, 5 Jan 2014 18:49:34 +0000 (UTC) Received: from CO1EHSMHS010.bigfish.com (unknown [10.243.78.241]) by mail63-co1.bigfish.com (Postfix) with ESMTP id 0B792DC004D; Sun, 5 Jan 2014 18:49:34 +0000 (UTC) Received: from xsj-gw1 (149.199.60.83) by CO1EHSMHS010.bigfish.com (10.243.66.20) with Microsoft SMTP Server id 14.16.227.3; Sun, 5 Jan 2014 18:49:33 +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 1VzslR-0000fv-B9; Sun, 05 Jan 2014 10:49:33 -0800 From: Jagannadha Sutradharudu Teki To: Date: Mon, 6 Jan 2014 00:19:21 +0530 X-Mailer: git-send-email 1.8.3 In-Reply-To: <1388947761-15186-1-git-send-email-jaganna@xilinx.com> References: <1388947761-15186-1-git-send-email-jaganna@xilinx.com> X-RCIS-Action: ALLOW MIME-Version: 1.0 Message-ID: <0c61fa3d-07ca-425a-b180-6d28fbb214b2@CO1EHSMHS010.ehs.local> X-OriginatorOrg: xilinx.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: trini@ti.com, Jagannadha@theia.denx.de, Sutradharudu Teki Subject: [U-Boot] [PATCH v2 4/4] sf: Add CONFIG_SF_NR_FLASH 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 config will use for defining greater than single flash support. currently - DUAL_STACKED and DUAL_PARALLEL. Signed-off-by: Jagannadha Sutradharudu Teki --- README | 6 ++++++ drivers/mtd/spi/sf.c | 3 ++- drivers/mtd/spi/sf_ops.c | 14 ++++++++++---- drivers/mtd/spi/sf_probe.c | 2 ++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/README b/README index 895fef3..20c1f92 100644 --- a/README +++ b/README @@ -2751,6 +2751,12 @@ CBFS (Coreboot Filesystem) support Define this option to use the Bank addr/Extended addr support on SPI flashes which has size > 16Mbytes. + CONFIG_SF_NR_FLASH Greater than single flash + + Define this option to use greater than single flash connected + with a given cs line from controller - currently Xilinx Zynq + qspi support dual/two flashes can be connected from single cs. + - SystemACE Support: CONFIG_SYSTEMACE diff --git a/drivers/mtd/spi/sf.c b/drivers/mtd/spi/sf.c index c780a81..d947d47 100644 --- a/drivers/mtd/spi/sf.c +++ b/drivers/mtd/spi/sf.c @@ -18,9 +18,10 @@ static int spi_flash_read_write(struct spi_slave *spi, unsigned long flags = SPI_XFER_BEGIN; int ret; +#ifdef CONFIG_SF_NR_FLASH if (spi->flags & SPI_XFER_U_PAGE) flags |= SPI_XFER_U_PAGE; - +#endif if (data_len == 0) flags |= SPI_XFER_END; diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c index 4fafbc6..914c1b6 100644 --- a/drivers/mtd/spi/sf_ops.c +++ b/drivers/mtd/spi/sf_ops.c @@ -131,6 +131,7 @@ static int spi_flash_bank(struct spi_flash *flash, u32 offset) } #endif +#ifdef CONFIG_SF_NR_FLASH static void spi_flash_nr_flash(struct spi_flash *flash, u32 *addr) { switch (flash->nr_flash) { @@ -150,6 +151,7 @@ static void spi_flash_nr_flash(struct spi_flash *flash, u32 *addr) break; } } +#endif int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) { @@ -167,9 +169,10 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout) check_status = poll_bit; } +#ifdef CONFIG_SF_NR_FLASH if (spi->flags & SPI_XFER_U_PAGE) flags |= SPI_XFER_U_PAGE; - +#endif ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN); if (ret) { debug("SF: fail to read %s status register\n", @@ -257,9 +260,10 @@ int spi_flash_cmd_erase_ops(struct spi_flash *flash, u32 offset, size_t len) while (len) { erase_addr = offset; +#ifdef CONFIG_SF_NR_FLASH if (flash->nr_flash > SF_NRF_SINGLE) spi_flash_nr_flash(flash, &erase_addr); - +#endif #ifdef CONFIG_SPI_FLASH_BAR ret = spi_flash_bank(flash, erase_addr); if (ret < 0) @@ -298,9 +302,10 @@ int spi_flash_cmd_write_ops(struct spi_flash *flash, u32 offset, for (actual = 0; actual < len; actual += chunk_len) { write_addr = offset; +#ifdef CONFIG_SF_NR_FLASH if (flash->nr_flash > SF_NRF_SINGLE) spi_flash_nr_flash(flash, &write_addr); - +#endif #ifdef CONFIG_SPI_FLASH_BAR ret = spi_flash_bank(flash, write_addr); if (ret < 0) @@ -382,9 +387,10 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset, while (len) { read_addr = offset; +#ifdef CONFIG_SF_NR_FLASH if (flash->nr_flash > SF_NRF_SINGLE) spi_flash_nr_flash(flash, &read_addr); - +#endif #ifdef CONFIG_SPI_FLASH_BAR bank_sel = spi_flash_bank(flash, read_addr); if (bank_sel < 0) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 0dc20f9..351a523 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -150,8 +150,10 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, flash->page_size = ((ext_jedec == 0x4d00) ? 512 : 256) << flash->shift; flash->sector_size = params->sector_size << flash->shift; flash->size = flash->sector_size * params->nr_sectors << flash->shift; +#ifdef CONFIG_SF_NR_FLASH if (flash->nr_flash & SF_NRF_DUAL_STACKED) flash->size <<= 1; +#endif /* Compute erase sector and command */ if (params->flags & SECT_4K) {