From patchwork Thu Jan 23 10:31:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 23606 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 480E4218BD for ; Thu, 23 Jan 2014 10:33:15 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id up15sf3855362pbc.11 for ; Thu, 23 Jan 2014 02:33:14 -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=YaHwbTczwxjTgzKOt7GlMqkeqRwZ61bl+rafurCKMPo=; b=XmPHzd8oqjx8YNbbXA2fX797nQ8WMOMcSXgX4nFCTudFs4V/q5v7ntHLUB21rzUQDw yHxAu+Vp9eEOSq7OxyplhqYiuBwWKJVCwXpbLZuFVjhQvUTTkODqqzu8S8ZKWwlKOSOK rYKDzHWfXwhhxZUAwJHTvfxqT9t66z7nrv06elpT7UYz4pIq6J11u6EmNDJ40zE72sC2 6UnS2MBnpDF3XKBuz6QApBy3cPl191WmXdEgDteTeNq3TPxKg9u7aNGbd23K2eNkwMQy 2mTow0D2xR+0NM5eKJBV9FZQlmPAof5NBaK+064iJA5kY5pLzz4VA6dWdKEVetQeyXdi Emvg== X-Gm-Message-State: ALoCoQm9st6WuIFBvrim/whKmLRBtjH6ZFr5B73WgR3K5jA6iotxBxxFsJQCYTyxVhWATfKGD9rR X-Received: by 10.66.6.1 with SMTP id w1mr2707848paw.6.1390473194553; Thu, 23 Jan 2014 02:33:14 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.70 with SMTP id t64ls271470qge.1.gmail; Thu, 23 Jan 2014 02:33:14 -0800 (PST) X-Received: by 10.58.172.132 with SMTP id bc4mr34698vec.45.1390473194426; Thu, 23 Jan 2014 02:33:14 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id vi9si6419127vec.132.2014.01.23.02.33.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.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.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu8so949835vcb.1 for ; Thu, 23 Jan 2014 02:33:14 -0800 (PST) X-Received: by 10.220.174.200 with SMTP id u8mr4151735vcz.6.1390473194351; Thu, 23 Jan 2014 02:33:14 -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 u4csp16032vcz; Thu, 23 Jan 2014 02:33:13 -0800 (PST) X-Received: by 10.194.58.180 with SMTP id s20mr6148818wjq.54.1390473193389; Thu, 23 Jan 2014 02:33:13 -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 yw3si8773663wjc.158.2014.01.23.02.33.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:13 -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 y10so1237621wgg.34 for ; Thu, 23 Jan 2014 02:33:12 -0800 (PST) X-Received: by 10.194.216.68 with SMTP id oo4mr805573wjc.79.1390473192773; Thu, 23 Jan 2014 02:33:12 -0800 (PST) Received: from localhost.localdomain ([80.76.198.141]) by mx.google.com with ESMTPSA id ay6sm21257831wjb.23.2014.01.23.02.33.10 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 02:33:12 -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 35/37] mtd: st_spi_fsm: Supply the W25Qxxx chip specific configuration call-back Date: Thu, 23 Jan 2014 10:31:23 +0000 Message-Id: <1390473085-24626-36-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.220.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: , Signed-off-by: Lee Jones --- drivers/mtd/devices/st_spi_fsm.c | 47 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 88017d8..ddfff35 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -339,6 +339,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[] = { /* @@ -444,10 +445,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 }, @@ -575,6 +580,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 */ @@ -1433,6 +1443,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 *buf, uint32_t size, uint32_t offset) {