From patchwork Tue Jan 5 14:02:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FD2AC4332B for ; Tue, 5 Jan 2021 14:05:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C23CD22AAA for ; Tue, 5 Jan 2021 14:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730051AbhAEOEZ (ORCPT ); Tue, 5 Jan 2021 09:04:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:56788 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727289AbhAEOEY (ORCPT ); Tue, 5 Jan 2021 09:04:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 34C54AD57; Tue, 5 Jan 2021 14:03:41 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 02/10] net: tc35815: Drop support for TX49XX boards Date: Tue, 5 Jan 2021 15:02:47 +0100 Message-Id: <20210105140305.141401-3-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove support in network drivers for it. Signed-off-by: Thomas Bogendoerfer --- drivers/net/ethernet/toshiba/tc35815.c | 29 -------------------------- 1 file changed, 29 deletions(-) diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c index 7a6e5ff8e5d4..d4712cd2e28c 100644 --- a/drivers/net/ethernet/toshiba/tc35815.c +++ b/drivers/net/ethernet/toshiba/tc35815.c @@ -687,39 +687,10 @@ static int tc_mii_init(struct net_device *dev) return err; } -#ifdef CONFIG_CPU_TX49XX -/* - * Find a platform_device providing a MAC address. The platform code - * should provide a "tc35815-mac" device with a MAC address in its - * platform_data. - */ -static int tc35815_mac_match(struct device *dev, const void *data) -{ - struct platform_device *plat_dev = to_platform_device(dev); - const struct pci_dev *pci_dev = data; - unsigned int id = pci_dev->irq; - return !strcmp(plat_dev->name, "tc35815-mac") && plat_dev->id == id; -} - static int tc35815_read_plat_dev_addr(struct net_device *dev) { - struct tc35815_local *lp = netdev_priv(dev); - struct device *pd = bus_find_device(&platform_bus_type, NULL, - lp->pci_dev, tc35815_mac_match); - if (pd) { - if (pd->platform_data) - memcpy(dev->dev_addr, pd->platform_data, ETH_ALEN); - put_device(pd); - return is_valid_ether_addr(dev->dev_addr) ? 0 : -ENODEV; - } return -ENODEV; } -#else -static int tc35815_read_plat_dev_addr(struct net_device *dev) -{ - return -ENODEV; -} -#endif static int tc35815_init_dev_addr(struct net_device *dev) { From patchwork Tue Jan 5 14:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0C05C43381 for ; Tue, 5 Jan 2021 14:05:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AADD922AAB for ; Tue, 5 Jan 2021 14:05:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730081AbhAEOEZ (ORCPT ); Tue, 5 Jan 2021 09:04:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:56830 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729880AbhAEOEY (ORCPT ); Tue, 5 Jan 2021 09:04:24 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A7FB2ADD6; Tue, 5 Jan 2021 14:03:41 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 03/10] net: 8390: Drop support for TX49XX boards Date: Tue, 5 Jan 2021 15:02:48 +0100 Message-Id: <20210105140305.141401-4-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove support in network drivers for it. Signed-off-by: Thomas Bogendoerfer --- drivers/net/ethernet/8390/Kconfig | 2 +- drivers/net/ethernet/8390/ne.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig index 9f4b302fd2ce..6aecc4c199d0 100644 --- a/drivers/net/ethernet/8390/Kconfig +++ b/drivers/net/ethernet/8390/Kconfig @@ -101,7 +101,7 @@ config MCF8390 config NE2000 tristate "NE2000/NE1000 support" - depends on (ISA || (Q40 && m) || MACH_TX49XX || ATARI_ETHERNEC) + depends on (ISA || (Q40 && m) || ATARI_ETHERNEC) select CRC32 help If you have a network (Ethernet) card of this type, say Y here. diff --git a/drivers/net/ethernet/8390/ne.c b/drivers/net/ethernet/8390/ne.c index e9756d0ea5b8..69110306badf 100644 --- a/drivers/net/ethernet/8390/ne.c +++ b/drivers/net/ethernet/8390/ne.c @@ -143,9 +143,6 @@ bad_clone_list[] __initdata = { {"E-LAN100", "E-LAN200", {0x00, 0x00, 0x5d}}, /* Broken ne1000 clones */ {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */ {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */ -#ifdef CONFIG_MACH_TX49XX - {"RBHMA4X00-RTL8019", "RBHMA4X00-RTL8019", {0x00, 0x60, 0x0a}}, /* Toshiba built-in */ -#endif {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */ {NULL,} }; @@ -164,9 +161,7 @@ bad_clone_list[] __initdata = { #define NESM_START_PG 0x40 /* First page of TX buffer */ #define NESM_STOP_PG 0x80 /* Last page +1 of RX ring */ -#if defined(CONFIG_MACH_TX49XX) -# define DCR_VAL 0x48 /* 8-bit mode */ -#elif defined(CONFIG_ATARI) /* 8-bit mode on Atari, normal on Q40 */ +#if defined(CONFIG_ATARI) /* 8-bit mode on Atari, normal on Q40 */ # define DCR_VAL (MACH_IS_ATARI ? 0x48 : 0x49) #else # define DCR_VAL 0x49 From patchwork Tue Jan 5 14:02:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E496C43217 for ; Tue, 5 Jan 2021 14:04:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53A2C22AAB for ; Tue, 5 Jan 2021 14:04:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730278AbhAEOEc (ORCPT ); Tue, 5 Jan 2021 09:04:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:56872 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729886AbhAEOE0 (ORCPT ); Tue, 5 Jan 2021 09:04:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 715C8AE63; Tue, 5 Jan 2021 14:03:42 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 04/10] spi: txx9: Remove driver Date: Tue, 5 Jan 2021 15:02:49 +0100 Message-Id: <20210105140305.141401-5-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove support SPI driver for it. Signed-off-by: Thomas Bogendoerfer --- drivers/spi/Kconfig | 6 - drivers/spi/Makefile | 1 - drivers/spi/spi-txx9.c | 477 ----------------------------------------- 3 files changed, 484 deletions(-) delete mode 100644 drivers/spi/spi-txx9.c diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index aadaea052f51..7e9d91bbb996 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -885,12 +885,6 @@ config SPI_TOPCLIFF_PCH This driver also supports the ML7213/ML7223/ML7831, a companion chip for the Atom E6xx series and compatible with the Intel EG20T PCH. -config SPI_TXX9 - tristate "Toshiba TXx9 SPI controller" - depends on GPIOLIB && (CPU_TX49XX || COMPILE_TEST) - help - SPI driver for Toshiba TXx9 MIPS SoCs - config SPI_UNIPHIER tristate "Socionext UniPhier SPI Controller" depends on (ARCH_UNIPHIER || COMPILE_TEST) && OF diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 6fea5821662e..9578b40e7800 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -122,7 +122,6 @@ obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o spi-thunderx-objs := spi-cavium.o spi-cavium-thunderx.o obj-$(CONFIG_SPI_THUNDERX) += spi-thunderx.o obj-$(CONFIG_SPI_TOPCLIFF_PCH) += spi-topcliff-pch.o -obj-$(CONFIG_SPI_TXX9) += spi-txx9.o obj-$(CONFIG_SPI_UNIPHIER) += spi-uniphier.o obj-$(CONFIG_SPI_XCOMM) += spi-xcomm.o obj-$(CONFIG_SPI_XILINX) += spi-xilinx.o diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c deleted file mode 100644 index 3606232f190f..000000000000 --- a/drivers/spi/spi-txx9.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * TXx9 SPI controller driver. - * - * Based on linux/arch/mips/tx4938/toshiba_rbtx4938/spi_txx9.c - * Copyright (C) 2000-2001 Toshiba Corporation - * - * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the - * terms of the GNU General Public License version 2. This program is - * licensed "as is" without any warranty of any kind, whether express - * or implied. - * - * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com) - * - * Convert to generic SPI framework - Atsushi Nemoto (anemo@mba.ocn.ne.jp) - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define SPI_FIFO_SIZE 4 -#define SPI_MAX_DIVIDER 0xff /* Max. value for SPCR1.SER */ -#define SPI_MIN_DIVIDER 1 /* Min. value for SPCR1.SER */ - -#define TXx9_SPMCR 0x00 -#define TXx9_SPCR0 0x04 -#define TXx9_SPCR1 0x08 -#define TXx9_SPFS 0x0c -#define TXx9_SPSR 0x14 -#define TXx9_SPDR 0x18 - -/* SPMCR : SPI Master Control */ -#define TXx9_SPMCR_OPMODE 0xc0 -#define TXx9_SPMCR_CONFIG 0x40 -#define TXx9_SPMCR_ACTIVE 0x80 -#define TXx9_SPMCR_SPSTP 0x02 -#define TXx9_SPMCR_BCLR 0x01 - -/* SPCR0 : SPI Control 0 */ -#define TXx9_SPCR0_TXIFL_MASK 0xc000 -#define TXx9_SPCR0_RXIFL_MASK 0x3000 -#define TXx9_SPCR0_SIDIE 0x0800 -#define TXx9_SPCR0_SOEIE 0x0400 -#define TXx9_SPCR0_RBSIE 0x0200 -#define TXx9_SPCR0_TBSIE 0x0100 -#define TXx9_SPCR0_IFSPSE 0x0010 -#define TXx9_SPCR0_SBOS 0x0004 -#define TXx9_SPCR0_SPHA 0x0002 -#define TXx9_SPCR0_SPOL 0x0001 - -/* SPSR : SPI Status */ -#define TXx9_SPSR_TBSI 0x8000 -#define TXx9_SPSR_RBSI 0x4000 -#define TXx9_SPSR_TBS_MASK 0x3800 -#define TXx9_SPSR_RBS_MASK 0x0700 -#define TXx9_SPSR_SPOE 0x0080 -#define TXx9_SPSR_IFSD 0x0008 -#define TXx9_SPSR_SIDLE 0x0004 -#define TXx9_SPSR_STRDY 0x0002 -#define TXx9_SPSR_SRRDY 0x0001 - - -struct txx9spi { - struct work_struct work; - spinlock_t lock; /* protect 'queue' */ - struct list_head queue; - wait_queue_head_t waitq; - void __iomem *membase; - int baseclk; - struct clk *clk; - struct gpio_desc *last_chipselect; - int last_chipselect_val; -}; - -static u32 txx9spi_rd(struct txx9spi *c, int reg) -{ - return __raw_readl(c->membase + reg); -} -static void txx9spi_wr(struct txx9spi *c, u32 val, int reg) -{ - __raw_writel(val, c->membase + reg); -} - -static void txx9spi_cs_func(struct spi_device *spi, struct txx9spi *c, - int on, unsigned int cs_delay) -{ - /* - * The GPIO descriptor will track polarity inversion inside - * gpiolib. - */ - if (on) { - /* deselect the chip with cs_change hint in last transfer */ - if (c->last_chipselect) - gpiod_set_value(c->last_chipselect, - !c->last_chipselect_val); - c->last_chipselect = spi->cs_gpiod; - c->last_chipselect_val = on; - } else { - c->last_chipselect = NULL; - ndelay(cs_delay); /* CS Hold Time */ - } - gpiod_set_value(spi->cs_gpiod, on); - ndelay(cs_delay); /* CS Setup Time / CS Recovery Time */ -} - -static int txx9spi_setup(struct spi_device *spi) -{ - struct txx9spi *c = spi_master_get_devdata(spi->master); - - if (!spi->max_speed_hz) - return -EINVAL; - - /* deselect chip */ - spin_lock(&c->lock); - txx9spi_cs_func(spi, c, 0, (NSEC_PER_SEC / 2) / spi->max_speed_hz); - spin_unlock(&c->lock); - - return 0; -} - -static irqreturn_t txx9spi_interrupt(int irq, void *dev_id) -{ - struct txx9spi *c = dev_id; - - /* disable rx intr */ - txx9spi_wr(c, txx9spi_rd(c, TXx9_SPCR0) & ~TXx9_SPCR0_RBSIE, - TXx9_SPCR0); - wake_up(&c->waitq); - return IRQ_HANDLED; -} - -static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m) -{ - struct spi_device *spi = m->spi; - struct spi_transfer *t; - unsigned int cs_delay; - unsigned int cs_change = 1; - int status = 0; - u32 mcr; - u32 prev_speed_hz = 0; - u8 prev_bits_per_word = 0; - - /* CS setup/hold/recovery time in nsec */ - cs_delay = 100 + (NSEC_PER_SEC / 2) / spi->max_speed_hz; - - mcr = txx9spi_rd(c, TXx9_SPMCR); - if (unlikely((mcr & TXx9_SPMCR_OPMODE) == TXx9_SPMCR_ACTIVE)) { - dev_err(&spi->dev, "Bad mode.\n"); - status = -EIO; - goto exit; - } - mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); - - /* enter config mode */ - txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); - txx9spi_wr(c, TXx9_SPCR0_SBOS - | ((spi->mode & SPI_CPOL) ? TXx9_SPCR0_SPOL : 0) - | ((spi->mode & SPI_CPHA) ? TXx9_SPCR0_SPHA : 0) - | 0x08, - TXx9_SPCR0); - - list_for_each_entry(t, &m->transfers, transfer_list) { - const void *txbuf = t->tx_buf; - void *rxbuf = t->rx_buf; - u32 data; - unsigned int len = t->len; - unsigned int wsize; - u32 speed_hz = t->speed_hz; - u8 bits_per_word = t->bits_per_word; - - wsize = bits_per_word >> 3; /* in bytes */ - - if (prev_speed_hz != speed_hz - || prev_bits_per_word != bits_per_word) { - int n = DIV_ROUND_UP(c->baseclk, speed_hz) - 1; - - n = clamp(n, SPI_MIN_DIVIDER, SPI_MAX_DIVIDER); - /* enter config mode */ - txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, - TXx9_SPMCR); - txx9spi_wr(c, (n << 8) | bits_per_word, TXx9_SPCR1); - /* enter active mode */ - txx9spi_wr(c, mcr | TXx9_SPMCR_ACTIVE, TXx9_SPMCR); - - prev_speed_hz = speed_hz; - prev_bits_per_word = bits_per_word; - } - - if (cs_change) - txx9spi_cs_func(spi, c, 1, cs_delay); - cs_change = t->cs_change; - while (len) { - unsigned int count = SPI_FIFO_SIZE; - int i; - u32 cr0; - - if (len < count * wsize) - count = len / wsize; - /* now tx must be idle... */ - while (!(txx9spi_rd(c, TXx9_SPSR) & TXx9_SPSR_SIDLE)) - cpu_relax(); - cr0 = txx9spi_rd(c, TXx9_SPCR0); - cr0 &= ~TXx9_SPCR0_RXIFL_MASK; - cr0 |= (count - 1) << 12; - /* enable rx intr */ - cr0 |= TXx9_SPCR0_RBSIE; - txx9spi_wr(c, cr0, TXx9_SPCR0); - /* send */ - for (i = 0; i < count; i++) { - if (txbuf) { - data = (wsize == 1) - ? *(const u8 *)txbuf - : *(const u16 *)txbuf; - txx9spi_wr(c, data, TXx9_SPDR); - txbuf += wsize; - } else - txx9spi_wr(c, 0, TXx9_SPDR); - } - /* wait all rx data */ - wait_event(c->waitq, - txx9spi_rd(c, TXx9_SPSR) & TXx9_SPSR_RBSI); - /* receive */ - for (i = 0; i < count; i++) { - data = txx9spi_rd(c, TXx9_SPDR); - if (rxbuf) { - if (wsize == 1) - *(u8 *)rxbuf = data; - else - *(u16 *)rxbuf = data; - rxbuf += wsize; - } - } - len -= count * wsize; - } - m->actual_length += t->len; - spi_transfer_delay_exec(t); - - if (!cs_change) - continue; - if (t->transfer_list.next == &m->transfers) - break; - /* sometimes a short mid-message deselect of the chip - * may be needed to terminate a mode or command - */ - txx9spi_cs_func(spi, c, 0, cs_delay); - } - -exit: - m->status = status; - if (m->complete) - m->complete(m->context); - - /* normally deactivate chipselect ... unless no error and - * cs_change has hinted that the next message will probably - * be for this chip too. - */ - if (!(status == 0 && cs_change)) - txx9spi_cs_func(spi, c, 0, cs_delay); - - /* enter config mode */ - txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); -} - -static void txx9spi_work(struct work_struct *work) -{ - struct txx9spi *c = container_of(work, struct txx9spi, work); - unsigned long flags; - - spin_lock_irqsave(&c->lock, flags); - while (!list_empty(&c->queue)) { - struct spi_message *m; - - m = container_of(c->queue.next, struct spi_message, queue); - list_del_init(&m->queue); - spin_unlock_irqrestore(&c->lock, flags); - - txx9spi_work_one(c, m); - - spin_lock_irqsave(&c->lock, flags); - } - spin_unlock_irqrestore(&c->lock, flags); -} - -static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) -{ - struct spi_master *master = spi->master; - struct txx9spi *c = spi_master_get_devdata(master); - struct spi_transfer *t; - unsigned long flags; - - m->actual_length = 0; - - /* check each transfer's parameters */ - list_for_each_entry(t, &m->transfers, transfer_list) { - if (!t->tx_buf && !t->rx_buf && t->len) - return -EINVAL; - } - - spin_lock_irqsave(&c->lock, flags); - list_add_tail(&m->queue, &c->queue); - schedule_work(&c->work); - spin_unlock_irqrestore(&c->lock, flags); - - return 0; -} - -/* - * Chip select uses GPIO only, further the driver is using the chip select - * numer (from the device tree "reg" property, and this can only come from - * device tree since this i MIPS and there is no way to pass platform data) as - * the GPIO number. As the platform has only one GPIO controller (the txx9 GPIO - * chip) it is thus using the chip select number as an offset into that chip. - * This chip has a maximum of 16 GPIOs 0..15 and this is what all platforms - * register. - * - * We modernized this behaviour by explicitly converting that offset to an - * offset on the GPIO chip using a GPIO descriptor machine table of the same - * size as the txx9 GPIO chip with a 1-to-1 mapping of chip select to GPIO - * offset. - * - * This is admittedly a hack, but it is countering the hack of using "reg" to - * contain a GPIO offset when it should be using "cs-gpios" as the SPI bindings - * state. - */ -static struct gpiod_lookup_table txx9spi_cs_gpio_table = { - .dev_id = "spi0", - .table = { - GPIO_LOOKUP_IDX("TXx9", 0, "cs", 0, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 1, "cs", 1, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 2, "cs", 2, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 3, "cs", 3, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 4, "cs", 4, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 5, "cs", 5, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 6, "cs", 6, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 7, "cs", 7, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 8, "cs", 8, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 9, "cs", 9, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 10, "cs", 10, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 11, "cs", 11, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 12, "cs", 12, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 13, "cs", 13, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 14, "cs", 14, GPIO_ACTIVE_LOW), - GPIO_LOOKUP_IDX("TXx9", 15, "cs", 15, GPIO_ACTIVE_LOW), - { }, - }, -}; - -static int txx9spi_probe(struct platform_device *dev) -{ - struct spi_master *master; - struct txx9spi *c; - struct resource *res; - int ret = -ENODEV; - u32 mcr; - int irq; - - master = spi_alloc_master(&dev->dev, sizeof(*c)); - if (!master) - return ret; - c = spi_master_get_devdata(master); - platform_set_drvdata(dev, master); - - INIT_WORK(&c->work, txx9spi_work); - spin_lock_init(&c->lock); - INIT_LIST_HEAD(&c->queue); - init_waitqueue_head(&c->waitq); - - c->clk = devm_clk_get(&dev->dev, "spi-baseclk"); - if (IS_ERR(c->clk)) { - ret = PTR_ERR(c->clk); - c->clk = NULL; - goto exit; - } - ret = clk_prepare_enable(c->clk); - if (ret) { - c->clk = NULL; - goto exit; - } - c->baseclk = clk_get_rate(c->clk); - master->min_speed_hz = DIV_ROUND_UP(c->baseclk, SPI_MAX_DIVIDER + 1); - master->max_speed_hz = c->baseclk / (SPI_MIN_DIVIDER + 1); - - res = platform_get_resource(dev, IORESOURCE_MEM, 0); - c->membase = devm_ioremap_resource(&dev->dev, res); - if (IS_ERR(c->membase)) - goto exit_busy; - - /* enter config mode */ - mcr = txx9spi_rd(c, TXx9_SPMCR); - mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); - txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); - - irq = platform_get_irq(dev, 0); - if (irq < 0) - goto exit_busy; - ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0, - "spi_txx9", c); - if (ret) - goto exit; - - c->last_chipselect = NULL; - - dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", - (unsigned long long)res->start, irq, - (c->baseclk + 500000) / 1000000); - - gpiod_add_lookup_table(&txx9spi_cs_gpio_table); - - /* the spi->mode bits understood by this driver: */ - master->mode_bits = SPI_CS_HIGH | SPI_CPOL | SPI_CPHA; - - master->bus_num = dev->id; - master->setup = txx9spi_setup; - master->transfer = txx9spi_transfer; - master->num_chipselect = (u16)UINT_MAX; /* any GPIO numbers */ - master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); - master->use_gpio_descriptors = true; - - ret = devm_spi_register_master(&dev->dev, master); - if (ret) - goto exit; - return 0; -exit_busy: - ret = -EBUSY; -exit: - clk_disable_unprepare(c->clk); - spi_master_put(master); - return ret; -} - -static int txx9spi_remove(struct platform_device *dev) -{ - struct spi_master *master = platform_get_drvdata(dev); - struct txx9spi *c = spi_master_get_devdata(master); - - flush_work(&c->work); - clk_disable_unprepare(c->clk); - return 0; -} - -/* work with hotplug and coldplug */ -MODULE_ALIAS("platform:spi_txx9"); - -static struct platform_driver txx9spi_driver = { - .probe = txx9spi_probe, - .remove = txx9spi_remove, - .driver = { - .name = "spi_txx9", - }, -}; - -static int __init txx9spi_init(void) -{ - return platform_driver_register(&txx9spi_driver); -} -subsys_initcall(txx9spi_init); - -static void __exit txx9spi_exit(void) -{ - platform_driver_unregister(&txx9spi_driver); -} -module_exit(txx9spi_exit); - -MODULE_DESCRIPTION("TXx9 SPI Driver"); -MODULE_LICENSE("GPL"); From patchwork Tue Jan 5 14:02:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8139C433DB for ; Tue, 5 Jan 2021 14:06:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 95FD422AAB for ; Tue, 5 Jan 2021 14:06:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730563AbhAEOFJ (ORCPT ); Tue, 5 Jan 2021 09:05:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:57642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbhAEOFB (ORCPT ); Tue, 5 Jan 2021 09:05:01 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0B248AEBB; Tue, 5 Jan 2021 14:03:43 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 05/10] dma: tx49 removal Date: Tue, 5 Jan 2021 15:02:50 +0100 Message-Id: <20210105140305.141401-6-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Signed-off-by: Thomas Bogendoerfer --- drivers/dma/Kconfig | 2 +- drivers/dma/txx9dmac.h | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index d242c7632621..22fedfb6f5f9 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig @@ -601,7 +601,7 @@ config S3C24XX_DMAC config TXX9_DMAC tristate "Toshiba TXx9 SoC DMA support" - depends on MACH_TX49XX || MACH_TX39XX + depends on MACH_TX39XX select DMA_ENGINE help Support the TXx9 SoC internal DMA controller. This can be diff --git a/drivers/dma/txx9dmac.h b/drivers/dma/txx9dmac.h index aa53eafb1519..4acf29f50a29 100644 --- a/drivers/dma/txx9dmac.h +++ b/drivers/dma/txx9dmac.h @@ -26,11 +26,6 @@ * DMA channel. */ -#ifdef CONFIG_MACH_TX49XX -static inline bool txx9_dma_have_SMPCHN(void) -{ - return true; -} #define TXX9_DMA_USE_SIMPLE_CHAIN #else static inline bool txx9_dma_have_SMPCHN(void) @@ -40,13 +35,8 @@ static inline bool txx9_dma_have_SMPCHN(void) #endif #ifdef __LITTLE_ENDIAN -#ifdef CONFIG_MACH_TX49XX -#define CCR_LE TXX9_DMA_CCR_LE -#define MCR_LE 0 -#else #define CCR_LE 0 #define MCR_LE TXX9_DMA_MCR_LE -#endif #else #define CCR_LE 0 #define MCR_LE 0 From patchwork Tue Jan 5 14:02:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E84BCC07EBC for ; Tue, 5 Jan 2021 14:05:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BD70022AAA for ; Tue, 5 Jan 2021 14:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730617AbhAEOFX (ORCPT ); Tue, 5 Jan 2021 09:05:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:57718 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729093AbhAEOFM (ORCPT ); Tue, 5 Jan 2021 09:05:12 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 16936AEE0; Tue, 5 Jan 2021 14:03:44 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 06/10] mtd: Remove drivers used by TX49xx Date: Tue, 5 Jan 2021 15:02:51 +0100 Message-Id: <20210105140305.141401-7-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove MTD support for it. Signed-off-by: Thomas Bogendoerfer Acked-by: Miquel Raynal --- drivers/mtd/maps/Kconfig | 6 - drivers/mtd/maps/Makefile | 1 - drivers/mtd/maps/rbtx4939-flash.c | 133 ------- drivers/mtd/nand/raw/Kconfig | 7 - drivers/mtd/nand/raw/Makefile | 1 - drivers/mtd/nand/raw/txx9ndfmc.c | 423 ----------------------- include/linux/platform_data/txx9/ndfmc.h | 28 -- 7 files changed, 599 deletions(-) delete mode 100644 drivers/mtd/maps/rbtx4939-flash.c delete mode 100644 drivers/mtd/nand/raw/txx9ndfmc.c delete mode 100644 include/linux/platform_data/txx9/ndfmc.h diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 6650acbc961e..17579ce04922 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -380,12 +380,6 @@ config MTD_INTEL_VR_NOR Map driver for a NOR flash bank located on the Expansion Bus of the Intel Vermilion Range chipset. -config MTD_RBTX4939 - tristate "Map driver for RBTX4939 board" - depends on TOSHIBA_RBTX4939 && MTD_CFI && MTD_COMPLEX_MAPPINGS - help - Map driver for NOR flash chips on RBTX4939 board. - config MTD_PLATRAM tristate "Map driver for platform device RAM (mtd-ram)" select MTD_RAM diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 79f018cf412f..408a2217b0f2 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile @@ -43,6 +43,5 @@ obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o -obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o obj-$(CONFIG_MTD_VMU) += vmu-flash.o obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c deleted file mode 100644 index 39c86c0b0ec1..000000000000 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ /dev/null @@ -1,133 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * rbtx4939-flash (based on physmap.c) - * - * This is a simplified physmap driver with map_init callback function. - * - * Copyright (C) 2009 Atsushi Nemoto - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct rbtx4939_flash_info { - struct mtd_info *mtd; - struct map_info map; -}; - -static int rbtx4939_flash_remove(struct platform_device *dev) -{ - struct rbtx4939_flash_info *info; - - info = platform_get_drvdata(dev); - if (!info) - return 0; - - if (info->mtd) { - mtd_device_unregister(info->mtd); - map_destroy(info->mtd); - } - return 0; -} - -static const char * const rom_probe_types[] = { - "cfi_probe", "jedec_probe", NULL }; - -static int rbtx4939_flash_probe(struct platform_device *dev) -{ - struct rbtx4939_flash_data *pdata; - struct rbtx4939_flash_info *info; - struct resource *res; - const char * const *probe_type; - int err = 0; - unsigned long size; - - pdata = dev_get_platdata(&dev->dev); - if (!pdata) - return -ENODEV; - - res = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info), - GFP_KERNEL); - if (!info) - return -ENOMEM; - - platform_set_drvdata(dev, info); - - size = resource_size(res); - pr_notice("rbtx4939 platform flash device: %pR\n", res); - - if (!devm_request_mem_region(&dev->dev, res->start, size, - dev_name(&dev->dev))) - return -EBUSY; - - info->map.name = dev_name(&dev->dev); - info->map.phys = res->start; - info->map.size = size; - info->map.bankwidth = pdata->width; - - info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size); - if (!info->map.virt) - return -EBUSY; - - if (pdata->map_init) - (*pdata->map_init)(&info->map); - else - simple_map_init(&info->map); - - probe_type = rom_probe_types; - for (; !info->mtd && *probe_type; probe_type++) - info->mtd = do_map_probe(*probe_type, &info->map); - if (!info->mtd) { - dev_err(&dev->dev, "map_probe failed\n"); - err = -ENXIO; - goto err_out; - } - info->mtd->dev.parent = &dev->dev; - err = mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); - - if (err) - goto err_out; - return 0; - -err_out: - rbtx4939_flash_remove(dev); - return err; -} - -#ifdef CONFIG_PM -static void rbtx4939_flash_shutdown(struct platform_device *dev) -{ - struct rbtx4939_flash_info *info = platform_get_drvdata(dev); - - if (mtd_suspend(info->mtd) == 0) - mtd_resume(info->mtd); -} -#else -#define rbtx4939_flash_shutdown NULL -#endif - -static struct platform_driver rbtx4939_flash_driver = { - .probe = rbtx4939_flash_probe, - .remove = rbtx4939_flash_remove, - .shutdown = rbtx4939_flash_shutdown, - .driver = { - .name = "rbtx4939-flash", - }, -}; - -module_platform_driver(rbtx4939_flash_driver); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("RBTX4939 MTD map driver"); -MODULE_ALIAS("platform:rbtx4939-flash"); diff --git a/drivers/mtd/nand/raw/Kconfig b/drivers/mtd/nand/raw/Kconfig index 442a039b92f3..9e74a63b18a4 100644 --- a/drivers/mtd/nand/raw/Kconfig +++ b/drivers/mtd/nand/raw/Kconfig @@ -313,13 +313,6 @@ config MTD_NAND_DAVINCI Enable the driver for NAND flash chips on Texas Instruments DaVinci/Keystone processors. -config MTD_NAND_TXX9NDFMC - tristate "TXx9 NAND controller" - depends on SOC_TX4938 || SOC_TX4939 || COMPILE_TEST - depends on HAS_IOMEM - help - This enables the NAND flash controller on the TXx9 SoCs. - config MTD_NAND_SOCRATES tristate "Socrates NAND controller" depends on SOCRATES diff --git a/drivers/mtd/nand/raw/Makefile b/drivers/mtd/nand/raw/Makefile index 32475a28d8f8..07cb86321403 100644 --- a/drivers/mtd/nand/raw/Makefile +++ b/drivers/mtd/nand/raw/Makefile @@ -37,7 +37,6 @@ obj-$(CONFIG_MTD_NAND_MLC_LPC32XX) += lpc32xx_mlc.o obj-$(CONFIG_MTD_NAND_SH_FLCTL) += sh_flctl.o obj-$(CONFIG_MTD_NAND_MXC) += mxc_nand.o obj-$(CONFIG_MTD_NAND_SOCRATES) += socrates_nand.o -obj-$(CONFIG_MTD_NAND_TXX9NDFMC) += txx9ndfmc.o obj-$(CONFIG_MTD_NAND_MPC5121_NFC) += mpc5121_nfc.o obj-$(CONFIG_MTD_NAND_VF610_NFC) += vf610_nfc.o obj-$(CONFIG_MTD_NAND_RICOH) += r852.o diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c deleted file mode 100644 index 1a9449e53bf9..000000000000 --- a/drivers/mtd/nand/raw/txx9ndfmc.c +++ /dev/null @@ -1,423 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * TXx9 NAND flash memory controller driver - * Based on RBTX49xx patch from CELF patch archive. - * - * (C) Copyright TOSHIBA CORPORATION 2004-2007 - * All Rights Reserved. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* TXX9 NDFMC Registers */ -#define TXX9_NDFDTR 0x00 -#define TXX9_NDFMCR 0x04 -#define TXX9_NDFSR 0x08 -#define TXX9_NDFISR 0x0c -#define TXX9_NDFIMR 0x10 -#define TXX9_NDFSPR 0x14 -#define TXX9_NDFRSTR 0x18 /* not TX4939 */ - -/* NDFMCR : NDFMC Mode Control */ -#define TXX9_NDFMCR_WE 0x80 -#define TXX9_NDFMCR_ECC_ALL 0x60 -#define TXX9_NDFMCR_ECC_RESET 0x60 -#define TXX9_NDFMCR_ECC_READ 0x40 -#define TXX9_NDFMCR_ECC_ON 0x20 -#define TXX9_NDFMCR_ECC_OFF 0x00 -#define TXX9_NDFMCR_CE 0x10 -#define TXX9_NDFMCR_BSPRT 0x04 /* TX4925/TX4926 only */ -#define TXX9_NDFMCR_ALE 0x02 -#define TXX9_NDFMCR_CLE 0x01 -/* TX4939 only */ -#define TXX9_NDFMCR_X16 0x0400 -#define TXX9_NDFMCR_DMAREQ_MASK 0x0300 -#define TXX9_NDFMCR_DMAREQ_NODMA 0x0000 -#define TXX9_NDFMCR_DMAREQ_128 0x0100 -#define TXX9_NDFMCR_DMAREQ_256 0x0200 -#define TXX9_NDFMCR_DMAREQ_512 0x0300 -#define TXX9_NDFMCR_CS_MASK 0x0c -#define TXX9_NDFMCR_CS(ch) ((ch) << 2) - -/* NDFMCR : NDFMC Status */ -#define TXX9_NDFSR_BUSY 0x80 -/* TX4939 only */ -#define TXX9_NDFSR_DMARUN 0x40 - -/* NDFMCR : NDFMC Reset */ -#define TXX9_NDFRSTR_RST 0x01 - -struct txx9ndfmc_priv { - struct platform_device *dev; - struct nand_chip chip; - int cs; - const char *mtdname; -}; - -#define MAX_TXX9NDFMC_DEV 4 -struct txx9ndfmc_drvdata { - struct mtd_info *mtds[MAX_TXX9NDFMC_DEV]; - void __iomem *base; - unsigned char hold; /* in gbusclock */ - unsigned char spw; /* in gbusclock */ - struct nand_controller controller; -}; - -static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) -{ - struct nand_chip *chip = mtd_to_nand(mtd); - struct txx9ndfmc_priv *txx9_priv = nand_get_controller_data(chip); - return txx9_priv->dev; -} - -static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) -{ - struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); - struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); - - return drvdata->base + (reg << plat->shift); -} - -static u32 txx9ndfmc_read(struct platform_device *dev, unsigned int reg) -{ - return __raw_readl(ndregaddr(dev, reg)); -} - -static void txx9ndfmc_write(struct platform_device *dev, - u32 val, unsigned int reg) -{ - __raw_writel(val, ndregaddr(dev, reg)); -} - -static uint8_t txx9ndfmc_read_byte(struct nand_chip *chip) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - - return txx9ndfmc_read(dev, TXX9_NDFDTR); -} - -static void txx9ndfmc_write_buf(struct nand_chip *chip, const uint8_t *buf, - int len) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); - u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); - - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_WE, TXX9_NDFMCR); - while (len--) - __raw_writel(*buf++, ndfdtr); - txx9ndfmc_write(dev, mcr, TXX9_NDFMCR); -} - -static void txx9ndfmc_read_buf(struct nand_chip *chip, uint8_t *buf, int len) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - void __iomem *ndfdtr = ndregaddr(dev, TXX9_NDFDTR); - - while (len--) - *buf++ = __raw_readl(ndfdtr); -} - -static void txx9ndfmc_cmd_ctrl(struct nand_chip *chip, int cmd, - unsigned int ctrl) -{ - struct txx9ndfmc_priv *txx9_priv = nand_get_controller_data(chip); - struct platform_device *dev = txx9_priv->dev; - struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); - - if (ctrl & NAND_CTRL_CHANGE) { - u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); - - mcr &= ~(TXX9_NDFMCR_CLE | TXX9_NDFMCR_ALE | TXX9_NDFMCR_CE); - mcr |= ctrl & NAND_CLE ? TXX9_NDFMCR_CLE : 0; - mcr |= ctrl & NAND_ALE ? TXX9_NDFMCR_ALE : 0; - /* TXX9_NDFMCR_CE bit is 0:high 1:low */ - mcr |= ctrl & NAND_NCE ? TXX9_NDFMCR_CE : 0; - if (txx9_priv->cs >= 0 && (ctrl & NAND_NCE)) { - mcr &= ~TXX9_NDFMCR_CS_MASK; - mcr |= TXX9_NDFMCR_CS(txx9_priv->cs); - } - txx9ndfmc_write(dev, mcr, TXX9_NDFMCR); - } - if (cmd != NAND_CMD_NONE) - txx9ndfmc_write(dev, cmd & 0xff, TXX9_NDFDTR); - if (plat->flags & NDFMC_PLAT_FLAG_DUMMYWRITE) { - /* dummy write to update external latch */ - if ((ctrl & NAND_CTRL_CHANGE) && cmd == NAND_CMD_NONE) - txx9ndfmc_write(dev, 0, TXX9_NDFDTR); - } -} - -static int txx9ndfmc_dev_ready(struct nand_chip *chip) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - - return !(txx9ndfmc_read(dev, TXX9_NDFSR) & TXX9_NDFSR_BUSY); -} - -static int txx9ndfmc_calculate_ecc(struct nand_chip *chip, const uint8_t *dat, - uint8_t *ecc_code) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - int eccbytes; - u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); - - mcr &= ~TXX9_NDFMCR_ECC_ALL; - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_READ, TXX9_NDFMCR); - for (eccbytes = chip->ecc.bytes; eccbytes > 0; eccbytes -= 3) { - ecc_code[1] = txx9ndfmc_read(dev, TXX9_NDFDTR); - ecc_code[0] = txx9ndfmc_read(dev, TXX9_NDFDTR); - ecc_code[2] = txx9ndfmc_read(dev, TXX9_NDFDTR); - ecc_code += 3; - } - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); - return 0; -} - -static int txx9ndfmc_correct_data(struct nand_chip *chip, unsigned char *buf, - unsigned char *read_ecc, - unsigned char *calc_ecc) -{ - int eccsize; - int corrected = 0; - int stat; - - for (eccsize = chip->ecc.size; eccsize > 0; eccsize -= 256) { - stat = rawnand_sw_hamming_correct(chip, buf, read_ecc, - calc_ecc); - if (stat < 0) - return stat; - corrected += stat; - buf += 256; - read_ecc += 3; - calc_ecc += 3; - } - return corrected; -} - -static void txx9ndfmc_enable_hwecc(struct nand_chip *chip, int mode) -{ - struct platform_device *dev = mtd_to_platdev(nand_to_mtd(chip)); - u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); - - mcr &= ~TXX9_NDFMCR_ECC_ALL; - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_RESET, TXX9_NDFMCR); - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_OFF, TXX9_NDFMCR); - txx9ndfmc_write(dev, mcr | TXX9_NDFMCR_ECC_ON, TXX9_NDFMCR); -} - -static void txx9ndfmc_initialize(struct platform_device *dev) -{ - struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); - struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); - int tmout = 100; - - if (plat->flags & NDFMC_PLAT_FLAG_NO_RSTR) - ; /* no NDFRSTR. Write to NDFSPR resets the NDFMC. */ - else { - /* reset NDFMC */ - txx9ndfmc_write(dev, - txx9ndfmc_read(dev, TXX9_NDFRSTR) | - TXX9_NDFRSTR_RST, - TXX9_NDFRSTR); - while (txx9ndfmc_read(dev, TXX9_NDFRSTR) & TXX9_NDFRSTR_RST) { - if (--tmout == 0) { - dev_err(&dev->dev, "reset failed.\n"); - break; - } - udelay(1); - } - } - /* setup Hold Time, Strobe Pulse Width */ - txx9ndfmc_write(dev, (drvdata->hold << 4) | drvdata->spw, TXX9_NDFSPR); - txx9ndfmc_write(dev, - (plat->flags & NDFMC_PLAT_FLAG_USE_BSPRT) ? - TXX9_NDFMCR_BSPRT : 0, TXX9_NDFMCR); -} - -#define TXX9NDFMC_NS_TO_CYC(gbusclk, ns) \ - DIV_ROUND_UP((ns) * DIV_ROUND_UP(gbusclk, 1000), 1000000) - -static int txx9ndfmc_attach_chip(struct nand_chip *chip) -{ - struct mtd_info *mtd = nand_to_mtd(chip); - - if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST) - return 0; - - chip->ecc.strength = 1; - - if (mtd->writesize >= 512) { - chip->ecc.size = 512; - chip->ecc.bytes = 6; - } else { - chip->ecc.size = 256; - chip->ecc.bytes = 3; - } - - chip->ecc.calculate = txx9ndfmc_calculate_ecc; - chip->ecc.correct = txx9ndfmc_correct_data; - chip->ecc.hwctl = txx9ndfmc_enable_hwecc; - - return 0; -} - -static const struct nand_controller_ops txx9ndfmc_controller_ops = { - .attach_chip = txx9ndfmc_attach_chip, -}; - -static int __init txx9ndfmc_probe(struct platform_device *dev) -{ - struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); - int hold, spw; - int i; - struct txx9ndfmc_drvdata *drvdata; - unsigned long gbusclk = plat->gbus_clock; - struct resource *res; - - drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) - return -ENOMEM; - res = platform_get_resource(dev, IORESOURCE_MEM, 0); - drvdata->base = devm_ioremap_resource(&dev->dev, res); - if (IS_ERR(drvdata->base)) - return PTR_ERR(drvdata->base); - - hold = plat->hold ?: 20; /* tDH */ - spw = plat->spw ?: 90; /* max(tREADID, tWP, tRP) */ - - hold = TXX9NDFMC_NS_TO_CYC(gbusclk, hold); - spw = TXX9NDFMC_NS_TO_CYC(gbusclk, spw); - if (plat->flags & NDFMC_PLAT_FLAG_HOLDADD) - hold -= 2; /* actual hold time : (HOLD + 2) BUSCLK */ - spw -= 1; /* actual wait time : (SPW + 1) BUSCLK */ - hold = clamp(hold, 1, 15); - drvdata->hold = hold; - spw = clamp(spw, 1, 15); - drvdata->spw = spw; - dev_info(&dev->dev, "CLK:%ldMHz HOLD:%d SPW:%d\n", - (gbusclk + 500000) / 1000000, hold, spw); - - nand_controller_init(&drvdata->controller); - drvdata->controller.ops = &txx9ndfmc_controller_ops; - - platform_set_drvdata(dev, drvdata); - txx9ndfmc_initialize(dev); - - for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) { - struct txx9ndfmc_priv *txx9_priv; - struct nand_chip *chip; - struct mtd_info *mtd; - - if (!(plat->ch_mask & (1 << i))) - continue; - txx9_priv = kzalloc(sizeof(struct txx9ndfmc_priv), - GFP_KERNEL); - if (!txx9_priv) - continue; - chip = &txx9_priv->chip; - mtd = nand_to_mtd(chip); - mtd->dev.parent = &dev->dev; - - chip->legacy.read_byte = txx9ndfmc_read_byte; - chip->legacy.read_buf = txx9ndfmc_read_buf; - chip->legacy.write_buf = txx9ndfmc_write_buf; - chip->legacy.cmd_ctrl = txx9ndfmc_cmd_ctrl; - chip->legacy.dev_ready = txx9ndfmc_dev_ready; - chip->legacy.chip_delay = 100; - chip->controller = &drvdata->controller; - - nand_set_controller_data(chip, txx9_priv); - txx9_priv->dev = dev; - - if (plat->ch_mask != 1) { - txx9_priv->cs = i; - txx9_priv->mtdname = kasprintf(GFP_KERNEL, "%s.%u", - dev_name(&dev->dev), i); - } else { - txx9_priv->cs = -1; - txx9_priv->mtdname = kstrdup(dev_name(&dev->dev), - GFP_KERNEL); - } - if (!txx9_priv->mtdname) { - kfree(txx9_priv); - dev_err(&dev->dev, "Unable to allocate MTD name.\n"); - continue; - } - if (plat->wide_mask & (1 << i)) - chip->options |= NAND_BUSWIDTH_16; - - if (nand_scan(chip, 1)) { - kfree(txx9_priv->mtdname); - kfree(txx9_priv); - continue; - } - mtd->name = txx9_priv->mtdname; - - mtd_device_register(mtd, NULL, 0); - drvdata->mtds[i] = mtd; - } - - return 0; -} - -static int __exit txx9ndfmc_remove(struct platform_device *dev) -{ - struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); - int ret, i; - - if (!drvdata) - return 0; - for (i = 0; i < MAX_TXX9NDFMC_DEV; i++) { - struct mtd_info *mtd = drvdata->mtds[i]; - struct nand_chip *chip; - struct txx9ndfmc_priv *txx9_priv; - - if (!mtd) - continue; - chip = mtd_to_nand(mtd); - txx9_priv = nand_get_controller_data(chip); - - ret = mtd_device_unregister(nand_to_mtd(chip)); - WARN_ON(ret); - nand_cleanup(chip); - kfree(txx9_priv->mtdname); - kfree(txx9_priv); - } - return 0; -} - -#ifdef CONFIG_PM -static int txx9ndfmc_resume(struct platform_device *dev) -{ - if (platform_get_drvdata(dev)) - txx9ndfmc_initialize(dev); - return 0; -} -#else -#define txx9ndfmc_resume NULL -#endif - -static struct platform_driver txx9ndfmc_driver = { - .remove = __exit_p(txx9ndfmc_remove), - .resume = txx9ndfmc_resume, - .driver = { - .name = "txx9ndfmc", - }, -}; - -module_platform_driver_probe(txx9ndfmc_driver, txx9ndfmc_probe); - -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("TXx9 SoC NAND flash controller driver"); -MODULE_ALIAS("platform:txx9ndfmc"); diff --git a/include/linux/platform_data/txx9/ndfmc.h b/include/linux/platform_data/txx9/ndfmc.h deleted file mode 100644 index 7aaa4cd34d31..000000000000 --- a/include/linux/platform_data/txx9/ndfmc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * - * (C) Copyright TOSHIBA CORPORATION 2007 - */ -#ifndef __TXX9_NDFMC_H -#define __TXX9_NDFMC_H - -#define NDFMC_PLAT_FLAG_USE_BSPRT 0x01 -#define NDFMC_PLAT_FLAG_NO_RSTR 0x02 -#define NDFMC_PLAT_FLAG_HOLDADD 0x04 -#define NDFMC_PLAT_FLAG_DUMMYWRITE 0x08 - -struct txx9ndfmc_platform_data { - unsigned int shift; - unsigned int gbus_clock; - unsigned int hold; /* hold time in nanosecond */ - unsigned int spw; /* strobe pulse width in nanosecond */ - unsigned int flags; - unsigned char ch_mask; /* available channel bitmask */ - unsigned char wp_mask; /* write-protect bitmask */ - unsigned char wide_mask; /* 16bit-nand bitmask */ -}; - -void txx9_ndfmc_init(unsigned long baseaddr, - const struct txx9ndfmc_platform_data *plat_data); - -#endif /* __TXX9_NDFMC_H */ From patchwork Tue Jan 5 14:02:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4901BC07EBE for ; Tue, 5 Jan 2021 14:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21A5422B30 for ; Tue, 5 Jan 2021 14:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730679AbhAEOGB (ORCPT ); Tue, 5 Jan 2021 09:06:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:57714 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729032AbhAEOFI (ORCPT ); Tue, 5 Jan 2021 09:05:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C617AAD19; Tue, 5 Jan 2021 14:03:44 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 07/10] char: hw_random: Remove tx4939 driver Date: Tue, 5 Jan 2021 15:02:52 +0100 Message-Id: <20210105140305.141401-8-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove hw_random driver for it. Signed-off-by: Thomas Bogendoerfer --- drivers/char/hw_random/Kconfig | 13 --- drivers/char/hw_random/Makefile | 1 - drivers/char/hw_random/tx4939-rng.c | 157 ---------------------------- 3 files changed, 171 deletions(-) delete mode 100644 drivers/char/hw_random/tx4939-rng.c diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 1fe006f3f12f..9d13d640384a 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -226,19 +226,6 @@ config HW_RANDOM_VIRTIO To compile this driver as a module, choose M here: the module will be called virtio-rng. If unsure, say N. -config HW_RANDOM_TX4939 - tristate "TX4939 Random Number Generator support" - depends on SOC_TX4939 - default HW_RANDOM - help - This driver provides kernel-side support for the Random Number - Generator hardware found on TX4939 SoC. - - To compile this driver as a module, choose M here: the - module will be called tx4939-rng. - - If unsure, say Y. - config HW_RANDOM_MXC_RNGA tristate "Freescale i.MX RNGA Random Number Generator" depends on SOC_IMX31 diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index 8933fada74f2..b2aa37162e24 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile @@ -20,7 +20,6 @@ obj-$(CONFIG_HW_RANDOM_OMAP) += omap-rng.o obj-$(CONFIG_HW_RANDOM_OMAP3_ROM) += omap3-rom-rng.o obj-$(CONFIG_HW_RANDOM_PASEMI) += pasemi-rng.o obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o -obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o obj-$(CONFIG_HW_RANDOM_IMX_RNGC) += imx-rngc.o obj-$(CONFIG_HW_RANDOM_INGENIC_RNG) += ingenic-rng.o diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c deleted file mode 100644 index c8bd34e740fd..000000000000 --- a/drivers/char/hw_random/tx4939-rng.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * RNG driver for TX4939 Random Number Generators (RNG) - * - * Copyright (C) 2009 Atsushi Nemoto - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TX4939_RNG_RCSR 0x00000000 -#define TX4939_RNG_ROR(n) (0x00000018 + (n) * 8) - -#define TX4939_RNG_RCSR_INTE 0x00000008 -#define TX4939_RNG_RCSR_RST 0x00000004 -#define TX4939_RNG_RCSR_FIN 0x00000002 -#define TX4939_RNG_RCSR_ST 0x00000001 - -struct tx4939_rng { - struct hwrng rng; - void __iomem *base; - u64 databuf[3]; - unsigned int data_avail; -}; - -static void rng_io_start(void) -{ -#ifndef CONFIG_64BIT - /* - * readq is reading a 64-bit register using a 64-bit load. On - * a 32-bit kernel however interrupts or any other processor - * exception would clobber the upper 32-bit of the processor - * register so interrupts need to be disabled. - */ - local_irq_disable(); -#endif -} - -static void rng_io_end(void) -{ -#ifndef CONFIG_64BIT - local_irq_enable(); -#endif -} - -static u64 read_rng(void __iomem *base, unsigned int offset) -{ - return ____raw_readq(base + offset); -} - -static void write_rng(u64 val, void __iomem *base, unsigned int offset) -{ - return ____raw_writeq(val, base + offset); -} - -static int tx4939_rng_data_present(struct hwrng *rng, int wait) -{ - struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); - int i; - - if (rngdev->data_avail) - return rngdev->data_avail; - for (i = 0; i < 20; i++) { - rng_io_start(); - if (!(read_rng(rngdev->base, TX4939_RNG_RCSR) - & TX4939_RNG_RCSR_ST)) { - rngdev->databuf[0] = - read_rng(rngdev->base, TX4939_RNG_ROR(0)); - rngdev->databuf[1] = - read_rng(rngdev->base, TX4939_RNG_ROR(1)); - rngdev->databuf[2] = - read_rng(rngdev->base, TX4939_RNG_ROR(2)); - rngdev->data_avail = - sizeof(rngdev->databuf) / sizeof(u32); - /* Start RNG */ - write_rng(TX4939_RNG_RCSR_ST, - rngdev->base, TX4939_RNG_RCSR); - wait = 0; - } - rng_io_end(); - if (!wait) - break; - /* 90 bus clock cycles by default for generation */ - ndelay(90 * 5); - } - return rngdev->data_avail; -} - -static int tx4939_rng_data_read(struct hwrng *rng, u32 *buffer) -{ - struct tx4939_rng *rngdev = container_of(rng, struct tx4939_rng, rng); - - rngdev->data_avail--; - *buffer = *((u32 *)&rngdev->databuf + rngdev->data_avail); - return sizeof(u32); -} - -static int __init tx4939_rng_probe(struct platform_device *dev) -{ - struct tx4939_rng *rngdev; - int i; - - rngdev = devm_kzalloc(&dev->dev, sizeof(*rngdev), GFP_KERNEL); - if (!rngdev) - return -ENOMEM; - rngdev->base = devm_platform_ioremap_resource(dev, 0); - if (IS_ERR(rngdev->base)) - return PTR_ERR(rngdev->base); - - rngdev->rng.name = dev_name(&dev->dev); - rngdev->rng.data_present = tx4939_rng_data_present; - rngdev->rng.data_read = tx4939_rng_data_read; - - rng_io_start(); - /* Reset RNG */ - write_rng(TX4939_RNG_RCSR_RST, rngdev->base, TX4939_RNG_RCSR); - write_rng(0, rngdev->base, TX4939_RNG_RCSR); - /* Start RNG */ - write_rng(TX4939_RNG_RCSR_ST, rngdev->base, TX4939_RNG_RCSR); - rng_io_end(); - /* - * Drop first two results. From the datasheet: - * The quality of the random numbers generated immediately - * after reset can be insufficient. Therefore, do not use - * random numbers obtained from the first and second - * generations; use the ones from the third or subsequent - * generation. - */ - for (i = 0; i < 2; i++) { - rngdev->data_avail = 0; - if (!tx4939_rng_data_present(&rngdev->rng, 1)) - return -EIO; - } - - platform_set_drvdata(dev, rngdev); - return devm_hwrng_register(&dev->dev, &rngdev->rng); -} - -static struct platform_driver tx4939_rng_driver = { - .driver = { - .name = "tx4939-rng", - }, -}; - -module_platform_driver_probe(tx4939_rng_driver, tx4939_rng_probe); - -MODULE_DESCRIPTION("H/W Random Number Generator (RNG) driver for TX4939"); -MODULE_LICENSE("GPL"); From patchwork Tue Jan 5 14:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BAA1C072B1 for ; Tue, 5 Jan 2021 14:06:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA4E122AAB for ; Tue, 5 Jan 2021 14:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729638AbhAEOFJ (ORCPT ); Tue, 5 Jan 2021 09:05:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:57644 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbhAEOFA (ORCPT ); Tue, 5 Jan 2021 09:05:00 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 79861AEC1; Tue, 5 Jan 2021 14:03:45 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 08/10] rtc: tx4939: Remove driver Date: Tue, 5 Jan 2021 15:02:53 +0100 Message-Id: <20210105140305.141401-9-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove rtc driver for it. Signed-off-by: Thomas Bogendoerfer --- drivers/rtc/Kconfig | 7 - drivers/rtc/Makefile | 1 - drivers/rtc/rtc-tx4939.c | 303 --------------------------------------- 3 files changed, 311 deletions(-) delete mode 100644 drivers/rtc/rtc-tx4939.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 6123f9f4fbc9..3b5510c9bffa 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1587,13 +1587,6 @@ config RTC_DRV_STARFIRE If you say Y here you will get support for the RTC found on Starfire systems. -config RTC_DRV_TX4939 - tristate "TX4939 SoC" - depends on SOC_TX4939 || COMPILE_TEST - help - Driver for the internal RTC (Realtime Clock) module found on - Toshiba TX4939 SoC. - config RTC_DRV_MV tristate "Marvell SoC RTC" depends on ARCH_DOVE || ARCH_MVEBU || COMPILE_TEST diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index bb8f319b09fb..a020adde4bbd 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -171,7 +171,6 @@ obj-$(CONFIG_RTC_DRV_TPS6586X) += rtc-tps6586x.o obj-$(CONFIG_RTC_DRV_TPS65910) += rtc-tps65910.o obj-$(CONFIG_RTC_DRV_TPS80031) += rtc-tps80031.o obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl.o -obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o diff --git a/drivers/rtc/rtc-tx4939.c b/drivers/rtc/rtc-tx4939.c deleted file mode 100644 index c3309db5448d..000000000000 --- a/drivers/rtc/rtc-tx4939.c +++ /dev/null @@ -1,303 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * TX4939 internal RTC driver - * Based on RBTX49xx patch from CELF patch archive. - * - * (C) Copyright TOSHIBA CORPORATION 2005-2007 - */ -#include -#include -#include -#include -#include -#include - -#define TX4939_RTCCTL_ALME 0x00000080 -#define TX4939_RTCCTL_ALMD 0x00000040 -#define TX4939_RTCCTL_BUSY 0x00000020 - -#define TX4939_RTCCTL_COMMAND 0x00000007 -#define TX4939_RTCCTL_COMMAND_NOP 0x00000000 -#define TX4939_RTCCTL_COMMAND_GETTIME 0x00000001 -#define TX4939_RTCCTL_COMMAND_SETTIME 0x00000002 -#define TX4939_RTCCTL_COMMAND_GETALARM 0x00000003 -#define TX4939_RTCCTL_COMMAND_SETALARM 0x00000004 - -#define TX4939_RTCTBC_PM 0x00000080 -#define TX4939_RTCTBC_COMP 0x0000007f - -#define TX4939_RTC_REG_RAMSIZE 0x00000100 -#define TX4939_RTC_REG_RWBSIZE 0x00000006 - -struct tx4939_rtc_reg { - __u32 ctl; - __u32 adr; - __u32 dat; - __u32 tbc; -}; - -struct tx4939rtc_plat_data { - struct rtc_device *rtc; - struct tx4939_rtc_reg __iomem *rtcreg; - spinlock_t lock; -}; - -static int tx4939_rtc_cmd(struct tx4939_rtc_reg __iomem *rtcreg, int cmd) -{ - int i = 0; - - __raw_writel(cmd, &rtcreg->ctl); - /* This might take 30us (next 32.768KHz clock) */ - while (__raw_readl(&rtcreg->ctl) & TX4939_RTCCTL_BUSY) { - /* timeout on approx. 100us (@ GBUS200MHz) */ - if (i++ > 200 * 100) - return -EBUSY; - cpu_relax(); - } - return 0; -} - -static int tx4939_rtc_set_time(struct device *dev, struct rtc_time *tm) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev); - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - unsigned long secs = rtc_tm_to_time64(tm); - int i, ret; - unsigned char buf[6]; - - buf[0] = 0; - buf[1] = 0; - buf[2] = secs; - buf[3] = secs >> 8; - buf[4] = secs >> 16; - buf[5] = secs >> 24; - spin_lock_irq(&pdata->lock); - __raw_writel(0, &rtcreg->adr); - for (i = 0; i < 6; i++) - __raw_writel(buf[i], &rtcreg->dat); - ret = tx4939_rtc_cmd(rtcreg, - TX4939_RTCCTL_COMMAND_SETTIME | - (__raw_readl(&rtcreg->ctl) & TX4939_RTCCTL_ALME)); - spin_unlock_irq(&pdata->lock); - return ret; -} - -static int tx4939_rtc_read_time(struct device *dev, struct rtc_time *tm) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev); - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - int i, ret; - unsigned long sec; - unsigned char buf[6]; - - spin_lock_irq(&pdata->lock); - ret = tx4939_rtc_cmd(rtcreg, - TX4939_RTCCTL_COMMAND_GETTIME | - (__raw_readl(&rtcreg->ctl) & TX4939_RTCCTL_ALME)); - if (ret) { - spin_unlock_irq(&pdata->lock); - return ret; - } - __raw_writel(2, &rtcreg->adr); - for (i = 2; i < 6; i++) - buf[i] = __raw_readl(&rtcreg->dat); - spin_unlock_irq(&pdata->lock); - sec = ((unsigned long)buf[5] << 24) | (buf[4] << 16) | - (buf[3] << 8) | buf[2]; - rtc_time64_to_tm(sec, tm); - return 0; -} - -static int tx4939_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev); - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - int i, ret; - unsigned long sec; - unsigned char buf[6]; - - sec = rtc_tm_to_time64(&alrm->time); - buf[0] = 0; - buf[1] = 0; - buf[2] = sec; - buf[3] = sec >> 8; - buf[4] = sec >> 16; - buf[5] = sec >> 24; - spin_lock_irq(&pdata->lock); - __raw_writel(0, &rtcreg->adr); - for (i = 0; i < 6; i++) - __raw_writel(buf[i], &rtcreg->dat); - ret = tx4939_rtc_cmd(rtcreg, TX4939_RTCCTL_COMMAND_SETALARM | - (alrm->enabled ? TX4939_RTCCTL_ALME : 0)); - spin_unlock_irq(&pdata->lock); - return ret; -} - -static int tx4939_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev); - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - int i, ret; - unsigned long sec; - unsigned char buf[6]; - u32 ctl; - - spin_lock_irq(&pdata->lock); - ret = tx4939_rtc_cmd(rtcreg, - TX4939_RTCCTL_COMMAND_GETALARM | - (__raw_readl(&rtcreg->ctl) & TX4939_RTCCTL_ALME)); - if (ret) { - spin_unlock_irq(&pdata->lock); - return ret; - } - __raw_writel(2, &rtcreg->adr); - for (i = 2; i < 6; i++) - buf[i] = __raw_readl(&rtcreg->dat); - ctl = __raw_readl(&rtcreg->ctl); - alrm->enabled = (ctl & TX4939_RTCCTL_ALME) ? 1 : 0; - alrm->pending = (ctl & TX4939_RTCCTL_ALMD) ? 1 : 0; - spin_unlock_irq(&pdata->lock); - sec = ((unsigned long)buf[5] << 24) | (buf[4] << 16) | - (buf[3] << 8) | buf[2]; - rtc_time64_to_tm(sec, &alrm->time); - return rtc_valid_tm(&alrm->time); -} - -static int tx4939_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev); - - spin_lock_irq(&pdata->lock); - tx4939_rtc_cmd(pdata->rtcreg, - TX4939_RTCCTL_COMMAND_NOP | - (enabled ? TX4939_RTCCTL_ALME : 0)); - spin_unlock_irq(&pdata->lock); - return 0; -} - -static irqreturn_t tx4939_rtc_interrupt(int irq, void *dev_id) -{ - struct tx4939rtc_plat_data *pdata = dev_get_drvdata(dev_id); - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - unsigned long events = RTC_IRQF; - - spin_lock(&pdata->lock); - if (__raw_readl(&rtcreg->ctl) & TX4939_RTCCTL_ALMD) { - events |= RTC_AF; - tx4939_rtc_cmd(rtcreg, TX4939_RTCCTL_COMMAND_NOP); - } - spin_unlock(&pdata->lock); - rtc_update_irq(pdata->rtc, 1, events); - - return IRQ_HANDLED; -} - -static const struct rtc_class_ops tx4939_rtc_ops = { - .read_time = tx4939_rtc_read_time, - .read_alarm = tx4939_rtc_read_alarm, - .set_alarm = tx4939_rtc_set_alarm, - .set_time = tx4939_rtc_set_time, - .alarm_irq_enable = tx4939_rtc_alarm_irq_enable, -}; - -static int tx4939_nvram_read(void *priv, unsigned int pos, void *val, - size_t bytes) -{ - struct tx4939rtc_plat_data *pdata = priv; - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - u8 *buf = val; - - spin_lock_irq(&pdata->lock); - for (; bytes; bytes--) { - __raw_writel(pos++, &rtcreg->adr); - *buf++ = __raw_readl(&rtcreg->dat); - } - spin_unlock_irq(&pdata->lock); - return 0; -} - -static int tx4939_nvram_write(void *priv, unsigned int pos, void *val, - size_t bytes) -{ - struct tx4939rtc_plat_data *pdata = priv; - struct tx4939_rtc_reg __iomem *rtcreg = pdata->rtcreg; - u8 *buf = val; - - spin_lock_irq(&pdata->lock); - for (; bytes; bytes--) { - __raw_writel(pos++, &rtcreg->adr); - __raw_writel(*buf++, &rtcreg->dat); - } - spin_unlock_irq(&pdata->lock); - return 0; -} - -static int __init tx4939_rtc_probe(struct platform_device *pdev) -{ - struct rtc_device *rtc; - struct tx4939rtc_plat_data *pdata; - int irq, ret; - struct nvmem_config nvmem_cfg = { - .name = "tx4939_nvram", - .size = TX4939_RTC_REG_RAMSIZE, - .reg_read = tx4939_nvram_read, - .reg_write = tx4939_nvram_write, - }; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return -ENODEV; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; - platform_set_drvdata(pdev, pdata); - - pdata->rtcreg = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(pdata->rtcreg)) - return PTR_ERR(pdata->rtcreg); - - spin_lock_init(&pdata->lock); - tx4939_rtc_cmd(pdata->rtcreg, TX4939_RTCCTL_COMMAND_NOP); - if (devm_request_irq(&pdev->dev, irq, tx4939_rtc_interrupt, - 0, pdev->name, &pdev->dev) < 0) - return -EBUSY; - rtc = devm_rtc_allocate_device(&pdev->dev); - if (IS_ERR(rtc)) - return PTR_ERR(rtc); - - rtc->ops = &tx4939_rtc_ops; - rtc->range_max = U32_MAX; - - pdata->rtc = rtc; - - nvmem_cfg.priv = pdata; - ret = devm_rtc_nvmem_register(rtc, &nvmem_cfg); - if (ret) - return ret; - - return devm_rtc_register_device(rtc); -} - -static int __exit tx4939_rtc_remove(struct platform_device *pdev) -{ - struct tx4939rtc_plat_data *pdata = platform_get_drvdata(pdev); - - spin_lock_irq(&pdata->lock); - tx4939_rtc_cmd(pdata->rtcreg, TX4939_RTCCTL_COMMAND_NOP); - spin_unlock_irq(&pdata->lock); - return 0; -} - -static struct platform_driver tx4939_rtc_driver = { - .remove = __exit_p(tx4939_rtc_remove), - .driver = { - .name = "tx4939rtc", - }, -}; - -module_platform_driver_probe(tx4939_rtc_driver, tx4939_rtc_probe); - -MODULE_AUTHOR("Atsushi Nemoto "); -MODULE_DESCRIPTION("TX4939 internal RTC driver"); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:tx4939rtc"); From patchwork Tue Jan 5 14:02:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73BF4C4332D for ; Tue, 5 Jan 2021 14:06:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BA1422AB0 for ; Tue, 5 Jan 2021 14:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730578AbhAEOFL (ORCPT ); Tue, 5 Jan 2021 09:05:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:57720 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729090AbhAEOFJ (ORCPT ); Tue, 5 Jan 2021 09:05:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6582BAF0D; Tue, 5 Jan 2021 14:03:46 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 09/10] ide: tx4938ide: Remove driver Date: Tue, 5 Jan 2021 15:02:54 +0100 Message-Id: <20210105140305.141401-10-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove IDE support for it. Signed-off-by: Thomas Bogendoerfer --- drivers/ide/Kconfig | 10 - drivers/ide/Makefile | 3 - drivers/ide/tx4938ide.c | 209 ------------- drivers/ide/tx4939ide.c | 628 ---------------------------------------- 4 files changed, 850 deletions(-) delete mode 100644 drivers/ide/tx4938ide.c delete mode 100644 drivers/ide/tx4939ide.c diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 19abf11c84c8..03303af8c96f 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -662,16 +662,6 @@ config BLK_DEV_IDE_PMAC_ATA100FIRST CD-ROM on hda. This option changes this to more natural hda for hard disk and hdc for CD-ROM. -config BLK_DEV_IDE_TX4938 - tristate "TX4938 internal IDE support" - depends on SOC_TX4938 - select IDE_TIMINGS - -config BLK_DEV_IDE_TX4939 - tristate "TX4939 internal IDE support" - depends on SOC_TX4939 - select BLK_DEV_IDEDMA_SFF - config BLK_DEV_IDE_ICSIDE tristate "ICS IDE interface support" depends on ARM && ARCH_ACORN diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 2605b3cdaf47..4d6655160a4a 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile @@ -106,6 +106,3 @@ obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o - -obj-$(CONFIG_BLK_DEV_IDE_TX4938) += tx4938ide.o -obj-$(CONFIG_BLK_DEV_IDE_TX4939) += tx4939ide.o diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c deleted file mode 100644 index 962eb92501b5..000000000000 --- a/drivers/ide/tx4938ide.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * TX4938 internal IDE driver - * Based on tx4939ide.c. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * (C) Copyright TOSHIBA CORPORATION 2005-2007 - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -static void tx4938ide_tune_ebusc(unsigned int ebus_ch, - unsigned int gbus_clock, - u8 pio) -{ - struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio); - u64 cr = __raw_readq(&tx4938_ebuscptr->cr[ebus_ch]); - unsigned int sp = (cr >> 4) & 3; - unsigned int clock = gbus_clock / (4 - sp); - unsigned int cycle = 1000000000 / clock; - unsigned int shwt; - int wt; - - /* Minimum DIOx- active time */ - wt = DIV_ROUND_UP(t->act8b, cycle) - 2; - /* IORDY setup time: 35ns */ - wt = max_t(int, wt, DIV_ROUND_UP(35, cycle)); - /* actual wait-cycle is max(wt & ~1, 1) */ - if (wt > 2 && (wt & 1)) - wt++; - wt &= ~1; - /* Address-valid to DIOR/DIOW setup */ - shwt = DIV_ROUND_UP(t->setup, cycle); - - /* -DIOx recovery time (SHWT * 4) and cycle time requirement */ - while ((shwt * 4 + wt + (wt ? 2 : 3)) * cycle < t->cycle) - shwt++; - if (shwt > 7) { - pr_warn("tx4938ide: SHWT violation (%d)\n", shwt); - shwt = 7; - } - pr_debug("tx4938ide: ebus %d, bus cycle %dns, WT %d, SHWT %d\n", - ebus_ch, cycle, wt, shwt); - - __raw_writeq((cr & ~0x3f007ull) | (wt << 12) | shwt, - &tx4938_ebuscptr->cr[ebus_ch]); -} - -static void tx4938ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) -{ - struct tx4938ide_platform_info *pdata = dev_get_platdata(hwif->dev); - u8 safe = drive->pio_mode - XFER_PIO_0; - ide_drive_t *pair; - - pair = ide_get_pair_dev(drive); - if (pair) - safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0); - tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, safe); -} - -#ifdef __BIG_ENDIAN - -/* custom iops (independent from SWAP_IO_SPACE) */ -static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, - void *buf, unsigned int len) -{ - unsigned long port = drive->hwif->io_ports.data_addr; - unsigned short *ptr = buf; - unsigned int count = (len + 1) / 2; - - while (count--) - *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); - __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); -} - -static void tx4938ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, - void *buf, unsigned int len) -{ - unsigned long port = drive->hwif->io_ports.data_addr; - unsigned short *ptr = buf; - unsigned int count = (len + 1) / 2; - - while (count--) { - __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); - ptr++; - } - __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); -} - -static const struct ide_tp_ops tx4938ide_tp_ops = { - .exec_command = ide_exec_command, - .read_status = ide_read_status, - .read_altstatus = ide_read_altstatus, - .write_devctl = ide_write_devctl, - - .dev_select = ide_dev_select, - .tf_load = ide_tf_load, - .tf_read = ide_tf_read, - - .input_data = tx4938ide_input_data_swap, - .output_data = tx4938ide_output_data_swap, -}; - -#endif /* __BIG_ENDIAN */ - -static const struct ide_port_ops tx4938ide_port_ops = { - .set_pio_mode = tx4938ide_set_pio_mode, -}; - -static const struct ide_port_info tx4938ide_port_info __initconst = { - .port_ops = &tx4938ide_port_ops, -#ifdef __BIG_ENDIAN - .tp_ops = &tx4938ide_tp_ops, -#endif - .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, - .pio_mask = ATA_PIO5, - .chipset = ide_generic, -}; - -static int __init tx4938ide_probe(struct platform_device *pdev) -{ - struct ide_hw hw, *hws[] = { &hw }; - struct ide_host *host; - struct resource *res; - struct tx4938ide_platform_info *pdata = dev_get_platdata(&pdev->dev); - int irq, ret, i; - unsigned long mapbase, mapctl; - struct ide_port_info d = tx4938ide_port_info; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - if (!devm_request_mem_region(&pdev->dev, res->start, - resource_size(res), "tx4938ide")) - return -EBUSY; - mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, - 8 << pdata->ioport_shift); - mapctl = (unsigned long)devm_ioremap(&pdev->dev, - res->start + 0x10000 + - (6 << pdata->ioport_shift), - 1 << pdata->ioport_shift); - if (!mapbase || !mapctl) - return -EBUSY; - - memset(&hw, 0, sizeof(hw)); - if (pdata->ioport_shift) { - unsigned long port = mapbase; - unsigned long ctl = mapctl; - - hw.io_ports_array[0] = port; -#ifdef __BIG_ENDIAN - port++; - ctl++; -#endif - for (i = 1; i <= 7; i++) - hw.io_ports_array[i] = - port + (i << pdata->ioport_shift); - hw.io_ports.ctl_addr = ctl; - } else - ide_std_init_ports(&hw, mapbase, mapctl); - hw.irq = irq; - hw.dev = &pdev->dev; - - pr_info("TX4938 IDE interface (base %#lx, ctl %#lx, irq %d)\n", - mapbase, mapctl, hw.irq); - if (pdata->gbus_clock) - tx4938ide_tune_ebusc(pdata->ebus_ch, pdata->gbus_clock, 0); - else - d.port_ops = NULL; - ret = ide_host_add(&d, hws, 1, &host); - if (!ret) - platform_set_drvdata(pdev, host); - return ret; -} - -static int __exit tx4938ide_remove(struct platform_device *pdev) -{ - struct ide_host *host = platform_get_drvdata(pdev); - - ide_host_remove(host); - return 0; -} - -static struct platform_driver tx4938ide_driver = { - .driver = { - .name = "tx4938ide", - }, - .remove = __exit_p(tx4938ide_remove), -}; - -module_platform_driver_probe(tx4938ide_driver, tx4938ide_probe); - -MODULE_DESCRIPTION("TX4938 internal IDE driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:tx4938ide"); diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c deleted file mode 100644 index b1bbf807bb3d..000000000000 --- a/drivers/ide/tx4939ide.c +++ /dev/null @@ -1,628 +0,0 @@ -/* - * TX4939 internal IDE driver - * Based on RBTX49xx patch from CELF patch archive. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * (C) Copyright TOSHIBA CORPORATION 2005-2007 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define MODNAME "tx4939ide" - -/* ATA Shadow Registers (8-bit except for Data which is 16-bit) */ -#define TX4939IDE_Data 0x000 -#define TX4939IDE_Error_Feature 0x001 -#define TX4939IDE_Sec 0x002 -#define TX4939IDE_LBA0 0x003 -#define TX4939IDE_LBA1 0x004 -#define TX4939IDE_LBA2 0x005 -#define TX4939IDE_DevHead 0x006 -#define TX4939IDE_Stat_Cmd 0x007 -#define TX4939IDE_AltStat_DevCtl 0x402 -/* H/W DMA Registers */ -#define TX4939IDE_DMA_Cmd 0x800 /* 8-bit */ -#define TX4939IDE_DMA_Stat 0x802 /* 8-bit */ -#define TX4939IDE_PRD_Ptr 0x804 /* 32-bit */ -/* ATA100 CORE Registers (16-bit) */ -#define TX4939IDE_Sys_Ctl 0xc00 -#define TX4939IDE_Xfer_Cnt_1 0xc08 -#define TX4939IDE_Xfer_Cnt_2 0xc0a -#define TX4939IDE_Sec_Cnt 0xc10 -#define TX4939IDE_Start_Lo_Addr 0xc18 -#define TX4939IDE_Start_Up_Addr 0xc20 -#define TX4939IDE_Add_Ctl 0xc28 -#define TX4939IDE_Lo_Burst_Cnt 0xc30 -#define TX4939IDE_Up_Burst_Cnt 0xc38 -#define TX4939IDE_PIO_Addr 0xc88 -#define TX4939IDE_H_Rst_Tim 0xc90 -#define TX4939IDE_Int_Ctl 0xc98 -#define TX4939IDE_Pkt_Cmd 0xcb8 -#define TX4939IDE_Bxfer_Cnt_Hi 0xcc0 -#define TX4939IDE_Bxfer_Cnt_Lo 0xcc8 -#define TX4939IDE_Dev_TErr 0xcd0 -#define TX4939IDE_Pkt_Xfer_Ctl 0xcd8 -#define TX4939IDE_Start_TAddr 0xce0 - -/* bits for Int_Ctl */ -#define TX4939IDE_INT_ADDRERR 0x80 -#define TX4939IDE_INT_REACHMUL 0x40 -#define TX4939IDE_INT_DEVTIMING 0x20 -#define TX4939IDE_INT_UDMATERM 0x10 -#define TX4939IDE_INT_TIMER 0x08 -#define TX4939IDE_INT_BUSERR 0x04 -#define TX4939IDE_INT_XFEREND 0x02 -#define TX4939IDE_INT_HOST 0x01 - -#define TX4939IDE_IGNORE_INTS \ - (TX4939IDE_INT_ADDRERR | TX4939IDE_INT_REACHMUL | \ - TX4939IDE_INT_DEVTIMING | TX4939IDE_INT_UDMATERM | \ - TX4939IDE_INT_TIMER | TX4939IDE_INT_XFEREND) - -#ifdef __BIG_ENDIAN -#define tx4939ide_swizzlel(a) ((a) ^ 4) -#define tx4939ide_swizzlew(a) ((a) ^ 6) -#define tx4939ide_swizzleb(a) ((a) ^ 7) -#else -#define tx4939ide_swizzlel(a) (a) -#define tx4939ide_swizzlew(a) (a) -#define tx4939ide_swizzleb(a) (a) -#endif - -static u16 tx4939ide_readw(void __iomem *base, u32 reg) -{ - return __raw_readw(base + tx4939ide_swizzlew(reg)); -} -static u8 tx4939ide_readb(void __iomem *base, u32 reg) -{ - return __raw_readb(base + tx4939ide_swizzleb(reg)); -} -static void tx4939ide_writel(u32 val, void __iomem *base, u32 reg) -{ - __raw_writel(val, base + tx4939ide_swizzlel(reg)); -} -static void tx4939ide_writew(u16 val, void __iomem *base, u32 reg) -{ - __raw_writew(val, base + tx4939ide_swizzlew(reg)); -} -static void tx4939ide_writeb(u8 val, void __iomem *base, u32 reg) -{ - __raw_writeb(val, base + tx4939ide_swizzleb(reg)); -} - -#define TX4939IDE_BASE(hwif) ((void __iomem *)(hwif)->extra_base) - -static void tx4939ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive) -{ - int is_slave = drive->dn; - u32 mask, val; - const u8 pio = drive->pio_mode - XFER_PIO_0; - u8 safe = pio; - ide_drive_t *pair; - - pair = ide_get_pair_dev(drive); - if (pair) - safe = min_t(u8, safe, pair->pio_mode - XFER_PIO_0); - /* - * Update Command Transfer Mode for master/slave and Data - * Transfer Mode for this drive. - */ - mask = is_slave ? 0x07f00000 : 0x000007f0; - val = ((safe << 8) | (pio << 4)) << (is_slave ? 16 : 0); - hwif->select_data = (hwif->select_data & ~mask) | val; - /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ -} - -static void tx4939ide_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) -{ - u32 mask, val; - const u8 mode = drive->dma_mode; - - /* Update Data Transfer Mode for this drive. */ - if (mode >= XFER_UDMA_0) - val = mode - XFER_UDMA_0 + 8; - else - val = mode - XFER_MW_DMA_0 + 5; - if (drive->dn) { - mask = 0x00f00000; - val <<= 20; - } else { - mask = 0x000000f0; - val <<= 4; - } - hwif->select_data = (hwif->select_data & ~mask) | val; - /* tx4939ide_tf_load_fixup() will set the Sys_Ctl register */ -} - -static u16 tx4939ide_check_error_ints(ide_hwif_t *hwif) -{ - void __iomem *base = TX4939IDE_BASE(hwif); - u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); - - if (ctl & TX4939IDE_INT_BUSERR) { - /* reset FIFO */ - u16 sysctl = tx4939ide_readw(base, TX4939IDE_Sys_Ctl); - - tx4939ide_writew(sysctl | 0x4000, base, TX4939IDE_Sys_Ctl); - /* wait 12GBUSCLK (typ. 60ns @ GBUS200MHz, max 270ns) */ - ndelay(270); - tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); - } - if (ctl & (TX4939IDE_INT_ADDRERR | - TX4939IDE_INT_DEVTIMING | TX4939IDE_INT_BUSERR)) - pr_err("%s: Error interrupt %#x (%s%s%s )\n", - hwif->name, ctl, - ctl & TX4939IDE_INT_ADDRERR ? " Address-Error" : "", - ctl & TX4939IDE_INT_DEVTIMING ? " DEV-Timing" : "", - ctl & TX4939IDE_INT_BUSERR ? " Bus-Error" : ""); - return ctl; -} - -static void tx4939ide_clear_irq(ide_drive_t *drive) -{ - ide_hwif_t *hwif; - void __iomem *base; - u16 ctl; - - /* - * tx4939ide_dma_test_irq() and tx4939ide_dma_end() do all job - * for DMA case. - */ - if (drive->waiting_for_dma) - return; - hwif = drive->hwif; - base = TX4939IDE_BASE(hwif); - ctl = tx4939ide_check_error_ints(hwif); - tx4939ide_writew(ctl, base, TX4939IDE_Int_Ctl); -} - -static u8 tx4939ide_cable_detect(ide_hwif_t *hwif) -{ - void __iomem *base = TX4939IDE_BASE(hwif); - - return tx4939ide_readw(base, TX4939IDE_Sys_Ctl) & 0x2000 ? - ATA_CBL_PATA40 : ATA_CBL_PATA80; -} - -#ifdef __BIG_ENDIAN -static void tx4939ide_dma_host_set(ide_drive_t *drive, int on) -{ - ide_hwif_t *hwif = drive->hwif; - u8 unit = drive->dn; - void __iomem *base = TX4939IDE_BASE(hwif); - u8 dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); - - if (on) - dma_stat |= (1 << (5 + unit)); - else - dma_stat &= ~(1 << (5 + unit)); - - tx4939ide_writeb(dma_stat, base, TX4939IDE_DMA_Stat); -} -#else -#define tx4939ide_dma_host_set ide_dma_host_set -#endif - -static u8 tx4939ide_clear_dma_status(void __iomem *base) -{ - u8 dma_stat; - - /* read DMA status for INTR & ERROR flags */ - dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); - /* clear INTR & ERROR flags */ - tx4939ide_writeb(dma_stat | ATA_DMA_INTR | ATA_DMA_ERR, base, - TX4939IDE_DMA_Stat); - /* recover intmask cleared by writing to bit2 of DMA_Stat */ - tx4939ide_writew(TX4939IDE_IGNORE_INTS << 8, base, TX4939IDE_Int_Ctl); - return dma_stat; -} - -#ifdef __BIG_ENDIAN -/* custom ide_build_dmatable to handle swapped layout */ -static int tx4939ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) -{ - ide_hwif_t *hwif = drive->hwif; - u32 *table = (u32 *)hwif->dmatable_cpu; - unsigned int count = 0; - int i; - struct scatterlist *sg; - - for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { - u32 cur_addr, cur_len, bcount; - - cur_addr = sg_dma_address(sg); - cur_len = sg_dma_len(sg); - - /* - * Fill in the DMA table, without crossing any 64kB boundaries. - */ - - while (cur_len) { - if (count++ >= PRD_ENTRIES) - goto use_pio_instead; - - bcount = 0x10000 - (cur_addr & 0xffff); - if (bcount > cur_len) - bcount = cur_len; - /* - * This workaround for zero count seems required. - * (standard ide_build_dmatable does it too) - */ - if (bcount == 0x10000) - bcount = 0x8000; - *table++ = bcount & 0xffff; - *table++ = cur_addr; - cur_addr += bcount; - cur_len -= bcount; - } - } - - if (count) { - *(table - 2) |= 0x80000000; - return count; - } - -use_pio_instead: - printk(KERN_ERR "%s: %s\n", drive->name, - count ? "DMA table too small" : "empty DMA table?"); - - return 0; /* revert to PIO for this request */ -} -#else -#define tx4939ide_build_dmatable ide_build_dmatable -#endif - -static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) -{ - ide_hwif_t *hwif = drive->hwif; - void __iomem *base = TX4939IDE_BASE(hwif); - u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; - - /* fall back to PIO! */ - if (tx4939ide_build_dmatable(drive, cmd) == 0) - return 1; - - /* PRD table */ - tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); - - /* specify r/w */ - tx4939ide_writeb(rw, base, TX4939IDE_DMA_Cmd); - - /* clear INTR & ERROR flags */ - tx4939ide_clear_dma_status(base); - - tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? - TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); - - tx4939ide_writew(blk_rq_sectors(cmd->rq), base, TX4939IDE_Sec_Cnt); - - return 0; -} - -static int tx4939ide_dma_end(ide_drive_t *drive) -{ - ide_hwif_t *hwif = drive->hwif; - u8 dma_stat, dma_cmd; - void __iomem *base = TX4939IDE_BASE(hwif); - u16 ctl = tx4939ide_readw(base, TX4939IDE_Int_Ctl); - - /* get DMA command mode */ - dma_cmd = tx4939ide_readb(base, TX4939IDE_DMA_Cmd); - /* stop DMA */ - tx4939ide_writeb(dma_cmd & ~ATA_DMA_START, base, TX4939IDE_DMA_Cmd); - - /* read and clear the INTR & ERROR bits */ - dma_stat = tx4939ide_clear_dma_status(base); - -#define CHECK_DMA_MASK (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR) - - /* verify good DMA status */ - if ((dma_stat & CHECK_DMA_MASK) == 0 && - (ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) == - (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST)) - /* INT_IDE lost... bug? */ - return 0; - return ((dma_stat & CHECK_DMA_MASK) != - ATA_DMA_INTR) ? 0x10 | dma_stat : 0; -} - -/* returns 1 if DMA IRQ issued, 0 otherwise */ -static int tx4939ide_dma_test_irq(ide_drive_t *drive) -{ - ide_hwif_t *hwif = drive->hwif; - void __iomem *base = TX4939IDE_BASE(hwif); - u16 ctl, ide_int; - u8 dma_stat, stat; - int found = 0; - - ctl = tx4939ide_check_error_ints(hwif); - ide_int = ctl & (TX4939IDE_INT_XFEREND | TX4939IDE_INT_HOST); - switch (ide_int) { - case TX4939IDE_INT_HOST: - /* On error, XFEREND might not be asserted. */ - stat = tx4939ide_readb(base, TX4939IDE_AltStat_DevCtl); - if ((stat & (ATA_BUSY | ATA_DRQ | ATA_ERR)) == ATA_ERR) - found = 1; - else - /* Wait for XFEREND (Mask HOST and unmask XFEREND) */ - ctl &= ~TX4939IDE_INT_XFEREND << 8; - ctl |= ide_int << 8; - break; - case TX4939IDE_INT_HOST | TX4939IDE_INT_XFEREND: - dma_stat = tx4939ide_readb(base, TX4939IDE_DMA_Stat); - if (!(dma_stat & ATA_DMA_INTR)) - pr_warn("%s: weird interrupt status. " - "DMA_Stat %#02x int_ctl %#04x\n", - hwif->name, dma_stat, ctl); - found = 1; - break; - } - /* - * Do not clear XFEREND, HOST now. They will be cleared by - * clearing bit2 of DMA_Stat. - */ - ctl &= ~ide_int; - tx4939ide_writew(ctl, base, TX4939IDE_Int_Ctl); - return found; -} - -#ifdef __BIG_ENDIAN -static u8 tx4939ide_dma_sff_read_status(ide_hwif_t *hwif) -{ - void __iomem *base = TX4939IDE_BASE(hwif); - - return tx4939ide_readb(base, TX4939IDE_DMA_Stat); -} -#else -#define tx4939ide_dma_sff_read_status ide_dma_sff_read_status -#endif - -static void tx4939ide_init_hwif(ide_hwif_t *hwif) -{ - void __iomem *base = TX4939IDE_BASE(hwif); - - /* Soft Reset */ - tx4939ide_writew(0x8000, base, TX4939IDE_Sys_Ctl); - /* at least 20 GBUSCLK (typ. 100ns @ GBUS200MHz, max 450ns) */ - ndelay(450); - tx4939ide_writew(0x0000, base, TX4939IDE_Sys_Ctl); - /* mask some interrupts and clear all interrupts */ - tx4939ide_writew((TX4939IDE_IGNORE_INTS << 8) | 0xff, base, - TX4939IDE_Int_Ctl); - - tx4939ide_writew(0x0008, base, TX4939IDE_Lo_Burst_Cnt); - tx4939ide_writew(0, base, TX4939IDE_Up_Burst_Cnt); -} - -static int tx4939ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d) -{ - hwif->dma_base = - hwif->extra_base + tx4939ide_swizzleb(TX4939IDE_DMA_Cmd); - /* - * Note that we cannot use ATA_DMA_TABLE_OFS, ATA_DMA_STATUS - * for big endian. - */ - return ide_allocate_dma_engine(hwif); -} - -static void tx4939ide_tf_load_fixup(ide_drive_t *drive) -{ - ide_hwif_t *hwif = drive->hwif; - void __iomem *base = TX4939IDE_BASE(hwif); - u16 sysctl = hwif->select_data >> (drive->dn ? 16 : 0); - - /* - * Fix ATA100 CORE System Control Register. (The write to the - * Device/Head register may write wrong data to the System - * Control Register) - * While Sys_Ctl is written here, dev_select() is not needed. - */ - tx4939ide_writew(sysctl, base, TX4939IDE_Sys_Ctl); -} - -static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, - u8 valid) -{ - ide_tf_load(drive, tf, valid); - - if (valid & IDE_VALID_DEVICE) - tx4939ide_tf_load_fixup(drive); -} - -#ifdef __BIG_ENDIAN - -/* custom iops (independent from SWAP_IO_SPACE) */ -static void tx4939ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, - void *buf, unsigned int len) -{ - unsigned long port = drive->hwif->io_ports.data_addr; - unsigned short *ptr = buf; - unsigned int count = (len + 1) / 2; - - while (count--) - *ptr++ = cpu_to_le16(__raw_readw((void __iomem *)port)); - __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); -} - -static void tx4939ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, - void *buf, unsigned int len) -{ - unsigned long port = drive->hwif->io_ports.data_addr; - unsigned short *ptr = buf; - unsigned int count = (len + 1) / 2; - - while (count--) { - __raw_writew(le16_to_cpu(*ptr), (void __iomem *)port); - ptr++; - } - __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); -} - -static const struct ide_tp_ops tx4939ide_tp_ops = { - .exec_command = ide_exec_command, - .read_status = ide_read_status, - .read_altstatus = ide_read_altstatus, - .write_devctl = ide_write_devctl, - - .dev_select = ide_dev_select, - .tf_load = tx4939ide_tf_load, - .tf_read = ide_tf_read, - - .input_data = tx4939ide_input_data_swap, - .output_data = tx4939ide_output_data_swap, -}; - -#else /* __LITTLE_ENDIAN */ - -static const struct ide_tp_ops tx4939ide_tp_ops = { - .exec_command = ide_exec_command, - .read_status = ide_read_status, - .read_altstatus = ide_read_altstatus, - .write_devctl = ide_write_devctl, - - .dev_select = ide_dev_select, - .tf_load = tx4939ide_tf_load, - .tf_read = ide_tf_read, - - .input_data = ide_input_data, - .output_data = ide_output_data, -}; - -#endif /* __LITTLE_ENDIAN */ - -static const struct ide_port_ops tx4939ide_port_ops = { - .set_pio_mode = tx4939ide_set_pio_mode, - .set_dma_mode = tx4939ide_set_dma_mode, - .clear_irq = tx4939ide_clear_irq, - .cable_detect = tx4939ide_cable_detect, -}; - -static const struct ide_dma_ops tx4939ide_dma_ops = { - .dma_host_set = tx4939ide_dma_host_set, - .dma_setup = tx4939ide_dma_setup, - .dma_start = ide_dma_start, - .dma_end = tx4939ide_dma_end, - .dma_test_irq = tx4939ide_dma_test_irq, - .dma_lost_irq = ide_dma_lost_irq, - .dma_timer_expiry = ide_dma_sff_timer_expiry, - .dma_sff_read_status = tx4939ide_dma_sff_read_status, -}; - -static const struct ide_port_info tx4939ide_port_info __initconst = { - .init_hwif = tx4939ide_init_hwif, - .init_dma = tx4939ide_init_dma, - .port_ops = &tx4939ide_port_ops, - .dma_ops = &tx4939ide_dma_ops, - .tp_ops = &tx4939ide_tp_ops, - .host_flags = IDE_HFLAG_MMIO, - .pio_mask = ATA_PIO4, - .mwdma_mask = ATA_MWDMA2, - .udma_mask = ATA_UDMA5, - .chipset = ide_generic, -}; - -static int __init tx4939ide_probe(struct platform_device *pdev) -{ - struct ide_hw hw, *hws[] = { &hw }; - struct ide_host *host; - struct resource *res; - int irq, ret; - unsigned long mapbase; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return -ENODEV; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - if (!devm_request_mem_region(&pdev->dev, res->start, - resource_size(res), MODNAME)) - return -EBUSY; - mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, - resource_size(res)); - if (!mapbase) - return -EBUSY; - memset(&hw, 0, sizeof(hw)); - hw.io_ports.data_addr = - mapbase + tx4939ide_swizzlew(TX4939IDE_Data); - hw.io_ports.error_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_Error_Feature); - hw.io_ports.nsect_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_Sec); - hw.io_ports.lbal_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_LBA0); - hw.io_ports.lbam_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_LBA1); - hw.io_ports.lbah_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_LBA2); - hw.io_ports.device_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_DevHead); - hw.io_ports.command_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_Stat_Cmd); - hw.io_ports.ctl_addr = - mapbase + tx4939ide_swizzleb(TX4939IDE_AltStat_DevCtl); - hw.irq = irq; - hw.dev = &pdev->dev; - - pr_info("TX4939 IDE interface (base %#lx, irq %d)\n", mapbase, irq); - host = ide_host_alloc(&tx4939ide_port_info, hws, 1); - if (!host) - return -ENOMEM; - /* use extra_base for base address of the all registers */ - host->ports[0]->extra_base = mapbase; - ret = ide_host_register(host, &tx4939ide_port_info, hws); - if (ret) { - ide_host_free(host); - return ret; - } - platform_set_drvdata(pdev, host); - return 0; -} - -static int __exit tx4939ide_remove(struct platform_device *pdev) -{ - struct ide_host *host = platform_get_drvdata(pdev); - - ide_host_remove(host); - return 0; -} - -#ifdef CONFIG_PM -static int tx4939ide_resume(struct platform_device *dev) -{ - struct ide_host *host = platform_get_drvdata(dev); - ide_hwif_t *hwif = host->ports[0]; - - tx4939ide_init_hwif(hwif); - return 0; -} -#else -#define tx4939ide_resume NULL -#endif - -static struct platform_driver tx4939ide_driver = { - .driver = { - .name = MODNAME, - }, - .remove = __exit_p(tx4939ide_remove), - .resume = tx4939ide_resume, -}; - -module_platform_driver_probe(tx4939ide_driver, tx4939ide_probe); - -MODULE_DESCRIPTION("TX4939 internal IDE driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:tx4939ide"); From patchwork Tue Jan 5 14:02:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Bogendoerfer X-Patchwork-Id: 11998993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA66C4361A for ; Tue, 5 Jan 2021 14:06:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 464AA22AAB for ; Tue, 5 Jan 2021 14:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730645AbhAEOFn (ORCPT ); Tue, 5 Jan 2021 09:05:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:57716 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728968AbhAEOFJ (ORCPT ); Tue, 5 Jan 2021 09:05:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A4388AEFE; Tue, 5 Jan 2021 14:03:47 +0000 (UTC) From: Thomas Bogendoerfer To: Matt Mackall , Herbert Xu , Dan Williams , Vinod Koul , "David S. Miller" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Jakub Kicinski , Alessandro Zummo , Alexandre Belloni , Mark Brown , Wim Van Sebroeck , Guenter Roeck , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-ide@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, linux-rtc@vger.kernel.org, linux-spi@vger.kernel.org, linux-watchdog@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH 10/10] ASoC: txx9: Remove driver Date: Tue, 5 Jan 2021 15:02:55 +0100 Message-Id: <20210105140305.141401-11-tsbogend@alpha.franken.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105140305.141401-1-tsbogend@alpha.franken.de> References: <20210105140305.141401-1-tsbogend@alpha.franken.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org CPU support for TX49xx is getting removed, so remove sound support for it. Signed-off-by: Thomas Bogendoerfer --- sound/soc/Kconfig | 1 - sound/soc/Makefile | 1 - sound/soc/txx9/Kconfig | 30 --- sound/soc/txx9/Makefile | 12 - sound/soc/txx9/txx9aclc-ac97.c | 230 ---------------- sound/soc/txx9/txx9aclc-generic.c | 88 ------- sound/soc/txx9/txx9aclc.c | 422 ------------------------------ sound/soc/txx9/txx9aclc.h | 71 ----- 8 files changed, 855 deletions(-) delete mode 100644 sound/soc/txx9/Kconfig delete mode 100644 sound/soc/txx9/Makefile delete mode 100644 sound/soc/txx9/txx9aclc-ac97.c delete mode 100644 sound/soc/txx9/txx9aclc-generic.c delete mode 100644 sound/soc/txx9/txx9aclc.c delete mode 100644 sound/soc/txx9/txx9aclc.h diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 71a6fe87d1a1..47da9ce17693 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -71,7 +71,6 @@ source "sound/soc/stm/Kconfig" source "sound/soc/sunxi/Kconfig" source "sound/soc/tegra/Kconfig" source "sound/soc/ti/Kconfig" -source "sound/soc/txx9/Kconfig" source "sound/soc/uniphier/Kconfig" source "sound/soc/ux500/Kconfig" source "sound/soc/xilinx/Kconfig" diff --git a/sound/soc/Makefile b/sound/soc/Makefile index ddbac3a2169f..508dbaa1814e 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile @@ -54,7 +54,6 @@ obj-$(CONFIG_SND_SOC) += stm/ obj-$(CONFIG_SND_SOC) += sunxi/ obj-$(CONFIG_SND_SOC) += tegra/ obj-$(CONFIG_SND_SOC) += ti/ -obj-$(CONFIG_SND_SOC) += txx9/ obj-$(CONFIG_SND_SOC) += uniphier/ obj-$(CONFIG_SND_SOC) += ux500/ obj-$(CONFIG_SND_SOC) += xilinx/ diff --git a/sound/soc/txx9/Kconfig b/sound/soc/txx9/Kconfig deleted file mode 100644 index d928edf9f5a9..000000000000 --- a/sound/soc/txx9/Kconfig +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -## -## TXx9 ACLC -## -config SND_SOC_TXX9ACLC - tristate "SoC Audio for TXx9" - depends on HAS_TXX9_ACLC && TXX9_DMAC - help - This option enables support for the AC Link Controllers in TXx9 SoC. - -config HAS_TXX9_ACLC - bool - -config SND_SOC_TXX9ACLC_AC97 - tristate - select AC97_BUS - select SND_AC97_CODEC - select SND_SOC_AC97_BUS - - -## -## Boards -## -config SND_SOC_TXX9ACLC_GENERIC - tristate "Generic TXx9 ACLC sound machine" - depends on SND_SOC_TXX9ACLC - select SND_SOC_TXX9ACLC_AC97 - select SND_SOC_AC97_CODEC - help - This is a generic AC97 sound machine for use in TXx9 based systems. diff --git a/sound/soc/txx9/Makefile b/sound/soc/txx9/Makefile deleted file mode 100644 index 37ad833eb329..000000000000 --- a/sound/soc/txx9/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# Platform -snd-soc-txx9aclc-objs := txx9aclc.o -snd-soc-txx9aclc-ac97-objs := txx9aclc-ac97.o - -obj-$(CONFIG_SND_SOC_TXX9ACLC) += snd-soc-txx9aclc.o -obj-$(CONFIG_SND_SOC_TXX9ACLC_AC97) += snd-soc-txx9aclc-ac97.o - -# Machine -snd-soc-txx9aclc-generic-objs := txx9aclc-generic.o - -obj-$(CONFIG_SND_SOC_TXX9ACLC_GENERIC) += snd-soc-txx9aclc-generic.o diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c deleted file mode 100644 index d9e348444bd0..000000000000 --- a/sound/soc/txx9/txx9aclc-ac97.c +++ /dev/null @@ -1,230 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * TXx9 ACLC AC97 driver - * - * Copyright (C) 2009 Atsushi Nemoto - * - * Based on RBTX49xx patch from CELF patch archive. - * (C) Copyright TOSHIBA CORPORATION 2004-2006 - */ - -#include -#include -#include -#include -#include -#include -#include /* for TXX9_DIRECTMAP_BASE */ -#include -#include -#include -#include "txx9aclc.h" - -#define AC97_DIR \ - (SND_SOC_DAIDIR_PLAYBACK | SND_SOC_DAIDIR_CAPTURE) - -#define AC97_RATES \ - SNDRV_PCM_RATE_8000_48000 - -#ifdef __BIG_ENDIAN -#define AC97_FMTS SNDRV_PCM_FMTBIT_S16_BE -#else -#define AC97_FMTS SNDRV_PCM_FMTBIT_S16_LE -#endif - -static DECLARE_WAIT_QUEUE_HEAD(ac97_waitq); - -/* REVISIT: How to find txx9aclc_drvdata from snd_ac97? */ -static struct txx9aclc_plat_drvdata *txx9aclc_drvdata; - -static int txx9aclc_regready(struct txx9aclc_plat_drvdata *drvdata) -{ - return __raw_readl(drvdata->base + ACINTSTS) & ACINT_REGACCRDY; -} - -/* AC97 controller reads codec register */ -static unsigned short txx9aclc_ac97_read(struct snd_ac97 *ac97, - unsigned short reg) -{ - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - u32 dat; - - if (!(__raw_readl(base + ACINTSTS) & ACINT_CODECRDY(ac97->num))) - return 0xffff; - reg |= ac97->num << 7; - dat = (reg << ACREGACC_REG_SHIFT) | ACREGACC_READ; - __raw_writel(dat, base + ACREGACC); - __raw_writel(ACINT_REGACCRDY, base + ACINTEN); - if (!wait_event_timeout(ac97_waitq, txx9aclc_regready(txx9aclc_drvdata), HZ)) { - __raw_writel(ACINT_REGACCRDY, base + ACINTDIS); - printk(KERN_ERR "ac97 read timeout (reg %#x)\n", reg); - dat = 0xffff; - goto done; - } - dat = __raw_readl(base + ACREGACC); - if (((dat >> ACREGACC_REG_SHIFT) & 0xff) != reg) { - printk(KERN_ERR "reg mismatch %x with %x\n", - dat, reg); - dat = 0xffff; - goto done; - } - dat = (dat >> ACREGACC_DAT_SHIFT) & 0xffff; -done: - __raw_writel(ACINT_REGACCRDY, base + ACINTDIS); - return dat; -} - -/* AC97 controller writes to codec register */ -static void txx9aclc_ac97_write(struct snd_ac97 *ac97, unsigned short reg, - unsigned short val) -{ - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - - __raw_writel(((reg | (ac97->num << 7)) << ACREGACC_REG_SHIFT) | - (val << ACREGACC_DAT_SHIFT), - base + ACREGACC); - __raw_writel(ACINT_REGACCRDY, base + ACINTEN); - if (!wait_event_timeout(ac97_waitq, txx9aclc_regready(txx9aclc_drvdata), HZ)) { - printk(KERN_ERR - "ac97 write timeout (reg %#x)\n", reg); - } - __raw_writel(ACINT_REGACCRDY, base + ACINTDIS); -} - -static void txx9aclc_ac97_cold_reset(struct snd_ac97 *ac97) -{ - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - u32 ready = ACINT_CODECRDY(ac97->num) | ACINT_REGACCRDY; - - __raw_writel(ACCTL_ENLINK, base + ACCTLDIS); - udelay(1); - __raw_writel(ACCTL_ENLINK, base + ACCTLEN); - /* wait for primary codec ready status */ - __raw_writel(ready, base + ACINTEN); - if (!wait_event_timeout(ac97_waitq, - (__raw_readl(base + ACINTSTS) & ready) == ready, - HZ)) { - dev_err(&ac97->dev, "primary codec is not ready " - "(status %#x)\n", - __raw_readl(base + ACINTSTS)); - } - __raw_writel(ACINT_REGACCRDY, base + ACINTSTS); - __raw_writel(ready, base + ACINTDIS); -} - -/* AC97 controller operations */ -static struct snd_ac97_bus_ops txx9aclc_ac97_ops = { - .read = txx9aclc_ac97_read, - .write = txx9aclc_ac97_write, - .reset = txx9aclc_ac97_cold_reset, -}; - -static irqreturn_t txx9aclc_ac97_irq(int irq, void *dev_id) -{ - struct txx9aclc_plat_drvdata *drvdata = dev_id; - void __iomem *base = drvdata->base; - - __raw_writel(__raw_readl(base + ACINTMSTS), base + ACINTDIS); - wake_up(&ac97_waitq); - return IRQ_HANDLED; -} - -static int txx9aclc_ac97_probe(struct snd_soc_dai *dai) -{ - txx9aclc_drvdata = snd_soc_dai_get_drvdata(dai); - return 0; -} - -static int txx9aclc_ac97_remove(struct snd_soc_dai *dai) -{ - struct txx9aclc_plat_drvdata *drvdata = snd_soc_dai_get_drvdata(dai); - - /* disable AC-link */ - __raw_writel(ACCTL_ENLINK, drvdata->base + ACCTLDIS); - txx9aclc_drvdata = NULL; - return 0; -} - -static struct snd_soc_dai_driver txx9aclc_ac97_dai = { - .probe = txx9aclc_ac97_probe, - .remove = txx9aclc_ac97_remove, - .playback = { - .rates = AC97_RATES, - .formats = AC97_FMTS, - .channels_min = 2, - .channels_max = 2, - }, - .capture = { - .rates = AC97_RATES, - .formats = AC97_FMTS, - .channels_min = 2, - .channels_max = 2, - }, -}; - -static const struct snd_soc_component_driver txx9aclc_ac97_component = { - .name = "txx9aclc-ac97", -}; - -static int txx9aclc_ac97_dev_probe(struct platform_device *pdev) -{ - struct txx9aclc_plat_drvdata *drvdata; - struct resource *r; - int err; - int irq; - - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; - - drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); - if (!drvdata) - return -ENOMEM; - - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - drvdata->base = devm_ioremap_resource(&pdev->dev, r); - if (IS_ERR(drvdata->base)) - return PTR_ERR(drvdata->base); - - platform_set_drvdata(pdev, drvdata); - drvdata->physbase = r->start; - if (sizeof(drvdata->physbase) > sizeof(r->start) && - r->start >= TXX9_DIRECTMAP_BASE && - r->start < TXX9_DIRECTMAP_BASE + 0x400000) - drvdata->physbase |= 0xf00000000ull; - err = devm_request_irq(&pdev->dev, irq, txx9aclc_ac97_irq, - 0, dev_name(&pdev->dev), drvdata); - if (err < 0) - return err; - - err = snd_soc_set_ac97_ops(&txx9aclc_ac97_ops); - if (err < 0) - return err; - - return devm_snd_soc_register_component(&pdev->dev, &txx9aclc_ac97_component, - &txx9aclc_ac97_dai, 1); -} - -static int txx9aclc_ac97_dev_remove(struct platform_device *pdev) -{ - snd_soc_set_ac97_ops(NULL); - return 0; -} - -static struct platform_driver txx9aclc_ac97_driver = { - .probe = txx9aclc_ac97_dev_probe, - .remove = txx9aclc_ac97_dev_remove, - .driver = { - .name = "txx9aclc-ac97", - }, -}; - -module_platform_driver(txx9aclc_ac97_driver); - -MODULE_AUTHOR("Atsushi Nemoto "); -MODULE_DESCRIPTION("TXx9 ACLC AC97 driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:txx9aclc-ac97"); diff --git a/sound/soc/txx9/txx9aclc-generic.c b/sound/soc/txx9/txx9aclc-generic.c deleted file mode 100644 index d6893721ba1d..000000000000 --- a/sound/soc/txx9/txx9aclc-generic.c +++ /dev/null @@ -1,88 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Generic TXx9 ACLC machine driver - * - * Copyright (C) 2009 Atsushi Nemoto - * - * Based on RBTX49xx patch from CELF patch archive. - * (C) Copyright TOSHIBA CORPORATION 2004-2006 - * - * This is a very generic AC97 sound machine driver for boards which - * have (AC97) audio at ACLC (e.g. RBTX49XX boards). - */ - -#include -#include -#include -#include -#include -#include "txx9aclc.h" - -SND_SOC_DAILINK_DEFS(hifi, - DAILINK_COMP_ARRAY(COMP_CPU("txx9aclc-ac97")), - DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")), - DAILINK_COMP_ARRAY(COMP_PLATFORM("txx9aclc-pcm-audio"))); - -static struct snd_soc_dai_link txx9aclc_generic_dai = { - .name = "AC97", - .stream_name = "AC97 HiFi", - SND_SOC_DAILINK_REG(hifi), -}; - -static struct snd_soc_card txx9aclc_generic_card = { - .name = "Generic TXx9 ACLC Audio", - .owner = THIS_MODULE, - .dai_link = &txx9aclc_generic_dai, - .num_links = 1, -}; - -static struct platform_device *soc_pdev; - -static int __init txx9aclc_generic_probe(struct platform_device *pdev) -{ - int ret; - - soc_pdev = platform_device_alloc("soc-audio", -1); - if (!soc_pdev) - return -ENOMEM; - platform_set_drvdata(soc_pdev, &txx9aclc_generic_card); - ret = platform_device_add(soc_pdev); - if (ret) { - platform_device_put(soc_pdev); - return ret; - } - - return 0; -} - -static int __exit txx9aclc_generic_remove(struct platform_device *pdev) -{ - platform_device_unregister(soc_pdev); - return 0; -} - -static struct platform_driver txx9aclc_generic_driver = { - .remove = __exit_p(txx9aclc_generic_remove), - .driver = { - .name = "txx9aclc-generic", - }, -}; - -static int __init txx9aclc_generic_init(void) -{ - return platform_driver_probe(&txx9aclc_generic_driver, - txx9aclc_generic_probe); -} - -static void __exit txx9aclc_generic_exit(void) -{ - platform_driver_unregister(&txx9aclc_generic_driver); -} - -module_init(txx9aclc_generic_init); -module_exit(txx9aclc_generic_exit); - -MODULE_AUTHOR("Atsushi Nemoto "); -MODULE_DESCRIPTION("Generic TXx9 ACLC ALSA SoC audio driver"); -MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:txx9aclc-generic"); diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c deleted file mode 100644 index 1d2d0d9b57b0..000000000000 --- a/sound/soc/txx9/txx9aclc.c +++ /dev/null @@ -1,422 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Generic TXx9 ACLC platform driver - * - * Copyright (C) 2009 Atsushi Nemoto - * - * Based on RBTX49xx patch from CELF patch archive. - * (C) Copyright TOSHIBA CORPORATION 2004-2006 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "txx9aclc.h" - -#define DRV_NAME "txx9aclc" - -static struct txx9aclc_soc_device { - struct txx9aclc_dmadata dmadata[2]; -} txx9aclc_soc_device; - -/* REVISIT: How to find txx9aclc_drvdata from snd_ac97? */ -static struct txx9aclc_plat_drvdata *txx9aclc_drvdata; - -static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, - struct txx9aclc_dmadata *dmadata); - -static const struct snd_pcm_hardware txx9aclc_pcm_hardware = { - /* - * REVISIT: SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID - * needs more works for noncoherent MIPS. - */ - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_BATCH | - SNDRV_PCM_INFO_PAUSE, - .period_bytes_min = 1024, - .period_bytes_max = 8 * 1024, - .periods_min = 2, - .periods_max = 4096, - .buffer_bytes_max = 32 * 1024, -}; - -static int txx9aclc_pcm_hw_params(struct snd_soc_component *component, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct txx9aclc_dmadata *dmadata = runtime->private_data; - - dev_dbg(component->dev, - "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " - "runtime->min_align %ld\n", - (unsigned long)runtime->dma_area, - (unsigned long)runtime->dma_addr, runtime->dma_bytes, - runtime->min_align); - dev_dbg(component->dev, - "periods %d period_bytes %d stream %d\n", - params_periods(params), params_period_bytes(params), - substream->stream); - - dmadata->substream = substream; - dmadata->pos = 0; - return 0; -} - -static int txx9aclc_pcm_prepare(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime = substream->runtime; - struct txx9aclc_dmadata *dmadata = runtime->private_data; - - dmadata->dma_addr = runtime->dma_addr; - dmadata->buffer_bytes = snd_pcm_lib_buffer_bytes(substream); - dmadata->period_bytes = snd_pcm_lib_period_bytes(substream); - - if (dmadata->buffer_bytes == dmadata->period_bytes) { - dmadata->frag_bytes = dmadata->period_bytes >> 1; - dmadata->frags = 2; - } else { - dmadata->frag_bytes = dmadata->period_bytes; - dmadata->frags = dmadata->buffer_bytes / dmadata->period_bytes; - } - dmadata->frag_count = 0; - dmadata->pos = 0; - return 0; -} - -static void txx9aclc_dma_complete(void *arg) -{ - struct txx9aclc_dmadata *dmadata = arg; - unsigned long flags; - - /* dma completion handler cannot submit new operations */ - spin_lock_irqsave(&dmadata->dma_lock, flags); - if (dmadata->frag_count >= 0) { - dmadata->dmacount--; - if (!WARN_ON(dmadata->dmacount < 0)) - queue_work(system_highpri_wq, &dmadata->work); - } - spin_unlock_irqrestore(&dmadata->dma_lock, flags); -} - -static struct dma_async_tx_descriptor * -txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr) -{ - struct dma_chan *chan = dmadata->dma_chan; - struct dma_async_tx_descriptor *desc; - struct scatterlist sg; - - sg_init_table(&sg, 1); - sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf_dma_addr)), - dmadata->frag_bytes, buf_dma_addr & (PAGE_SIZE - 1)); - sg_dma_address(&sg) = buf_dma_addr; - desc = dmaengine_prep_slave_sg(chan, &sg, 1, - dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); - if (!desc) { - dev_err(&chan->dev->device, "cannot prepare slave dma\n"); - return NULL; - } - desc->callback = txx9aclc_dma_complete; - desc->callback_param = dmadata; - dmaengine_submit(desc); - return desc; -} - -#define NR_DMA_CHAIN 2 - -static void txx9aclc_dma_work(struct work_struct *work) -{ - struct txx9aclc_dmadata *dmadata = - container_of(work, struct txx9aclc_dmadata, work); - struct dma_chan *chan = dmadata->dma_chan; - struct dma_async_tx_descriptor *desc; - struct snd_pcm_substream *substream = dmadata->substream; - u32 ctlbit = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - ACCTL_AUDODMA : ACCTL_AUDIDMA; - int i; - unsigned long flags; - - spin_lock_irqsave(&dmadata->dma_lock, flags); - if (dmadata->frag_count < 0) { - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - - spin_unlock_irqrestore(&dmadata->dma_lock, flags); - dmaengine_terminate_all(chan); - /* first time */ - for (i = 0; i < NR_DMA_CHAIN; i++) { - desc = txx9aclc_dma_submit(dmadata, - dmadata->dma_addr + i * dmadata->frag_bytes); - if (!desc) - return; - } - dmadata->dmacount = NR_DMA_CHAIN; - dma_async_issue_pending(chan); - spin_lock_irqsave(&dmadata->dma_lock, flags); - __raw_writel(ctlbit, base + ACCTLEN); - dmadata->frag_count = NR_DMA_CHAIN % dmadata->frags; - spin_unlock_irqrestore(&dmadata->dma_lock, flags); - return; - } - if (WARN_ON(dmadata->dmacount >= NR_DMA_CHAIN)) { - spin_unlock_irqrestore(&dmadata->dma_lock, flags); - return; - } - while (dmadata->dmacount < NR_DMA_CHAIN) { - dmadata->dmacount++; - spin_unlock_irqrestore(&dmadata->dma_lock, flags); - desc = txx9aclc_dma_submit(dmadata, - dmadata->dma_addr + - dmadata->frag_count * dmadata->frag_bytes); - if (!desc) - return; - dma_async_issue_pending(chan); - - spin_lock_irqsave(&dmadata->dma_lock, flags); - dmadata->frag_count++; - dmadata->frag_count %= dmadata->frags; - dmadata->pos += dmadata->frag_bytes; - dmadata->pos %= dmadata->buffer_bytes; - if ((dmadata->frag_count * dmadata->frag_bytes) % - dmadata->period_bytes == 0) - snd_pcm_period_elapsed(substream); - } - spin_unlock_irqrestore(&dmadata->dma_lock, flags); -} - -static int txx9aclc_pcm_trigger(struct snd_soc_component *component, - struct snd_pcm_substream *substream, int cmd) -{ - struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - unsigned long flags; - int ret = 0; - u32 ctlbit = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? - ACCTL_AUDODMA : ACCTL_AUDIDMA; - - spin_lock_irqsave(&dmadata->dma_lock, flags); - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - dmadata->frag_count = -1; - queue_work(system_highpri_wq, &dmadata->work); - break; - case SNDRV_PCM_TRIGGER_STOP: - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - case SNDRV_PCM_TRIGGER_SUSPEND: - __raw_writel(ctlbit, base + ACCTLDIS); - break; - case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: - case SNDRV_PCM_TRIGGER_RESUME: - __raw_writel(ctlbit, base + ACCTLEN); - break; - default: - ret = -EINVAL; - } - spin_unlock_irqrestore(&dmadata->dma_lock, flags); - return ret; -} - -static snd_pcm_uframes_t -txx9aclc_pcm_pointer(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; - - return bytes_to_frames(substream->runtime, dmadata->pos); -} - -static int txx9aclc_pcm_open(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct txx9aclc_soc_device *dev = &txx9aclc_soc_device; - struct txx9aclc_dmadata *dmadata = &dev->dmadata[substream->stream]; - int ret; - - ret = snd_soc_set_runtime_hwparams(substream, &txx9aclc_pcm_hardware); - if (ret) - return ret; - /* ensure that buffer size is a multiple of period size */ - ret = snd_pcm_hw_constraint_integer(substream->runtime, - SNDRV_PCM_HW_PARAM_PERIODS); - if (ret < 0) - return ret; - substream->runtime->private_data = dmadata; - return 0; -} - -static int txx9aclc_pcm_close(struct snd_soc_component *component, - struct snd_pcm_substream *substream) -{ - struct txx9aclc_dmadata *dmadata = substream->runtime->private_data; - struct dma_chan *chan = dmadata->dma_chan; - - dmadata->frag_count = -1; - dmaengine_terminate_all(chan); - return 0; -} - -static int txx9aclc_pcm_new(struct snd_soc_component *component, - struct snd_soc_pcm_runtime *rtd) -{ - struct snd_card *card = rtd->card->snd_card; - struct snd_soc_dai *dai = asoc_rtd_to_cpu(rtd, 0); - struct snd_pcm *pcm = rtd->pcm; - struct platform_device *pdev = to_platform_device(component->dev); - struct txx9aclc_soc_device *dev; - struct resource *r; - int i; - int ret; - - /* at this point onwards the AC97 component has probed and this will be valid */ - dev = snd_soc_dai_get_drvdata(dai); - - dev->dmadata[0].stream = SNDRV_PCM_STREAM_PLAYBACK; - dev->dmadata[1].stream = SNDRV_PCM_STREAM_CAPTURE; - for (i = 0; i < 2; i++) { - r = platform_get_resource(pdev, IORESOURCE_DMA, i); - if (!r) { - ret = -EBUSY; - goto exit; - } - dev->dmadata[i].dma_res = r; - ret = txx9aclc_dma_init(dev, &dev->dmadata[i]); - if (ret) - goto exit; - } - - snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, - card->dev, 64 * 1024, 4 * 1024 * 1024); - return 0; - -exit: - for (i = 0; i < 2; i++) { - if (dev->dmadata[i].dma_chan) - dma_release_channel(dev->dmadata[i].dma_chan); - dev->dmadata[i].dma_chan = NULL; - } - return ret; -} - -static bool filter(struct dma_chan *chan, void *param) -{ - struct txx9aclc_dmadata *dmadata = param; - char *devname; - bool found = false; - - devname = kasprintf(GFP_KERNEL, "%s.%d", dmadata->dma_res->name, - (int)dmadata->dma_res->start); - if (strcmp(dev_name(chan->device->dev), devname) == 0) { - chan->private = &dmadata->dma_slave; - found = true; - } - kfree(devname); - return found; -} - -static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, - struct txx9aclc_dmadata *dmadata) -{ - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - struct txx9dmac_slave *ds = &dmadata->dma_slave; - dma_cap_mask_t mask; - - spin_lock_init(&dmadata->dma_lock); - - ds->reg_width = sizeof(u32); - if (dmadata->stream == SNDRV_PCM_STREAM_PLAYBACK) { - ds->tx_reg = drvdata->physbase + ACAUDODAT; - ds->rx_reg = 0; - } else { - ds->tx_reg = 0; - ds->rx_reg = drvdata->physbase + ACAUDIDAT; - } - - /* Try to grab a DMA channel */ - dma_cap_zero(mask); - dma_cap_set(DMA_SLAVE, mask); - dmadata->dma_chan = dma_request_channel(mask, filter, dmadata); - if (!dmadata->dma_chan) { - printk(KERN_ERR - "DMA channel for %s is not available\n", - dmadata->stream == SNDRV_PCM_STREAM_PLAYBACK ? - "playback" : "capture"); - return -EBUSY; - } - INIT_WORK(&dmadata->work, txx9aclc_dma_work); - return 0; -} - -static int txx9aclc_pcm_probe(struct snd_soc_component *component) -{ - snd_soc_component_set_drvdata(component, &txx9aclc_soc_device); - return 0; -} - -static void txx9aclc_pcm_remove(struct snd_soc_component *component) -{ - struct txx9aclc_soc_device *dev = snd_soc_component_get_drvdata(component); - struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; - void __iomem *base = drvdata->base; - int i; - - /* disable all FIFO DMAs */ - __raw_writel(ACCTL_AUDODMA | ACCTL_AUDIDMA, base + ACCTLDIS); - /* dummy R/W to clear pending DMAREQ if any */ - __raw_writel(__raw_readl(base + ACAUDIDAT), base + ACAUDODAT); - - for (i = 0; i < 2; i++) { - struct txx9aclc_dmadata *dmadata = &dev->dmadata[i]; - struct dma_chan *chan = dmadata->dma_chan; - - if (chan) { - dmadata->frag_count = -1; - dmaengine_terminate_all(chan); - dma_release_channel(chan); - } - dev->dmadata[i].dma_chan = NULL; - } -} - -static const struct snd_soc_component_driver txx9aclc_soc_component = { - .name = DRV_NAME, - .probe = txx9aclc_pcm_probe, - .remove = txx9aclc_pcm_remove, - .open = txx9aclc_pcm_open, - .close = txx9aclc_pcm_close, - .hw_params = txx9aclc_pcm_hw_params, - .prepare = txx9aclc_pcm_prepare, - .trigger = txx9aclc_pcm_trigger, - .pointer = txx9aclc_pcm_pointer, - .pcm_construct = txx9aclc_pcm_new, -}; - -static int txx9aclc_soc_platform_probe(struct platform_device *pdev) -{ - return devm_snd_soc_register_component(&pdev->dev, - &txx9aclc_soc_component, NULL, 0); -} - -static struct platform_driver txx9aclc_pcm_driver = { - .driver = { - .name = "txx9aclc-pcm-audio", - }, - - .probe = txx9aclc_soc_platform_probe, -}; - -module_platform_driver(txx9aclc_pcm_driver); - -MODULE_AUTHOR("Atsushi Nemoto "); -MODULE_DESCRIPTION("TXx9 ACLC Audio DMA driver"); -MODULE_LICENSE("GPL"); diff --git a/sound/soc/txx9/txx9aclc.h b/sound/soc/txx9/txx9aclc.h deleted file mode 100644 index 37c691ba56ed..000000000000 --- a/sound/soc/txx9/txx9aclc.h +++ /dev/null @@ -1,71 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * TXx9 SoC AC Link Controller - */ - -#ifndef __TXX9ACLC_H -#define __TXX9ACLC_H - -#include -#include - -#define ACCTLEN 0x00 /* control enable */ -#define ACCTLDIS 0x04 /* control disable */ -#define ACCTL_ENLINK 0x00000001 /* enable/disable AC-link */ -#define ACCTL_AUDODMA 0x00000100 /* AUDODMA enable/disable */ -#define ACCTL_AUDIDMA 0x00001000 /* AUDIDMA enable/disable */ -#define ACCTL_AUDOEHLT 0x00010000 /* AUDO error halt - enable/disable */ -#define ACCTL_AUDIEHLT 0x00100000 /* AUDI error halt - enable/disable */ -#define ACREGACC 0x08 /* codec register access */ -#define ACREGACC_DAT_SHIFT 0 /* data field */ -#define ACREGACC_REG_SHIFT 16 /* address field */ -#define ACREGACC_CODECID_SHIFT 24 /* CODEC ID field */ -#define ACREGACC_READ 0x80000000 /* CODEC read */ -#define ACREGACC_WRITE 0x00000000 /* CODEC write */ -#define ACINTSTS 0x10 /* interrupt status */ -#define ACINTMSTS 0x14 /* interrupt masked status */ -#define ACINTEN 0x18 /* interrupt enable */ -#define ACINTDIS 0x1c /* interrupt disable */ -#define ACINT_CODECRDY(n) (0x00000001 << (n)) /* CODECn ready */ -#define ACINT_REGACCRDY 0x00000010 /* ACREGACC ready */ -#define ACINT_AUDOERR 0x00000100 /* AUDO underrun error */ -#define ACINT_AUDIERR 0x00001000 /* AUDI overrun error */ -#define ACDMASTS 0x80 /* DMA request status */ -#define ACDMA_AUDO 0x00000001 /* AUDODMA pending */ -#define ACDMA_AUDI 0x00000010 /* AUDIDMA pending */ -#define ACAUDODAT 0xa0 /* audio out data */ -#define ACAUDIDAT 0xb0 /* audio in data */ -#define ACREVID 0xfc /* revision ID */ - -struct txx9aclc_dmadata { - struct resource *dma_res; - struct txx9dmac_slave dma_slave; - struct dma_chan *dma_chan; - struct work_struct work; - spinlock_t dma_lock; - int stream; /* SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE */ - struct snd_pcm_substream *substream; - unsigned long pos; - dma_addr_t dma_addr; - unsigned long buffer_bytes; - unsigned long period_bytes; - unsigned long frag_bytes; - int frags; - int frag_count; - int dmacount; -}; - -struct txx9aclc_plat_drvdata { - void __iomem *base; - u64 physbase; -}; - -static inline struct txx9aclc_plat_drvdata *txx9aclc_get_plat_drvdata( - struct snd_soc_dai *dai) -{ - return dev_get_drvdata(dai->dev); -} - -#endif /* __TXX9ACLC_H */