linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs
@ 2014-06-05 17:26 Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 1/7] of: Provide function to request and map memory Matthias Brugger
                   ` (6 more replies)
  0 siblings, 7 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Seventh round for the Mediatek basic support patches.

Due to the discussion about the need of request the memory needed by a
device [0], I implemented the function of_io_request_and_map.
The clocksource drivers uses proper error handling and keep on booting
the device instead of calling panic.

[0] http://www.spinics.net/lists/arm-kernel/msg336924.html

---
This patch set adds basic support for the Mediatek Cortex-A7 SoCs.
Support is quite basic, as the only component working up to now are the
timers.

The patch series is build against torvalds/master tree.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>


Changes for v7:
1. OF address
- add of_io_request_and_map

2. Clocksource timer
- use pr_warnings and error handling instead of panic
- fix macro parentheses
- use of_io_request_and_map

3. Others
- rename SoC DT bindings to mediatek.txt
- fixed typos


Changes for v6:
- fix compatible string of the timer
- encapsulate timer setup in function
- add more information to the timer commit message
- add address in timer DTS bindings documentation


Changes for v5:
1. Clocksource timer
- Change the compatible string to mt6577

2. Timer DT bindings
- Change compatible string to mt6577


Changes for v4:
1. Clocksource timer
- use cpu_possible_mask

2. Timer DT bindings
- Delete comments about the frequency of the clocks
- Add clock-names for the input clocks

3. Basic SoC support
- add clock-names for the timer
- rename the label of the clocks nodes


Changes for v3:
1. Clocksource timer
- Set cpu_mask_all and irq in clock_event_device
- Use device private structure for driver specific values

2. Timer DT bindings
- Define order of the clock phandles
- Fix typos

3. Basic SoC support
- DTS: set gic to a15-gic
- DTS: order by physical address
- Remove call to dt_init function


Changes for v2:
1. Clocksource timer
- Delete unused parts for sched_clock_source
- Use irq_request instead of setup_irq
- Remove unused SMP parts
- Fix some style issues
- use of_address_to resource and request_mem_region
- delete use of named clock
- select CLKSRC_MMIO in driver Kconfig

2. DT bindings
- delete named clock bindings

3. Basic SoC support
- Clean-up Kconfig
- Add documentation of the SoC compatible property 
- DTS: rename SoC file to mt6589.dts
- DTS: Delete not present cache controller
- DTS: Add missing GICv2 properties
- DTS: Change clock names
- DTS: Add Aquaris5 board

4. Add earlyprintk
- patch droped until serial driver is available

5. Add support for Aquaris5 mobile phone



Matthias Brugger (7):
  of: Provide function to request and map memory
  clocksource: Add support for the Mediatek SoCs
  dt-bindings: add mtk-timer bindings
  vendor-prefixes: add prefix for Mediaktek Inc.
  arm: add basic support for Mediatek MT6589 boards
  dt-bindings: add documentation for Mediatek SoC
  arm: mediatek: add dts for Aquaris5 mobile phone

 Documentation/devicetree/bindings/arm/mediatek.txt |    8 +
 .../bindings/timer/mediatek,mtk-timer.txt          |   18 ++
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 arch/arm/Kconfig                                   |    2 +
 arch/arm/Makefile                                  |    1 +
 arch/arm/boot/dts/mt6589-aquaris5.dts              |   25 ++
 arch/arm/boot/dts/mt6589.dtsi                      |   94 +++++++
 arch/arm/mach-mediatek/Kconfig                     |    6 +
 arch/arm/mach-mediatek/Makefile                    |    1 +
 arch/arm/mach-mediatek/mediatek.c                  |   27 ++
 drivers/clocksource/Kconfig                        |    5 +
 drivers/clocksource/Makefile                       |    1 +
 drivers/clocksource/mtk_timer.c                    |  260 ++++++++++++++++++++
 drivers/of/address.c                               |   28 +++
 include/linux/of_address.h                         |    8 +
 15 files changed, 485 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek.txt
 create mode 100644 Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
 create mode 100644 arch/arm/boot/dts/mt6589-aquaris5.dts
 create mode 100644 arch/arm/boot/dts/mt6589.dtsi
 create mode 100644 arch/arm/mach-mediatek/Kconfig
 create mode 100644 arch/arm/mach-mediatek/Makefile
 create mode 100644 arch/arm/mach-mediatek/mediatek.c
 create mode 100644 drivers/clocksource/mtk_timer.c

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-06 15:19   ` Rob Herring
  2014-06-05 17:26 ` [PATCH v7 2/7] clocksource: Add support for the Mediatek SoCs Matthias Brugger
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

A call to of_iomap does not request the memory region.
This patch adds the function of_io_request_and_map which requests
the memory region before mapping it.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
 include/linux/of_address.h |    8 ++++++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index cb4242a..c55b107 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
 	return ioremap(res.start, resource_size(&res));
 }
 EXPORT_SYMBOL(of_iomap);
+
+/**
+ * of_io_request_and_map - Requests a resource and maps the memory mapped IO
+ *			   for a given device_node
+ * @device:	the device whose io range will be mapped
+ * @index:	index of the io range
+ * @name:	name of the resource
+ *
+ * Returns a pointer to the requested and mapped memory
+ */
+void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
+{
+	struct resource res;
+	void __iomem *mem;
+
+	if (of_address_to_resource(np, index, &res))
+		return NULL;
+
+	if (!request_mem_region(res.start, resource_size(&res), name))
+		return NULL;
+
+	mem = ioremap(res.start, resource_size(&res));
+	if (!mem)
+		release_mem_region(res.start, resource_size(&res));
+
+	return mem;
+}
+EXPORT_SYMBOL(of_io_request_and_map);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 5f6ed6b..725b875 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -96,6 +96,8 @@ static inline struct of_pci_range *of_pci_range_parser_one(
 extern int of_address_to_resource(struct device_node *dev, int index,
 				  struct resource *r);
 void __iomem *of_iomap(struct device_node *node, int index);
+void __iomem *of_io_request_and_map(struct device_node *device,
+					int index, char *name);
 #else
 static inline int of_address_to_resource(struct device_node *dev, int index,
 					 struct resource *r)
@@ -107,6 +109,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
 {
 	return NULL;
 }
+
+static inline void __iomem *of_io_request_and_map(struct device_node *device,
+					int index, char *name)
+{
+	return NULL;
+}
 #endif
 
 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 2/7] clocksource: Add support for the Mediatek SoCs
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 1/7] of: Provide function to request and map memory Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 3/7] dt-bindings: add mtk-timer bindings Matthias Brugger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds a clock source and clock event for the timer found
on the Mediatek SoCs.

The Mediatek General Purpose Timer block provides five 32 bit timers and
one 64 bit timer.

Two 32 bit timers are used by this driver:
TIMER1: clock events supporting periodic and oneshot events
TIMER2: clock source configured as a free running counter

The General Purpose Timer block can be run with two clocks. A 13 MHz system
clock and the RTC clock running at 32 KHz. This implementation uses the system
clock with no clock source divider.

The interrupts are shared between the different timers and have to be read back
from a register. We just enable one interrupt for the clock event. The clock
event timer is used by all cores.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 drivers/clocksource/Kconfig     |    5 +
 drivers/clocksource/Makefile    |    1 +
 drivers/clocksource/mtk_timer.c |  260 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+)
 create mode 100644 drivers/clocksource/mtk_timer.c

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 96918e1..a008473 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -144,6 +144,11 @@ config VF_PIT_TIMER
 config SYS_SUPPORTS_SH_CMT
         bool
 
+config MTK_TIMER
+	select CLKSRC_OF
+	select CLKSRC_MMIO
+	bool
+
 config SYS_SUPPORTS_SH_MTU2
         bool
 
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 98cb6c5..619d302 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_CLKSRC_EXYNOS_MCT)	+= exynos_mct.o
 obj-$(CONFIG_CLKSRC_SAMSUNG_PWM)	+= samsung_pwm_timer.o
 obj-$(CONFIG_VF_PIT_TIMER)	+= vf_pit_timer.o
 obj-$(CONFIG_CLKSRC_QCOM)	+= qcom-timer.o
+obj-$(CONFIG_MTK_TIMER)		+= mtk_timer.o
 
 obj-$(CONFIG_ARM_ARCH_TIMER)		+= arm_arch_timer.o
 obj-$(CONFIG_ARM_GLOBAL_TIMER)		+= arm_global_timer.o
diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
new file mode 100644
index 0000000..a399416
--- /dev/null
+++ b/drivers/clocksource/mtk_timer.c
@@ -0,0 +1,260 @@
+/*
+ * Mediatek SoCs General-Purpose Timer handling.
+ *
+ * Copyright (C) 2014 Matthias Brugger
+ *
+ * Matthias Brugger <matthias.bgg@gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/clockchips.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/irqreturn.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/slab.h>
+
+#define GPT_IRQ_EN_REG		0x00
+#define GPT_IRQ_ENABLE(val)	BIT((val) - 1)
+#define GPT_IRQ_ACK_REG		0x08
+#define GPT_IRQ_ACK(val)	BIT((val) - 1)
+
+#define TIMER_CTRL_REG(val)	(0x10 * (val))
+#define TIMER_CTRL_OP(val)	(((val) & 0x3) << 4)
+#define TIMER_CTRL_OP_ONESHOT	(0)
+#define TIMER_CTRL_OP_REPEAT	(1)
+#define TIMER_CTRL_OP_FREERUN	(3)
+#define TIMER_CTRL_CLEAR	(2)
+#define TIMER_CTRL_ENABLE	(1)
+#define TIMER_CTRL_DISABLE	(0)
+
+#define TIMER_CLK_REG(val)	(0x04 + (0x10 * (val)))
+#define TIMER_CLK_SRC(val)	(((val) & 0x1) << 4)
+#define TIMER_CLK_SRC_SYS13M	(0)
+#define TIMER_CLK_SRC_RTC32K	(1)
+#define TIMER_CLK_DIV1		(0x0)
+#define TIMER_CLK_DIV2		(0x1)
+
+#define TIMER_CNT_REG(val)	(0x08 + (0x10 * (val)))
+#define TIMER_CMP_REG(val)	(0x0C + (0x10 * (val)))
+
+#define GPT_CLK_EVT	1
+#define GPT_CLK_SRC	2
+
+struct mtk_clock_event_device {
+	void __iomem *gpt_base;
+	u32 ticks_per_jiffy;
+	struct clock_event_device dev;
+};
+
+static inline struct mtk_clock_event_device *to_mtk_clk(
+				struct clock_event_device *c)
+{
+	return container_of(c, struct mtk_clock_event_device, dev);
+}
+
+static void mtk_clkevt_time_stop(struct mtk_clock_event_device *evt, u8 timer)
+{
+	u32 val = readl(evt->gpt_base + TIMER_CTRL_REG(timer));
+	writel(val & ~TIMER_CTRL_ENABLE, evt->gpt_base +
+			TIMER_CTRL_REG(timer));
+}
+
+static void mtk_clkevt_time_setup(struct mtk_clock_event_device *evt,
+				unsigned long delay, u8 timer)
+{
+	writel(delay, evt->gpt_base + TIMER_CMP_REG(timer));
+}
+
+static void mtk_clkevt_time_start(struct mtk_clock_event_device *evt,
+		bool periodic, u8 timer)
+{
+	u32 val;
+
+	/* Acknowledge interrupt */
+	writel(GPT_IRQ_ACK(timer), evt->gpt_base + GPT_IRQ_ACK_REG);
+
+	val = readl(evt->gpt_base + TIMER_CTRL_REG(timer));
+
+	/* Clear 2 bit timer operation mode field */
+	val &= ~TIMER_CTRL_OP(0x3);
+
+	if (periodic)
+		val |= TIMER_CTRL_OP(TIMER_CTRL_OP_REPEAT);
+	else
+		val |= TIMER_CTRL_OP(TIMER_CTRL_OP_ONESHOT);
+
+	writel(val | TIMER_CTRL_ENABLE | TIMER_CTRL_CLEAR,
+	       evt->gpt_base + TIMER_CTRL_REG(timer));
+}
+
+static void mtk_clkevt_mode(enum clock_event_mode mode,
+				struct clock_event_device *clk)
+{
+	struct mtk_clock_event_device *evt = to_mtk_clk(clk);
+
+	mtk_clkevt_time_stop(evt, GPT_CLK_EVT);
+
+	switch (mode) {
+	case CLOCK_EVT_MODE_PERIODIC:
+		mtk_clkevt_time_setup(evt, evt->ticks_per_jiffy, GPT_CLK_EVT);
+		mtk_clkevt_time_start(evt, true, GPT_CLK_EVT);
+		break;
+	case CLOCK_EVT_MODE_ONESHOT:
+		mtk_clkevt_time_start(evt, false, GPT_CLK_EVT);
+		break;
+	case CLOCK_EVT_MODE_UNUSED:
+	case CLOCK_EVT_MODE_SHUTDOWN:
+	default:
+		/* No more interrupts will occur as source is disabled */
+		break;
+	}
+}
+
+static int mtk_clkevt_next_event(unsigned long event,
+				   struct clock_event_device *clk)
+{
+	struct mtk_clock_event_device *evt = to_mtk_clk(clk);
+
+	mtk_clkevt_time_stop(evt, GPT_CLK_EVT);
+	mtk_clkevt_time_setup(evt, event, GPT_CLK_EVT);
+	mtk_clkevt_time_start(evt, false, GPT_CLK_EVT);
+
+	return 0;
+}
+
+static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
+{
+	struct mtk_clock_event_device *evt = dev_id;
+
+	/* Acknowledge timer0 irq */
+	writel(GPT_IRQ_ACK(GPT_CLK_EVT), evt->gpt_base + GPT_IRQ_ACK_REG);
+	evt->dev.event_handler(&evt->dev);
+
+	return IRQ_HANDLED;
+}
+
+static void mtk_timer_global_reset(struct mtk_clock_event_device *evt)
+{
+	/* Disable all interrupts */
+	writel(0x0, evt->gpt_base + GPT_IRQ_EN_REG);
+	/* Acknowledge all interrupts */
+	writel(0x3f, evt->gpt_base + GPT_IRQ_ACK_REG);
+}
+
+static void
+mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+{
+	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
+		evt->gpt_base + TIMER_CTRL_REG(timer));
+
+	writel(TIMER_CLK_SRC(TIMER_CLK_SRC_SYS13M) | TIMER_CLK_DIV1,
+			evt->gpt_base + TIMER_CLK_REG(timer));
+
+	writel(0x0, evt->gpt_base + TIMER_CMP_REG(timer));
+
+	writel(TIMER_CTRL_OP(option) | TIMER_CTRL_ENABLE,
+			evt->gpt_base + TIMER_CTRL_REG(timer));
+}
+
+static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
+{
+	u32 val;
+
+	val = readl(evt->gpt_base + GPT_IRQ_EN_REG);
+	writel(val | GPT_IRQ_ENABLE(timer),
+			evt->gpt_base + GPT_IRQ_EN_REG);
+}
+
+static void __init mtk_timer_init(struct device_node *node)
+{
+	struct mtk_clock_event_device *evt;
+	struct resource res;
+	unsigned long rate = 0;
+	struct clk *clk;
+
+	evt = kzalloc(sizeof(*evt), GFP_KERNEL);
+	if (!evt) {
+		pr_warn("Can't allocate mtk clock event driver struct");
+		return;
+	}
+
+	evt->dev.name = "mtk_tick";
+	evt->dev.rating = 300;
+	evt->dev.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
+	evt->dev.set_mode = mtk_clkevt_mode;
+	evt->dev.set_next_event = mtk_clkevt_next_event;
+	evt->dev.cpumask = cpu_possible_mask;
+
+	evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer");
+	if (!evt->gpt_base) {
+		pr_warn("Can't get resource\n");
+		return;
+	}
+
+	evt->dev.irq = irq_of_parse_and_map(node, 0);
+	if (evt->dev.irq <= 0) {
+		pr_warn("Can't parse IRQ");
+		goto err_mem;
+	}
+
+	clk = of_clk_get(node, 0);
+	if (IS_ERR(clk)) {
+		pr_warn("Can't get timer clock");
+		goto err_irq;
+	}
+
+	if (clk_prepare_enable(clk)) {
+		pr_warn("Can't prepare clock");
+		goto err_clk_put;
+	}
+	rate = clk_get_rate(clk);
+
+	if (request_irq(evt->dev.irq, mtk_timer_interrupt,
+			IRQF_TIMER | IRQF_IRQPOLL, "mtk_timer", evt)) {
+		pr_warn("failed to setup irq %d\n", evt->dev.irq);
+		goto err_clk_disable;
+	}
+
+	evt->ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
+
+	mtk_timer_global_reset(evt);
+
+	/* Configure clock source */
+	mtk_timer_setup(evt, GPT_CLK_SRC, TIMER_CTRL_OP_FREERUN);
+	clocksource_mmio_init(evt->gpt_base + TIMER_CNT_REG(GPT_CLK_SRC),
+			node->name, rate, 300, 32, clocksource_mmio_readl_up);
+
+	/* Configure clock event */
+	mtk_timer_setup(evt, GPT_CLK_EVT, TIMER_CTRL_OP_REPEAT);
+	mtk_timer_enable_irq(evt, GPT_CLK_EVT);
+
+	clockevents_config_and_register(&evt->dev, rate, 0x3,
+					0xffffffff);
+	return;
+
+err_clk_disable:
+	clk_disable_unprepare(clk);
+err_clk_put:
+	clk_put(clk);
+err_irq:
+	irq_dispose_mapping(evt->dev.irq);
+err_mem:
+	iounmap(evt->gpt_base);
+	of_address_to_resource(node, 0, &res);
+	release_mem_region(res.start, resource_size(&res));
+	return;
+}
+CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 3/7] dt-bindings: add mtk-timer bindings
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 1/7] of: Provide function to request and map memory Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 2/7] clocksource: Add support for the Mediatek SoCs Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 4/7] vendor-prefixes: add prefix for Mediaktek Inc Matthias Brugger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Add binding documentation for the General Porpose Timer driver of
the Mediatek SoCs.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: S?ren Brinkmann <soren.brinkmann@xilinx.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../bindings/timer/mediatek,mtk-timer.txt          |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt

diff --git a/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
new file mode 100644
index 0000000..10b7e09
--- /dev/null
+++ b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
@@ -0,0 +1,18 @@
+Mediatek MT6577, MT6572 and MT6589 Timers
+---------------------------------------
+
+Required properties:
+- compatible: Should be "mediatek,mt6577-timer"
+- reg: Should contain location and length for timers register.
+- clocks: Clocks driving the timer hardware. This list should include two
+	clocks. The order is system clock and as second clock the RTC clock.
+
+Examples:
+
+	timer at 10008000 {
+		compatible = "mediatek,mt6577-timer";
+		reg = <0x10008000 0x80>;
+		interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&system_clk>, <&rtc_clk>;
+		clock-names = "system-clk", "rtc-clk";
+	};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 4/7] vendor-prefixes: add prefix for Mediaktek Inc.
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
                   ` (2 preceding siblings ...)
  2014-06-05 17:26 ` [PATCH v7 3/7] dt-bindings: add mtk-timer bindings Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards Matthias Brugger
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/vendor-prefixes.txt        |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index abc3080..73f9e4c 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -75,6 +75,7 @@ linux	Linux-specific binding
 lsi	LSI Corp. (LSI Logic)
 marvell	Marvell Technology Group Ltd.
 maxim	Maxim Integrated Products
+mediatek	MediaTek Inc.
 microchip	Microchip Technology Inc.
 mosaixtech	Mosaix Technologies, Inc.
 moxa	Moxa
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
                   ` (3 preceding siblings ...)
  2014-06-05 17:26 ` [PATCH v7 4/7] vendor-prefixes: add prefix for Mediaktek Inc Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-05 18:21   ` Mark Rutland
  2014-06-05 17:26 ` [PATCH v7 6/7] dt-bindings: add documentation for Mediatek SoC Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 7/7] arm: mediatek: add dts for Aquaris5 mobile phone Matthias Brugger
  6 siblings, 1 reply; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a generic devicetree board file and a dtsi for boards
based on MT6589 SoCs from Mediatek.

Apart from the generic parts (gic, clocks) the only component
currently supported are the timers.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 arch/arm/Kconfig                  |    2 +
 arch/arm/Makefile                 |    1 +
 arch/arm/boot/dts/mt6589.dtsi     |   94 +++++++++++++++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig    |    6 +++
 arch/arm/mach-mediatek/Makefile   |    1 +
 arch/arm/mach-mediatek/mediatek.c |   27 +++++++++++
 6 files changed, 131 insertions(+)
 create mode 100644 arch/arm/boot/dts/mt6589.dtsi
 create mode 100644 arch/arm/mach-mediatek/Kconfig
 create mode 100644 arch/arm/mach-mediatek/Makefile
 create mode 100644 arch/arm/mach-mediatek/mediatek.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index db3c541..0fc8acd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -997,6 +997,8 @@ source "arch/arm/mach-mv78xx0/Kconfig"
 
 source "arch/arm/mach-imx/Kconfig"
 
+source "arch/arm/mach-mediatek/Kconfig"
+
 source "arch/arm/mach-mxs/Kconfig"
 
 source "arch/arm/mach-netx/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 41c1931..8ce9774 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_MSM)		+= msm
 machine-$(CONFIG_ARCH_MV78XX0)		+= mv78xx0
 machine-$(CONFIG_ARCH_MVEBU)		+= mvebu
 machine-$(CONFIG_ARCH_MXC)		+= imx
+machine-$(CONFIG_ARCH_MEDIATEK)		+= mediatek
 machine-$(CONFIG_ARCH_MXS)		+= mxs
 machine-$(CONFIG_ARCH_NETX)		+= netx
 machine-$(CONFIG_ARCH_NOMADIK)		+= nomadik
diff --git a/arch/arm/boot/dts/mt6589.dtsi b/arch/arm/boot/dts/mt6589.dtsi
new file mode 100644
index 0000000..f1d8a8b
--- /dev/null
+++ b/arch/arm/boot/dts/mt6589.dtsi
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014 MundoReader S.L.
+ * Author: Matthias Brugger <matthias.bgg@gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include "skeleton.dtsi"
+
+/ {
+	compatible = "mediatek,mt6589";
+	interrupt-parent = <&gic>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0x0>;
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0x1>;
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0x2>;
+		};
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0x3>;
+		};
+
+	};
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		system_clk: dummy13m {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		rtc_clk: dummy32k {
+			compatible = "fixed-clock";
+			clock-frequency = <32000>;
+			#clock-cells = <0>;
+		};
+	};
+
+	soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "simple-bus";
+		clock-ranges;
+		ranges;
+
+		timer: timer at 10008000 {
+			compatible = "mediatek,mt6577-timer";
+			reg = <0x10008000 0x80>;
+			interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&system_clk>, <&rtc_clk>;
+			clock-names = "system-clk", "rtc-clk";
+		};
+
+		gic: interrupt-controller at 10212000 {
+			compatible = "arm,cortex-a15-gic";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			reg = <0x10211000 0x1000>,
+			      <0x10212000 0x1000>,
+			      <0x10214000 0x2000>,
+			      <0x10216000 0x2000>;
+		};
+	};
+};
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
new file mode 100644
index 0000000..2c043a2
--- /dev/null
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -0,0 +1,6 @@
+config ARCH_MEDIATEK
+	bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7
+	select ARM_GIC
+	select MTK_TIMER
+	help
+	  Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.
diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
new file mode 100644
index 0000000..43e619f
--- /dev/null
+++ b/arch/arm/mach-mediatek/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
new file mode 100644
index 0000000..f2acf07
--- /dev/null
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -0,0 +1,27 @@
+/*
+ * Device Tree support for Mediatek SoCs
+ *
+ * Copyright (c) 2014 MundoReader S.L.
+ * Author: Matthias Brugger <matthias.bgg@gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+#include <linux/init.h>
+#include <asm/mach/arch.h>
+
+static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6589",
+	NULL,
+};
+
+DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
+	.dt_compat	= mediatek_board_dt_compat,
+MACHINE_END
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 6/7] dt-bindings: add documentation for Mediatek SoC
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
                   ` (4 preceding siblings ...)
  2014-06-05 17:26 ` [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  2014-06-05 17:26 ` [PATCH v7 7/7] arm: mediatek: add dts for Aquaris5 mobile phone Matthias Brugger
  6 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a DT binding documentation for the MT6589 SoC from Mediatek.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/arm/mediatek.txt |    8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/mediatek.txt

diff --git a/Documentation/devicetree/bindings/arm/mediatek.txt b/Documentation/devicetree/bindings/arm/mediatek.txt
new file mode 100644
index 0000000..d6ac71f
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek.txt
@@ -0,0 +1,8 @@
+Mediatek MT6589 Platforms Device Tree Bindings
+
+Boards with a SoC of the Mediatek MT6589 shall have the following property:
+
+Required root node property:
+
+compatible: must contain "mediatek,mt6589"
+
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 7/7] arm: mediatek: add dts for Aquaris5 mobile phone
  2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
                   ` (5 preceding siblings ...)
  2014-06-05 17:26 ` [PATCH v7 6/7] dt-bindings: add documentation for Mediatek SoC Matthias Brugger
@ 2014-06-05 17:26 ` Matthias Brugger
  6 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-05 17:26 UTC (permalink / raw)
  To: linux-arm-kernel

The Aquaris5 is a mobile phone based on the MT6589 SoC.

Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 arch/arm/boot/dts/mt6589-aquaris5.dts |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 arch/arm/boot/dts/mt6589-aquaris5.dts

diff --git a/arch/arm/boot/dts/mt6589-aquaris5.dts b/arch/arm/boot/dts/mt6589-aquaris5.dts
new file mode 100644
index 0000000..443b446
--- /dev/null
+++ b/arch/arm/boot/dts/mt6589-aquaris5.dts
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014 MundoReader S.L.
+ * Author: Matthias Brugger <matthias.bgg@gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+#include "mt6589.dtsi"
+
+/ {
+	model = "bq Aquaris5";
+
+	memory {
+		reg = <0x80000000 0x40000000>;
+	};
+};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards
  2014-06-05 17:26 ` [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards Matthias Brugger
@ 2014-06-05 18:21   ` Mark Rutland
  2014-06-11 11:18     ` Matthias Brugger
  0 siblings, 1 reply; 16+ messages in thread
From: Mark Rutland @ 2014-06-05 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 05, 2014 at 06:26:19PM +0100, Matthias Brugger wrote:
> This adds a generic devicetree board file and a dtsi for boards
> based on MT6589 SoCs from Mediatek.
> 
> Apart from the generic parts (gic, clocks) the only component
> currently supported are the timers.
> 
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
>  arch/arm/Kconfig                  |    2 +
>  arch/arm/Makefile                 |    1 +
>  arch/arm/boot/dts/mt6589.dtsi     |   94 +++++++++++++++++++++++++++++++++++++
>  arch/arm/mach-mediatek/Kconfig    |    6 +++
>  arch/arm/mach-mediatek/Makefile   |    1 +
>  arch/arm/mach-mediatek/mediatek.c |   27 +++++++++++
>  6 files changed, 131 insertions(+)
>  create mode 100644 arch/arm/boot/dts/mt6589.dtsi
>  create mode 100644 arch/arm/mach-mediatek/Kconfig
>  create mode 100644 arch/arm/mach-mediatek/Makefile
>  create mode 100644 arch/arm/mach-mediatek/mediatek.c
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index db3c541..0fc8acd 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -997,6 +997,8 @@ source "arch/arm/mach-mv78xx0/Kconfig"
>  
>  source "arch/arm/mach-imx/Kconfig"
>  
> +source "arch/arm/mach-mediatek/Kconfig"
> +
>  source "arch/arm/mach-mxs/Kconfig"
>  
>  source "arch/arm/mach-netx/Kconfig"
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 41c1931..8ce9774 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_MSM)		+= msm
>  machine-$(CONFIG_ARCH_MV78XX0)		+= mv78xx0
>  machine-$(CONFIG_ARCH_MVEBU)		+= mvebu
>  machine-$(CONFIG_ARCH_MXC)		+= imx
> +machine-$(CONFIG_ARCH_MEDIATEK)		+= mediatek
>  machine-$(CONFIG_ARCH_MXS)		+= mxs
>  machine-$(CONFIG_ARCH_NETX)		+= netx
>  machine-$(CONFIG_ARCH_NOMADIK)		+= nomadik
> diff --git a/arch/arm/boot/dts/mt6589.dtsi b/arch/arm/boot/dts/mt6589.dtsi
> new file mode 100644
> index 0000000..f1d8a8b
> --- /dev/null
> +++ b/arch/arm/boot/dts/mt6589.dtsi
> @@ -0,0 +1,94 @@
> +/*
> + * Copyright (c) 2014 MundoReader S.L.
> + * Author: Matthias Brugger <matthias.bgg@gmail.com>
> + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <dt-bindings/interrupt-controller/irq.h>
> +#include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include "skeleton.dtsi"
> +
> +/ {
> +	compatible = "mediatek,mt6589";
> +	interrupt-parent = <&gic>;
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu at 0 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a7";
> +			reg = <0x0>;
> +		};
> +		cpu at 1 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a7";
> +			reg = <0x1>;
> +		};
> +		cpu at 2 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a7";
> +			reg = <0x2>;
> +		};
> +		cpu at 3 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a7";
> +			reg = <0x3>;
> +		};
> +
> +	};
> +
> +	clocks {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		ranges;

This is just nonsense. This /clocks node is in no way special -- /clocks
was never reserved as a place to put clocks that we guarantee to probe.
It's just an arbitrary containter node, and the fact we happen to probe
clocks under it is an implementation detail (and arguably a bug).

I argued in the past to at least have them as a simple-bus,
necessitating ranges, #address-cells, and #size-cells you have here, but
you'r missing the compatible = "simple-bus", rendering the exercise
pointless.

> +
> +		system_clk: dummy13m {
> +			compatible = "fixed-clock";
> +			clock-frequency = <13000000>;
> +			#clock-cells = <0>;
> +		};
> +
> +		rtc_clk: dummy32k {
> +			compatible = "fixed-clock";
> +			clock-frequency = <32000>;
> +			#clock-cells = <0>;
> +		};
> +	};
> +
> +	soc {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		compatible = "simple-bus";
> +		clock-ranges;

Why the clock-ranges? You refer to them explicitly below.

> +		ranges;
> +
> +		timer: timer at 10008000 {
> +			compatible = "mediatek,mt6577-timer";
> +			reg = <0x10008000 0x80>;
> +			interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>;
> +			clocks = <&system_clk>, <&rtc_clk>;
> +			clock-names = "system-clk", "rtc-clk";
> +		};
> +
> +		gic: interrupt-controller at 10212000 {
> +			compatible = "arm,cortex-a15-gic";
> +			interrupt-controller;
> +			#interrupt-cells = <3>;
> +			reg = <0x10211000 0x1000>,
> +			      <0x10212000 0x1000>,
> +			      <0x10214000 0x2000>,
> +			      <0x10216000 0x2000>;
> +		};
> +	};
> +};

No architected timers?


> diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
> new file mode 100644
> index 0000000..2c043a2
> --- /dev/null
> +++ b/arch/arm/mach-mediatek/Kconfig
> @@ -0,0 +1,6 @@
> +config ARCH_MEDIATEK
> +	bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7
> +	select ARM_GIC
> +	select MTK_TIMER
> +	help
> +	  Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.
> diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
> new file mode 100644
> index 0000000..43e619f
> --- /dev/null
> +++ b/arch/arm/mach-mediatek/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
> diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
> new file mode 100644
> index 0000000..f2acf07
> --- /dev/null
> +++ b/arch/arm/mach-mediatek/mediatek.c
> @@ -0,0 +1,27 @@
> +/*
> + * Device Tree support for Mediatek SoCs
> + *
> + * Copyright (c) 2014 MundoReader S.L.
> + * Author: Matthias Brugger <matthias.bgg@gmail.com>
> + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +#include <linux/init.h>
> +#include <asm/mach/arch.h>
> +
> +static const char * const mediatek_board_dt_compat[] = {
> +	"mediatek,mt6589",
> +	NULL,
> +};
> +
> +DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
> +	.dt_compat	= mediatek_board_dt_compat,
> +MACHINE_END

If this is all we have, surely we can get by with the defaults?

Cheers,
Mark.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-05 17:26 ` [PATCH v7 1/7] of: Provide function to request and map memory Matthias Brugger
@ 2014-06-06 15:19   ` Rob Herring
  2014-06-06 16:56     ` Randy Dunlap
  2014-06-07  5:59     ` Grant Likely
  0 siblings, 2 replies; 16+ messages in thread
From: Rob Herring @ 2014-06-06 15:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
<matthias.bgg@gmail.com> wrote:
> A call to of_iomap does not request the memory region.
> This patch adds the function of_io_request_and_map which requests
> the memory region before mapping it.
>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
>  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
>  include/linux/of_address.h |    8 ++++++++
>  2 files changed, 36 insertions(+)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index cb4242a..c55b107 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
>         return ioremap(res.start, resource_size(&res));
>  }
>  EXPORT_SYMBOL(of_iomap);
> +
> +/**
> + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
> + *                        for a given device_node

I believe docbook requires this to be 1 line.

> + * @device:    the device whose io range will be mapped
> + * @index:     index of the io range
> + * @name:      name of the resource
> + *
> + * Returns a pointer to the requested and mapped memory
> + */
> +void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
> +{
> +       struct resource res;
> +       void __iomem *mem;
> +
> +       if (of_address_to_resource(np, index, &res))
> +               return NULL;
> +
> +       if (!request_mem_region(res.start, resource_size(&res), name))

Use the np->name here and drop the name parameter.

> +               return NULL;
> +
> +       mem = ioremap(res.start, resource_size(&res));
> +       if (!mem)
> +               release_mem_region(res.start, resource_size(&res));
> +
> +       return mem;
> +}
> +EXPORT_SYMBOL(of_io_request_and_map);
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index 5f6ed6b..725b875 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -96,6 +96,8 @@ static inline struct of_pci_range *of_pci_range_parser_one(
>  extern int of_address_to_resource(struct device_node *dev, int index,
>                                   struct resource *r);
>  void __iomem *of_iomap(struct device_node *node, int index);
> +void __iomem *of_io_request_and_map(struct device_node *device,
> +                                       int index, char *name);
>  #else
>  static inline int of_address_to_resource(struct device_node *dev, int index,
>                                          struct resource *r)
> @@ -107,6 +109,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
>  {
>         return NULL;
>  }
> +
> +static inline void __iomem *of_io_request_and_map(struct device_node *device,
> +                                       int index, char *name)
> +{
> +       return NULL;
> +}
>  #endif
>
>  #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
> --
> 1.7.9.5
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-06 15:19   ` Rob Herring
@ 2014-06-06 16:56     ` Randy Dunlap
  2014-06-07  5:59     ` Grant Likely
  1 sibling, 0 replies; 16+ messages in thread
From: Randy Dunlap @ 2014-06-06 16:56 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/06/2014 08:19 AM, Rob Herring wrote:
> On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
> <matthias.bgg@gmail.com> wrote:
>> A call to of_iomap does not request the memory region.
>> This patch adds the function of_io_request_and_map which requests
>> the memory region before mapping it.
>>
>> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>> ---
>>  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
>>  include/linux/of_address.h |    8 ++++++++
>>  2 files changed, 36 insertions(+)
>>
>> diff --git a/drivers/of/address.c b/drivers/of/address.c
>> index cb4242a..c55b107 100644
>> --- a/drivers/of/address.c
>> +++ b/drivers/of/address.c
>> @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
>>         return ioremap(res.start, resource_size(&res));
>>  }
>>  EXPORT_SYMBOL(of_iomap);
>> +
>> +/**
>> + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
>> + *                        for a given device_node
> 
> I believe docbook requires this to be 1 line.

No longer so.  That was fixed a couple of years ago.


-- 
~Randy

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-06 15:19   ` Rob Herring
  2014-06-06 16:56     ` Randy Dunlap
@ 2014-06-07  5:59     ` Grant Likely
  2014-06-09 14:36       ` Rob Herring
  1 sibling, 1 reply; 16+ messages in thread
From: Grant Likely @ 2014-06-07  5:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 6 Jun 2014 10:19:28 -0500, Rob Herring <robherring2@gmail.com> wrote:
> On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
> <matthias.bgg@gmail.com> wrote:
> > A call to of_iomap does not request the memory region.
> > This patch adds the function of_io_request_and_map which requests
> > the memory region before mapping it.
> >
> > Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> > ---
> >  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
> >  include/linux/of_address.h |    8 ++++++++
> >  2 files changed, 36 insertions(+)
> >
> > diff --git a/drivers/of/address.c b/drivers/of/address.c
> > index cb4242a..c55b107 100644
> > --- a/drivers/of/address.c
> > +++ b/drivers/of/address.c
> > @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
> >         return ioremap(res.start, resource_size(&res));
> >  }
> >  EXPORT_SYMBOL(of_iomap);
> > +
> > +/**
> > + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
> > + *                        for a given device_node
> 
> I believe docbook requires this to be 1 line.
> 
> > + * @device:    the device whose io range will be mapped
> > + * @index:     index of the io range
> > + * @name:      name of the resource
> > + *
> > + * Returns a pointer to the requested and mapped memory
> > + */
> > +void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
> > +{
> > +       struct resource res;
> > +       void __iomem *mem;
> > +
> > +       if (of_address_to_resource(np, index, &res))
> > +               return NULL;
> > +
> > +       if (!request_mem_region(res.start, resource_size(&res), name))
> 
> Use the np->name here and drop the name parameter.

Name here would be the name of the owner (the driver), not the name of
the node. Passing the name separately is fine by me.

Acked-by: Grant Likely <grant.likely@linaro.org>

You can merge this with the rest of the series.

g.

> 
> > +               return NULL;
> > +
> > +       mem = ioremap(res.start, resource_size(&res));
> > +       if (!mem)
> > +               release_mem_region(res.start, resource_size(&res));
> > +
> > +       return mem;
> > +}
> > +EXPORT_SYMBOL(of_io_request_and_map);
> > diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> > index 5f6ed6b..725b875 100644
> > --- a/include/linux/of_address.h
> > +++ b/include/linux/of_address.h
> > @@ -96,6 +96,8 @@ static inline struct of_pci_range *of_pci_range_parser_one(
> >  extern int of_address_to_resource(struct device_node *dev, int index,
> >                                   struct resource *r);
> >  void __iomem *of_iomap(struct device_node *node, int index);
> > +void __iomem *of_io_request_and_map(struct device_node *device,
> > +                                       int index, char *name);
> >  #else
> >  static inline int of_address_to_resource(struct device_node *dev, int index,
> >                                          struct resource *r)
> > @@ -107,6 +109,12 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
> >  {
> >         return NULL;
> >  }
> > +
> > +static inline void __iomem *of_io_request_and_map(struct device_node *device,
> > +                                       int index, char *name)
> > +{
> > +       return NULL;
> > +}
> >  #endif
> >
> >  #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
> > --
> > 1.7.9.5
> >
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-07  5:59     ` Grant Likely
@ 2014-06-09 14:36       ` Rob Herring
  2014-06-09 15:02         ` Matthias Brugger
  2014-06-10 12:31         ` Grant Likely
  0 siblings, 2 replies; 16+ messages in thread
From: Rob Herring @ 2014-06-09 14:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Jun 7, 2014 at 12:59 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Fri, 6 Jun 2014 10:19:28 -0500, Rob Herring <robherring2@gmail.com> wrote:
>> On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
>> <matthias.bgg@gmail.com> wrote:
>> > A call to of_iomap does not request the memory region.
>> > This patch adds the function of_io_request_and_map which requests
>> > the memory region before mapping it.
>> >
>> > Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>> > ---
>> >  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
>> >  include/linux/of_address.h |    8 ++++++++
>> >  2 files changed, 36 insertions(+)
>> >
>> > diff --git a/drivers/of/address.c b/drivers/of/address.c
>> > index cb4242a..c55b107 100644
>> > --- a/drivers/of/address.c
>> > +++ b/drivers/of/address.c
>> > @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
>> >         return ioremap(res.start, resource_size(&res));
>> >  }
>> >  EXPORT_SYMBOL(of_iomap);
>> > +
>> > +/**
>> > + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
>> > + *                        for a given device_node
>>
>> I believe docbook requires this to be 1 line.
>>
>> > + * @device:    the device whose io range will be mapped
>> > + * @index:     index of the io range
>> > + * @name:      name of the resource
>> > + *
>> > + * Returns a pointer to the requested and mapped memory
>> > + */
>> > +void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
>> > +{
>> > +       struct resource res;
>> > +       void __iomem *mem;
>> > +
>> > +       if (of_address_to_resource(np, index, &res))
>> > +               return NULL;
>> > +
>> > +       if (!request_mem_region(res.start, resource_size(&res), name))
>>
>> Use the np->name here and drop the name parameter.
>
> Name here would be the name of the owner (the driver), not the name of
> the node. Passing the name separately is fine by me.

This function is for when there is no driver. If there is a driver,
the devm_* functions should be used. I would like to see some standard
naming and consistency here rather than allowing random strings or
NULL to be passed by the caller.

Rob

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-09 14:36       ` Rob Herring
@ 2014-06-09 15:02         ` Matthias Brugger
  2014-06-10 12:31         ` Grant Likely
  1 sibling, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-09 15:02 UTC (permalink / raw)
  To: linux-arm-kernel

2014-06-09 16:36 GMT+02:00 Rob Herring <robherring2@gmail.com>:
> On Sat, Jun 7, 2014 at 12:59 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On Fri, 6 Jun 2014 10:19:28 -0500, Rob Herring <robherring2@gmail.com> wrote:
>>> On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
>>> <matthias.bgg@gmail.com> wrote:
>>> > A call to of_iomap does not request the memory region.
>>> > This patch adds the function of_io_request_and_map which requests
>>> > the memory region before mapping it.
>>> >
>>> > Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>>> > ---
>>> >  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
>>> >  include/linux/of_address.h |    8 ++++++++
>>> >  2 files changed, 36 insertions(+)
>>> >
>>> > diff --git a/drivers/of/address.c b/drivers/of/address.c
>>> > index cb4242a..c55b107 100644
>>> > --- a/drivers/of/address.c
>>> > +++ b/drivers/of/address.c
>>> > @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
>>> >         return ioremap(res.start, resource_size(&res));
>>> >  }
>>> >  EXPORT_SYMBOL(of_iomap);
>>> > +
>>> > +/**
>>> > + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
>>> > + *                        for a given device_node
>>>
>>> I believe docbook requires this to be 1 line.
>>>
>>> > + * @device:    the device whose io range will be mapped
>>> > + * @index:     index of the io range
>>> > + * @name:      name of the resource
>>> > + *
>>> > + * Returns a pointer to the requested and mapped memory
>>> > + */
>>> > +void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
>>> > +{
>>> > +       struct resource res;
>>> > +       void __iomem *mem;
>>> > +
>>> > +       if (of_address_to_resource(np, index, &res))
>>> > +               return NULL;
>>> > +
>>> > +       if (!request_mem_region(res.start, resource_size(&res), name))
>>>
>>> Use the np->name here and drop the name parameter.
>>
>> Name here would be the name of the owner (the driver), not the name of
>> the node. Passing the name separately is fine by me.
>
> This function is for when there is no driver. If there is a driver,
> the devm_* functions should be used. I would like to see some standard
> naming and consistency here rather than allowing random strings or
> NULL to be passed by the caller.

A driver can request and map more then one memory region, so it is
convenient that they have different names. Therefor the extra
parameter.
Another possibility would be to use np->name together with the index
to get unique names for every region requested by the driver

Regards,
Matthias

-- 
motzblog.wordpress.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 1/7] of: Provide function to request and map memory
  2014-06-09 14:36       ` Rob Herring
  2014-06-09 15:02         ` Matthias Brugger
@ 2014-06-10 12:31         ` Grant Likely
  1 sibling, 0 replies; 16+ messages in thread
From: Grant Likely @ 2014-06-10 12:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 9, 2014 at 3:36 PM, Rob Herring <robherring2@gmail.com> wrote:
> On Sat, Jun 7, 2014 at 12:59 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
>> On Fri, 6 Jun 2014 10:19:28 -0500, Rob Herring <robherring2@gmail.com> wrote:
>>> On Thu, Jun 5, 2014 at 12:26 PM, Matthias Brugger
>>> <matthias.bgg@gmail.com> wrote:
>>> > A call to of_iomap does not request the memory region.
>>> > This patch adds the function of_io_request_and_map which requests
>>> > the memory region before mapping it.
>>> >
>>> > Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>>> > ---
>>> >  drivers/of/address.c       |   28 ++++++++++++++++++++++++++++
>>> >  include/linux/of_address.h |    8 ++++++++
>>> >  2 files changed, 36 insertions(+)
>>> >
>>> > diff --git a/drivers/of/address.c b/drivers/of/address.c
>>> > index cb4242a..c55b107 100644
>>> > --- a/drivers/of/address.c
>>> > +++ b/drivers/of/address.c
>>> > @@ -721,3 +721,31 @@ void __iomem *of_iomap(struct device_node *np, int index)
>>> >         return ioremap(res.start, resource_size(&res));
>>> >  }
>>> >  EXPORT_SYMBOL(of_iomap);
>>> > +
>>> > +/**
>>> > + * of_io_request_and_map - Requests a resource and maps the memory mapped IO
>>> > + *                        for a given device_node
>>>
>>> I believe docbook requires this to be 1 line.
>>>
>>> > + * @device:    the device whose io range will be mapped
>>> > + * @index:     index of the io range
>>> > + * @name:      name of the resource
>>> > + *
>>> > + * Returns a pointer to the requested and mapped memory
>>> > + */
>>> > +void __iomem *of_io_request_and_map(struct device_node *np, int index, char *name)
>>> > +{
>>> > +       struct resource res;
>>> > +       void __iomem *mem;
>>> > +
>>> > +       if (of_address_to_resource(np, index, &res))
>>> > +               return NULL;
>>> > +
>>> > +       if (!request_mem_region(res.start, resource_size(&res), name))
>>>
>>> Use the np->name here and drop the name parameter.
>>
>> Name here would be the name of the owner (the driver), not the name of
>> the node. Passing the name separately is fine by me.
>
> This function is for when there is no driver. If there is a driver,
> the devm_* functions should be used. I would like to see some standard
> naming and consistency here rather than allowing random strings or
> NULL to be passed by the caller.

The node name doesn't provide a whole lot of help here though because
we want to identify the code creating the resource, not the node. I'm
not going to make a big deal about it. I've told Matthias on IRC that
he can go ahead and merge it because it is a very minor issue. If you
feel strongly about it, then we'll get him to change it or do a
follow-up patch to change the function signature.

g.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards
  2014-06-05 18:21   ` Mark Rutland
@ 2014-06-11 11:18     ` Matthias Brugger
  0 siblings, 0 replies; 16+ messages in thread
From: Matthias Brugger @ 2014-06-11 11:18 UTC (permalink / raw)
  To: linux-arm-kernel

2014-06-05 20:21 GMT+02:00 Mark Rutland <mark.rutland@arm.com>:
> On Thu, Jun 05, 2014 at 06:26:19PM +0100, Matthias Brugger wrote:
>> This adds a generic devicetree board file and a dtsi for boards
>> based on MT6589 SoCs from Mediatek.
>>
>> Apart from the generic parts (gic, clocks) the only component
>> currently supported are the timers.
>>
>> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>> ---
>>  arch/arm/Kconfig                  |    2 +
>>  arch/arm/Makefile                 |    1 +
>>  arch/arm/boot/dts/mt6589.dtsi     |   94 +++++++++++++++++++++++++++++++++++++
>>  arch/arm/mach-mediatek/Kconfig    |    6 +++
>>  arch/arm/mach-mediatek/Makefile   |    1 +
>>  arch/arm/mach-mediatek/mediatek.c |   27 +++++++++++
>>  6 files changed, 131 insertions(+)
>>  create mode 100644 arch/arm/boot/dts/mt6589.dtsi
>>  create mode 100644 arch/arm/mach-mediatek/Kconfig
>>  create mode 100644 arch/arm/mach-mediatek/Makefile
>>  create mode 100644 arch/arm/mach-mediatek/mediatek.c
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index db3c541..0fc8acd 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -997,6 +997,8 @@ source "arch/arm/mach-mv78xx0/Kconfig"
>>
>>  source "arch/arm/mach-imx/Kconfig"
>>
>> +source "arch/arm/mach-mediatek/Kconfig"
>> +
>>  source "arch/arm/mach-mxs/Kconfig"
>>
>>  source "arch/arm/mach-netx/Kconfig"
>> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
>> index 41c1931..8ce9774 100644
>> --- a/arch/arm/Makefile
>> +++ b/arch/arm/Makefile
>> @@ -170,6 +170,7 @@ machine-$(CONFIG_ARCH_MSM)                += msm
>>  machine-$(CONFIG_ARCH_MV78XX0)               += mv78xx0
>>  machine-$(CONFIG_ARCH_MVEBU)         += mvebu
>>  machine-$(CONFIG_ARCH_MXC)           += imx
>> +machine-$(CONFIG_ARCH_MEDIATEK)              += mediatek
>>  machine-$(CONFIG_ARCH_MXS)           += mxs
>>  machine-$(CONFIG_ARCH_NETX)          += netx
>>  machine-$(CONFIG_ARCH_NOMADIK)               += nomadik
>> diff --git a/arch/arm/boot/dts/mt6589.dtsi b/arch/arm/boot/dts/mt6589.dtsi
>> new file mode 100644
>> index 0000000..f1d8a8b
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/mt6589.dtsi
>> @@ -0,0 +1,94 @@
>> +/*
>> + * Copyright (c) 2014 MundoReader S.L.
>> + * Author: Matthias Brugger <matthias.bgg@gmail.com>
>> + *
>> + * 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.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + */
>> +
>> +#include <dt-bindings/interrupt-controller/irq.h>
>> +#include <dt-bindings/interrupt-controller/arm-gic.h>
>> +#include "skeleton.dtsi"
>> +
>> +/ {
>> +     compatible = "mediatek,mt6589";
>> +     interrupt-parent = <&gic>;
>> +
>> +     cpus {
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +
>> +             cpu at 0 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a7";
>> +                     reg = <0x0>;
>> +             };
>> +             cpu at 1 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a7";
>> +                     reg = <0x1>;
>> +             };
>> +             cpu at 2 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a7";
>> +                     reg = <0x2>;
>> +             };
>> +             cpu at 3 {
>> +                     device_type = "cpu";
>> +                     compatible = "arm,cortex-a7";
>> +                     reg = <0x3>;
>> +             };
>> +
>> +     };
>> +
>> +     clocks {
>> +             #address-cells = <1>;
>> +             #size-cells = <1>;
>> +             ranges;
>
> This is just nonsense. This /clocks node is in no way special -- /clocks
> was never reserved as a place to put clocks that we guarantee to probe.
> It's just an arbitrary containter node, and the fact we happen to probe
> clocks under it is an implementation detail (and arguably a bug).
>
> I argued in the past to at least have them as a simple-bus,
> necessitating ranges, #address-cells, and #size-cells you have here, but
> you'r missing the compatible = "simple-bus", rendering the exercise
> pointless.
>
>> +
>> +             system_clk: dummy13m {
>> +                     compatible = "fixed-clock";
>> +                     clock-frequency = <13000000>;
>> +                     #clock-cells = <0>;
>> +             };
>> +
>> +             rtc_clk: dummy32k {
>> +                     compatible = "fixed-clock";
>> +                     clock-frequency = <32000>;
>> +                     #clock-cells = <0>;
>> +             };
>> +     };
>> +
>> +     soc {
>> +             #address-cells = <1>;
>> +             #size-cells = <1>;
>> +             compatible = "simple-bus";
>> +             clock-ranges;
>
> Why the clock-ranges? You refer to them explicitly below.
>
>> +             ranges;
>> +
>> +             timer: timer at 10008000 {
>> +                     compatible = "mediatek,mt6577-timer";
>> +                     reg = <0x10008000 0x80>;
>> +                     interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>;
>> +                     clocks = <&system_clk>, <&rtc_clk>;
>> +                     clock-names = "system-clk", "rtc-clk";
>> +             };
>> +
>> +             gic: interrupt-controller at 10212000 {
>> +                     compatible = "arm,cortex-a15-gic";
>> +                     interrupt-controller;
>> +                     #interrupt-cells = <3>;
>> +                     reg = <0x10211000 0x1000>,
>> +                           <0x10212000 0x1000>,
>> +                           <0x10214000 0x2000>,
>> +                           <0x10216000 0x2000>;
>> +             };
>> +     };
>> +};
>
> No architected timers?

I was trying to get the arch timer working [0], but unfortunately with no luck.

[0] http://article.gmane.org/gmane.linux.ports.arm.kernel/321976

>
>
>> diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
>> new file mode 100644
>> index 0000000..2c043a2
>> --- /dev/null
>> +++ b/arch/arm/mach-mediatek/Kconfig
>> @@ -0,0 +1,6 @@
>> +config ARCH_MEDIATEK
>> +     bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7
>> +     select ARM_GIC
>> +     select MTK_TIMER
>> +     help
>> +       Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.
>> diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
>> new file mode 100644
>> index 0000000..43e619f
>> --- /dev/null
>> +++ b/arch/arm/mach-mediatek/Makefile
>> @@ -0,0 +1 @@
>> +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
>> diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
>> new file mode 100644
>> index 0000000..f2acf07
>> --- /dev/null
>> +++ b/arch/arm/mach-mediatek/mediatek.c
>> @@ -0,0 +1,27 @@
>> +/*
>> + * Device Tree support for Mediatek SoCs
>> + *
>> + * Copyright (c) 2014 MundoReader S.L.
>> + * Author: Matthias Brugger <matthias.bgg@gmail.com>
>> + *
>> + * 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.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> + * GNU General Public License for more details.
>> + */
>> +#include <linux/init.h>
>> +#include <asm/mach/arch.h>
>> +
>> +static const char * const mediatek_board_dt_compat[] = {
>> +     "mediatek,mt6589",
>> +     NULL,
>> +};
>> +
>> +DT_MACHINE_START(MEDIATEK_DT, "Mediatek Cortex-A7 (Device Tree)")
>> +     .dt_compat      = mediatek_board_dt_compat,
>> +MACHINE_END
>
> If this is all we have, surely we can get by with the defaults?

We reach to the point where the bootconsole gets disabled. Due to the
still missing console driver, we get stuck there.

Best regards,
Matthias

>
> Cheers,
> Mark.
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



-- 
motzblog.wordpress.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-06-11 11:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-05 17:26 [PATCH v7 0/7] arm: Add basic support for Mediatek Cortex-A7 SoCs Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 1/7] of: Provide function to request and map memory Matthias Brugger
2014-06-06 15:19   ` Rob Herring
2014-06-06 16:56     ` Randy Dunlap
2014-06-07  5:59     ` Grant Likely
2014-06-09 14:36       ` Rob Herring
2014-06-09 15:02         ` Matthias Brugger
2014-06-10 12:31         ` Grant Likely
2014-06-05 17:26 ` [PATCH v7 2/7] clocksource: Add support for the Mediatek SoCs Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 3/7] dt-bindings: add mtk-timer bindings Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 4/7] vendor-prefixes: add prefix for Mediaktek Inc Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 5/7] arm: add basic support for Mediatek MT6589 boards Matthias Brugger
2014-06-05 18:21   ` Mark Rutland
2014-06-11 11:18     ` Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 6/7] dt-bindings: add documentation for Mediatek SoC Matthias Brugger
2014-06-05 17:26 ` [PATCH v7 7/7] arm: mediatek: add dts for Aquaris5 mobile phone Matthias Brugger

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).