From patchwork Fri Nov 22 16:22:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21686 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A319123FDC for ; Fri, 22 Nov 2013 16:23:37 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id gq1sf4369088obb.2 for ; Fri, 22 Nov 2013 08:23:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=5oDQARs0ql4yTKlW4EjwJ/20bpTEkBJ4WQn1Dmk4tP4=; b=L/EkVcRx/1sG12QNFcnEL0otHFrz9HEyBuMGAcIyBXlraB5xV//IZLOkyHEFqLijPm Ueze3rK/PsyjOhZce5RwZKiDo9eQW3o+j4fGqlA3GSb6f1Pw1XL+j6ADlHZJkeNku3K2 9zP9EwIKlBvNwcgGbLSIet/A0FImHugTWtngmxl40bfoidvSIpJpdDGYty5EocYMu9hY d3/Yn8PIkVF/5+xSaOSrkyI/M8nnLrwGXRMpc5TS3D6W0K/gSwbSMunx5lYiMWZLmQAk TzhvbNv6zc4bokN/eMkcV38CC0g8SOdgoAXQlpSrSHD3VWhVQYQYBqAXqmjBQri8yy8h IJqA== X-Gm-Message-State: ALoCoQmNFAeI4pm/xPXWiG/wc7Vz2Bl162iRzYLIjNtMVyOeZxl6bdYGDD0BSddxcNszPFDlSh/r X-Received: by 10.42.85.148 with SMTP id q20mr3619302icl.22.1385137417283; Fri, 22 Nov 2013 08:23:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.170 with SMTP id ll10ls1062154qeb.34.gmail; Fri, 22 Nov 2013 08:23:37 -0800 (PST) X-Received: by 10.58.117.199 with SMTP id kg7mr1718015veb.31.1385137417173; Fri, 22 Nov 2013 08:23:37 -0800 (PST) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id y4si12874593vcx.99.2013.11.22.08.23.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:23:37 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id p14so1000867vbm.18 for ; Fri, 22 Nov 2013 08:23:37 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr12233826ved.20.1385137417075; Fri, 22 Nov 2013 08:23:37 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp51500vcz; Fri, 22 Nov 2013 08:23:36 -0800 (PST) X-Received: by 10.68.197.165 with SMTP id iv5mr3539865pbc.150.1385137416127; Fri, 22 Nov 2013 08:23:36 -0800 (PST) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id vs7si20186243pbc.85.2013.11.22.08.23.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:23:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id y10so1445008pdj.37 for ; Fri, 22 Nov 2013 08:23:35 -0800 (PST) X-Received: by 10.66.188.172 with SMTP id gb12mr12669340pac.143.1385137415750; Fri, 22 Nov 2013 08:23:35 -0800 (PST) Received: from localhost.localdomain (cpc15-aztw25-2-0-cust493.aztw.cable.virginm.net. [92.233.57.238]) by mx.google.com with ESMTPSA id qz9sm52962938pbc.3.2013.11.22.08.23.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Nov 2013 08:23:35 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, angus.clark@st.com Cc: linus.walleij@linaro.org, Lee Jones Subject: [PATCH 06/23] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Date: Fri, 22 Nov 2013 16:22:43 +0000 Message-Id: <1385137380-28968-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1385137380-28968-1-git-send-email-lee.jones@linaro.org> References: <1385137380-28968-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Flash chip commands are issued using a set of predefined opcodes. These are mostly the same for all flash devices, but do differ on occasion. This patch supplies the majority of the key ones which will be used in this driver. Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.h b/drivers/mtd/devices/st_spi_fsm.h index 6164142..97b4868 100644 --- a/drivers/mtd/devices/st_spi_fsm.h +++ b/drivers/mtd/devices/st_spi_fsm.h @@ -189,6 +189,44 @@ #define STFSM_FLASH_SAFE_FREQ 10000000UL /* 10 MHz */ +/* Flash Commands */ +#define FLASH_CMD_WREN 0x06 +#define FLASH_CMD_WRDI 0x04 +#define FLASH_CMD_RDID 0x9f +#define FLASH_CMD_RDSR 0x05 +#define FLASH_CMD_RDSR2 0x35 +#define FLASH_CMD_WRSR 0x01 +#define FLASH_CMD_SE_4K 0x20 +#define FLASH_CMD_SE_32K 0x52 +#define FLASH_CMD_SE 0xd8 +#define FLASH_CMD_CHIPERASE 0xc7 +#define FLASH_CMD_WRVCR 0x81 +#define FLASH_CMD_RDVCR 0x85 + +#define FLASH_CMD_READ 0x03 /* READ */ +#define FLASH_CMD_READ_FAST 0x0b /* FAST READ */ +#define FLASH_CMD_READ_1_1_2 0x3b /* DUAL OUTPUT READ */ +#define FLASH_CMD_READ_1_2_2 0xbb /* DUAL I/O READ */ +#define FLASH_CMD_READ_1_1_4 0x6b /* QUAD OUTPUT READ */ +#define FLASH_CMD_READ_1_4_4 0xeb /* QUAD I/O READ */ + +#define FLASH_CMD_WRITE 0x02 /* PAGE PROGRAM */ +#define FLASH_CMD_WRITE_1_1_2 0xa2 /* DUAL INPUT PROGRAM */ +#define FLASH_CMD_WRITE_1_2_2 0xd2 /* DUAL INPUT EXT PROGRAM */ +#define FLASH_CMD_WRITE_1_1_4 0x32 /* QUAD INPUT PROGRAM */ +#define FLASH_CMD_WRITE_1_4_4 0x12 /* QUAD INPUT EXT PROGRAM */ + +#define FLASH_CMD_EN4B_ADDR 0xb7 /* Enter 4-byte address mode */ +#define FLASH_CMD_EX4B_ADDR 0xe9 /* Exit 4-byte address mode */ + +/* READ commands with 32-bit addressing (N25Q256 and S25FLxxxS) */ +#define FLASH_CMD_READ4 0x13 +#define FLASH_CMD_READ4_FAST 0x0c +#define FLASH_CMD_READ4_1_1_2 0x3c +#define FLASH_CMD_READ4_1_2_2 0xbc +#define FLASH_CMD_READ4_1_1_4 0x6c +#define FLASH_CMD_READ4_1_4_4 0xec + struct stfsm { struct device *dev; void __iomem *base;