From patchwork Sat Feb 10 11:20:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Kundr=C3=A1t?= X-Patchwork-Id: 10221399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1FDB86055C for ; Thu, 15 Feb 2018 14:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F82E2896A for ; Thu, 15 Feb 2018 14:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 046852896D; Thu, 15 Feb 2018 14:32:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=2.0 tests=BAYES_00, DATE_IN_PAST_96_XX, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95AE029388 for ; Thu, 15 Feb 2018 14:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033243AbeBOObj (ORCPT ); Thu, 15 Feb 2018 09:31:39 -0500 Received: from office2.cesnet.cz ([195.113.144.244]:43644 "EHLO office2.cesnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033121AbeBOOb0 (ORCPT ); Thu, 15 Feb 2018 09:31:26 -0500 Received: from localhost (unknown [IPv6:2001:718:1:2c:15f8:b813:1f49:2432]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id 66604400068; Thu, 15 Feb 2018 15:31:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1518705085; bh=t2NufILl6muOTmJi67z0nPPb/RYI+wkr8UHTx4waBpI=; h=Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To: References:From:Date:Subject:To:Cc; b=rACMQQhN4i/oovNin+kjejuCSv6xpW+kdoTRdVldWXA6ia5Y3qXjVW13zC+ep/RHG KCSX/oA21znnimLVSD8ObxiVigUqPMOnDz1LNejaxYHyi22diGZ1EyjYHx8gK/T7UD 31RA50cmyWqyJJlu/1FiwyMPMLWR9/SOp40tw2VE= Message-Id: <11b0dbc2b01dcd1e2f1e94ee1199442d5f2492ce.1518704854.git.jan.kundrat@cesnet.cz> In-Reply-To: References: From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Sat, 10 Feb 2018 12:20:23 +0100 Subject: [PATCH 3/4] spi: orion: Prepare space for per-child options MIME-Version: 1.0 To: linux-spi@vger.kernel.org Cc: Mark Brown , Geert Uytterhoeven , Chris Packham , Andy Shevchenko , Gregory CLEMENT , Christophe JAILLET Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Aggregating all options for a particular child underneath a common struct looks cleaner compared to having a separate array for each per-child option. Signed-off-by: Jan Kundrát --- This is just a precursor for the next one in series ("spi: orion: Software control for inter-word delays"). --- drivers/spi/spi-orion.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 56e419a7ed78..1eccc2287079 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -90,6 +90,10 @@ struct orion_direct_acc { u32 size; }; +struct orion_child_options { + struct orion_direct_acc direct_access; +}; + struct orion_spi { struct spi_master *master; void __iomem *base; @@ -98,7 +102,7 @@ struct orion_spi { const struct orion_spi_dev *devdata; int unused_hw_gpio; - struct orion_direct_acc direct_access[ORION_NUM_CHIPSELECTS]; + struct orion_child_options child[ORION_NUM_CHIPSELECTS]; }; static inline void __iomem *spi_reg(struct orion_spi *orion_spi, u32 reg) @@ -436,7 +440,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Use SPI direct write mode if base address is available. Otherwise * fall back to PIO mode for this transfer. */ - if ((orion_spi->direct_access[cs].vaddr) && (xfer->tx_buf) && + if ((orion_spi->child[cs].direct_access.vaddr) && (xfer->tx_buf) && (word_len == 8)) { unsigned int cnt = count / 4; unsigned int rem = count % 4; @@ -445,12 +449,12 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Send the TX-data to the SPI device via the direct * mapped address window */ - iowrite32_rep(orion_spi->direct_access[cs].vaddr, + iowrite32_rep(orion_spi->child[cs].direct_access.vaddr, xfer->tx_buf, cnt); if (rem) { u32 *buf = (u32 *)xfer->tx_buf; - iowrite8_rep(orion_spi->direct_access[cs].vaddr, + iowrite8_rep(orion_spi->child[cs].direct_access.vaddr, &buf[cnt], rem); } @@ -707,14 +711,14 @@ static int orion_spi_probe(struct platform_device *pdev) * This needs to get extended for the direct SPI-NOR / SPI-NAND * support, once this gets implemented. */ - spi->direct_access[cs].vaddr = devm_ioremap(&pdev->dev, + spi->child[cs].direct_access.vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE); - if (!spi->direct_access[cs].vaddr) { + if (!spi->child[cs].direct_access.vaddr) { status = -ENOMEM; goto out_rel_axi_clk; } - spi->direct_access[cs].size = PAGE_SIZE; + spi->child[cs].direct_access.size = PAGE_SIZE; dev_info(&pdev->dev, "CS%d configured for direct access\n", cs); }