From patchwork Fri Nov 29 12:19:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 21893 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6CCF923FEA for ; Fri, 29 Nov 2013 12:20:44 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id w8sf21382885vbj.6 for ; Fri, 29 Nov 2013 04:20:44 -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=X/ID9duSlLOHXyyGfSX0xveEWRYXrUGED/dwrGpEVYA=; b=dBO5YuRD/G8PcGhdOksHc5+sygKLEUERp5NljgfuUYGPhDjgMguFyA4h7Pv25frTm4 30KJMBYC0loY0Ns4EvMk+ikx+tzxC5Rk8FFslO1kccT5u2DcFV3TvCwZvAfZPr3fbQzj /GcFErDjNhPz8+kd9cjcWat97LEWB9AUZ1W9TaTn8mZ2M2dPRKyxqkz9Vn79BzqCf8M4 R55k26OKpeIgIGFILXylDiqL64A3QI6ZJXuuKCTmFHUbs9riZdE+VO8NA/LG7K/JWes2 0GQYWGyU3ZJuXVIogWZ0p94sO4CHuWtOSjTWIwv3Dxx9shF+fxuXXjaL5TeW0oCIj2AP b6bQ== X-Gm-Message-State: ALoCoQngic/oSqTpG6o/8ZdyUaspmpJSdVK4FEn7N+IOmqEMzcJcKEXyXpPdInD0VuHaNo0YDIaD X-Received: by 10.52.229.41 with SMTP id sn9mr6908309vdc.6.1385727644264; Fri, 29 Nov 2013 04:20:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.169 with SMTP id i9ls3735469qer.65.gmail; Fri, 29 Nov 2013 04:20:44 -0800 (PST) X-Received: by 10.220.84.65 with SMTP id i1mr570551vcl.51.1385727644175; Fri, 29 Nov 2013 04:20:44 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id gq10si24734214vdc.82.2013.11.29.04.20.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.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.128.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so6777218veb.7 for ; Fri, 29 Nov 2013 04:20:44 -0800 (PST) X-Received: by 10.220.47.10 with SMTP id l10mr1852041vcf.32.1385727644108; Fri, 29 Nov 2013 04:20:44 -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 u4csp87487vcz; Fri, 29 Nov 2013 04:20:43 -0800 (PST) X-Received: by 10.49.27.226 with SMTP id w2mr85864063qeg.32.1385727643717; Fri, 29 Nov 2013 04:20:43 -0800 (PST) Received: from mail-yh0-f54.google.com (mail-yh0-f54.google.com [209.85.213.54]) by mx.google.com with ESMTPS id s9si21652205qas.131.2013.11.29.04.20.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.54 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.213.54; Received: by mail-yh0-f54.google.com with SMTP id z12so6666008yhz.13 for ; Fri, 29 Nov 2013 04:20:43 -0800 (PST) X-Received: by 10.236.2.166 with SMTP id 26mr1951046yhf.79.1385727643460; Fri, 29 Nov 2013 04:20:43 -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.20.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 04:20:43 -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 35/36] mtd: st_spi_fsm: Supply the W25Qxxx chip specific configuration call-back Date: Fri, 29 Nov 2013 12:19:24 +0000 Message-Id: <1385727565-25794-36-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.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: , Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 34 ++++++++++++++++++++++++++++++++++ drivers/mtd/devices/st_spi_fsm.h | 13 +++++++++---- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index d31348a..72474f1 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -150,6 +150,11 @@ static struct seq_rw_config stfsm_s25fl_write4_configs[] = { {0x00, 0, 0, 0, 0, 0x00, 0, 0}, }; +/* + * [W25Qxxx] Configuration + */ +#define W25Q_STATUS_QE (0x1 << 9) + static struct stfsm_seq stfsm_seq_read; /* Dynamically populated */ static struct stfsm_seq stfsm_seq_write; /* Dynamically populated */ static struct stfsm_seq stfsm_seq_en_32bit_addr;/* Dynamically populated */ @@ -1010,6 +1015,35 @@ static int stfsm_s25fl_config(struct stfsm *fsm) return 0; } +static int stfsm_w25q_config(struct stfsm *fsm) +{ + uint32_t data_pads; + uint16_t sta_wr; + uint8_t sta1, sta2; + int ret; + + ret = stfsm_prepare_rwe_seqs_default(fsm); + if (ret) + return ret; + + /* If using QUAD mode, set QE STATUS bit */ + data_pads = ((stfsm_seq_read.seq_cfg >> 16) & 0x3) + 1; + if (data_pads == 4) { + stfsm_read_status(fsm, FLASH_CMD_RDSR, &sta1); + stfsm_read_status(fsm, FLASH_CMD_RDSR2, &sta2); + + sta_wr = ((uint16_t)sta2 << 8) | sta1; + + sta_wr |= W25Q_STATUS_QE; + + stfsm_write_status(fsm, sta_wr, 2); + + stfsm_wait_busy(fsm); + } + + return 0; +} + static int stfsm_read(struct stfsm *fsm, uint8_t *const buf, const uint32_t size, const uint32_t offset) { diff --git a/drivers/mtd/devices/st_spi_fsm.h b/drivers/mtd/devices/st_spi_fsm.h index 83b30f9..4c8fecd 100644 --- a/drivers/mtd/devices/st_spi_fsm.h +++ b/drivers/mtd/devices/st_spi_fsm.h @@ -333,6 +333,7 @@ struct flash_info { static int stfsm_n25q_config(struct stfsm *fsm); static int stfsm_mx25_config(struct stfsm *fsm); static int stfsm_s25fl_config(struct stfsm *fsm); +static int stfsm_w25q_config(struct stfsm *fsm); static struct flash_info flash_types[] = { /* @@ -439,10 +440,14 @@ static struct flash_info flash_types[] = { FLASH_FLAG_READ_1_1_4 | \ FLASH_FLAG_READ_1_4_4 | \ FLASH_FLAG_WRITE_1_1_4) - { "w25q80", 0xef4014, 0, 64 * 1024, 16, W25Q_FLAG, 80, NULL }, - { "w25q16", 0xef4015, 0, 64 * 1024, 32, W25Q_FLAG, 80, NULL }, - { "w25q32", 0xef4016, 0, 64 * 1024, 64, W25Q_FLAG, 80, NULL }, - { "w25q64", 0xef4017, 0, 64 * 1024, 128, W25Q_FLAG, 80, NULL }, + { "w25q80", 0xef4014, 0, 64 * 1024, 16, W25Q_FLAG, 80, + stfsm_w25q_config }, + { "w25q16", 0xef4015, 0, 64 * 1024, 32, W25Q_FLAG, 80, + stfsm_w25q_config }, + { "w25q32", 0xef4016, 0, 64 * 1024, 64, W25Q_FLAG, 80, + stfsm_w25q_config }, + { "w25q64", 0xef4017, 0, 64 * 1024, 128, W25Q_FLAG, 80, + stfsm_w25q_config }, /* Sentinel */ { NULL, 0x000000, 0, 0, 0, 0, 0, NULL },