From patchwork Tue Feb 12 07:12:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 158118 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3510165jaa; Mon, 11 Feb 2019 23:14:35 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibzm0HJ4YZb3MrakB++iJLW4Nij86e5iTKXXONHuZsjZwT4E/sKB6DxXon6R3JhXuplDSJC X-Received: by 2002:aa7:8101:: with SMTP id b1mr2626294pfi.148.1549955675787; Mon, 11 Feb 2019 23:14:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549955675; cv=none; d=google.com; s=arc-20160816; b=UYRiT/KJZQ3I3QOFId25rXIOWVT09H8JEAvoOk5HvgMfhc1zRXuWqutzQPSeOEc/I4 evjo9Jq7BXPAzuWnsI0mL4DJ3ULZRriwO1VFQ52Pw8bbU0oDTMEWVk52XU1SDyTkVzAn +9SAvxhT+H89mnQ8VsFsusHBfKdosoYbTZiQl1XWG9TYWjhqgY0nHPMkkxkEmg27vf4W REM206v78GLVDEu0ZnwWFR3co8lleKfR0aljoixjcqfeZlB7ua50m/NFQWfgTWJDpU0X tTCJ54VSvXRp/fFPIYGx2qLc+00bUY/H2uBmwROLOqvWXc9nIqwXXbTzIhGmp1LN+gtn 5HPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=5tFiME3yBRiRGQPmOvBDbj65Ncxe853UQ+lYecUJZ+0=; b=vDVyPkcL+pkV1WSENezttJYrE2GLKOezl+PsQz1LmKmfGtHJNoMUDEbup+/bn6xExY vbIWCbpYJjmISXurtPdWFg5kEoGM0lAnYJjrgKo0FZFT2NXZTfcC5+dluKJ8VxjW/JYb /RvCOyTvSNRPgQK/uzee0tV0bn5GbjI9X3RPk4w02p4RDjof4jTWCgaZQyA0nTaBTFl4 bGkzzbRzeCIgnHbKUgqoWiGQMTHd+wuBq2Blf3UsIWfGXQ6PLIIWO1GhWUnQ6KvYEZcu rgyOUwkjOxo1CvVhoy5H6QLzcXc0dYnAQ1nJXoJLziTlNF/cCBv5F+jHA05UrMxxMS2L 4U/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=g8TPNZNH; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=ucXgJkQO; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id 2si13216943pla.156.2019.02.11.23.14.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 23:14:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=g8TPNZNH; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=ucXgJkQO; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5tFiME3yBRiRGQPmOvBDbj65Ncxe853UQ+lYecUJZ+0=; b=g8TPNZNHCYw5O8gC9qXGAoHyck 1NnZRn+dC51gYZkIJb8rA8KyPR71DiLoFabKoef1gOBQ3BZebsiHiIX7vZq+QjmqkXzSZAa+4k9rG QafDrVp19W4wrIX7ppKTVrUZ0YTa2drfe1L3dbZHQtqQw2D3/g1EhdCLOv3v0oofRgQwc3YTFcWG2 0rdbwDqEPxhq0RaCX/sQ/+213+/pEahrqx43SlWge3Py8dZJc/loZjEcX9RfZfqZXg+FPXve0no0T f+kl1NehaieCRxTzrc9EuGqR1lFPJlb0o1gRL6GXUbAN3zawHr2Mj+ZId2G287d1NdWZY04tu5zy3 NYkQRUug==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGx-0003w0-AH; Tue, 12 Feb 2019 07:14:27 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGM-0003J9-Rg for linux-mtd@lists.infradead.org; Tue, 12 Feb 2019 07:13:59 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x1C7DPdP019269; Tue, 12 Feb 2019 16:13:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x1C7DPdP019269 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1549955607; bh=/zxB7KIjCJq0MrBa/cBQIYXIicBEXVUS2iHzliKqLWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucXgJkQOhrNoGeTRo3w1RNhc4hf7iWSOskQ5fEt+BBdf13BzJLn1kx74ohleIrN6p zyLtO0Khp1YRzkmKilxkQSlyv5wywU5kbnM+F9tXowYs0SkehMzql+Dt3iV4/83Fyd g0/9OwrD63RNlt0F4xBD057q6FhVXl/y8Nb8FS92NpC2yVKkkCLV3v0kppPTrwVwCn es4PH5tL6CpN/ei5n9LzU85AplvlBF2B6VGvQ5rqAcDIwDBskhWKXSBRTzWtscmlCp 3/1VFNn2yNZejtRErYFwwywwzRQWc1Z2m6FxWx0wpLB7+uZPg6ACwF1Euai1yFAG3a hKdhpFqG/YqZg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v2 01/10] mtd: rawnand: denali: use nand_chip pointer more for internal functions Date: Tue, 12 Feb 2019 16:12:53 +0900 Message-Id: <1549955582-30346-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> References: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190211_231351_600582_21AF1FDA X-CRM114-Status: GOOD ( 15.51 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [210.131.2.76 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org With the recent refactoring, the NAND driver hooks now take a pointer to nand_chip. Add to_denali() in order to convert (struct nand_chip *) to (struct denali_nand_info *) directly. It is more useful than the current mtd_to_denali(). I changed some helper functions to take (struct nand_chip *). This will avoid pointer conversion back and forth, and ease further development. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/raw/denali.c | 57 ++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 25 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 24aeafc..4ac1314 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -47,6 +47,11 @@ static inline struct denali_nand_info *mtd_to_denali(struct mtd_info *mtd) return container_of(mtd_to_nand(mtd), struct denali_nand_info, nand); } +static struct denali_nand_info *to_denali(struct nand_chip *chip) +{ + return container_of(chip, struct denali_nand_info, nand); +} + /* * Direct Addressing - the slave address forms the control information (command * type, bank, block, and page address). The slave data is the actual data to @@ -282,12 +287,12 @@ static void denali_cmd_ctrl(struct nand_chip *chip, int dat, unsigned int ctrl) denali->host_write(denali, DENALI_BANK(denali) | type, dat); } -static int denali_check_erased_page(struct mtd_info *mtd, - struct nand_chip *chip, uint8_t *buf, +static int denali_check_erased_page(struct nand_chip *chip, + struct denali_nand_info *denali, u8 *buf, unsigned long uncor_ecc_flags, unsigned int max_bitflips) { - struct denali_nand_info *denali = mtd_to_denali(mtd); + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; uint8_t *ecc_code = chip->oob_poi + denali->oob_skip_bytes; int ecc_steps = chip->ecc.steps; int ecc_size = chip->ecc.size; @@ -303,9 +308,9 @@ static int denali_check_erased_page(struct mtd_info *mtd, NULL, 0, chip->ecc.strength); if (stat < 0) { - mtd->ecc_stats.failed++; + ecc_stats->failed++; } else { - mtd->ecc_stats.corrected += stat; + ecc_stats->corrected += stat; max_bitflips = max_t(unsigned int, max_bitflips, stat); } @@ -316,11 +321,11 @@ static int denali_check_erased_page(struct mtd_info *mtd, return max_bitflips; } -static int denali_hw_ecc_fixup(struct mtd_info *mtd, +static int denali_hw_ecc_fixup(struct nand_chip *chip, struct denali_nand_info *denali, unsigned long *uncor_ecc_flags) { - struct nand_chip *chip = mtd_to_nand(mtd); + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; int bank = denali->active_bank; uint32_t ecc_cor; unsigned int max_bitflips; @@ -346,16 +351,17 @@ static int denali_hw_ecc_fixup(struct mtd_info *mtd, * Unfortunately, we can not know the total number of corrected bits in * the page. Increase the stats by max_bitflips. (compromised solution) */ - mtd->ecc_stats.corrected += max_bitflips; + ecc_stats->corrected += max_bitflips; return max_bitflips; } -static int denali_sw_ecc_fixup(struct mtd_info *mtd, +static int denali_sw_ecc_fixup(struct nand_chip *chip, struct denali_nand_info *denali, unsigned long *uncor_ecc_flags, uint8_t *buf) { - unsigned int ecc_size = denali->nand.ecc.size; + struct mtd_ecc_stats *ecc_stats = &nand_to_mtd(chip)->ecc_stats; + unsigned int ecc_size = chip->ecc.size; unsigned int bitflips = 0; unsigned int max_bitflips = 0; uint32_t err_addr, err_cor_info; @@ -404,7 +410,7 @@ static int denali_sw_ecc_fixup(struct mtd_info *mtd, /* correct the ECC error */ flips_in_byte = hweight8(buf[offset] ^ err_cor_value); buf[offset] ^= err_cor_value; - mtd->ecc_stats.corrected += flips_in_byte; + ecc_stats->corrected += flips_in_byte; bitflips += flips_in_byte; max_bitflips = max(max_bitflips, bitflips); @@ -587,9 +593,11 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, return ret; } -static int denali_data_xfer(struct denali_nand_info *denali, void *buf, - size_t size, int page, int raw, int write) +static int denali_data_xfer(struct nand_chip *chip, void *buf, size_t size, + int page, int raw, int write) { + struct denali_nand_info *denali = to_denali(chip); + iowrite32(raw ? 0 : ECC_ENABLE__FLAG, denali->reg + ECC_ENABLE); iowrite32(raw ? TRANSFER_SPARE_REG__FLAG : 0, denali->reg + TRANSFER_SPARE_REG); @@ -678,7 +686,7 @@ static int denali_read_page_raw(struct nand_chip *chip, uint8_t *buf, size_t size = writesize + oobsize; int ret, i, pos, len; - ret = denali_data_xfer(denali, tmp_buf, size, page, 1, 0); + ret = denali_data_xfer(chip, tmp_buf, size, page, 1, 0); if (ret) return ret; @@ -766,14 +774,14 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, int stat = 0; int ret; - ret = denali_data_xfer(denali, buf, mtd->writesize, page, 0, 0); + ret = denali_data_xfer(chip, buf, mtd->writesize, page, 0, 0); if (ret && ret != -EBADMSG) return ret; if (denali->caps & DENALI_CAP_HW_ECC_FIXUP) - stat = denali_hw_ecc_fixup(mtd, denali, &uncor_ecc_flags); + stat = denali_hw_ecc_fixup(chip, denali, &uncor_ecc_flags); else if (ret == -EBADMSG) - stat = denali_sw_ecc_fixup(mtd, denali, &uncor_ecc_flags, buf); + stat = denali_sw_ecc_fixup(chip, denali, &uncor_ecc_flags, buf); if (stat < 0) return stat; @@ -783,7 +791,7 @@ static int denali_read_page(struct nand_chip *chip, uint8_t *buf, if (ret) return ret; - stat = denali_check_erased_page(mtd, chip, buf, + stat = denali_check_erased_page(chip, denali, buf, uncor_ecc_flags, stat); } @@ -866,17 +874,16 @@ static int denali_write_page_raw(struct nand_chip *chip, const uint8_t *buf, memcpy(tmp_buf + size - len, oob, len); } - return denali_data_xfer(denali, tmp_buf, size, page, 1, 1); + return denali_data_xfer(chip, tmp_buf, size, page, 1, 1); } static int denali_write_page(struct nand_chip *chip, const uint8_t *buf, int oob_required, int page) { struct mtd_info *mtd = nand_to_mtd(chip); - struct denali_nand_info *denali = mtd_to_denali(mtd); - return denali_data_xfer(denali, (void *)buf, mtd->writesize, - page, 0, 1); + return denali_data_xfer(chip, (void *)buf, mtd->writesize, page, + 0, 1); } static void denali_select_chip(struct nand_chip *chip, int cs) @@ -1092,9 +1099,9 @@ static const struct mtd_ooblayout_ops denali_ooblayout_ops = { .free = denali_ooblayout_free, }; -static int denali_multidev_fixup(struct denali_nand_info *denali) +static int denali_multidev_fixup(struct nand_chip *chip) { - struct nand_chip *chip = &denali->nand; + struct denali_nand_info *denali = to_denali(chip); struct mtd_info *mtd = nand_to_mtd(chip); /* @@ -1222,7 +1229,7 @@ static int denali_attach_chip(struct nand_chip *chip) chip->ecc.read_oob = denali_read_oob; chip->ecc.write_oob = denali_write_oob; - ret = denali_multidev_fixup(denali); + ret = denali_multidev_fixup(chip); if (ret) return ret; From patchwork Tue Feb 12 07:12:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 158116 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3509822jaa; Mon, 11 Feb 2019 23:14:07 -0800 (PST) X-Google-Smtp-Source: AHgI3IbaG0eN6NjhkqzhIp0gFlkuWkOWhwi6jmHkVtZnUwx/sAik+mIsaTuLHT2+7oBIPXZYM1YD X-Received: by 2002:a63:5359:: with SMTP id t25mr2162723pgl.99.1549955647181; Mon, 11 Feb 2019 23:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549955647; cv=none; d=google.com; s=arc-20160816; b=Qg79Nwpizq+He8OkEwqsqHNx0g+JwVIfpt4EA4AZgw1+PIlucXEfcGCE7nWCUNICbb n9TSzeqMeA53XEeSb6ZnG/rKed0cwEdViQF7B8AylNSMnHuSblCQbvXhJAyeUKYOZl+D THGR7LX9boA5OjBzB1tGAGeBrNTb7Nu4U9eebN137c1pcPMdPSA57V+dXxN1C3DmAj9E w/M1YUMi06FJfu4pwPRFp5X0xIyOnb560DQtzzQ2XAD5XF0XXy3MfhxX4E7cgoNHeKBH jjhmbA8w07wATKWVe4Xpu9EjO7fY276QAOanh6dqzbvd73dggggJsK6uTyh/SIWA9YcI QlBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=L2ILPGgDUKksLtmvaKIYqW8M+MiMrkGWRgkgjw9cqFs=; b=vO3jf1Xo2veBGuSbpAh+G7rdba+vmQa+9vAc11aQunJmvsIrkF2+NqW3BdFrJGvJpq vVXjcmsNz2N1InBHbhKyN2f+9QOj80ea28cs84phJBee0kFDVmMZi5P3w6tupClynhGU DJOC/ur1okCFOAYK3eoF6h2mKE9dpCppDgattKKN08O+XE+sJNExldWgtsQfezS5ltAW wWz0KmJVXrU5VWZ92NBsLshS5MEPIY20yVOc56ADXyUqyrX9l2A8TQu+o5d8VwWXCZVh AgtY+GMqiUZGu6g/Uu5/erFCPheuPMAoM1SwbWUmlpZt9w5PQxXD8JxXZgj24uaWiFI5 Z3jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VO1KnPNV; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=qbt9Ky2x; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id b23si6081597pgl.559.2019.02.11.23.14.07 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 23:14:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VO1KnPNV; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=qbt9Ky2x; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=L2ILPGgDUKksLtmvaKIYqW8M+MiMrkGWRgkgjw9cqFs=; b=VO1KnPNVAN5sA7VpLuCtqFmiCv mH+Lwq2yervzniQTJwkVSHMPvA/ZSgfYo89BzquugpRaaFEDnkXT1/S6J5PQIgXIpHcrx0wkD76Oe 3y64BxStAgFeLOaDyZoWKHta/kf09ZWpMZE+3hM5R0IGwvGrFD4uFT3IuPwp8AjwPp9tCbhUp7/mT lTXzQHVbSlk3XljXxR4n+4zJcKEZi5wb2iT+dhOOdJ9gsxKgH9kYoNhAbplVX3Jo6sNc7GjgDFWja bI+DzDmZETBar/6A7Usu0Vm0U39CHxuBqgYkLNe1IkxpZRkBtcWtHpNLG7WZS2h7UB/VNFJZyYF/8 pHncy0ng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGU-0003Tc-8b; Tue, 12 Feb 2019 07:13:58 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGM-0003J8-NB for linux-mtd@lists.infradead.org; Tue, 12 Feb 2019 07:13:53 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x1C7DPdR019269; Tue, 12 Feb 2019 16:13:28 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x1C7DPdR019269 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1549955609; bh=HYckDXuas8pq71xyZdmaNUVL9TtZH+n6gMwrrO1jxis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbt9Ky2xDyQGdz88W/Sj6ZBspI2TphsqEV+kskQDTYR4VmUuHPhB4xPLdYi+v7lSM DTuISCkrU9MtBHR4Sk8c9EJAYXtCZ534xIpiLEfMmXxGuir24j86N90z/Ukp40kNR1 YLxaybUNFcSSGNfydSV1rWVuqCchnnp9QIqP465U37aR2imWHcnQCVEnGBkaqUiVQZ LJFImwKm70HYqib6gSaTcoPJlfSBs4tSRiJ3HD0Sri7d9XehajPkMrn2Mdhbw8JC8e boU5fzB5bs27Pml0tIF/VJjhg1SEu88igO42NXsTbTHGorl4QvKgwUUTOG9Ym768DQ 8YTZp9W/qQFCw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v2 03/10] mtd: rawnand: denali: remove unneeded casts in denali_{read, write}_pio Date: Tue, 12 Feb 2019 16:12:55 +0900 Message-Id: <1549955582-30346-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> References: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190211_231351_463935_DAF934C8 X-CRM114-Status: GOOD ( 10.68 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [210.131.2.76 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Since (u32 *) can accept an opaque pointer, the explicit casting from (void *) to (u32 *) is redundant. Change the function argument type to remove the casts. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/raw/denali.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 9287f4f..a2fe2ff 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -478,11 +478,10 @@ static void denali_setup_dma32(struct denali_nand_info *denali, denali->host_write(denali, mode | 0x14000, 0x2400); } -static int denali_pio_read(struct denali_nand_info *denali, void *buf, +static int denali_pio_read(struct denali_nand_info *denali, u32 *buf, size_t size, int page) { u32 addr = DENALI_MAP01 | DENALI_BANK(denali) | page; - uint32_t *buf32 = (uint32_t *)buf; uint32_t irq_status, ecc_err_mask; int i; @@ -494,7 +493,7 @@ static int denali_pio_read(struct denali_nand_info *denali, void *buf, denali_reset_irq(denali); for (i = 0; i < size / 4; i++) - *buf32++ = denali->host_read(denali, addr); + buf[i] = denali->host_read(denali, addr); irq_status = denali_wait_for_irq(denali, INTR__PAGE_XFER_INC); if (!(irq_status & INTR__PAGE_XFER_INC)) @@ -506,18 +505,17 @@ static int denali_pio_read(struct denali_nand_info *denali, void *buf, return irq_status & ecc_err_mask ? -EBADMSG : 0; } -static int denali_pio_write(struct denali_nand_info *denali, - const void *buf, size_t size, int page) +static int denali_pio_write(struct denali_nand_info *denali, const u32 *buf, + size_t size, int page) { u32 addr = DENALI_MAP01 | DENALI_BANK(denali) | page; - const uint32_t *buf32 = (uint32_t *)buf; uint32_t irq_status; int i; denali_reset_irq(denali); for (i = 0; i < size / 4; i++) - denali->host_write(denali, addr, *buf32++); + denali->host_write(denali, addr, buf[i]); irq_status = denali_wait_for_irq(denali, INTR__PROGRAM_COMP | INTR__PROGRAM_FAIL); From patchwork Tue Feb 12 07:13:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 158117 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3509991jaa; Mon, 11 Feb 2019 23:14:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ9xov2mJTJjNcAciFodRc0p/l69TgDwGD3hFHt7bEACYavGniTMW6gluLvMdjHwlprACc4 X-Received: by 2002:a65:6116:: with SMTP id z22mr2284968pgu.265.1549955660630; Mon, 11 Feb 2019 23:14:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549955660; cv=none; d=google.com; s=arc-20160816; b=iSQ85g9IhNZ12S1hQhQ6waZ4PlOd7rF2zx6n9MMz8ciFuGiy93WwKujOBnAEoLIi6x j3SZG4X5Cv/64Jq//J15kvDbPH8coLlMnwKOiD8P/JKAVZ8BbOZOxu8J4X1uSy1nm/WS p3JvXvJDSOjUIrsQIaSQDJbFNQwPxSBIpCevZGpcssRJesjCgtVpZ3T6fsaF1nQcCyE9 eEw+SFORJIqKB2q5y/hYBIHlm4imehaPl+CSeCeb/WC0133x9Tg8crUpTPNzxN2jW15q zMWngcDqto+TR+yLRSW2Z3hR++i5+SioBtVuduXRdHfeAjDUV67uEneelfGcn/zM+UHu X9Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=UJy+pSH1v7wytLhdgbswF1GVmhCNwLIBOxng2R63Rzo=; b=An6ci5PJRiSnY9O914w8ovdOLQsy2fXyqcQm4hcfiut0PKANUzpZGxvT9zUHhiuSAv ZuMY9uEIg66Q8xJfLzVLypZkzN2+cP5yATqajVn0I/I3cMOMoVTeHceDBM5p6LNkMSQe 0eOhD2toVP2bFg0ksz5ioGXyP5wJz13yOITNL05Ei09LWhyRbcLjbjC5Fw+Q87Q8gXmo Z6VDd4+MIDvxADVYJSkLcnoSfsdmIOAl221nA7hpnU7UcGlROGiGKB6Jq2Mp7XpvH/Fq zet/tMgNMKOsspm3JezTkAD5b+Uumt6llgloYq59PpVme0Gq9Tf1C9vTZ5FVQ2Tjam59 g8uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=GQb3iCGd; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="I0/FSzXM"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id t74si11304693pgc.150.2019.02.11.23.14.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 23:14:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=GQb3iCGd; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="I0/FSzXM"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=UJy+pSH1v7wytLhdgbswF1GVmhCNwLIBOxng2R63Rzo=; b=GQb3iCGdoYs+MjcT7L3o3duLup b4/9+GQp4TJ3Rn48lNsggHlhIuyJhyXaFPbbbL/CiFxaec9Mki5+EZOXfH6jRnC1uS/um6OON12hn /dzUgm8pSJFWDdb9xm3nIctr1Fe4I6NzUF5NEMj9XzOz6QpV6PEhaJ92gugTrymzhR5hEukOzsCeZ BDxpYf61c3Z1e3Ob0JsilWoFhSksJDjEu/PKMnBdH9I5Jd0Bm7f8rt8l2I6om6g8T4OEZncBR+8QL 6trI0azp3KiCOMxKDGEEZiiojxDiTxp+Rw5BgslA5f7UMBVmc83WpHb1M3KJra/VIefCtT3sz19EO yP45CYDQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGj-0003hJ-9G; Tue, 12 Feb 2019 07:14:13 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gtSGM-0003J3-M7 for linux-mtd@lists.infradead.org; Tue, 12 Feb 2019 07:13:53 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id x1C7DPdX019269; Tue, 12 Feb 2019 16:13:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com x1C7DPdX019269 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1549955614; bh=W7SE5qbwsV5rwyJe9i+cPWUmbUQD+IWEIEw4oDfctm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0/FSzXMmmwcZRVqdoNJocDfNuGW9hQQjoC9s67boSMYKaZXGnuTQMmtkks+QGOvG COzcdy5n0w2A+KXCxcLENXdh4eSzaUHZifq9S5C9Z8jX37lId3SxHqu8bBkS3L9Fnu EGHsCx4235f57Nr1bmSnt4uJ67uG02O/ZJU6A0hwPIWeROwjfeX14bm+lIl/B1bknB I8Zdqi6OES0gsiXGJaR7IwokTvdKEt/WeEZeVqDmEwYMtBufDdfSlusM0EHj+54I8i X2x8fw1RArjB+LSLPBeL25NGBdn00cD1/siDJmQ+qhBhYt4uUAeo13BhaskQWDSmUg Nd9VjJXCqAo9w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v2 09/10] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Date: Tue, 12 Feb 2019 16:13:01 +0900 Message-Id: <1549955582-30346-10-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> References: <1549955582-30346-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190211_231351_548218_34972801 X-CRM114-Status: GOOD ( 10.55 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [210.131.2.76 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Use the runtime-detected denali->nbanks instead of hard-coded DENALI_NR_BANKS (=4). The actual number of banks depends on the IP configuration, and can be less than DENALI_NR_BANKS. It is pointless to touch registers of unsupported banks. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/raw/denali.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index a162bd1..eb58136 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -40,7 +40,6 @@ #define DENALI_BANK(denali) ((denali)->active_bank << 24) #define DENALI_INVALID_BANK -1 -#define DENALI_NR_BANKS 4 static struct denali_chip *to_denali_chip(struct nand_chip *chip) { @@ -92,7 +91,7 @@ static void denali_enable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(U32_MAX, denali->reg + INTR_EN(i)); iowrite32(GLOBAL_INT_EN_FLAG, denali->reg + GLOBAL_INT_ENABLE); } @@ -101,7 +100,7 @@ static void denali_disable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(0, denali->reg + INTR_EN(i)); iowrite32(0, denali->reg + GLOBAL_INT_ENABLE); } @@ -117,7 +116,7 @@ static void denali_clear_irq_all(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) denali_clear_irq(denali, i, U32_MAX); } @@ -130,7 +129,7 @@ static irqreturn_t denali_isr(int irq, void *dev_id) spin_lock(&denali->irq_lock); - for (i = 0; i < DENALI_NR_BANKS; i++) { + for (i = 0; i < denali->nbanks; i++) { irq_status = ioread32(denali->reg + INTR_STATUS(i)); if (irq_status) ret = IRQ_HANDLED;