From patchwork Wed Jan 8 13:46:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 22942 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1DA06202E2 for ; Wed, 8 Jan 2014 13:48:33 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf2156935yho.9 for ; Wed, 08 Jan 2014 05:48:32 -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=TrGebJ81X896jTuOcAcTQY1F+xst1AHV4g1SdF+mGSzjUrWcOpInLLaR7v/xvJVbXI /fOrktPaTQSI4gFHP6wyoIacSp24cLPv1CPEM9c6DZtNZmoL7M1jAvNR0447ni3ovHRO LifVZcQKhiYhwn7qxKW7Ous8R8VrFTryJhgrOQ8tt+0tYFL6YIVOCinWuKKo39hx9+zE o5G9I2z6gZhC4WheDcilLYiX9Pg2nttP9anC03qUyMkKwnXRb8rjOyvzSMkjxsgHZUVc Jd0rhGDlAvLx5jmrBIZUmlbCQA6+dtel4e9XDw9ZCJfLRAkhB+r135hgPVYU4Q6K6xXl tfCA== X-Gm-Message-State: ALoCoQkZuCl5KUhl+j6xfjxD3wveYpIviqY5I7A4L1g/eSXZ6RD8x+BqHOoOZhREXwa2rSTQ4cCn X-Received: by 10.58.206.47 with SMTP id ll15mr9932996vec.28.1389188912290; Wed, 08 Jan 2014 05:48:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.85.162 with SMTP id i2ls540206qez.39.gmail; Wed, 08 Jan 2014 05:48:32 -0800 (PST) X-Received: by 10.52.232.135 with SMTP id to7mr2689184vdc.58.1389188912185; Wed, 08 Jan 2014 05:48:32 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id bi4si136308vec.151.2014.01.08.05.48.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so1270625veb.15 for ; Wed, 08 Jan 2014 05:48:32 -0800 (PST) X-Received: by 10.58.243.37 with SMTP id wv5mr3200380vec.41.1389188912056; Wed, 08 Jan 2014 05:48:32 -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.59.13.131 with SMTP id ey3csp226595ved; Wed, 8 Jan 2014 05:48:31 -0800 (PST) X-Received: by 10.194.236.9 with SMTP id uq9mr69923313wjc.31.1389188910853; Wed, 08 Jan 2014 05:48:30 -0800 (PST) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by mx.google.com with ESMTPS id hk7si4565747wjb.30.2014.01.08.05.48.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.179 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.179; Received: by mail-wi0-f179.google.com with SMTP id z2so2088233wiv.0 for ; Wed, 08 Jan 2014 05:48:30 -0800 (PST) X-Received: by 10.194.173.163 with SMTP id bl3mr82334815wjc.10.1389188910344; Wed, 08 Jan 2014 05:48:30 -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 j9sm48125217wjx.18.2014.01.08.05.48.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 05:48:29 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, angus.clark@st.com, Lee Jones Subject: [PATCH v4 06/37] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Date: Wed, 8 Jan 2014 13:46:49 +0000 Message-Id: <1389188840-14306-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389188840-14306-1-git-send-email-lee.jones@linaro.org> References: <1389188840-14306-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.128.170 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;