From patchwork Tue May 26 17:47:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1267 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 36C103F1DD for ; Tue, 26 May 2020 19:47:37 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id m7sf184648pjh.9 for ; Tue, 26 May 2020 10:47:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590515256; cv=pass; d=google.com; s=arc-20160816; b=c0uth/bbEIPoUSm0eLyNonxTWGZaME2OWSxBfQLfwr9+zjzqcsl+d8HVAF/0iXlxS2 woau/C9uCF89ij3+vjQYY4rd9xLt8PPwre62aEjFkxWoIiEjYaq+VymSburOt1yAGS+5 BQYSUE91zGrOx/kcZPbSerIFJ9y4egJ+9XZo5EGtlPtVOhevktuK6BCeu5UDQAZ9FOPV g/fkkjjHX1PfR7pWk2XkvK4w3Xc8HnDIuOJql8oz7JOqJJgCNOq5cbrbG6779YvJ4IbK 4EmMGyu6WcpBAPtQtcqHpu+MGPkzLYdcRhwbeIcsFi+TFdLVxI2YhuXaNessnqhgqCbq M/4A== 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=qpWyQczCmQb5GFHNmc5YHASwJGZigORKX7GF3Wf39Z0=; b=0kiVfqzE+Eh7xQ4N6FtNWfjQGmF2RuvgbtemYmUo8tdHzFjCDYISdtyK+AtK31Uk9g OJOBwWhJ/POqOFphq3DEh0PvB6In/n89abeoi0TtKFrG6FcSYvHBWn84g4AL+PZ9FU6Y 4EqwQgL6RtWg1wkOe98SPEgJ3KI9nUx5FCiepfbcQ8m+vHMTyzpwME+SLO64KsNcTUFl Fp6v3etABPCi3TBS+XhmLkC5Uu33BlNnLMYnQKZ7QeVRUGCs0OgbXcLfMV/uC3eiIflD 1QhPYVaqN+H3sTsPcrqK32OvPFcWJidacbL+D3qoOtYjKUCzN/Tq07f6aA5jXW6aK6zX 49lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YsdcsZUM; 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=qpWyQczCmQb5GFHNmc5YHASwJGZigORKX7GF3Wf39Z0=; b=ZFB3wmLouCXmV4RzaTMQddd2QPuwYPbMFMQI551UEroqMW3m4KRn6xkf3Jiur4OZ1A wj87xQbkiWQaIxUYwrk2ScUyROifwlN16+6etKbJ98dURNrA3LRMxCExEBFrR7W8DUc5 oM/cXTFl9tl6nkCz3x2vQ+WmG1QoS6ztM1YxU= 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=qpWyQczCmQb5GFHNmc5YHASwJGZigORKX7GF3Wf39Z0=; b=FxLH+1YLGKK+gUyinCtX7SeaOlm5I1v2vvA2/6jT0l2f5QgZUPDXEb0DJf4/oGnUoz UmErPMvOWmb4dkNHXyqY0ymKcmK4suIceYwfNrS0zjNTiz56MJEpswkkoaCd6hq8OaiR 3wqdf0kw1+pizIlSMl6IqAr8PQK7X40gmJ/tjpicBlYjE3Rbskzy0cna5+AGNnefkxyN DP9CiHzoIiTY5Y0+gc+F2EtJHk7Rd7I6FpWXqO0P7ClWKTUJ7Mu/4XYHkJHBRu8IdlOS gdecAyk8qRtzAfINq/7ifWW5CvlIhZyAghXP+VRaW8oIZiQuYFhhCnQ2B0K3bmP2KJPf tuog== X-Gm-Message-State: AOAM532Gj8YGwrFGpy5d2bXY10pR6N7EY86OKS+QSfhUYRphrPSaJPgQ ajrF+Y/gSkWJBabEJWdHaCSptbPF X-Google-Smtp-Source: ABdhPJxEEanbhL1TZRQjA1gNje2LtGp2iWGAOktO0cWm/lFstaMWY6uu/e0ZPiueGZ8vwTaO6E6sow== X-Received: by 2002:a17:902:8509:: with SMTP id bj9mr2113811plb.151.1590515256003; Tue, 26 May 2020 10:47:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:fc8e:: with SMTP id e136ls4088882pfh.7.gmail; Tue, 26 May 2020 10:47:35 -0700 (PDT) X-Received: by 2002:aa7:95a5:: with SMTP id a5mr22297326pfk.151.1590515255506; Tue, 26 May 2020 10:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590515255; cv=none; d=google.com; s=arc-20160816; b=weV7RvIRI5lHXE4xHU6CoD+97hKPFL7e8gKyCtLhBAEIwtXZ6iY79ixj8d5gVIikP8 MxLE71uB5p+nS5Lsd3Vp4js9Xz9TqpnhAbQoRFT8qQcLzfrSkIzhsKUJxi4q0Iv1UBp9 Z2Q+5LDLNd1AtnDtSkKL1GX5TvqZ+8fN6Q2LvZ99vMw9QgvKP1DQs0J3amsTIoa9M7jb R5RLVStglGUMIF5sdKbHPozFq3iGIntKckSGxLDjWRHNOVyoriLlBEzonA81bL8EH4HF YRTGFxff/Xe+NPGACIwDbTt7hq1sluu4HZaajMvHLhHHJr9rTCzc9Ff0AGV8YTHBFsWx Bqmw== 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=dCI1CGZWhDeJKl2L4WBv6yJ/D22lvjX3tTbPKEqTpkQ=; b=kroKK0HCuyq93q1rLC+Q4hlaGh9OKPac0DzgH2g+paJpH4hNWOhDN952PCnUZiIJvc zO0JrVCNozAjWI17zkDrDy08pc1+oGpkEO1R+Ja2ZI/FJYYsfsuTFvGz9GB83Lf9Qy2W hR0tN1mdI/uZ0WnizK4wfPdnTZwRXspez6ViimjCD8a28PTbz+Ng7u21iuhdS2cPGPu2 dfJIzi8skbEGMKPUGCQxVxv4tF9QcBlkXPSXuAvw5ODu23rI9aQb5zMxpZ3DcPwZ4Bvz FLS+LlxX7oYN7+Wuy+hGZHUHOhtNEMRCXKI0z5BsPaSwvX/Yk9L7vAXV6ZU3yI3JJE1f Rtrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YsdcsZUM; 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 j11sor893983plj.44.2020.05.26.10.47.35 for (Google Transport Security); Tue, 26 May 2020 10:47:35 -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:a17:902:a989:: with SMTP id bh9mr2179365plb.44.1590515255125; Tue, 26 May 2020 10:47:35 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:34bf:6d2b:f49c:646b]) by smtp.gmail.com with ESMTPSA id o201sm175153pfd.115.2020.05.26.10.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 10:47:34 -0700 (PDT) From: Jagan Teki To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 13/14] spi: omap3: Drop nondm code Date: Tue, 26 May 2020 23:17:16 +0530 Message-Id: <20200526174717.262151-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526174717.262151-1-jagan@amarulasolutions.com> References: <20200526174717.262151-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=YsdcsZUM; 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: , Now all boards are using this omap3 spi driver in dm model, so drop the nondm code. Signed-off-by: Jagan Teki --- drivers/spi/Kconfig | 14 ++--- drivers/spi/omap3_spi.c | 136 ---------------------------------------- 2 files changed, 7 insertions(+), 143 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 09b9cb17d8..8fccfbf20d 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -226,6 +226,13 @@ config NXP_FSPI Enable the NXP FlexSPI (FSPI) driver. This driver can be used to access the SPI NOR flash on platforms embedding this NXP IP core. +config OMAP3_SPI + bool "McSPI driver for OMAP" + help + SPI master controller for OMAP24XX and later Multichannel SPI + (McSPI). This driver be used to access SPI chips on platforms + embedding this OMAP3 McSPI IP core. + config PIC32_SPI bool "Microchip PIC32 SPI driver" depends on MACH_PIC32 @@ -429,11 +436,4 @@ 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 OMAP3_SPI - bool "McSPI driver for OMAP" - help - SPI master controller for OMAP24XX and later Multichannel SPI - (McSPI). This driver be used to access SPI chips on platforms - embedding this OMAP3 McSPI IP core. - endif # menu "SPI Support" diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index 6a615d1498..39e6813469 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -25,16 +25,6 @@ DECLARE_GLOBAL_DATA_PTR; -#if defined(CONFIG_AM33XX) || defined(CONFIG_AM43XX) -#define OMAP3_MCSPI1_BASE 0x48030100 -#define OMAP3_MCSPI2_BASE 0x481A0100 -#else -#define OMAP3_MCSPI1_BASE 0x48098000 -#define OMAP3_MCSPI2_BASE 0x4809A000 -#define OMAP3_MCSPI3_BASE 0x480B8000 -#define OMAP3_MCSPI4_BASE 0x480BA000 -#endif - #define OMAP4_MCSPI_REG_OFFSET 0x100 struct omap2_mcspi_platform_config { @@ -109,9 +99,6 @@ struct mcspi { }; struct omap3_spi_priv { -#ifndef CONFIG_DM_SPI - struct spi_slave slave; -#endif struct mcspi *regs; unsigned int cs; unsigned int freq; @@ -455,128 +442,6 @@ static void _omap3_spi_claim_bus(struct omap3_spi_priv *priv) writel(conf, &priv->regs->modulctrl); } -#ifndef CONFIG_DM_SPI - -static inline struct omap3_spi_priv *to_omap3_spi(struct spi_slave *slave) -{ - return container_of(slave, struct omap3_spi_priv, slave); -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct omap3_spi_priv *priv = to_omap3_spi(slave); - - free(priv); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - struct omap3_spi_priv *priv = to_omap3_spi(slave); - - spi_reset(priv->regs); - - _omap3_spi_claim_bus(priv); - _omap3_spi_set_wordlen(priv); - _omap3_spi_set_mode(priv); - _omap3_spi_set_speed(priv); - - return 0; -} - -void spi_release_bus(struct spi_slave *slave) -{ - struct omap3_spi_priv *priv = to_omap3_spi(slave); - - writel(OMAP3_MCSPI_MODULCTRL_MS, &priv->regs->modulctrl); -} - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct omap3_spi_priv *priv; - struct mcspi *regs; - - /* - * OMAP3 McSPI (MultiChannel SPI) has 4 busses (modules) - * with different number of chip selects (CS, channels): - * McSPI1 has 4 CS (bus 0, cs 0 - 3) - * McSPI2 has 2 CS (bus 1, cs 0 - 1) - * McSPI3 has 2 CS (bus 2, cs 0 - 1) - * McSPI4 has 1 CS (bus 3, cs 0) - */ - - switch (bus) { - case 0: - regs = (struct mcspi *)OMAP3_MCSPI1_BASE; - break; -#ifdef OMAP3_MCSPI2_BASE - case 1: - regs = (struct mcspi *)OMAP3_MCSPI2_BASE; - break; -#endif -#ifdef OMAP3_MCSPI3_BASE - case 2: - regs = (struct mcspi *)OMAP3_MCSPI3_BASE; - break; -#endif -#ifdef OMAP3_MCSPI4_BASE - case 3: - regs = (struct mcspi *)OMAP3_MCSPI4_BASE; - break; -#endif - default: - printf("SPI error: unsupported bus %i. Supported busses 0 - 3\n", bus); - return NULL; - } - - if (((bus == 0) && (cs > 3)) || - ((bus == 1) && (cs > 1)) || - ((bus == 2) && (cs > 1)) || - ((bus == 3) && (cs > 0))) { - printf("SPI error: unsupported chip select %i on bus %i\n", cs, bus); - return NULL; - } - - if (max_hz > OMAP3_MCSPI_MAX_FREQ) { - printf("SPI error: unsupported frequency %i Hz. Max frequency is 48 MHz\n", - max_hz); - return NULL; - } - - if (mode > SPI_MODE_3) { - printf("SPI error: unsupported SPI mode %i\n", mode); - return NULL; - } - - priv = spi_alloc_slave(struct omap3_spi_priv, bus, cs); - if (!priv) { - printf("SPI error: malloc of SPI structure failed\n"); - return NULL; - } - - priv->regs = regs; - priv->cs = cs; - priv->freq = max_hz; - priv->mode = mode; - priv->wordlen = priv->slave.wordlen; -#if 0 - /* Please migrate to DM_SPI support for this feature. */ - priv->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN; -#endif - - return &priv->slave; -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, - const void *dout, void *din, unsigned long flags) -{ - struct omap3_spi_priv *priv = to_omap3_spi(slave); - - return _spi_xfer(priv, bitlen, dout, din, flags); -} - -#else - static int omap3_spi_claim_bus(struct udevice *dev) { struct udevice *bus = dev->parent; @@ -701,4 +566,3 @@ U_BOOT_DRIVER(omap3_spi) = { .ops = &omap3_spi_ops, .priv_auto_alloc_size = sizeof(struct omap3_spi_priv), }; -#endif