From patchwork Thu Jan 23 10:30:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23577 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BF07A218BD for ; Thu, 23 Jan 2014 10:31:56 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id y10sf3663033pdj.11 for ; Thu, 23 Jan 2014 02:31:56 -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=lR3U8GhT9xfqsNeCftWhA+piG3nuI0S+ItvaT2LF4hU=; b=ijGls1epzWswtlqaTmgrY1YnYyWTTAwNiNnYI3mtP8E1Pr3Msc2NSQTt5b5ICqRJXv SKTIgK92woC6bP090Hju+bs83hGyDhBGNHXDf5hVjKq5uTxeTld8BlQX6+VKXrWEtyAJ KWqmozLNb76sE9+zRPdnex5O4OIpS0XREzDB/TzMBImpqhyLUU8WSb7uNG/V0r6nlOub SRsd0NoUxFLJ3hdMaSWs6yNxHWsIQERo48fm/zNhjpXGhnPRG/SINvVOMtmCGEaHCLyk jqBV626KwQOwL+g8MN893Olh0L17X4wFKK9293mUyFa50QwlSdjyeXq7/NdIAOdJl1+a nUNw== X-Gm-Message-State: ALoCoQkt5s2Zx4Q1QAyfj7OTjl8F4UincBHajGsVUmki5Kfy5UCBbtaSZcrslYaumhU7sAOF5bOP X-Received: by 10.67.21.145 with SMTP id hk17mr2632026pad.35.1390473116045; Thu, 23 Jan 2014 02:31:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.139 with SMTP id f11ls286454qgf.71.gmail; Thu, 23 Jan 2014 02:31:55 -0800 (PST) X-Received: by 10.220.193.132 with SMTP id du4mr54360vcb.39.1390473115924; Thu, 23 Jan 2014 02:31:55 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id y7si6431741vcf.36.2014.01.23.02.31.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:31:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 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.53; Received: by mail-vb0-f53.google.com with SMTP id p17so937716vbe.12 for ; Thu, 23 Jan 2014 02:31:55 -0800 (PST) X-Received: by 10.220.58.202 with SMTP id i10mr4121631vch.23.1390473115842; Thu, 23 Jan 2014 02:31:55 -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 u4csp15913vcz; Thu, 23 Jan 2014 02:31:55 -0800 (PST) X-Received: by 10.180.149.175 with SMTP id ub15mr24020256wib.44.1390473114872; Thu, 23 Jan 2014 02:31:54 -0800 (PST) Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by mx.google.com with ESMTPS id dk3si8927002wib.48.2014.01.23.02.31.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:31:54 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.43 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.43; Received: by mail-wg0-f43.google.com with SMTP id y10so1236590wgg.34 for ; Thu, 23 Jan 2014 02:31:54 -0800 (PST) X-Received: by 10.180.80.103 with SMTP id q7mr24151666wix.14.1390473114228; Thu, 23 Jan 2014 02:31:54 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.31.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:31:53 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, dwmw2@infradead.org, linux-mtd@lists.infradead.org, computersforpeace@gmail.com, Angus.Clark@st.com, DCG_UPD_stlinux_kernel@list.st.com, olivier.clergeaud@st.com, Lee Jones Subject: [PATCH RESEND v4 06/37] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Date: Thu, 23 Jan 2014 10:30:54 +0000 Message-Id: <1390473085-24626-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390473085-24626-1-git-send-email-lee.jones@linaro.org> References: <1390473085-24626-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.53 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.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 0eba759..bb0f20a 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -194,6 +194,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;