From patchwork Tue May 26 08:04:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1249 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0FD533F08B for ; Tue, 26 May 2020 10:04:57 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id ck14sf1918280pjb.2 for ; Tue, 26 May 2020 01:04:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1590480296; cv=pass; d=google.com; s=arc-20160816; b=TKw+fiDH9ItvIbHeAdqp21akJMoQtXdXb0/9MZqHpyddLfKcyRmt/JCcutFQanAcBo S9ip7vcvozrB+uarWbnsnY7PW9Z05Ha8f7KbW8azrsSIMWHS27wwk7OXuHxvMjOHRJzz pG+TCRcy4q4c0RB3UfLGVPRFhuHjZdWuw7Y3Bm3H7+gMA74oXkzBho50dyMWsjeqgo5o FNE4hX3jSykARk4S6XdRajwaXDXtVMfMNHtLVzRgo5/i8/Bf5fF3A9bwuGSBf6/Zj+R7 JKhEfWXEnXk5+4qFXCpDx5Cct3/YhZZ+fMftHDJy4R1cn+ct3ajV5pAfbz6+ZthK7V2/ 7mSw== 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=jkv4SDT6uFNaa5B2Fe2C6JlpXG9WeWX5vaJ0gVKhCCo=; b=B0ai5XiLbgDX3BoESLHPO+swc+N1G2g2hvk1d5iWDd29AsbUIf3lCrJ1fvDT4kPIxg bHAaf9E04acGxUWE6tUv+6w8622Ih8wVKqDkRd38a2pE/nte6pcifha7SbTqlbBt62+m O/mcdo5WG3ApKLA7v64/D727+JANP6h4nJtZTUmS8d8/z2TsVwWS6ZFLuVbOlZC61i6n 0laIi5Yo64Zs6uf/gb1RRYg41XG5SfMuPxJk4gWYYTEJZ8Tg6Ai48iR3Y4fnx+DYPHnB a1brXn+iC+OYVwN3MsgzbJwJ5h3AJ75eyWosZkdSXzJvzgvsZ5Vuv9lqEozODZye7pWs bfJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qJoWLmmc; 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=jkv4SDT6uFNaa5B2Fe2C6JlpXG9WeWX5vaJ0gVKhCCo=; b=cPYWOelOsrnlM1zTWW/eJMGaiLN3/KlIeF9AB9lKUcDLZGoP0oAr7JTDSRoRhm+hzp 5tizyqoCBZZaXRHUJxWap/YFeCXQ8b71NRx7IEpCkHwNUma266sXz6WbhDaMrsv+8ya3 UsD+3iTtBAibTe3QqZW+FzadMfvlVSmLRD5+w= 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=jkv4SDT6uFNaa5B2Fe2C6JlpXG9WeWX5vaJ0gVKhCCo=; b=pYekKTZeHYZFdkjR4VfnNqcNN9RpD3MY57tWQva7q+JXW5WuSPpLR/V60v4n14nA+I 2ZxfcvNfuqYgksmxSNgtrA3lsuEKJBdRclkxfDE7n/BpWyvplxEK5IEyeMCjZliCGGgi Q4BKeDLbgkt1Y4MCXbmW70a6iSbq3FjUf8EEzbzP+gzHwLgGtj3OD4Q1rmQ4oPIXTqzf o4wYEg0BSuRaZUkulJrAkuA4ffpTxYbE8vN1e8jixAudsF9NL1snM9GWOCh4MWxALCoZ l4otHmdeZ4rIztYbXvSe46DcmRqnJJwRo2Ks5iIFPHN3qVPSz72R3NaowrNKLorUFzRt 5+jQ== X-Gm-Message-State: AOAM5310PHnCwY7FmJBz1/bVbxFq1uyySpYsDmnQVo8yus0uNtGCgA3g spviSHBikXafC9NU1zV7T6Ex+u7c X-Google-Smtp-Source: ABdhPJwr7Jaf7v/X+fxQNhvTQmV1M6R8Oq2E2YTzH/gwnaaYneb0Sph9ctwYl2GoHsw50M4xDP9DFg== X-Received: by 2002:a17:90b:897:: with SMTP id bj23mr25574391pjb.82.1590480295849; Tue, 26 May 2020 01:04:55 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8d95:: with SMTP id v21ls4686652plo.3.gmail; Tue, 26 May 2020 01:04:55 -0700 (PDT) X-Received: by 2002:a17:90a:1aa2:: with SMTP id p31mr24555518pjp.233.1590480295368; Tue, 26 May 2020 01:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590480295; cv=none; d=google.com; s=arc-20160816; b=io048XRsseU+A7+SpqwW9iHt3pcrHBPLEYt8lhGD8B8mUW16pWp030AYH697MRkP1Q 6A8iqGMIg7XdgtEL25Yoz3/rWioUF7LPfFqIPn+hItkXtZVb4vcXlVOWROyXqZe5n/ZM IH53DwS/AuwtxYo170IYn1KRcTCdI73TOcuHDadlfDo0U0NDxbjF6xXM4YrrPxpWlyEk jL6GrkksZkfuItCb215nIVFQJrGLEFtsTKS5RRUYJsAPYNjM0O1OYR4fL6eTfaCOg1yK PwofVSXxkXifT8vw+8Fr4i9swAJnOwkoCOuDnkBJONTIHK0rzMAM+VqeOKRp72ahhtJV 74XA== 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=WJBmko4ItfbONdPXmT1FM0pCzO9kSC42NBpdtIgp/1c=; b=TMACUCfqC/bbEJUUX2VLbO4ILPS5EEsGneXa9omsElEgoRRcsuihPDXzeEJIyvxPa1 y/1pHL2CpF/ol7bV7QHJpW/iNW6sWl0YSN4rFWHmGXwqLTKst0qLUdBgSViDg5g5EcDh P/YPNgF60UEVt6LdPhDmPyfzdcAUA/6tf52eDh0K54F9rNNaEZJmO2JGjZ/THxC1A6GH 70e2/RC8pUe9C45hFwVdYL+hc6ioTIvCGaaW7ZWW7L/QjqzNRs3CEMGvZju3a0baHfQs C1puf86Vdv8MVBzl2Uigg8vyjBH9Y3OYLJJTo2hcjHEZO1pBNN6T9RWktgtk3PfXSI2Q 7iwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qJoWLmmc; 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 88sor861904pla.37.2020.05.26.01.04.55 for (Google Transport Security); Tue, 26 May 2020 01:04:55 -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:7618:: with SMTP id k24mr12904551pll.167.1590480295000; Tue, 26 May 2020 01:04:55 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 01:04:54 -0700 (PDT) From: Jagan Teki To: Simon Glass , Tom Rini Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki , Adam Ford Subject: [PATCH 5/9] spi: davinci: Drop non-dm code Date: Tue, 26 May 2020 13:34:26 +0530 Message-Id: <20200526080430.118262-6-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=qJoWLmmc; 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 which are using davinci SPI driver have moved to SPL_DM so drop the unneeded non-dm code. Cc: Adam Ford Signed-off-by: Jagan Teki Tested-by: Adam Ford #da850-evm --- drivers/spi/Kconfig | 12 +- drivers/spi/davinci_spi.c | 157 --------------------------- include/configs/ti_armv7_keystone2.h | 9 -- 3 files changed, 6 insertions(+), 172 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 59415209ee..1a1f195232 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -119,6 +119,12 @@ config CF_SPI Enable the ColdFire SPI driver. This driver can be used on some m68k SoCs. +config DAVINCI_SPI + bool "Davinci & Keystone SPI driver" + depends on ARCH_DAVINCI || ARCH_KEYSTONE + help + Enable the Davinci SPI driver + config DESIGNWARE_SPI bool "Designware SPI driver" help @@ -400,12 +406,6 @@ config FSL_ESPI access the SPI interface and SPI NOR flash on platforms embedding this Freescale eSPI IP core. -config DAVINCI_SPI - bool "Davinci & Keystone SPI driver" - depends on ARCH_DAVINCI || ARCH_KEYSTONE - help - Enable the Davinci SPI driver - config SH_QSPI bool "Renesas Quad SPI driver" help diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c index 97ac97b1a5..e1e9b45cc9 100644 --- a/drivers/spi/davinci_spi.c +++ b/drivers/spi/davinci_spi.c @@ -55,41 +55,6 @@ /* SPIDEF */ #define SPIDEF_CSDEF0_MASK BIT(0) -#ifndef CONFIG_DM_SPI -#define SPI0_BUS 0 -#define SPI0_BASE CONFIG_SYS_SPI_BASE -/* - * Define default SPI0_NUM_CS as 1 for existing platforms that uses this - * driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS - * if more than one CS is supported and by defining CONFIG_SYS_SPI0. - */ -#ifndef CONFIG_SYS_SPI0 -#define SPI0_NUM_CS 1 -#else -#define SPI0_NUM_CS CONFIG_SYS_SPI0_NUM_CS -#endif - -/* - * define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and - * CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus - */ -#ifdef CONFIG_SYS_SPI1 -#define SPI1_BUS 1 -#define SPI1_NUM_CS CONFIG_SYS_SPI1_NUM_CS -#define SPI1_BASE CONFIG_SYS_SPI1_BASE -#endif - -/* - * define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and - * CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus - */ -#ifdef CONFIG_SYS_SPI2 -#define SPI2_BUS 2 -#define SPI2_NUM_CS CONFIG_SYS_SPI2_NUM_CS -#define SPI2_BASE CONFIG_SYS_SPI2_BASE -#endif -#endif - DECLARE_GLOBAL_DATA_PTR; /* davinci spi register set */ @@ -122,9 +87,6 @@ struct davinci_spi_regs { /* davinci spi slave */ struct davinci_spi_slave { -#ifndef CONFIG_DM_SPI - struct spi_slave slave; -#endif struct davinci_spi_regs *regs; unsigned int freq; /* current SPI bus frequency */ unsigned int mode; /* current SPI mode used */ @@ -346,124 +308,6 @@ out: return 0; } -#ifndef CONFIG_DM_SPI - -static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave) -{ - return container_of(slave, struct davinci_spi_slave, slave); -} - -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - int ret = 0; - - switch (bus) { - case SPI0_BUS: - if (cs < SPI0_NUM_CS) - ret = 1; - break; -#ifdef CONFIG_SYS_SPI1 - case SPI1_BUS: - if (cs < SPI1_NUM_CS) - ret = 1; - break; -#endif -#ifdef CONFIG_SYS_SPI2 - case SPI2_BUS: - if (cs < SPI2_NUM_CS) - ret = 1; - break; -#endif - default: - /* Invalid bus number. Do nothing */ - break; - } - return ret; -} - -void spi_cs_activate(struct spi_slave *slave) -{ - /* do nothing */ -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - /* do nothing */ -} - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct davinci_spi_slave *ds; - - if (!spi_cs_is_valid(bus, cs)) - return NULL; - - ds = spi_alloc_slave(struct davinci_spi_slave, bus, cs); - if (!ds) - return NULL; - - switch (bus) { - case SPI0_BUS: - ds->regs = (struct davinci_spi_regs *)SPI0_BASE; - break; -#ifdef CONFIG_SYS_SPI1 - case SPI1_BUS: - ds->regs = (struct davinci_spi_regs *)SPI1_BASE; - break; -#endif -#ifdef CONFIG_SYS_SPI2 - case SPI2_BUS: - ds->regs = (struct davinci_spi_regs *)SPI2_BASE; - break; -#endif - default: /* Invalid bus number */ - return NULL; - } - - ds->freq = max_hz; - ds->mode = mode; - - return &ds->slave; -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct davinci_spi_slave *ds = to_davinci_spi(slave); - - free(ds); -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, - const void *dout, void *din, unsigned long flags) -{ - struct davinci_spi_slave *ds = to_davinci_spi(slave); - - ds->cur_cs = slave->cs; - - return __davinci_spi_xfer(ds, bitlen, dout, din, flags); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - struct davinci_spi_slave *ds = to_davinci_spi(slave); - -#ifdef CONFIG_SPI_HALF_DUPLEX - ds->half_duplex = true; -#else - ds->half_duplex = false; -#endif - return __davinci_spi_claim_bus(ds, ds->slave.cs); -} - -void spi_release_bus(struct spi_slave *slave) -{ - struct davinci_spi_slave *ds = to_davinci_spi(slave); - - __davinci_spi_release_bus(ds); -} - -#else static int davinci_spi_set_speed(struct udevice *bus, uint max_hz) { struct davinci_spi_slave *ds = dev_get_priv(bus); @@ -582,4 +426,3 @@ U_BOOT_DRIVER(davinci_spi) = { .ops = &davinci_spi_ops, .priv_auto_alloc_size = sizeof(struct davinci_spi_slave), }; -#endif diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h index 37210b2605..b632ae010d 100644 --- a/include/configs/ti_armv7_keystone2.h +++ b/include/configs/ti_armv7_keystone2.h @@ -64,15 +64,6 @@ /* SPI Configuration */ #define CONFIG_SYS_SPI_CLK ks_clk_get_rate(KS2_CLK1_6) -#define CONFIG_SYS_SPI0 -#define CONFIG_SYS_SPI_BASE KS2_SPI0_BASE -#define CONFIG_SYS_SPI0_NUM_CS 4 -#define CONFIG_SYS_SPI1 -#define CONFIG_SYS_SPI1_BASE KS2_SPI1_BASE -#define CONFIG_SYS_SPI1_NUM_CS 4 -#define CONFIG_SYS_SPI2 -#define CONFIG_SYS_SPI2_BASE KS2_SPI2_BASE -#define CONFIG_SYS_SPI2_NUM_CS 4 /* Network Configuration */ #define CONFIG_BOOTP_DEFAULT