From patchwork Mon Oct 7 13:41:22 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: 281107 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 6B0802C00A7 for ; Tue, 8 Oct 2013 00:42:01 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 23FEB4A07B; Mon, 7 Oct 2013 15:41:59 +0200 (CEST) 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 8m+tX3iLNtFF; Mon, 7 Oct 2013 15:41:58 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D576E4A080; Mon, 7 Oct 2013 15:41:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 39D4D4A080 for ; Mon, 7 Oct 2013 15:41:49 +0200 (CEST) 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 T7j5tujtNVVw for ; Mon, 7 Oct 2013 15:41:43 +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 db8outboundpool.messaging.microsoft.com (mail-db8lp0189.outbound.messaging.microsoft.com [213.199.154.189]) by theia.denx.de (Postfix) with ESMTPS id 41BCF4A07B for ; Mon, 7 Oct 2013 15:41:36 +0200 (CEST) Received: from mail202-db8-R.bigfish.com (10.174.8.243) by DB8EHSOBE004.bigfish.com (10.174.4.67) with Microsoft SMTP Server id 14.1.225.22; Mon, 7 Oct 2013 13:41:35 +0000 Received: from mail202-db8 (localhost [127.0.0.1]) by mail202-db8-R.bigfish.com (Postfix) with ESMTP id E8FF6B800E6 for ; Mon, 7 Oct 2013 13:41: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: VPS-1(zz936eI4015Izz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h1de097h8275bhz2fh95h839hd24hf0ah119dh1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e1dh1e23h1fe8h1ff5h906i1155h192ch) Received-SPF: pass (mail202-db8: 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 mail202-db8 (localhost.localdomain [127.0.0.1]) by mail202-db8 (MessageSwitch) id 1381153293246564_12674; Mon, 7 Oct 2013 13:41:33 +0000 (UTC) Received: from DB8EHSMHS003.bigfish.com (unknown [10.174.8.228]) by mail202-db8.bigfish.com (Postfix) with ESMTP id 37D92401EA for ; Mon, 7 Oct 2013 13:41:33 +0000 (UTC) Received: from xsj-gw1 (149.199.60.83) by DB8EHSMHS003.bigfish.com (10.174.4.13) with Microsoft SMTP Server id 14.16.227.3; Mon, 7 Oct 2013 13:41:30 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-smtp1.xilinx.com) by xsj-gw1 with esmtp (Exim 4.63) (envelope-from ) id 1VTB3y-0002xK-6g for u-boot@lists.denx.de; Mon, 07 Oct 2013 06:41:30 -0700 From: Jagannadha Sutradharudu Teki To: Date: Mon, 7 Oct 2013 19:11:22 +0530 X-Mailer: git-send-email 1.8.3 X-RCIS-Action: ALLOW MIME-Version: 1.0 Message-ID: X-OriginatorOrg: xilinx.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: Jagannadha Sutradharudu Teki Subject: [U-Boot] [PATCH v2] sf: Minor cleanups 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 - Add spaces, tabs - Commenting. - Rearrange code. - Add static qualifier for missing func. - Remove memory_map from ramtron.c - Ramtron: spi_flash_internal.h -> sf_internal.h Signed-off-by: Jagannadha Sutradharudu Teki --- Changes for v2: - Replace rantron: spi_flash_internal.h -> sf_internal.h drivers/mtd/spi/ramtron.c | 4 +- drivers/mtd/spi/sf_internal.h | 8 +-- drivers/mtd/spi/sf_probe.c | 7 ++- include/spi.h | 22 ++++---- include/spi_flash.h | 4 +- update.txt | 125 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+), 23 deletions(-) create mode 100644 update.txt diff --git a/drivers/mtd/spi/ramtron.c b/drivers/mtd/spi/ramtron.c index c9701d0..7367e7a 100644 --- a/drivers/mtd/spi/ramtron.c +++ b/drivers/mtd/spi/ramtron.c @@ -36,7 +36,7 @@ #include #include #include -#include "spi_flash_internal.h" +#include "sf_internal.h" /* * Properties of supported FRAMs @@ -383,8 +383,6 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, printf("SF: Detected %s with page size ", flash->name); print_size(flash->sector_size, ", total "); print_size(flash->size, ""); - if (flash->memory_map) - printf(", mapped at %p", flash->memory_map); puts("\n"); spi_release_bus(spi); diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 29a14f4..12d02f9 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -13,7 +13,7 @@ #define SPI_FLASH_16MB_BOUN 0x1000000 /* SECT flags */ -#define SECT_4K (1 << 1) +#define SECT_4K (1 << 1) #define SECT_32K (1 << 2) #define E_FSR (1 << 3) @@ -29,8 +29,8 @@ #define CMD_WRITE_DISABLE 0x04 #define CMD_READ_STATUS 0x05 #define CMD_WRITE_ENABLE 0x06 -#define CMD_READ_CONFIG 0x35 -#define CMD_FLAG_STATUS 0x70 +#define CMD_READ_CONFIG 0x35 +#define CMD_FLAG_STATUS 0x70 /* Read commands */ #define CMD_READ_ARRAY_SLOW 0x03 @@ -57,7 +57,7 @@ /* SST specific */ #ifdef CONFIG_SPI_FLASH_SST # define SST_WP 0x01 /* Supports AAI word program */ -# define CMD_SST_BP 0x02 /* Byte Program */ +# define CMD_SST_BP 0x02 /* Byte Program */ # define CMD_SST_AAI_WP 0xAD /* Auto Address Incr Word Program */ int sst_write_wp(struct spi_flash *flash, u32 offset, size_t len, diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 6aa7086..4251b1b 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -152,7 +152,8 @@ static const struct spi_flash_params spi_flash_params_table[] = { */ }; -struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode) +static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, + u8 *idcode) { const struct spi_flash_params *params; struct spi_flash *flash; @@ -189,6 +190,7 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode) flash->spi = spi; flash->name = params->name; + flash->memory_map = spi->memory_map; /* Assign spi_flash ops */ flash->write = spi_flash_cmd_write_ops; @@ -203,7 +205,6 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode) flash->page_size = (ext_jedec == 0x4d00) ? 512 : 256; flash->sector_size = params->sector_size; flash->size = flash->sector_size * params->nr_sectors; - flash->memory_map = spi->memory_map; /* Compute erase sector and command */ if (params->flags & SECT_4K) { @@ -224,8 +225,8 @@ struct spi_flash *spi_flash_validate_params(struct spi_slave *spi, u8 *idcode) flash->poll_cmd = CMD_FLAG_STATUS; #endif + /* Configure the BAR - discover bank cmds and read current bank */ #ifdef CONFIG_SPI_FLASH_BAR - /* Configure the BAR - discover bank cmds and read current bank */ u8 curr_bank = 0; if (flash->size > SPI_FLASH_16MB_BOUN) { flash->bank_read_cmd = (idcode[0] == 0x01) ? diff --git a/include/spi.h b/include/spi.h index c2086fc..5164d43 100644 --- a/include/spi.h +++ b/include/spi.h @@ -25,24 +25,24 @@ #define SPI_PREAMBLE 0x80 /* Skip preamble bytes */ /* SPI transfer flags */ -#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ -#define SPI_XFER_END 0x02 /* Deassert CS after transfer */ -#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ -#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ +#define SPI_XFER_BEGIN 0x01 /* Assert CS before transfer */ +#define SPI_XFER_END 0x02 /* Deassert CS after transfer */ +#define SPI_XFER_MMAP 0x08 /* Memory Mapped start */ +#define SPI_XFER_MMAP_END 0x10 /* Memory Mapped End */ /* Header byte that marks the start of the message */ -#define SPI_PREAMBLE_END_BYTE 0xec +#define SPI_PREAMBLE_END_BYTE 0xec /** - * struct spi_slave: Representation of a SPI slave, - * i.e. what we're communicating with. + * struct spi_slave - Representation of a SPI slave * * Drivers are expected to extend this with controller-specific data. * - * bus: ID of the bus that the slave is attached to. - * cs: ID of the chip select connected to the slave. - * max_write_size: If non-zero, the maximum number of bytes which can - * be written at once, excluding command bytes. + * @bus: ID of the bus that the slave is attached to. + * @cs: ID of the chip select connected to the slave. + * @max_write_size: If non-zero, the maximum number of bytes which can + * be written at once, excluding command bytes. + * @memory_map: Address of read-only SPI flash access. */ struct spi_slave { unsigned int bus; diff --git a/include/spi_flash.h b/include/spi_flash.h index b7cce12..1ff5af4 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -27,13 +27,13 @@ * @size: Total flash size * @page_size: Write (page) size * @sector_size: Sector size - * @erase_size: Erase size + * @erase_size: Erase size * @bank_read_cmd: Bank read cmd * @bank_write_cmd: Bank write cmd * @bank_curr: Current flash bank * @poll_cmd: Poll cmd - for flash erase/program * @erase_cmd: Erase cmd 4K, 32K, 64K - * @memory_map: Address of read-only SPI flash access + * @memory_map: Address of read-only SPI flash access * @read: Flash read ops: Read len bytes at offset into buf * Supported cmds: Fast Array Read * @write: Flash write ops: Write len bytes from buf into offeset diff --git a/update.txt b/update.txt new file mode 100644 index 0000000..4ad4341 --- /dev/null +++ b/update.txt @@ -0,0 +1,125 @@ +Subject: Pull request: u-boot-spi/master + +Hi Tom, + +Just released pull request with new sf probe support. +Tested these changes on stmicro, winbond, spansion and sst. + +Hope, nothing breaks! + +-- +Thanks, +Jagan. + +The following changes since commit f835c77fb7e57508ffe8d8ca3a092ee28add77b2: + + Merge branch 'master' of git://git.denx.de/u-boot-arm (2013-10-04 13:17:48 -0400) + +are available in the git repository at: + + + git://git.denx.de/u-boot-spi.git master + +for you to fetch changes up to eecf9ed71a31ee017360e47c804b0bb34242623d: + + doc: SPI: Update SPI status track (2013-10-07 17:55:53 +0530) + +---------------------------------------------------------------- +Jagannadha Sutradharudu Teki (35): + sf: Divide spi_flash into multiple parts + sf: probe: Add new spi_flash_probe support + sf: probe: Add support for M25P* flash parts + sf: probe: Add support for EN25Q* flash parts + sf: probe: Add support for GD25* flash parts + sf: probe: Add support for MX25L* flash parts + sf: probe: Add support for W25* flash parts + sf: probe: Add support for S25FL* flash parts + sf: probe: Add support for SST25* flash parts + sf: probe: Add support for AT45DB* flash parts + sf: probe: Give proper spacing on flash table params + sf: probe: Add support for SST_WP + sf: probe: Add support to clear flash BP# bits + sf: probe: Add support for erase sector selection flag + sf: probe: Add support for flag status polling + sf: probe: Simply the BAR configuration logic + sf: Add proper comment style on spi_flash structure + sf: ramtron: Add support for separate flash driver + sf: Remove unneeded flash drivers files + sf: probe: Add support for EN25Q64 + sf: probe: Add support for S25FL256S_256K + sf: probe: Add support for S25FL512S_256K + sf: probe: Use print_size arg as page_size + sf: probe: Print erase_size while printing flash details + sf: ops: Add static qualifier to spi_flash_cmd_bankaddr_write + sf: probe: Add support for MX25L25635F + sf: probe: Add support for MX25L51235F + sf: Remove spi_flash_do_alloc references + sf: spi_flash cleanups + spi: spi cleanups + sf: Rename spi_flash files + doc: SPI: Add status.txt for tracking SPI subsys status + sf: Minor cleanups + sf: ramtron: Remove page_size print + doc: SPI: Update SPI status track + +Matt Porter (3): + omap5: add qspi support + spi: add TI QSPI driver + dra7xx_evm: add SPL API, QSPI, and serial flash support + +Poddar, Sourav (3): + armv7: hw_data: change clock divider setting. + sf: Add memory mapped read support + README: qspi usecase and testing documentation. + +Priyanka Jain (1): + sf: probe: Add support for EN25S64 + + arch/arm/cpu/armv7/omap5/hw_data.c | 10 +- + arch/arm/cpu/armv7/omap5/prcm-regs.c | 1 + + arch/arm/include/asm/arch-omap5/omap.h | 3 + + arch/arm/include/asm/arch-omap5/spl.h | 1 + + arch/arm/include/asm/omap_common.h | 1 + + board/ti/dra7xx/mux_data.h | 10 + + doc/SPI/README.ti_qspi_dra_test | 48 ++ + doc/SPI/README.ti_qspi_flash | 47 ++ + doc/SPI/status.txt | 31 ++ + drivers/mtd/spi/Makefile | 15 +- + drivers/mtd/spi/atmel.c | 544 ------------------ + drivers/mtd/spi/eon.c | 60 -- + drivers/mtd/spi/gigadevice.c | 65 --- + drivers/mtd/spi/macronix.c | 98 ---- + drivers/mtd/spi/ramtron.c | 120 +++- + drivers/mtd/spi/sf.c | 54 ++ + .../spi/{spi_flash_internal.h => sf_internal.h} | 140 ++--- + drivers/mtd/spi/sf_ops.c | 405 ++++++++++++++ + drivers/mtd/spi/sf_probe.c | 363 ++++++++++++ + drivers/mtd/spi/spansion.c | 141 ----- + drivers/mtd/spi/spi_flash.c | 615 --------------------- + drivers/mtd/spi/sst.c | 238 -------- + drivers/mtd/spi/stmicro.c | 202 ------- + drivers/mtd/spi/winbond.c | 141 ----- + drivers/spi/Makefile | 1 + + drivers/spi/ti_qspi.c | 311 +++++++++++ + include/configs/dra7xx_evm.h | 19 + + include/configs/top9000.h | 1 - + include/spi.h | 100 ++-- + include/spi_flash.h | 103 ++-- + 30 files changed, 1591 insertions(+), 2297 deletions(-) + create mode 100644 doc/SPI/README.ti_qspi_dra_test + create mode 100644 doc/SPI/README.ti_qspi_flash + create mode 100644 doc/SPI/status.txt + delete mode 100644 drivers/mtd/spi/atmel.c + delete mode 100644 drivers/mtd/spi/eon.c + delete mode 100644 drivers/mtd/spi/gigadevice.c + delete mode 100644 drivers/mtd/spi/macronix.c + create mode 100644 drivers/mtd/spi/sf.c + rename drivers/mtd/spi/{spi_flash_internal.h => sf_internal.h} (62%) + create mode 100644 drivers/mtd/spi/sf_ops.c + create mode 100644 drivers/mtd/spi/sf_probe.c + delete mode 100644 drivers/mtd/spi/spansion.c + delete mode 100644 drivers/mtd/spi/spi_flash.c + delete mode 100644 drivers/mtd/spi/sst.c + delete mode 100644 drivers/mtd/spi/stmicro.c + delete mode 100644 drivers/mtd/spi/winbond.c + create mode 100644 drivers/spi/ti_qspi.c