Skip to contentSkip to conversation

ARM: ixp4xx: Modernize and DT support

PATCH In review Linus Walleij 2 participants 34 messages Apr 8, 2019 – Apr 9, 2019

Subsystems (12)
lore
Share & tools
lore
#0 lore raw

v3 cover ARM: ixp4xx: Modernize and DT support

This modernizes the IXP4xx platform and adds initial Device Tree Support. We migrate to MULTI_IRQ_HANDLER, bumps the IRQs to offset 16, converts to SPARSE_IRQ, then we add proper subsystem drivers in each subsystem for irqchip, GPIO and clocksource and switch over to using these new drivers.

I will follow up with a pull request to the ARM SoC shortly.

A working set of base patches that boots to prompt from initramfs on NSLU2 and GW2358-4 and also includes the series for ethernet support is provided on this branch:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git/log/?h=ixp4

Obviously I am looking for the IXP4xx maintainers to ACK the patch set.

Linus Walleij (31):
ARM: ixp4xx: Add myself as maintainer
ARM: ixp4xx: Convert to MULTI_IRQ_HANDLER
ARM: ixp4xx: Pass IRQ resource to beeper
ARM: ixp4xx: Convert to SPARSE_IRQ
irqchip: Add driver for IXP4xx
gpio: ixp4xx: Add driver for the IXP4xx GPIO
ARM: ixp4xx: Switch to use new IRQ+GPIO drivers clocksource/drivers/ixp4xx: Add driver
ARM: ixp4xx: Switch to use new timer driver
irqchip: ixp4xx: Add DT bindings
irqchip: ixp4xx: Add OF initialization support clocksource/drivers/ixp4xx: Add DT bindings clocksource/drivers/ixp4xx: Add OF initialization support
gpio: ixp4xx: Add DT bindings
gpio: ixp4xx: Add OF probing support
ARM: ixp4xx: Add DT bindings
ARM: ixp4xx: Add device tree boot support
ARM: dts: Add some initial IXP4xx device trees
ARM: ixp4xx: Move NPE and QMGR to drivers/soc
ARM: ixp4xx: Move IXP4xx QMGR and NPE headers
ARM: ixp4xx: Turn the NPE into a platform device
ARM: ixp4xx: Turn the QMGR into a platform device
soc: ixp4xx: npe: Pass addresses as resources
soc: ixp4xx: Uninline several functions
soc: ixp4xx: Remove unused functions
soc: ixp4xx: qmgr: Pass resources
soc: ixp4xx: Add DT bindings for IXP4xx NPE
soc: ixp4xx: npe: Add DT probe code
soc: ixp4xx: qmgr: Add DT bindings for IXP4xx qmgr
soc: ixp4xx: qmgr: Add DT probe code
ARM: dts: Add queue manager and NPE to the IXP4xx DTSI

 .../devicetree/bindings/arm/intel-ixp4xx.yaml |  22 +
 ...ntel,ixp4xx-network-processing-engine.yaml |  44 ++
 .../intel,ixp4xx-interrupt.yaml               |  54 ++
 .../misc/intel,ixp4xx-queue-manager.yaml      |  54 ++
 .../bindings/timer/intel,ixp4xx-timer.yaml    |  42 ++
 MAINTAINERS                                   |  18 +-
 arch/arm/Kconfig                              |   5 +-
 arch/arm/boot/dts/Makefile                    |   3 +
 .../boot/dts/intel-ixp42x-linksys-nslu2.dts   | 109 ++++
 arch/arm/boot/dts/intel-ixp42x.dtsi           |  25 +
 .../dts/intel-ixp43x-gateworks-gw2358.dts     |  94 ++++
 arch/arm/boot/dts/intel-ixp43x.dtsi           |  15 +
 arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi    |  34 ++
 arch/arm/boot/dts/intel-ixp4xx.dtsi           |  70 +++
 arch/arm/mach-ixp4xx/Kconfig                  |  27 +-
 arch/arm/mach-ixp4xx/Makefile                 |   5 +-
 arch/arm/mach-ixp4xx/avila-pci.c              |   2 +
 arch/arm/mach-ixp4xx/avila-setup.c            |   2 +
 arch/arm/mach-ixp4xx/common.c                 | 484 +++---------------
 arch/arm/mach-ixp4xx/coyote-pci.c             |   2 +
 arch/arm/mach-ixp4xx/coyote-setup.c           |   2 +
 arch/arm/mach-ixp4xx/dsmg600-pci.c            |   2 +
 arch/arm/mach-ixp4xx/dsmg600-setup.c          |   5 +-
 arch/arm/mach-ixp4xx/fsg-pci.c                |   2 +
 arch/arm/mach-ixp4xx/fsg-setup.c              |   2 +
 arch/arm/mach-ixp4xx/gateway7001-pci.c        |   2 +
 arch/arm/mach-ixp4xx/gateway7001-setup.c      |   2 +
 arch/arm/mach-ixp4xx/gtwx5715-pci.c           |   2 +
 arch/arm/mach-ixp4xx/gtwx5715-setup.c         |   2 +
 .../mach-ixp4xx/include/mach/entry-macro.S    |  41 --
 arch/arm/mach-ixp4xx/include/mach/irqs.h      |  75 ---
 .../mach-ixp4xx/include/mach/ixp4xx-regs.h    |  94 ----
 arch/arm/mach-ixp4xx/include/mach/qmgr.h      | 204 --------
 arch/arm/mach-ixp4xx/irqs.h                   |  68 +++
 arch/arm/mach-ixp4xx/ixdp425-pci.c            |   2 +
 arch/arm/mach-ixp4xx/ixdp425-setup.c          |   2 +
 arch/arm/mach-ixp4xx/ixdpg425-pci.c           |   2 +
 arch/arm/mach-ixp4xx/ixp4xx-of.c              |  60 +++
 arch/arm/mach-ixp4xx/nas100d-pci.c            |   2 +
 arch/arm/mach-ixp4xx/nas100d-setup.c          |   5 +-
 arch/arm/mach-ixp4xx/nslu2-pci.c              |   2 +
 arch/arm/mach-ixp4xx/nslu2-setup.c            |  12 +-
 arch/arm/mach-ixp4xx/wg302v2-pci.c            |   2 +
 arch/arm/mach-ixp4xx/wg302v2-setup.c          |   2 +
 drivers/clocksource/Kconfig                   |   7 +
 drivers/clocksource/Makefile                  |   1 +
 drivers/clocksource/timer-ixp4xx.c            | 284 ++++++++++
 drivers/crypto/ixp4xx_crypto.c                |   4 +-
 drivers/gpio/Kconfig                          |  13 +
 drivers/gpio/Makefile                         |   1 +
 drivers/gpio/gpio-ixp4xx.c                    | 474 +++++++++++++++++
 drivers/input/misc/ixp4xx-beeper.c            |  20 +-
 drivers/irqchip/Kconfig                       |   6 +
 drivers/irqchip/Makefile                      |   1 +
 drivers/irqchip/irq-ixp4xx.c                  | 403 +++++++++++++++
 drivers/net/ethernet/xscale/ixp4xx_eth.c      |  14 +-
 drivers/net/wan/ixp4xx_hss.c                  |   4 +-
 drivers/soc/Kconfig                           |   1 +
 drivers/soc/Makefile                          |   1 +
 drivers/soc/ixp4xx/Kconfig                    |  16 +
 drivers/soc/ixp4xx/Makefile                   |   2 +
 .../soc/ixp4xx/ixp4xx-npe.c                   |  66 ++-
 .../soc/ixp4xx/ixp4xx-qmgr.c                  | 186 +++++--
 drivers/watchdog/ixp4xx_wdt.c                 |   9 +
 include/linux/irqchip/irq-ixp4xx.h            |  12 +
 include/linux/platform_data/timer-ixp4xx.h    |  11 +
 .../mach => include/linux/soc/ixp4xx}/npe.h   |   2 -
 include/linux/soc/ixp4xx/qmgr.h               |  91 ++++
 68 files changed, 2421 insertions(+), 913 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
 create mode 100644 Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
 create mode 100644 Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml
 create mode 100644 Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
 create mode 100644 arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts
 create mode 100644 arch/arm/boot/dts/intel-ixp42x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts
 create mode 100644 arch/arm/boot/dts/intel-ixp43x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp4xx.dtsi
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/entry-macro.S
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/irqs.h
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/qmgr.h
 create mode 100644 arch/arm/mach-ixp4xx/irqs.h
 create mode 100644 arch/arm/mach-ixp4xx/ixp4xx-of.c
 create mode 100644 drivers/clocksource/timer-ixp4xx.c
 create mode 100644 drivers/gpio/gpio-ixp4xx.c
 create mode 100644 drivers/irqchip/irq-ixp4xx.c
 create mode 100644 drivers/soc/ixp4xx/Kconfig
 create mode 100644 drivers/soc/ixp4xx/Makefile
 rename arch/arm/mach-ixp4xx/ixp4xx_npe.c => drivers/soc/ixp4xx/ixp4xx-npe.c (94%)
 rename arch/arm/mach-ixp4xx/ixp4xx_qmgr.c => drivers/soc/ixp4xx/ixp4xx-qmgr.c (66%)
 create mode 100644 include/linux/irqchip/irq-ixp4xx.h
 create mode 100644 include/linux/platform_data/timer-ixp4xx.h
 rename {arch/arm/mach-ixp4xx/include/mach => include/linux/soc/ixp4xx}/npe.h (95%)
 create mode 100644 include/linux/soc/ixp4xx/qmgr.h
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

PATCH v3 1/31 ARM: ixp4xx: Add myself as maintainer

I am working on the platform right now so might as well maintain it for a bit.

---
ChangeLog v1->v3:
- New patch

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index e17ebf70b548..0508cf8ed022 100644
@@ -1685,6 +1685,7 @@ L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 
 ARM/INTEL IXP4XX ARM ARCHITECTURE
+M:	Linus Walleij <[email protected]>
 M:	Imre Kaloz <[email protected]>
 M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH v3 2/31 ARM: ixp4xx: Convert to MULTI_IRQ_HANDLER

In reply to Linus Walleij

This rewrites the IXP4xx to use MULTI_IRQ_HANDLER and create an irqdomain for the irqchip in the platform. We convert the timer to request the interrupt like any other driver in the process.

We bump all IRQs to 16+offset to avoid using IRQ 0 and set NR_IRQS to 512 (the default for most systems). This conveniently fits with the first 16 IRQs being pre-allocated when using SPARSE_IRQ.

This is a prerequisite for SPARSE_IRQ and DT boot.

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1

---
 arch/arm/Kconfig                              |   1 +
 arch/arm/mach-ixp4xx/common.c                 | 109 +++++++++++++-----
 .../mach-ixp4xx/include/mach/entry-macro.S    |  41 -------
 arch/arm/mach-ixp4xx/include/mach/irqs.h      |  95 ++++++++-------
 4 files changed, 126 insertions(+), 120 deletions(-)
 delete mode 100644 arch/arm/mach-ixp4xx/include/mach/entry-macro.S
arch/arm/Kconfig +1 -0
index 054ead960f98..eb27554aa04f 100644
@@ -433,6 +433,7 @@ config ARCH_IXP4XX
 	select CPU_XSCALE
 	select DMABOUNCE if PCI
 	select GENERIC_CLOCKEVENTS
+	select GENERIC_IRQ_MULTI_HANDLER
 	select GPIOLIB
 	select HAVE_PCI
 	select NEED_MACH_IO_H
arch/arm/mach-ixp4xx/common.c +80 -29

210 lines not on this page · raw message

arch/arm/mach-ixp4xx/include/mach/entry-macro.S deleted +0 -41

41 lines not on this page · raw message

arch/arm/mach-ixp4xx/include/mach/irqs.h +45 -50

105 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH v3 3/31 ARM: ixp4xx: Pass IRQ resource to beeper

In reply to Linus Walleij

All IXP4xx devices except the beeper passes the IRQ as a resource, augment the NSLU2 beeper to do the same.

This is a prerequisite for SPARSE_IRQ.

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1

---
 arch/arm/mach-ixp4xx/nslu2-setup.c | 10 +++++++++-
 drivers/input/misc/ixp4xx-beeper.c | 20 +++++++++++++++-----
 2 files changed, 24 insertions(+), 6 deletions(-)
arch/arm/mach-ixp4xx/nslu2-setup.c +9 -1
index 341b263482ef..7c2b6604187e 100644
@@ -125,10 +125,18 @@ static struct platform_device nslu2_i2c_gpio = {
 	},
 };
 
+static struct resource nslu2_beeper_resources[] = {
+	{
+		.start	= IRQ_IXP4XX_TIMER2,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
 static struct platform_device nslu2_beeper = {
 	.name			= "ixp4xx-beeper",
 	.id			= NSLU2_GPIO_BUZZ,
-	.num_resources		= 0,
+	.resource		= nslu2_beeper_resources,
+	.num_resources		= ARRAY_SIZE(nslu2_beeper_resources),
 };
 
 static struct resource nslu2_uart_resources[] = {
drivers/input/misc/ixp4xx-beeper.c +15 -5
index 1fe149f3def2..4776273fa10b 100644
@@ -30,6 +30,8 @@ MODULE_ALIAS("platform:ixp4xx-beeper");
 
 static DEFINE_SPINLOCK(beep_lock);
 
+static int ixp4xx_timer2_irq;
+
 static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
 {
 	unsigned long flags;
@@ -90,6 +92,7 @@ static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
 static int ixp4xx_spkr_probe(struct platform_device *dev)
 {
 	struct input_dev *input_dev;
+	int irq;
 	int err;
 
 	input_dev = input_allocate_device();
@@ -110,15 +113,22 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
 	input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
 	input_dev->event = ixp4xx_spkr_event;
 
+	irq = platform_get_irq(dev, 0);
+	if (irq < 0) {
+		err = irq;
+		goto err_free_device;
+	}
+
 	err = gpio_request(dev->id, "ixp4-beeper");
 	if (err)
 		goto err_free_device;
 
-	err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
+	err = request_irq(irq, &ixp4xx_spkr_interrupt,
 			  IRQF_NO_SUSPEND, "ixp4xx-beeper",
 			  (void *) dev->id);
 	if (err)
 		goto err_free_gpio;
+	ixp4xx_timer2_irq = irq;
 
 	err = input_register_device(input_dev);
 	if (err)
@@ -129,7 +139,7 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
 	return 0;
 
  err_free_irq:
-	free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
+	free_irq(irq, (void *)dev->id);
  err_free_gpio:
 	gpio_free(dev->id);
  err_free_device:
@@ -146,10 +156,10 @@ static int ixp4xx_spkr_remove(struct platform_device *dev)
 	input_unregister_device(input_dev);
 
 	/* turn the speaker off */
-	disable_irq(IRQ_IXP4XX_TIMER2);
+	disable_irq(ixp4xx_timer2_irq);
 	ixp4xx_spkr_control(pin, 0);
 
-	free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
+	free_irq(ixp4xx_timer2_irq, (void *)dev->id);
 	gpio_free(dev->id);
 
 	return 0;
@@ -161,7 +171,7 @@ static void ixp4xx_spkr_shutdown(struct platform_device *dev)
 	unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
 
 	/* turn off the speaker */
-	disable_irq(IRQ_IXP4XX_TIMER2);
+	disable_irq(ixp4xx_timer2_irq);
 	ixp4xx_spkr_control(pin, 0);
 }
 
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH v3 4/31 ARM: ixp4xx: Convert to SPARSE_IRQ

In reply to Linus Walleij

This localizes the <mach/irqs.h> header to the mach-ixp4xx directory, removes NR_IRQS and switches IXP4xx over to using SPARSE_IRQ.

This is a prerequisite for DT support.

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1

---
 arch/arm/Kconfig                               | 1 +
 arch/arm/mach-ixp4xx/avila-pci.c               | 2 ++
 arch/arm/mach-ixp4xx/avila-setup.c             | 2 ++
 arch/arm/mach-ixp4xx/common.c                  | 2 ++
 arch/arm/mach-ixp4xx/coyote-pci.c              | 2 ++
 arch/arm/mach-ixp4xx/coyote-setup.c            | 2 ++
 arch/arm/mach-ixp4xx/dsmg600-pci.c             | 2 ++
 arch/arm/mach-ixp4xx/dsmg600-setup.c           | 2 ++
 arch/arm/mach-ixp4xx/fsg-pci.c                 | 2 ++
 arch/arm/mach-ixp4xx/fsg-setup.c               | 2 ++
 arch/arm/mach-ixp4xx/gateway7001-pci.c         | 2 ++
 arch/arm/mach-ixp4xx/gateway7001-setup.c       | 2 ++
 arch/arm/mach-ixp4xx/gtwx5715-pci.c            | 2 ++
 arch/arm/mach-ixp4xx/gtwx5715-setup.c          | 2 ++
 arch/arm/mach-ixp4xx/{include/mach => }/irqs.h | 2 --
 arch/arm/mach-ixp4xx/ixdp425-pci.c             | 2 ++
 arch/arm/mach-ixp4xx/ixdp425-setup.c           | 2 ++
 arch/arm/mach-ixp4xx/ixdpg425-pci.c            | 2 ++
 arch/arm/mach-ixp4xx/ixp4xx_qmgr.c             | 2 ++
 arch/arm/mach-ixp4xx/nas100d-pci.c             | 2 ++
 arch/arm/mach-ixp4xx/nas100d-setup.c           | 2 ++
 arch/arm/mach-ixp4xx/nslu2-pci.c               | 2 ++
 arch/arm/mach-ixp4xx/nslu2-setup.c             | 2 ++
 arch/arm/mach-ixp4xx/wg302v2-pci.c             | 2 ++
 arch/arm/mach-ixp4xx/wg302v2-setup.c           | 2 ++
 25 files changed, 47 insertions(+), 2 deletions(-)
 rename arch/arm/mach-ixp4xx/{include/mach => }/irqs.h (99%)
arch/arm/Kconfig +1 -0
index eb27554aa04f..f5ec59a549e3 100644
@@ -437,6 +437,7 @@ config ARCH_IXP4XX
 	select GPIOLIB
 	select HAVE_PCI
 	select NEED_MACH_IO_H
+	select SPARSE_IRQ
 	select USB_EHCI_BIG_ENDIAN_DESC
 	select USB_EHCI_BIG_ENDIAN_MMIO
 	help
arch/arm/mach-ixp4xx/avila-pci.c +2 -0
index 548c7d43ade6..9c834f0f4231 100644
@@ -27,6 +27,8 @@
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define AVILA_MAX_DEV	4
 #define LOFT_MAX_DEV	6
 #define IRQ_LINES	4
arch/arm/mach-ixp4xx/avila-setup.c +2 -0
index 44cbbce6bda6..1981b33109cb 100644
@@ -28,6 +28,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define AVILA_SDA_PIN	7
 #define AVILA_SCL_PIN	6
 
arch/arm/mach-ixp4xx/common.c +2 -0
index 58a1b851425e..aa8fd248c125 100644
@@ -45,6 +45,8 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
+#include "irqs.h"
+
 #define IXP4XX_TIMER_FREQ 66666000
 
 /*
arch/arm/mach-ixp4xx/coyote-pci.c +2 -0
index 5d14ce2aee6d..a16c35d2bb96 100644
@@ -23,6 +23,8 @@
 #include <asm/irq.h>
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 #define SLOT0_DEVID	14
 #define SLOT1_DEVID	15
 
arch/arm/mach-ixp4xx/coyote-setup.c +2 -0
index 7e40fe70933b..7ca43ca2816d 100644
@@ -25,6 +25,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define COYOTE_IDE_BASE_PHYS	IXP4XX_EXP_BUS_BASE(3)
 #define COYOTE_IDE_BASE_VIRT	0xFFFE1000
 #define COYOTE_IDE_REGION_SIZE	0x1000
arch/arm/mach-ixp4xx/dsmg600-pci.c +2 -0
index 8dca76937723..6899023bd1b7 100644
@@ -22,6 +22,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV		4
 #define IRQ_LINES	3
 
arch/arm/mach-ixp4xx/dsmg600-setup.c +2 -0
index 397190f3a8da..0daaede8fb6d 100644
@@ -35,6 +35,8 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
 
+#include "irqs.h"
+
 #define DSMG600_SDA_PIN		5
 #define DSMG600_SCL_PIN		4
 
arch/arm/mach-ixp4xx/fsg-pci.c +2 -0
index fd4a8625b4ae..6c08bb9d9807 100644
@@ -22,6 +22,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV		3
 #define IRQ_LINES	3
 
arch/arm/mach-ixp4xx/fsg-setup.c +2 -0
index f0a152e365b1..648932d8d7a8 100644
@@ -29,6 +29,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define FSG_SDA_PIN		12
 #define FSG_SCL_PIN		13
 
arch/arm/mach-ixp4xx/gateway7001-pci.c +2 -0
index d9d6cc089707..903c75330b76 100644
@@ -27,6 +27,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init gateway7001_pci_preinit(void)
 {
 	irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW);
arch/arm/mach-ixp4xx/gateway7001-setup.c +2 -0
index 1be6faf6da9a..678e7dfff0e5 100644
@@ -28,6 +28,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 static struct flash_platform_data gateway7001_flash_data = {
 	.map_name	= "cfi_probe",
 	.width		= 2,
arch/arm/mach-ixp4xx/gtwx5715-pci.c +2 -0
index 551d114c9e14..1223d160448f 100644
@@ -30,6 +30,8 @@
 #include <mach/hardware.h>
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 #define SLOT0_DEVID	0
 #define SLOT1_DEVID	1
 #define INTA		10 /* slot 1 has INTA and INTB crossed */
arch/arm/mach-ixp4xx/gtwx5715-setup.c +2 -0
index 16a12994fb53..5dbdde8e2338 100644
@@ -36,6 +36,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 /* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch
    and operate as an SPI type interface.  The details of the interface
    are available on Kendin/Micrel's web site. */
arch/arm/mach-ixp4xx/irqs.h renamed from arch/arm/mach-ixp4xx/include/mach/irqs.h +0 -2
similarity index 99%
rename from arch/arm/mach-ixp4xx/include/mach/irqs.h
rename to arch/arm/mach-ixp4xx/irqs.h
index dadcd4ddb0a9..6b7f220cf9e0 100644
@@ -63,8 +63,6 @@
 #define _IXP4XX_GPIO_IRQ(n)	(IRQ_IXP4XX_GPIO ## n)
 #define IXP4XX_GPIO_IRQ(n)	_IXP4XX_GPIO_IRQ(n)
 
-#define NR_IRQS 512
-
 #define	XSCALE_PMU_IRQ		(IRQ_IXP4XX_XSCALE_PMU)
 
 #endif
arch/arm/mach-ixp4xx/ixdp425-pci.c +2 -0
index 318424dd3c50..c1340465b2ea 100644
@@ -24,6 +24,8 @@
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV		4
 #define IRQ_LINES	4
 
arch/arm/mach-ixp4xx/ixdp425-setup.c +2 -0
index 57d7df79d838..6f0f7ed18ea8 100644
@@ -32,6 +32,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define IXDP425_SDA_PIN		7
 #define IXDP425_SCL_PIN		6
 
arch/arm/mach-ixp4xx/ixdpg425-pci.c +2 -0
index 1f8717ba13dc..ac0e9bc6eb4d 100644
@@ -23,6 +23,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init ixdpg425_pci_preinit(void)
 {
 	irq_set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW);
arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +2 -0
index 9d1b6b7c394c..4c7c960e1b4c 100644
@@ -14,6 +14,8 @@
 #include <linux/module.h>
 #include <mach/qmgr.h>
 
+#include "irqs.h"
+
 static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
 static struct resource *mem_res;
 static spinlock_t qmgr_lock;
arch/arm/mach-ixp4xx/nas100d-pci.c +2 -0
index 8f0eba0a6800..925ef805f966 100644
@@ -21,6 +21,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV		3
 #define IRQ_LINES	3
 
arch/arm/mach-ixp4xx/nas100d-setup.c +2 -0
index 4138d6aa4c52..9d67f8de0772 100644
@@ -34,6 +34,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 #define NAS100D_SDA_PIN		5
 #define NAS100D_SCL_PIN		6
 
arch/arm/mach-ixp4xx/nslu2-pci.c +2 -0
index 032defe111aa..d69ee4066d20 100644
@@ -21,6 +21,8 @@
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include "irqs.h"
+
 #define MAX_DEV		3
 #define IRQ_LINES	3
 
arch/arm/mach-ixp4xx/nslu2-setup.c +2 -0
index 7c2b6604187e..ee1877fcfafe 100644
@@ -32,6 +32,8 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/time.h>
 
+#include "irqs.h"
+
 #define NSLU2_SDA_PIN		7
 #define NSLU2_SCL_PIN		6
 
arch/arm/mach-ixp4xx/wg302v2-pci.c +2 -0
index c92e5b82af36..cf83f7e24179 100644
@@ -27,6 +27,8 @@
 
 #include <asm/mach/pci.h>
 
+#include "irqs.h"
+
 void __init wg302v2_pci_preinit(void)
 {
 	irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
arch/arm/mach-ixp4xx/wg302v2-setup.c +2 -0
index 90b3c604e8b6..8711e299229b 100644
@@ -29,6 +29,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
+#include "irqs.h"
+
 static struct flash_platform_data wg302v2_flash_data = {
 	.map_name	= "cfi_probe",
 	.width		= 2,
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#5 lore raw

PATCH v3 5/31 irqchip: Add driver for IXP4xx

In reply to Linus Walleij

The IXP4xx (arch/arm/mach-ixp4xx) is an old Intel XScale platform that has very wide deployment and use.

As part of modernizing the platform, we need to implement a proper irqchip in the irqchip subsystem.

The IXP4xx irqchip is tightly jotted together with the GPIO controller, and whereas in the past we would deal with this complex logic by adding necessarily different code, we can nowadays modernize it using a hierarchical irqchip.

The actual IXP4 irqchip is a simple active low level IRQ controller, whereas the GPIO functionality resides in a different memory area and adds edge trigger support for the interrupts.

The interrupts from GPIO lines 0..12 are 1:1 mapped to a fixed set of hardware IRQs on this IRQchip, so we expect the child GPIO interrupt controller to go in and allocate descriptors for these interrupts.

For the other interrupts, as we do not yet have DT support for this platform, we create a linear irqdomain and then go in and allocate the IRQs that the legacy boards use. This code will be removed on the DT probe path when we add DT support to the platform.

We add some translation code for supporting DT translations for the fwnodes, but we leave most of that for later.

---
ChangeLog v2->v3:
- Collect Marc's ACK.
ChangeLog v1->v2:
- Deny any other type than LEVEL_HIGH

irqchip maintainers: I am requesting an ACK for this once you're happy with the driver, as I intend to merge all of this IXP4xx rework through ARM SoC.

---
 MAINTAINERS                        |   2 +
 drivers/irqchip/Kconfig            |   6 +
 drivers/irqchip/Makefile           |   1 +
 drivers/irqchip/irq-ixp4xx.c       | 362 +++++++++++++++++++++++++++++
 include/linux/irqchip/irq-ixp4xx.h |  12 +
 5 files changed, 383 insertions(+)
 create mode 100644 drivers/irqchip/irq-ixp4xx.c
 create mode 100644 include/linux/irqchip/irq-ixp4xx.h
MAINTAINERS +2 -0
index 0508cf8ed022..e12f7fc21b2b 100644
@@ -1691,6 +1691,8 @@ M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 F:	arch/arm/mach-ixp4xx/
+F:	drivers/irqchip/irq-ixp4xx.c
+F:	include/linux/irqchip/irq-ixp4xx.h
 
 ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT
 M:	Jonathan Cameron <[email protected]>
drivers/irqchip/Kconfig +6 -0
index 5438abb1baba..cf7984991062 100644
@@ -160,6 +160,12 @@ config IMGPDC_IRQ
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config IXP4XX_IRQ
+	bool
+	select IRQ_DOMAIN
+	select GENERIC_IRQ_MULTI_HANDLER
+	select SPARSE_IRQ
+
 config MADERA_IRQ
 	tristate
 
drivers/irqchip/Makefile +1 -0
index 85972ae1bd7f..f8c66e958a64 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_ATMEL_AIC5_IRQ)	+= irq-atmel-aic-common.o irq-atmel-aic5.o
 obj-$(CONFIG_I8259)			+= irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)		+= irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
+obj-$(CONFIG_IXP4XX_IRQ)		+= irq-ixp4xx.o
 obj-$(CONFIG_SIRF_IRQ)			+= irq-sirfsoc.o
 obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
drivers/irqchip/irq-ixp4xx.c new file +362 -0

362 lines not on this page · raw message

include/linux/irqchip/irq-ixp4xx.h new file +12 -0
new file mode 100644
index 000000000000..9395917d6936
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __IRQ_IXP4XX_H
+#define __IRQ_IXP4XX_H
+
+#include <linux/ioport.h>
+struct irq_domain;
+
+void ixp4xx_irq_init(resource_size_t irqbase,
+		     bool is_356);
+struct irq_domain *ixp4xx_get_irq_domain(void);
+
+#endif /* __IRQ_IXP4XX_H */
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

PATCH v3 6/31 gpio: ixp4xx: Add driver for the IXP4xx GPIO

In reply to Linus Walleij

This adds a driver for the IXP4xx GPIO block found in the Intel XScale IXP4xx systems.

The GPIO part of this block is pretty straight-forward and just uses the generic MMIO GPIO library.

The irqchip side of this driver is hierarchical where the main irqchip will receive a processed level trigger in response to the edge detector of the GPIO block, so for this reason the v2 version of the irqdomain API is used (as well as in the parent IXP4xx irqchip) and masking, unmasking and setting up the type on IRQ happens on several levels.

Currently this GPIO controller will grab the parent irqdomain using a special function, but as the platform move toward device tree probing, this will not be needed:
we can just look up the parent irqdomain from the device tree.

Cc Bartosz Golaszewski <[email protected]>

---
ChangeLog v2->v3:
- Add a depends on ARM to Kconfig as the driver is currently using <asm/mach-types.h>. This can be dropped when we go full device tree.
ChangeLog v1->v2:
- Fix comment style in header
- Fix register naming to be more intuitive

---
 MAINTAINERS                |   1 +
 drivers/gpio/Kconfig       |  13 ++
 drivers/gpio/Makefile      |   1 +
 drivers/gpio/gpio-ixp4xx.c | 444 +++++++++++++++++++++++++++++++++++++
 4 files changed, 459 insertions(+)
 create mode 100644 drivers/gpio/gpio-ixp4xx.c
MAINTAINERS +1 -0
index e12f7fc21b2b..353821fdc700 100644
@@ -1691,6 +1691,7 @@ M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 F:	arch/arm/mach-ixp4xx/
+F:	drivers/gpio/gpio-ixp4xx.c
 F:	drivers/irqchip/irq-ixp4xx.c
 F:	include/linux/irqchip/irq-ixp4xx.h
 
drivers/gpio/Kconfig +13 -0
index 3f50526a771f..9adc7c2c3775 100644
@@ -287,6 +287,19 @@ config GPIO_IOP
 
 	  If unsure, say N.
 
+config GPIO_IXP4XX
+	bool "Intel IXP4xx GPIO"
+	depends on ARM # For <asm/mach-types.h>
+	depends on ARCH_IXP4XX || COMPILE_TEST
+	select GPIO_GENERIC
+	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY
+	help
+	  Say yes here to support the GPIO functionality of a number of Intel
+	  IXP4xx series of chips.
+
+	  If unsure, say N.
+
 config GPIO_LOONGSON
 	bool "Loongson-2/3 GPIO support"
 	depends on CPU_LOONGSON2 || CPU_LOONGSON3
drivers/gpio/Makefile +1 -0
index 54d55274b93a..1ee5dab9c3cf 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_GPIO_HLWD)		+= gpio-hlwd.o
 obj-$(CONFIG_HTC_EGPIO)		+= gpio-htc-egpio.o
 obj-$(CONFIG_GPIO_ICH)		+= gpio-ich.o
 obj-$(CONFIG_GPIO_IOP)		+= gpio-iop.o
+obj-$(CONFIG_GPIO_IXP4XX)	+= gpio-ixp4xx.o
 obj-$(CONFIG_GPIO_IT87)		+= gpio-it87.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= gpio-janz-ttl.o
 obj-$(CONFIG_GPIO_KEMPLD)	+= gpio-kempld.o
drivers/gpio/gpio-ixp4xx.c new file +444 -0

444 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#7 lore raw

PATCH v3 7/31 ARM: ixp4xx: Switch to use new IRQ+GPIO drivers

In reply to Linus Walleij

This deletes the old irq+gpiochip combo from the IXP4xx machine and switches it over to use the new drivers merged in respective subsystem.

Cc Jason Cooper <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

---
ChangeLog v2->v3:
- Collect Marc's ACK.

---
 arch/arm/Kconfig                              |   3 +-
 arch/arm/mach-ixp4xx/common.c                 | 318 ++----------------
 arch/arm/mach-ixp4xx/dsmg600-setup.c          |   3 -
 .../mach-ixp4xx/include/mach/ixp4xx-regs.h    |  89 -----
 arch/arm/mach-ixp4xx/nas100d-setup.c          |   3 -
 5 files changed, 24 insertions(+), 392 deletions(-)
arch/arm/Kconfig +2 -1
index f5ec59a549e3..798cb0f4f9de 100644
@@ -434,10 +434,11 @@ config ARCH_IXP4XX
 	select DMABOUNCE if PCI
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_MULTI_HANDLER
+	select GPIO_IXP4XX
 	select GPIOLIB
 	select HAVE_PCI
+	select IXP4XX_IRQ
 	select NEED_MACH_IO_H
-	select SPARSE_IRQ
 	select USB_EHCI_BIG_ENDIAN_DESC
 	select USB_EHCI_BIG_ENDIAN_MMIO
 	help
arch/arm/mach-ixp4xx/common.c +22 -296

374 lines not on this page · raw message

arch/arm/mach-ixp4xx/dsmg600-setup.c +0 -3
index 0daaede8fb6d..4d4c62fced71 100644
@@ -270,9 +270,6 @@ static void __init dsmg600_init(void)
 {
 	ixp4xx_sys_init();
 
-	/* Make sure that GPIO14 and GPIO15 are not used as clocks */
-	*IXP4XX_GPIO_GPCLKR = 0;
-
 	dsmg600_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
 	dsmg600_flash_resource.end =
 		IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +0 -89

95 lines not on this page · raw message

arch/arm/mach-ixp4xx/nas100d-setup.c +0 -3
index 9d67f8de0772..c142cfa8c5d6 100644
@@ -281,9 +281,6 @@ static void __init nas100d_init(void)
 
 	ixp4xx_sys_init();
 
-	/* gpio 14 and 15 are _not_ clocks */
-	*IXP4XX_GPIO_GPCLKR = 0;
-
 	nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
 	nas100d_flash_resource.end =
 		IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#8 lore raw

PATCH v3 8/31 clocksource/drivers/ixp4xx: Add driver

In reply to Linus Walleij

This adds a new slightly rewritten timer driver for the Intel IXP4xx clocksource, clockevent and delay timer.

Cc Daniel Lezcano <[email protected]>
Cc Thomas Gleixner <[email protected]>

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1
- Clocksource/timer maintainers: I am requesting an ACK for this once you're happy with the driver, as I intend to merge all of this IXP4xx rework through ARM SoC. See my reply to Daniel's questions:
https://marc.info/?l=linux-arm-kernel&m=155160578307914&w=2

---
 MAINTAINERS                                |   2 +
 drivers/clocksource/Kconfig                |   7 +
 drivers/clocksource/Makefile               |   1 +
 drivers/clocksource/timer-ixp4xx.c         | 249 +++++++++++++++++++++
 include/linux/platform_data/timer-ixp4xx.h |  11 +
 5 files changed, 270 insertions(+)
 create mode 100644 drivers/clocksource/timer-ixp4xx.c
 create mode 100644 include/linux/platform_data/timer-ixp4xx.h
MAINTAINERS +2 -0
index 353821fdc700..bc918f318797 100644
@@ -1691,9 +1691,11 @@ M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 F:	arch/arm/mach-ixp4xx/
+F:	drivers/clocksource/timer-ixp4xx.c
 F:	drivers/gpio/gpio-ixp4xx.c
 F:	drivers/irqchip/irq-ixp4xx.c
 F:	include/linux/irqchip/irq-ixp4xx.h
+F:	include/linux/platform_data/timer-ixp4xx.h
 
 ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT
 M:	Jonathan Cameron <[email protected]>
drivers/clocksource/Kconfig +7 -0
index 171502a356aa..6d2b0d821c27 100644
@@ -69,6 +69,13 @@ config FTTMR010_TIMER
 	  Enables support for the Faraday Technology timer block
 	  FTTMR010.
 
+config IXP4XX_TIMER
+	bool "Intel XScale IXP4xx timer driver" if COMPILE_TEST
+	depends on HAS_IOMEM
+	select CLKSRC_MMIO
+	help
+	  Enables support for the Intel XScale IXP4xx SoC timer.
+
 config ROCKCHIP_TIMER
 	bool "Rockchip timer driver" if COMPILE_TEST
 	depends on ARM || ARM64
drivers/clocksource/Makefile +1 -0
index be6e0fbc7489..dba4eff880de 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_OMAP_DM_TIMER)	+= timer-ti-dm.o
 obj-$(CONFIG_DW_APB_TIMER)	+= dw_apb_timer.o
 obj-$(CONFIG_DW_APB_TIMER_OF)	+= dw_apb_timer_of.o
 obj-$(CONFIG_FTTMR010_TIMER)	+= timer-fttmr010.o
+obj-$(CONFIG_IXP4XX_TIMER)	+= timer-ixp4xx.o
 obj-$(CONFIG_ROCKCHIP_TIMER)      += timer-rockchip.o
 obj-$(CONFIG_CLKSRC_NOMADIK_MTU)	+= nomadik-mtu.o
 obj-$(CONFIG_CLKSRC_DBX500_PRCMU)	+= clksrc-dbx500-prcmu.o
drivers/clocksource/timer-ixp4xx.c new file +249 -0

249 lines not on this page · raw message

include/linux/platform_data/timer-ixp4xx.h new file +11 -0
new file mode 100644
index 000000000000..ee92ae7edaed
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __TIMER_IXP4XX_H
+#define __TIMER_IXP4XX_H
+
+#include <linux/ioport.h>
+
+void __init ixp4xx_timer_setup(resource_size_t timerbase,
+			       int timer_irq,
+			       unsigned int timer_freq);
+
+#endif
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#9 lore raw

PATCH v3 9/31 ARM: ixp4xx: Switch to use new timer driver

In reply to Linus Walleij

This augments the IXP4xx to select and use the new timer driver in drivers/clocksource and removes the old code in the machine.

---
ChangeLog v2->v3:
- Collected Daniel's ACK.

---
 arch/arm/Kconfig              |   2 +-
 arch/arm/mach-ixp4xx/common.c | 153 +---------------------------------
 2 files changed, 5 insertions(+), 150 deletions(-)
arch/arm/Kconfig +1 -1
index 798cb0f4f9de..c614526a54ee 100644
@@ -429,7 +429,6 @@ config ARCH_IXP4XX
 	depends on MMU
 	select ARCH_HAS_DMA_SET_COHERENT_MASK
 	select ARCH_SUPPORTS_BIG_ENDIAN
-	select CLKSRC_MMIO
 	select CPU_XSCALE
 	select DMABOUNCE if PCI
 	select GENERIC_CLOCKEVENTS
@@ -438,6 +437,7 @@ config ARCH_IXP4XX
 	select GPIOLIB
 	select HAVE_PCI
 	select IXP4XX_IRQ
+	select IXP4XX_TIMER
 	select NEED_MACH_IO_H
 	select USB_EHCI_BIG_ENDIAN_DESC
 	select USB_EHCI_BIG_ENDIAN_MMIO
arch/arm/mach-ixp4xx/common.c +4 -149

187 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#10 lore raw

PATCH v3 10/31 irqchip: ixp4xx: Add DT bindings

In reply to Linus Walleij

This adds device tree bindings for the IXP4xx interrupt controller. It's a standard 2-cell controller.

---
ChangeLog v2->v3:
- Dropped oneOf on compatible
- Dropped description on reg, set maxItems 1
- Drop the description on interrupt-cells
- Collect Rob's review tag
ChangeLog v1->v2:
- Converted to use JSON yaml schema, why not.
- Not keeping Rob's ACK because I think he wants to take a second look.

---
 .../intel,ixp4xx-interrupt.yaml               | 54 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml new file +54 -0
new file mode 100644
index 000000000000..bae10e261fa9
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2018 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/interrupt/intel-ixp4xx-interrupt.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx XScale Networking Processors Interrupt Controller
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+  This interrupt controller is found in the Intel IXP4xx processors.
+  Some processors have 32 interrupts, some have up to 64 interrupts.
+  The exact number of interrupts is determined from the compatible
+  string.
+
+  The distinct IXP4xx families with different interrupt controller
+  variations are IXP42x, IXP43x, IXP45x and IXP46x. Those four
+  families were the only ones to reach the developer and consumer
+  market.
+
+properties:
+  compatible:
+    items:
+      - enum:
+        - intel,ixp42x-interrupt
+        - intel,ixp43x-interrupt
+        - intel,ixp45x-interrupt
+        - intel,ixp46x-interrupt
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 2
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+examples:
+  - |
+    intcon: interrupt-controller@c8003000 {
+        compatible = "intel,ixp43x-interrupt";
+        reg = <0xc8003000 0x100>;
+        interrupt-controller;
+        #interrupt-cells = <2>;
+    };
MAINTAINERS +1 -0
index bc918f318797..ad05704fbd68 100644
@@ -1690,6 +1690,7 @@ M:	Imre Kaloz <[email protected]>
 M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
 F:	arch/arm/mach-ixp4xx/
 F:	drivers/clocksource/timer-ixp4xx.c
 F:	drivers/gpio/gpio-ixp4xx.c
Signature · 1 line
2.20.1
#11 lore raw

PATCH v3 11/31 irqchip: ixp4xx: Add OF initialization support

In reply to Linus Walleij

This adds support for probing and settin up the IXP4xx irqchip from device tree.

---
ChangeLog v2->v3:
- Drop a superfluous NULL check in fwnode
- Collect Marc's ACK.

---
 drivers/irqchip/irq-ixp4xx.c | 41 ++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
drivers/irqchip/irq-ixp4xx.c +41 -0
index 89c80ce047a7..d576809429ac 100644
@@ -15,6 +15,9 @@
 #include <linux/irqchip.h>
 #include <linux/irqchip/irq-ixp4xx.h>
 #include <linux/irqdomain.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/cpu.h>
 
@@ -360,3 +363,41 @@ void __init ixp4xx_irq_init(resource_size_t irqbase,
 	}
 }
 EXPORT_SYMBOL_GPL(ixp4xx_irq_init);
+
+#ifdef CONFIG_OF
+int __init ixp4xx_of_init_irq(struct device_node *np,
+			      struct device_node *parent)
+{
+	struct ixp4xx_irq *ixi = &ixirq;
+	void __iomem *base;
+	struct fwnode_handle *fwnode;
+	bool is_356;
+	int ret;
+
+	base = of_iomap(np, 0);
+	if (!base) {
+		pr_crit("IXP4XX: could not ioremap interrupt controller\n");
+		return -ENODEV;
+	}
+	fwnode = of_node_to_fwnode(np);
+
+	/* These chip variants have 64 interrupts */
+	is_356 = of_device_is_compatible(np, "intel,ixp43x-interrupt") ||
+		of_device_is_compatible(np, "intel,ixp45x-interrupt") ||
+		of_device_is_compatible(np, "intel,ixp46x-interrupt");
+
+	ret = ixp4xx_irq_setup(ixi, base, fwnode, is_356);
+	if (ret)
+		pr_crit("IXP4XX: failed to set up irqchip\n");
+
+	return ret;
+}
+IRQCHIP_DECLARE(ixp42x, "intel,ixp42x-interrupt",
+		ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp43x, "intel,ixp43x-interrupt",
+		ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp45x, "intel,ixp45x-interrupt",
+		ixp4xx_of_init_irq);
+IRQCHIP_DECLARE(ixp46x, "intel,ixp46x-interrupt",
+		ixp4xx_of_init_irq);
+#endif
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#12 lore raw

PATCH v3 12/31 clocksource/drivers/ixp4xx: Add DT bindings

In reply to Linus Walleij

This adds device tree bindings for the Intel IXP4xx timers.

---
ChangeLog v2->v3:
- Collect Rob's Review tag.
ChangeLog v1->v2:
- Switch to JSON YAML schema, why not.
- Not collecting any review tags as this changed a bit.

---
 .../bindings/timer/intel,ixp4xx-timer.yaml    | 42 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml new file +42 -0
new file mode 100644
index 000000000000..a36a0746c056
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2018 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/timer/intel-ixp4xx-timer.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx XScale Networking Processors Timers
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: This timer is found in the Intel IXP4xx processors.
+
+properties:
+  compatible:
+    items:
+      - const: intel,ixp4xx-timer
+
+  reg:
+    description: Should contain registers location and length
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: Timer 1 interrupt
+      - description: Timer 2 interrupt
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    timer@c8005000 {
+        compatible = "intel,ixp4xx-timer";
+        reg = <0xc8005000 0x100>;
+        interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
+    };
MAINTAINERS +1 -0
index ad05704fbd68..78f50505a313 100644
@@ -1691,6 +1691,7 @@ M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
 F:	Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
+F:	Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
 F:	arch/arm/mach-ixp4xx/
 F:	drivers/clocksource/timer-ixp4xx.c
 F:	drivers/gpio/gpio-ixp4xx.c
Signature · 1 line
2.20.1
#13 lore raw

PATCH v3 13/31 clocksource/drivers/ixp4xx: Add OF initialization support

In reply to Linus Walleij

This adds support for setting up the IXP4xx timer driver from device tree.

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1
- Requesting an ACK from the clocksource maintainers, see my reply to Daniel:
https://marc.info/?l=linux-arm-kernel&m=155160578307914&w=2

---
 drivers/clocksource/timer-ixp4xx.c | 35 ++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
drivers/clocksource/timer-ixp4xx.c +35 -0
index fa78f80792db..404445bc11ea 100644
@@ -16,6 +16,8 @@
 #include <linux/slab.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 /* Goes away with OF conversion */
 #include <linux/platform_data/timer-ixp4xx.h>
 
@@ -247,3 +249,36 @@ void __init ixp4xx_timer_setup(resource_size_t timerbase,
 	ixp4xx_timer_register(base, timer_irq, timer_freq);
 }
 EXPORT_SYMBOL_GPL(ixp4xx_timer_setup);
+
+#ifdef CONFIG_OF
+static __init int ixp4xx_of_timer_init(struct device_node *np)
+{
+	void __iomem *base;
+	int irq;
+	int ret;
+
+	base = of_iomap(np, 0);
+	if (!base) {
+		pr_crit("IXP4xx: can't remap timer\n");
+		return -ENODEV;
+	}
+
+	irq = irq_of_parse_and_map(np, 0);
+	if (irq <= 0) {
+		pr_err("Can't parse IRQ\n");
+		ret = -EINVAL;
+		goto out_unmap;
+	}
+
+	/* TODO: get some fixed clocks into the device tree */
+	ret = ixp4xx_timer_register(base, irq, 66666000);
+	if (ret)
+		goto out_unmap;
+	return 0;
+
+out_unmap:
+	iounmap(base);
+	return ret;
+}
+TIMER_OF_DECLARE(ixp4xx, "intel,ixp4xx-timer", ixp4xx_of_timer_init);
+#endif
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#14 lore raw

PATCH v3 14/31 gpio: ixp4xx: Add DT bindings

In reply to Linus Walleij

This adds DT bindings for the IXP4xx GPIO controller.

---
ChangeLog v2->v3:
- Rebase on v5.1-rc1
ChangeLog v1->v2:
- Collect Bartosz and Rob's review tags.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 78f50505a313..0a8999c09764 100644
@@ -1690,6 +1690,7 @@ M:	Imre Kaloz <[email protected]>
 M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
 F:	Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
 F:	Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
 F:	arch/arm/mach-ixp4xx/
Signature · 1 line
2.20.1
#15 lore raw

PATCH v3 15/31 gpio: ixp4xx: Add OF probing support

In reply to Linus Walleij

This adds device tree probe and registration support for the IXP4xx GPIO driver.

Cc Bartosz Golaszewski <[email protected]>

---
ChangeLog v1->v3:
- Rebased on v5.1-rc1

---
 drivers/gpio/gpio-ixp4xx.c | 84 ++++++++++++++++++++++++++------------
 1 file changed, 57 insertions(+), 27 deletions(-)
drivers/gpio/gpio-ixp4xx.c +57 -27
index eaf317f73f75..4b1cf7ea858d 100644
@@ -11,6 +11,7 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/irqchip.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/bitops.h>
 /* Include that go away with DT transition */
@@ -306,6 +307,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 {
 	unsigned long flags;
 	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
 	struct irq_domain *parent;
 	struct resource *res;
 	struct ixp4xx_gpio *g;
@@ -382,11 +384,27 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	 * from IRQCHIP_DECLARE(), then use of_node_to_fwnode() to get
 	 * the fwnode. For now we need this boardfile style code.
 	 */
-	parent = ixp4xx_get_irq_domain();
-	g->fwnode = irq_domain_alloc_fwnode(g->base);
-	if (!g->fwnode) {
-		dev_err(dev, "no domain base\n");
-		return -ENODEV;
+	if (np) {
+		struct device_node *irq_parent;
+
+		irq_parent = of_irq_find_parent(np);
+		if (!irq_parent) {
+			dev_err(dev, "no IRQ parent node\n");
+			return -ENODEV;
+		}
+		parent = irq_find_host(irq_parent);
+		if (!parent) {
+			dev_err(dev, "no IRQ parent domain\n");
+			return -ENODEV;
+		}
+		g->fwnode = of_node_to_fwnode(np);
+	} else {
+		parent = ixp4xx_get_irq_domain();
+		g->fwnode = irq_domain_alloc_fwnode(g->base);
+		if (!g->fwnode) {
+			dev_err(dev, "no domain base\n");
+			return -ENODEV;
+		}
 	}
 	g->domain = irq_domain_create_hierarchy(parent,
 						IRQ_DOMAIN_FLAG_HIERARCHY,
@@ -404,28 +422,31 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	 * After adding OF support, this is no longer needed: irqs
 	 * will be allocated for the respective fwnodes.
 	 */
-	for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) {
-		const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i];
-		struct irq_fwspec fwspec;
-
-		fwspec.fwnode = g->fwnode;
-		/* This is the hwirq for the GPIO line side of things */
-		fwspec.param[0] = map->gpio_offset;
-		fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
-		fwspec.param_count = 2;
-		ret = __irq_domain_alloc_irqs(g->domain,
-					      -1, /* just pick something */
-					      1,
-					      NUMA_NO_NODE,
-					      &fwspec,
-					      false,
-					      NULL);
-		if (ret < 0) {
-			irq_domain_free_fwnode(g->fwnode);
-			dev_err(dev,
-				"can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
-				map->gpio_offset, map->parent_hwirq, ret);
-			return ret;
+	if (!np) {
+		for (i = 0; i < ARRAY_SIZE(ixp4xx_gpiomap); i++) {
+			const struct ixp4xx_gpio_map *map = &ixp4xx_gpiomap[i];
+			struct irq_fwspec fwspec;
+
+			fwspec.fwnode = g->fwnode;
+			/* This is the hwirq for the GPIO line side of things */
+			fwspec.param[0] = map->gpio_offset;
+			fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
+			fwspec.param_count = 2;
+			ret = __irq_domain_alloc_irqs(g->domain,
+						      -1, /* just pick something */
+						      1,
+						      NUMA_NO_NODE,
+						      &fwspec,
+						      false,
+						      NULL);
+			if (ret < 0) {
+				irq_domain_free_fwnode(g->fwnode);
+				dev_err(dev,
+					"can not allocate irq for GPIO line %d parent hwirq %d in hierarchy domain: %d\n",
+					map->gpio_offset, map->parent_hwirq,
+					ret);
+				return ret;
+			}
 		}
 	}
 
@@ -435,9 +456,18 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id ixp4xx_gpio_of_match[] = {
+	{
+		.compatible = "intel,ixp4xx-gpio",
+	},
+	{},
+};
+
+
 static struct platform_driver ixp4xx_gpio_driver = {
 	.driver = {
 		.name		= "ixp4xx-gpio",
+		.of_match_table = of_match_ptr(ixp4xx_gpio_of_match),
 	},
 	.probe = ixp4xx_gpio_probe,
 };
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#16 lore raw

PATCH v3 16/31 ARM: ixp4xx: Add DT bindings

In reply to Linus Walleij

This adds initial device tree bindings for the IXP4xx machines. This time I tried something wild and crazy and try to make proper JSON-style YAML bindings for the top level.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1
ChangeLog v1->v2:
- Fix up the GW2358 compatible string.

---
 .../devicetree/bindings/arm/intel-ixp4xx.yaml | 22 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml new file +22 -0
new file mode 100644
index 000000000000..f4f7451e5e8a
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/intel-ixp4xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Intel IXP4xx Device Tree Bindings
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - linksys,nslu2
+          - const: intel,ixp42x
+      - items:
+          - enum:
+              - gateworks,gw2358
+          - const: intel,ixp43x
MAINTAINERS +1 -0
index 0a8999c09764..49052de0567b 100644
@@ -1690,6 +1690,7 @@ M:	Imre Kaloz <[email protected]>
 M:	Krzysztof Halasa <[email protected]>
 L:	[email protected] (moderated for non-subscribers)
 S:	Maintained
+F:	Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
 F:	Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
 F:	Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
 F:	Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
Signature · 1 line
2.20.1
#17 lore raw

PATCH v3 17/31 ARM: ixp4xx: Add device tree boot support

In reply to Linus Walleij

This adds a minimal support for booting IXP4xx systems from device tree.

We have to add hacks to the QMGR, NPE and notably also ethernet and watchdog drivers so that they don't crash the platform: these drivers are unconditionally starting to grab regions of statically remapped IO space with no concern of the device model or other platforms.

We will go in and properly fix these drivers as we go along but for now this hack gets us to a place where we can start working on proper device tree support for these platforms.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1
ChangeLog v1->v2:
- Remap the external bus registers since the feature checks for different hardware using ixp4xx_read_feature_bits() to determine the system configuration needs this static map. We can eventually move this to syscon but only if we first move all boards to device tree.

---
 arch/arm/mach-ixp4xx/Kconfig             | 14 ++++++
 arch/arm/mach-ixp4xx/Makefile            |  3 ++
 arch/arm/mach-ixp4xx/ixp4xx-of.c         | 60 ++++++++++++++++++++++++
 arch/arm/mach-ixp4xx/ixp4xx_npe.c        |  5 ++
 arch/arm/mach-ixp4xx/ixp4xx_qmgr.c       |  5 ++
 drivers/net/ethernet/xscale/ixp4xx_eth.c | 10 ++++
 drivers/watchdog/ixp4xx_wdt.c            |  9 ++++
 7 files changed, 106 insertions(+)
 create mode 100644 arch/arm/mach-ixp4xx/ixp4xx-of.c
arch/arm/mach-ixp4xx/Kconfig +14 -0
index fea008123eb1..0973270f4863 100644
@@ -4,6 +4,20 @@ menu "Intel IXP4xx Implementation Options"
 
 comment "IXP4xx Platforms"
 
+config MACH_IXP4XX_OF
+	bool
+	prompt "Devce Tree IXP4xx boards"
+	default y
+	select ARM_APPENDED_DTB # Old Redboot bootloaders deployed
+	select I2C
+	select I2C_IOP3XX
+	select PCI
+	select SERIAL_OF_PLATFORM
+	select TIMER_OF
+	select USE_OF
+	help
+	  Say 'Y' here to support Device Tree-based IXP4xx platforms.
+
 config MACH_NSLU2
 	bool
 	prompt "Linksys NSLU2"
arch/arm/mach-ixp4xx/Makefile +3 -0
index f09994500a34..5f63b3012826 100644
@@ -6,6 +6,9 @@
 obj-pci-y	:=
 obj-pci-n	:=
 
+# Device tree platform
+obj-pci-$(CONFIG_MACH_IXP4XX_OF)	+= ixp4xx-of.o
+
 obj-pci-$(CONFIG_ARCH_IXDP4XX)		+= ixdp425-pci.o
 obj-pci-$(CONFIG_MACH_AVILA)		+= avila-pci.o
 obj-pci-$(CONFIG_MACH_IXDPG425)		+= ixdpg425-pci.o
arch/arm/mach-ixp4xx/ixp4xx-of.c new file +60 -0

60 lines not on this page · raw message

arch/arm/mach-ixp4xx/ixp4xx_npe.c +5 -0
index d4eb09a62863..e0ce22cd9bfc 100644
@@ -20,6 +20,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <mach/npe.h>
 
 #define DEBUG_MSG			0
@@ -688,6 +689,10 @@ static int __init npe_init_module(void)
 
 	int i, found = 0;
 
+	/* This driver does not work with device tree */
+	if (of_have_populated_dt())
+		return -ENODEV;
+
 	for (i = 0; i < NPE_COUNT; i++) {
 		struct npe *npe = &npe_tab[i];
 		if (!(ixp4xx_read_feature_bits() &
arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +5 -0
index 4c7c960e1b4c..2665347a2c6f 100644
@@ -12,6 +12,7 @@
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <mach/qmgr.h>
 
 #include "irqs.h"
@@ -289,6 +290,10 @@ static int qmgr_init(void)
 	int i, err;
 	irq_handler_t handler1, handler2;
 
+	/* This driver does not work with device tree */
+	if (of_have_populated_dt())
+		return -ENODEV;
+
 	mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS,
 				     IXP4XX_QMGR_REGION_SIZE,
 				     "IXP4xx Queue Manager");
drivers/net/ethernet/xscale/ixp4xx_eth.c +10 -0
index ed6623a9801e..05d27fa9835f 100644
@@ -31,6 +31,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/net_tstamp.h>
+#include <linux/of.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/ptp_classify.h>
@@ -1497,6 +1498,15 @@ static struct platform_driver ixp4xx_eth_driver = {
 static int __init eth_init_module(void)
 {
 	int err;
+
+	/*
+	 * FIXME: we bail out on device tree boot but this really needs
+	 * to be fixed in a nicer way: this registers the MDIO bus before
+	 * even matching the driver infrastructure, we should only probe
+	 * detected hardware.
+	 */
+	if (of_have_populated_dt())
+		return -ENODEV;
 	if ((err = ixp4xx_mdio_register()))
 		return err;
 	return platform_driver_register(&ixp4xx_eth_driver);
drivers/watchdog/ixp4xx_wdt.c +9 -0
index f20cc53ff719..a80449bb36f0 100644
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
+#include <linux/of.h>
 #include <linux/watchdog.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
@@ -176,6 +177,14 @@ static int __init ixp4xx_wdt_init(void)
 {
 	int ret;
 
+	/*
+	 * FIXME: we bail out on device tree boot but this really needs
+	 * to be fixed in a nicer way: this registers the MDIO bus before
+	 * even matching the driver infrastructure, we should only probe
+	 * detected hardware.
+	 */
+	if (of_have_populated_dt())
+		return -ENODEV;
 	if (!(read_cpuid_id() & 0xf) && !cpu_is_ixp46x()) {
 		pr_err("Rev. A0 IXP42x CPU detected - watchdog disabled\n");
 
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#18 lore raw

PATCH v3 18/31 ARM: dts: Add some initial IXP4xx device trees

In reply to Linus Walleij

This adds a device tree for the IXP4xx-based Linksys NSLU2 and Gateworks GW2358 which encompass the Gateworks Cambria family.

These will be the first IXP4xx device tree platforms.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1
ChangeLog RFC->v2:
- Take out of RFC
- Use ISC license on the files, *BSD likes this license

---
 arch/arm/boot/dts/Makefile                    |   3 +
 .../boot/dts/intel-ixp42x-linksys-nslu2.dts   | 109 ++++++++++++++++++
 arch/arm/boot/dts/intel-ixp42x.dtsi           |  25 ++++
 .../dts/intel-ixp43x-gateworks-gw2358.dts     |  94 +++++++++++++++
 arch/arm/boot/dts/intel-ixp43x.dtsi           |  15 +++
 arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi    |  34 ++++++
 arch/arm/boot/dts/intel-ixp4xx.dtsi           |  58 ++++++++++
 7 files changed, 338 insertions(+)
 create mode 100644 arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts
 create mode 100644 arch/arm/boot/dts/intel-ixp42x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts
 create mode 100644 arch/arm/boot/dts/intel-ixp43x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi
 create mode 100644 arch/arm/boot/dts/intel-ixp4xx.dtsi
arch/arm/boot/dts/Makefile +3 -0
index f4f5aeaf3298..7af4e3289a89 100644
@@ -229,6 +229,9 @@ dtb-$(CONFIG_ARCH_HIX5HD2) += \
 dtb-$(CONFIG_ARCH_INTEGRATOR) += \
 	integratorap.dtb \
 	integratorcp.dtb
+dtb-$(CONFIG_ARCH_IXP4XX) += \
+	intel-ixp42x-linksys-nslu2.dtb \
+	intel-ixp43x-gateworks-gw2358.dtb
 dtb-$(CONFIG_ARCH_KEYSTONE) += \
 	keystone-k2hk-evm.dtb \
 	keystone-k2l-evm.dtb \
arch/arm/boot/dts/intel-ixp42x-linksys-nslu2.dts new file +109 -0

109 lines not on this page · raw message

arch/arm/boot/dts/intel-ixp42x.dtsi new file +25 -0
new file mode 100644
index 000000000000..a9622ca850cc
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP 42x series. This series has 32 interrupts.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+	soc {
+		interrupt-controller@c8003000 {
+			compatible = "intel,ixp42x-interrupt";
+		};
+
+		/*
+		 * This is the USB Device Mode (UDC) controller, which is used
+		 * to present the IXP4xx as a device on a USB bus.
+		 */
+		usb@c800b000 {
+			compatible = "intel,ixp4xx-udc";
+			reg = <0xc800b000 0x1000>;
+			interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+	};
+};
arch/arm/boot/dts/intel-ixp43x-gateworks-gw2358.dts new file +94 -0

94 lines not on this page · raw message

arch/arm/boot/dts/intel-ixp43x.dtsi new file +15 -0
new file mode 100644
index 000000000000..494fb2ff57a0
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP 43x series. This series has 64 interrupts and adds a few more
+ * peripherals over the 42x series.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+	soc {
+		interrupt-controller@c8003000 {
+			compatible = "intel,ixp43x-interrupt";
+		};
+	};
+};
arch/arm/boot/dts/intel-ixp45x-ixp46x.dtsi new file +34 -0
new file mode 100644
index 000000000000..f8cd506659dc
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: ISC
+/*
+ * Device Tree file for Intel XScale Network Processors
+ * in the IXP45x and IXP46x series. This series has 64 interrupts and adds a
+ * few more peripherals over the 42x and 43x series so this extends the
+ * basic IXP4xx DTSI.
+ */
+#include "intel-ixp4xx.dtsi"
+
+/ {
+	soc {
+		interrupt-controller@c8003000 {
+			compatible = "intel,ixp43x-interrupt";
+		};
+
+		/*
+		 * This is the USB Device Mode (UDC) controller, which is used
+		 * to present the IXP4xx as a device on a USB bus.
+		 */
+		usb@c800b000 {
+			compatible = "intel,ixp4xx-udc";
+			reg = <0xc800b000 0x1000>;
+			interrupts = <12 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+
+		i2c@c8011000 {
+			compatible = "intel,ixp4xx-i2c";
+			reg = <0xc8011000 0x18>;
+			interrupts = <33 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+		};
+	};
+};
arch/arm/boot/dts/intel-ixp4xx.dtsi new file +58 -0

58 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#19 lore raw

PATCH v3 19/31 ARM: ixp4xx: Move NPE and QMGR to drivers/soc

In reply to Linus Walleij

The Network Processing Engine and Queue Manager are versatile firmware components used by several IXP4xx drivers.

Drivers are relying on getting access to these components using <mach/*> headers which does not work with multiplatform. We need to find a better place for the drivers to live.

Let's first move them to drivers/soc and the start to refactor a bit by passing resources and moving headers.

This patch introduce static IRQ assignments but that will be fixed by later patches in this series.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc

---
 MAINTAINERS                                      |  4 ++--
 arch/arm/mach-ixp4xx/Kconfig                     | 13 -------------
 arch/arm/mach-ixp4xx/Makefile                    |  2 --
 drivers/soc/Kconfig                              |  1 +
 drivers/soc/Makefile                             |  1 +
 drivers/soc/ixp4xx/Kconfig                       | 16 ++++++++++++++++
 drivers/soc/ixp4xx/Makefile                      |  2 ++
 .../soc/ixp4xx/ixp4xx-npe.c                      |  0
 .../soc/ixp4xx/ixp4xx-qmgr.c                     |  5 ++++-
 9 files changed, 26 insertions(+), 18 deletions(-)
 create mode 100644 drivers/soc/ixp4xx/Kconfig
 create mode 100644 drivers/soc/ixp4xx/Makefile
 rename arch/arm/mach-ixp4xx/ixp4xx_npe.c => drivers/soc/ixp4xx/ixp4xx-npe.c (100%)
 rename arch/arm/mach-ixp4xx/ixp4xx_qmgr.c => drivers/soc/ixp4xx/ixp4xx-qmgr.c (98%)
MAINTAINERS +2 -2
index 49052de0567b..dbbd7594a9b8 100644
@@ -7888,8 +7888,8 @@ M:	Krzysztof Halasa <[email protected]>
 S:	Maintained
 F:	arch/arm/mach-ixp4xx/include/mach/qmgr.h
 F:	arch/arm/mach-ixp4xx/include/mach/npe.h
-F:	arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
-F:	arch/arm/mach-ixp4xx/ixp4xx_npe.c
+F:	drivers/soc/ixp4xx/ixp4xx-qmgr.c
+F:	drivers/soc/ixp4xx/ixp4xx-npe.c
 F:	drivers/net/ethernet/xscale/ixp4xx_eth.c
 F:	drivers/net/wan/ixp4xx_hss.c
 
arch/arm/mach-ixp4xx/Kconfig +0 -13
index 0973270f4863..83afb80d38a8 100644
@@ -236,19 +236,6 @@ config IXP4XX_INDIRECT_PCI
 	  need to use the indirect method instead. If you don't know
 	  what you need, leave this option unselected.
 
-config IXP4XX_QMGR
-	tristate "IXP4xx Queue Manager support"
-	help
-	  This driver supports IXP4xx built-in hardware queue manager
-	  and is automatically selected by Ethernet and HSS drivers.
-
-config IXP4XX_NPE
-	tristate "IXP4xx Network Processor Engine support"
-	select FW_LOADER
-	help
-	  This driver supports IXP4xx built-in network coprocessors
-	  and is automatically selected by Ethernet and HSS drivers.
-
 endmenu
 
 endif
arch/arm/mach-ixp4xx/Makefile +0 -2
index 5f63b3012826..1fa4e6605782 100644
@@ -43,5 +43,3 @@ obj-$(CONFIG_MACH_GORAMO_MLR)	+= goramo_mlr.o
 obj-$(CONFIG_MACH_ARCOM_VULCAN)	+= vulcan-setup.o
 
 obj-$(CONFIG_PCI)		+= $(obj-pci-$(CONFIG_PCI)) common-pci.o
-obj-$(CONFIG_IXP4XX_QMGR)	+= ixp4xx_qmgr.o
-obj-$(CONFIG_IXP4XX_NPE)	+= ixp4xx_npe.o
drivers/soc/Kconfig +1 -0
index c07b4a85253f..ae9bf20b26fa 100644
@@ -6,6 +6,7 @@ source "drivers/soc/atmel/Kconfig"
 source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/imx/Kconfig"
+source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
drivers/soc/Makefile +1 -0
index 90b686e586c6..c7c1a139ad8d 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
 obj-$(CONFIG_ARCH_MXC)		+= imx/
+obj-$(CONFIG_ARCH_IXP4XX)	+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
 obj-y				+= mediatek/
 obj-y				+= amlogic/
drivers/soc/ixp4xx/Kconfig new file +16 -0
new file mode 100644
index 000000000000..de6becdc78a2
@@ -0,0 +1,16 @@
+menu "IXP4xx SoC drivers"
+
+config IXP4XX_QMGR
+	tristate "IXP4xx Queue Manager support"
+	help
+	  This driver supports IXP4xx built-in hardware queue manager
+	  and is automatically selected by Ethernet and HSS drivers.
+
+config IXP4XX_NPE
+	tristate "IXP4xx Network Processor Engine support"
+	select FW_LOADER
+	help
+	  This driver supports IXP4xx built-in network coprocessors
+	  and is automatically selected by Ethernet and HSS drivers.
+
+endmenu
drivers/soc/ixp4xx/Makefile new file +2 -0
new file mode 100644
index 000000000000..d20d99e6df65
@@ -0,0 +1,2 @@
+obj-$(CONFIG_IXP4XX_QMGR)	+= ixp4xx-qmgr.o
+obj-$(CONFIG_IXP4XX_NPE)	+= ixp4xx-npe.o
drivers/soc/ixp4xx/ixp4xx-npe.c renamed from arch/arm/mach-ixp4xx/ixp4xx_npe.c +0 -0
similarity index 100%
rename from arch/arm/mach-ixp4xx/ixp4xx_npe.c
rename to drivers/soc/ixp4xx/ixp4xx-npe.c
drivers/soc/ixp4xx/ixp4xx-qmgr.c renamed from arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +4 -1
similarity index 98%
rename from arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
rename to drivers/soc/ixp4xx/ixp4xx-qmgr.c
index 2665347a2c6f..2e6d33534afe 100644
@@ -15,7 +15,10 @@
 #include <linux/of.h>
 #include <mach/qmgr.h>
 
-#include "irqs.h"
+/* FIXME: get rid of these static assigments */
+#define IRQ_IXP4XX_BASE		16
+#define IRQ_IXP4XX_QM1		(IRQ_IXP4XX_BASE + 3)
+#define IRQ_IXP4XX_QM2		(IRQ_IXP4XX_BASE + 4)
 
 static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
 static struct resource *mem_res;
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#20 lore raw

PATCH v3 20/31 ARM: ixp4xx: Move IXP4xx QMGR and NPE headers

In reply to Linus Walleij

This moves the IXP4xx Queue Manager and Network Processing Engine headers out of the <mack/*> include path as that is incompatible with multiplatform.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 MAINTAINERS                                                   | 4 ++--
 drivers/crypto/ixp4xx_crypto.c                                | 4 ++--
 drivers/net/ethernet/xscale/ixp4xx_eth.c                      | 4 ++--
 drivers/net/wan/ixp4xx_hss.c                                  | 4 ++--
 drivers/soc/ixp4xx/ixp4xx-npe.c                               | 2 +-
 drivers/soc/ixp4xx/ixp4xx-qmgr.c                              | 2 +-
 .../include/mach => include/linux/soc/ixp4xx}/npe.h           | 0
 .../include/mach => include/linux/soc/ixp4xx}/qmgr.h          | 0
 8 files changed, 10 insertions(+), 10 deletions(-)
 rename {arch/arm/mach-ixp4xx/include/mach => include/linux/soc/ixp4xx}/npe.h (100%)
 rename {arch/arm/mach-ixp4xx/include/mach => include/linux/soc/ixp4xx}/qmgr.h (100%)
MAINTAINERS +2 -2
index dbbd7594a9b8..fb5911d46c2d 100644
@@ -7886,8 +7886,8 @@ F:	Documentation/media/v4l-drivers/ipu3.rst
 INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
 M:	Krzysztof Halasa <[email protected]>
 S:	Maintained
-F:	arch/arm/mach-ixp4xx/include/mach/qmgr.h
-F:	arch/arm/mach-ixp4xx/include/mach/npe.h
+F:	include/linux/soc/ixp4xx/qmgr.h
+F:	include/linux/soc/ixp4xx/npe.h
 F:	drivers/soc/ixp4xx/ixp4xx-qmgr.c
 F:	drivers/soc/ixp4xx/ixp4xx-npe.c
 F:	drivers/net/ethernet/xscale/ixp4xx_eth.c
drivers/crypto/ixp4xx_crypto.c +2 -2
index 5c4659b04d70..5522d64ecfda 100644
@@ -30,8 +30,8 @@
 #include <crypto/authenc.h>
 #include <crypto/scatterwalk.h>
 
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define MAX_KEYLEN 32
 
drivers/net/ethernet/xscale/ixp4xx_eth.c +2 -2
index 05d27fa9835f..319db3ece263 100644
@@ -38,8 +38,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <mach/ixp46x_ts.h>
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define DEBUG_DESC		0
 #define DEBUG_RX		0
drivers/net/wan/ixp4xx_hss.c +2 -2
index 5c60dc60a8e6..46a05b6540b8 100644
@@ -22,8 +22,8 @@
 #include <linux/platform_device.h>
 #include <linux/poll.h>
 #include <linux/slab.h>
-#include <mach/npe.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/npe.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 #define DEBUG_DESC		0
 #define DEBUG_RX		0
drivers/soc/ixp4xx/ixp4xx-npe.c +1 -1
index e0ce22cd9bfc..1f6e01369d54 100644
@@ -21,7 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <mach/npe.h>
+#include <linux/soc/ixp4xx/npe.h>
 
 #define DEBUG_MSG			0
 #define DEBUG_FW			0
drivers/soc/ixp4xx/ixp4xx-qmgr.c +1 -1
index 2e6d33534afe..1bed048924bb 100644
@@ -13,7 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <mach/qmgr.h>
+#include <linux/soc/ixp4xx/qmgr.h>
 
 /* FIXME: get rid of these static assigments */
 #define IRQ_IXP4XX_BASE		16
include/linux/soc/ixp4xx/npe.h renamed from arch/arm/mach-ixp4xx/include/mach/npe.h +0 -0
similarity index 100%
rename from arch/arm/mach-ixp4xx/include/mach/npe.h
rename to include/linux/soc/ixp4xx/npe.h
include/linux/soc/ixp4xx/qmgr.h renamed from arch/arm/mach-ixp4xx/include/mach/qmgr.h +0 -0
similarity index 100%
rename from arch/arm/mach-ixp4xx/include/mach/qmgr.h
rename to include/linux/soc/ixp4xx/qmgr.h
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#21 lore raw

PATCH v3 21/31 ARM: ixp4xx: Turn the NPE into a platform device

In reply to Linus Walleij

Instead of registering everything related to the NPE unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the NPE like any other device.

Put the device first in the list of devices added for the platform so it is there when the dependent network and crypto drivers probe later on.

This probe() path will not be taken unconditionally on device tree boots, so remove the DT guard.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 arch/arm/mach-ixp4xx/common.c   |  6 ++++++
 drivers/soc/ixp4xx/ixp4xx-npe.c | 23 +++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)
arch/arm/mach-ixp4xx/common.c +6 -0
index fc4c9b21ca96..e7789d06c39b 100644
@@ -150,7 +150,13 @@ static struct platform_device ixp4xx_udc_device = {
 	},
 };
 
+static struct platform_device ixp4xx_npe_device = {
+	.name           = "ixp4xx-npe",
+	.id             = -1,
+};
+
 static struct platform_device *ixp4xx_devices[] __initdata = {
+	&ixp4xx_npe_device,
 	&ixp4xx_gpio_device,
 	&ixp4xx_udc_device,
 };
drivers/soc/ixp4xx/ixp4xx-npe.c +13 -10
index 1f6e01369d54..e3294457b5de 100644
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/platform_device.h>
 #include <linux/soc/ixp4xx/npe.h>
 
 #define DEBUG_MSG			0
@@ -683,16 +684,10 @@ void npe_release(struct npe *npe)
 	module_put(THIS_MODULE);
 }
 
-
-static int __init npe_init_module(void)
+static int ixp4xx_npe_probe(struct platform_device *pdev)
 {
-
 	int i, found = 0;
 
-	/* This driver does not work with device tree */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
 	for (i = 0; i < NPE_COUNT; i++) {
 		struct npe *npe = &npe_tab[i];
 		if (!(ixp4xx_read_feature_bits() &
@@ -717,7 +712,7 @@ static int __init npe_init_module(void)
 	return 0;
 }
 
-static void __exit npe_cleanup_module(void)
+static int ixp4xx_npe_remove(struct platform_device *pdev)
 {
 	int i;
 
@@ -726,10 +721,18 @@ static void __exit npe_cleanup_module(void)
 			npe_reset(&npe_tab[i]);
 			release_resource(npe_tab[i].mem_res);
 		}
+
+	return 0;
 }
 
-module_init(npe_init_module);
-module_exit(npe_cleanup_module);
+static struct platform_driver ixp4xx_npe_driver = {
+	.driver = {
+		.name           = "ixp4xx-npe",
+	},
+	.probe = ixp4xx_npe_probe,
+	.remove = ixp4xx_npe_remove,
+};
+module_platform_driver(ixp4xx_npe_driver);
 
 MODULE_AUTHOR("Krzysztof Halasa");
 MODULE_LICENSE("GPL v2");
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#22 lore raw

PATCH v3 22/31 ARM: ixp4xx: Turn the QMGR into a platform device

In reply to Linus Walleij

Instead of registering everything related to the QMGR unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the QMGR like any other device.

Put the device second in the list of devices added for the platform so it is there when the dependent network and crypto drivers probe later on.

This probe() path will not be taken unconditionally on device tree boots, so remove the DT guard.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 arch/arm/mach-ixp4xx/common.c    |  6 ++++++
 drivers/soc/ixp4xx/ixp4xx-qmgr.c | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)
arch/arm/mach-ixp4xx/common.c +6 -0
index e7789d06c39b..cdcd6d6b6d3d 100644
@@ -155,8 +155,14 @@ static struct platform_device ixp4xx_npe_device = {
 	.id             = -1,
 };
 
+static struct platform_device ixp4xx_qmgr_device = {
+	.name           = "ixp4xx-qmgr",
+	.id             = -1,
+};
+
 static struct platform_device *ixp4xx_devices[] __initdata = {
 	&ixp4xx_npe_device,
+	&ixp4xx_qmgr_device,
 	&ixp4xx_gpio_device,
 	&ixp4xx_udc_device,
 };
drivers/soc/ixp4xx/ixp4xx-qmgr.c +13 -8
index 1bed048924bb..133914e99aeb 100644
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/platform_device.h>
 #include <linux/soc/ixp4xx/qmgr.h>
 
 /* FIXME: get rid of these static assigments */
@@ -288,15 +289,11 @@ void qmgr_release_queue(unsigned int queue)
 	module_put(THIS_MODULE);
 }
 
-static int qmgr_init(void)
+static int ixp4xx_qmgr_probe(struct platform_device *pdev)
 {
 	int i, err;
 	irq_handler_t handler1, handler2;
 
-	/* This driver does not work with device tree */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
 	mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS,
 				     IXP4XX_QMGR_REGION_SIZE,
 				     "IXP4xx Queue Manager");
@@ -355,17 +352,25 @@ static int qmgr_init(void)
 	return err;
 }
 
-static void qmgr_remove(void)
+static int ixp4xx_qmgr_remove(struct platform_device *pdev)
 {
 	free_irq(IRQ_IXP4XX_QM1, NULL);
 	free_irq(IRQ_IXP4XX_QM2, NULL);
 	synchronize_irq(IRQ_IXP4XX_QM1);
 	synchronize_irq(IRQ_IXP4XX_QM2);
 	release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
+
+	return 0;
 }
 
-module_init(qmgr_init);
-module_exit(qmgr_remove);
+static struct platform_driver ixp4xx_qmgr_driver = {
+	.driver = {
+		.name           = "ixp4xx-qmgr",
+	},
+	.probe = ixp4xx_qmgr_probe,
+	.remove = ixp4xx_qmgr_remove,
+};
+module_platform_driver(ixp4xx_qmgr_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Krzysztof Halasa");
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#23 lore raw

PATCH v3 23/31 soc: ixp4xx: npe: Pass addresses as resources

In reply to Linus Walleij

Instead of using hardcoded base addresses implicitly obtained through <linux/io.h>, pass the physical base for the three NPE blocks as memory resources and remap these in the driver.

Drop the memory request region business, this will anyways be done by devm_* remapping functions.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 arch/arm/mach-ixp4xx/common.c                 | 21 +++++++++++
 .../mach-ixp4xx/include/mach/ixp4xx-regs.h    |  3 --
 drivers/soc/ixp4xx/ixp4xx-npe.c               | 36 ++++++++++---------
 include/linux/soc/ixp4xx/npe.h                |  2 --
 4 files changed, 41 insertions(+), 21 deletions(-)
arch/arm/mach-ixp4xx/common.c +21 -0
index cdcd6d6b6d3d..07c3cb312a92 100644
@@ -150,9 +150,30 @@ static struct platform_device ixp4xx_udc_device = {
 	},
 };
 
+static struct resource ixp4xx_npe_resources[] = {
+	{
+		.start = IXP4XX_NPEA_BASE_PHYS,
+		.end = IXP4XX_NPEA_BASE_PHYS + 0xfff,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.start = IXP4XX_NPEB_BASE_PHYS,
+		.end = IXP4XX_NPEB_BASE_PHYS + 0xfff,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.start = IXP4XX_NPEC_BASE_PHYS,
+		.end = IXP4XX_NPEC_BASE_PHYS + 0xfff,
+		.flags = IORESOURCE_MEM,
+	},
+
+};
+
 static struct platform_device ixp4xx_npe_device = {
 	.name           = "ixp4xx-npe",
 	.id             = -1,
+	.num_resources  = ARRAY_SIZE(ixp4xx_npe_resources),
+	.resource       = ixp4xx_npe_resources,
 };
 
 static struct platform_device ixp4xx_qmgr_device = {
arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +0 -3
index 459abe2eb4b5..f5d5b258c3f7 100644
@@ -132,9 +132,6 @@
 #define IXP4XX_INTC_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
 #define IXP4XX_GPIO_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
 #define IXP4XX_TIMER_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
-#define IXP4XX_NPEA_BASE_VIRT   	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000)
-#define IXP4XX_NPEB_BASE_VIRT   	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000)
-#define IXP4XX_NPEC_BASE_VIRT   	(IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000)
 #define IXP4XX_EthB_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
 #define IXP4XX_EthC_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
 #define IXP4XX_USB_BASE_VIRT		(IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
drivers/soc/ixp4xx/ixp4xx-npe.c +20 -16
index e3294457b5de..d2dd916816d4 100644
@@ -155,16 +155,10 @@ static struct {
 static struct npe npe_tab[NPE_COUNT] = {
 	{
 		.id	= 0,
-		.regs	= (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT,
-		.regs_phys = IXP4XX_NPEA_BASE_PHYS,
 	}, {
 		.id	= 1,
-		.regs	= (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT,
-		.regs_phys = IXP4XX_NPEB_BASE_PHYS,
 	}, {
 		.id	= 2,
-		.regs	= (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT,
-		.regs_phys = IXP4XX_NPEC_BASE_PHYS,
 	}
 };
 
@@ -687,23 +681,34 @@ void npe_release(struct npe *npe)
 static int ixp4xx_npe_probe(struct platform_device *pdev)
 {
 	int i, found = 0;
+	struct device *dev = &pdev->dev;
+	struct resource *res;
 
 	for (i = 0; i < NPE_COUNT; i++) {
 		struct npe *npe = &npe_tab[i];
+
+		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+		if (!res)
+			return -ENODEV;
+
 		if (!(ixp4xx_read_feature_bits() &
-		      (IXP4XX_FEATURE_RESET_NPEA << i)))
+		      (IXP4XX_FEATURE_RESET_NPEA << i))) {
+			dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n",
+				 i, res->start, res->end);
 			continue; /* NPE already disabled or not present */
-		if (!(npe->mem_res = request_mem_region(npe->regs_phys,
-							REGS_SIZE,
-							npe_name(npe)))) {
-			print_npe(KERN_ERR, npe,
-				  "failed to request memory region\n");
-			continue;
 		}
+		npe->regs = devm_ioremap_resource(dev, res);
+		if (!npe->regs)
+			return -ENOMEM;
 
-		if (npe_reset(npe))
+		if (npe_reset(npe)) {
+			dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n",
+				 i, res->start, res->end);
 			continue;
+		}
 		npe->valid = 1;
+		dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n",
+			 i, res->start, res->end);
 		found++;
 	}
 
@@ -717,9 +722,8 @@ static int ixp4xx_npe_remove(struct platform_device *pdev)
 	int i;
 
 	for (i = 0; i < NPE_COUNT; i++)
-		if (npe_tab[i].mem_res) {
+		if (npe_tab[i].regs) {
 			npe_reset(&npe_tab[i]);
-			release_resource(npe_tab[i].mem_res);
 		}
 
 	return 0;
include/linux/soc/ixp4xx/npe.h +0 -2
index 3a980845e557..2a91f465d456 100644
@@ -16,9 +16,7 @@ struct npe_regs {
 };
 
 struct npe {
-	struct resource *mem_res;
 	struct npe_regs __iomem *regs;
-	u32 regs_phys;
 	int id;
 	int valid;
 };
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#24 lore raw

PATCH v3 24/31 soc: ixp4xx: Uninline several functions

In reply to Linus Walleij

These inline functions immediately exploit the static ioremaps for the queue manager memory region. This does not work with multiplatform where everything need to be dynamically remapped, so get rid of these inlines and create new exports for those used by other drivers.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 drivers/soc/ixp4xx/ixp4xx-qmgr.c | 117 ++++++++++++++++++++++++++++
 include/linux/soc/ixp4xx/qmgr.h  | 127 ++-----------------------------
 2 files changed, 124 insertions(+), 120 deletions(-)
drivers/soc/ixp4xx/ixp4xx-qmgr.c +117 -0
index 133914e99aeb..412a346136d8 100644
@@ -32,6 +32,117 @@ static void *irq_pdevs[QUEUES];
 char qmgr_queue_descs[QUEUES][32];
 #endif
 
+void qmgr_put_entry(unsigned int queue, u32 val)
+{
+#if DEBUG_QMGR
+	BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
+
+	printk(KERN_DEBUG "Queue %s(%i) put %X\n",
+	       qmgr_queue_descs[queue], queue, val);
+#endif
+	__raw_writel(val, &qmgr_regs->acc[queue][0]);
+}
+
+u32 qmgr_get_entry(unsigned int queue)
+{
+	u32 val;
+	val = __raw_readl(&qmgr_regs->acc[queue][0]);
+#if DEBUG_QMGR
+	BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
+
+	printk(KERN_DEBUG "Queue %s(%i) get %X\n",
+	       qmgr_queue_descs[queue], queue, val);
+#endif
+	return val;
+}
+
+static int __qmgr_get_stat1(unsigned int queue)
+{
+	return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
+		>> ((queue & 7) << 2)) & 0xF;
+}
+
+static int __qmgr_get_stat2(unsigned int queue)
+{
+	BUG_ON(queue >= HALF_QUEUES);
+	return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
+		>> ((queue & 0xF) << 1)) & 0x3;
+}
+
+/**
+ * qmgr_stat_empty() - checks if a hardware queue is empty
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue is empty.
+ */
+int qmgr_stat_empty(unsigned int queue)
+{
+	BUG_ON(queue >= HALF_QUEUES);
+	return __qmgr_get_stat1(queue) & QUEUE_STAT1_EMPTY;
+}
+
+/**
+ * qmgr_stat_below_low_watermark() - checks if a queue is below low watermark
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue is below low watermark.
+ */
+int qmgr_stat_below_low_watermark(unsigned int queue)
+{
+	if (queue >= HALF_QUEUES)
+		return (__raw_readl(&qmgr_regs->statne_h) >>
+			(queue - HALF_QUEUES)) & 0x01;
+	return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY;
+}
+
+/**
+ * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue is above high watermark
+ */
+static int qmgr_stat_above_high_watermark(unsigned int queue)
+{
+	BUG_ON(queue >= HALF_QUEUES);
+	return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL;
+}
+
+/**
+ * qmgr_stat_full() - checks if a hardware queue is full
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue is full.
+ */
+int qmgr_stat_full(unsigned int queue)
+{
+	if (queue >= HALF_QUEUES)
+		return (__raw_readl(&qmgr_regs->statf_h) >>
+			(queue - HALF_QUEUES)) & 0x01;
+	return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL;
+}
+
+/**
+ * qmgr_stat_underflow() - checks if a hardware queue experienced underflow
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue experienced underflow.
+ */
+static int qmgr_stat_underflow(unsigned int queue)
+{
+	return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW;
+}
+
+/**
+ * qmgr_stat_overflow() - checks if a hardware queue experienced overflow
+ * @queue:	queue number
+ *
+ * Returns non-zero value if the queue experienced overflow.
+ */
+int qmgr_stat_overflow(unsigned int queue)
+{
+	return __qmgr_get_stat2(queue) & QUEUE_STAT2_OVERFLOW;
+}
+
 void qmgr_set_irq(unsigned int queue, int src,
 		  void (*handler)(void *pdev), void *pdev)
 {
@@ -375,6 +486,12 @@ module_platform_driver(ixp4xx_qmgr_driver);
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Krzysztof Halasa");
 
+EXPORT_SYMBOL(qmgr_put_entry);
+EXPORT_SYMBOL(qmgr_get_entry);
+EXPORT_SYMBOL(qmgr_stat_empty);
+EXPORT_SYMBOL(qmgr_stat_below_low_watermark);
+EXPORT_SYMBOL(qmgr_stat_full);
+EXPORT_SYMBOL(qmgr_stat_overflow);
 EXPORT_SYMBOL(qmgr_set_irq);
 EXPORT_SYMBOL(qmgr_enable_irq);
 EXPORT_SYMBOL(qmgr_disable_irq);
include/linux/soc/ixp4xx/qmgr.h +7 -120

137 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#25 lore raw

PATCH v3 25/31 soc: ixp4xx: Remove unused functions

In reply to Linus Walleij

These former inlines turn out to be unused in the kernel. If they are needed in the future, they can be resurrected by reverting or studying this commit.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 drivers/soc/ixp4xx/ixp4xx-qmgr.c | 23 -----------------------
 1 file changed, 23 deletions(-)
drivers/soc/ixp4xx/ixp4xx-qmgr.c +0 -23
index 412a346136d8..f3775346e007 100644
@@ -95,18 +95,6 @@ int qmgr_stat_below_low_watermark(unsigned int queue)
 	return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_EMPTY;
 }
 
-/**
- * qmgr_stat_above_high_watermark() - checks if a queue is above high watermark
- * @queue:	queue number
- *
- * Returns non-zero value if the queue is above high watermark
- */
-static int qmgr_stat_above_high_watermark(unsigned int queue)
-{
-	BUG_ON(queue >= HALF_QUEUES);
-	return __qmgr_get_stat1(queue) & QUEUE_STAT1_NEARLY_FULL;
-}
-
 /**
  * qmgr_stat_full() - checks if a hardware queue is full
  * @queue:	queue number
@@ -121,17 +109,6 @@ int qmgr_stat_full(unsigned int queue)
 	return __qmgr_get_stat1(queue) & QUEUE_STAT1_FULL;
 }
 
-/**
- * qmgr_stat_underflow() - checks if a hardware queue experienced underflow
- * @queue:	queue number
- *
- * Returns non-zero value if the queue experienced underflow.
- */
-static int qmgr_stat_underflow(unsigned int queue)
-{
-	return __qmgr_get_stat2(queue) & QUEUE_STAT2_UNDERFLOW;
-}
-
 /**
  * qmgr_stat_overflow() - checks if a hardware queue experienced overflow
  * @queue:	queue number
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#26 lore raw

PATCH v3 26/31 soc: ixp4xx: qmgr: Pass resources

In reply to Linus Walleij

Instead of using hardcoded base address implicitly obtained through <linux/io.h>, pass the physical base for the QMGR block as a memory resource and remap it in the driver.

Also pass the two IRQs as resources and obtain them in the driver.

Use devm_* accessors and simplify the error path in the process. Drop memory region request as this is done by the devm_ioremap* functions.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 arch/arm/mach-ixp4xx/common.c                 | 25 +++++--
 .../mach-ixp4xx/include/mach/ixp4xx-regs.h    |  2 -
 drivers/soc/ixp4xx/ixp4xx-qmgr.c              | 71 +++++++++----------
 3 files changed, 55 insertions(+), 43 deletions(-)
arch/arm/mach-ixp4xx/common.c +20 -5
index 07c3cb312a92..cc5f15679d29 100644
@@ -66,11 +66,6 @@ static struct map_desc ixp4xx_io_desc[] __initdata = {
 		.pfn		= __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),
 		.length		= IXP4XX_PCI_CFG_REGION_SIZE,
 		.type		= MT_DEVICE
-	}, {	/* Queue Manager */
-		.virtual	= (unsigned long)IXP4XX_QMGR_BASE_VIRT,
-		.pfn		= __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS),
-		.length		= IXP4XX_QMGR_REGION_SIZE,
-		.type		= MT_DEVICE
 	},
 };
 
@@ -176,9 +171,29 @@ static struct platform_device ixp4xx_npe_device = {
 	.resource       = ixp4xx_npe_resources,
 };
 
+static struct resource ixp4xx_qmgr_resources[] = {
+	{
+		.start = IXP4XX_QMGR_BASE_PHYS,
+		.end = IXP4XX_QMGR_BASE_PHYS + 0x3fff,
+		.flags = IORESOURCE_MEM,
+	},
+	{
+		.start = IRQ_IXP4XX_QM1,
+		.end = IRQ_IXP4XX_QM1,
+		.flags = IORESOURCE_IRQ,
+	},
+	{
+		.start = IRQ_IXP4XX_QM2,
+		.end = IRQ_IXP4XX_QM2,
+		.flags = IORESOURCE_IRQ,
+	},
+};
+
 static struct platform_device ixp4xx_qmgr_device = {
 	.name           = "ixp4xx-qmgr",
 	.id             = -1,
+	.num_resources  = ARRAY_SIZE(ixp4xx_qmgr_resources),
+	.resource       = ixp4xx_qmgr_resources,
 };
 
 static struct platform_device *ixp4xx_devices[] __initdata = {
arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +0 -2
index f5d5b258c3f7..588b76651085 100644
@@ -43,8 +43,6 @@
  * Queue Manager
  */
 #define IXP4XX_QMGR_BASE_PHYS		0x60000000
-#define IXP4XX_QMGR_BASE_VIRT		IOMEM(0xFEF15000)
-#define IXP4XX_QMGR_REGION_SIZE		0x00004000
 
 /*
  * Peripheral space, including debug UART. Must be section-aligned so that
drivers/soc/ixp4xx/ixp4xx-qmgr.c +35 -36

110 lines not on this page · raw message

Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#27 lore raw

PATCH v3 27/31 soc: ixp4xx: Add DT bindings for IXP4xx NPE

In reply to Linus Walleij

This adds DT bindings for the Intel IXP4xx Network Processing Engine (NPE). These are three firmware-executing units found in the IXP4xx SoC. These bindings use YAML.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 ...ntel,ixp4xx-network-processing-engine.yaml | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml
Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml new file +44 -0
new file mode 100644
index 000000000000..8cb136c376fb
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/firmware/intel-ixp4xx-network-processing-engine.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx Network Processing Engine
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+  On the IXP4xx SoCs, the Network Processing Engine (NPE) is a small
+  processor that can load a firmware to perform offloading of networking
+  and crypto tasks. It also manages the MDIO bus to the ethernet PHYs
+  on the IXP4xx platform. All IXP4xx platforms have three NPEs at
+  consecutive memory locations. They are all included in the same
+  device node since they are not independent of each other.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: intel,ixp4xx-network-processing-engine
+
+  reg:
+    minItems: 3
+    maxItems: 3
+    items:
+      - description: NPE0 register range
+      - description: NPE1 register range
+      - description: NPE2 register range
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    npe@c8006000 {
+         compatible = "intel,ixp4xx-network-processing-engine";
+         reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>;
+    };
Signature · 1 line
2.20.1
maintainer Reviewed-by on v3 27/31
#28 lore raw

Re: [PATCH 27/31 v3] soc: ixp4xx: Add DT bindings for IXP4xx NPE

Quoted 7 lines · Linus Walleij

This adds DT bindings for the Intel IXP4xx Network Processing Engine (NPE). These are three firmware-executing units found in the IXP4xx SoC. These bindings use YAML.

Quoted 7 lines

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 ...ntel,ixp4xx-network-processing-engine.yaml | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/firmware/intel,ixp4xx-network-processing-engine.yaml
#29 lore raw

PATCH v3 28/31 soc: ixp4xx: npe: Add DT probe code

In reply to Linus Walleij

This makes the NPE driver able to probe from the device tree. It only needs to get three memory resources and the plaform device provide these, so all is pretty simple.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 drivers/soc/ixp4xx/ixp4xx-npe.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/soc/ixp4xx/ixp4xx-npe.c +8 -0
index d2dd916816d4..15979d4376ab 100644
@@ -729,9 +729,17 @@ static int ixp4xx_npe_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id ixp4xx_npe_of_match[] = {
+	{
+		.compatible = "intel,ixp4xx-network-processing-engine",
+        },
+	{},
+};
+
 static struct platform_driver ixp4xx_npe_driver = {
 	.driver = {
 		.name           = "ixp4xx-npe",
+		.of_match_table = of_match_ptr(ixp4xx_npe_of_match),
 	},
 	.probe = ixp4xx_npe_probe,
 	.remove = ixp4xx_npe_remove,
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#30 lore raw

PATCH v3 29/31 soc: ixp4xx: qmgr: Add DT bindings for IXP4xx qmgr

In reply to Linus Walleij

This adds device tree bindings for the Intel IXP4xx AHB Queue Manager.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1
- Drop oneOf in compatible, just list items.
- Drop description on reg, just use maxItems: 1
- Set '#queue-cells' as required

---
 .../misc/intel,ixp4xx-queue-manager.yaml      | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml
Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml new file +54 -0
new file mode 100644
index 000000000000..346707936a2f
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/misc/intel-ixp4xx-ahb-queue-manager.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx AHB Queue Manager
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+  The IXP4xx AHB Queue Manager maintains queues as circular buffers in
+  an 8KB embedded SRAM along with hardware pointers. It is used by both
+  the XScale processor and the NPEs (Network Processing Units) in the
+  IXP4xx for accelerating queues, especially for networking. Clients pick
+  queues from the queue manager with foo-queue = <&qmgr N> where the
+  &qmgr is a phandle to the queue manager and N is the queue resource
+  number. The queue resources available and their specific purpose
+  on a certain IXP4xx system will vary.
+
+properties:
+  compatible:
+    items:
+      - const: intel,ixp4xx-ahb-queue-manager
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: Interrupt for queues 0-31
+      - description: Interrupt for queues 32-63
+
+  '#queue-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - '#queue-cells'
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    qmgr: queue-manager@60000000 {
+         compatible = "intel,ixp4xx-ahb-queue-manager";
+         reg = <0x60000000 0x4000>;
+         interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>;
+         #queue-cells = <1>;
+    };
Signature · 1 line
2.20.1
maintainer
#31 lore raw

Re: [PATCH 29/31 v3] soc: ixp4xx: qmgr: Add DT bindings for IXP4xx qmgr

Quoted 50 lines · Linus Walleij

This adds device tree bindings for the Intel IXP4xx AHB Queue Manager.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1
- Drop oneOf in compatible, just list items.
- Drop description on reg, just use maxItems: 1
- Set '#queue-cells' as required

---
 .../misc/intel,ixp4xx-queue-manager.yaml      | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml
Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml new file +27 -0
new file mode 100644
index 000000000000..346707936a2f
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2019 Linaro Ltd.
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/misc/intel-ixp4xx-ahb-queue-manager.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Intel IXP4xx AHB Queue Manager
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+  The IXP4xx AHB Queue Manager maintains queues as circular buffers in
+  an 8KB embedded SRAM along with hardware pointers. It is used by both
+  the XScale processor and the NPEs (Network Processing Units) in the
+  IXP4xx for accelerating queues, especially for networking. Clients pick
+  queues from the queue manager with foo-queue = <&qmgr N> where the
+  &qmgr is a phandle to the queue manager and N is the queue resource
+  number. The queue resources available and their specific purpose
+  on a certain IXP4xx system will vary.
+
+properties:
+  compatible:
+    items:
+      - const: intel,ixp4xx-ahb-queue-manager
+

Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/misc/intel,ixp4xx-queue-manager.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: Interrupt for queues 0-31
+      - description: Interrupt for queues 32-63
+
+  '#queue-cells':
+    const: 1

Not sure why I didn't notice this earlier... You don't need '#*-cells' unless it's variable and this should have a vendor prefix as it could collide with a generic binding if we came up with a 'queue' binding. So I'd just drop it as it seems specific to this binding.

Rob

#32 lore raw

PATCH v3 30/31 soc: ixp4xx: qmgr: Add DT probe code

In reply to Linus Walleij

This makes the queue manager driver able to probe from the device tree. It only needs to get a memory resource and two interrupts and the platform device provides these as resources, so all is pretty simple.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 drivers/soc/ixp4xx/ixp4xx-qmgr.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/soc/ixp4xx/ixp4xx-qmgr.c +8 -0
index 64572f2d6ff0..13a8a13c9b01 100644
@@ -450,9 +450,17 @@ static int ixp4xx_qmgr_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id ixp4xx_qmgr_of_match[] = {
+	{
+		.compatible = "intel,ixp4xx-ahb-queue-manager",
+        },
+	{},
+};
+
 static struct platform_driver ixp4xx_qmgr_driver = {
 	.driver = {
 		.name           = "ixp4xx-qmgr",
+		.of_match_table = of_match_ptr(ixp4xx_qmgr_of_match),
 	},
 	.probe = ixp4xx_qmgr_probe,
 	.remove = ixp4xx_qmgr_remove,
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#33 lore raw

PATCH v3 31/31 ARM: dts: Add queue manager and NPE to the IXP4xx DTSI

In reply to Linus Walleij

The AHB queue manager and Network Processing Engines are present on all IXP4xx SoCs, so we add them to the overarching device tree include.

---
ChangeLog v2->v3:
- Rebased on v5.1-rc1

---
 arch/arm/boot/dts/intel-ixp4xx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/intel-ixp4xx.dtsi +12 -0
index 9edd49509af8..96a5a02f7ba9 100644
@@ -14,6 +14,13 @@
 		compatible = "simple-bus";
 		interrupt-parent = <&intcon>;
 
+		qmgr: queue-manager@60000000 {
+			compatible = "intel,ixp4xx-ahb-queue-manager";
+			reg = <0x60000000 0x4000>;
+			#queue-cells = <1>;
+			interrupts = <3 IRQ_TYPE_LEVEL_HIGH>, <4 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		uart0: serial@c8000000 {
 			compatible = "intel,xscale-uart";
 			reg = <0xc8000000 0x1000>;
@@ -54,5 +61,10 @@
 			reg = <0xc8005000 0x100>;
 			interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
 		};
+
+		npe@c8006000 {
+			compatible = "intel,ixp4xx-network-processing-engine";
+			reg = <0xc8006000 0x1000>, <0xc8007000 0x1000>, <0xc8008000 0x1000>;
+		};
 	};
 };
Signature · 7 lines
2.20.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel