From patchwork Thu Jun 18 17:45:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1418 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9016D3F0D3 for ; Thu, 18 Jun 2020 19:45:37 +0200 (CEST) Received: by mail-il1-f198.google.com with SMTP id c11sf4545378ilq.0 for ; Thu, 18 Jun 2020 10:45:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1592502336; cv=pass; d=google.com; s=arc-20160816; b=reIbgeDvo1xIoH1TLYGqnxM9qEg7rvG99lEE4QbMiCaaYQx7i3auCD0j0k6QYGzdwI LAVo5vC19JagoEn6Fou2xxSplye4OuVolC8L1Ogl7VWDzCdg8j++YO9AHTyJb4iZ+IqZ bSibiVu2kbbCa9T/nhUwCI0Wk6smwCFAPSiZZSTxHVOYfQH/uD5cORUKjuTbQv2+9FAj NPGdbFNKMwsT/G5IHnoVYzgaOGWCnpOOSTHk5ALnKs1D+BLQXyVCBsBbwXSDmq2aWM8H PMgwz9MCV3OwqyEA7Pdgthd67Crg/zMWqdb2NnlH7I74YHEk5V0PXz49giZTxC5Cq7zT q0qg== 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=y4gRDM4tKyB/71tKncczPMEo+J23SZijkbyAbFo+IUM=; b=zNnjTeWPYuqDZMgw7mQEhmhdshhFh71BOijJEQKtgoHm1VG7MYEcyIOxWe0Uou0qTk ig32ikt+Tnau1zcXFNe8ebk3Hs+ae5aFRZ7QeY31SwDA6JbRdFdd3sj28tNOTgGc4Ig0 F1iThNY5NxwtboLshpH8imIgWkyX7I0YAgWrYdisPzPG+tbMU3/pfIMImipn9o+Ktj3w npPzucke8+HMFj6Xv+Xid4+JYIvDGO2/mDpkHi93xwzpef0a5v7SEsJkww+HN8nPCEN2 yfLwJtdeNDMqvL5B/OlIFxz9hle7rpDI6O9c4iXWI9FmHe5zbFHmIXKbGEv3zFPYYy2Q l5gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h2mibMgo; 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=y4gRDM4tKyB/71tKncczPMEo+J23SZijkbyAbFo+IUM=; b=eVJ5R8+s3npeTSyZy/Sgad0OhYNXuC+tkfQKsDHEikt/peDcVfNowZD8i9Ck4H7/6K BymnE6xy9eIfEKdu0HDvivWo5grdHLZDilXATAn33ertqLcWJ5/DkZIK10YKZXNHYHao hUBXBacyRawYANZIW38hIc+LV2BUlAv633Weo= 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=y4gRDM4tKyB/71tKncczPMEo+J23SZijkbyAbFo+IUM=; b=kvhUQBLUK+A0UDJ8NQ/PYy0EB0Z3rvj52Ua96U/fFCx/D9j6wfTwwf97W9lZbHegC2 9TxVy6rdW9S+A/LM8lg//gBvRctnQd1DcCfjrmDES1VYOrbwZQ+MWa0OlPDkCX4ARUUF CzcRjNqiqFHm4cefCGO81DrvArM4b8636XiRwU5KS3xikPywhyq4OP1E5fA3dL33cRL1 howmXggrESsttDU5OAEzU2Ae09PI5cBImC1iy79u8dsTHiRa4HJ6V7PXK/kvi82xvd8t 24qhq38VlDm4S2tdbJ7eYdMyRImBwcHc63Xf7PPCkdmXplOvV6eVKWMU0WneidEZYiQg vpCQ== X-Gm-Message-State: AOAM531+WzApPl2boGFQw6rXYW9+db009w9xtHeAh5o6rqTKzDePZqjl gBRNA9mJ+zyRaw0VvyxQGTxQvkmq X-Google-Smtp-Source: ABdhPJwcpCbTYwDb5rzYB6/eh+UX+58rhgUzYB4bX1DOK4s8pqkhTE2HYpJTapjLJ+qKELADqRMvXw== X-Received: by 2002:a05:6e02:8e8:: with SMTP id n8mr5057863ilt.282.1592502336154; Thu, 18 Jun 2020 10:45:36 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a92:4d2:: with SMTP id 201ls1813795ile.8.gmail; Thu, 18 Jun 2020 10:45:35 -0700 (PDT) X-Received: by 2002:a92:d302:: with SMTP id x2mr5436980ila.175.1592502335715; Thu, 18 Jun 2020 10:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592502335; cv=none; d=google.com; s=arc-20160816; b=PBAhKMiLbN6ytSM7r3TW+RWAZCxnlJAOWW01jwkjXtAGkjA08PbUlpZJvOiLCcGulZ 9KHmWEEYX16NznVb2NLuzre7ubQL5NzlFuPbXgEMOPL7ERHgI3XQvOv/FCu5OjRLZMki IydbbN1HKDcYWlonYf2awGy/nvp2kAfHA8TuFXGs2kDlt3rYiOuh9rzFRIPOTZLUwf5j 9VWU741sHlF7ic2/eiuthOGmth6T/zbGWhIhMgLGW5GJGO0kRihj0CLRMqyYBHfrkONj jd7zb7DQOGrJY4DpwvEUPfKJzg9vXfkA9rBld5b+rZmiRdHfPypL71GCKcB0sOMlQl6M 666A== 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=PndGxZuH+eesaBghmo8XfutImWTcxLqutnOcwx8uzyY=; b=l3Fy3Ap7Vs9tg1zv1p3YROtse0LK2SdyjJqLNEkgX/yKN/Qc9TU0cm8xzCkTqtBAmZ uu12oqSoWR1e3xtTjv0pXTMzWZeTJttisdHGRzgnh2DmcBm/VVqb8AkTxxa2YxnlvGu3 r1HaK5s/6SNA5XWjh+oSLsY9R243CCtQSz7Es96oomqIB/e40CXsT9OBqHlZ7iUTIdlf 05wstnLuh6ch64NxpImrF8fA0b/oljlF1ZXWVZ85h4Q7n4SdSJdGDsQVzH8X2+MrOgfG Gep6lKNrzGdbyPO+hYaCg0MYYR1m6GdDCN4s3wfjWBEUCFPW7TvAF+sJezM7S6HF+Czm 8xdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h2mibMgo; 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 s70sor3010523ili.11.2020.06.18.10.45.35 for (Google Transport Security); Thu, 18 Jun 2020 10:45: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:90a:6ace:: with SMTP id b14mr5428603pjm.13.1592502334915; Thu, 18 Jun 2020 10:45:34 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:b0c7:f192:869b:df87]) by smtp.gmail.com with ESMTPSA id k14sm3355296pfk.97.2020.06.18.10.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 10:45:33 -0700 (PDT) From: Jagan Teki To: Stefan Roese , Tom Rini , Simon Glass , Bhargav Shah Cc: u-boot@lists.denx.de, linux-amarula , Jagan Teki Subject: [PATCH v3 1/4] spi: kirkwood: Drop nondm code Date: Thu, 18 Jun 2020 23:15:13 +0530 Message-Id: <20200618174516.239626-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618174516.239626-1-jagan@amarulasolutions.com> References: <20200618174516.239626-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=h2mibMgo; 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: , From: Bhargav Shah Drop the nondm code from kirkwood_spi.c since there is no board or any other code using for it. Signed-off-by: Bhargav Shah Signed-off-by: Jagan Teki --- Changes for v3: - updated commit message - updated config_whitelist.txt drivers/spi/Kconfig | 12 ++-- drivers/spi/kirkwood_spi.c | 136 ++++------------------------------- scripts/config_whitelist.txt | 1 - 3 files changed, 19 insertions(+), 130 deletions(-) diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 09b9cb17d8..0945177efb 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -162,6 +162,12 @@ config ICH_SPI access the SPI NOR flash on platforms embedding this Intel ICH IP core. +config KIRKWOOD_SPI + bool "Marvell Kirkwood SPI Driver" + help + Enable support for SPI on various Marvell SoCs, such as + Kirkwood and Armada 375. + config MESON_SPIFC bool "Amlogic Meson SPI Flash Controller driver" depends on ARCH_MESON @@ -417,12 +423,6 @@ config SH_QSPI Enable the Renesas Quad SPI controller driver. This driver can be used on Renesas SoCs. -config KIRKWOOD_SPI - bool "Marvell Kirkwood SPI Driver" - help - Enable support for SPI on various Marvell SoCs, such as - Kirkwood and Armada 375. - config MXC_SPI bool "MXC SPI Driver" help diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c index 3986b06b25..92dc2e13c5 100644 --- a/drivers/spi/kirkwood_spi.c +++ b/drivers/spi/kirkwood_spi.c @@ -19,6 +19,19 @@ #endif #include +struct mvebu_spi_dev { + bool is_errata_50mhz_ac; +}; + +struct mvebu_spi_platdata { + struct kwspi_registers *spireg; + bool is_errata_50mhz_ac; +}; + +struct mvebu_spi_priv { + struct kwspi_registers *spireg; +}; + static void _spi_cs_activate(struct kwspi_registers *reg) { setbits_le32(®->ctrl, KWSPI_CSN_ACT); @@ -94,128 +107,6 @@ static int _spi_xfer(struct kwspi_registers *reg, unsigned int bitlen, return 0; } -#ifndef CONFIG_DM_SPI - -static struct kwspi_registers *spireg = - (struct kwspi_registers *)MVEBU_SPI_BASE; - -#ifdef CONFIG_ARCH_KIRKWOOD -static u32 cs_spi_mpp_back[2]; -#endif - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct spi_slave *slave; - u32 data; -#ifdef CONFIG_ARCH_KIRKWOOD - static const u32 kwspi_mpp_config[2][2] = { - { MPP0_SPI_SCn, 0 }, /* if cs == 0 */ - { MPP7_SPI_SCn, 0 } /* if cs != 0 */ - }; -#endif - - if (!spi_cs_is_valid(bus, cs)) - return NULL; - - slave = spi_alloc_slave_base(bus, cs); - if (!slave) - return NULL; - - writel(KWSPI_SMEMRDY, &spireg->ctrl); - - /* calculate spi clock prescaller using max_hz */ - data = ((CONFIG_SYS_TCLK / 2) / max_hz) + 0x10; - data = data < KWSPI_CLKPRESCL_MIN ? KWSPI_CLKPRESCL_MIN : data; - data = data > KWSPI_CLKPRESCL_MASK ? KWSPI_CLKPRESCL_MASK : data; - - /* program spi clock prescaller using max_hz */ - writel(KWSPI_ADRLEN_3BYTE | data, &spireg->cfg); - debug("data = 0x%08x\n", data); - - writel(KWSPI_SMEMRDIRQ, &spireg->irq_cause); - writel(KWSPI_IRQMASK, &spireg->irq_mask); - -#ifdef CONFIG_ARCH_KIRKWOOD - /* program mpp registers to select SPI_CSn */ - kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back); -#endif - - return slave; -} - -void spi_free_slave(struct spi_slave *slave) -{ -#ifdef CONFIG_ARCH_KIRKWOOD - kirkwood_mpp_conf(cs_spi_mpp_back, NULL); -#endif - free(slave); -} - -__attribute__((weak)) int board_spi_claim_bus(struct spi_slave *slave) -{ - return 0; -} - -int spi_claim_bus(struct spi_slave *slave) -{ - return board_spi_claim_bus(slave); -} - -__attribute__((weak)) void board_spi_release_bus(struct spi_slave *slave) -{ -} - -void spi_release_bus(struct spi_slave *slave) -{ - board_spi_release_bus(slave); -} - -#ifndef CONFIG_SPI_CS_IS_VALID -/* - * you can define this function board specific - * define above CONFIG in board specific config file and - * provide the function in board specific src file - */ -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - return bus == 0 && (cs == 0 || cs == 1); -} -#endif - -void spi_cs_activate(struct spi_slave *slave) -{ - _spi_cs_activate(spireg); -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - _spi_cs_deactivate(spireg); -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, - const void *dout, void *din, unsigned long flags) -{ - return _spi_xfer(spireg, bitlen, dout, din, flags); -} - -#else - -/* Here now the DM part */ - -struct mvebu_spi_dev { - bool is_errata_50mhz_ac; -}; - -struct mvebu_spi_platdata { - struct kwspi_registers *spireg; - bool is_errata_50mhz_ac; -}; - -struct mvebu_spi_priv { - struct kwspi_registers *spireg; -}; - static int mvebu_spi_set_speed(struct udevice *bus, uint hz) { struct mvebu_spi_platdata *plat = dev_get_platdata(bus); @@ -409,4 +300,3 @@ U_BOOT_DRIVER(mvebu_spi) = { .priv_auto_alloc_size = sizeof(struct mvebu_spi_priv), .probe = mvebu_spi_probe, }; -#endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index f6bf6f2474..e6f5bd7e6d 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1619,7 +1619,6 @@ CONFIG_SPEAR_USBBOOT CONFIG_SPEAR_USBTTY CONFIG_SPI_ADDR CONFIG_SPI_BOOTING -CONFIG_SPI_CS_IS_VALID CONFIG_SPI_DATAFLASH_WRITE_VERIFY CONFIG_SPI_FLASH_QUAD CONFIG_SPI_FLASH_SIZE