* [PATCH 0/7] support DT on ARCH-MMP
[not found] <2011071901>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 7:12 ` [PATCH 0/7] support DT on ARCH-MMP Jean Delvare
0 siblings, 2 replies; 25+ 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
It's used to support DT on ARCH-MMP.
Haojian Zhuang (7):
ARM: mmp: parse irq from DT
ARM: mmp: append MMP_USE_OF config
ARM: mmp: support DT on both dkb and brownstone
tty: serial: support device tree in pxa
tty: serial: check ops before registering console
i2c: pxa: support i2c controller from DT
i2c: pxa: support to parse property
.../devicetree/bindings/arm/marvell/boards.txt | 7 +
.../devicetree/bindings/arm/marvell/intc.txt | 120 ++++++++++
.../devicetree/bindings/i2c/pxa255-i2c.txt | 36 +++
arch/arm/Kconfig | 1 +
arch/arm/boot/dts/mmp2-brownstone.dts | 242 ++++++++++++++++++++
arch/arm/boot/dts/ttc-dkb.dts | 80 +++++++
arch/arm/mach-mmp/Kconfig | 7 +
arch/arm/mach-mmp/Makefile | 6 +
arch/arm/mach-mmp/boards.c | 159 +++++++++++++
arch/arm/mach-mmp/common.h | 1 +
arch/arm/mach-mmp/include/mach/irqs.h | 4 +
arch/arm/mach-mmp/intc.c | 223 ++++++++++++++++++
drivers/i2c/busses/i2c-pxa.c | 78 +++++--
drivers/tty/serial/Kconfig | 4 +-
drivers/tty/serial/of_serial.c | 12 +
drivers/tty/serial/pxa.c | 95 ++++++++-
include/linux/serial_pxa.h | 17 ++
17 files changed, 1065 insertions(+), 27 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
create mode 100644 arch/arm/mach-mmp/boards.c
create mode 100644 arch/arm/mach-mmp/intc.c
create mode 100644 include/linux/serial_pxa.h
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 1/7] ARM: mmp: parse irq from DT
[not found] ` <1311042290-20253-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 25+ 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
Parse irq sepcifier from DT and translate it to Linux irq number.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
.../devicetree/bindings/arm/marvell/intc.txt | 120 +++++++++++
arch/arm/Kconfig | 1 +
arch/arm/mach-mmp/Makefile | 2 +
arch/arm/mach-mmp/common.h | 1 +
arch/arm/mach-mmp/intc.c | 223 ++++++++++++++++++++
5 files changed, 347 insertions(+), 0 deletions(-)
create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
create mode 100644 arch/arm/mach-mmp/intc.c
diff --git a/Documentation/devicetree/bindings/arm/marvell/intc.txt b/Documentation/devicetree/bindings/arm/marvell/intc.txt
new file mode 100644
index 0000000..e730a16
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/marvell/intc.txt
@@ -0,0 +1,120 @@
+* Interrupt Controller Binding for ARCH-MMP
+
+This binding specifies what properties must be available in device tree representation of an ARCH-MMP compliant interrupt controller.
+
+Required properties:
+
+ - compatible: Specifies the compatibility list of the interrupt
+ controller. The type shall be <string> and the value shall be
+ "mrvl,mmp-intc" or "mrvl,mux-intc".
+ "mrvl,mmp-intc" is the base interrupt controller. It must be
+ included. "mrvl,mux-intc" is the expanded interrupt controller,
+ and it's optional.
+
+ - reg: Specified the base physical address(s) and size(s) of the
+ interrupt controller's addressable register space. The type
+ should be <prop-encoded-array>.
+
+ - interrupt-controller: The presence of this property identifies
+ the node as interrupt controller. No property value should be
+ defined.
+
+ - #interrupt-cells: Specifies the number of cells needed to encode
+ an interrupt source. The type should be <u32> and the value should
+ be 1.
+
+ - #address-cells: Specifies the number of cells needed to encode an
+ address. The type should be <u32> and the value should be 1.
+
+ - #size-cells: Specifies the number of cells need to encode an
+ size. The type should be <u32> and the value should be 1.
+
+ - intc-numbers: Specifies the number of interrupts is supported in
+ this interrupt controller. The type should be <u32>.
+
+Optional properties:
+
+ - intc-enable-mask: Specifies the masking value of interrupt
+ configuration register. The property is used in mmp-intc. The value
+ should be <u32>.
+
+ - intc-status: Specifies the offset of status register. The property
+ is used in mux-intc. The type should be <u32>.
+
+ - intc-mask: Specifies the offset of mask register. The property
+ is used in mux-intc. The type should be <u32>.
+
+ - intc-mfp-edge: Specifies the address of mfp edge detection register.
+ The property is used while acking specified interrupt. The type
+ should be <prop-encoded-array>. The first cell indicates the address
+ of mfp edge detection register. The second cell indicates the
+ index of interrupt in current interrupt controller that should
+ handle mfp edge detection.
+
+* Examples
+
+Example 1:
+
+ /*
+ * base INTC
+ */
+ mmp_intc: interrupt-controller@d4282000 {
+ /* Compatible with mmp-intc. */
+ compatible = "mrvl,mmp-intc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ /* Offset address of 0xd4282000 and size of 0x400. */
+ reg = <0xd4282000 0x400>;
+
+ #interrupt-cells = <1>;
+ interrupt-controller;
+
+ /* 64 interrupts are supported in this INTC. */
+ intc-numbers = <64>;
+
+ /* enable bits in configuration register */
+ intc-enable-mask = <0x20>;
+ };
+
+Example 2:
+
+ /*
+ * mux INTC that is internal wired to base INTC
+ */
+ mux_intc4: interrupt-controller@d4282150 {
+ compatible = "mrvl,mux-intc";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0xd4282000 0x400>;
+
+ #interrupt-cells = <1>;
+ interrupt-controller;
+ interrupt-parent = <&mmp_intc>;
+
+ /* interrupt source '4' of parent INTC. */
+ interrupts = <4>;
+
+ /* 2 interrupts are supported in this INTC. */
+ intc-numbers = <2>;
+
+ /* Status offset address of 0x150. */
+ intc-status = <0x150>;
+
+ /* Mask offset address of 0x168. */
+ intc-mask = <0x168>;
+
+ /* mfp register of 0xd401e2c4 & interrupt index of 1 */
+ intc-mfp-edge = <0xd401e2c4 1>;
+ };
+
+Example 3:
+ /*
+ * An interrupt generating device that is wired to an INTC.
+ */
+ uart0: uart@d4030000 {
+ /* parent's '#interrupt-cells' property. */
+ interrupts = <27>;
+
+ /* The INTC that this device is wired to. */
+ interrupt-parent = <&mmp_intc>;
+ };
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 17507b8..f18eb14 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -542,6 +542,7 @@ config ARCH_MMP
select ARCH_REQUIRE_GPIOLIB
select CLKDEV_LOOKUP
select GENERIC_CLOCKEVENTS
+ select GENERIC_IRQ_CHIP
select HAVE_SCHED_CLOCK
select TICK_ONESHOT
select PLAT_PXA
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index 5c68382..e7862ea 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -4,6 +4,8 @@
obj-y += common.o clock.o devices.o time.o
+obj-$(CONFIG_OF_IRQ) += intc.o
+
# SoC support
obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o
obj-$(CONFIG_CPU_PXA910) += pxa910.o irq-pxa168.o
diff --git a/arch/arm/mach-mmp/common.h b/arch/arm/mach-mmp/common.h
index ec8d65d..1c563c2 100644
--- a/arch/arm/mach-mmp/common.h
+++ b/arch/arm/mach-mmp/common.h
@@ -6,3 +6,4 @@ extern void timer_init(int irq);
extern void __init icu_init_irq(void);
extern void __init mmp_map_io(void);
+extern void __init mmp_init_intc(void);
diff --git a/arch/arm/mach-mmp/intc.c b/arch/arm/mach-mmp/intc.c
new file mode 100644
index 0000000..ac84c7b
--- /dev/null
+++ b/arch/arm/mach-mmp/intc.c
@@ -0,0 +1,223 @@
+/*
+ * linux/arch/arm/mach-mmp/intc.c
+ *
+ * Generic IRQ handling
+ *
+ * Author: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
+ * Copyright: Marvell International Ltd. 2011
+ *
+ * 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
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/slab.h>
+
+struct mmp_intc_info {
+ unsigned int en_mask;
+ void __iomem *virt_base;
+ void __iomem *status;
+ void __iomem *mfp_edge;
+ unsigned int mfp_edge_index; /* index in irq domain */
+};
+
+static void mux_irq_ack(struct irq_data *d)
+{
+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+ struct irq_chip_type *ct;
+ struct mmp_intc_info *info;
+ unsigned int data, irq_offs;
+
+ ct = gc->chip_types;
+ info = (struct mmp_intc_info *)ct->regs.ack;
+ irq_offs = d->irq - gc->irq_base;
+ /* clear MFP edge-detect */
+ if (info->mfp_edge && (info->mfp_edge_index == irq_offs)) {
+ data = __raw_readl(info->mfp_edge);
+ __raw_writel(data | (1 << 6), info->mfp_edge);
+ __raw_writel(data, info->mfp_edge);
+ }
+}
+
+static void mmp_irq_demux_handler(unsigned int irq, struct irq_desc *desc)
+{
+ struct irq_chip_generic *gc = irq_get_handler_data(irq);
+ struct irq_chip_type *ct;
+ struct mmp_intc_info *info;
+ unsigned long status, n;
+
+ ct = gc->chip_types;
+ info = (struct mmp_intc_info *)ct->regs.ack;
+ while (1) {
+ status = __raw_readl(info->status) & ~gc->mask_cache;
+ if (status == 0)
+ break;
+ n = find_first_bit(&status, BITS_PER_LONG);
+ while (n < BITS_PER_LONG) {
+ generic_handle_irq(gc->irq_base + n);
+ n = find_next_bit(&status, BITS_PER_LONG, n + 1);
+ }
+ }
+}
+
+static void mux_init_intc(struct mmp_intc_info *mmp_info)
+{
+ struct device_node *np;
+ struct mmp_intc_info *mux_info;
+ struct irq_chip_generic *gc;
+ struct irq_chip_type *ct;
+ const __be32 *edge;
+ unsigned int addr = 0, offs = 0;
+ unsigned int status, mask, irq_base, nr, data;
+ int cascade;
+
+ for_each_compatible_node(np, NULL, "mrvl,mux-intc") {
+ if (of_get_property(np, "interrupt-controller", NULL) == NULL)
+ continue;
+ if (of_property_read_u32(np, "intc-numbers", &nr) < 0) {
+ pr_warn("intc-numbers property is missed\n");
+ continue;
+ }
+ if (of_property_read_u32(np, "intc-status", &status) < 0) {
+ pr_warn("intc-status property is missed\n");
+ continue;
+ }
+ if (of_property_read_u32(np, "intc-mask", &mask) < 0) {
+ pr_warn("intc-mask property is missed\n");
+ continue;
+ }
+
+ mux_info = kzalloc(sizeof(*mux_info), GFP_KERNEL);
+ if (mux_info == NULL)
+ goto out;
+ status += (unsigned int)mmp_info->virt_base;
+ mux_info->status = (void __iomem *)status;
+
+ edge = of_get_property(np, "intc-mfp-edge", NULL);
+ if (edge) {
+ addr = be32_to_cpu(*edge) & PAGE_MASK;
+ offs = be32_to_cpu(*edge) - addr;
+ mux_info->mfp_edge = ioremap(addr, PAGE_SIZE) + offs;
+ mux_info->mfp_edge_index = be32_to_cpu(*++edge);
+ /* clear mfp edge detection for initialization */
+ data = __raw_readl(mux_info->mfp_edge);
+ __raw_writel(data | (1 << 6), mux_info->mfp_edge);
+ __raw_writel(data, mux_info->mfp_edge);
+ }
+
+ /* allocate new irq */
+ cascade = irq_of_parse_and_map(np, 0);
+ irq_base = irq_alloc_descs(-1, 0, nr, 0);
+ irq_domain_add_simple(np, irq_base);
+
+ gc = irq_alloc_generic_chip("mux-intc", 1, irq_base,
+ mmp_info->virt_base, handle_level_irq);
+ ct = gc->chip_types;
+ ct->regs.ack = (unsigned int)mux_info;
+ ct->regs.mask = mask;
+ ct->chip.irq_ack = mux_irq_ack;
+ ct->chip.irq_mask = irq_gc_mask_set_bit;
+ ct->chip.irq_unmask = irq_gc_mask_clr_bit;
+ irq_setup_generic_chip(gc, IRQ_MSK(nr), IRQ_GC_INIT_MASK_CACHE,
+ IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+
+ irq_set_handler_data(cascade, gc);
+ irq_set_chained_handler(cascade, mmp_irq_demux_handler);
+ }
+out:
+ return;
+}
+
+static void mmp_irq_unmask(struct irq_data *d)
+{
+ struct mmp_intc_info *info = irq_data_get_irq_chip_data(d);
+
+ /* ICU_INT_CONF */
+ __raw_writel(info->en_mask, info->virt_base + (d->irq << 2));
+}
+
+static void mmp_irq_mask(struct irq_data *d)
+{
+ struct mmp_intc_info *info = irq_data_get_irq_chip_data(d);
+
+ __raw_writel(0, info->virt_base + (d->irq << 2));
+}
+
+static struct irq_chip mmp_irq_chip = {
+ .name = "mmp-intc",
+ .irq_unmask = mmp_irq_unmask,
+ .irq_mask = mmp_irq_mask,
+ .irq_ack = mmp_irq_mask,
+};
+
+void __init mmp_init_intc(void)
+{
+ struct mmp_intc_info *info;
+ struct device_node *np;
+ struct resource rs;
+ unsigned int cells, nr, enable, irq_base;
+ int i;
+
+ np = of_find_compatible_node(NULL, NULL, "mrvl,mmp-intc");
+
+ BUG_ON(!np);
+
+ of_node_get(np);
+ if (of_get_property(np, "interrupt-controller", NULL) == NULL)
+ goto out;
+ if (of_property_read_u32(np, "#interrupt-cells", &cells) < 0) {
+ pr_warn("mmp-intc: interrupt-cells property is missed\n");
+ goto out;
+ }
+ if (cells != 1) {
+ pr_warn("mmp-intc: interrupt-cells property is incorrect\n");
+ goto out;
+ }
+ if (of_property_read_u32(np, "intc-numbers", &nr) < 0) {
+ pr_warn("mmp-intc: intc-numbers property is missed\n");
+ goto out;
+ }
+ if (of_property_read_u32(np, "intc-enable-mask", &enable) < 0) {
+ pr_warn("mmp-intc: intc-enable-mask property is missed\n");
+ goto out;
+ }
+ if (of_address_to_resource(np, 0, &rs) < 0) {
+ pr_warn("mmp-intc: invalid reg property\n");
+ goto out;
+ }
+
+ info = kzalloc(sizeof(struct mmp_intc_info), GFP_KERNEL);
+ if (info == NULL)
+ goto out;
+ info->en_mask = enable;
+ info->virt_base = ioremap(rs.start, PAGE_SIZE);
+ if (info->virt_base == NULL) {
+ pr_warn("mmp-intc: failed to remap reg base\n");
+ goto out_mem;
+ }
+
+ /* allocate new irq */
+ irq_base = irq_alloc_descs(-1, 0, nr, 0);
+ irq_domain_add_simple(np, 0);
+
+ for (i = irq_base; i < irq_base + nr; i++) {
+ irq_set_chip_data(i, info);
+ mmp_irq_mask(irq_get_irq_data(i));
+ irq_set_chip_and_handler(i, &mmp_irq_chip, handle_level_irq);
+ set_irq_flags(i, IRQF_VALID);
+ }
+ mux_init_intc(info);
+ of_node_put(np);
+ return;
+out_mem:
+ kfree(info);
+out:
+ of_node_put(np);
+ return;
+}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 2/7] ARM: mmp: append MMP_USE_OF config
[not found] ` <1311042290-20253-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 17:39 ` [PATCH 1/7] ARM: mmp: parse irq from DT Grant Likely
1 sibling, 1 reply; 25+ 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
Since NR_IRQS is defined in irqs.h, parsing irq specifier will be started
from NR_IRQS while both CONFIG_USE_OF and CONFIG_SPARSE_IRQ is enabled.
It breaks the assumption that base irq is started from 0.
Add CONFIG_MMP_USE_OF config to distinguish. If CONFIG_MMP_USE_OF is set,
NR_IRQS is defined as 0. Otherwise, it follows the original definition.
Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
---
arch/arm/mach-mmp/Kconfig | 7 +++++++
arch/arm/mach-mmp/include/mach/irqs.h | 4 ++++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 67793a6..1efe994 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -96,4 +96,11 @@ config CPU_MMP2
select CPU_PJ4
help
Select code specific to MMP2. MMP2 is ARMv7 compatible.
+
+config MMP_USE_OF
+ bool "MMP Use OF"
+ select USE_OF
+ help
+ Select OF code to ARCH-MMP.
+
endif
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
index a09d328..538bb69 100644
--- a/arch/arm/mach-mmp/include/mach/irqs.h
+++ b/arch/arm/mach-mmp/include/mach/irqs.h
@@ -224,6 +224,10 @@
#define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
+#ifdef CONFIG_MMP_USE_OF
+#define NR_IRQS 0
+#else
#define NR_IRQS (IRQ_BOARD_START)
+#endif
#endif /* __ASM_MACH_IRQS_H */
--
1.5.6.5
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
[not found] ` <1311042290-20253-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 19:24 ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Grant Likely
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* [PATCH 4/7] tty: serial: support device tree in pxa
[not found] ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 13:42 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Mitch Bradley
2011-07-19 19:36 ` Grant Likely
2 siblings, 1 reply; 25+ 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] 25+ messages in thread
* [PATCH 5/7] tty: serial: check ops before registering console
[not found] ` <1311042290-20253-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 19:40 ` [PATCH 4/7] tty: serial: support device tree in pxa Grant Likely
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* [PATCH 6/7] i2c: pxa: support i2c controller from DT
[not found] ` <1311042290-20253-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 25+ 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] 25+ messages in thread
* [PATCH 7/7] i2c: pxa: support to parse property
[not found] ` <1311042290-20253-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 2:24 ` Haojian Zhuang
[not found] ` <1311042290-20253-8-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 19:43 ` [PATCH 6/7] i2c: pxa: support i2c controller from DT Grant Likely
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 0/7] support DT on ARCH-MMP
2011-07-19 2:24 ` [PATCH 0/7] support DT on ARCH-MMP Haojian Zhuang
[not found] ` <1311042290-20253-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 7:12 ` Jean Delvare
1 sibling, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2011-07-19 7:12 UTC (permalink / raw)
To: Haojian Zhuang
Cc: eric.y.miao, nico, devicetree-discuss, haojian.zhuang,
grant.likely, ben-linux, linux, linux-arm-kernel, alan
Hi Haojian,
On Tue, 19 Jul 2011 10:24:43 +0800, Haojian Zhuang wrote:
>
> It's used to support DT on ARCH-MMP.
>
> Haojian Zhuang (7):
> ARM: mmp: parse irq from DT
> ARM: mmp: append MMP_USE_OF config
> ARM: mmp: support DT on both dkb and brownstone
> tty: serial: support device tree in pxa
> tty: serial: check ops before registering console
> i2c: pxa: support i2c controller from DT
> i2c: pxa: support to parse property
>
> .../devicetree/bindings/arm/marvell/boards.txt | 7 +
> .../devicetree/bindings/arm/marvell/intc.txt | 120 ++++++++++
> .../devicetree/bindings/i2c/pxa255-i2c.txt | 36 +++
> arch/arm/Kconfig | 1 +
> arch/arm/boot/dts/mmp2-brownstone.dts | 242 ++++++++++++++++++++
> arch/arm/boot/dts/ttc-dkb.dts | 80 +++++++
> arch/arm/mach-mmp/Kconfig | 7 +
> arch/arm/mach-mmp/Makefile | 6 +
> arch/arm/mach-mmp/boards.c | 159 +++++++++++++
> arch/arm/mach-mmp/common.h | 1 +
> arch/arm/mach-mmp/include/mach/irqs.h | 4 +
> arch/arm/mach-mmp/intc.c | 223 ++++++++++++++++++
> drivers/i2c/busses/i2c-pxa.c | 78 +++++--
> drivers/tty/serial/Kconfig | 4 +-
> drivers/tty/serial/of_serial.c | 12 +
> drivers/tty/serial/pxa.c | 95 ++++++++-
> include/linux/serial_pxa.h | 17 ++
> 17 files changed, 1065 insertions(+), 27 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/arm/marvell/boards.txt
> create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
> create mode 100644 Documentation/devicetree/bindings/i2c/pxa255-i2c.txt
> create mode 100644 arch/arm/boot/dts/mmp2-brownstone.dts
> create mode 100644 arch/arm/boot/dts/ttc-dkb.dts
> create mode 100644 arch/arm/mach-mmp/boards.c
> create mode 100644 arch/arm/mach-mmp/intc.c
> create mode 100644 include/linux/serial_pxa.h
I am not involved in this in any way so please don't include me in the
Cc list.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 7/7] i2c: pxa: support to parse property
[not found] ` <1311042290-20253-8-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
@ 2011-07-19 10:17 ` Eric Miao
[not found] ` <CAMPhdO-qjR0LSjvMm7hbdqZyrFxa5S8JVa1FO8sDsxOdyUV9Ng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 19:45 ` Grant Likely
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
[not found] ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 4/7] tty: serial: support device tree in pxa Haojian Zhuang
@ 2011-07-19 13:42 ` Mitch Bradley
[not found] ` <4E2589C8.8010604-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-07-19 19:36 ` Grant Likely
2 siblings, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 1/7] ARM: mmp: parse irq from DT
[not found] ` <1311042290-20253-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Haojian Zhuang
@ 2011-07-19 17:39 ` Grant Likely
1 sibling, 0 replies; 25+ messages in thread
From: Grant Likely @ 2011-07-19 17:39 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 Mon, Jul 18, 2011 at 8:24 PM, Haojian Zhuang
<haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org> wrote:
> Parse irq sepcifier from DT and translate it to Linux irq number.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> ---
> .../devicetree/bindings/arm/marvell/intc.txt | 120 +++++++++++
> arch/arm/Kconfig | 1 +
> arch/arm/mach-mmp/Makefile | 2 +
> arch/arm/mach-mmp/common.h | 1 +
> arch/arm/mach-mmp/intc.c | 223 ++++++++++++++++++++
> 5 files changed, 347 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/arm/marvell/intc.txt
> create mode 100644 arch/arm/mach-mmp/intc.c
>
> diff --git a/Documentation/devicetree/bindings/arm/marvell/intc.txt b/Documentation/devicetree/bindings/arm/marvell/intc.txt
> new file mode 100644
> index 0000000..e730a16
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/marvell/intc.txt
> @@ -0,0 +1,120 @@
> +* Interrupt Controller Binding for ARCH-MMP
> +
> +This binding specifies what properties must be available in device tree representation of an ARCH-MMP compliant interrupt controller.
> +
> +Required properties:
> +
> + - compatible: Specifies the compatibility list of the interrupt
> + controller. The type shall be <string> and the value shall be
> + "mrvl,mmp-intc" or "mrvl,mux-intc".
> + "mrvl,mmp-intc" is the base interrupt controller. It must be
> + included. "mrvl,mux-intc" is the expanded interrupt controller,
> + and it's optional.
Please encode the soc name into the compatible property. Different
SoCs get different versions of IP blocks. The compatible property is
the easiest way to differentiate between them. New devices can always
claim compatibility with older ones to avoid needing an exhaustive
list in the device driver. Both of these should be something like
"mrvl,<soc>-mmp-intc" and "mrvl,<soc>-mux-intc".
> +
> + - reg: Specified the base physical address(s) and size(s) of the
> + interrupt controller's addressable register space. The type
> + should be <prop-encoded-array>.
> +
> + - interrupt-controller: The presence of this property identifies
> + the node as interrupt controller. No property value should be
> + defined.
> +
> + - #interrupt-cells: Specifies the number of cells needed to encode
> + an interrupt source. The type should be <u32> and the value should
> + be 1.
> +
> + - #address-cells: Specifies the number of cells needed to encode an
> + address. The type should be <u32> and the value should be 1.
> +
> + - #size-cells: Specifies the number of cells need to encode an
> + size. The type should be <u32> and the value should be 1.
This is not a bus node. It should not have #address-cells or #size-cells.
> +
> + - intc-numbers: Specifies the number of interrupts is supported in
> + this interrupt controller. The type should be <u32>.
> +
> +Optional properties:
> +
> + - intc-enable-mask: Specifies the masking value of interrupt
> + configuration register. The property is used in mmp-intc. The value
> + should be <u32>.
What is the purpose of having a mask register? I would expect that
unused interrupts simply wouldn't be requested by any devices.
> +
> + - intc-status: Specifies the offset of status register. The property
> + is used in mux-intc. The type should be <u32>.
> +
> + - intc-mask: Specifies the offset of mask register. The property
> + is used in mux-intc. The type should be <u32>.
> +
> + - intc-mfp-edge: Specifies the address of mfp edge detection register.
> + The property is used while acking specified interrupt. The type
> + should be <prop-encoded-array>. The first cell indicates the address
> + of mfp edge detection register. The second cell indicates the
> + index of interrupt in current interrupt controller that should
> + handle mfp edge detection.
Use a "mrvl," prefix on the above non-standard properties. Since the
4 properties above are all register offsets, the name should reflect
that. Something like "mrvl,status-reg-offset"
Do the register offsets change with difference versions of the silicon?
> +
> +* Examples
> +
> +Example 1:
> +
> + /*
> + * base INTC
> + */
> + mmp_intc: interrupt-controller@d4282000 {
> + /* Compatible with mmp-intc. */
> + compatible = "mrvl,mmp-intc";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + /* Offset address of 0xd4282000 and size of 0x400. */
> + reg = <0xd4282000 0x400>;
> +
> + #interrupt-cells = <1>;
> + interrupt-controller;
> +
> + /* 64 interrupts are supported in this INTC. */
> + intc-numbers = <64>;
> +
> + /* enable bits in configuration register */
> + intc-enable-mask = <0x20>;
> + };
> +
> +Example 2:
> +
> + /*
> + * mux INTC that is internal wired to base INTC
> + */
> + mux_intc4: interrupt-controller@d4282150 {
> + compatible = "mrvl,mux-intc";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + reg = <0xd4282000 0x400>;
> +
> + #interrupt-cells = <1>;
> + interrupt-controller;
> + interrupt-parent = <&mmp_intc>;
> +
> + /* interrupt source '4' of parent INTC. */
> + interrupts = <4>;
> +
> + /* 2 interrupts are supported in this INTC. */
> + intc-numbers = <2>;
> +
> + /* Status offset address of 0x150. */
> + intc-status = <0x150>;
> +
> + /* Mask offset address of 0x168. */
> + intc-mask = <0x168>;
> +
> + /* mfp register of 0xd401e2c4 & interrupt index of 1 */
> + intc-mfp-edge = <0xd401e2c4 1>;
> + };
> +
> +Example 3:
> + /*
> + * An interrupt generating device that is wired to an INTC.
> + */
> + uart0: uart@d4030000 {
> + /* parent's '#interrupt-cells' property. */
> + interrupts = <27>;
> +
> + /* The INTC that this device is wired to. */
> + interrupt-parent = <&mmp_intc>;
> + };
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 17507b8..f18eb14 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -542,6 +542,7 @@ config ARCH_MMP
> select ARCH_REQUIRE_GPIOLIB
> select CLKDEV_LOOKUP
> select GENERIC_CLOCKEVENTS
> + select GENERIC_IRQ_CHIP
> select HAVE_SCHED_CLOCK
> select TICK_ONESHOT
> select PLAT_PXA
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index 5c68382..e7862ea 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -4,6 +4,8 @@
>
> obj-y += common.o clock.o devices.o time.o
>
> +obj-$(CONFIG_OF_IRQ) += intc.o
> +
Do drivers already exist for the pxa interrupt controllers? I would
expect the existing driver to be updated to include DT support instead
of writing an entirely new IRQ controller driver.
g.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 2/7] ARM: mmp: append MMP_USE_OF config
[not found] ` <1311042290-20253-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Haojian Zhuang
@ 2011-07-19 19:24 ` Grant Likely
1 sibling, 0 replies; 25+ messages in thread
From: Grant Likely @ 2011-07-19 19:24 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:45AM +0800, Haojian Zhuang wrote:
> Since NR_IRQS is defined in irqs.h, parsing irq specifier will be started
> from NR_IRQS while both CONFIG_USE_OF and CONFIG_SPARSE_IRQ is enabled.
> It breaks the assumption that base irq is started from 0.
>
> Add CONFIG_MMP_USE_OF config to distinguish. If CONFIG_MMP_USE_OF is set,
> NR_IRQS is defined as 0. Otherwise, it follows the original definition.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
Don't do this. It is completely valid and supported to have both DT
and non-DT support in the same kernel build. This patch will break
that.
> ---
> arch/arm/mach-mmp/Kconfig | 7 +++++++
> arch/arm/mach-mmp/include/mach/irqs.h | 4 ++++
> 2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
> index 67793a6..1efe994 100644
> --- a/arch/arm/mach-mmp/Kconfig
> +++ b/arch/arm/mach-mmp/Kconfig
> @@ -96,4 +96,11 @@ config CPU_MMP2
> select CPU_PJ4
> help
> Select code specific to MMP2. MMP2 is ARMv7 compatible.
> +
> +config MMP_USE_OF
> + bool "MMP Use OF"
> + select USE_OF
> + help
> + Select OF code to ARCH-MMP.
> +
> endif
> diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
> index a09d328..538bb69 100644
> --- a/arch/arm/mach-mmp/include/mach/irqs.h
> +++ b/arch/arm/mach-mmp/include/mach/irqs.h
> @@ -224,6 +224,10 @@
>
> #define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
>
> +#ifdef CONFIG_MMP_USE_OF
> +#define NR_IRQS 0
> +#else
> #define NR_IRQS (IRQ_BOARD_START)
> +#endif
>
> #endif /* __ASM_MACH_IRQS_H */
> --
> 1.5.6.5
>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
[not found] ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 4/7] tty: serial: support device tree in pxa Haojian Zhuang
2011-07-19 13:42 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Mitch Bradley
@ 2011-07-19 19:36 ` Grant Likely
2 siblings, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
[not found] ` <1311042290-20253-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 5/7] tty: serial: check ops before registering console Haojian Zhuang
@ 2011-07-19 19:40 ` Grant Likely
2011-07-19 19:48 ` Arnd Bergmann
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 6/7] i2c: pxa: support i2c controller from DT
[not found] ` <1311042290-20253-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 7/7] i2c: pxa: support to parse property Haojian Zhuang
@ 2011-07-19 19:43 ` Grant Likely
1 sibling, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 7/7] i2c: pxa: support to parse property
[not found] ` <1311042290-20253-8-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 10:17 ` Eric Miao
@ 2011-07-19 19:45 ` Grant Likely
[not found] ` <20110719194550.GK6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
1 sibling, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 7/7] i2c: pxa: support to parse property
[not found] ` <CAMPhdO-qjR0LSjvMm7hbdqZyrFxa5S8JVa1FO8sDsxOdyUV9Ng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-07-19 19:47 ` Grant Likely
0 siblings, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
2011-07-19 19:40 ` [PATCH 4/7] tty: serial: support device tree in pxa Grant Likely
@ 2011-07-19 19:48 ` Arnd Bergmann
2011-07-19 19:53 ` Grant Likely
0 siblings, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone
[not found] ` <4E2589C8.8010604-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
@ 2011-07-19 19:49 ` Grant Likely
0 siblings, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
2011-07-19 19:48 ` Arnd Bergmann
@ 2011-07-19 19:53 ` Grant Likely
[not found] ` <CACxGe6u1Pq990opdt7irttuY1OvpZVNXSM11cLdqo5zN8YpYeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 25+ 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] 25+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
[not found] ` <CACxGe6u1Pq990opdt7irttuY1OvpZVNXSM11cLdqo5zN8YpYeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-07-19 20:05 ` Russell King - ARM Linux
2011-07-19 20:17 ` Arnd Bergmann
[not found] ` <20110719200515.GB308-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
0 siblings, 2 replies; 25+ 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] 25+ messages in thread
* Re: [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
[not found] ` <20110719200515.GB308-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
1 sibling, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 7/7] i2c: pxa: support to parse property
[not found] ` <20110719194550.GK6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
@ 2011-07-20 1:22 ` Eric Miao
0 siblings, 0 replies; 25+ 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] 25+ messages in thread
* Re: [PATCH 4/7] tty: serial: support device tree in pxa
[not found] ` <20110719200515.GB308-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
@ 2011-07-20 1:26 ` Eric Miao
0 siblings, 0 replies; 25+ 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] 25+ messages in thread
end of thread, other threads:[~2011-07-20 1:26 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2011071901>
2011-07-19 2:24 ` [PATCH 0/7] support DT on ARCH-MMP Haojian Zhuang
[not found] ` <1311042290-20253-1-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 1/7] ARM: mmp: parse irq from DT Haojian Zhuang
[not found] ` <1311042290-20253-2-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Haojian Zhuang
[not found] ` <1311042290-20253-3-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Haojian Zhuang
[not found] ` <1311042290-20253-4-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 4/7] tty: serial: support device tree in pxa Haojian Zhuang
[not found] ` <1311042290-20253-5-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 5/7] tty: serial: check ops before registering console Haojian Zhuang
[not found] ` <1311042290-20253-6-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 6/7] i2c: pxa: support i2c controller from DT Haojian Zhuang
[not found] ` <1311042290-20253-7-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 2:24 ` [PATCH 7/7] i2c: pxa: support to parse property Haojian Zhuang
[not found] ` <1311042290-20253-8-git-send-email-haojian.zhuang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
2011-07-19 10:17 ` Eric Miao
[not found] ` <CAMPhdO-qjR0LSjvMm7hbdqZyrFxa5S8JVa1FO8sDsxOdyUV9Ng-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 19:47 ` Grant Likely
2011-07-19 19:45 ` Grant Likely
[not found] ` <20110719194550.GK6848-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-07-20 1:22 ` Eric Miao
2011-07-19 19:43 ` [PATCH 6/7] i2c: pxa: support i2c controller from DT Grant Likely
2011-07-19 19:40 ` [PATCH 4/7] tty: serial: support device tree in pxa Grant Likely
2011-07-19 19:48 ` Arnd Bergmann
2011-07-19 19:53 ` Grant Likely
[not found] ` <CACxGe6u1Pq990opdt7irttuY1OvpZVNXSM11cLdqo5zN8YpYeg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-19 20:05 ` Russell King - ARM Linux
2011-07-19 20:17 ` Arnd Bergmann
[not found] ` <20110719200515.GB308-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2011-07-20 1:26 ` Eric Miao
2011-07-19 13:42 ` [PATCH 3/7] ARM: mmp: support DT on both dkb and brownstone Mitch Bradley
[not found] ` <4E2589C8.8010604-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2011-07-19 19:49 ` Grant Likely
2011-07-19 19:36 ` Grant Likely
2011-07-19 19:24 ` [PATCH 2/7] ARM: mmp: append MMP_USE_OF config Grant Likely
2011-07-19 17:39 ` [PATCH 1/7] ARM: mmp: parse irq from DT Grant Likely
2011-07-19 7:12 ` [PATCH 0/7] support DT on ARCH-MMP Jean Delvare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).