From patchwork Thu Nov 14 14:22:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21503 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7F5BA23FDD for ; Thu, 14 Nov 2013 14:23:06 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wn1sf4748426obc.3 for ; Thu, 14 Nov 2013 06:23:05 -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=geG0rqBe7Rm2C7jIV3yJHVweMCyM0/VwOK7cONPmOLo=; b=CschPBElLSb44GR5/1veCmQ7aYjIITg61Mrf1pa7b8mn1fMWvB/frohcP50lDWRTSh n/crSPh+WarafGZ8z+ajrIE6JSO56jKCzXbb46g5m1FDEPdKRX0ov6/LV6fRcsq+627J 3Awd216MXDcGTJ+hjx/TgyLOrjc7luTXg7X34YJHbMECIF/IzWHpEUHI2lmxkifrSOzs B+6d/mAUJJyfCLYRYBSMUGzCMXXlPGN1hdJJj40aYEErw6opyoUOfV1vqFBoW/iLpKCc b9fv1K4tNm7YjZ5iFrPN1ppYRvl+selCWyIY2AZRW/xBXzy/1N92ui3mkiRjyJiUhlAk hPew== X-Gm-Message-State: ALoCoQk7p6x5zmkHVbWEZPBvlsJ3IJkqCcLvEaXli0OQwQPgeTLxGwcirQxlkQM2FBZvb3X38DwE X-Received: by 10.182.158.4 with SMTP id wq4mr690749obb.18.1384438985904; Thu, 14 Nov 2013 06:23:05 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.226 with SMTP id nj2ls1023661qeb.90.gmail; Thu, 14 Nov 2013 06:23:05 -0800 (PST) X-Received: by 10.52.169.227 with SMTP id ah3mr159420vdc.45.1384438985747; Thu, 14 Nov 2013 06:23:05 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id ch11si17184994ved.101.2013.11.14.06.23.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 06:23:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ia6so56460vcb.21 for ; Thu, 14 Nov 2013 06:23:05 -0800 (PST) X-Received: by 10.52.171.79 with SMTP id as15mr806261vdc.1.1384438985479; Thu, 14 Nov 2013 06:23:05 -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 u4csp319811vcz; Thu, 14 Nov 2013 06:23:05 -0800 (PST) X-Received: by 10.60.125.138 with SMTP id mq10mr1644410oeb.90.1384438984831; Thu, 14 Nov 2013 06:23:04 -0800 (PST) Received: from mail-oa0-f45.google.com (mail-oa0-f45.google.com [209.85.219.45]) by mx.google.com with ESMTPS id mu4si4335136obc.61.2013.11.14.06.23.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 06:23:04 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.45 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.219.45; Received: by mail-oa0-f45.google.com with SMTP id m1so2291538oag.32 for ; Thu, 14 Nov 2013 06:23:04 -0800 (PST) X-Received: by 10.60.40.70 with SMTP id v6mr1572556oek.69.1384438984353; Thu, 14 Nov 2013 06:23:04 -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 z5sm5585965obg.13.2013.11.14.06.23.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Nov 2013 06:23:03 -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, angus.clark@st.com, Lee Jones Subject: [PATCH 06/10] mtd: st_spi_fsm: Supply defines for the possible flash command opcodes Date: Thu, 14 Nov 2013 14:22:32 +0000 Message-Id: <1384438956-31153-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1384438956-31153-1-git-send-email-lee.jones@linaro.org> References: <1384438956-31153-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.220.176 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 a1c2857..6691eaf 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -30,6 +30,44 @@ #define 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;