From patchwork Wed May 27 12:56:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1291 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 169103F066 for ; Wed, 27 May 2020 14:57:59 +0200 (CEST) Received: by mail-pg1-f199.google.com with SMTP id k124sf8016198pgc.0 for ; Wed, 27 May 2020 05:57:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590584278; cv=pass; d=google.com; s=arc-20160816; b=sDX2dzHXe7WRkE8YOV5rQBLLfSOrPQr7cSoo9LgAr7jvmaP5MK3M0880zsfgrAnPjE 2ni7tBKEzF5DL2F7e10pm3RQYZ5zh97P0dpWNoquzdCMssj6ahFn5fImVfEvor8obXIO fyRDNvoHkfUFkvvMXwXMtccFnBGmi1CAGG9O+OOmg1eonLNp6O50wghpIewZuE1QjxCG rVkOneoIsM49s42S1793jMIj9IMT2l9wLG19AYMKvF4scdlUhRwDp/YApINqgbUqJRhJ CusCV7JaPvnyk+naRYCP77MgVRKeCvxzbrXw4u0wgqJnZrse4penp+Z0/hGEOo67boDo uMjw== 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=eg//QU9M/EeDqKGdNGsj1eQ0CEgpEqtIr986Nn1dEFI=; b=pZYr6xcMO95UKGgDYQ1LxqjAZFwMOIkJVFxNF0koBl30QNnVU6ws2h54Ihcg5TKROi e5Q3ShfjizFE3brOhlCfU2P1iQW4RDIU+2gBVdDm65Af8CPby4nnCrsqGc6tdav1WvrS YSoBxQF/q1TJxWzjFUfVTWvPQxkGbSg/uvXFaunRjIzppXILY7g1zd4eI+MbOCUDFtmW nYx0/Oc5SO9U5Emoxk8OwDVqNaOoD6Uy4kVm+D00een7B3Dj6i9VF+AMDxjxRwhy9dgw TIJKBB4ipyaHP9FbPyadkDPLXl/n4Bfaoszkcr/pE/6INDAmY47kl9xcZ0iw65QX0YMc 984A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Sq/A7Wep"; 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=eg//QU9M/EeDqKGdNGsj1eQ0CEgpEqtIr986Nn1dEFI=; b=hKcPyHq4z5DC3moa1NJ6WZNPPyAtsfzJjM6HMJTmOc9AiAra0VN81zv7uE+0DOq57r ZlkVSqcx4nPUpcxI9aKYPI/7tr4aHa+dZTOuNz8+vJYVTcwc36hCHiGMneQ1LOEa8ZNN J88J+JjDNRwDzG67Se1J2eqDFEb7rN6ULvBiY= 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=eg//QU9M/EeDqKGdNGsj1eQ0CEgpEqtIr986Nn1dEFI=; b=FvL2m6AHEDzqWAwPZ0KQw+TMtRmtjdwzMbbIy3MKBXU/kZXjJahWiIYbCKY+oHKV0I moKUS+Ej2Iqn10259cZNYhSQ8CXd1WfyF17eu27kEWw7SuWLzSmH5jwFJ3yNqDQBQ1JB QllVWRyD2NLvPmftyVGLg0bV5uY/uQSUy/pVHkRGMPN/VLP6ogqRS7/2d/3BF8TCq+o/ yN2Z8MyGIeC7rnj3DmlXRIpWbzNXXoTlUCTLMpMF2rOoxQnxp+J77fsipefD+kkeHHO4 enVuYDJfWkd13Yhn2DEqDQEZkm8fREk9DFxYiRnJefD5a/fwmbd/ORvz0ogYaPSBXhs4 baqg== X-Gm-Message-State: AOAM5307RKE1SZQsVvQa4QxhdscK5bACxCPftL84+clFLr2Pzok3abgU DtgFYaBDWIlCsXhtV3q2Jmqjy6Fs X-Google-Smtp-Source: ABdhPJyQH7oU9RaBZ5nupe29oa+pvgitneHXSawaVcYAp3+skjCjacz5VCT5YowXe6qyDF4RR7P22A== X-Received: by 2002:a17:90a:f98c:: with SMTP id cq12mr4877936pjb.39.1590584277886; Wed, 27 May 2020 05:57:57 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:1cca:: with SMTP id c193ls4979403pfc.9.gmail; Wed, 27 May 2020 05:57:57 -0700 (PDT) X-Received: by 2002:a63:794a:: with SMTP id u71mr3704480pgc.89.1590584277374; Wed, 27 May 2020 05:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590584277; cv=none; d=google.com; s=arc-20160816; b=0hGBRfYazon4++szOGerYaL5gHfx65rQJyDIBT/CF1FSEF2k4v4gB/DHurB1CPam5E 3d+l7/tF53C4Sdvz7moFnnIwUSra1CO10kH9Weoz02aK6m+AgjYSF8rqHQCAJU87rOkN 8K67fIpYTKVPG27/v7VkTKXSPglEI3XAGBxx+1grvt6Mh/yz+PwnmeobIf8RnmufiHPb XwbLFfZslVucaNRmDrE+BhgI2EeWQDMkidirm3Tq6uISmtqzzj4JTkueAh/LA+qcT7J1 3BRyrLlsMPtHbHQoxSbJq+IB9hmYJkCl63DA1EyOX2TJjw47BjzO4QCoi6Dsg4rsm9Hn Uuvg== 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=zQDElQYm5YfddGxuY39IaqtkJbKELWf3iCjHqpjp818=; b=V3D1lcFmU4D+9i8du6To87yaAN2L3XGA6zn9sqBUBEezqUvgjYhsqMNB8Mq3QPTjEc GMeYAs0nn/lzmJN+QUcYCzjK2I9YAiQGnbozipPYCY+5yD9Ct28Le7ezHKZTPDPKj90Q JgSvmVcEzb3+7F0GssWJ+DpaDKgiHD/tk41zP9zsW9cLY0jraF831BB9kM/gOstVAF3v PJi3C7JRFgiV3peW5McvvRChtcHzl+NDeEII3yx3SpmLfT+P5XIvZ/tdPxZKIUC26qRW WKaclkIIc6FX1P2eGBKpdKXqrTIQgplOgaUtEMP1qeCrq/HGCWFeK/C6dhK4mPSV0g6L 7jgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Sq/A7Wep"; 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 gm22sor3513875pjb.10.2020.05.27.05.57.57 for (Google Transport Security); Wed, 27 May 2020 05:57:57 -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:90a:6881:: with SMTP id a1mr4971112pjd.153.1590584277043; Wed, 27 May 2020 05:57:57 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:ac3b:7dcd:80:b788]) by smtp.gmail.com with ESMTPSA id k4sm2078274pgg.88.2020.05.27.05.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 05:57:56 -0700 (PDT) From: Jagan Teki To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 22/23] spi: omap3: Drop nondm code Date: Wed, 27 May 2020 18:26:36 +0530 Message-Id: <20200527125637.149189-23-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200527125637.149189-1-jagan@amarulasolutions.com> References: <20200527125637.149189-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="Sq/A7Wep"; 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 --- Changes for v2: - none 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