From patchwork Thu Jul 16 04:31:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11666641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF7EE13B1 for ; Thu, 16 Jul 2020 04:33:35 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98792206C1 for ; Thu, 16 Jul 2020 04:33:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eZi4pIhI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="ucHPxPDz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98792206C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References:List-Owner; bh=2t/w9XKD4rMwqgx2LT76UzeR4VQfgXDWcvorRzTLuYs=; b=eZi4pIhIUYQcUm0avJ/sYYvxRw 7kjglpQ7yK63GrO+R8teaANeaFPlignR91B9B187vsZjz5QLMYp1AcLeWHLx2K59DDVd4Z8u4xTik 5syvfzxoZvbp3hgDbekCmyoZrSnTekSAD0pJqMCtSwppDvaXqC4EzsP9NL/adZHVhZYdwrlpFlu7h q3zd3Vg2wnctX3p6feQV0uyw9Z48yjH69UFwDuwqf1pys5zJiNJH7q9B6AmnySqxfjHGpN3Zan8qn DSAX3JDScveqsWIukT2CTmOBm/DrUSOugR36v5iLUfrCgn8U0SJkoP49WiXoe1/h+9HvMLGcKmq+v NST/TnTw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvvYq-0003Ol-Hj; Thu, 16 Jul 2020 04:31:56 +0000 Received: from esa6.microchip.iphmx.com ([216.71.154.253]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvvYl-0003O9-4I for linux-arm-kernel@lists.infradead.org; Thu, 16 Jul 2020 04:31:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594873911; x=1626409911; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=u+UB9c28my/DDQhUKy4DZyEP/giRSm6BeHWpq5Nj6ds=; b=ucHPxPDzmK5WTyOtoO5ktg4g7I9yRw9I5hoajNKnlVarf8RviViQF6I3 RdK2SEOtOa6T8DoqB/iHBt3qvxvM3ptLZygtxVtNdMI1gAbqu6aumbrKO i6zhMlAOTGl2zE5YdvNc0DFOXMpzEUsOHlxeQ8SoCNA+gSAdyEXxheOxn u6xKlQrBtmcgBekXOejccRjIpLnOnIhwsgYE0M1P8743rN9Uj4vzpXJXs QKT1Dt6u6Fhuy2aC6W8LTtHZ8FadNXv0S1F0hgjo0nJyY/UPjelffoxhy KPNaEKHHq5CIDGyTy/KSntak1khNDilt9rl+4jszeyo7dJSGOrKLuoIS6 A==; IronPort-SDR: O/HUM1gCYSMxNiQL1Ba8SPvBO0P+mvVTHRMzYP2Yj8KNZidyLgwy6FmadsSOSrBqBfsvN30C3G NsJpOCB8bS0zksVXHwjkaLncvkxKZRwI/Gwq8g12yyJAbxQncoVWiibYl/T6HiF/N74+SJkL4u iONmueXp6vuJQZXeYsp0E7XRV/UfPbeA1quObVVqJ2ykm0MDHmnsCpXExT/KnizVF3TwCPGMjz 8ukBOpAcXF202CrPdb/n72hF3sk9T3bfBd5346xfFrXnDHHnJLLTkVtiHivVP63n8Fb7x06lmx GZw= X-IronPort-AV: E=Sophos;i="5.75,358,1589266800"; d="scan'208";a="19379601" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Jul 2020 21:31:46 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 15 Jul 2020 21:31:46 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 15 Jul 2020 21:31:11 -0700 From: Tudor Ambarus To: Subject: [PATCH] spi: atmel-quadspi: Use optimezed memcpy_fromio()/memcpy_toio() Date: Thu, 16 Jul 2020 07:31:39 +0300 Message-ID: <20200716043139.565734-1-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_003151_305976_D8BD3EE6 X-CRM114-Status: GOOD ( 10.17 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.154.253 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [216.71.154.253 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Optimezed mem*io operations are defined for LE platforms, use them. The ARM and !ARCH_EBSA110 dependencies for COMPILE_TEST were added only for the _memcpy_fromio()/_memcpy_toio() functions. Drop these dependencies. Tested unaligned accesses on both sama5d2 and sam9x60 QSPI controllers using SPI NOR flashes, everything works ok. The following performance improvement can be seen when running mtd_speedtest: sama5d2_xplained (mx25l25635e) - before: mtd_speedtest: eraseblock write speed is 983 KiB/s mtd_speedtest: eraseblock read speed is 6150 KiB/s - after: mtd_speedtest: eraseblock write speed is 1055 KiB/s mtd_speedtest: eraseblock read speed is 20144 KiB/s sam9x60ek (sst26vf064b) - before: mtd_speedtest: eraseblock write speed is 4770 KiB/s mtd_speedtest: eraseblock read speed is 8062 KiB/s - after: mtd_speedtest: eraseblock write speed is 4524 KiB/s mtd_speedtest: eraseblock read speed is 21186 KiB/s Signed-off-by: Tudor Ambarus --- drivers/spi/Kconfig | 2 +- drivers/spi/atmel-quadspi.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index fd64c865f6ef..b89d03a36cbd 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -103,7 +103,7 @@ config SPI_AT91_USART config SPI_ATMEL_QUADSPI tristate "Atmel Quad SPI Controller" - depends on ARCH_AT91 || (ARM && COMPILE_TEST && !ARCH_EBSA110) + depends on ARCH_AT91 || COMPILE_TEST depends on OF && HAS_IOMEM help This enables support for the Quad SPI controller in master mode. diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index a898755fb41e..8c009c175f2c 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -430,11 +430,11 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) /* Send/Receive data */ if (op->data.dir == SPI_MEM_DATA_IN) - _memcpy_fromio(op->data.buf.in, aq->mem + offset, - op->data.nbytes); + memcpy_fromio(op->data.buf.in, aq->mem + offset, + op->data.nbytes); else - _memcpy_toio(aq->mem + offset, op->data.buf.out, - op->data.nbytes); + memcpy_toio(aq->mem + offset, op->data.buf.out, + op->data.nbytes); /* Release the chip-select */ atmel_qspi_write(QSPI_CR_LASTXFER, aq, QSPI_CR);