* [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
nico-vtqb6HGKxmzR7s880joybQ, alan-VuQAYsv1563Yd54FQh9/CA,
eric.y.miao
Cc: 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.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
.../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
diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
new file mode 100644
index 0000000..219e134
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
@@ -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";
diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
new file mode 100644
index 0000000..4e14388
--- /dev/null
+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
@@ -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;
+ };
+
+ soc@d4000000 {
+ compatible = "mrvl,mmp2", "mrvl,armada610", "simple-bus";
+ device_type = "soc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+
+ mmp_intc: interrupt-controller@d4282000 {
+ compatible = "mrvl,mmp-intc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ /* 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@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>;
+ intc-status = <0x150>;
+ intc-mask = <0x168>;
+ /* mfp register & interrupt index */
+ intc-mfp-edge = <0xd401e2c4 1>;
+ };
+
+ mux_intc5: interrupt-controller@d4282154 {
+ compatible = "mrvl,mux-intc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ 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@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@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@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@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@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@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@d4031000 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4031000 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <0>;
+ interrupt-parent = <&mux_intc17>;
+ };
+
+ i2c2: i2c@d4032000 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4032000 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <1>;
+ interrupt-parent = <&mux_intc17>;
+ };
+
+ i2c3: i2c@d4033000 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4033000 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <2>;
+ interrupt-parent = <&mux_intc17>;
+ };
+
+ i2c4: i2c@d4033800 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4033800 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <3>;
+ interrupt-parent = <&mux_intc17>;
+ };
+
+ i2c5: i2c@d4034000 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4034000 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <4>;
+ interrupt-parent = <&mux_intc17>;
+ };
+
+ uart0: uart@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@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@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@d4016000 {
+ compatible = "mrvl,pxa270-serial";
+ reg = <0xd4016000 0x1000>;
+ reg-shift = <2>;
+ interrupts = <46>;
+ interrupt-parent = <&mmp_intc>;
+ clock-frequency = <26000000>;
+ current-speed = <115200>;
+ };
+ };
+};
diff --git a/arch/arm/boot/dts/ttc-dkb.dts b/arch/arm/boot/dts/ttc-dkb.dts
new file mode 100644
index 0000000..ff8df4f
--- /dev/null
+++ b/arch/arm/boot/dts/ttc-dkb.dts
@@ -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";
+ linux,stdout-path = &uart0;
+ };
+
+ soc@d4000000 {
+ compatible = "mrvl,pxa910", "simple-bus";
+ device_type = "soc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0xd4000000 0xd4000000 0x00200000 /* APB */
+ 0xd4200000 0xd4200000 0x00200000>; /* AXI */
+
+ mmp_intc: interrupt-controller@d4282000 {
+ compatible = "mrvl,mmp-intc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ /* 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@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@d4037000 {
+ compatible = "mrvl,pxa255-i2c";
+ reg = <0xd4037000 0x60>;
+ i2c-polling = <0>;
+ i2c-frequency = "fast";
+ interrupts = <54>;
+ interrupt-parent = <&mmp_intc>;
+ };
+
+ uart0: uart@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@d4018000 {
+ compatible = "mrvl,pxa270-serial";
+ reg = <0xd4018000 0x1000>;
+ reg-shift = <2>;
+ interrupts = <28>;
+ interrupt-parent = <&mmp_intc>;
+ clock-frequency = <14745600>;
+ current-speed = <115200>;
+ };
+ };
+};
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index e7862ea..6c39bbd 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -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
diff --git a/arch/arm/mach-mmp/boards.c b/arch/arm/mach-mmp/boards.c
new file mode 100644
index 0000000..31c8e84
--- /dev/null
+++ b/arch/arm/mach-mmp/boards.c
@@ -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
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: linux-arm-kernel
Support both normal platform driver and device tree driver in serial pxa.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
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
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 636144c..3f75e0d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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.
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index e65f1e8..83e07fb 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -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 */ },
};
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 4302e6e..8f4d538 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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;
diff --git a/include/linux/serial_pxa.h b/include/linux/serial_pxa.h
new file mode 100644
index 0000000..565e510
--- /dev/null
+++ b/include/linux/serial_pxa.h
@@ -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
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
nico-vtqb6HGKxmzR7s880joybQ, alan-VuQAYsv1563Yd54FQh9/CA,
eric.y.miao
Cc: Haojian Zhuang
Support both normal platform driver and device tree driver in serial pxa.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
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
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 636144c..3f75e0d 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -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.
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index e65f1e8..83e07fb 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -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 */ },
};
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 4302e6e..8f4d538 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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;
diff --git a/include/linux/serial_pxa.h b/include/linux/serial_pxa.h
new file mode 100644
index 0000000..565e510
--- /dev/null
+++ b/include/linux/serial_pxa.h
@@ -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
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 5/7] tty: serial: check ops before registering console
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: linux-arm-kernel
Console should be only registered after port->ops assigned. If uart console
doesn't match the current uart, port->ops keeps NULL.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/tty/serial/pxa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 8f4d538..2d8e7d0 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH 5/7] tty: serial: check ops before registering console
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
nico-vtqb6HGKxmzR7s880joybQ, alan-VuQAYsv1563Yd54FQh9/CA,
eric.y.miao
Cc: Haojian Zhuang
Console should be only registered after port->ops assigned. If uart console
doesn't match the current uart, port->ops keeps NULL.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
drivers/tty/serial/pxa.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 8f4d538..2d8e7d0 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -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)
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH 6/7] i2c: pxa: support i2c controller from DT
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: linux-arm-kernel
support i2c-pxa controller from DT.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
drivers/i2c/busses/i2c-pxa.c | 58 ++++++++++++++++++++++++++++++-----------
1 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index d603646..adac74a 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -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,
};
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 6/7] i2c: pxa: support i2c controller from DT
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
nico-vtqb6HGKxmzR7s880joybQ, alan-VuQAYsv1563Yd54FQh9/CA,
eric.y.miao
Cc: Haojian Zhuang
support i2c-pxa controller from DT.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
drivers/i2c/busses/i2c-pxa.c | 58 ++++++++++++++++++++++++++++++-----------
1 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index d603646..adac74a 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -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,
};
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
.../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
diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
new file mode 100644
index 0000000..bf34236
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
@@ -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>;
+ };
+ };
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index adac74a..4b9fa71 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -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 {
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 2:24 ` Haojian Zhuang
0 siblings, 0 replies; 50+ messages in thread
From: Haojian Zhuang @ 2011-07-19 2:24 UTC (permalink / raw)
To: haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
nico-vtqb6HGKxmzR7s880joybQ, alan-VuQAYsv1563Yd54FQh9/CA,
eric.y.miao
Cc: 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.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
.../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
diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
new file mode 100644
index 0000000..bf34236
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
@@ -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@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@34 {
+ interrupt-controller;
+ /* interrupt of pm860x */
+ interrupts = <4>;
+ interrupt-parent = <&mmp_intc>;
+ };
+ };
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index adac74a..4b9fa71 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -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 {
--
1.5.6.5
^ permalink raw reply related [flat|nested] 50+ messages in thread* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 10:17 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-19 10:17 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 10:24 AM, Haojian Zhuang
<haojian.zhuang@marvell.com> wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> ?.../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
>
> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> new file mode 100644
> index 0000000..bf34236
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> @@ -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>;
> + ? ? ? ? ? ? ? };
> + ? ? ? };
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index adac74a..4b9fa71 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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;
> + ? ? ? ? ? ? ? }
> +
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?
> ? ? ? ? ? ? ? ?/*
> ? ? ? ? ? ? ? ? * 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 {
> --
> 1.5.6.5
>
>
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 10:17 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-19 10:17 UTC (permalink / raw)
To: Haojian Zhuang
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 10:24 AM, Haojian Zhuang
<haojian.zhuang@marvell.com> wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> new file mode 100644
> index 0000000..bf34236
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> @@ -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@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@34 {
> + interrupt-controller;
> + /* interrupt of pm860x */
> + interrupts = <4>;
> + interrupt-parent = <&mmp_intc>;
> + };
> + };
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index adac74a..4b9fa71 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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;
> + }
> +
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?
> /*
> * 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 {
> --
> 1.5.6.5
>
>
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 50+ messages in thread* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 19:47 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:47 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 06:17:21PM +0800, Eric Miao wrote:
> On Tue, Jul 19, 2011 at 10:24 AM, Haojian Zhuang
> <haojian.zhuang@marvell.com> wrote:
> > 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.
> >
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> > ---
> > ?.../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
> >
> > diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> > new file mode 100644
> > index 0000000..bf34236
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> > @@ -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>;
> > + ? ? ? ? ? ? ? };
> > + ? ? ? };
> > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> > index adac74a..4b9fa71 100644
> > --- a/drivers/i2c/busses/i2c-pxa.c
> > +++ b/drivers/i2c/busses/i2c-pxa.c
> > @@ -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;
> > + ? ? ? ? ? ? ? }
> > +
>
> 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.
>
> Grant, any idea on this?
>
> > ? ? ? ? ? ? ? ?/*
> > ? ? ? ? ? ? ? ? * 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 {
> > --
> > 1.5.6.5
> >
> >
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 19:47 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:47 UTC (permalink / raw)
To: Eric Miao
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 06:17:21PM +0800, Eric Miao wrote:
> On Tue, Jul 19, 2011 at 10:24 AM, Haojian Zhuang
> <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> wrote:
> > 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.
> >
> > Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> > ---
> > .../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
> >
> > diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> > new file mode 100644
> > index 0000000..bf34236
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> > @@ -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@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@34 {
> > + interrupt-controller;
> > + /* interrupt of pm860x */
> > + interrupts = <4>;
> > + interrupt-parent = <&mmp_intc>;
> > + };
> > + };
> > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> > index adac74a..4b9fa71 100644
> > --- a/drivers/i2c/busses/i2c-pxa.c
> > +++ b/drivers/i2c/busses/i2c-pxa.c
> > @@ -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;
> > + }
> > +
>
> 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.
>
> Grant, any idea on this?
>
> > /*
> > * 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 {
> > --
> > 1.5.6.5
> >
> >
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 19:45 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:45 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 10:24:50AM +0800, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> new file mode 100644
> index 0000000..bf34236
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> @@ -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?
> +
> + - 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.
> +
> +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>;
> + };
> + };
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index adac74a..4b9fa71 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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 {
> --
> 1.5.6.5
>
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-19 19:45 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:45 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 10:24:50AM +0800, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> new file mode 100644
> index 0000000..bf34236
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> @@ -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?
> +
> + - 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.
> +
> +Example:
> + i2c0: i2c@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@34 {
> + interrupt-controller;
> + /* interrupt of pm860x */
> + interrupts = <4>;
> + interrupt-parent = <&mmp_intc>;
> + };
> + };
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index adac74a..4b9fa71 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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 {
> --
> 1.5.6.5
>
^ permalink raw reply [flat|nested] 50+ messages in thread* [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-20 1:22 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-20 1:22 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jul 20, 2011 at 3:45 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Tue, Jul 19, 2011 at 10:24:50AM +0800, Haojian Zhuang wrote:
>> 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.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> ---
>> ?.../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
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> new file mode 100644
>> index 0000000..bf34236
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> @@ -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?
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.
>
>> +
>> + ? ? - 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.
>
>> +
>> +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>;
>> + ? ? ? ? ? ? };
>> + ? ? };
>> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
>> index adac74a..4b9fa71 100644
>> --- a/drivers/i2c/busses/i2c-pxa.c
>> +++ b/drivers/i2c/busses/i2c-pxa.c
>> @@ -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 {
>> --
>> 1.5.6.5
>>
>
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 7/7] i2c: pxa: support to parse property
@ 2011-07-20 1:22 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-20 1:22 UTC (permalink / raw)
To: Grant Likely
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Wed, Jul 20, 2011 at 3:45 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Tue, Jul 19, 2011 at 10:24:50AM +0800, Haojian Zhuang wrote:
>> 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.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> ---
>> .../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
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> new file mode 100644
>> index 0000000..bf34236
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
>> @@ -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?
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.
>
>> +
>> + - 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.
>
>> +
>> +Example:
>> + i2c0: i2c@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@34 {
>> + interrupt-controller;
>> + /* interrupt of pm860x */
>> + interrupts = <4>;
>> + interrupt-parent = <&mmp_intc>;
>> + };
>> + };
>> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
>> index adac74a..4b9fa71 100644
>> --- a/drivers/i2c/busses/i2c-pxa.c
>> +++ b/drivers/i2c/busses/i2c-pxa.c
>> @@ -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 {
>> --
>> 1.5.6.5
>>
>
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 6/7] i2c: pxa: support i2c controller from DT
@ 2011-07-19 19:43 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:43 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 10:24:49AM +0800, Haojian Zhuang wrote:
> support i2c-pxa controller from DT.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> drivers/i2c/busses/i2c-pxa.c | 58 ++++++++++++++++++++++++++++++-----------
> 1 files changed, 42 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index d603646..adac74a 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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++;
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).
> + 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
> + 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);
The hunk can be dropped.
> 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,
> };
> --
> 1.5.6.5
>
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 6/7] i2c: pxa: support i2c controller from DT
@ 2011-07-19 19:43 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:43 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 10:24:49AM +0800, Haojian Zhuang wrote:
> support i2c-pxa controller from DT.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-pxa.c | 58 ++++++++++++++++++++++++++++++-----------
> 1 files changed, 42 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index d603646..adac74a 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -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++;
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).
> + 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
> + 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);
The hunk can be dropped.
> 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,
> };
> --
> 1.5.6.5
>
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 19:40 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:40 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> Support both normal platform driver and device tree driver in serial pxa.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> 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.
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 636144c..3f75e0d 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -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.
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
> index e65f1e8..83e07fb 100644
> --- a/drivers/tty/serial/of_serial.c
> +++ b/drivers/tty/serial/of_serial.c
> @@ -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 */ },
> };
> diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
> index 4302e6e..8f4d538 100644
> --- a/drivers/tty/serial/pxa.c
> +++ b/drivers/tty/serial/pxa.c
> @@ -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;
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 19:40 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:40 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> Support both normal platform driver and device tree driver in serial pxa.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> 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.
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 636144c..3f75e0d 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -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.
> diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
> index e65f1e8..83e07fb 100644
> --- a/drivers/tty/serial/of_serial.c
> +++ b/drivers/tty/serial/of_serial.c
> @@ -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 */ },
> };
> diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
> index 4302e6e..8f4d538 100644
> --- a/drivers/tty/serial/pxa.c
> +++ b/drivers/tty/serial/pxa.c
> @@ -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;
^ permalink raw reply [flat|nested] 50+ messages in thread* [PATCH 4/7] tty: serial: support device tree in pxa
2011-07-19 19:40 ` Grant Likely
@ 2011-07-19 19:48 ` Arnd Bergmann
-1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2011-07-19 19:48 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> > Support both normal platform driver and device tree driver in serial pxa.
> >
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> > ---
> > 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.
Right. We should probably rename of_serial to 8250_of and remove the qpace
parts from the driver.
Arnd
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 19:48 ` Arnd Bergmann
0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2011-07-19 19:48 UTC (permalink / raw)
To: linux-arm-kernel
Cc: eric.y.miao, nico, devicetree-discuss, Haojian Zhuang,
haojian.zhuang, Grant Likely, ben-linux, khali, linux, alan
On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> > Support both normal platform driver and device tree driver in serial pxa.
> >
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> > ---
> > 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.
Right. We should probably rename of_serial to 8250_of and remove the qpace
parts from the driver.
Arnd
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
2011-07-19 19:48 ` Arnd Bergmann
@ 2011-07-19 19:53 ` Grant Likely
-1 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:53 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
>> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
>> > Support both normal platform driver and device tree driver in serial pxa.
>> >
>> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> > ---
>> > ?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.
>
> 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.
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 19:53 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:53 UTC (permalink / raw)
To: Arnd Bergmann
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
>> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
>> > Support both normal platform driver and device tree driver in serial pxa.
>> >
>> > Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
>> > ---
>> > 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.
>
> 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.
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 20:05 ` Russell King - ARM Linux
0 siblings, 0 replies; 50+ messages in thread
From: Russell King - ARM Linux @ 2011-07-19 20:05 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
> On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
> >> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> >> > Support both normal platform driver and device tree driver in serial pxa.
> >> >
> >> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> >> > ---
> >> > ?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.
> >
> > 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.
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 20:05 ` Russell King - ARM Linux
0 siblings, 0 replies; 50+ messages in thread
From: Russell King - ARM Linux @ 2011-07-19 20:05 UTC (permalink / raw)
To: Grant Likely
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
> On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> > On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
> >> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
> >> > Support both normal platform driver and device tree driver in serial pxa.
> >> >
> >> > Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> >> > ---
> >> > 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.
> >
> > 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.
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
2011-07-19 20:05 ` Russell King - ARM Linux
@ 2011-07-19 20:17 ` Arnd Bergmann
-1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2011-07-19 20:17 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 19 July 2011 21:05:15 Russell King - ARM Linux wrote:
> On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
> > On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > > 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.
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
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-19 20:17 ` Arnd Bergmann
0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2011-07-19 20:17 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: eric.y.miao, nico, devicetree-discuss, Haojian Zhuang,
haojian.zhuang, Grant Likely, ben-linux, khali, linux-arm-kernel,
alan
On Tuesday 19 July 2011 21:05:15 Russell King - ARM Linux wrote:
> On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
> > On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> > > 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.
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
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-20 1:26 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-20 1:26 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Jul 20, 2011 at 4:05 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
>> On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
>> >> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
>> >> > Support both normal platform driver and device tree driver in serial pxa.
>> >> >
>> >> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> >> > ---
>> >> > ?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.
>> >
>> > 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.
>
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?
^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
@ 2011-07-20 1:26 ` Eric Miao
0 siblings, 0 replies; 50+ messages in thread
From: Eric Miao @ 2011-07-20 1:26 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Wed, Jul 20, 2011 at 4:05 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Jul 19, 2011 at 01:53:53PM -0600, Grant Likely wrote:
>> On Tue, Jul 19, 2011 at 1:48 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> > On Tuesday 19 July 2011 13:40:10 Grant Likely wrote:
>> >> On Tue, Jul 19, 2011 at 10:24:47AM +0800, Haojian Zhuang wrote:
>> >> > Support both normal platform driver and device tree driver in serial pxa.
>> >> >
>> >> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> >> > ---
>> >> > 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.
>> >
>> > 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.
>
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?
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 13:42 ` Mitch Bradley
0 siblings, 0 replies; 50+ messages in thread
From: Mitch Bradley @ 2011-07-19 13:42 UTC (permalink / raw)
To: linux-arm-kernel
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
On 7/19/2011 10:24 AM, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang<haojian.zhuang@marvell.com>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> new file mode 100644
> index 0000000..219e134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> @@ -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";
> diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> new file mode 100644
> index 0000000..4e14388
> --- /dev/null
> +++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> @@ -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;
> + };
> +
> + 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?
> + #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.
> +
> + 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.
> + /* 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>;
> + 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.
> + 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>;
> + };
> + };
> +};
> diff --git a/arch/arm/boot/dts/ttc-dkb.dts b/arch/arm/boot/dts/ttc-dkb.dts
> new file mode 100644
> index 0000000..ff8df4f
> --- /dev/null
> +++ b/arch/arm/boot/dts/ttc-dkb.dts
> @@ -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";
> + 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.
> +
> + 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.
> + /* 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>;
> + };
> + };
> +};
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index e7862ea..6c39bbd 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -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
> diff --git a/arch/arm/mach-mmp/boards.c b/arch/arm/mach-mmp/boards.c
> new file mode 100644
> index 0000000..31c8e84
> --- /dev/null
> +++ b/arch/arm/mach-mmp/boards.c
> @@ -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
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 13:42 ` Mitch Bradley
0 siblings, 0 replies; 50+ messages in thread
From: Mitch Bradley @ 2011-07-19 13:42 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
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
On 7/19/2011 10:24 AM, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang<haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> .../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
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> new file mode 100644
> index 0000000..219e134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> @@ -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";
> diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> new file mode 100644
> index 0000000..4e14388
> --- /dev/null
> +++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> @@ -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;
> + };
> +
> + soc@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?
> + #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.
> +
> + mmp_intc: interrupt-controller@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.
> + /* 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@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>;
> + intc-status =<0x150>;
> + intc-mask =<0x168>;
> + /* mfp register& interrupt index */
> + intc-mfp-edge =<0xd401e2c4 1>;
> + };
> +
> + mux_intc5: interrupt-controller@d4282154 {
> + compatible = "mrvl,mux-intc";
> + #address-cells =<1>;
> + #size-cells =<1>;
Should not have #address-cells and #size-cells, as previously explained.
> + 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@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@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@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@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@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@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@d4031000 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4031000 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<0>;
> + interrupt-parent =<&mux_intc17>;
> + };
> +
> + i2c2: i2c@d4032000 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4032000 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<1>;
> + interrupt-parent =<&mux_intc17>;
> + };
> +
> + i2c3: i2c@d4033000 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4033000 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<2>;
> + interrupt-parent =<&mux_intc17>;
> + };
> +
> + i2c4: i2c@d4033800 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4033800 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<3>;
> + interrupt-parent =<&mux_intc17>;
> + };
> +
> + i2c5: i2c@d4034000 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4034000 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<4>;
> + interrupt-parent =<&mux_intc17>;
> + };
> +
> + uart0: uart@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@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@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@d4016000 {
> + compatible = "mrvl,pxa270-serial";
> + reg =<0xd4016000 0x1000>;
> + reg-shift =<2>;
> + interrupts =<46>;
> + interrupt-parent =<&mmp_intc>;
> + clock-frequency =<26000000>;
> + current-speed =<115200>;
> + };
> + };
> +};
> diff --git a/arch/arm/boot/dts/ttc-dkb.dts b/arch/arm/boot/dts/ttc-dkb.dts
> new file mode 100644
> index 0000000..ff8df4f
> --- /dev/null
> +++ b/arch/arm/boot/dts/ttc-dkb.dts
> @@ -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";
> + linux,stdout-path =&uart0;
> + };
> +
> + soc@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@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@1,82000
reg = <1 0x82000 0x400>;
with similar address modifications for other children.
> +
> + mmp_intc: interrupt-controller@d4282000 {
> + compatible = "mrvl,mmp-intc";
> + #address-cells =<1>;
> + #size-cells =<1>;
Should not have #address-cells and #size-cells, as previously explained.
> + /* 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@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@d4037000 {
> + compatible = "mrvl,pxa255-i2c";
> + reg =<0xd4037000 0x60>;
> + i2c-polling =<0>;
> + i2c-frequency = "fast";
> + interrupts =<54>;
> + interrupt-parent =<&mmp_intc>;
> + };
> +
> + uart0: uart@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@d4018000 {
> + compatible = "mrvl,pxa270-serial";
> + reg =<0xd4018000 0x1000>;
> + reg-shift =<2>;
> + interrupts =<28>;
> + interrupt-parent =<&mmp_intc>;
> + clock-frequency =<14745600>;
> + current-speed =<115200>;
> + };
> + };
> +};
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index e7862ea..6c39bbd 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -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
> diff --git a/arch/arm/mach-mmp/boards.c b/arch/arm/mach-mmp/boards.c
> new file mode 100644
> index 0000000..31c8e84
> --- /dev/null
> +++ b/arch/arm/mach-mmp/boards.c
> @@ -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
^ permalink raw reply [flat|nested] 50+ messages in thread* [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 19:49 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:49 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 09:42:32PM +0800, Mitch Bradley wrote:
> 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
>
> On 7/19/2011 10:24 AM, Haojian Zhuang wrote:
> >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.
> >
> >Signed-off-by: Haojian Zhuang<haojian.zhuang@marvell.com>
> >---
> > .../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
> >
> >diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> >new file mode 100644
> >index 0000000..219e134
> >--- /dev/null
> >+++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> >@@ -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";
> >diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> >new file mode 100644
> >index 0000000..4e14388
> >--- /dev/null
> >+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> >@@ -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;
> >+ };
> >+
> >+ 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.
>
> >+ #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.
>
> >+
> >+ 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
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 19:49 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:49 UTC (permalink / raw)
To: Mitch Bradley
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Haojian Zhuang,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 09:42:32PM +0800, Mitch Bradley wrote:
> 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
>
> On 7/19/2011 10:24 AM, Haojian Zhuang wrote:
> >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.
> >
> >Signed-off-by: Haojian Zhuang<haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> >---
> > .../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
> >
> >diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> >new file mode 100644
> >index 0000000..219e134
> >--- /dev/null
> >+++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> >@@ -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";
> >diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> >new file mode 100644
> >index 0000000..4e14388
> >--- /dev/null
> >+++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> >@@ -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;
> >+ };
> >+
> >+ soc@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.
>
> >+ #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.
>
> >+
> >+ mmp_intc: interrupt-controller@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
^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 19:36 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:36 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jul 19, 2011 at 10:24:46AM +0800, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> .../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.
> 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
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> new file mode 100644
> index 0000000..219e134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> @@ -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.
> diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> new file mode 100644
> index 0000000..4e14388
> --- /dev/null
> +++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> @@ -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.
> +
> + 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
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index e7862ea..6c39bbd 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -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
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.
> diff --git a/arch/arm/mach-mmp/boards.c b/arch/arm/mach-mmp/boards.c
> new file mode 100644
> index 0000000..31c8e84
> --- /dev/null
> +++ b/arch/arm/mach-mmp/boards.c
> @@ -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", },
> + {},
> +};
Just use of_default_bus_match_table.
> +
> +static struct of_dev_auxdata ttc_dkb_auxdata_lookup[] __initdata = {
> + {}
> +};
If the auxdata table is empty, then pass NULL to
of_platform_populate().
> +
> +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.
> +}
> +
> +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()
> + .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 = {
> + {}
> +};
Ditto here. Drop empty auxdata.
> +
> +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
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.
^ permalink raw reply [flat|nested] 50+ messages in thread* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
@ 2011-07-19 19:36 ` Grant Likely
0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2011-07-19 19:36 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
ben-linux-elnMNo+KYs3YtjvyW6yDsg, khali-PUYAD+kWke1g9hUCZPvPmw,
linux-lFZ/pmaqli7XmaaqVzeoHQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA
On Tue, Jul 19, 2011 at 10:24:46AM +0800, Haojian Zhuang wrote:
> 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.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> .../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.
> 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
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell/boards.txt b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> new file mode 100644
> index 0000000..219e134
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell/boards.txt
> @@ -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.
> diff --git a/arch/arm/boot/dts/mmp2-brownstone.dts b/arch/arm/boot/dts/mmp2-brownstone.dts
> new file mode 100644
> index 0000000..4e14388
> --- /dev/null
> +++ b/arch/arm/boot/dts/mmp2-brownstone.dts
> @@ -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.
> +
> + 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@d4000000 {
> + compatible = "mrvl,mmp2", "mrvl,armada610", "simple-bus";
> + device_type = "soc";
Drop device_type
> + #address-cells = <1>;
> + #size-cells = <1>;
> + ranges;
> +
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index e7862ea..6c39bbd 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -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
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.
> diff --git a/arch/arm/mach-mmp/boards.c b/arch/arm/mach-mmp/boards.c
> new file mode 100644
> index 0000000..31c8e84
> --- /dev/null
> +++ b/arch/arm/mach-mmp/boards.c
> @@ -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", },
> + {},
> +};
Just use of_default_bus_match_table.
> +
> +static struct of_dev_auxdata ttc_dkb_auxdata_lookup[] __initdata = {
> + {}
> +};
If the auxdata table is empty, then pass NULL to
of_platform_populate().
> +
> +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.
> +}
> +
> +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()
> + .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 = {
> + {}
> +};
Ditto here. Drop empty auxdata.
> +
> +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
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.
^ permalink raw reply [flat|nested] 50+ messages in thread