From patchwork Tue May 26 08:04:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1250 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0D3823F08B for ; Tue, 26 May 2020 10:05:00 +0200 (CEST) Received: by mail-pl1-f200.google.com with SMTP id w11sf15102316pll.15 for ; Tue, 26 May 2020 01:04:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590480298; cv=pass; d=google.com; s=arc-20160816; b=u6EzJvLcupZXL3RsZzw1ZH8zhkIPUshBuGqdSyD0cm+VadB1uB66CO3jTXQIhJErsT RnzO5pge28W/e9XIdpd2alS04INk/qvTQLNv/d+wKHP7jTJE09Rd4VsiFDtzBJldYIb8 sDMHYAop/pDaItvYTbgBEiJui2AYH6rHd97fmOBFBtJckZZYFNZVbjv9/VC82b56C4Au /c2vUivO8dMuoKRMJKm7+TC1kmaKDGSKMVzaXof5jWpX9x1MVRG+uHSLkPLFl7Akk4ap a7eMY9cdBVM6plzK4Vj8ksD1p6DxiCxqQj+LBd1+goFIFFBJK+g6MpMAFcvISAJiepID s5qA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=m9Gw/+FWt+iaIrXqczkfS4YQYi/YKyhztU1h4DdILNo=; b=wLL9Ci9LvxiQzFUMTKHkGpnWY9MqzpBfPi5pyG+5KL8lwVt3rvhptxCqhdXEBifLSJ YhC3x5/34FqQYg8yVygT8MMUMs+KVPUq5Nk50DudxVO44oY5gxCJqe2r/HqKjLOmcg6K wU7MaK6hova2y8T5VFF1Q7dyxoY6NTqNVfcCBF2IiWCDEZ1obnKrszEOWWrVJ6Vd8y// sNqYXWZbHwUQQ2h5XhDzW/sQyNd8qXn8vFWrZ6myp2yaLm9QBr7Vo/OyUiamiYWKLjYI QNDNFUTYhSg2Sq8qQKjkSolwhG6yka20ViBSDlecNlyOpgScujc2osxCGKuoVsUcNhOO rcxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Uf2V98XL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=m9Gw/+FWt+iaIrXqczkfS4YQYi/YKyhztU1h4DdILNo=; b=E+68jUg8AWoZ2Ump/u+0e3nYlBVFwB+W+dsXzhz40HqjOnvtz2C+wMRCpcpGzWLgYq S80QpjY+vEjEWcT5cxIWHZa3hzgOkKZbxehe/AT/LCJVPmN8n+OOzajiHH84uUK6IM8V SVazlhmox42AT37Fm4B7yipN1WUWWzgToaK98= 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=m9Gw/+FWt+iaIrXqczkfS4YQYi/YKyhztU1h4DdILNo=; b=DBkIrwx9OgQhwA1wytEG+kC7O5cbZhfg66b0L6bWPqq4a+ASuWR8OzjCxHkaiYtWOO XtlkNpO0turkQSBebQUhVByCS2/HxyopemYuMbzK3T9jXfpghtpZIk4/Kbj6+nOnUx+U 8FHHlmc2vFKrzDOUAfh5ehrjCTC5mKftgzuGJmIPTtnRRwrBCSKwKtvgyhJTrug9YvX1 mkiBimII2/KITEDNjqBjpU73RrM8XA95+7UjUVw0Wa1BHjk6AG6sEJCJCgQ2RrwdIEAP VaniEtn/B5kD+YglXGdLnTq57dvcfFdBk8kZpXAmUQMQ21ve52CvfwoA/CrpRDr9/eYa 4QCg== X-Gm-Message-State: AOAM531gSref80CCwjhbSEiidC1rZHOYt25eoFoDwYLIe4WxGslPCmxl SW1MhiFQrX53BBkB2x3EdJCEzIbu X-Google-Smtp-Source: ABdhPJydTuBdh1dlJZB18ANSeAQN4CuvU58Xd2RgszcJbVY3pWq0ivMg0FBHz5jFqL1ZYKAE7pJb/g== X-Received: by 2002:a63:c44b:: with SMTP id m11mr28676854pgg.404.1590480298537; Tue, 26 May 2020 01:04:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:384c:: with SMTP id nl12ls5671247pjb.2.canary-gmail; Tue, 26 May 2020 01:04:58 -0700 (PDT) X-Received: by 2002:a17:90a:cc05:: with SMTP id b5mr24767911pju.102.1590480298070; Tue, 26 May 2020 01:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590480298; cv=none; d=google.com; s=arc-20160816; b=JRwI3UinQ2g29fOee7e7c7SSetKLFmSaPs75iDMgxf27NH35XLTjMB1DMDrky757Ej +rlVPqz4OCfTMUsiCsM6aLhtruyJln+l/kf6UpK0WHPwrcJyMpB9LruebidAt3XxePqd 4+lyuXVT7Uz7QrIRV5gJKPtHDWRd6+C3EAyGeoC5U58oQJpYq2jNeekvpjard1orM7jw gGZeUCSNoLtLXg2uLlT+OA9QLbXWAbGdAcTBUPVGHBvB3thwL0gaJ+kH2ASjv1t+JETN HtOvUN7mudNT1PTLD9qxPml8jvvB4BX6d8vx29froQOqR6Qd7R/U/k6s93ggT/vbBsch RZ4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=162iVD4HjrEMaAMjPoXnt7AJEsIU4cCIt0pK7n+/HR8=; b=oz05EHJHZURtevfBHKeD6bV06PXMFe8FR7HeKGF3eKLsrhwllYu4mzoWlgiH1IAYCT PrPoeM05XG3d/AYLsX8Ay7ea0mQGVjp0PyCpDsMutkmsGMdMK7kzU/lsqAOzt0OqnVx0 3kt/tY9ZaUXx7aM8iFh7/tMEV114UqxhLqrJAoudZJVJdcPCn5mv/WZWXiWhKsE5u6om hfY+IBYElhcHDCoq553W/su8ZPUNnphGtr8d7X02Z/K8VQaUzhR3k89FJhidM5K4NjnM 8pq03z+5FiQ0zh35Mtj/coUKz/QsAzRud9ON2UUug1FbbrCgVBB74L2C2JNvnqn11npG 1/5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Uf2V98XL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o5sor10101990pgi.25.2020.05.26.01.04.58 for (Google Transport Security); Tue, 26 May 2020 01:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a63:d044:: with SMTP id s4mr30300225pgi.347.1590480297709; Tue, 26 May 2020 01:04:57 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:3:4404:74c7:87fd]) by smtp.gmail.com with ESMTPSA id d8sm14560782pfq.123.2020.05.26.01.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 01:04:57 -0700 (PDT) From: Jagan Teki To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 6/9] spi: mxs: Drop nondm code Date: Tue, 26 May 2020 13:34:27 +0530 Message-Id: <20200526080430.118262-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526080430.118262-1-jagan@amarulasolutions.com> References: <20200526080430.118262-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Uf2V98XL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Deadline for DM migration already passed by months and no response on full dm conversation hence removed the nondm code. Note: Look like there is no user for nondm code for this driver. Signed-off-by: Jagan Teki --- drivers/spi/Kconfig | 12 ++--- drivers/spi/mxs_spi.c | 123 ------------------------------------------ 2 files changed, 6 insertions(+), 129 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 1a1f195232..46a7b9e9d3 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -213,6 +213,12 @@ config MVEBU_A3700_SPI used to access the SPI NOR flash on platforms embedding this Marvell IP core. +config MXS_SPI + bool "MXS SPI Driver" + help + Enable the MXS SPI controller driver. This driver can be used + on the i.MX23 and i.MX28 SoCs. + config NXP_FSPI bool "NXP FlexSPI driver" depends on SPI_MEM @@ -424,12 +430,6 @@ config MXC_SPI Enable the MXC SPI controller driver. This driver can be used on various i.MX SoCs such as i.MX31/35/51/6/7. -config MXS_SPI - bool "MXS SPI Driver" - help - Enable the MXS SPI controller driver. This driver can be used - on the i.MX23 and i.MX28 SoCs. - config OMAP3_SPI bool "McSPI driver for OMAP" help diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c index 0da4a80d71..a21419a15a 100644 --- a/drivers/spi/mxs_spi.c +++ b/drivers/spi/mxs_spi.c @@ -46,19 +46,6 @@ static void mxs_spi_end_xfer(struct mxs_ssp_regs *ssp_regs) writel(SSP_CTRL0_IGNORE_CRC, &ssp_regs->hw_ssp_ctrl0_set); } -#if !CONFIG_IS_ENABLED(DM_SPI) -struct mxs_spi_slave { - struct spi_slave slave; - uint32_t max_khz; - uint32_t mode; - struct mxs_ssp_regs *regs; -}; - -static inline struct mxs_spi_slave *to_mxs_slave(struct spi_slave *slave) -{ - return container_of(slave, struct mxs_spi_slave, slave); -} -#else #include #include #include @@ -87,20 +74,12 @@ struct mxs_spi_priv { unsigned int clk_id; unsigned int mode; }; -#endif -#if !CONFIG_IS_ENABLED(DM_SPI) -static int mxs_spi_xfer_pio(struct mxs_spi_slave *slave, - char *data, int length, int write, unsigned long flags) -{ - struct mxs_ssp_regs *ssp_regs = slave->regs; -#else static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv, char *data, int length, int write, unsigned long flags) { struct mxs_ssp_regs *ssp_regs = priv->regs; -#endif if (flags & SPI_XFER_BEGIN) mxs_spi_start_xfer(ssp_regs); @@ -156,17 +135,10 @@ static int mxs_spi_xfer_pio(struct mxs_spi_priv *priv, return 0; } -#if !CONFIG_IS_ENABLED(DM_SPI) -static int mxs_spi_xfer_dma(struct mxs_spi_slave *slave, - char *data, int length, int write, unsigned long flags) -{ - struct mxs_ssp_regs *ssp_regs = slave->regs; -#else static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv, char *data, int length, int write, unsigned long flags) { struct mxs_ssp_regs *ssp_regs = priv->regs; -#endif const int xfer_max_sz = 0xff00; const int desc_count = DIV_ROUND_UP(length, xfer_max_sz) + 1; struct mxs_dma_desc *dp; @@ -207,11 +179,7 @@ static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv, /* Invalidate the area, so no writeback into the RAM races with DMA */ invalidate_dcache_range(dstart, dstart + cache_data_count); -#if !CONFIG_IS_ENABLED(DM_SPI) - dmach = MXS_DMA_CHANNEL_AHB_APBH_SSP0 + slave->slave.bus; -#else dmach = priv->dma_channel; -#endif dp = desc; while (length) { @@ -288,20 +256,12 @@ static int mxs_spi_xfer_dma(struct mxs_spi_priv *priv, return ret; } -#if !CONFIG_IS_ENABLED(DM_SPI) -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, - const void *dout, void *din, unsigned long flags) -{ - struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); - struct mxs_ssp_regs *ssp_regs = mxs_slave->regs; -#else int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct udevice *bus = dev_get_parent(dev); struct mxs_spi_priv *priv = dev_get_priv(bus); struct mxs_ssp_regs *ssp_regs = priv->regs; -#endif int len = bitlen / 8; char dummy; int write = 0; @@ -345,95 +305,13 @@ int mxs_spi_xfer(struct udevice *dev, unsigned int bitlen, if (!dma || (len < MXSSSP_SMALL_TRANSFER)) { writel(SSP_CTRL1_DMA_ENABLE, &ssp_regs->hw_ssp_ctrl1_clr); -#if !CONFIG_IS_ENABLED(DM_SPI) - return mxs_spi_xfer_pio(mxs_slave, data, len, write, flags); -#else return mxs_spi_xfer_pio(priv, data, len, write, flags); -#endif } else { writel(SSP_CTRL1_DMA_ENABLE, &ssp_regs->hw_ssp_ctrl1_set); -#if !CONFIG_IS_ENABLED(DM_SPI) - return mxs_spi_xfer_dma(mxs_slave, data, len, write, flags); -#else return mxs_spi_xfer_dma(priv, data, len, write, flags); -#endif - } -} - -#if !CONFIG_IS_ENABLED(DM_SPI) -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - /* MXS SPI: 4 ports and 3 chip selects maximum */ - if (!mxs_ssp_bus_id_valid(bus) || cs > 2) - return 0; - else - return 1; -} - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct mxs_spi_slave *mxs_slave; - - if (!spi_cs_is_valid(bus, cs)) { - printf("mxs_spi: invalid bus %d / chip select %d\n", bus, cs); - return NULL; } - - mxs_slave = spi_alloc_slave(struct mxs_spi_slave, bus, cs); - if (!mxs_slave) - return NULL; - - if (mxs_dma_init_channel(MXS_DMA_CHANNEL_AHB_APBH_SSP0 + bus)) - goto err_init; - - mxs_slave->max_khz = max_hz / 1000; - mxs_slave->mode = mode; - mxs_slave->regs = mxs_ssp_regs_by_bus(bus); - - return &mxs_slave->slave; - -err_init: - free(mxs_slave); - return NULL; -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); - - free(mxs_slave); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - struct mxs_spi_slave *mxs_slave = to_mxs_slave(slave); - struct mxs_ssp_regs *ssp_regs = mxs_slave->regs; - u32 reg = 0; - - mxs_reset_block(&ssp_regs->hw_ssp_ctrl0_reg); - - writel((slave->cs << MXS_SSP_CHIPSELECT_SHIFT) | - SSP_CTRL0_BUS_WIDTH_ONE_BIT, - &ssp_regs->hw_ssp_ctrl0); - - reg = SSP_CTRL1_SSP_MODE_SPI | SSP_CTRL1_WORD_LENGTH_EIGHT_BITS; - reg |= (mxs_slave->mode & SPI_CPOL) ? SSP_CTRL1_POLARITY : 0; - reg |= (mxs_slave->mode & SPI_CPHA) ? SSP_CTRL1_PHASE : 0; - writel(reg, &ssp_regs->hw_ssp_ctrl1); - - writel(0, &ssp_regs->hw_ssp_cmd0); - - mxs_set_ssp_busclock(slave->bus, mxs_slave->max_khz); - - return 0; } -void spi_release_bus(struct spi_slave *slave) -{ -} - -#else /* CONFIG_DM_SPI */ /* Base numbers of i.MX2[38] clk for ssp0 IP block */ #define MXS_SSP_IMX23_CLKID_SSP0 33 #define MXS_SSP_IMX28_CLKID_SSP0 46 @@ -625,4 +503,3 @@ U_BOOT_DRIVER(mxs_spi) = { .priv_auto_alloc_size = sizeof(struct mxs_spi_priv), .probe = mxs_spi_probe, }; -#endif