From patchwork Fri Nov 29 12:18:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21864 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f69.google.com (mail-qe0-f69.google.com [209.85.128.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E087623FC4 for ; Fri, 29 Nov 2013 12:19:48 +0000 (UTC) Received: by mail-qe0-f69.google.com with SMTP id 1sf17031739qec.0 for ; Fri, 29 Nov 2013 04:19:48 -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=wVErr7qGPocFLm43HoFl4B9nvZUmOerkUd0/Vz15fqA=; b=LBsvF0FBUcAQHHTQJ+UeW277sWOEfcNWNqyNEHxsh+nQO0/wcHqBVVjHChUMIA0m3d YalvzTqGoNNPRLEd2ajXCA/g0j6lNTiyVp9E6MEjAv6Fy+S/iSelOUqsMrrR3rkSPxwb SMOiARJQKghZMfElWlanP+Y+jdmljKXlDmsSes+T67D2/Bq/xCxqw/Km2Pt3E4FvTuk+ fk3uJLbmTPm/JuzV7LGYvNZjtp3zV4grrXrfYpM1v6iDC0zJEKXEdM8JqS1AwI5E7bD+ 31R2njP3RJ5joTi+WpcM+WRGpoTuIvVZohsXyU/LGgnIKg8TRW71TtNvVz4egXluGZuH jkDw== X-Gm-Message-State: ALoCoQlvDyNxfa5qohMs85ntb2jm9JgJLZUi3+mpRCnXY8Agvgi64/fd1ft5LNNNEoXTmowDsAIV X-Received: by 10.58.171.135 with SMTP id au7mr17067801vec.22.1385727588784; Fri, 29 Nov 2013 04:19:48 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.81.133 with SMTP id a5ls690447qey.21.gmail; Fri, 29 Nov 2013 04:19:48 -0800 (PST) X-Received: by 10.58.186.233 with SMTP id fn9mr1184544vec.31.1385727588712; Fri, 29 Nov 2013 04:19:48 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id bq2si24800412vcb.40.2013.11.29.04.19.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:19:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 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.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so6703875veb.25 for ; Fri, 29 Nov 2013 04:19:48 -0800 (PST) X-Received: by 10.52.103.35 with SMTP id ft3mr35804023vdb.5.1385727588637; Fri, 29 Nov 2013 04:19:48 -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 u4csp87389vcz; Fri, 29 Nov 2013 04:19:48 -0800 (PST) X-Received: by 10.224.61.1 with SMTP id r1mr43889514qah.97.1385727588146; Fri, 29 Nov 2013 04:19:48 -0800 (PST) Received: from mail-yh0-f45.google.com (mail-yh0-f45.google.com [209.85.213.45]) by mx.google.com with ESMTPS id ll3si46046385qeb.83.2013.11.29.04.19.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:19:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.45 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.45; Received: by mail-yh0-f45.google.com with SMTP id v1so5648421yhn.18 for ; Fri, 29 Nov 2013 04:19:47 -0800 (PST) X-Received: by 10.236.62.194 with SMTP id y42mr1978844yhc.54.1385727587325; Fri, 29 Nov 2013 04:19:47 -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 m29sm101911689yho.14.2013.11.29.04.19.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:19:46 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dwmw2@infradead.org Cc: linus.walleij@linaro.org, linux-mtd@lists.infradead.org, angus.clark@st.com, Lee Jones Subject: [PATCH v3 06/36] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Date: Fri, 29 Nov 2013 12:18:55 +0000 Message-Id: <1385727565-25794-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1385727565-25794-1-git-send-email-lee.jones@linaro.org> References: <1385727565-25794-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.180 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;