From patchwork Tue Nov 20 12:48:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1000479 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="NaPMkRb/"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 42zmKQ64S8z9sBh for ; Wed, 21 Nov 2018 00:10:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id ED8F9C220C2; Tue, 20 Nov 2018 13:01:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C4656C2209D; Tue, 20 Nov 2018 12:52:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D7501C22091; Tue, 20 Nov 2018 12:50:05 +0000 (UTC) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by lists.denx.de (Postfix) with ESMTPS id ECC82C22088 for ; Tue, 20 Nov 2018 12:49:58 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id n2so875292pgm.3 for ; Tue, 20 Nov 2018 04:49:58 -0800 (PST) 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:content-transfer-encoding; bh=gpiRvpl3phAFjxoC2PPQtfVyqeBgNg7sWmiYFBU1h04=; b=NaPMkRb/2XcRwrUICLCWO/E3z8144JsWwwnmzXgMsaHdGioVg4xqKOobMKUWJQmNtq cqjoud+BFZGVgYdOzsMum5tSamVlVQnRZ2OJtRzUIQnJxwxKdeYwnTCmEPHBDKC7YqHW LMEVYOuxaJqKhq3295y+jNRaQT5AVDGIBJ4j4= 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:content-transfer-encoding; bh=gpiRvpl3phAFjxoC2PPQtfVyqeBgNg7sWmiYFBU1h04=; b=XPLHR9WtxTdkYwpc1jWL1UqQBVPN1iTdUfkegEKzp4wmK5pYw22yHnZKSWPHgJfUYL gIPwr8eKUl2iLTktcUk5l/J9EQvGAoJX/vPPN6TVq+e39lhgOumV8urquzhOKBRp6Dju GwK/H3dswSruy3pn2EQ63vQKldYJqDjdeAKGXwpS/wmxDXE/tlk3uG62nkSDj2TKlODL QVTqwH5U4qYiEAM49WodaUYdX5MYvklph5n0HW5FOhnzixiK82TqU263tNroSf9DvvwP lvF+86koi+q/AA/GWC4wc2Sa8AmI3qRwEzQDjr9Iokd/eLnSKmMUKg6c9zB68pzDYL4F Ps3w== X-Gm-Message-State: AGRZ1gJFfLcAn8BkhW5CtveRKJyh/a+BSXvS7P9aG8cDsKepXF1eB2ju QcoXpZtXifsSmMNvFtd1r81iVoDs8fs= X-Google-Smtp-Source: AJdET5ezgpSCiSXUFMqVdEzUT2MZHV3UE8ZhCDaCrDXp6f1jbnBr0V0eW04RVz3FInj0BhXGwvJrNg== X-Received: by 2002:a62:3101:: with SMTP id x1-v6mr2097822pfx.204.1542718197336; Tue, 20 Nov 2018 04:49:57 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id b5sm34880349pfc.150.2018.11.20.04.49.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Nov 2018 04:49:56 -0800 (PST) From: Jagan Teki To: u-boot@lists.denx.de Date: Tue, 20 Nov 2018 18:18:11 +0530 Message-Id: <20181120124814.23293-32-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181120124814.23293-1-jagan@amarulasolutions.com> References: <20181120124814.23293-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 31/34] spi: Zap omap3_spi driver-related code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Dropped - omap3_spi driver - SPI, SPI flash CONFIG-items - CMD_SPI, CMD_SF..etc Dropped becuase - no active updates - no dm conversion - no reponse for dm converted patch - driver-model migration expiry Signed-off-by: Jagan Teki --- Makefile | 2 +- drivers/spi/Makefile | 2 +- drivers/spi/omap3_spi.c | 126 ---------------------------------------- drivers/spi/spi.c | 1 + 4 files changed, 3 insertions(+), 128 deletions(-) diff --git a/Makefile b/Makefile index 3be3bb3118..00f0117b16 100644 --- a/Makefile +++ b/Makefile @@ -920,7 +920,7 @@ ifeq ($(CONFIG_DM_I2C_COMPAT)$(CONFIG_SANDBOX),y) endif ifeq ($(CONFIG_DM_SPI),) ifeq ($(filter $(CONFIG_DAVINCI_SPI) $(CONFIG_KIRKWOOD_SPI) $(CONFIG_MPC8XXX_SPI) \ - $(CONFIG_MXC_SPI) $(CONFIG_TI_QSPI),y),y) + $(CONFIG_MXC_SPI) $(CONFIG_OMAP3_SPI) $(CONFIG_TI_QSPI),y),y) @echo "===================== WARNING ======================" @echo "This board uses SPI driver from drivers/spi/ without" @echo "enabling CONFIG_DM_SPI. Please enable CONFIG_DM_SPI" diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 549d104016..7de209830e 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -10,6 +10,7 @@ obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o obj-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o obj-$(CONFIG_MXC_SPI) += mxc_spi.o +obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o obj-$(CONFIG_SANDBOX) += spi-emul-uclass.o obj-$(CONFIG_SOFT_SPI) += soft_spi.o obj-$(CONFIG_SPI_MEM) += spi-mem.o @@ -34,7 +35,6 @@ obj-$(CONFIG_ICH_SPI) += ich.o obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o -obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o obj-$(CONFIG_PIC32_SPI) += pic32_spi.o obj-$(CONFIG_PL022_SPI) += pl022_spi.o obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c index c7fcf050a5..5e267d88d7 100644 --- a/drivers/spi/omap3_spi.c +++ b/drivers/spi/omap3_spi.c @@ -108,9 +108,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; @@ -454,128 +451,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; @@ -700,4 +575,3 @@ U_BOOT_DRIVER(omap3_spi) = { .ops = &omap3_spi_ops, .priv_auto_alloc_size = sizeof(struct omap3_spi_priv), }; -#endif diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 5c13f85841..7f5863f904 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -44,6 +44,7 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus, defined(CONFIG_KIRKWOOD_SPI) || \ defined(CONFIG_MPC8XXX_SPI) || \ defined(CONFIG_MXC_SPI) || \ + defined(CONFIG_OMAP3_SPI) || \ defined(CONFIG_TI_QSPI) void spi_cs_activate(struct spi_slave *slave) {