From patchwork Thu Jul 14 01:13:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 648146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rqd740JFJz9sDf for ; Thu, 14 Jul 2016 11:15:44 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=d5pv3ra+; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNVDy-0000VU-Ne; Thu, 14 Jul 2016 01:13:58 +0000 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bNVDw-0000UN-0M for linux-mtd@lists.infradead.org; Thu, 14 Jul 2016 01:13:56 +0000 Received: by mail-pf0-x241.google.com with SMTP id t190so3961722pfb.2 for ; Wed, 13 Jul 2016 18:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=0XUI0IgEPN/Zw3glC+33zs7bqi1wojpaKkGIoHIPono=; b=d5pv3ra+UpIHRCdpamaEFaKb1mMk0OD8yPApXKxBB4K0RFM0JTaSLzOFsxoVg+to4A lbdkgXpOydfP89zR3mxt3bh4bwmahKNPVj3O6u4A9kBUUzzmG5uy7A7GKMctRxqqmHmL gy2ZbKg6Xs3JXCFq1yEfr+dQGgfE2v0mg5sSKFAjGRCJzTdSaa8w445gQp8rsFFkz1r9 9C+nWYFai8b/BrTL8xj1Ne9eImLFxhrQhgJhseCVsAPDzHjJPsVYKRKrQ1JsaAxLzvXq 3kNLAaQMxMhcLSDyr4F3C9NcBgMtaZINJ7lr/kLnWgm0hEWLclJdy+f5duWqSYieDRdd Ba+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=0XUI0IgEPN/Zw3glC+33zs7bqi1wojpaKkGIoHIPono=; b=IMsAsYyu19r6TbWckSRAcCazuKH6hzxS8mMlz/l/37yXugTjpglcxh8zcjthP/seJ7 J2a8XTwARKSiOU/PVootu8seTNZ93gNfFFAaQ0Uj2fbSxQY/7ID98ExbmgYfWaUjkuZx NfYQt7XAXNxs56qM/mMFGYyEyxOBlHUz9j0Wvlk1f9ookTkY+Ig3h83dBjDlyOURZVSy tV77O4ABxD/pQ493exWsDYS3IFKMVkXm93cz6vH11OjV9g8v/7zLSUNqbrWtAI/n9Gik ppkEHGA2/vmlRnZfAhQdRZv10y2aBs4z9zG4g/i9SyIWVFzJytPMZNtCQJu+HGc3a/4Q OD+A== X-Gm-Message-State: ALyK8tJo/BK0xCIRLzYzSQm0LtdlNsm8mASnJWLJY+Ap83HPI66gnBmShb3MDZkDCSo+5Q== X-Received: by 10.98.102.221 with SMTP id s90mr8267939pfj.69.1468458813880; Wed, 13 Jul 2016 18:13:33 -0700 (PDT) Received: from google.com ([2620:0:1000:1301:9c8f:26e5:226e:ea4c]) by smtp.gmail.com with ESMTPSA id w8sm881124paz.32.2016.07.13.18.13.32 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 13 Jul 2016 18:13:33 -0700 (PDT) Date: Wed, 13 Jul 2016 18:13:31 -0700 From: Brian Norris To: Jiancheng Xue Subject: Re: [PATCH v12] mtd: spi-nor: add hisilicon spi-nor flash controller driver Message-ID: <20160714011331.GE54628@google.com> References: <1467100099-6172-1-git-send-email-xuejiancheng@hisilicon.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1467100099-6172-1-git-send-email-xuejiancheng@hisilicon.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160713_181356_091190_478B21A7 X-CRM114-Status: GOOD ( 20.36 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Binquan Peng , linshunquan1@hisilicon.com, linux-kernel@vger.kernel.org, yanhaifeng@hisilicon.com, robh+dt@kernel.org, linux-mtd@lists.infradead.org, ezequiel@vanguardiasur.com.ar, jteki@openedev.com, cyrille.pitchen@atmel.com, yanghongwei@hisilicon.com Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Tue, Jun 28, 2016 at 03:48:19PM +0800, Jiancheng Xue wrote: > Add hisilicon spi-nor flash controller driver > > Signed-off-by: Binquan Peng > Signed-off-by: Jiancheng Xue > Acked-by: Rob Herring > Reviewed-by: Ezequiel Garcia > Reviewed-by: Jagan Teki > Reviewed-by: Cyrille Pitchen > --- > change log > v12: > 1)Made SPI_HISI_SFC depend on HAS_DMA to fix the kbuild test robot error. > 2)Added "Reviewed-by Cyrille Pitchen " and > "Reviewed-by: Jagan Teki " in the commit message. > v11: > Fixed issues pointed by Brian Norris and Cyrille Pitchen. > 1)Changed hisi_spi_nor_read_reg()/write_reg() to configure registers > without sniffing the opcodes. > 2)Deleted hisi_spi_nor_erase() and used default implementation instead. > 3)Changed hisi_spi_nor_dma_transfer() to return a integer type value > instead of nothing. > 4)Simplified hisi_spi_nor_read()/write() as Brian suggested. > > v10: > Fixed issues pointed by Marek Vasut. > 1)Droped the underscores in the argument names of some macros' definition. > 2)Changed some varibles to correct type. > 3)Rewrote hisi_spi_nor_read/write for readability. > 4)Added new functions hisi_spi_nor_register/unregister_all > 5)Changed to dynamically allocation for spi_nor embeded in hifmc_host. > Fixed issues pointed by Brian Norris. > 1)Replaced some headers with more accurate ones. > v9: > Fixed issues pointed by Jagan Teki. > v8: > Fixed issues pointed by Ezequiel Garcia and Brian Norris. > Moved dts binding file to mtd directory. > Changed the compatible string more specific. > v7: > Rebased to v4.5-rc3. > Fixed issues pointed by Ezequiel Garcia. > v6: > Based on v4.5-rc2 > Fixed issues pointed by Ezequiel Garcia. > v5: > Fixed a compile error. > v4: > Rebased to v4.5-rc1 > v3: > Added a compatible string "hisilicon,hi3519-sfc". > v2: > Fixed some compiling warings. > .../bindings/mtd/hisilicon,fmc-spi-nor.txt | 24 + > drivers/mtd/spi-nor/Kconfig | 7 + > drivers/mtd/spi-nor/Makefile | 1 + > drivers/mtd/spi-nor/hisi-sfc.c | 489 +++++++++++++++++++++ > 4 files changed, 521 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mtd/hisilicon,fmc-spi-nor.txt > create mode 100644 drivers/mtd/spi-nor/hisi-sfc.c Pushed to l2-mtd.git, with the following diff due to API changes. Please review to be sure it looks OK to you. Also, please base changes on l2-mtd.git or linux-next.git in the future. Regards, Brian diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c index 44664c3fc5ff..20378b0d55e9 100644 --- a/drivers/mtd/spi-nor/hisi-sfc.c +++ b/drivers/mtd/spi-nor/hisi-sfc.c @@ -269,8 +269,8 @@ static int hisi_spi_nor_dma_transfer(struct spi_nor *nor, loff_t start_off, return wait_op_finish(host); } -static int hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len, - size_t *retlen, u_char *read_buf) +static ssize_t hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len, + u_char *read_buf) { struct hifmc_priv *priv = nor->priv; struct hifmc_host *host = priv->host; @@ -287,14 +287,13 @@ static int hisi_spi_nor_read(struct spi_nor *nor, loff_t from, size_t len, return ret; } memcpy(read_buf + offset, host->buffer, trans); - *retlen += trans; } - return 0; + return len; } -static void hisi_spi_nor_write(struct spi_nor *nor, loff_t to, - size_t len, size_t *retlen, const u_char *write_buf) +static ssize_t hisi_spi_nor_write(struct spi_nor *nor, loff_t to, + size_t len, const u_char *write_buf) { struct hifmc_priv *priv = nor->priv; struct hifmc_host *host = priv->host; @@ -309,10 +308,11 @@ static void hisi_spi_nor_write(struct spi_nor *nor, loff_t to, to + offset, host->dma_buffer, trans, FMC_OP_WRITE); if (ret) { dev_warn(nor->dev, "DMA write timeout\n"); - return; + return ret; } - *retlen += len; } + + return len; } /**