Skip to contentSkip to conversation

support DT on ARCH-MMP

PATCH Superseded Haojian Zhuang 7 participants 25 messages Jul 19, 2011 – Jul 20, 2011 1 message not in the archive

Subsystems (7)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 2011071901

#1 lore raw

cover support DT on ARCH-MMP

It's used to support DT on ARCH-MMP.

Haojian Zhuang (7):
ARM: mmp: parse irq from DT
ARM: mmp: append MMP_USE_OF config
ARM: mmp: support DT on both dkb and brownstone
tty: serial: support device tree in pxa
tty: serial: check ops before registering console
i2c: pxa: support i2c controller from DT
i2c: pxa: support to parse property

 .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
 .../devicetree/bindings/arm/marvell/intc.txt       |  120 ++++++++++
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   36 +++
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
 arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
 arch/arm/mach-mmp/Kconfig                          |    7 +
 arch/arm/mach-mmp/Makefile                         |    6 +
 arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++
 arch/arm/mach-mmp/common.h                         |    1 +
 arch/arm/mach-mmp/include/mach/irqs.h              |    4 +
 arch/arm/mach-mmp/intc.c                           |  223 ++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   78 +++++--
 drivers/tty/serial/Kconfig                         |    4 +-
 drivers/tty/serial/of_serial.c                     |   12 +
 drivers/tty/serial/pxa.c                           |   95 ++++++++-
 include/linux/serial_pxa.h                         |   17 ++
 17 files changed, 1065 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
 create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
 create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
 create mode 100644 arch/arm/mach-mmp/boards.c
 create mode 100644 arch/arm/mach-mmp/intc.c
 create mode 100644 include/linux/serial_pxa.h
#2 lore raw

PATCH 1/7 ARM: mmp: parse irq from DT

Parse irq sepcifier from DT and translate it to Linux irq number.

---
 .../devicetree/bindings/arm/marvell/intc.txt       |  120 +++++++++++
 arch/arm/Kconfig                                   |    1 +
 arch/arm/mach-mmp/Makefile                         |    2 +
 arch/arm/mach-mmp/common.h                         |    1 +
 arch/arm/mach-mmp/intc.c                           |  223 ++++++++++++++++++++
 5 files changed, 347 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
 create mode 100644 arch/arm/mach-mmp/intc.c
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +120 -0
new file mode 100644
index 0000000..e730a16
@@ -0,0 +1,120 @@
+* Interrupt Controller Binding for ARCH-MMP
+
+This binding specifies what properties must be available in device tree representation of an ARCH-MMP compliant interrupt controller.
+
+Required properties:
+
+	- compatible: Specifies the compatibility list of the interrupt
+	  controller. The type shall be <string> and the value shall be
+	  "mrvl,mmp-intc" or "mrvl,mux-intc".
+	  "mrvl,mmp-intc" is the base interrupt controller. It must be
+	  included. "mrvl,mux-intc" is the expanded interrupt controller,
+	  and it's optional.
+
+	- reg: Specified the base physical address(s) and size(s) of the
+	  interrupt controller's addressable register space. The type
+	  should be <prop-encoded-array>.
+
+	- interrupt-controller: The presence of this property identifies
+	  the node as interrupt controller. No property value should be
+	  defined.
+
+	- #interrupt-cells: Specifies the number of cells needed to encode
+	  an interrupt source. The type should be <u32> and the value should
+	  be 1.
+
+	- #address-cells: Specifies the number of cells needed to encode an
+	  address. The type should be <u32> and the value should be 1.
+
+	- #size-cells: Specifies the number of cells need to encode an
+	  size. The type should be <u32> and the value should be 1.
+
+	- intc-numbers: Specifies the number of interrupts is supported in
+	  this interrupt controller. The type should be <u32>.
+
+Optional properties:
+
+	- intc-enable-mask: Specifies the masking value of interrupt
+	  configuration register. The property is used in mmp-intc. The value
+	  should be <u32>.
+
+	- intc-status: Specifies the offset of status register. The property
+	  is used in mux-intc. The type should be <u32>.
+
+	- intc-mask: Specifies the offset of mask register. The property
+	  is used in mux-intc. The type should be <u32>.
+
+	- intc-mfp-edge: Specifies the address of mfp edge detection register.
+	  The property is used while acking specified interrupt. The type
+	  should be <prop-encoded-array>. The first cell indicates the address
+	  of mfp edge detection register. The second cell indicates the
+	  index of interrupt in current interrupt controller that should
+	  handle mfp edge detection.
+
+* Examples
+
+Example 1:
+
+	/*
+	 * base INTC
+	 */
+	mmp_intc: interrupt-controller at d4282000 {
+		/* Compatible with mmp-intc. */
+		compatible = "mrvl,mmp-intc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		/* Offset address of 0xd4282000 and size of 0x400. */
+		reg = <0xd4282000 0x400>;
+
+		#interrupt-cells = <1>;
+		interrupt-controller;
+
+		/* 64 interrupts are supported in this INTC. */
+		intc-numbers = <64>;
+
+		/* enable bits in configuration register */
+		intc-enable-mask = <0x20>;
+	};
+
+Example 2:
+
+	/*
+	 * mux INTC that is internal wired to base INTC
+	 */
+	mux_intc4: interrupt-controller at d4282150 {
+		compatible = "mrvl,mux-intc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0xd4282000 0x400>;
+
+		#interrupt-cells = <1>;
+		interrupt-controller;
+		interrupt-parent = <&mmp_intc>;
+
+		/* interrupt source '4' of parent INTC. */
+		interrupts = <4>;
+
+		/* 2 interrupts are supported in this INTC. */
+		intc-numbers = <2>;
+
+		/* Status offset address of 0x150. */
+		intc-status = <0x150>;
+
+		/* Mask offset address of 0x168. */
+		intc-mask = <0x168>;
+
+		/* mfp register of 0xd401e2c4 & interrupt index of 1 */
+		intc-mfp-edge = <0xd401e2c4 1>;
+	};
+
+Example 3:
+	/*
+	 * An interrupt generating device that is wired to an INTC.
+	 */
+	uart0: uart at d4030000 {
+		/* parent's '#interrupt-cells' property. */
+		interrupts = <27>;
+
+		/* The INTC that this device is wired to. */
+		interrupt-parent = <&mmp_intc>;
+	};
arch/arm/Kconfig +1 -0
index 17507b8..f18eb14 100644
@@ -542,6 +542,7 @@ config ARCH_MMP
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
 	select GENERIC_CLOCKEVENTS
+	select GENERIC_IRQ_CHIP
 	select HAVE_SCHED_CLOCK
 	select TICK_ONESHOT
 	select PLAT_PXA
arch/arm/mach-mmp/Makefile +2 -0
index 5c68382..e7862ea 100644
@@ -4,6 +4,8 @@
 
 obj-y				+= common.o clock.o devices.o time.o
 
+obj-$(CONFIG_OF_IRQ)		+= intc.o
+
 # SoC support
 obj-$(CONFIG_CPU_PXA168)	+= pxa168.o irq-pxa168.o
 obj-$(CONFIG_CPU_PXA910)	+= pxa910.o irq-pxa168.o
arch/arm/mach-mmp/common.h +1 -0
index ec8d65d..1c563c2 100644
@@ -6,3 +6,4 @@ extern void timer_init(int irq);
 
 extern void __init icu_init_irq(void);
 extern void __init mmp_map_io(void);
+extern void __init mmp_init_intc(void);
arch/arm/mach-mmp/intc.c new file +223 -0

223 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#3 lore raw

PATCH 2/7 ARM: mmp: append MMP_USE_OF config

Since NR_IRQS is defined in irqs.h, parsing irq specifier will be started from NR_IRQS while both CONFIG_USE_OF and CONFIG_SPARSE_IRQ is enabled. It breaks the assumption that base irq is started from 0.

Add CONFIG_MMP_USE_OF config to distinguish. If CONFIG_MMP_USE_OF is set, NR_IRQS is defined as 0. Otherwise, it follows the original definition.

---
 arch/arm/mach-mmp/Kconfig             |    7 +++++++
 arch/arm/mach-mmp/include/mach/irqs.h |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/Kconfig +7 -0
index 67793a6..1efe994 100644
@@ -96,4 +96,11 @@ config CPU_MMP2
 	select CPU_PJ4
 	help
 	  Select code specific to MMP2. MMP2 is ARMv7 compatible.
+
+config MMP_USE_OF
+	bool "MMP Use OF"
+	select USE_OF
+	help
+	  Select OF code to ARCH-MMP.
+
 endif
arch/arm/mach-mmp/include/mach/irqs.h +4 -0
index a09d328..538bb69 100644
@@ -224,6 +224,10 @@
 
 #define IRQ_BOARD_START			(IRQ_GPIO_START + IRQ_GPIO_NUM)
 
+#ifdef CONFIG_MMP_USE_OF
+#define NR_IRQS				0
+#else
 #define NR_IRQS				(IRQ_BOARD_START)
+#endif
 
 #endif /* __ASM_MACH_IRQS_H */
Signature · 1 line
1.5.6.5
#4 lore raw

PATCH 3/7 ARM: mmp: support DT on both dkb and brownstone

Add new boards.c to support both TTC-DKB and MMP2-BROWNSTONE. While CONFIG_MMP_USE_OF is selected, original ttc_dkb.c and brownstone.c won't be compiled.

While everything moving to DT in ARCH-MMP, original ttc_dkb.c and brownstone.c will be abandoned.

---
 .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
 arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
 arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
 arch/arm/mach-mmp/Makefile                         |    4 +
 arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++
 5 files changed, 492 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
 create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
 create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
 create mode 100644 arch/arm/mach-mmp/boards.c
Documentation/devicetree/bindings/arm/marvell/boards.txt new file +7 -0
new file mode 100644
index 0000000..219e134
@@ -0,0 +1,7 @@
+TTC(pxa910) "DKB" evalutation board
+Required root node properties:
+	- compatible = "mrvl,ttc-dkb", "mrvl,pxa910-dkb";
+
+mmp2(armada610) "Brownstone" evalutation board
+Required root node properties:
+	- compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";
arch/arm/boot/dts/mmp2-brownstone.dts new file +242 -0

242 lines not on this page · raw message

arch/arm/boot/dts/ttc-dkb.dts new file +80 -0

80 lines not on this page · raw message

arch/arm/mach-mmp/Makefile +4 -0
index e7862ea..6c39bbd 100644
@@ -12,6 +12,9 @@ obj-$(CONFIG_CPU_PXA910)	+= pxa910.o irq-pxa168.o
 obj-$(CONFIG_CPU_MMP2)		+= mmp2.o irq-mmp2.o
 
 # board support
+ifeq ($(CONFIG_MMP_USE_OF),y)
+obj-$(CONFIG_OF)		+= boards.o
+else
 obj-$(CONFIG_MACH_ASPENITE)	+= aspenite.o
 obj-$(CONFIG_MACH_ZYLONITE2)	+= aspenite.o
 obj-$(CONFIG_MACH_AVENGERS_LITE)+= avengers_lite.o
@@ -21,3 +24,4 @@ obj-$(CONFIG_MACH_BROWNSTONE)	+= brownstone.o
 obj-$(CONFIG_MACH_FLINT)	+= flint.o
 obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
 obj-$(CONFIG_MACH_TETON_BGA)	+= teton_bga.o
+endif
arch/arm/mach-mmp/boards.c new file +159 -0

159 lines not on this page · raw message

Signature · 1 line
1.5.6.5
#5 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

Support both normal platform driver and device tree driver in serial pxa.

---
 drivers/tty/serial/Kconfig     |    4 +-
 drivers/tty/serial/of_serial.c |   12 +++++
 drivers/tty/serial/pxa.c       |   93 ++++++++++++++++++++++++++++++++++++++-
 include/linux/serial_pxa.h     |   17 +++++++
 4 files changed, 122 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/serial_pxa.h
drivers/tty/serial/Kconfig +3 -1
index 636144c..3f75e0d 100644
@@ -663,6 +663,8 @@ config SERIAL_MPSC_CONSOLE
 config SERIAL_PXA
 	bool "PXA serial port support"
 	depends on ARCH_PXA || ARCH_MMP
+	select SERIAL_OF_PLATFORM
+	select SERIAL_CORE_CONSOLE
 	select SERIAL_CORE
 	help
 	  If you have a machine based on an Intel XScale PXA2xx CPU you
@@ -1340,7 +1342,7 @@ config SERIAL_NETX_CONSOLE
 config SERIAL_OF_PLATFORM
 	tristate "Serial port on Open Firmware platform bus"
 	depends on OF
-	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL
+	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL || SERIAL_PXA
 	help
 	  If you have a PowerPC based system that has serial ports
 	  on a platform specific bus, you should enable this option.
drivers/tty/serial/of_serial.c +12 -0
index e65f1e8..83e07fb 100644
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
+#include <linux/serial_pxa.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -126,6 +127,11 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
 		ret = nwpserial_register_port(&port);
 		break;
 #endif
+#ifdef CONFIG_SERIAL_PXA
+	case PORT_PXA:
+		ret = serial_pxa_register_port(&port);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 	case PORT_UNKNOWN:
@@ -163,6 +169,11 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
 		nwpserial_unregister_port(info->line);
 		break;
 #endif
+#ifdef CONFIG_SERIAL_PXA
+	case PORT_PXA:
+		serial_pxa_unregister_port(info->line);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 		break;
@@ -186,6 +197,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
 	{ .compatible = "ibm,qpace-nwp-serial",
 		.data = (void *)PORT_NWPSERIAL, },
 #endif
+	{ .compatible = "mrvl,pxa270-serial", .data = (void *)PORT_PXA, },
 	{ .type = "serial",         .data = (void *)PORT_UNKNOWN, },
 	{ /* end of list */ },
 };
drivers/tty/serial/pxa.c +90 -3

127 lines not on this page · raw message

include/linux/serial_pxa.h new file +17 -0
new file mode 100644
index 0000000..565e510
@@ -0,0 +1,17 @@
+/*
+ *  linux/include/linux/serial_8250.h
+ *
+ *  Marvell Semiconductor Inc.
+ *  Copyright (C) 2011
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef _LINUX_SERIAL_PXA_H
+#define _LINUX_SERIAL_PXA_H
+
+extern int serial_pxa_register_port(struct uart_port *);
+extern void serial_pxa_unregister_port(int);
+#endif
Signature · 1 line
1.5.6.5
#6 lore raw

PATCH 5/7 tty: serial: check ops before registering console

Console should be only registered after port->ops assigned. If uart console doesn't match the current uart, port->ops keeps NULL.

---
 drivers/tty/serial/pxa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/pxa.c +1 -1
index 8f4d538..2d8e7d0 100644
@@ -684,7 +684,7 @@ serial_pxa_console_setup(struct console *co, char *options)
 	if (co->index == -1 || co->index >= serial_pxa_reg.nr)
 		co->index = 0;
 	up = serial_pxa_ports[co->index];
-	if (!up)
+	if (!up || !up->port.ops)
 		return -ENODEV;
 
 	if (options)
Signature · 1 line
1.5.6.5
#7 lore raw

PATCH 6/7 i2c: pxa: support i2c controller from DT

support i2c-pxa controller from DT.

---
 drivers/i2c/busses/i2c-pxa.c |   58 ++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-pxa.c +42 -16
index d603646..adac74a 100644
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/i2c-pxa.h>
+#include <linux/of_device.h>
 #include <linux/of_i2c.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
@@ -1044,15 +1045,31 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
 	.functionality	= i2c_pxa_functionality,
 };
 
+static const struct of_device_id pxa_i2c_of_match[] = {
+	{ .compatible = "mrvl,pxa255-i2c",    .data = (void *)REGS_PXA2XX, },
+	{ .compatible = "mrvl,pxa300-pwri2c", .data = (void *)REGS_PXA3XX, },
+	{},
+};
+
 static int i2c_pxa_probe(struct platform_device *dev)
 {
+	struct device_node *np = dev->dev.of_node;
+	const struct of_device_id *match;
 	struct pxa_i2c *i2c;
-	struct resource *res;
 	struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
 	const struct platform_device_id *id = platform_get_device_id(dev);
-	enum pxa_i2c_types i2c_type = id->driver_data;
-	int ret;
-	int irq;
+	enum pxa_i2c_types i2c_type;
+	struct resource *res;
+	int irq, ret;
+	static int idx = 0;
+
+	if (np) {
+		match = of_match_device(pxa_i2c_of_match, &dev->dev);
+		if (match == NULL)
+			return -ENODEV;
+		i2c_type = (int)match->data;
+	} else
+		i2c_type = id->driver_data;
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(dev, 0);
@@ -1074,16 +1091,23 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	spin_lock_init(&i2c->lock);
 	init_waitqueue_head(&i2c->wait);
 
-	/*
-	 * If "dev->id" is negative we consider it as zero.
-	 * The reason to do so is to avoid sysfs names that only make
-	 * sense when there are multiple adapters.
-	 */
-	i2c->adap.nr = dev->id;
-	snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
-		 i2c->adap.nr);
 
-	i2c->clk = clk_get(&dev->dev, NULL);
+	if (np) {
+		i2c->adap.nr = idx++;
+		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
+			"pxa2xx-i2c.%u", i2c->adap.nr);
+		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
+	} else {
+		/*
+		 * If "dev->id" is negative we consider it as zero.
+		 * The reason to do so is to avoid sysfs names that only make
+		 * sense when there are multiple adapters.
+		 */
+		i2c->adap.nr = dev->id;
+		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
+			"pxa_i2c-i2c.%u", i2c->adap.nr);
+		i2c->clk = clk_get(&dev->dev, NULL);
+	}
 	if (IS_ERR(i2c->clk)) {
 		ret = PTR_ERR(i2c->clk);
 		goto eclk;
@@ -1138,11 +1162,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	i2c->adap.algo_data = i2c;
 	i2c->adap.dev.parent = &dev->dev;
-#ifdef CONFIG_OF
 	i2c->adap.dev.of_node = dev->dev.of_node;
-#endif
 
-	ret = i2c_add_numbered_adapter(&i2c->adap);
+	if (i2c_type == REGS_CE4100)
+		ret = i2c_add_adapter(&i2c->adap);
+	else
+		ret = i2c_add_numbered_adapter(&i2c->adap);
 	if (ret < 0) {
 		printk(KERN_INFO "I2C: Failed to add bus\n");
 		goto eadapt;
@@ -1234,6 +1259,7 @@ static struct platform_driver i2c_pxa_driver = {
 		.name	= "pxa2xx-i2c",
 		.owner	= THIS_MODULE,
 		.pm	= I2C_PXA_DEV_PM_OPS,
+		.of_match_table	= pxa_i2c_of_match,
 	},
 	.id_table	= i2c_pxa_id_table,
 };
Signature · 1 line
1.5.6.5
#8 lore raw

PATCH 7/7 i2c: pxa: support to parse property

Support to parse some optional properties. These three properties are i2c-polling, i2c-frequency, i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform data except for slave mode.

---
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   36 ++++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   22 ++++++++----
 2 files changed, 51 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +36 -0
new file mode 100644
index 0000000..bf34236
@@ -0,0 +1,36 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+	- i2c-polling: Specifies whether I2C-Controller is used in polling
+	  mode or interrupt mode. The type of property should be <u32>.
+
+	- i2c-frequency: Specifies the frequency that the I2C-Controller
+	  is working. The type of property should be <string>.
+
+	- i2c-class: Specifies the class of I2C-Controller. The type of
+	  property should be <u32>.
+
+Example:
+	i2c0: i2c at d4011000 {
+		compatible = "pxa2xx-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xd4011000 0x60>;
+		/* I2C-Controller works in interrupt mode. */
+		i2c-polling = <0>;
+		/* I2C-Controller's frequency is FAST. */
+		i2c-frequency = "fast";
+		/* interrupt of I2C-Controller */
+		interrupts = <7>;
+		interrupt-parent = <&mmp_intc>;
+
+		pm860x: pmic at 34 {
+			interrupt-controller;
+			/* interrupt of pm860x */
+			interrupts = <4>;
+			interrupt-parent = <&mmp_intc>;
+		};
+	};
drivers/i2c/busses/i2c-pxa.c +15 -7
index adac74a..4b9fa71 100644
@@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	const struct platform_device_id *id = platform_get_device_id(dev);
 	enum pxa_i2c_types i2c_type;
 	struct resource *res;
-	int irq, ret;
+	int irq, ret, poll;
+	char *p = NULL;
 	static int idx = 0;
 
 	if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 	if (np) {
+		of_property_read_u32(np, "i2c-polling", &poll);
+		i2c->use_pio = (poll) ? 1 : 0;
+		of_property_read_string(np, "i2c-frequency", &p);
+		if (p && !strncmp(p, "fast", 4))
+			i2c->fast_mode = 1;
+		of_property_read_u32(np, "i2c-class", &i2c->adap.class);
+
 		i2c->adap.nr = idx++;
 		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 			"pxa2xx-i2c.%u", i2c->adap.nr);
 		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 	} else {
+		if (plat) {
+			i2c->adap.class = plat->class;
+			i2c->use_pio = plat->use_pio;
+			i2c->fast_mode = plat->fast_mode;
+		}
+
 		/*
 		 * If "dev->id" is negative we consider it as zero.
 		 * The reason to do so is to avoid sysfs names that only make
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	clk_enable(i2c->clk);
 
-	if (plat) {
-		i2c->adap.class = plat->class;
-		i2c->use_pio = plat->use_pio;
-		i2c->fast_mode = plat->fast_mode;
-	}
-
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;
 	} else {
Signature · 1 line
1.5.6.5
#9 lore raw

PATCH 7/7 i2c: pxa: support to parse property

Quoted 81 lines · Haojian Zhuang

Support to parse some optional properties. These three properties are i2c-polling, i2c-frequency, i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform data except for slave mode.

---
?.../devicetree/bindings/i2c/pxa255-i2c.txt ? ? ? ? | ? 36 ++++++++++++++++++++ ?drivers/i2c/busses/i2c-pxa.c ? ? ? ? ? ? ? ? ? ? ? | ? 22 ++++++++---- ?2 files changed, 51 insertions(+), 7 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +36 -0
new file mode 100644
index 0000000..bf34236
@@ -0,0 +1,36 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+ ? ? ? - i2c-polling: Specifies whether I2C-Controller is used in polling
+ ? ? ? ? mode or interrupt mode. The type of property should be <u32>.
+
+ ? ? ? - i2c-frequency: Specifies the frequency that the I2C-Controller
+ ? ? ? ? is working. The type of property should be <string>.
+
+ ? ? ? - i2c-class: Specifies the class of I2C-Controller. The type of
+ ? ? ? ? property should be <u32>.
+
+Example:
+ ? ? ? i2c0: i2c at d4011000 {
+ ? ? ? ? ? ? ? compatible = "pxa2xx-i2c";
+ ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? #size-cells = <0>;
+ ? ? ? ? ? ? ? reg = <0xd4011000 0x60>;
+ ? ? ? ? ? ? ? /* I2C-Controller works in interrupt mode. */
+ ? ? ? ? ? ? ? i2c-polling = <0>;
+ ? ? ? ? ? ? ? /* I2C-Controller's frequency is FAST. */
+ ? ? ? ? ? ? ? i2c-frequency = "fast";
+ ? ? ? ? ? ? ? /* interrupt of I2C-Controller */
+ ? ? ? ? ? ? ? interrupts = <7>;
+ ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+
+ ? ? ? ? ? ? ? pm860x: pmic at 34 {
+ ? ? ? ? ? ? ? ? ? ? ? interrupt-controller;
+ ? ? ? ? ? ? ? ? ? ? ? /* interrupt of pm860x */
+ ? ? ? ? ? ? ? ? ? ? ? interrupts = <4>;
+ ? ? ? ? ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+ ? ? ? ? ? ? ? };
+ ? ? ? };
drivers/i2c/busses/i2c-pxa.c +9 -1
index adac74a..4b9fa71 100644
@@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 ? ? ? ?const struct platform_device_id *id = platform_get_device_id(dev);
 ? ? ? ?enum pxa_i2c_types i2c_type;
 ? ? ? ?struct resource *res;
- ? ? ? int irq, ret;
+ ? ? ? int irq, ret, poll;
+ ? ? ? char *p = NULL;
 ? ? ? ?static int idx = 0;
 
 ? ? ? ?if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 ? ? ? ?if (np) {
+ ? ? ? ? ? ? ? of_property_read_u32(np, "i2c-polling", &poll);
+ ? ? ? ? ? ? ? i2c->use_pio = (poll) ? 1 : 0;
+ ? ? ? ? ? ? ? of_property_read_string(np, "i2c-frequency", &p);
+ ? ? ? ? ? ? ? if (p && !strncmp(p, "fast", 4))
+ ? ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = 1;
+ ? ? ? ? ? ? ? of_property_read_u32(np, "i2c-class", &i2c->adap.class);
+
 ? ? ? ? ? ? ? ?i2c->adap.nr = idx++;

drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform_device *dev) · line 1114

Quoted 10 lines
drivers/i2c/busses/i2c-pxa.c +6 -0
 ? ? ? ? ? ? ? ?snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 ? ? ? ? ? ? ? ? ? ? ? ?"pxa2xx-i2c.%u", i2c->adap.nr);
 ? ? ? ? ? ? ? ?i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 ? ? ? ?} else {
+ ? ? ? ? ? ? ? if (plat) {
+ ? ? ? ? ? ? ? ? ? ? ? i2c->adap.class = plat->class;
+ ? ? ? ? ? ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
+ ? ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
+ ? ? ? ? ? ? ? }
+

One concern of DT's impact to existing drivers is _every_ driver has to be modified. While I'm not sure if it's a right way to go in a long run. Or can we have a generic way to automatically map the DT properties to the specific platform data structure?

Grant, any idea on this?

Quoted 20 lines

? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? * If "dev->id" is negative we consider it as zero. ? ? ? ? ? ? ? ? * The reason to do so is to avoid sysfs names that only make

drivers/i2c/busses/i2c-pxa.c +0 -7
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 ? ? ? ?clk_enable(i2c->clk);
 
- ? ? ? if (plat) {
- ? ? ? ? ? ? ? i2c->adap.class = plat->class;
- ? ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
- ? ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
- ? ? ? }
-
 ? ? ? ?if (i2c->use_pio) {
 ? ? ? ? ? ? ? ?i2c->adap.algo = &i2c_pxa_pio_algorithm;
 ? ? ? ?} else {
--

1.5.6.5

#10 lore raw

PATCH 7/7 i2c: pxa: support to parse property

Quoted 90 lines · Eric Miao
Quoted 88 lines · Haojian Zhuang

Support to parse some optional properties. These three properties are i2c-polling, i2c-frequency, i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform data except for slave mode.

---
?.../devicetree/bindings/i2c/pxa255-i2c.txt ? ? ? ? | ? 36 ++++++++++++++++++++ ?drivers/i2c/busses/i2c-pxa.c ? ? ? ? ? ? ? ? ? ? ? | ? 22 ++++++++---- ?2 files changed, 51 insertions(+), 7 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +36 -0
new file mode 100644
index 0000000..bf34236
@@ -0,0 +1,36 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+ ? ? ? - i2c-polling: Specifies whether I2C-Controller is used in polling
+ ? ? ? ? mode or interrupt mode. The type of property should be <u32>.
+
+ ? ? ? - i2c-frequency: Specifies the frequency that the I2C-Controller
+ ? ? ? ? is working. The type of property should be <string>.
+
+ ? ? ? - i2c-class: Specifies the class of I2C-Controller. The type of
+ ? ? ? ? property should be <u32>.
+
+Example:
+ ? ? ? i2c0: i2c at d4011000 {
+ ? ? ? ? ? ? ? compatible = "pxa2xx-i2c";
+ ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? #size-cells = <0>;
+ ? ? ? ? ? ? ? reg = <0xd4011000 0x60>;
+ ? ? ? ? ? ? ? /* I2C-Controller works in interrupt mode. */
+ ? ? ? ? ? ? ? i2c-polling = <0>;
+ ? ? ? ? ? ? ? /* I2C-Controller's frequency is FAST. */
+ ? ? ? ? ? ? ? i2c-frequency = "fast";
+ ? ? ? ? ? ? ? /* interrupt of I2C-Controller */
+ ? ? ? ? ? ? ? interrupts = <7>;
+ ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+
+ ? ? ? ? ? ? ? pm860x: pmic at 34 {
+ ? ? ? ? ? ? ? ? ? ? ? interrupt-controller;
+ ? ? ? ? ? ? ? ? ? ? ? /* interrupt of pm860x */
+ ? ? ? ? ? ? ? ? ? ? ? interrupts = <4>;
+ ? ? ? ? ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+ ? ? ? ? ? ? ? };
+ ? ? ? };
drivers/i2c/busses/i2c-pxa.c +12 -1
index adac74a..4b9fa71 100644
@@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 ? ? ? ?const struct platform_device_id *id = platform_get_device_id(dev);
 ? ? ? ?enum pxa_i2c_types i2c_type;
 ? ? ? ?struct resource *res;
- ? ? ? int irq, ret;
+ ? ? ? int irq, ret, poll;
+ ? ? ? char *p = NULL;
 ? ? ? ?static int idx = 0;
 
 ? ? ? ?if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 ? ? ? ?if (np) {
+ ? ? ? ? ? ? ? of_property_read_u32(np, "i2c-polling", &poll);
+ ? ? ? ? ? ? ? i2c->use_pio = (poll) ? 1 : 0;
+ ? ? ? ? ? ? ? of_property_read_string(np, "i2c-frequency", &p);
+ ? ? ? ? ? ? ? if (p && !strncmp(p, "fast", 4))
+ ? ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = 1;
+ ? ? ? ? ? ? ? of_property_read_u32(np, "i2c-class", &i2c->adap.class);
+
 ? ? ? ? ? ? ? ?i2c->adap.nr = idx++;
 ? ? ? ? ? ? ? ?snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 ? ? ? ? ? ? ? ? ? ? ? ?"pxa2xx-i2c.%u", i2c->adap.nr);
 ? ? ? ? ? ? ? ?i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 ? ? ? ?} else {
+ ? ? ? ? ? ? ? if (plat) {
+ ? ? ? ? ? ? ? ? ? ? ? i2c->adap.class = plat->class;
+ ? ? ? ? ? ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
Quoted 8 lines

drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform_device *dev) · line 1114

Quoted 3 lines
drivers/i2c/busses/i2c-pxa.c +3 -0
+ ? ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
+ ? ? ? ? ? ? ? }
+

One concern of DT's impact to existing drivers is _every_ driver has to be modified. While I'm not sure if it's a right way to go in a long run. Or can we have a generic way to automatically map the DT properties to the specific platform data structure?

Not really, since there is no such thing as a generic platform_data structure. We can certainly have helper functions, but any driver-specific data must by definition have driver-specific code to decode it from the device tree.

It does help though when similar drivers use the same binding.

g.

Quoted 23 lines

Grant, any idea on this?

Quoted 20 lines

? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? * If "dev->id" is negative we consider it as zero. ? ? ? ? ? ? ? ? * The reason to do so is to avoid sysfs names that only make

drivers/i2c/busses/i2c-pxa.c +0 -7
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 ? ? ? ?clk_enable(i2c->clk);
 
- ? ? ? if (plat) {
- ? ? ? ? ? ? ? i2c->adap.class = plat->class;
- ? ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
- ? ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
- ? ? ? }
-
 ? ? ? ?if (i2c->use_pio) {
 ? ? ? ? ? ? ? ?i2c->adap.algo = &i2c_pxa_pio_algorithm;
 ? ? ? ?} else {
--

1.5.6.5

#11 lore raw

PATCH 7/7 i2c: pxa: support to parse property

In reply to Haojian Zhuang
Quoted 19 lines · Haojian Zhuang

Support to parse some optional properties. These three properties are i2c-polling, i2c-frequency, i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform data except for slave mode.

---
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   36 ++++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   22 ++++++++----
 2 files changed, 51 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +0 -0
new file mode 100644
index 0000000..bf34236

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +8 -0
@@ -0,0 +1,36 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+	- i2c-polling: Specifies whether I2C-Controller is used in polling
+	  mode or interrupt mode. The type of property should be <u32>.

mrvl,i2c-polling

Make this an empty property instead of reading a value out of it. If the property is present, then it means polling mode is requested. Besides, wouldn't just the absence of an "interrupts" property mean that the i2c controller should be run in polled mode?

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt line 14

Quoted 6 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +6 -0
+
+	- i2c-frequency: Specifies the frequency that the I2C-Controller
+	  is working. The type of property should be <string>.
+
+	- i2c-class: Specifies the class of I2C-Controller. The type of
+	  property should be <u32>.

??? What is this for? The description in insufficient.

Quoted 77 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +22 -0
+
+Example:
+	i2c0: i2c at d4011000 {
+		compatible = "pxa2xx-i2c";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0xd4011000 0x60>;
+		/* I2C-Controller works in interrupt mode. */
+		i2c-polling = <0>;
+		/* I2C-Controller's frequency is FAST. */
+		i2c-frequency = "fast";
+		/* interrupt of I2C-Controller */
+		interrupts = <7>;
+		interrupt-parent = <&mmp_intc>;
+
+		pm860x: pmic at 34 {
+			interrupt-controller;
+			/* interrupt of pm860x */
+			interrupts = <4>;
+			interrupt-parent = <&mmp_intc>;
+		};
+	};
drivers/i2c/busses/i2c-pxa.c +15 -7
index adac74a..4b9fa71 100644
@@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	const struct platform_device_id *id = platform_get_device_id(dev);
 	enum pxa_i2c_types i2c_type;
 	struct resource *res;
-	int irq, ret;
+	int irq, ret, poll;
+	char *p = NULL;
 	static int idx = 0;
 
 	if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 	if (np) {
+		of_property_read_u32(np, "i2c-polling", &poll);
+		i2c->use_pio = (poll) ? 1 : 0;
+		of_property_read_string(np, "i2c-frequency", &p);
+		if (p && !strncmp(p, "fast", 4))
+			i2c->fast_mode = 1;
+		of_property_read_u32(np, "i2c-class", &i2c->adap.class);
+
 		i2c->adap.nr = idx++;
 		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 			"pxa2xx-i2c.%u", i2c->adap.nr);
 		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 	} else {
+		if (plat) {
+			i2c->adap.class = plat->class;
+			i2c->use_pio = plat->use_pio;
+			i2c->fast_mode = plat->fast_mode;
+		}
+
 		/*
 		 * If "dev->id" is negative we consider it as zero.
 		 * The reason to do so is to avoid sysfs names that only make
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	clk_enable(i2c->clk);
 
-	if (plat) {
-		i2c->adap.class = plat->class;
-		i2c->use_pio = plat->use_pio;
-		i2c->fast_mode = plat->fast_mode;
-	}
-
 	if (i2c->use_pio) {
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;
 	} else {
Signature · 1 line
1.5.6.5
#12 lore raw

PATCH 7/7 i2c: pxa: support to parse property

Quoted 31 lines · Grant Likely
Quoted 19 lines · Haojian Zhuang

Support to parse some optional properties. These three properties are i2c-polling, i2c-frequency, i2c-class.

After supporting these property, i2c-pxa driver can avoid to use platform data except for slave mode.

---
?.../devicetree/bindings/i2c/pxa255-i2c.txt ? ? ? ? | ? 36 ++++++++++++++++++++ ?drivers/i2c/busses/i2c-pxa.c ? ? ? ? ? ? ? ? ? ? ? | ? 22 ++++++++---- ?2 files changed, 51 insertions(+), 7 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +0 -0
new file mode 100644
index 0000000..bf34236

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt line 8

Quoted 8 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +8 -0
@@ -0,0 +1,36 @@
+PXA255 I2C
+
+The I2C-Controller is first used in PXA255. It's widely used in Intel/Marvell
+silicons.
+
+Optional Property:
+ ? ? - i2c-polling: Specifies whether I2C-Controller is used in polling
+ ? ? ? mode or interrupt mode. The type of property should be <u32>.

mrvl,i2c-polling

Quoted 4 lines

Make this an empty property instead of reading a value out of it. ?If the property is present, then it means polling mode is requested. Besides, wouldn't just the absence of an "interrupts" property mean that the i2c controller should be run in polled mode?

And change it to 'use-polling' might be clearer here. The absence of an 'interrupt' property gives an illusion of this controller not connected to any IRQ line, while this is not true, it's just not used in polling mode.

PS: polling mode used in interrupt disabled situations, e.g. late in suspend or early in resume.

Quoted 88 lines

Documentation/devicetree/bindings/i2c/pxa255-i2c.txt line 14

Quoted 7 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +6 -0
+
+ ? ? - i2c-frequency: Specifies the frequency that the I2C-Controller
+ ? ? ? is working. The type of property should be <string>.
+
+ ? ? - i2c-class: Specifies the class of I2C-Controller. The type of
+ ? ? ? property should be <u32>.

??? ?What is this for? ?The description in insufficient.

Quoted 77 lines
Documentation/devicetree/bindings/i2c/pxa255-i2c.txt new file +22 -0
+
+Example:
+ ? ? i2c0: i2c at d4011000 {
+ ? ? ? ? ? ? compatible = "pxa2xx-i2c";
+ ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? #size-cells = <0>;
+ ? ? ? ? ? ? reg = <0xd4011000 0x60>;
+ ? ? ? ? ? ? /* I2C-Controller works in interrupt mode. */
+ ? ? ? ? ? ? i2c-polling = <0>;
+ ? ? ? ? ? ? /* I2C-Controller's frequency is FAST. */
+ ? ? ? ? ? ? i2c-frequency = "fast";
+ ? ? ? ? ? ? /* interrupt of I2C-Controller */
+ ? ? ? ? ? ? interrupts = <7>;
+ ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+
+ ? ? ? ? ? ? pm860x: pmic at 34 {
+ ? ? ? ? ? ? ? ? ? ? interrupt-controller;
+ ? ? ? ? ? ? ? ? ? ? /* interrupt of pm860x */
+ ? ? ? ? ? ? ? ? ? ? interrupts = <4>;
+ ? ? ? ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+ ? ? ? ? ? ? };
+ ? ? };
drivers/i2c/busses/i2c-pxa.c +15 -1
index adac74a..4b9fa71 100644
@@ -1060,7 +1060,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 ? ? ? const struct platform_device_id *id = platform_get_device_id(dev);
 ? ? ? enum pxa_i2c_types i2c_type;
 ? ? ? struct resource *res;
- ? ? int irq, ret;
+ ? ? int irq, ret, poll;
+ ? ? char *p = NULL;
 ? ? ? static int idx = 0;
 
 ? ? ? if (np) {
@@ -1093,11 +1094,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 
 ? ? ? if (np) {
+ ? ? ? ? ? ? of_property_read_u32(np, "i2c-polling", &poll);
+ ? ? ? ? ? ? i2c->use_pio = (poll) ? 1 : 0;
+ ? ? ? ? ? ? of_property_read_string(np, "i2c-frequency", &p);
+ ? ? ? ? ? ? if (p && !strncmp(p, "fast", 4))
+ ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = 1;
+ ? ? ? ? ? ? of_property_read_u32(np, "i2c-class", &i2c->adap.class);
+
 ? ? ? ? ? ? ? i2c->adap.nr = idx++;
 ? ? ? ? ? ? ? snprintf(i2c->adap.name, sizeof(i2c->adap.name),
 ? ? ? ? ? ? ? ? ? ? ? "pxa2xx-i2c.%u", i2c->adap.nr);
 ? ? ? ? ? ? ? i2c->clk = clk_get_sys(i2c->adap.name, NULL);
 ? ? ? } else {
+ ? ? ? ? ? ? if (plat) {
+ ? ? ? ? ? ? ? ? ? ? i2c->adap.class = plat->class;
+ ? ? ? ? ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
+ ? ? ? ? ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
+ ? ? ? ? ? ? }
+

? ? ? ? ? ? ? /*
? ? ? ? ? ? ? ?* If "dev->id" is negative we consider it as zero. ? ? ? ? ? ? ? ?* The reason to do so is to avoid sysfs names that only make

drivers/i2c/busses/i2c-pxa.c +0 -7
@@ -1142,12 +1156,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 ? ? ? clk_enable(i2c->clk);
 
- ? ? if (plat) {
- ? ? ? ? ? ? i2c->adap.class = plat->class;
- ? ? ? ? ? ? i2c->use_pio = plat->use_pio;
- ? ? ? ? ? ? i2c->fast_mode = plat->fast_mode;
- ? ? }
-
 ? ? ? if (i2c->use_pio) {
 ? ? ? ? ? ? ? i2c->adap.algo = &i2c_pxa_pio_algorithm;
 ? ? ? } else {
--

1.5.6.5

#13 lore raw

PATCH 6/7 i2c: pxa: support i2c controller from DT

In reply to Haojian Zhuang
Quoted 61 lines · Haojian Zhuang

support i2c-pxa controller from DT.

---
 drivers/i2c/busses/i2c-pxa.c |   58 ++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 16 deletions(-)
drivers/i2c/busses/i2c-pxa.c +21 -6
index d603646..adac74a 100644
@@ -29,6 +29,7 @@
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/i2c-pxa.h>
+#include <linux/of_device.h>
 #include <linux/of_i2c.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
@@ -1044,15 +1045,31 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
 	.functionality	= i2c_pxa_functionality,
 };
 
+static const struct of_device_id pxa_i2c_of_match[] = {
+	{ .compatible = "mrvl,pxa255-i2c",    .data = (void *)REGS_PXA2XX, },
+	{ .compatible = "mrvl,pxa300-pwri2c", .data = (void *)REGS_PXA3XX, },
+	{},
+};
+
 static int i2c_pxa_probe(struct platform_device *dev)
 {
+	struct device_node *np = dev->dev.of_node;
+	const struct of_device_id *match;
 	struct pxa_i2c *i2c;
-	struct resource *res;
 	struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
 	const struct platform_device_id *id = platform_get_device_id(dev);
-	enum pxa_i2c_types i2c_type = id->driver_data;
-	int ret;
-	int irq;
+	enum pxa_i2c_types i2c_type;
+	struct resource *res;
+	int irq, ret;
+	static int idx = 0;
+
+	if (np) {
+		match = of_match_device(pxa_i2c_of_match, &dev->dev);
+		if (match == NULL)
+			return -ENODEV;
+		i2c_type = (int)match->data;
+	} else
+		i2c_type = id->driver_data;
 
 	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	irq = platform_get_irq(dev, 0);
@@ -1074,16 +1091,23 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	spin_lock_init(&i2c->lock);
 	init_waitqueue_head(&i2c->wait);
 
-	/*
-	 * If "dev->id" is negative we consider it as zero.

drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform_device *dev) · line 1096

Quoted 10 lines
drivers/i2c/busses/i2c-pxa.c +2 -7
-	 * The reason to do so is to avoid sysfs names that only make
-	 * sense when there are multiple adapters.
-	 */
-	i2c->adap.nr = dev->id;
-	snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
-		 i2c->adap.nr);
 
-	i2c->clk = clk_get(&dev->dev, NULL);
+	if (np) {
+		i2c->adap.nr = idx++;

No, just set adap.nr to -1. The i2c layer will dynamically assign an id (there is a chance queued for v3.1 that fixes the i2c add numbered adapter function to do this).

drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform_device *dev) · line 1105

Quoted 9 lines
drivers/i2c/busses/i2c-pxa.c +9 -0
+		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
+			"pxa2xx-i2c.%u", i2c->adap.nr);
+		i2c->clk = clk_get_sys(i2c->adap.name, NULL);
+	} else {
+		/*
+		 * If "dev->id" is negative we consider it as zero.
+		 * The reason to do so is to avoid sysfs names that only make
+		 * sense when there are multiple adapters.
+		 */

will no longer be necessary in v3.1

Quoted 11 lines
drivers/i2c/busses/i2c-pxa.c +5 -0
+		i2c->adap.nr = dev->id;
+		snprintf(i2c->adap.name, sizeof(i2c->adap.name),
+			"pxa_i2c-i2c.%u", i2c->adap.nr);
+		i2c->clk = clk_get(&dev->dev, NULL);
+	}
 	if (IS_ERR(i2c->clk)) {
 		ret = PTR_ERR(i2c->clk);
 		goto eclk;
@@ -1138,11 +1162,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	i2c->adap.algo_data = i2c;

drivers/i2c/busses/i2c-pxa.c static int i2c_pxa_probe(struct platform_device *dev) · line 1170

Quoted 10 lines
drivers/i2c/busses/i2c-pxa.c +4 -3
 	i2c->adap.dev.parent = &dev->dev;
-#ifdef CONFIG_OF
 	i2c->adap.dev.of_node = dev->dev.of_node;
-#endif
 
-	ret = i2c_add_numbered_adapter(&i2c->adap);
+	if (i2c_type == REGS_CE4100)
+		ret = i2c_add_adapter(&i2c->adap);
+	else
+		ret = i2c_add_numbered_adapter(&i2c->adap);

The hunk can be dropped.

Quoted 14 lines
drivers/i2c/busses/i2c-pxa.c +1 -0
 	if (ret < 0) {
 		printk(KERN_INFO "I2C: Failed to add bus\n");
 		goto eadapt;
@@ -1234,6 +1259,7 @@ static struct platform_driver i2c_pxa_driver = {
 		.name	= "pxa2xx-i2c",
 		.owner	= THIS_MODULE,
 		.pm	= I2C_PXA_DEV_PM_OPS,
+		.of_match_table	= pxa_i2c_of_match,
 	},
 	.id_table	= i2c_pxa_id_table,
 };
Signature · 1 line
1.5.6.5
#14 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

In reply to Haojian Zhuang
Quoted 11 lines · Haojian Zhuang

Support both normal platform driver and device tree driver in serial pxa.

---
 drivers/tty/serial/Kconfig     |    4 +-
 drivers/tty/serial/of_serial.c |   12 +++++
 drivers/tty/serial/pxa.c       |   93 ++++++++++++++++++++++++++++++++++++++-
 include/linux/serial_pxa.h     |   17 +++++++
 4 files changed, 122 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/serial_pxa.h

serial_pxa is already a platform_driver. Instead of modifying of_serial, an of_match_table should be added to this driver and it should decode the DT data inside the existing probe hook.

No need to create all of this extra infrastructure.

g.

Quoted 202 lines
drivers/tty/serial/Kconfig +3 -1
index 636144c..3f75e0d 100644
@@ -663,6 +663,8 @@ config SERIAL_MPSC_CONSOLE
 config SERIAL_PXA
 	bool "PXA serial port support"
 	depends on ARCH_PXA || ARCH_MMP
+	select SERIAL_OF_PLATFORM
+	select SERIAL_CORE_CONSOLE
 	select SERIAL_CORE
 	help
 	  If you have a machine based on an Intel XScale PXA2xx CPU you
@@ -1340,7 +1342,7 @@ config SERIAL_NETX_CONSOLE
 config SERIAL_OF_PLATFORM
 	tristate "Serial port on Open Firmware platform bus"
 	depends on OF
-	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL
+	depends on SERIAL_8250 || SERIAL_OF_PLATFORM_NWPSERIAL || SERIAL_PXA
 	help
 	  If you have a PowerPC based system that has serial ports
 	  on a platform specific bus, you should enable this option.
drivers/tty/serial/of_serial.c +12 -0
index e65f1e8..83e07fb 100644
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
+#include <linux/serial_pxa.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
@@ -126,6 +127,11 @@ static int __devinit of_platform_serial_probe(struct platform_device *ofdev)
 		ret = nwpserial_register_port(&port);
 		break;
 #endif
+#ifdef CONFIG_SERIAL_PXA
+	case PORT_PXA:
+		ret = serial_pxa_register_port(&port);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 	case PORT_UNKNOWN:
@@ -163,6 +169,11 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
 		nwpserial_unregister_port(info->line);
 		break;
 #endif
+#ifdef CONFIG_SERIAL_PXA
+	case PORT_PXA:
+		serial_pxa_unregister_port(info->line);
+		break;
+#endif
 	default:
 		/* need to add code for these */
 		break;
@@ -186,6 +197,7 @@ static struct of_device_id __devinitdata of_platform_serial_table[] = {
 	{ .compatible = "ibm,qpace-nwp-serial",
 		.data = (void *)PORT_NWPSERIAL, },
 #endif
+	{ .compatible = "mrvl,pxa270-serial", .data = (void *)PORT_PXA, },
 	{ .type = "serial",         .data = (void *)PORT_UNKNOWN, },
 	{ /* end of list */ },
 };
drivers/tty/serial/pxa.c +90 -3
index 4302e6e..8f4d538 100644
@@ -36,10 +36,12 @@
 #include <linux/circ_buf.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
 #include <linux/serial_core.h>
+#include <linux/serial_pxa.h>
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/slab.h>
@@ -54,6 +56,10 @@ struct uart_pxa_port {
 	char			*name;
 };
 
+#define PXA_SERIAL_NR		4
+
+static DEFINE_MUTEX(serial_pxa_mutex);
+
 static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)
 {
 	offset <<= 2;
@@ -346,8 +352,6 @@ static int serial_pxa_startup(struct uart_port *port)
 	else
 		up->mcr = 0;
 
-	up->port.uartclk = clk_get_rate(up->clk);
-
 	/*
 	 * Allocate the IRQ
 	 */
@@ -593,7 +597,7 @@ serial_pxa_type(struct uart_port *port)
 	return up->name;
 }
 
-static struct uart_pxa_port *serial_pxa_ports[4];
+static struct uart_pxa_port *serial_pxa_ports[PXA_SERIAL_NR];
 static struct uart_driver serial_pxa_reg;
 
 #ifdef CONFIG_SERIAL_PXA_CONSOLE
@@ -761,6 +765,89 @@ static const struct dev_pm_ops serial_pxa_pm_ops = {
 };
 #endif
 
+static int serial_pxa_port_size(struct uart_pxa_port *sport)
+{
+	return 8 << sport->port.regshift;
+}
+
+int serial_pxa_register_port(struct uart_port *port)
+{
+	struct uart_pxa_port *sport = NULL;
+	char name[32];
+	int i, ret;
+
+	mutex_lock(&serial_pxa_mutex);
+	for (i = 0; i < PXA_SERIAL_NR; i++) {
+		if (serial_pxa_ports[i] != NULL)
+			continue;
+		sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL);
+		if (!sport) {
+			ret = -ENOMEM;
+			goto out;
+		}
+		switch (i) {
+		case 0: sport->name = "FFUART"; break;
+		case 1: sport->name = "BTUART"; break;
+		case 2: sport->name = "STUART"; break;
+		case 3: sport->name = "HWUART"; break;
+		default:
+			sport->name = "???";
+			break;
+		}
+		break;
+	}
+	if (i >= PXA_SERIAL_NR) {
+		pr_warn("can't find pxa serial port\n");
+		ret = -ENODEV;
+		goto out;
+	}
+
+	sprintf(name, "pxa2xx-uart.%d", i);
+	sport->clk = clk_get_sys(name, NULL);
+	if (IS_ERR(sport->clk)) {
+		ret = PTR_ERR(sport->clk);
+		goto out_clk;
+	}
+	memcpy(&sport->port, port, sizeof(struct uart_port));
+	sport->port.line = i;
+	sport->port.fifosize = 64;
+	sport->port.ops = &serial_pxa_pops;
+
+	sport->port.membase = ioremap(sport->port.mapbase,
+				serial_pxa_port_size(sport));
+	if (!sport->port.membase) {
+		ret = -ENOMEM;
+		goto out_membase;
+	}
+
+	serial_pxa_ports[i] = sport;
+
+	uart_add_one_port(&serial_pxa_reg, &sport->port);
+	mutex_unlock(&serial_pxa_mutex);
+
+	return sport->port.line;
+
+out_membase:
+	clk_put(sport->clk);
+out_clk:
+	kfree(sport);
+out:
+	mutex_unlock(&serial_pxa_mutex);
+	return ret;
+}
+EXPORT_SYMBOL(serial_pxa_register_port);
+
+void serial_pxa_unregister_port(int line)
+{
+	struct uart_pxa_port *sport = serial_pxa_ports[line];
+
+	mutex_lock(&serial_pxa_mutex);
+	uart_remove_one_port(&serial_pxa_reg, &sport->port);
+	sport->port.type = PORT_UNKNOWN;
+	clk_put(sport->clk);
+	mutex_unlock(&serial_pxa_mutex);
+}
+
 static int serial_pxa_probe(struct platform_device *dev)
 {
 	struct uart_pxa_port *sport;
#15 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

Quoted 13 lines · On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
Quoted 11 lines · Haojian Zhuang

Support both normal platform driver and device tree driver in serial pxa.

---
 drivers/tty/serial/Kconfig     |    4 +-
 drivers/tty/serial/of_serial.c |   12 +++++
 drivers/tty/serial/pxa.c       |   93 ++++++++++++++++++++++++++++++++++++++-
 include/linux/serial_pxa.h     |   17 +++++++
 4 files changed, 122 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/serial_pxa.h
Quoted 5 lines

serial_pxa is already a platform_driver. Instead of modifying of_serial, an of_match_table should be added to this driver and it should decode the DT data inside the existing probe hook.

No need to create all of this extra infrastructure.

Right. We should probably rename of_serial to 8250_of and remove the qpace parts from the driver.

Arnd

#16 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
Quoted 11 lines · Haojian Zhuang

Support both normal platform driver and device tree driver in serial pxa.

---

?drivers/tty/serial/Kconfig ? ? | ? ?4 +-
?drivers/tty/serial/of_serial.c | ? 12 +++++
?drivers/tty/serial/pxa.c ? ? ? | ? 93 ++++++++++++++++++++++++++++++++++++++-
?include/linux/serial_pxa.h ? ? | ? 17 +++++++

?4 files changed, 122 insertions(+), 4 deletions(-) ?create mode 100644 include/linux/serial_pxa.h

Quoted 8 lines
Quoted 5 lines

serial_pxa is already a platform_driver. ?Instead of modifying of_serial, an of_match_table should be added to this driver and it should decode the DT data inside the existing probe hook.

No need to create all of this extra infrastructure.

Right. We should probably rename of_serial to 8250_of and remove the qpace parts from the driver.

In fact, I think we've got about 3 devtree drivers for 8250 serial ports. I think it is about time for some consolidation work. :-)

I wonder if we can roll of_serial directly into the 8250.c driver.

g.

#17 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

Quoted 21 lines · Grant Likely
Quoted 20 lines · Arnd Bergmann
Quoted 18 lines · On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
Quoted 11 lines · Haojian Zhuang

Support both normal platform driver and device tree driver in serial pxa.

---

?drivers/tty/serial/Kconfig ? ? | ? ?4 +-
?drivers/tty/serial/of_serial.c | ? 12 +++++
?drivers/tty/serial/pxa.c ? ? ? | ? 93 ++++++++++++++++++++++++++++++++++++++-
?include/linux/serial_pxa.h ? ? | ? 17 +++++++

?4 files changed, 122 insertions(+), 4 deletions(-) ?create mode 100644 include/linux/serial_pxa.h

serial_pxa is already a platform_driver. ?Instead of modifying of_serial, an of_match_table should be added to this driver and it should decode the DT data inside the existing probe hook.

No need to create all of this extra infrastructure.

Quoted 7 lines
Quoted 2 lines

Right. We should probably rename of_serial to 8250_of and remove the qpace parts from the driver.

In fact, I think we've got about 3 devtree drivers for 8250 serial ports. I think it is about time for some consolidation work. :-)

I wonder if we can roll of_serial directly into the 8250.c driver.

The original serial.c got split into 8250.c, plus several probe modules (8250_pnp.c, 8250_pci.c, etc) to get around the problem of lots of bus specific crap appearing in the main driver. 8250_of.c would follow on that theme.

#18 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

Quoted 8 lines · On Tuesday 19 July 2011 21:05:15 Russell King - ARM Linux wrote:
Quoted 7 lines · Grant Likely
Quoted 2 lines · Arnd Bergmann

Right. We should probably rename of_serial to 8250_of and remove the qpace parts from the driver.

In fact, I think we've got about 3 devtree drivers for 8250 serial ports. I think it is about time for some consolidation work. :-)

Quoted 6 lines
Quoted 1 line

I wonder if we can roll of_serial directly into the 8250.c driver.

The original serial.c got split into 8250.c, plus several probe modules (8250_pnp.c, 8250_pci.c, etc) to get around the problem of lots of bus specific crap appearing in the main driver. 8250_of.c would follow on that theme.

Yes. Going even further, I'd actually like to pull the ISA bits and the platform driver out of the 8250.c file as well. While it would be possible to combine the platform driver with the of driver, I don't think that's too useful in case of 8250 because the two actually look quite different.

Arnd

#19 lore raw

PATCH 4/7 tty: serial: support device tree in pxa

In reply to Russell King - ARM Linux
Quoted 28 lines · Russell King - ARM Linux
Quoted 27 lines · Grant Likely
Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
Quoted 11 lines · Haojian Zhuang

Support both normal platform driver and device tree driver in serial pxa.

---

?drivers/tty/serial/Kconfig ? ? | ? ?4 +-
?drivers/tty/serial/of_serial.c | ? 12 +++++
?drivers/tty/serial/pxa.c ? ? ? | ? 93 ++++++++++++++++++++++++++++++++++++++-
?include/linux/serial_pxa.h ? ? | ? 17 +++++++

?4 files changed, 122 insertions(+), 4 deletions(-) ?create mode 100644 include/linux/serial_pxa.h

Quoted 8 lines
Quoted 5 lines

serial_pxa is already a platform_driver. ?Instead of modifying of_serial, an of_match_table should be added to this driver and it should decode the DT data inside the existing probe hook.

No need to create all of this extra infrastructure.

Right. We should probably rename of_serial to 8250_of and remove the qpace parts from the driver.

In fact, I think we've got about 3 devtree drivers for 8250 serial ports. ?I think it is about time for some consolidation work. ?:-)

Quoted 7 lines
Quoted 1 line

I wonder if we can roll of_serial directly into the 8250.c driver.

The original serial.c got split into 8250.c, plus several probe modules (8250_pnp.c, 8250_pci.c, etc) to get around the problem of lots of bus specific crap appearing in the main driver. ?8250_of.c would follow on that theme.

Apart from the DMA support (which hasn't make it into mainline yet) and a few other minor tweaks, the PXA serial can actually reuse the 8250.c (actually it was where pxa serial driver forked IIRC).

Russell, what's inevitable to have a forked pxa serial driver?

#20 lore raw

PATCH 3/7 ARM: mmp: support DT on both dkb and brownstone

In reply to Haojian Zhuang

Thanks for doing this work. I'm currently working on a One Laptop Per Child product that is based on the Armada 610, so this very timely for OLPC.

See my in-line comments on the specification of the soc top-level nodes, related to the addressing of their children, and on the presence of "#address-cells" and "#size-cells" in the intc nodes.

-- Mitch Bradley

Quoted 49 lines · Haojian Zhuang

Add new boards.c to support both TTC-DKB and MMP2-BROWNSTONE. While CONFIG_MMP_USE_OF is selected, original ttc_dkb.c and brownstone.c won't be compiled.

While everything moving to DT in ARCH-MMP, original ttc_dkb.c and brownstone.c will be abandoned.

---
  .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
  arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
  arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
  arch/arm/mach-mmp/Makefile                         |    4 +
  arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++
  5 files changed, 492 insertions(+), 0 deletions(-)

create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
create mode 100644 arch/arm/mach-mmp/boards.c

Documentation/devicetree/bindings/arm/marvell/boards.txt new file +7 -0
new file mode 100644
index 0000000..219e134
@@ -0,0 +1,7 @@
+TTC(pxa910) "DKB" evalutation board
+Required root node properties:
+	- compatible = "mrvl,ttc-dkb", "mrvl,pxa910-dkb";
+
+mmp2(armada610) "Brownstone" evalutation board
+Required root node properties:
+	- compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";
arch/arm/boot/dts/mmp2-brownstone.dts new file +10 -0
new file mode 100644
index 0000000..4e14388
@@ -0,0 +1,242 @@
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell MMP2 Brownstone";
+	compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";
+
+	memory {
+		reg =<0x00000000 0x20000000>;

arch/arm/boot/dts/mmp2-brownstone.dts line 20

Quoted 10 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +10 -0
+	};
+
+	chosen {
+		bootargs = "console=ttyS2,38400 root=/dev/nfs nfsroot=192.168.1.100:192.168.1.101::255.255.255.0::eth0:on";
+		linux,stdout-path =&uart2;
+	};
+
+	soc at d4000000 {
+		compatible = "mrvl,mmp2", "mrvl,armada610", "simple-bus";
+		device_type = "soc";

Can someone comment on the use of "device_type" here? I thought that device_type was deprecated. Is there some residual use for it in Linux?

arch/arm/boot/dts/mmp2-brownstone.dts line 23

Quoted 3 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +3 -0
+		#address-cells =<1>;
+		#size-cells =<1>;
+		ranges;

This way of addressing of APB and AXI devices would work, in that the empty ranges property specifies no address translation across the "soc" node. However, in a case like this, it is unclear to me why you need an "soc" node at all. The "soc" node appears to have no semantics. You could just move all the subordinate devices up a level, making them direct children of the root node. As I understand it, the Linux kernel no longer has a problem with devices being directly attached to the root node.

If you want to have a bus node at this level, I think it's best to go all the way and define it as an AXI/APB bus, exposing some of the addressing semantics of that kind of bus. See below for an exploration of how that might work, in the comments for the ttc-dkb "soc" node.

arch/arm/boot/dts/mmp2-brownstone.dts

Quoted 5 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +5 -0
+
+		mmp_intc: interrupt-controller at d4282000 {
+			compatible = "mrvl,mmp-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;

I believe that this node should not have "#address-cells" and "#size-cells" properties. Such properties apply to nodes that have child nodes, expressing how those children are addressed. I think that the interrupt controller is not intended to have child nodes.

Quoted 21 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +21 -0
+			/* reg:<offset&  size>  */
+			reg =<0xd4282000 0x400>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			intc-numbers =<64>;
+			/* enable bits in conf register */
+			intc-enable-mask =<0x20>;
+		};
+
+		mux_intc4: interrupt-controller at d4282150 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd4282150 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<4>;
+			intc-numbers =<2>;

arch/arm/boot/dts/mmp2-brownstone.dts line 59

Quoted 10 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +10 -0
+			intc-status =<0x150>;
+			intc-mask =<0x168>;
+			/* mfp register&  interrupt index */
+			intc-mfp-edge =<0xd401e2c4 1>;
+		};
+
+		mux_intc5: interrupt-controller at d4282154 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;

Should not have #address-cells and #size-cells, as previously explained.

Quoted 203 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +183 -0
+			reg =<0xd4282154 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<5>;
+			intc-numbers =<2>;
+			intc-status =<0x154>;
+			intc-mask =<0x16c>;
+		};
+
+		mux_intc9: interrupt-controller at d4282180 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd4282180 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<9>;
+			intc-numbers =<3>;
+			intc-status =<0x180>;
+			intc-mask =<0x17c>;
+		};
+
+		mux_intc17: interrupt-controller at d4282158 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd4282158 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<17>;
+			intc-numbers =<5>;
+			intc-status =<0x158>;
+			intc-mask =<0x170>;
+		};
+
+		mux_intc35: interrupt-controller at d428215c {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd428215c 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<35>;
+			intc-numbers =<15>;
+			intc-status =<0x15c>;
+			intc-mask =<0x174>;
+		};
+
+		mux_intc51: interrupt-controller at d4282160 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd4282160 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<51>;
+			intc-numbers =<2>;
+			intc-status =<0x160>;
+			intc-mask =<0x178>;
+		};
+
+		mux_intc55: interrupt-controller at d4282188 {
+			compatible = "mrvl,mux-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;
+			reg =<0xd4282188 0>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			interrupt-parent =<&mmp_intc>;
+			interrupts =<55>;
+			intc-numbers =<2>;
+			intc-status =<0x188>;
+			intc-mask =<0x184>;
+		};
+
+		i2c0: i2c at d4011000 {
+			compatible = "mrvl,pxa255-i2c";
+			#address-cells =<1>;
+			#size-cells =<0>;
+			reg =<0xd4011000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<7>;
+			interrupt-parent =<&mmp_intc>;
+		};
+
+		i2c1: i2c at d4031000 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4031000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<0>;
+			interrupt-parent =<&mux_intc17>;
+		};
+
+		i2c2: i2c at d4032000 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4032000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<1>;
+			interrupt-parent =<&mux_intc17>;
+		};
+
+		i2c3: i2c at d4033000 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4033000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<2>;
+			interrupt-parent =<&mux_intc17>;
+		};
+
+		i2c4: i2c at d4033800 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4033800 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<3>;
+			interrupt-parent =<&mux_intc17>;
+		};
+
+		i2c5: i2c at d4034000 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4034000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<4>;
+			interrupt-parent =<&mux_intc17>;
+		};
+
+		uart0: uart at d4030000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4030000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<27>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<26000000>;
+			current-speed =<115200>;
+		};
+
+		uart1: uart at d4017000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4017000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<28>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<26000000>;
+			current-speed =<115200>;
+		};
+
+		uart2: uart at d4018000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4018000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<24>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<26000000>;
+			current-speed =<38400>;
+		};
+
+		uart3: uart at d4016000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4016000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<46>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<26000000>;
+			current-speed =<115200>;
+		};
+	};
+};
arch/arm/boot/dts/ttc-dkb.dts new file +14 -0
new file mode 100644
index 0000000..ff8df4f
@@ -0,0 +1,80 @@
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell TTC DKB";
+	compatible = "mrvl,ttc-dkb", "mrvl,pxa910-dkb";
+
+	memory {
+		reg =<0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.100:192.168.1.101::255.255.255.0::eth0:on";

arch/arm/boot/dts/ttc-dkb.dts line 24

Quoted 10 lines
arch/arm/boot/dts/ttc-dkb.dts new file +10 -0
+		linux,stdout-path =&uart0;
+	};
+
+	soc at d4000000 {
+		compatible = "mrvl,pxa910", "simple-bus";
+		device_type = "soc";
+		#address-cells =<1>;
+		#size-cells =<1>;
+		ranges =<0xd4000000 0xd4000000 0x00200000	/* APB */
+			0xd4200000 0xd4200000 0x00200000>;	/* AXI */

I assume that, by defining a non-empty "ranges" property in this way, you were thinking of exposing the existence of APB and AXI bus bridges inside the chip. That's probably a good thing, but I think it might be better to do a proper translation here, instead of just passing the
child addresses through. To fully express the APB/AXI structure, you
could do it this way:

soc at d4000000 {
	compatible = "mrvl,pxa910", "simple-bus";
	#address-cells =<2>;  /* first cell: 0 for APB, 1 for AXI */
	#size-cells =<1>;
	ranges =<0 0 0xd4000000 0x00200000	      /* APB */
		        0 1 0xd4200000 0x00200000>;	/* AXI */

         mmp_intc: interrupt-controller at 1,82000
                reg = <1 0x82000 0x400>;

with similar address modifications for other children.

arch/arm/boot/dts/ttc-dkb.dts line 29

Quoted 5 lines
arch/arm/boot/dts/ttc-dkb.dts new file +5 -0
+
+		mmp_intc: interrupt-controller at d4282000 {
+			compatible = "mrvl,mmp-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;

Should not have #address-cells and #size-cells, as previously explained.

Quoted 235 lines
arch/arm/boot/dts/ttc-dkb.dts new file +51 -0
+			/* reg:<offset&  size>  */
+			reg =<0xd4282000 0x400>;
+
+			#interrupt-cells =<1>;
+			interrupt-controller;
+			intc-numbers =<64>;
+			/* enable bits in conf register */
+			intc-enable-mask =<0x51>;
+		};
+
+		i2c0: i2c at d4011000 {
+			compatible = "mrvl,pxa255-i2c";
+			#address-cells =<1>;
+			#size-cells =<0>;
+			reg =<0xd4011000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<7>;
+			interrupt-parent =<&mmp_intc>;
+		};
+
+		i2c1: i2c at d4037000 {
+			compatible = "mrvl,pxa255-i2c";
+			reg =<0xd4037000 0x60>;
+			i2c-polling =<0>;
+			i2c-frequency = "fast";
+			interrupts =<54>;
+			interrupt-parent =<&mmp_intc>;
+		};
+
+		uart0: uart at d4017000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4017000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<27>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<14745600>;
+			current-speed =<115200>;
+		};
+
+		uart1: uart at d4018000 {
+			compatible = "mrvl,pxa270-serial";
+			reg =<0xd4018000 0x1000>;
+			reg-shift =<2>;
+			interrupts =<28>;
+			interrupt-parent =<&mmp_intc>;
+			clock-frequency =<14745600>;
+			current-speed =<115200>;
+		};
+	};
+};
arch/arm/mach-mmp/Makefile +4 -0
index e7862ea..6c39bbd 100644
@@ -12,6 +12,9 @@ obj-$(CONFIG_CPU_PXA910)	+= pxa910.o irq-pxa168.o
  obj-$(CONFIG_CPU_MMP2)		+= mmp2.o irq-mmp2.o
 
  # board support
+ifeq ($(CONFIG_MMP_USE_OF),y)
+obj-$(CONFIG_OF)		+= boards.o
+else
  obj-$(CONFIG_MACH_ASPENITE)	+= aspenite.o
  obj-$(CONFIG_MACH_ZYLONITE2)	+= aspenite.o
  obj-$(CONFIG_MACH_AVENGERS_LITE)+= avengers_lite.o
@@ -21,3 +24,4 @@ obj-$(CONFIG_MACH_BROWNSTONE)	+= brownstone.o
  obj-$(CONFIG_MACH_FLINT)	+= flint.o
  obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
  obj-$(CONFIG_MACH_TETON_BGA)	+= teton_bga.o
+endif
arch/arm/mach-mmp/boards.c new file +159 -0
new file mode 100644
index 0000000..31c8e84
@@ -0,0 +1,159 @@
+/*
+ *  linux/arch/arm/mach-mmp/boards.c
+ *
+ *  Support for the Multiple Marvell Development Platforms.
+ *
+ *  Copyright (C) 2009-2011 Marvell International Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  publishhed by the Free Software Foundation.
+ */
+
+#include<linux/init.h>
+#include<linux/kernel.h>
+#include<linux/of.h>
+#include<linux/of_fdt.h>
+#include<linux/of_platform.h>
+#include<linux/platform_device.h>
+#include<linux/i2c/pxa-i2c.h>
+
+#include<asm/mach-types.h>
+#include<asm/mach/arch.h>
+
+#include<mach/pxa910.h>
+#include<mach/mmp2.h>
+#include<mach/mfp-mmp2.h>
+
+#include "common.h"
+
+static struct of_device_id of_bus_ids[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{},
+};
+
+static struct of_dev_auxdata ttc_dkb_auxdata_lookup[] __initdata = {
+	{}
+};
+
+static void __init ttc_dkb_init(void)
+{
+	if (of_platform_populate(NULL, of_bus_ids, ttc_dkb_auxdata_lookup,
+		NULL)<  0)
+		BUG();
+}
+
+static const char *ttc_dkb_dt_match[] __initdata = {
+	"mrvl,ttc-dkb",
+	NULL,
+};
+
+#ifdef CONFIG_CPU_PXA910
+MACHINE_START(TTC_DKB, "PXA910-based TTC-DKB Development Platform")
+	.map_io		= mmp_map_io,
+	.init_irq	= mmp_init_intc,
+	.timer		=&pxa910_timer,
+	.init_machine	= ttc_dkb_init,
+	.dt_compat	= ttc_dkb_dt_match,
+MACHINE_END
+#endif
+
+static unsigned long brownstone_pin_config[] __initdata = {
+	/* UART1 */
+	GPIO29_UART1_RXD,
+	GPIO30_UART1_TXD,
+
+	/* UART3 */
+	GPIO51_UART3_RXD,
+	GPIO52_UART3_TXD,
+
+	/* DFI */
+	GPIO168_DFI_D0,
+	GPIO167_DFI_D1,
+	GPIO166_DFI_D2,
+	GPIO165_DFI_D3,
+	GPIO107_DFI_D4,
+	GPIO106_DFI_D5,
+	GPIO105_DFI_D6,
+	GPIO104_DFI_D7,
+	GPIO111_DFI_D8,
+	GPIO164_DFI_D9,
+	GPIO163_DFI_D10,
+	GPIO162_DFI_D11,
+	GPIO161_DFI_D12,
+	GPIO110_DFI_D13,
+	GPIO109_DFI_D14,
+	GPIO108_DFI_D15,
+	GPIO143_ND_nCS0,
+	GPIO144_ND_nCS1,
+	GPIO147_ND_nWE,
+	GPIO148_ND_nRE,
+	GPIO150_ND_ALE,
+	GPIO149_ND_CLE,
+	GPIO112_ND_RDY0,
+	GPIO160_ND_RDY1,
+
+	/* PMIC */
+	PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
+
+	/* MMC0 */
+	GPIO131_MMC1_DAT3 | MFP_PULL_HIGH,
+	GPIO132_MMC1_DAT2 | MFP_PULL_HIGH,
+	GPIO133_MMC1_DAT1 | MFP_PULL_HIGH,
+	GPIO134_MMC1_DAT0 | MFP_PULL_HIGH,
+	GPIO136_MMC1_CMD | MFP_PULL_HIGH,
+	GPIO139_MMC1_CLK,
+	GPIO140_MMC1_CD | MFP_PULL_LOW,
+	GPIO141_MMC1_WP | MFP_PULL_LOW,
+
+	/* MMC1 */
+	GPIO37_MMC2_DAT3 | MFP_PULL_HIGH,
+	GPIO38_MMC2_DAT2 | MFP_PULL_HIGH,
+	GPIO39_MMC2_DAT1 | MFP_PULL_HIGH,
+	GPIO40_MMC2_DAT0 | MFP_PULL_HIGH,
+	GPIO41_MMC2_CMD | MFP_PULL_HIGH,
+	GPIO42_MMC2_CLK,
+
+	/* MMC2 */
+	GPIO165_MMC3_DAT7 | MFP_PULL_HIGH,
+	GPIO162_MMC3_DAT6 | MFP_PULL_HIGH,
+	GPIO166_MMC3_DAT5 | MFP_PULL_HIGH,
+	GPIO163_MMC3_DAT4 | MFP_PULL_HIGH,
+	GPIO167_MMC3_DAT3 | MFP_PULL_HIGH,
+	GPIO164_MMC3_DAT2 | MFP_PULL_HIGH,
+	GPIO168_MMC3_DAT1 | MFP_PULL_HIGH,
+	GPIO111_MMC3_DAT0 | MFP_PULL_HIGH,
+	GPIO112_MMC3_CMD | MFP_PULL_HIGH,
+	GPIO151_MMC3_CLK,
+
+	/* 5V regulator */
+	GPIO89_GPIO,
+};
+
+static struct of_dev_auxdata brownstone_auxdata_lookup[] __initdata = {
+	{}
+};
+
+static void __init brownstone_init(void)
+{
+	mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
+
+	if (of_platform_populate(NULL, of_bus_ids, brownstone_auxdata_lookup,
+		NULL)<  0)
+		BUG();
+}
+
+static const char *brownstone_dt_match[] __initdata = {
+	"mrvl,mmp2-brownstone",
+	NULL,
+};
+
+#ifdef CONFIG_CPU_MMP2
+MACHINE_START(BROWNSTONE, "Brownstone Development Platform")
+	.map_io		= mmp_map_io,
+	.init_irq	= mmp_init_intc,
+	.timer		=&mmp2_timer,
+	.init_machine	= brownstone_init,
+	.dt_compat	= brownstone_dt_match,
+MACHINE_END
+#endif
#21 lore raw

PATCH 3/7 ARM: mmp: support DT on both dkb and brownstone

Quoted 66 lines · Mitch Bradley

Thanks for doing this work. I'm currently working on a One Laptop Per Child product that is based on the Armada 610, so this very timely for OLPC.

See my in-line comments on the specification of the soc top-level nodes, related to the addressing of their children, and on the presence of "#address-cells" and "#size-cells" in the intc nodes.

-- Mitch Bradley

Quoted 55 lines · Haojian Zhuang

Add new boards.c to support both TTC-DKB and MMP2-BROWNSTONE. While CONFIG_MMP_USE_OF is selected, original ttc_dkb.c and brownstone.c won't be compiled.

While everything moving to DT in ARCH-MMP, original ttc_dkb.c and brownstone.c will be abandoned.

---
 .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
 arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
 arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
 arch/arm/mach-mmp/Makefile                         |    4 +
 arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++
 5 files changed, 492 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
 create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
 create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
 create mode 100644 arch/arm/mach-mmp/boards.c
Documentation/devicetree/bindings/arm/marvell/boards.txt new file +7 -0
new file mode 100644
index 0000000..219e134
@@ -0,0 +1,7 @@
+TTC(pxa910) "DKB" evalutation board
+Required root node properties:
+	- compatible = "mrvl,ttc-dkb", "mrvl,pxa910-dkb";
+
+mmp2(armada610) "Brownstone" evalutation board
+Required root node properties:
+	- compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";
arch/arm/boot/dts/mmp2-brownstone.dts new file +16 -0
new file mode 100644
index 0000000..4e14388
@@ -0,0 +1,242 @@
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell MMP2 Brownstone";
+	compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";
+
+	memory {
+		reg =<0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS2,38400 root=/dev/nfs nfsroot=192.168.1.100:192.168.1.101::255.255.255.0::eth0:on";
+		linux,stdout-path =&uart2;
+	};
Quoted 8 lines

arch/arm/boot/dts/mmp2-brownstone.dts line 20

Quoted 4 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +4 -0
+
+	soc at d4000000 {
+		compatible = "mrvl,mmp2", "mrvl,armada610", "simple-bus";
+		device_type = "soc";

Can someone comment on the use of "device_type" here? I thought that device_type was deprecated. Is there some residual use for it in Linux?

It is, and device_type should be removed for .dts files.

Quoted 20 lines

arch/arm/boot/dts/mmp2-brownstone.dts line 23

Quoted 4 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +3 -0
+		#address-cells =<1>;
+		#size-cells =<1>;
+		ranges;

This way of addressing of APB and AXI devices would work, in that the empty ranges property specifies no address translation across the "soc" node. However, in a case like this, it is unclear to me why you need an "soc" node at all. The "soc" node appears to have no semantics. You could just move all the subordinate devices up a level, making them direct children of the root node. As I understand it, the Linux kernel no longer has a problem with devices being directly attached to the root node.

If you want to have a bus node at this level, I think it's best to go all the way and define it as an AXI/APB bus, exposing some of the addressing semantics of that kind of bus. See below for an exploration of how that might work, in the comments for the ttc-dkb "soc" node.

Quoted 10 lines

arch/arm/boot/dts/mmp2-brownstone.dts

Quoted 5 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +5 -0
+
+		mmp_intc: interrupt-controller at d4282000 {
+			compatible = "mrvl,mmp-intc";
+			#address-cells =<1>;
+			#size-cells =<1>;

I believe that this node should not have "#address-cells" and "#size-cells" properties. Such properties apply to nodes that have child nodes, expressing how those children are addressed. I think that the interrupt controller is not intended to have child nodes.

I agree

#22 lore raw

PATCH 3/7 ARM: mmp: support DT on both dkb and brownstone

In reply to Haojian Zhuang
Quoted 7 lines · Haojian Zhuang

Add new boards.c to support both TTC-DKB and MMP2-BROWNSTONE. While CONFIG_MMP_USE_OF is selected, original ttc_dkb.c and brownstone.c won't be compiled.

While everything moving to DT in ARCH-MMP, original ttc_dkb.c and brownstone.c will be abandoned.

Quoted 7 lines
---
 .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
 arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
 arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
 arch/arm/mach-mmp/Makefile                         |    4 +
 arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++

I would suggest arch/arm/mach-mmp/board-dt.c. That is the pattern that has been used for several other socs.

Quoted 12 lines
 5 files changed, 492 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
 create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
 create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
 create mode 100644 arch/arm/mach-mmp/boards.c
Documentation/devicetree/bindings/arm/marvell/boards.txt new file +0 -0
new file mode 100644
index 0000000..219e134

Documentation/devicetree/bindings/arm/marvell/boards.txt line 7

Quoted 7 lines
Documentation/devicetree/bindings/arm/marvell/boards.txt new file +7 -0
@@ -0,0 +1,7 @@
+TTC(pxa910) "DKB" evalutation board
+Required root node properties:
+	- compatible = "mrvl,ttc-dkb", "mrvl,pxa910-dkb";
+
+mmp2(armada610) "Brownstone" evalutation board
+Required root node properties:
+	- compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";

What do these individual values mean? Typically a board should have 2 values, the exact name of the board/system, and the exact name of the SoC used by the board. The board.c file will normally match on the soc value.

arch/arm/boot/dts/mmp2-brownstone.dts line 7

Quoted 13 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +7 -0
new file mode 100644
index 0000000..4e14388
@@ -0,0 +1,242 @@
+/dts-v1/;
+
+/include/ "skeleton.dtsi"
+
+/ {
+	model = "Marvell MMP2 Brownstone";
+	compatible = "mrvl,mmp2-brownstone", "mrvl,armada610-brownstone";

Missing #address-cells and #size-cells in the root node.

If you add an interrupt-parent = <&mmp_intc>; property here, then it can be removed from all the nodes below because child nodes inherit interrupt-parent from their parent node.

arch/arm/boot/dts/mmp2-brownstone.dts line 20

Quoted 13 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +13 -0
+
+	memory {
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS2,38400 root=/dev/nfs nfsroot=192.168.1.100:192.168.1.101::255.255.255.0::eth0:on";
+		linux,stdout-path = &uart2;
+	};
+
+	soc at d4000000 {
+		compatible = "mrvl,mmp2", "mrvl,armada610", "simple-bus";
+		device_type = "soc";

Drop device_type

Quoted 19 lines
arch/arm/boot/dts/mmp2-brownstone.dts new file +4 -0
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
arch/arm/mach-mmp/Makefile +3 -0
index e7862ea..6c39bbd 100644
@@ -12,6 +12,9 @@ obj-$(CONFIG_CPU_PXA910)	+= pxa910.o irq-pxa168.o
 obj-$(CONFIG_CPU_MMP2)		+= mmp2.o irq-mmp2.o
 
 # board support
+ifeq ($(CONFIG_MMP_USE_OF),y)
+obj-$(CONFIG_OF)		+= boards.o
+else
 obj-$(CONFIG_MACH_ASPENITE)	+= aspenite.o
 obj-$(CONFIG_MACH_ZYLONITE2)	+= aspenite.o
 obj-$(CONFIG_MACH_AVENGERS_LITE)+= avengers_lite.o

arch/arm/mach-mmp/Makefile obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o · line 27

Quoted 4 lines
arch/arm/mach-mmp/Makefile +1 -0
@@ -21,3 +24,4 @@ obj-$(CONFIG_MACH_BROWNSTONE)	+= brownstone.o
 obj-$(CONFIG_MACH_FLINT)	+= flint.o
 obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
 obj-$(CONFIG_MACH_TETON_BGA)	+= teton_bga.o
+endif

The else/endif clause breaks multiplatform kernels. There is no need to do this. It should be possible to select both DT and non-DT platforms.

Quoted 29 lines
arch/arm/mach-mmp/boards.c new file +23 -0
new file mode 100644
index 0000000..31c8e84
@@ -0,0 +1,159 @@
+/*
+ *  linux/arch/arm/mach-mmp/boards.c
+ *
+ *  Support for the Multiple Marvell Development Platforms.
+ *
+ *  Copyright (C) 2009-2011 Marvell International Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  publishhed by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/i2c/pxa-i2c.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+

arch/arm/mach-mmp/boards.c line 33

Quoted 10 lines
arch/arm/mach-mmp/boards.c new file +10 -0
+#include <mach/pxa910.h>
+#include <mach/mmp2.h>
+#include <mach/mfp-mmp2.h>
+
+#include "common.h"
+
+static struct of_device_id of_bus_ids[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{},
+};

Just use of_default_bus_match_table.

arch/arm/mach-mmp/boards.c line 37

Quoted 4 lines
arch/arm/mach-mmp/boards.c new file +4 -0
+
+static struct of_dev_auxdata ttc_dkb_auxdata_lookup[] __initdata = {
+	{}
+};

If the auxdata table is empty, then pass NULL to
of_platform_populate().

arch/arm/mach-mmp/boards.c line 43

Quoted 6 lines
arch/arm/mach-mmp/boards.c new file +6 -0
+
+static void __init ttc_dkb_init(void)
+{
+	if (of_platform_populate(NULL, of_bus_ids, ttc_dkb_auxdata_lookup,
+		NULL) < 0)
+		BUG();

I wouldn't even bother with checking the return code. If it fails, we're borked anyway.

arch/arm/mach-mmp/boards.c line 52

Quoted 9 lines
arch/arm/mach-mmp/boards.c new file +9 -0
+}
+
+static const char *ttc_dkb_dt_match[] __initdata = {
+	"mrvl,ttc-dkb",
+	NULL,
+};
+
+#ifdef CONFIG_CPU_PXA910
+MACHINE_START(TTC_DKB, "PXA910-based TTC-DKB Development Platform")

DT_MACHINE_START()

Quoted 73 lines
arch/arm/mach-mmp/boards.c new file +73 -0
+	.map_io		= mmp_map_io,
+	.init_irq	= mmp_init_intc,
+	.timer		= &pxa910_timer,
+	.init_machine	= ttc_dkb_init,
+	.dt_compat	= ttc_dkb_dt_match,
+MACHINE_END
+#endif
+
+static unsigned long brownstone_pin_config[] __initdata = {
+	/* UART1 */
+	GPIO29_UART1_RXD,
+	GPIO30_UART1_TXD,
+
+	/* UART3 */
+	GPIO51_UART3_RXD,
+	GPIO52_UART3_TXD,
+
+	/* DFI */
+	GPIO168_DFI_D0,
+	GPIO167_DFI_D1,
+	GPIO166_DFI_D2,
+	GPIO165_DFI_D3,
+	GPIO107_DFI_D4,
+	GPIO106_DFI_D5,
+	GPIO105_DFI_D6,
+	GPIO104_DFI_D7,
+	GPIO111_DFI_D8,
+	GPIO164_DFI_D9,
+	GPIO163_DFI_D10,
+	GPIO162_DFI_D11,
+	GPIO161_DFI_D12,
+	GPIO110_DFI_D13,
+	GPIO109_DFI_D14,
+	GPIO108_DFI_D15,
+	GPIO143_ND_nCS0,
+	GPIO144_ND_nCS1,
+	GPIO147_ND_nWE,
+	GPIO148_ND_nRE,
+	GPIO150_ND_ALE,
+	GPIO149_ND_CLE,
+	GPIO112_ND_RDY0,
+	GPIO160_ND_RDY1,
+
+	/* PMIC */
+	PMIC_PMIC_INT | MFP_LPM_EDGE_FALL,
+
+	/* MMC0 */
+	GPIO131_MMC1_DAT3 | MFP_PULL_HIGH,
+	GPIO132_MMC1_DAT2 | MFP_PULL_HIGH,
+	GPIO133_MMC1_DAT1 | MFP_PULL_HIGH,
+	GPIO134_MMC1_DAT0 | MFP_PULL_HIGH,
+	GPIO136_MMC1_CMD | MFP_PULL_HIGH,
+	GPIO139_MMC1_CLK,
+	GPIO140_MMC1_CD | MFP_PULL_LOW,
+	GPIO141_MMC1_WP | MFP_PULL_LOW,
+
+	/* MMC1 */
+	GPIO37_MMC2_DAT3 | MFP_PULL_HIGH,
+	GPIO38_MMC2_DAT2 | MFP_PULL_HIGH,
+	GPIO39_MMC2_DAT1 | MFP_PULL_HIGH,
+	GPIO40_MMC2_DAT0 | MFP_PULL_HIGH,
+	GPIO41_MMC2_CMD | MFP_PULL_HIGH,
+	GPIO42_MMC2_CLK,
+
+	/* MMC2 */
+	GPIO165_MMC3_DAT7 | MFP_PULL_HIGH,
+	GPIO162_MMC3_DAT6 | MFP_PULL_HIGH,
+	GPIO166_MMC3_DAT5 | MFP_PULL_HIGH,
+	GPIO163_MMC3_DAT4 | MFP_PULL_HIGH,
+	GPIO167_MMC3_DAT3 | MFP_PULL_HIGH,
+	GPIO164_MMC3_DAT2 | MFP_PULL_HIGH,
+	GPIO168_MMC3_DAT1 | MFP_PULL_HIGH,
+	GPIO111_MMC3_DAT0 | MFP_PULL_HIGH,

arch/arm/mach-mmp/boards.c line 135

Quoted 10 lines
arch/arm/mach-mmp/boards.c new file +10 -0
+	GPIO112_MMC3_CMD | MFP_PULL_HIGH,
+	GPIO151_MMC3_CLK,
+
+	/* 5V regulator */
+	GPIO89_GPIO,
+};
+
+static struct of_dev_auxdata brownstone_auxdata_lookup[] __initdata = {
+	{}
+};

Ditto here. Drop empty auxdata.

Quoted 14 lines
arch/arm/mach-mmp/boards.c new file +14 -0
+
+static void __init brownstone_init(void)
+{
+	mfp_config(ARRAY_AND_SIZE(brownstone_pin_config));
+
+	if (of_platform_populate(NULL, of_bus_ids, brownstone_auxdata_lookup,
+		NULL) < 0)
+		BUG();
+}
+
+static const char *brownstone_dt_match[] __initdata = {
+	"mrvl,mmp2-brownstone",
+	NULL,
+};

arch/arm/mach-mmp/boards.c line 159

Quoted 10 lines
arch/arm/mach-mmp/boards.c new file +10 -0
+
+#ifdef CONFIG_CPU_MMP2
+MACHINE_START(BROWNSTONE, "Brownstone Development Platform")
+	.map_io		= mmp_map_io,
+	.init_irq	= mmp_init_intc,
+	.timer		= &mmp2_timer,
+	.init_machine	= brownstone_init,
+	.dt_compat	= brownstone_dt_match,
+MACHINE_END
+#endif

Brownstone and dkb should share the same DT_MACHINE_START() section. The only difference is the pinmux setup which is eventually going to be populated from the DT, right?

g.

#23 lore raw

PATCH 2/7 ARM: mmp: append MMP_USE_OF config

In reply to Haojian Zhuang
Quoted 8 lines · Haojian Zhuang

Since NR_IRQS is defined in irqs.h, parsing irq specifier will be started from NR_IRQS while both CONFIG_USE_OF and CONFIG_SPARSE_IRQ is enabled. It breaks the assumption that base irq is started from 0.

Add CONFIG_MMP_USE_OF config to distinguish. If CONFIG_MMP_USE_OF is set, NR_IRQS is defined as 0. Otherwise, it follows the original definition.

Don't do this. It is completely valid and supported to have both DT and non-DT support in the same kernel build. This patch will break that.

Quoted 39 lines
---
 arch/arm/mach-mmp/Kconfig             |    7 +++++++
 arch/arm/mach-mmp/include/mach/irqs.h |    4 ++++
 2 files changed, 11 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/Kconfig +7 -0
index 67793a6..1efe994 100644
@@ -96,4 +96,11 @@ config CPU_MMP2
 	select CPU_PJ4
 	help
 	  Select code specific to MMP2. MMP2 is ARMv7 compatible.
+
+config MMP_USE_OF
+	bool "MMP Use OF"
+	select USE_OF
+	help
+	  Select OF code to ARCH-MMP.
+
 endif
arch/arm/mach-mmp/include/mach/irqs.h +4 -0
index a09d328..538bb69 100644
@@ -224,6 +224,10 @@
 
 #define IRQ_BOARD_START			(IRQ_GPIO_START + IRQ_GPIO_NUM)
 
+#ifdef CONFIG_MMP_USE_OF
+#define NR_IRQS				0
+#else
 #define NR_IRQS				(IRQ_BOARD_START)
+#endif
 
 #endif /* __ASM_MACH_IRQS_H */
Signature · 1 line
1.5.6.5
#24 lore raw

PATCH 1/7 ARM: mmp: parse irq from DT

In reply to Haojian Zhuang
Quoted 21 lines · Haojian Zhuang

Parse irq sepcifier from DT and translate it to Linux irq number.

---

?.../devicetree/bindings/arm/marvell/intc.txt ? ? ? | ?120 +++++++++++
?arch/arm/Kconfig ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
?arch/arm/mach-mmp/Makefile ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +
?arch/arm/mach-mmp/common.h ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +
?arch/arm/mach-mmp/intc.c ? ? ? ? ? ? ? ? ? ? ? ? ? | ?223 ++++++++++++++++++++

?5 files changed, 347 insertions(+), 0 deletions(-)
?create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt ?create mode 100644 arch/arm/mach-mmp/intc.c

Documentation/devicetree/bindings/arm/marvell/intc.txt new file +2 -0
new file mode 100644
index 0000000..e730a16
@@ -0,0 +1,120 @@
+* Interrupt Controller Binding for ARCH-MMP
+

Documentation/devicetree/bindings/arm/marvell/intc.txt line 12

Quoted 10 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +10 -0
+This binding specifies what properties must be available in device tree representation of an ARCH-MMP compliant interrupt controller.
+
+Required properties:
+
+ ? ? ? - compatible: Specifies the compatibility list of the interrupt
+ ? ? ? ? controller. The type shall be <string> and the value shall be
+ ? ? ? ? "mrvl,mmp-intc" or "mrvl,mux-intc".
+ ? ? ? ? "mrvl,mmp-intc" is the base interrupt controller. It must be
+ ? ? ? ? included. "mrvl,mux-intc" is the expanded interrupt controller,
+ ? ? ? ? and it's optional.

Please encode the soc name into the compatible property. Different SoCs get different versions of IP blocks. The compatible property is the easiest way to differentiate between them. New devices can always claim compatibility with older ones to avoid needing an exhaustive list in the device driver. Both of these should be something like "mrvl,<soc>-mmp-intc" and "mrvl,<soc>-mux-intc".

Quoted 8 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +8 -0
+
+ ? ? ? - reg: Specified the base physical address(s) and size(s) of the
+ ? ? ? ? interrupt controller's addressable register space. The type
+ ? ? ? ? should be <prop-encoded-array>.
+
+ ? ? ? - interrupt-controller: The presence of this property identifies
+ ? ? ? ? the node as interrupt controller. No property value should be
+ ? ? ? ? defined.

Documentation/devicetree/bindings/arm/marvell/intc.txt line 30

Quoted 10 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +10 -0
+
+ ? ? ? - #interrupt-cells: Specifies the number of cells needed to encode
+ ? ? ? ? an interrupt source. The type should be <u32> and the value should
+ ? ? ? ? be 1.
+
+ ? ? ? - #address-cells: Specifies the number of cells needed to encode an
+ ? ? ? ? address. The type should be <u32> and the value should be 1.
+
+ ? ? ? - #size-cells: Specifies the number of cells need to encode an
+ ? ? ? ? size. The type should be <u32> and the value should be 1.

This is not a bus node. It should not have #address-cells or #size-cells.

Documentation/devicetree/bindings/arm/marvell/intc.txt

Quoted 11 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +9 -0
+
+ ? ? ? - intc-numbers: Specifies the number of interrupts is supported in
+ ? ? ? ? this interrupt controller. The type should be <u32>.
 
 
+
+Optional properties:
+
+ ? ? ? - intc-enable-mask: Specifies the masking value of interrupt
+ ? ? ? ? configuration register. The property is used in mmp-intc. The value
+ ? ? ? ? should be <u32>.

What is the purpose of having a mask register? I would expect that unused interrupts simply wouldn't be requested by any devices.

Documentation/devicetree/bindings/arm/marvell/intc.txt

Quoted 13 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +13 -0
+
+ ? ? ? - intc-status: Specifies the offset of status register. The property
+ ? ? ? ? is used in mux-intc. The type should be <u32>.
+
+ ? ? ? - intc-mask: Specifies the offset of mask register. The property
+ ? ? ? ? is used in mux-intc. The type should be <u32>.
+
+ ? ? ? - intc-mfp-edge: Specifies the address of mfp edge detection register.
+ ? ? ? ? The property is used while acking specified interrupt. The type
+ ? ? ? ? should be <prop-encoded-array>. The first cell indicates the address
+ ? ? ? ? of mfp edge detection register. The second cell indicates the
+ ? ? ? ? index of interrupt in current interrupt controller that should
+ ? ? ? ? handle mfp edge detection.

Use a "mrvl," prefix on the above non-standard properties. Since the 4 properties above are all register offsets, the name should reflect that. Something like "mrvl,status-reg-offset"

Do the register offsets change with difference versions of the silicon?

Quoted 88 lines
Documentation/devicetree/bindings/arm/marvell/intc.txt new file +68 -0
+
+* Examples
+
+Example 1:
+
+ ? ? ? /*
+ ? ? ? ?* base INTC
+ ? ? ? ?*/
+ ? ? ? mmp_intc: interrupt-controller at d4282000 {
+ ? ? ? ? ? ? ? /* Compatible with mmp-intc. */
+ ? ? ? ? ? ? ? compatible = "mrvl,mmp-intc";
+ ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? /* Offset address of 0xd4282000 and size of 0x400. */
+ ? ? ? ? ? ? ? reg = <0xd4282000 0x400>;
+
+ ? ? ? ? ? ? ? #interrupt-cells = <1>;
+ ? ? ? ? ? ? ? interrupt-controller;
+
+ ? ? ? ? ? ? ? /* 64 interrupts are supported in this INTC. */
+ ? ? ? ? ? ? ? intc-numbers = <64>;
+
+ ? ? ? ? ? ? ? /* enable bits in configuration register */
+ ? ? ? ? ? ? ? intc-enable-mask = <0x20>;
+ ? ? ? };
+
+Example 2:
+
+ ? ? ? /*
+ ? ? ? ?* mux INTC that is internal wired to base INTC
+ ? ? ? ?*/
+ ? ? ? mux_intc4: interrupt-controller at d4282150 {
+ ? ? ? ? ? ? ? compatible = "mrvl,mux-intc";
+ ? ? ? ? ? ? ? #address-cells = <1>;
+ ? ? ? ? ? ? ? #size-cells = <1>;
+ ? ? ? ? ? ? ? reg = <0xd4282000 0x400>;
+
+ ? ? ? ? ? ? ? #interrupt-cells = <1>;
+ ? ? ? ? ? ? ? interrupt-controller;
+ ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+
+ ? ? ? ? ? ? ? /* interrupt source '4' of parent INTC. */
+ ? ? ? ? ? ? ? interrupts = <4>;
+
+ ? ? ? ? ? ? ? /* 2 interrupts are supported in this INTC. */
+ ? ? ? ? ? ? ? intc-numbers = <2>;
+
+ ? ? ? ? ? ? ? /* Status offset address of 0x150. */
+ ? ? ? ? ? ? ? intc-status = <0x150>;
+
+ ? ? ? ? ? ? ? /* Mask offset address of 0x168. */
+ ? ? ? ? ? ? ? intc-mask = <0x168>;
+
+ ? ? ? ? ? ? ? /* mfp register of 0xd401e2c4 & interrupt index of 1 */
+ ? ? ? ? ? ? ? intc-mfp-edge = <0xd401e2c4 1>;
+ ? ? ? };
+
+Example 3:
+ ? ? ? /*
+ ? ? ? ?* An interrupt generating device that is wired to an INTC.
+ ? ? ? ?*/
+ ? ? ? uart0: uart at d4030000 {
+ ? ? ? ? ? ? ? /* parent's '#interrupt-cells' property. */
+ ? ? ? ? ? ? ? interrupts = <27>;
+
+ ? ? ? ? ? ? ? /* The INTC that this device is wired to. */
+ ? ? ? ? ? ? ? interrupt-parent = <&mmp_intc>;
+ ? ? ? };
arch/arm/Kconfig +0 -0
index 17507b8..f18eb14 100644
@@ -542,6 +542,7 @@ config ARCH_MMP

? ? ? ?select ARCH_REQUIRE_GPIOLIB
? ? ? ?select CLKDEV_LOOKUP
? ? ? ?select GENERIC_CLOCKEVENTS
+ ? ? ? select GENERIC_IRQ_CHIP
? ? ? ?select HAVE_SCHED_CLOCK
? ? ? ?select TICK_ONESHOT
? ? ? ?select PLAT_PXA

arch/arm/mach-mmp/Makefile +0 -0
index 5c68382..e7862ea 100644
@@ -4,6 +4,8 @@
 

?obj-y ? ? ? ? ? ? ? ? ? ? ? ? ?+= common.o clock.o devices.o time.o

arch/arm/mach-mmp/Makefile

Quoted 2 lines
arch/arm/mach-mmp/Makefile +2 -0
+obj-$(CONFIG_OF_IRQ) ? ? ? ? ? += intc.o
+

Do drivers already exist for the pxa interrupt controllers? I would expect the existing driver to be updated to include DT support instead of writing an entirely new IRQ controller driver.

g.

#25 lore raw

cover support DT on ARCH-MMP

In reply to Haojian Zhuang

Hi Haojian,

Quoted 30 lines · Haojian Zhuang

It's used to support DT on ARCH-MMP.

Haojian Zhuang (7):
ARM: mmp: parse irq from DT
ARM: mmp: append MMP_USE_OF config
ARM: mmp: support DT on both dkb and brownstone
tty: serial: support device tree in pxa
tty: serial: check ops before registering console
i2c: pxa: support i2c controller from DT
i2c: pxa: support to parse property

 .../devicetree/bindings/arm/marvell/boards.txt     |    7 +
 .../devicetree/bindings/arm/marvell/intc.txt       |  120 ++++++++++
 .../devicetree/bindings/i2c/pxa255-i2c.txt         |   36 +++
 arch/arm/Kconfig                                   |    1 +
 arch/arm/boot/dts/mmp2-brownstone.dts              |  242 ++++++++++++++++++++
 arch/arm/boot/dts/ttc-dkb.dts                      |   80 +++++++
 arch/arm/mach-mmp/Kconfig                          |    7 +
 arch/arm/mach-mmp/Makefile                         |    6 +
 arch/arm/mach-mmp/boards.c                         |  159 +++++++++++++
 arch/arm/mach-mmp/common.h                         |    1 +
 arch/arm/mach-mmp/include/mach/irqs.h              |    4 +
 arch/arm/mach-mmp/intc.c                           |  223 ++++++++++++++++++
 drivers/i2c/busses/i2c-pxa.c                       |   78 +++++--
 drivers/tty/serial/Kconfig                         |    4 +-
 drivers/tty/serial/of_serial.c                     |   12 +
 drivers/tty/serial/pxa.c                           |   95 ++++++++-
 include/linux/serial_pxa.h                         |   17 ++
 17 files changed, 1065 insertions(+), 27 deletions(-)
Quoted 8 lines
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
 create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
 create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
 create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
 create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
 create mode 100644 arch/arm/mach-mmp/boards.c
 create mode 100644 arch/arm/mach-mmp/intc.c
 create mode 100644 include/linux/serial_pxa.h

I am not involved in this in any way so please don't include me in the Cc list.

Thanks,

Signature · 1 line
Jean Delvare