Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1101254imm; Wed, 18 Jul 2018 16:59:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdTs20u9cagdwO7FspfAaLUffyYBeQgFJPnG1SbjlwOtbcvqSlWPTHVy4hk8+hX9lXUEgqB X-Received: by 2002:a17:902:8a8e:: with SMTP id p14-v6mr7737343plo.213.1531958353264; Wed, 18 Jul 2018 16:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531958353; cv=none; d=google.com; s=arc-20160816; b=q28j/Uk9PIFE8gZjmePkSinO7GhbMX71hLtVkLGavGrEuTlBq/WZoTmAhtt0zCFzar 4QEQ37+iS3UiFTDgSY4CUGAE1U6w7YQy2BR33n5N3Imy3X0tZMmQfYVe956ARgpOr6XW 90PetiuMy4Y9SKTDQ6vwwjll0Am6FCptT+XLE3uqAK+YIobm2kgvcCR08yrDcDrzZ3XY 1EjGpc3c2tFbgK95+UsWXRrF/eo8lL8hPN44n4W4AjWqsefuNdQ/WB2vycya4uAEzVEB UFBQUDIRF9F7hIj1g5xoMu25bkSiyO3Tg6Gluofr/hyrUmbiaBMkBbjbXB7fiBDHfGX6 wTmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=VKtzv6TOj+8k36A4MDjg5sQH4gRDQK6SCJGZCkc9hP0=; b=kYkEJ+BLMZiHxhaeqd7nru5+ZETP/zg6Fkd18YRQUlWCaMPDI+HSWteqMEvQ9BbhOj qKQOXzcH8bY4u5oLmi5dU9Pp3Jyiueh5OCejn8eFpiO/EmAGj9Xu1RjTEAJXL3CYIVUI 80NP79xaEc4qJHqW6Uw7YdbCvcs1jcb9xOcDqBFABCb8rvlzVHy0tDBWjs5mGEQcNydr 0779n7KMYjisyw7W9f01mXQxKcoSO6j+cLroflhVHGD+oLRZ6c5heke405SEqLVgLIjR okehB0l1k3UrUn1yoFC2xB7OrOvkfS5alM8nlHWNyyMAmzDDEDFDO2rSyXb+ot68bMUX M/Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IlQ8aKoT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m141-v6si4755373pfd.310.2018.07.18.16.58.58; Wed, 18 Jul 2018 16:59:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IlQ8aKoT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730912AbeGSAhP (ORCPT + 99 others); Wed, 18 Jul 2018 20:37:15 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35189 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730302AbeGSAhO (ORCPT ); Wed, 18 Jul 2018 20:37:14 -0400 Received: by mail-lj1-f194.google.com with SMTP id p10-v6so5614943ljg.2; Wed, 18 Jul 2018 16:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VKtzv6TOj+8k36A4MDjg5sQH4gRDQK6SCJGZCkc9hP0=; b=IlQ8aKoTG92ptQvIf3jEjtVkJm/f7dDAK06k7LNuIo4S1ply/FeieAXN856rW0EmPd s8DwFpAXD1Cndyn1hJNSrOMoNQoTJHJdTec1yCJLjrNeMlF3kv/pv/sIbtsYrQzM5/ek 2B9wAmZDnJdz235Ia/bdKaCDOdfBA6ruSeMR5e3ORA5cMFLE75bCV5shLwuslfJ/kpzZ QWr6GHn6pG2uz6DwE38gAJBMpWRe6DIme1Hd7+PpPkqYQgUZOo83O6wAHB0BKWsfsw2+ m3aiaEj52zyOcViF7bv0sd9uEWAgaDqkalGlW+0T0bT07oYPmKyF26lsD2i6zK+XYnLI 5yHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VKtzv6TOj+8k36A4MDjg5sQH4gRDQK6SCJGZCkc9hP0=; b=RQlCIxkRDJOBepWX1AUAs7oQMQGNzUyUTqmMWiAtkJcIwpFPQTdxhZPb7JHBFqXLN9 /dZ7Q5WtWi5JAq5egqbWflPi/gzsbbq61aNNla5FMukGpSLIh2pnje51c3nKxPrACjGF A2QfrtjjlNGU/Z1eNjFUgkGCihUJnciQfGHUxvFM1FI0j2Sw691x1bN020jnm0cHGszD 79DIdW+tn+WtE8m+ol3U6O106LLUhyRkr63T39vBAJCx6Yqc1cnoFGaZruCQdfaPD6t7 ee8cXJEh7rlq2t5XRAJZbMZlL9+Ld5f2Vy4aH8OOGluxGrsvqCy+vhj/Xpqsukd67s5S dWiw== X-Gm-Message-State: AOUpUlFUnB+AaVnW45YFgOgqm0YYUEENru/3u3DI5HMYlXh9sQEZL80f ilGh/0ZqS1FYSnBHKvFCNdk= X-Received: by 2002:a2e:4d51:: with SMTP id a78-v6mr5761383ljb.106.1531958213971; Wed, 18 Jul 2018 16:56:53 -0700 (PDT) Received: from z50.lan (93-181-165-181.internetia.net.pl. [93.181.165.181]) by smtp.gmail.com with ESMTPSA id h7-v6sm826584ljk.27.2018.07.18.16.56.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 16:56:53 -0700 (PDT) From: Janusz Krzysztofik To: Boris Brezillon , Miquel Raynal Cc: Tony Lindgren , Aaro Koskinen , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , Linus Walleij , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Artem Bityutskiy , Janusz Krzysztofik Subject: [RFC PATCH 3/8] mtd: rawnand: ams-delta: Set port direction once per transfer Date: Thu, 19 Jul 2018 01:57:05 +0200 Message-Id: <20180718235710.18242-4-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180718235710.18242-1-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In its current shape, the driver sets data port direction before each byte read/write operation, even during multi-byte transfers. Optimize that by setting the port direction only on first byte of each transfer. Signed-off-by: Janusz Krzysztofik --- drivers/mtd/nand/raw/ams-delta.c | 42 ++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c index 6ac38e9cfa1a..dfefcd79b420 100644 --- a/drivers/mtd/nand/raw/ams-delta.c +++ b/drivers/mtd/nand/raw/ams-delta.c @@ -72,50 +72,72 @@ static const struct mtd_partition partition_info[] = { .size = 3 * SZ_256K }, }; -static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) +static void ams_delta_write_next_byte(struct mtd_info *mtd, u_char byte) { struct nand_chip *this = mtd_to_nand(mtd); struct ams_delta_nand *priv = nand_get_controller_data(this); - void __iomem *io_base = priv->io_base; - writew(0, io_base + OMAP_MPUIO_IO_CNTL); writew(byte, this->IO_ADDR_W); gpiod_set_value(priv->gpiod_nwe, 0); ndelay(40); gpiod_set_value(priv->gpiod_nwe, 1); } -static u_char ams_delta_read_byte(struct mtd_info *mtd) +static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) { - u_char res; struct nand_chip *this = mtd_to_nand(mtd); struct ams_delta_nand *priv = nand_get_controller_data(this); void __iomem *io_base = priv->io_base; + writew(0, io_base + OMAP_MPUIO_IO_CNTL); + + ams_delta_write_next_byte(mtd, byte); +} + +static u_char ams_delta_read_next_byte(struct mtd_info *mtd) +{ + struct nand_chip *this = mtd_to_nand(mtd); + struct ams_delta_nand *priv = nand_get_controller_data(this); + u_char res; + gpiod_set_value(priv->gpiod_nre, 0); ndelay(40); - writew(~0, io_base + OMAP_MPUIO_IO_CNTL); res = readw(this->IO_ADDR_R); gpiod_set_value(priv->gpiod_nre, 1); return res; } +static u_char ams_delta_read_byte(struct mtd_info *mtd) +{ + struct nand_chip *this = mtd_to_nand(mtd); + struct ams_delta_nand *priv = nand_get_controller_data(this); + void __iomem *io_base = priv->io_base; + + writew(~0, io_base + OMAP_MPUIO_IO_CNTL); + + return ams_delta_read_next_byte(mtd); +} + static void ams_delta_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { int i; - for (i=0; i 0) + ams_delta_write_byte(mtd, buf[0]); + for (i = 1; i < len; i++) + ams_delta_write_next_byte(mtd, buf[i]); } static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len) { int i; - for (i=0; i 0) + buf[0] = ams_delta_read_byte(mtd); + for (i = 1; i < len; i++) + buf[i] = ams_delta_read_next_byte(mtd); } /* -- 2.16.4