From: Sascha Hauer <s.hauer@pengutronix.de>
To: Denis Orlov <denorl2009@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] nios2: remove arch remains from drivers
Date: Mon, 3 Jul 2023 15:21:13 +0200 [thread overview]
Message-ID: <20230703132113.GQ18491@pengutronix.de> (raw)
In-Reply-To: <20230629201446.16679-1-denorl2009@gmail.com>
On Thu, Jun 29, 2023 at 11:13:45PM +0300, Denis Orlov wrote:
> The architecture was removed back in the commit efccc13513, however some
> drivers that were available exclusively for NIOS2 were left over. As it
> has been impossible to compile those since then, it seems reasonable to
> just get rid of them.
>
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
> drivers/serial/Kconfig | 10 --
> drivers/serial/Makefile | 2 -
> drivers/serial/serial_altera.c | 94 -----------
> drivers/serial/serial_altera_jtag.c | 99 ------------
> drivers/spi/Kconfig | 4 -
> drivers/spi/Makefile | 1 -
> drivers/spi/altera_spi.c | 236 ----------------------------
> 7 files changed, 446 deletions(-)
> delete mode 100644 drivers/serial/serial_altera.c
> delete mode 100644 drivers/serial/serial_altera_jtag.c
> delete mode 100644 drivers/spi/altera_spi.c
Applied, thanks
Sascha
>
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index 7c9a46845a..77c827e436 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -71,16 +71,6 @@ config DRIVER_SERIAL_CLPS711X
> default y
> bool "CLPS711X serial driver"
>
> -config DRIVER_SERIAL_ALTERA
> - depends on NIOS2
> - default y
> - bool "Altera serial driver"
> -
> -config DRIVER_SERIAL_ALTERA_JTAG
> - depends on NIOS2
> - default n
> - bool "Altera JTAG serial driver"
> -
> config DRIVER_SERIAL_NS16550
> default n
> bool "NS16550 serial driver"
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index 5677dba631..bbc517f521 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -13,8 +13,6 @@ obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o
> obj-$(CONFIG_DRIVER_SERIAL_NS16550_PCI) += serial_ns16550_pci.o
> obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o
> obj-$(CONFIG_DRIVER_SERIAL_STM32) += serial_stm32.o
> -obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.o
> -obj-$(CONFIG_DRIVER_SERIAL_ALTERA_JTAG) += serial_altera_jtag.o
> obj-$(CONFIG_DRIVER_SERIAL_PXA) += serial_pxa.o
> obj-$(CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT) += serial_omap4_usbboot.o
> obj-$(CONFIG_DRIVER_SERIAL_AUART) += serial_auart.o
> diff --git a/drivers/serial/serial_altera.c b/drivers/serial/serial_altera.c
> deleted file mode 100644
> index b13050cfbe..0000000000
> --- a/drivers/serial/serial_altera.c
> +++ /dev/null
> @@ -1,94 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * (C) Copyright 2011, Franck JULLIEN, <elec4fun@gmail.com>
> - */
> -
> -#include <common.h>
> -#include <driver.h>
> -#include <init.h>
> -#include <malloc.h>
> -#include <io.h>
> -#include <asm/nios2-io.h>
> -
> -struct altera_serial_priv {
> - struct console_device cdev;
> - void __iomem *regs;
> -};
> -
> -static int altera_serial_setbaudrate(struct console_device *cdev, int baudrate)
> -{
> - struct altera_serial_priv *priv = container_of(cdev,
> - struct altera_serial_priv, cdev);
> -
> - struct nios_uart *uart = priv->regs;
> - uint16_t div;
> -
> - div = (CPU_FREQ / baudrate) - 1;
> - writew(div, &uart->divisor);
> -
> - return 0;
> -}
> -
> -static void altera_serial_putc(struct console_device *cdev, char c)
> -{
> - struct altera_serial_priv *priv = container_of(cdev,
> - struct altera_serial_priv, cdev);
> -
> - struct nios_uart *uart = priv->regs;
> -
> - while ((readw(&uart->status) & NIOS_UART_TRDY) == 0);
> -
> - writew(c, &uart->txdata);
> -}
> -
> -static int altera_serial_tstc(struct console_device *cdev)
> -{
> - struct altera_serial_priv *priv = container_of(cdev,
> - struct altera_serial_priv, cdev);
> -
> - struct nios_uart *uart = priv->regs;
> -
> - return readw(&uart->status) & NIOS_UART_RRDY;
> -}
> -
> -static int altera_serial_getc(struct console_device *cdev)
> -{
> - struct altera_serial_priv *priv = container_of(cdev,
> - struct altera_serial_priv, cdev);
> -
> - struct nios_uart *uart = priv->regs;
> -
> - while (altera_serial_tstc(cdev) == 0);
> -
> - return readw(&uart->rxdata) & 0x000000FF;
> -}
> -
> -static int altera_serial_probe(struct device *dev)
> -{
> - struct resource *iores;
> - struct console_device *cdev;
> - struct altera_serial_priv *priv;
> -
> - priv = xzalloc(sizeof(*priv));
> - cdev = &priv->cdev;
> -
> - iores = dev_request_mem_resource(dev, 0);
> - if (IS_ERR(iores))
> - return PTR_ERR(iores);
> - priv->regs = IOMEM(iores->start);
> - cdev->dev = dev;
> - cdev->tstc = altera_serial_tstc;
> - cdev->putc = altera_serial_putc;
> - cdev->getc = altera_serial_getc;
> - cdev->setbrg = altera_serial_setbaudrate;
> -
> - console_register(cdev);
> -
> - return 0;
> -}
> -
> -static struct driver altera_serial_driver = {
> - .name = "altera_serial",
> - .probe = altera_serial_probe,
> -};
> -console_platform_driver(altera_serial_driver);
> diff --git a/drivers/serial/serial_altera_jtag.c b/drivers/serial/serial_altera_jtag.c
> deleted file mode 100644
> index ad278d1a61..0000000000
> --- a/drivers/serial/serial_altera_jtag.c
> +++ /dev/null
> @@ -1,99 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
> - * Scott McNutt <smcnutt@psyent.com>
> - *
> - * (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
> - */
> -
> -#include <common.h>
> -#include <driver.h>
> -#include <init.h>
> -#include <malloc.h>
> -#include <io.h>
> -#include <asm/nios2-io.h>
> -
> -struct altera_serial_jtag_priv {
> - struct console_device cdev;
> - void __iomem *regs;
> -};
> -
> -
> -static int altera_serial_jtag_setbaudrate(struct console_device *cdev, int baudrate)
> -{
> - return 0;
> -}
> -
> -static void altera_serial_jtag_putc(struct console_device *cdev, char c)
> -{
> - struct altera_serial_jtag_priv *priv = container_of(cdev,
> - struct altera_serial_jtag_priv, cdev);
> -
> - struct nios_jtag *jtag = priv->regs;
> - uint32_t st;
> -
> - while (1) {
> - st = readl(&jtag->control);
> - if (NIOS_JTAG_WSPACE(st))
> - break;
> - }
> -
> - writel(c, &jtag->data);
> -}
> -
> -static int altera_serial_jtag_tstc(struct console_device *cdev)
> -{
> - struct altera_serial_jtag_priv *priv = container_of(cdev,
> - struct altera_serial_jtag_priv, cdev);
> -
> - struct nios_jtag *jtag = priv->regs;
> -
> - return readl(&jtag->control) & NIOS_JTAG_RRDY;
> -}
> -
> -static int altera_serial_jtag_getc(struct console_device *cdev)
> -{
> - struct altera_serial_jtag_priv *priv = container_of(cdev,
> - struct altera_serial_jtag_priv, cdev);
> -
> - struct nios_jtag *jtag = priv->regs;
> - uint32_t val;
> -
> - while (1) {
> - val = readl(&jtag->data);
> - if (val & NIOS_JTAG_RVALID)
> - break;
> - }
> -
> - return val & 0xFF;
> -}
> -
> -static int altera_serial_jtag_probe(struct device *dev) {
> - struct resource *iores;
> -
> - struct console_device *cdev;
> - struct altera_serial_jtag_priv *priv;
> -
> - priv = xzalloc(sizeof(*priv));
> - cdev = &priv->cdev;
> -
> - iores = dev_request_mem_resource(dev, 0);
> - if (IS_ERR(iores))
> - return PTR_ERR(iores);
> - priv->regs = IOMEM(iores->start);
> - cdev->dev = dev;
> - cdev->tstc = altera_serial_jtag_tstc;
> - cdev->putc = altera_serial_jtag_putc;
> - cdev->getc = altera_serial_jtag_getc;
> - cdev->setbrg = altera_serial_jtag_setbaudrate;
> -
> - console_register(cdev);
> -
> - return 0;
> -}
> -
> -static struct driver altera_serial_jtag_driver = {
> - .name = "altera_serial_jtag",
> - .probe = altera_serial_jtag_probe,
> -};
> -console_platform_driver(altera_serial_jtag_driver);
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index 8935feb97b..e37c7821fb 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -14,10 +14,6 @@ config SPI_MEM
> This extension is meant to simplify interaction with SPI memories
> by providing a high-level interface to send memory-like commands.
>
> -config DRIVER_SPI_ALTERA
> - bool "Altera SPI Master driver"
> - depends on NIOS2
> -
> config DRIVER_SPI_ATH79
> bool "Atheros AR71XX/AR724X/AR913X/AR933X SPI controller driver"
> depends on MACH_MIPS_ATH79
> diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> index 3455eea869..68a8c4e675 100644
> --- a/drivers/spi/Makefile
> +++ b/drivers/spi/Makefile
> @@ -8,7 +8,6 @@ obj-$(CONFIG_DRIVER_SPI_IMX) += imx_spi.o
> obj-$(CONFIG_DRIVER_SPI_LITEX_SPIFLASH) += litex_spiflash.o
> obj-$(CONFIG_DRIVER_SPI_MVEBU) += mvebu_spi.o
> obj-$(CONFIG_DRIVER_SPI_MXS) += mxs_spi.o
> -obj-$(CONFIG_DRIVER_SPI_ALTERA) += altera_spi.o
> obj-$(CONFIG_DRIVER_SPI_ATMEL) += atmel_spi.o
> obj-$(CONFIG_SPI_FSL_DSPI) += spi-fsl-dspi.o
> obj-$(CONFIG_SPI_ATMEL_QUADSPI) += atmel-quadspi.o
> diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
> deleted file mode 100644
> index 50d77723da..0000000000
> --- a/drivers/spi/altera_spi.c
> +++ /dev/null
> @@ -1,236 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * (C) Copyright 2011 - Franck JULLIEN <elec4fun@gmail.com>
> - */
> -
> -#include <common.h>
> -#include <init.h>
> -#include <driver.h>
> -#include <spi/spi.h>
> -#include <io.h>
> -#include <asm/spi.h>
> -#include <asm/nios2-io.h>
> -#include <clock.h>
> -
> -static void altera_spi_cs_inactive(struct spi_device *spi);
> -
> -static int altera_spi_setup(struct spi_device *spi)
> -{
> - struct spi_master *master = spi->master;
> - struct device spi_dev = spi->dev;
> - struct altera_spi *altera_spi = container_of(master, struct altera_spi, master);
> -
> - if (spi->bits_per_word != altera_spi->databits) {
> - dev_err(master->dev, " master doesn't support %d bits per word requested by %s\n",
> - spi->bits_per_word, spi_dev.name);
> - return -EINVAL;
> - }
> -
> - if ((spi->mode & (SPI_CPHA | SPI_CPOL)) != altera_spi->mode) {
> - dev_err(master->dev, " master doesn't support SPI_MODE%d requested by %s\n",
> - spi->mode & (SPI_CPHA | SPI_CPOL), spi_dev.name);
> - return -EINVAL;
> - }
> -
> - if (spi->max_speed_hz < altera_spi->speed) {
> - dev_err(master->dev, " frequency is too high for %s\n", spi_dev.name);
> - return -EINVAL;
> - }
> -
> - altera_spi_cs_inactive(spi);
> -
> - dev_dbg(master->dev, " mode 0x%08x, bits_per_word: %d, speed: %d\n",
> - spi->mode, spi->bits_per_word, altera_spi->speed);
> -
> - return 0;
> -}
> -
> -
> -static unsigned int altera_spi_xchg_single(struct altera_spi *altera_spi, unsigned int data)
> -{
> - struct nios_spi *nios_spi = altera_spi->regs;
> -
> - while (!(readl(&nios_spi->status) & NIOS_SPI_TRDY));
> - writel(data, &nios_spi->txdata);
> -
> - while (!(readl(&nios_spi->status) & NIOS_SPI_RRDY));
> -
> - return readl(&nios_spi->rxdata);
> -}
> -
> -/*
> - * When using SPI_CS_HIGH devices, only one device is allowed to be
> - * connected to the Altera SPI master. This limitation is due to the
> - * emulation of an active high CS by writing 0 to the slaveselect register
> - * (this produce a '1' to all CS pins).
> - */
> -
> -static void altera_spi_cs_active(struct spi_device *spi)
> -{
> - struct altera_spi *altera_spi = container_of(spi->master, struct altera_spi, master);
> - struct nios_spi *nios_spi = altera_spi->regs;
> - uint32_t tmp;
> -
> - if (spi->mode & SPI_CS_HIGH) {
> - tmp = readw(&nios_spi->control);
> - writew(tmp & ~NIOS_SPI_SSO, &nios_spi->control);
> - writel(0, &nios_spi->slaveselect);
> - } else {
> - writel(1 << spi->chip_select, &nios_spi->slaveselect);
> - tmp = readl(&nios_spi->control);
> - writel(tmp | NIOS_SPI_SSO, &nios_spi->control);
> - }
> -}
> -
> -static void altera_spi_cs_inactive(struct spi_device *spi)
> -{
> - struct altera_spi *altera_spi = container_of(spi->master, struct altera_spi, master);
> - struct nios_spi *nios_spi = altera_spi->regs;
> - uint32_t tmp;
> -
> - if (spi->mode & SPI_CS_HIGH) {
> - writel(1 << spi->chip_select, &nios_spi->slaveselect);
> - tmp = readl(&nios_spi->control);
> - writel(tmp | NIOS_SPI_SSO, &nios_spi->control);
> - } else {
> - tmp = readw(&nios_spi->control);
> - writew(tmp & ~NIOS_SPI_SSO, &nios_spi->control);
> - }
> -}
> -
> -static unsigned altera_spi_do_xfer(struct spi_device *spi, struct spi_transfer *t)
> -{
> - struct altera_spi *altera_spi = container_of(spi->master, struct altera_spi, master);
> - int word_len;
> - unsigned retval = 0;
> - u32 txval;
> - u32 rxval;
> -
> - word_len = spi->bits_per_word;
> -
> - if (word_len <= 8) {
> - const u8 *txbuf = t->tx_buf;
> - u8 *rxbuf = t->rx_buf;
> - int i = 0;
> -
> - while (i < t->len) {
> - txval = txbuf ? txbuf[i] : 0;
> - rxval = altera_spi_xchg_single(altera_spi, txval);
> - if (rxbuf)
> - rxbuf[i] = rxval;
> - i++;
> - retval++;
> - }
> - } else if (word_len <= 16) {
> - const u16 *txbuf = t->tx_buf;
> - u16 *rxbuf = t->rx_buf;
> - int i = 0;
> -
> - while (i < t->len >> 1) {
> - txval = txbuf ? txbuf[i] : 0;
> - rxval = altera_spi_xchg_single(altera_spi, txval);
> - if (rxbuf)
> - rxbuf[i] = rxval;
> - i++;
> - retval += 2;
> - }
> - } else if (word_len <= 32) {
> - const u32 *txbuf = t->tx_buf;
> - u32 *rxbuf = t->rx_buf;
> - int i = 0;
> -
> - while (i < t->len >> 2) {
> - txval = txbuf ? txbuf[i] : 0;
> - rxval = altera_spi_xchg_single(altera_spi, txval);
> - if (rxbuf)
> - rxbuf[i] = rxval;
> - i++;
> - retval += 4;
> - }
> - }
> -
> - return retval;
> -}
> -
> -static int altera_spi_transfer(struct spi_device *spi, struct spi_message *mesg)
> -{
> - struct altera_spi *altera_spi = container_of(spi->master, struct altera_spi, master);
> - struct nios_spi *nios_spi = altera_spi->regs;
> - struct spi_transfer *t;
> - unsigned int cs_change;
> - const int nsecs = 50;
> -
> - altera_spi_cs_active(spi);
> -
> - cs_change = 0;
> -
> - mesg->actual_length = 0;
> -
> - list_for_each_entry(t, &mesg->transfers, transfer_list) {
> -
> - if (cs_change) {
> - ndelay(nsecs);
> - altera_spi_cs_inactive(spi);
> - ndelay(nsecs);
> - altera_spi_cs_active(spi);
> - }
> -
> - cs_change = t->cs_change;
> -
> - mesg->actual_length += altera_spi_do_xfer(spi, t);
> -
> - if (cs_change) {
> - altera_spi_cs_active(spi);
> - }
> - }
> -
> - /* Wait the end of any pending transfer */
> - while ((readl(&nios_spi->status) & NIOS_SPI_TMT) == 0);
> -
> - if (!cs_change)
> - altera_spi_cs_inactive(spi);
> -
> - return 0;
> -}
> -
> -static int altera_spi_probe(struct device *dev)
> -{
> - struct resource *iores;
> - struct spi_master *master;
> - struct altera_spi *altera_spi;
> - struct spi_altera_master *pdata = dev->platform_data;
> - struct nios_spi *nios_spi;
> -
> - altera_spi = xzalloc(sizeof(*altera_spi));
> -
> - master = &altera_spi->master;
> - master->dev = dev;
> -
> - master->setup = altera_spi_setup;
> - master->transfer = altera_spi_transfer;
> - master->num_chipselect = pdata->num_chipselect;
> - master->bus_num = pdata->bus_num;
> -
> - iores = dev_request_mem_resource(dev, 0);
> - if (IS_ERR(iores))
> - return PTR_ERR(iores);
> - altera_spi->regs = IOMEM(iores->start);
> -
> - altera_spi->databits = pdata->databits;
> - altera_spi->speed = pdata->speed;
> - altera_spi->mode = pdata->spi_mode;
> -
> - nios_spi = altera_spi->regs;
> - writel(0, &nios_spi->slaveselect);
> - writel(0, &nios_spi->control);
> -
> - spi_register_master(master);
> -
> - return 0;
> -}
> -
> -static struct driver altera_spi_driver = {
> - .name = "altera_spi",
> - .probe = altera_spi_probe,
> -};
> -device_platform_driver(altera_spi_driver);
> --
> 2.41.0
>
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2023-07-03 13:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 20:13 Denis Orlov
2023-06-30 8:57 ` Ian Abbott
2023-06-30 18:55 ` Denis Orlov
2023-07-03 8:43 ` Sascha Hauer
2023-07-03 13:21 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230703132113.GQ18491@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=denorl2009@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox