Re: [PATCH] pci: remove tango host controller driver

2021-01-22 Thread Lorenzo Pieralisi
On Wed, 20 Jan 2021 16:07:29 +0100, Arnd Bergmann wrote:
> The tango platform is getting removed, so the driver is no
> longer needed.

Applied to pci/tango, thanks!

[1/1] PCI: Remove tango host controller driver
  https://git.kernel.org/lpieralisi/pci/c/de9427ca87

Thanks,
Lorenzo


Re: [PATCH] pci: remove tango host controller driver

2021-01-21 Thread Måns Rullgård
Arnd Bergmann  writes:

> From: Arnd Bergmann 
>
> The tango platform is getting removed, so the driver is no
> longer needed.
>
> Cc: Marc Gonzalez 
> Cc: Mans Rullgard 
> Signed-off-by: Arnd Bergmann 

Acked-by: Mans Rullgard 

> ---
>  drivers/pci/controller/Kconfig  |  14 --
>  drivers/pci/controller/Makefile |   1 -
>  drivers/pci/controller/pcie-tango.c | 341 
>  3 files changed, 356 deletions(-)
>  delete mode 100644 drivers/pci/controller/pcie-tango.c
>
> diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
> index 64e2f5e379aa..8c85c16594f2 100644
> --- a/drivers/pci/controller/Kconfig
> +++ b/drivers/pci/controller/Kconfig
> @@ -242,20 +242,6 @@ config PCIE_MEDIATEK
> Say Y here if you want to enable PCIe controller support on
> MediaTek SoCs.
>
> -config PCIE_TANGO_SMP8759
> - bool "Tango SMP8759 PCIe controller (DANGEROUS)"
> - depends on ARCH_TANGO && PCI_MSI && OF
> - depends on BROKEN
> - select PCI_HOST_COMMON
> - help
> -   Say Y here to enable PCIe controller support for Sigma Designs
> -   Tango SMP8759-based systems.
> -
> -   Note: The SMP8759 controller multiplexes PCI config and MMIO
> -   accesses, and Linux doesn't provide a way to serialize them.
> -   This can lead to data corruption if drivers perform concurrent
> -   config and MMIO accesses.
> -
>  config VMD
>   depends on PCI_MSI && X86_64 && SRCU
>   tristate "Intel Volume Management Device Driver"
> diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile
> index 04c6edc285c5..b3a7912f8a5c 100644
> --- a/drivers/pci/controller/Makefile
> +++ b/drivers/pci/controller/Makefile
> @@ -27,7 +27,6 @@ obj-$(CONFIG_PCIE_ROCKCHIP) += pcie-rockchip.o
>  obj-$(CONFIG_PCIE_ROCKCHIP_EP) += pcie-rockchip-ep.o
>  obj-$(CONFIG_PCIE_ROCKCHIP_HOST) += pcie-rockchip-host.o
>  obj-$(CONFIG_PCIE_MEDIATEK) += pcie-mediatek.o
> -obj-$(CONFIG_PCIE_TANGO_SMP8759) += pcie-tango.o
>  obj-$(CONFIG_VMD) += vmd.o
>  obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o
>  obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
> diff --git a/drivers/pci/controller/pcie-tango.c 
> b/drivers/pci/controller/pcie-tango.c
> deleted file mode 100644
> index 62a061f1d62e..
> --- a/drivers/pci/controller/pcie-tango.c
> +++ /dev/null
> @@ -1,341 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -
> -#define MSI_MAX  256
> -
> -#define SMP8759_MUX  0x48
> -#define SMP8759_TEST_OUT 0x74
> -#define SMP8759_DOORBELL 0x7c
> -#define SMP8759_STATUS   0x80
> -#define SMP8759_ENABLE   0xa0
> -
> -struct tango_pcie {
> - DECLARE_BITMAP(used_msi, MSI_MAX);
> - u64 msi_doorbell;
> - spinlock_t  used_msi_lock;
> - void __iomem*base;
> - struct irq_domain   *dom;
> -};
> -
> -static void tango_msi_isr(struct irq_desc *desc)
> -{
> - struct irq_chip *chip = irq_desc_get_chip(desc);
> - struct tango_pcie *pcie = irq_desc_get_handler_data(desc);
> - unsigned long status, base, virq, idx, pos = 0;
> -
> - chained_irq_enter(chip, desc);
> - spin_lock(>used_msi_lock);
> -
> - while ((pos = find_next_bit(pcie->used_msi, MSI_MAX, pos)) < MSI_MAX) {
> - base = round_down(pos, 32);
> - status = readl_relaxed(pcie->base + SMP8759_STATUS + base / 8);
> - for_each_set_bit(idx, , 32) {
> - virq = irq_find_mapping(pcie->dom, base + idx);
> - generic_handle_irq(virq);
> - }
> - pos = base + 32;
> - }
> -
> - spin_unlock(>used_msi_lock);
> - chained_irq_exit(chip, desc);
> -}
> -
> -static void tango_ack(struct irq_data *d)
> -{
> - struct tango_pcie *pcie = d->chip_data;
> - u32 offset = (d->hwirq / 32) * 4;
> - u32 bit = BIT(d->hwirq % 32);
> -
> - writel_relaxed(bit, pcie->base + SMP8759_STATUS + offset);
> -}
> -
> -static void update_msi_enable(struct irq_data *d, bool unmask)
> -{
> - unsigned long flags;
> - struct tango_pcie *pcie = d->chip_data;
> - u32 offset = (d->hwirq / 32) * 4;
> - u32 bit = BIT(d->hwirq % 32);
> - u32 val;
> -
> - spin_lock_irqsave(>used_msi_lock, flags);
> - val = readl_relaxed(pcie->base + SMP8759_ENABLE + offset);
> - val = unmask ? val | bit : val & ~bit;
> - writel_relaxed(val, pcie->base + SMP8759_ENABLE + offset);
> - spin_unlock_irqrestore(>used_msi_lock, flags);
> -}
> -
> -static void tango_mask(struct irq_data *d)
> -{
> - update_msi_enable(d, false);
> -}
> -
> -static void tango_unmask(struct irq_data *d)
> -{
> - update_msi_enable(d, true);
> -}
> -
> -static int tango_set_affinity(struct irq_data *d, const struct cpumask *mask,
> -   bool force)
> -{
> - return -EINVAL;
> -}
> -

[PATCH] pci: remove tango host controller driver

2021-01-20 Thread Arnd Bergmann
From: Arnd Bergmann 

The tango platform is getting removed, so the driver is no
longer needed.

Cc: Marc Gonzalez 
Cc: Mans Rullgard 
Signed-off-by: Arnd Bergmann 
---
 drivers/pci/controller/Kconfig  |  14 --
 drivers/pci/controller/Makefile |   1 -
 drivers/pci/controller/pcie-tango.c | 341 
 3 files changed, 356 deletions(-)
 delete mode 100644 drivers/pci/controller/pcie-tango.c

diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
index 64e2f5e379aa..8c85c16594f2 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -242,20 +242,6 @@ config PCIE_MEDIATEK
  Say Y here if you want to enable PCIe controller support on
  MediaTek SoCs.
 
-config PCIE_TANGO_SMP8759
-   bool "Tango SMP8759 PCIe controller (DANGEROUS)"
-   depends on ARCH_TANGO && PCI_MSI && OF
-   depends on BROKEN
-   select PCI_HOST_COMMON
-   help
- Say Y here to enable PCIe controller support for Sigma Designs
- Tango SMP8759-based systems.
-
- Note: The SMP8759 controller multiplexes PCI config and MMIO
- accesses, and Linux doesn't provide a way to serialize them.
- This can lead to data corruption if drivers perform concurrent
- config and MMIO accesses.
-
 config VMD
depends on PCI_MSI && X86_64 && SRCU
tristate "Intel Volume Management Device Driver"
diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile
index 04c6edc285c5..b3a7912f8a5c 100644
--- a/drivers/pci/controller/Makefile
+++ b/drivers/pci/controller/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_PCIE_ROCKCHIP) += pcie-rockchip.o
 obj-$(CONFIG_PCIE_ROCKCHIP_EP) += pcie-rockchip-ep.o
 obj-$(CONFIG_PCIE_ROCKCHIP_HOST) += pcie-rockchip-host.o
 obj-$(CONFIG_PCIE_MEDIATEK) += pcie-mediatek.o
-obj-$(CONFIG_PCIE_TANGO_SMP8759) += pcie-tango.o
 obj-$(CONFIG_VMD) += vmd.o
 obj-$(CONFIG_PCIE_BRCMSTB) += pcie-brcmstb.o
 obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
diff --git a/drivers/pci/controller/pcie-tango.c 
b/drivers/pci/controller/pcie-tango.c
deleted file mode 100644
index 62a061f1d62e..
--- a/drivers/pci/controller/pcie-tango.c
+++ /dev/null
@@ -1,341 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define MSI_MAX256
-
-#define SMP8759_MUX0x48
-#define SMP8759_TEST_OUT   0x74
-#define SMP8759_DOORBELL   0x7c
-#define SMP8759_STATUS 0x80
-#define SMP8759_ENABLE 0xa0
-
-struct tango_pcie {
-   DECLARE_BITMAP(used_msi, MSI_MAX);
-   u64 msi_doorbell;
-   spinlock_t  used_msi_lock;
-   void __iomem*base;
-   struct irq_domain   *dom;
-};
-
-static void tango_msi_isr(struct irq_desc *desc)
-{
-   struct irq_chip *chip = irq_desc_get_chip(desc);
-   struct tango_pcie *pcie = irq_desc_get_handler_data(desc);
-   unsigned long status, base, virq, idx, pos = 0;
-
-   chained_irq_enter(chip, desc);
-   spin_lock(>used_msi_lock);
-
-   while ((pos = find_next_bit(pcie->used_msi, MSI_MAX, pos)) < MSI_MAX) {
-   base = round_down(pos, 32);
-   status = readl_relaxed(pcie->base + SMP8759_STATUS + base / 8);
-   for_each_set_bit(idx, , 32) {
-   virq = irq_find_mapping(pcie->dom, base + idx);
-   generic_handle_irq(virq);
-   }
-   pos = base + 32;
-   }
-
-   spin_unlock(>used_msi_lock);
-   chained_irq_exit(chip, desc);
-}
-
-static void tango_ack(struct irq_data *d)
-{
-   struct tango_pcie *pcie = d->chip_data;
-   u32 offset = (d->hwirq / 32) * 4;
-   u32 bit = BIT(d->hwirq % 32);
-
-   writel_relaxed(bit, pcie->base + SMP8759_STATUS + offset);
-}
-
-static void update_msi_enable(struct irq_data *d, bool unmask)
-{
-   unsigned long flags;
-   struct tango_pcie *pcie = d->chip_data;
-   u32 offset = (d->hwirq / 32) * 4;
-   u32 bit = BIT(d->hwirq % 32);
-   u32 val;
-
-   spin_lock_irqsave(>used_msi_lock, flags);
-   val = readl_relaxed(pcie->base + SMP8759_ENABLE + offset);
-   val = unmask ? val | bit : val & ~bit;
-   writel_relaxed(val, pcie->base + SMP8759_ENABLE + offset);
-   spin_unlock_irqrestore(>used_msi_lock, flags);
-}
-
-static void tango_mask(struct irq_data *d)
-{
-   update_msi_enable(d, false);
-}
-
-static void tango_unmask(struct irq_data *d)
-{
-   update_msi_enable(d, true);
-}
-
-static int tango_set_affinity(struct irq_data *d, const struct cpumask *mask,
- bool force)
-{
-   return -EINVAL;
-}
-
-static void tango_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
-{
-   struct tango_pcie *pcie = d->chip_data;
-   msg->address_lo = lower_32_bits(pcie->msi_doorbell);
-   msg->address_hi =