2020-06-17 10:29:27

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH 1/3] mips: bmips: add PCI support

BMIPS SoCs with PCI: BCM6358, BCM6368.
BMIPS SoCs with PCIe (gen1): BCM6328, BCM6362, BCM63268.
BMIPS SoCs with PCIe (gen2): BCM6318.

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
---
arch/mips/Kconfig | 1 +
arch/mips/pci/Makefile | 1 +
arch/mips/pci/fixup-bmips.c | 17 +++++++++++++++++
3 files changed, 19 insertions(+)
create mode 100644 arch/mips/pci/fixup-bmips.c

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 6fee1a133e9d..357026cb51de 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -230,6 +230,7 @@ config BMIPS_GENERIC
select ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
select ARCH_HAS_PHYS_TO_DMA
select BOOT_RAW
+ select HAVE_PCI
select NO_EXCEPT_FILL
select USE_OF
select CEVT_R4K
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 0f68d6849978..e38285c10d45 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_PCI_XTALK_BRIDGE) += pci-xtalk-bridge.o
# These are still pretty much in the old state, watch, go blind.
#
obj-$(CONFIG_ATH79) += fixup-ath79.o
+obj-$(CONFIG_BMIPS_GENERIC) += fixup-bmips.o
obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
obj-$(CONFIG_LEMOTE_FULOONG2E) += fixup-fuloong2e.o ops-loongson2.o
obj-$(CONFIG_LEMOTE_MACH2F) += fixup-lemote2f.o ops-loongson2.o
diff --git a/arch/mips/pci/fixup-bmips.c b/arch/mips/pci/fixup-bmips.c
new file mode 100644
index 000000000000..581cff562ead
--- /dev/null
+++ b/arch/mips/pci/fixup-bmips.c
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2020 Álvaro Fernández Rojas <[email protected]>
+ */
+
+#include <linux/of_pci.h>
+#include <linux/pci.h>
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ return PCIBIOS_SUCCESSFUL;
+}
+
+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ return of_irq_parse_and_map_pci(dev, slot, pin);
+}
--
2.27.0


2020-06-17 11:21:57

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 1/3] mips: bmips: add PCI support

On Wed, Jun 17, 2020 at 12:25:54PM +0200, ?lvaro Fern?ndez Rojas wrote:
> BMIPS SoCs with PCI: BCM6358, BCM6368.
> BMIPS SoCs with PCIe (gen1): BCM6328, BCM6362, BCM63268.
> BMIPS SoCs with PCIe (gen2): BCM6318.
>
> Signed-off-by: ?lvaro Fern?ndez Rojas <[email protected]>
> ---
> arch/mips/Kconfig | 1 +
> arch/mips/pci/Makefile | 1 +
> arch/mips/pci/fixup-bmips.c | 17 +++++++++++++++++
> 3 files changed, 19 insertions(+)
> create mode 100644 arch/mips/pci/fixup-bmips.c
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 6fee1a133e9d..357026cb51de 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -230,6 +230,7 @@ config BMIPS_GENERIC
> select ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
> select ARCH_HAS_PHYS_TO_DMA
> select BOOT_RAW
> + select HAVE_PCI
> select NO_EXCEPT_FILL
> select USE_OF
> select CEVT_R4K

as everything is using DT in your patch, can't you use PCI_DRIVERS_GENERIC
here and drop fixup-bmips ?

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]