Skip to contentSkip to conversation

footbridge consolidation patches

PATCH New Bryan Wu 2 participants 11 messages Jun 13, 2011

Subsystems (3)
lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

cover footbridge consolidation patches

When trying to convert old leds event driver to led trigger drivers, I reviewed the code of mach-footbridge. move seperated PCI code and leds code into a single board files like other machines.

leds trigger code is based on Linus Walleij's driver in arch/arm/plat-versatile/leds.c

Built successfully with footbridge_defconfig.

Bryan Wu (6):
arm: footbridge: consolidation code of CATS machine
arm: footbridge: consolidation code of EBSA285 machine
arm: footbridge: consolidation code of Netwinder machine
arm: footbridge: consolidation code of Compaq Personal Server
arm: footbridge: convert old leds event driver to led gpio trigger
driver of Netwinder
arm: footbridge: convert old leds event driver to led trigger drivers

    of EBSA285
 arch/arm/mach-footbridge/Kconfig          |    6 +
 arch/arm/mach-footbridge/Makefile         |   15 +-
 arch/arm/mach-footbridge/cats-hw.c        |   95 ----
 arch/arm/mach-footbridge/cats-pci.c       |   58 ---
 arch/arm/mach-footbridge/cats.c           |  143 ++++++
 arch/arm/mach-footbridge/ebsa285-leds.c   |  139 ------
 arch/arm/mach-footbridge/ebsa285-pci.c    |   48 --
 arch/arm/mach-footbridge/ebsa285.c        |  114 +++++-
 arch/arm/mach-footbridge/netwinder-hw.c   |  660 --------------------------
 arch/arm/mach-footbridge/netwinder-leds.c |  139 ------
 arch/arm/mach-footbridge/netwinder-pci.c  |   62 ---
 arch/arm/mach-footbridge/netwinder.c      |  737 +++++++++++++++++++++++++++++
 arch/arm/mach-footbridge/personal-pci.c   |   56 ---
 arch/arm/mach-footbridge/personal.c       |   46 ++
 14 files changed, 1047 insertions(+), 1271 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/cats-hw.c
 delete mode 100644 arch/arm/mach-footbridge/cats-pci.c
 create mode 100644 arch/arm/mach-footbridge/cats.c
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-leds.c
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-pci.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-hw.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-leds.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-pci.c
 create mode 100644 arch/arm/mach-footbridge/netwinder.c
 delete mode 100644 arch/arm/mach-footbridge/personal-pci.c
Signature · 1 line
1.7.5
author
#1 lore raw

PATCH 1/6 arm: footbridge: consolidation code of CATS machine

move PCI code to board file

---
 arch/arm/mach-footbridge/Makefile   |    3 +-
 arch/arm/mach-footbridge/cats-hw.c  |   95 -----------------------
 arch/arm/mach-footbridge/cats-pci.c |   58 --------------
 arch/arm/mach-footbridge/cats.c     |  143 +++++++++++++++++++++++++++++++++++
 4 files changed, 144 insertions(+), 155 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/cats-hw.c
 delete mode 100644 arch/arm/mach-footbridge/cats-pci.c
 create mode 100644 arch/arm/mach-footbridge/cats.c
arch/arm/mach-footbridge/Makefile +1 -2
index 3afb1b2..e0a8b21 100644
@@ -9,7 +9,6 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
-pci-$(CONFIG_ARCH_CATS) += cats-pci.o
 pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
 pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
 pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
@@ -17,7 +16,7 @@ pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
 leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
 leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
 
-obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o
+obj-$(CONFIG_ARCH_CATS) += cats.o isa-timer.o
 obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
 obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
 obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
arch/arm/mach-footbridge/cats-hw.c deleted +0 -95

95 lines not on this page · raw message

arch/arm/mach-footbridge/cats-pci.c deleted +0 -58

58 lines not on this page · raw message

arch/arm/mach-footbridge/cats.c new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#2 lore raw

PATCH 2/6 arm: footbridge: consolidation code of EBSA285 machine

In reply to Bryan Wu

move PCI code to board file

---
 arch/arm/mach-footbridge/Makefile      |    1 -
 arch/arm/mach-footbridge/ebsa285-pci.c |   48 --------------------------------
 arch/arm/mach-footbridge/ebsa285.c     |   38 +++++++++++++++++++++++++
 3 files changed, 38 insertions(+), 49 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-pci.c
arch/arm/mach-footbridge/Makefile +0 -1
index e0a8b21..e051668 100644
@@ -9,7 +9,6 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
-pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
 pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
 pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
 
arch/arm/mach-footbridge/ebsa285-pci.c deleted +0 -48

48 lines not on this page · raw message

arch/arm/mach-footbridge/ebsa285.c +38 -0
index 2ef69ff..fc91c85 100644
@@ -5,7 +5,11 @@
  */
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
 
+#include <asm/irq.h>
+#include <asm/mach/pci.h>
 #include <asm/hardware/dec21285.h>
 #include <asm/mach-types.h>
 
@@ -13,6 +17,40 @@
 
 #include "common.h"
 
+static int irqmap_ebsa285[] __initdata = { IRQ_IN3, IRQ_IN1, IRQ_IN0, IRQ_PCI };
+
+static int __init ebsa285_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+	if (dev->vendor == PCI_VENDOR_ID_CONTAQ &&
+	    dev->device == PCI_DEVICE_ID_CONTAQ_82C693)
+		switch (PCI_FUNC(dev->devfn)) {
+		case 1:	return 14;
+		case 2:	return 15;
+		case 3:	return 12;
+		}
+
+	return irqmap_ebsa285[(slot + pin) & 3];
+}
+
+static struct hw_pci ebsa285_pci __initdata = {
+	.swizzle		= pci_std_swizzle,
+	.map_irq		= ebsa285_map_irq,
+	.nr_controllers		= 1,
+	.setup			= dc21285_setup,
+	.scan			= dc21285_scan_bus,
+	.preinit		= dc21285_preinit,
+	.postinit		= dc21285_postinit,
+};
+
+static int __init ebsa285_init_pci(void)
+{
+	if (machine_is_ebsa285())
+		pci_common_init(&ebsa285_pci);
+	return 0;
+}
+
+subsys_initcall(ebsa285_init_pci);
+
 MACHINE_START(EBSA285, "EBSA285")
 	/* Maintainer: Russell King */
 	.boot_params	= 0x00000100,
Signature · 1 line
1.7.5
author
#3 lore raw

PATCH 3/6 arm: footbridge: consolidation code of Netwinder machine

In reply to Bryan Wu

move PCI code to board file

---
 arch/arm/mach-footbridge/Makefile        |    3 +-
 arch/arm/mach-footbridge/netwinder-hw.c  |  660 ---------------------------
 arch/arm/mach-footbridge/netwinder-pci.c |   62 ---
 arch/arm/mach-footbridge/netwinder.c     |  713 ++++++++++++++++++++++++++++++
 4 files changed, 714 insertions(+), 724 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/netwinder-hw.c
 delete mode 100644 arch/arm/mach-footbridge/netwinder-pci.c
 create mode 100644 arch/arm/mach-footbridge/netwinder.c
arch/arm/mach-footbridge/Makefile +1 -2
index e051668..68f7988 100644
@@ -9,7 +9,6 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
-pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o
 pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
 
 leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
@@ -17,7 +16,7 @@ leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
 
 obj-$(CONFIG_ARCH_CATS) += cats.o isa-timer.o
 obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
-obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o
+obj-$(CONFIG_ARCH_NETWINDER) += netwinder.o isa-timer.o
 obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
 
 obj-$(CONFIG_PCI)	+=$(pci-y)
arch/arm/mach-footbridge/netwinder-hw.c deleted +0 -660

660 lines not on this page · raw message

arch/arm/mach-footbridge/netwinder-pci.c deleted +0 -62

62 lines not on this page · raw message

arch/arm/mach-footbridge/netwinder.c new file +713 -0

713 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#4 lore raw

PATCH 4/6 arm: footbridge: consolidation code of Compaq Personal Server

In reply to Bryan Wu

move PCI code to board file

---
 arch/arm/mach-footbridge/Makefile       |    3 --
 arch/arm/mach-footbridge/personal-pci.c |   56 -------------------------------
 arch/arm/mach-footbridge/personal.c     |   46 +++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 59 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/personal-pci.c
arch/arm/mach-footbridge/Makefile +0 -3
index 68f7988..d2172a9 100644
@@ -9,8 +9,6 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
-pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o
-
 leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
 leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
 
@@ -19,7 +17,6 @@ obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
 obj-$(CONFIG_ARCH_NETWINDER) += netwinder.o isa-timer.o
 obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
 
-obj-$(CONFIG_PCI)	+=$(pci-y)
 obj-$(CONFIG_LEDS)	+=$(leds-y)
 
 obj-$(CONFIG_ISA)	+= isa.o isa-rtc.o
arch/arm/mach-footbridge/personal-pci.c deleted +0 -56

56 lines not on this page · raw message

arch/arm/mach-footbridge/personal.c +46 -0

61 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#5 lore raw

PATCH 5/6 arm: footbridge: convert old leds event driver to led gpio trigger driver of Netwinder

In reply to Bryan Wu
---
 arch/arm/mach-footbridge/Makefile         |    1 -
 arch/arm/mach-footbridge/netwinder-leds.c |  139 -----------------------------
 arch/arm/mach-footbridge/netwinder.c      |   42 +++++++--
 3 files changed, 33 insertions(+), 149 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/netwinder-leds.c
arch/arm/mach-footbridge/Makefile +0 -1
index d2172a9..a1756c7 100644
@@ -10,7 +10,6 @@ obj-n			:=
 obj-			:=
 
 leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
-leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o
 
 obj-$(CONFIG_ARCH_CATS) += cats.o isa-timer.o
 obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
arch/arm/mach-footbridge/netwinder-leds.c deleted +0 -139

139 lines not on this page · raw message

arch/arm/mach-footbridge/netwinder.c +33 -9

67 lines not on this page · raw message

Signature · 1 line
1.7.5
author
#8 lore raw

PATCH 6/6 arm: footbridge: convert old leds event driver to led trigger drivers of EBSA285

In reply to Bryan Wu
---
 arch/arm/mach-footbridge/Kconfig        |    6 ++
 arch/arm/mach-footbridge/Makefile       |    4 -
 arch/arm/mach-footbridge/ebsa285-leds.c |  139 -------------------------------
 arch/arm/mach-footbridge/ebsa285.c      |   76 +++++++++++++++++-
 4 files changed, 81 insertions(+), 144 deletions(-)
 delete mode 100644 arch/arm/mach-footbridge/ebsa285-leds.c
arch/arm/mach-footbridge/Kconfig +6 -0
index 46adca0..2a575df 100644
@@ -52,6 +52,12 @@ config ARCH_EBSA285_HOST
 	select ISA
 	select ISA_DMA
 	select PCI
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select LEDS_TRIGGER_TIMER
+	select LEDS_TRIGGER_HEARTBEAT
+
 	help
 	  Say Y here if you intend to run this kernel on the EBSA285 card
 	  in host ("central function") mode.
arch/arm/mach-footbridge/Makefile +0 -4
index a1756c7..55f5b6d 100644
@@ -9,13 +9,9 @@ obj-m			:=
 obj-n			:=
 obj-			:=
 
-leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o
-
 obj-$(CONFIG_ARCH_CATS) += cats.o isa-timer.o
 obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o
 obj-$(CONFIG_ARCH_NETWINDER) += netwinder.o isa-timer.o
 obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o
 
-obj-$(CONFIG_LEDS)	+=$(leds-y)
-
 obj-$(CONFIG_ISA)	+= isa.o isa-rtc.o
arch/arm/mach-footbridge/ebsa285-leds.c deleted +0 -139

139 lines not on this page · raw message

arch/arm/mach-footbridge/ebsa285.c +75 -1

91 lines not on this page · raw message

Signature · 1 line
1.7.5
#9 lore raw

cover footbridge consolidation patches

In reply to Bryan Wu
Quoted 3 lines · Bryan Wu

When trying to convert old leds event driver to led trigger drivers, I reviewed the code of mach-footbridge. move seperated PCI code and leds code into a single board files like other machines.

This looks like it breaks all these when CONFIG_PCI=n. In that case, we would avoid building the PCI supporting files. However, with your merged files, we build it anyway and end up with undefined calls to the PCI subsystem.

The code is separated to avoid that, and to avoid ifdefs.

I'm not entirely sure what the point of this patch set is, because it mostly just moves the code into one file per platform and doesn't consolidate anything between the platforms themselves.

#6 lore raw

PATCH 5/6 arm: footbridge: convert old leds event driver to led gpio trigger driver of Netwinder

In reply to Bryan Wu

arch/arm/mach-footbridge/netwinder.c static void __init rwa010_init(void) · line 615

Quoted 12 lines · Bryan Wu
arch/arm/mach-footbridge/netwinder.c +12 -0
+/* LEDs */
+static struct gpio_led nw_gpio_leds[] = {
+        {
+                .name                   = "netwinder::led_red",
+                .default_trigger        = "heartbeat",
+                .gpio                   = GPIO_RED_LED,
+        },
+        {
+                .name                   = "netwinder::led_green",
+                .default_trigger        = "timer",
+                .gpio                   = GPIO_GREEN_LED,
+        },

This is especially broken. This platform has no GPIO support other than its private stuff, which makes the use of the GPIO LED driver useless. The GPIO_*_LED constants are bitmasks for the CPLD controller.

author
#10 lore raw

cover footbridge consolidation patches

In reply to Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Bryan Wu

When trying to convert old leds event driver to led trigger drivers, I reviewed the code of mach-footbridge. move seperated PCI code and leds code into a single board files like other machines.

Quoted 7 lines

This looks like it breaks all these when CONFIG_PCI=n. ?In that case, we would avoid building the PCI supporting files. ?However, with your merged files, we build it anyway and end up with undefined calls to the PCI subsystem.

The code is separated to avoid that, and to avoid ifdefs.

Yes, indeed.

Actually, my plan is to move code into one board file per machine but it needs ifdef which I missed in my patches.
If you think the first 4 patches are useless, I think we can ignore them.

Quoted 4 lines

I'm not entirely sure what the point of this patch set is, because it mostly just moves the code into one file per platform and doesn't consolidate anything between the platforms themselves.

I just start to convert the led drivers into a common framework like gpio leds or led triggers. mach-footbridge is the my first step. I will move to other subarch later after you review this patchset.

Thanks,
-Bryan

author
#7 lore raw

PATCH 5/6 arm: footbridge: convert old leds event driver to led gpio trigger driver of Netwinder

In reply to Russell King - ARM Linux
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Bryan Wu
(quoted diff) +9 -0
+/* LEDs */
+static struct gpio_led nw_gpio_leds[] = {
+ ? ? ? ?{
+ ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "netwinder::led_red",
+ ? ? ? ? ? ? ? ?.default_trigger ? ? ? ?= "heartbeat",
+ ? ? ? ? ? ? ? ?.gpio ? ? ? ? ? ? ? ? ? = GPIO_RED_LED,
+ ? ? ? ?},
+ ? ? ? ?{
+ ? ? ? ? ? ? ? ?.name ? ? ? ? ? ? ? ? ? = "netwinder::led_green",
Quoted 9 lines
Quoted 3 lines

+ ? ? ? ? ? ? ? ?.default_trigger ? ? ? ?= "timer",
+ ? ? ? ? ? ? ? ?.gpio ? ? ? ? ? ? ? ? ? = GPIO_GREEN_LED,
+ ? ? ? ?},

This is especially broken. ?This platform has no GPIO support other than its private stuff, which makes the use of the GPIO LED driver useless. ?The GPIO_*_LED constants are bitmasks for the CPLD controller.

I was totally confused by the name GPIO_*_* definitions stuff in the hardware.h. Sorry about that, it looks like I need rewrite it as my 6th patch.

Thanks,

Signature · 5 lines
Bryan Wu <[email protected]>
Kernel Developer ? ?+86.138-1617-6545 Mobile
Ubuntu Kernel Team
Canonical Ltd. ? ? ?www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com