arm: Add basic support for Mediatek Cortex-A7 SoCs
Subsystems (5)
Matthias Brugger
maintainercover arm: Add basic support for Mediatek Cortex-A7 SoCs
This patch set adds basic support for the Mediatek Cortex-A7 SoCs. Support is quite basic, as the only components working up to now are the timers and the low-level debug via UART.
The patch series is build against torvalds/master tree
Matthias Brugger (4):
clocksource: Add support for the Mediatek SoCs
dt-bindings: add mtk-timer bindings
arm: add basic support for Mediatek MT6589 boards
arm: mediatek: Add earlyprintk support for MT6589
.../bindings/timer/mediatek,mtk-timer.txt | 19 ++ .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Kconfig.debug | 49 +++- arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 +++++++++ arch/arm/include/debug/mediatek.S | 38 +++ arch/arm/mach-mediatek/Kconfig | 14 ++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++ drivers/clocksource/Kconfig | 4 + drivers/clocksource/Makefile | 1 + drivers/clocksource/mtk_timer.c | 248 ++++++++++++++++++++ 13 files changed, 521 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt create mode 100644 arch/arm/boot/dts/mtk6589.dtsi create mode 100644 arch/arm/include/debug/mediatek.S 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
Signature · 1 line
1.7.9.5
Matthias Brugger
maintainerPATCH 1/4 clocksource: Add support for the Mediatek SoCs
This patch adds a clock source and clock event for the timer found on the Mediatek SoCs.
The Mediatek General Porpose Timer block provides five 32 bit timers and one 64 bit timer.
Two 32 bit timers are used:
TIMER1: clock events supporting periodic and oneshot events
TIMER2: clock source configured as a free running counter
The General Porpose 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.
--- drivers/clocksource/Kconfig | 4 + drivers/clocksource/Makefile | 1 + drivers/clocksource/mtk_timer.c | 248 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 drivers/clocksource/mtk_timer.c
drivers/clocksource/Kconfig +4 -0
@@ -144,6 +144,10 @@ config VF_PIT_TIMER config SYS_SUPPORTS_SH_CMT bool +config MTK_TIMER + bool + + config SYS_SUPPORTS_SH_MTU2 bool
drivers/clocksource/Makefile +1 -0
@@ -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
drivers/clocksource/mtk_timer.c new file +248 -0
248 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 1/4] clocksource: Add support for the Mediatek SoCs
drivers/clocksource/Kconfig config VF_PIT_TIMER · line 150
Quoted 12 lines · Matthias Brugger
drivers/clocksource/Kconfig +4
-0@@ -144,6 +144,10 @@ config VF_PIT_TIMER config SYS_SUPPORTS_SH_CMT bool +config MTK_TIMER + bool + +
Why two newlines?
drivers/clocksource/mtk_timer.c line 7
Quoted 13 lines
drivers/clocksource/mtk_timer.c new file +7
-0@@ -0,0 +1,248 @@ + +#include <linux/clk.h> +#include <linux/clockchips.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/irqreturn.h> +#include <linux/sched_clock.h>
Were you planning on registering a sched_clock source?
Quoted 4 lines
drivers/clocksource/mtk_timer.c new file +4
-0+#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> +
[...]
drivers/clocksource/mtk_timer.c line 141
Quoted 5 lines
drivers/clocksource/mtk_timer.c new file +5
-0+ +static struct clock_event_device mtk_clockevent = { + .name ="mtk_tick" , + .rating =300 , + .shift =32 ,
This is unnecessary as it's handled byclockevents_config_and_register().
drivers/clocksource/mtk_timer.c line 150
Quoted 9 lines
drivers/clocksource/mtk_timer.c new file +9
-0+ .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_mode = mtk_clkevt_mode, + .set_next_event = mtk_clkevt_next_event, +}; + + +static irqreturn_t mtk_timer_interrupt (int irq,void *dev_id) +{ +struct clock_event_device *evt = (struct clock_event_device *)dev_id;
Unnecessary cast from void.
Quoted 8 lines
drivers/clocksource/mtk_timer.c new file +8
-0+ +/* Acknowledge timer0 irq */ +writel (GPT_IRQ_ACK (GPT_CLK_EVT ), gpt_base +GPT_IRQ_ACK_REG ); + evt->event_handler (evt); + +return IRQ_HANDLED ; +} +
[...]
drivers/clocksource/mtk_timer.c line 176
Quoted 4 lines
drivers/clocksource/mtk_timer.c new file +4
-0+ +static struct irqaction mtk_timer_irq = { + .name ="mtk_timer0" , + .flags =IRQF_DISABLED |IRQF_TIMER |IRQF_IRQPOLL ,
IRQF_DISABLED is a nop. Remove it.
drivers/clocksource/mtk_timer.c line 184
Quoted 8 lines
drivers/clocksource/mtk_timer.c new file +8
-0+ .handler = mtk_timer_interrupt, + .dev_id = &mtk_clockevent, +}; + +static u32 mtk_timer_sched_read (void ) +{ +return readl (gpt_base +TIMER_CNT_REG (GPT_CLK_SRC )); +}
This is unused unless you register a sched_clock source.
Quoted 40 lines
drivers/clocksource/mtk_timer.c new file +40
-0+ +static void __init mtk_timer_init (struct device_node *node) +{ +unsigned long rate =0 ; +struct clk *clk; +int ret, irq; +u32 val; + + gpt_base =of_iomap (node,0 ); +if (!gpt_base) +panic ("Can't map registers" ); + + irq =irq_of_parse_and_map (node,0 ); +if (irq <=0 ) +panic ("Can't parse IRQ" ); + + clk =of_clk_get_by_name (node,"sys_clk" ); +if (IS_ERR (clk)) +panic ("Can't get timer clock" ); +clk_prepare_enable (clk); + + rate =clk_get_rate (clk); + +mtk_timer_global_reset (); + +/* Configure clock source */ +mtk_timer_reset (GPT_CLK_SRC ); + +writel (TIMER_CLK_SRC (TIMER_CLK_SRC_SYS13M ) |TIMER_CLK_DIV1 , + gpt_base +TIMER_CLK_REG (GPT_CLK_SRC )); + +writel (TIMER_CTRL_OP (TIMER_CTRL_OP_FREERUN ) |TIMER_CTRL_ENABLE , + gpt_base +TIMER_CTRL_REG (GPT_CLK_SRC )); + +clocksource_mmio_init (gpt_base +TIMER_CNT_REG (GPT_CLK_SRC ), node->name, + rate,300 ,32 , clocksource_mmio_readl_up); + + ticks_per_jiffy =DIV_ROUND_UP (rate,HZ ); + +/* Configure clock event */
drivers/clocksource/mtk_timer.c line 234
Quoted 10 lines
drivers/clocksource/mtk_timer.c new file +10
-0+mtk_timer_reset (GPT_CLK_EVT ); + +writel (TIMER_CLK_SRC (TIMER_CLK_SRC_SYS13M ) |TIMER_CLK_DIV1 , + gpt_base +TIMER_CLK_REG (GPT_CLK_EVT )); +writel (0 , gpt_base +TIMER_CMP_REG (GPT_CLK_EVT )); + +writel (TIMER_CTRL_OP (TIMER_CTRL_OP_REPEAT ) |TIMER_CTRL_ENABLE , + gpt_base +TIMER_CTRL_REG (GPT_CLK_EVT )); + + ret =setup_irq (irq, &mtk_timer_irq);
Most clocksource drivers use request_irq() nowadays. Can you use that?
drivers/clocksource/mtk_timer.c line 242
Quoted 8 lines
drivers/clocksource/mtk_timer.c new file +8
-0+if (ret) +pr_warn ("failed to setup irq %d\n" , irq); + +/* Enable timer0 interrupt */ + val =readl (gpt_base +GPT_IRQ_EN_REG ); +writel (val |GPT_IRQ_ENABLE (GPT_CLK_EVT ), gpt_base +GPT_IRQ_EN_REG ); + + mtk_clockevent.cpumask =cpumask_of (0 );
Is it possible for this timer to be used on SMP hardware? If so, this should probably be cpu_all_mask. Please assign the .irq member here as well.
Quoted 4 lines
drivers/clocksource/mtk_timer.c new file +4
-0+ +clockevents_config_and_register (&mtk_clockevent, rate,0x3 , +0xffffffff ); +}
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 1/4] clocksource: Add support for the Mediatek SoCs
In reply to Matthias BruggerHi Matthias,
Quoted 238 lines · Matthias Brugger
This patch adds a clock source and clock event for the timer found on the Mediatek SoCs.
The Mediatek General Porpose Timer block provides five 32 bit timers and one 64 bit timer.
Two 32 bit timers are used:
TIMER1: clock events supporting periodic and oneshot events
TIMER2: clock source configured as a free running counterThe General Porpose 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.
Signed-off-by Matthias Brugger <[email protected]>--- drivers/clocksource/Kconfig | 4 + drivers/clocksource/Makefile | 1 + drivers/clocksource/mtk_timer.c | 248 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 drivers/clocksource/mtk_timer.cdrivers/clocksource/Kconfig +4
-0@@ -144,6 +144,10 @@ config VF_PIT_TIMER config SYS_SUPPORTS_SH_CMT bool +config MTK_TIMER + bool + + config SYS_SUPPORTS_SH_MTU2 booldrivers/clocksource/Makefile +1
-0@@ -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.odrivers/clocksource/mtk_timer.c new file +183
-0@@ -0,0 +1,248 @@ +/* +* Mediatek SoCs General-Purpose Timer handling. +* +* Copyright (C) 2014 Matthias Brugger +* +* Matthias Brugger <[email protected]> +* +* 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/sched_clock.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_irq.h> + +#define GPT_IRQ_EN_REG 0x00 +#define GPT_IRQ_ENABLE (val) BIT(val-1) +#define GPT_IRQ_ST_REG 0x04 +#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_KEEPGO (2) +#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_CLK_DIV3 (0x2) +#define TIMER_CLK_DIV4 (0x3) +#define TIMER_CLK_DIV5 (0x4) +#define TIMER_CLK_DIV6 (0x5) +#define TIMER_CLK_DIV7 (0x6) +#define TIMER_CLK_DIV8 (0x7) +#define TIMER_CLK_DIV9 (0x8) +#define TIMER_CLK_DIV10 (0x9) +#define TIMER_CLK_DIV11 (0xA) +#define TIMER_CLK_DIV12 (0xB) +#define TIMER_CLK_DIV13 (0xC) +#define TIMER_CLK_DIV16 (0xD) +#define TIMER_CLK_DIV32 (0xE) +#define TIMER_CLK_DIV64 (0xF) + +#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 + +static void __iomem *gpt_base; +static u32 ticks_per_jiffy; + +static void mtk_clkevt_time_stop (u8 timer) +{ +u32 val =readl (gpt_base +TIMER_CTRL_REG (timer)); +writel (val & ~TIMER_CTRL_ENABLE , gpt_base +TIMER_CTRL_REG (timer)); +} + +static void mtk_clkevt_time_setup (unsigned long delay,u8 timer) +{ +writel (delay, gpt_base +TIMER_CMP_REG (timer)); +} + +static void mtk_clkevt_time_start (bool periodic,u8 timer) +{ +u32 val; + +/* Acknowledge interrupt */ +writel (GPT_IRQ_ACK (timer), gpt_base +GPT_IRQ_ACK_REG ); + + val =readl (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 , + gpt_base +TIMER_CTRL_REG (timer)); +} + +static void mtk_clkevt_mode (enum clock_event_mode mode, +struct clock_event_device *clk) +{ +mtk_clkevt_time_stop (GPT_CLK_EVT ); + +switch (mode) { +case CLOCK_EVT_MODE_PERIODIC : +mtk_clkevt_time_setup (ticks_per_jiffy,GPT_CLK_EVT ); +mtk_clkevt_time_start (true,GPT_CLK_EVT ); +break ; +case CLOCK_EVT_MODE_ONESHOT : +mtk_clkevt_time_start (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 evt, +struct clock_event_device *unused) +{ +mtk_clkevt_time_stop (GPT_CLK_EVT ); +mtk_clkevt_time_setup (evt,GPT_CLK_EVT ); +mtk_clkevt_time_start (false,GPT_CLK_EVT ); + +return 0 ; +} + +static struct clock_event_device mtk_clockevent = { + .name ="mtk_tick" , + .rating =300 , + .shift =32 , + .features =CLOCK_EVT_FEAT_PERIODIC |CLOCK_EVT_FEAT_ONESHOT , + .set_mode = mtk_clkevt_mode, + .set_next_event = mtk_clkevt_next_event, +}; + + +static irqreturn_t mtk_timer_interrupt (int irq,void *dev_id) +{ +struct clock_event_device *evt = (struct clock_event_device *)dev_id; + +/* Acknowledge timer0 irq */ +writel (GPT_IRQ_ACK (GPT_CLK_EVT ), gpt_base +GPT_IRQ_ACK_REG ); + evt->event_handler (evt); + +return IRQ_HANDLED ; +} + +static void mtk_timer_global_reset (void ) +{ +/* Disable all interrupts */ +writel (0x0 , gpt_base +GPT_IRQ_EN_REG ); +/* Acknowledge all interrupts */ +writel (0x3f , gpt_base +GPT_IRQ_ACK_REG ); +} + +static void mtk_timer_reset (u8 timer) +{ +writel (TIMER_CTRL_CLEAR |TIMER_CTRL_DISABLE , + gpt_base +TIMER_CTRL_REG (timer)); +writel (0x0 , gpt_base +TIMER_CMP_REG (timer)); +} + +static struct irqaction mtk_timer_irq = { + .name ="mtk_timer0" , + .flags =IRQF_DISABLED |IRQF_TIMER |IRQF_IRQPOLL , + .handler = mtk_timer_interrupt, + .dev_id = &mtk_clockevent, +}; + +static u32 mtk_timer_sched_read (void ) +{ +return readl (gpt_base +TIMER_CNT_REG (GPT_CLK_SRC ));
drivers/clocksource/mtk_timer.c line 193
Quoted 10 lines
drivers/clocksource/mtk_timer.c new file +10
-0+} + +static void __init mtk_timer_init (struct device_node *node) +{ +unsigned long rate =0 ; +struct clk *clk; +int ret, irq; +u32 val; + + gpt_base =of_iomap (node,0 );
What about using of_address_to_resource()? Then you will be able to use request_mem_region() before calling ioremap().
drivers/clocksource/mtk_timer.c line 201
Quoted 8 lines
drivers/clocksource/mtk_timer.c new file +8
-0+if (!gpt_base) +panic ("Can't map registers" ); + + irq =irq_of_parse_and_map (node,0 ); +if (irq <=0 ) +panic ("Can't parse IRQ" ); + + clk =of_clk_get_by_name (node,"sys_clk" );
We try to avoid to used named clock. You should use of_clk_get(np, 0) here.
Thanks,
Gregory
Quoted 48 lines
drivers/clocksource/mtk_timer.c new file +47
-0+if (IS_ERR (clk)) +panic ("Can't get timer clock" ); +clk_prepare_enable (clk); + + rate =clk_get_rate (clk); + +mtk_timer_global_reset (); + +/* Configure clock source */ +mtk_timer_reset (GPT_CLK_SRC ); + +writel (TIMER_CLK_SRC (TIMER_CLK_SRC_SYS13M ) |TIMER_CLK_DIV1 , + gpt_base +TIMER_CLK_REG (GPT_CLK_SRC )); + +writel (TIMER_CTRL_OP (TIMER_CTRL_OP_FREERUN ) |TIMER_CTRL_ENABLE , + gpt_base +TIMER_CTRL_REG (GPT_CLK_SRC )); + +clocksource_mmio_init (gpt_base +TIMER_CNT_REG (GPT_CLK_SRC ), node->name, + rate,300 ,32 , clocksource_mmio_readl_up); + + ticks_per_jiffy =DIV_ROUND_UP (rate,HZ ); + +/* Configure clock event */ +mtk_timer_reset (GPT_CLK_EVT ); + +writel (TIMER_CLK_SRC (TIMER_CLK_SRC_SYS13M ) |TIMER_CLK_DIV1 , + gpt_base +TIMER_CLK_REG (GPT_CLK_EVT )); +writel (0 , gpt_base +TIMER_CMP_REG (GPT_CLK_EVT )); + +writel (TIMER_CTRL_OP (TIMER_CTRL_OP_REPEAT ) |TIMER_CTRL_ENABLE , + gpt_base +TIMER_CTRL_REG (GPT_CLK_EVT )); + + ret =setup_irq (irq, &mtk_timer_irq); +if (ret) +pr_warn ("failed to setup irq %d\n" , irq); + +/* Enable timer0 interrupt */ + val =readl (gpt_base +GPT_IRQ_EN_REG ); +writel (val |GPT_IRQ_ENABLE (GPT_CLK_EVT ), gpt_base +GPT_IRQ_EN_REG ); + + mtk_clockevent.cpumask =cpumask_of (0 ); + +clockevents_config_and_register (&mtk_clockevent, rate,0x3 , +0xffffffff ); +} +CLOCKSOURCE_OF_DECLARE (mtk_mt6589,"mediatek,mtk6589-timer" , mtk_timer_init); +
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Re: [PATCH 1/4] clocksource: Add support for the Mediatek SoCs
In reply to Matthias BruggerHi,
Quoted 6 lines · Matthias Brugger
This patch adds a clock source and clock event for the timer found on the Mediatek SoCs.
The Mediatek General Porpose Timer block provides five 32 bit timers and one 64 bit timer.
Quoted 7 lines
Two 32 bit timers are used:
TIMER1: clock events supporting periodic and oneshot events
TIMER2: clock source configured as a free running counterThe General Porpose 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.
Hm, are you planning on using these on the Cortex-A7-based and newer SoCs? On those, the arm generic timers should be available, and you might be better off just using those there.
Of course, you'll still need these for the A9-based platforms, so the driver might very well be needed anyway. Some of the earlier patches seem to be for A7-based systems so I'm not sure what you're primarily working on here. :)
-Olof
Matthias Brugger
maintainerRe: [PATCH 1/4] clocksource: Add support for the Mediatek SoCs
2014-04-09 23:52 GMT+02:00 Olof Johansson <[email protected]>:
Quoted 14 lines
Hi,
Quoted 10 lines · Matthias Brugger
This patch adds a clock source and clock event for the timer found on the Mediatek SoCs.
The Mediatek General Porpose Timer block provides five 32 bit timers and one 64 bit timer.
Two 32 bit timers are used:
TIMER1: clock events supporting periodic and oneshot events
TIMER2: clock source configured as a free running counter
Quoted 7 lines
Quoted 3 lines
The General Porpose 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.
Hm, are you planning on using these on the Cortex-A7-based and newer SoCs? On those, the arm generic timers should be available, and you might be better off just using those there.
I'm a bit puzzled about the timer naming.
Are the arm generic timers the one used by ARM_ARCH_TIMER, or are they different ones?
Quoted 5 lines
Of course, you'll still need these for the A9-based platforms, so the driver might very well be needed anyway. Some of the earlier patches seem to be for A7-based systems so I'm not sure what you're primarily working on here. :)
I'm working on a Cortex-A7 based platform. But ARM_ARCH_TIMER seems to get no clocking.
Initializing the timer fails with:
Architected timer frequency not available
That's why I use the SoC timer.
Quoted 3 lines
-Olof
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 1/4] clocksource: Add support for the Mediatek SoCs
Quoted 6 lines · On Friday 11 April 2014 11:07:35 Matthias Brugger wrote:
Quoted 5 lines
Of course, you'll still need these for the A9-based platforms, so the driver might very well be needed anyway. Some of the earlier patches seem to be for A7-based systems so I'm not sure what you're primarily working on here.
Quoted 6 lines
I'm working on a Cortex-A7 based platform. But
ARM_ARCH_TIMERseems to get no clocking.
Initializing the timer fails with:
Architected timer frequency not availableThat's why I use the SoC timer.
Are you sure you're not just missing a "clock-frequency" property in your DT node for the timer?
Arnd
Matthias Brugger
maintainerPATCH 2/4 dt-bindings: add mtk-timer bindings
In reply to Matthias BruggerAdd binding documentation for the General Porpose Timer driver of the Mediatek SoCs.
--- .../bindings/timer/mediatek,mtk-timer.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt new file +19 -0
@@ -0,0 +1,19 @@ +Mediatek MT6598, MT6577 and MT6572 Timers +--------------------------------------- + +Required properties: +- compatible: Should be "mediatek,mtk6589-timer" +- reg: Should contain location and length for timers register. +- clock-names : Must include the following entries: + "sysclk" (13 MHz system clock), + "rtcclk" (32 KHz RTC clock). + +Examples: + + timer { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc-clk>; + clock-names = "sysclk", "rtcclk"; + };
Signature · 1 line
1.7.9.5
Re: [PATCH 2/4] dt-bindings: add mtk-timer bindings
Hi Matthias,
Quoted 15 lines · Matthias Brugger
Add binding documentation for the General Porpose Timer driver of the Mediatek SoCs.
Signed-off-by Matthias Brugger <[email protected]>--- .../bindings/timer/mediatek,mtk-timer.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txtDocumentation/devicetree/bindings/timer/mediatek,mtk-timer.txt new file +0
-0
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt new file +9
-0@@ -0,0 +1,19 @@ +Mediatek MT6598, MT6577 and MT6572 Timers +--------------------------------------- + +Required properties: +- compatible: Should be "mediatek,mtk6589-timer" +- reg: Should contain location and length for timers register. +- clock-names : Must include the following entries: + "sysclk" (13 MHz system clock), + "rtcclk" (32 KHz RTC clock).
It would be better to make the clocks mandatory and not their name
Thanks,
Gregory
Quoted 11 lines
Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt new file +10
-0+ +Examples: + + timer { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc-clk>; + clock-names = "sysclk", "rtcclk"; + };
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Matthias Brugger
maintainerPATCH 3/4 arm: add basic support for Mediatek MT6589 boards
In reply to Matthias BruggerThis adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
--- .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 ++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 14 +++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++++++ 7 files changed, 164 insertions(+) create mode 100644 arch/arm/boot/dts/mtk6589.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
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
@@ -67,6 +67,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
arch/arm/Kconfig +2 -0
@@ -995,6 +995,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"
arch/arm/Makefile +1 -0
@@ -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
arch/arm/boot/dts/mtk6589.dtsi new file +105 -0
105 lines not on this page · raw message
arch/arm/mach-mediatek/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB + select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS + select HAVE_SMP + select LOCAL_TIMERS if SMP + select COMMON_CLK + select GENERIC_CLOCKEVENTS + select MTK_TIMER + select CLKSRC_MMIO + help + Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.
arch/arm/mach-mediatek/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
arch/arm/mach-mediatek/mediatek.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* Device Tree support for Mediatek SoCs +* +* Copyright (c) 2014 MundoReader S.L. +* Author: Matthias Brugger <[email protected]> +* +* 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/kernel.h> +#include <linux/init.h> +#include <linux/of_platform.h> +#include <linux/irqchip.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *const mediatek_board_dt_compat[] = { +"mediatek,mt6589" , +NULL , +}; + +DT_MACHINE_START (MEDIATEK_DT ,"Mediatek Cortex-A7 (Device Tree)" ) + .init_machine = mediatek_dt_init, + .dt_compat = mediatek_board_dt_compat, +MACHINE_END
Signature · 1 line
1.7.9.5
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
Hi Matthias,
Quoted 119 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>--- .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 ++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 14 +++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++++++ 7 files changed, 164 insertions(+) create mode 100644 arch/arm/boot/dts/mtk6589.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.cDocumentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -67,6 +67,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 Moxaarch/arm/Kconfig +2
-0@@ -995,6 +995,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"arch/arm/Makefile +1
-0@@ -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) += nomadikarch/arm/boot/dts/mtk6589.dtsi new file +55
-0@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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"; + next-level-cache = <&L2>; + reg = <0x0>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x2>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x3>; + }; + + }; + + clocks {
arch/arm/boot/dts/mtk6589.dtsi line 65
Quoted 10 lines
arch/arm/boot/dts/mtk6589.dtsi new file +10
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges; + + system_clk: system_clk { + compatible = "fixed-clock"; + clock-frequency = <13000000>; + #clock-cells = <0>; + clock-output-names = "system_clk"; + };
Is it really a fixed clock without any parent, or do you declare it as a fixed clock because you don't have any clock common framework support yet?
Quoted 46 lines
arch/arm/boot/dts/mtk6589.dtsi new file +40
-0+ + rtc_clk: rtc_clk { + compatible = "fixed-clock"; + clock-frequency = <32000>; + #clock-cells = <0>; + clock-output-names = "rtc_clk"; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + clock-ranges; + ranges; + + gic: interrupt-controller at 10212000 { + compatible = "arm,cortex-a9-gic"; + interrupt-controller; + #interrupt-cells = <3>; + reg = <0x10211000 0x1000>, + <0x10212000 0x1000>; + }; + + L2: l2-cache-controller at 1020e000 { + compatible = "arm,pl310-cache"; + reg = <0x1020e000 0x1000>; + cache-unified; + cache-level = <2>; + }; + + timer: timer at 10008000 { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc_clk>; + clock-names = "sys_clk", "rtc_clk"; + }; + }; +};arch/arm/mach-mediatek/Kconfig new file +0
-0
arch/arm/mach-mediatek/Kconfig line 6
Quoted 6 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB + select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS
LOCAL_TIMERS no longer exist
arch/arm/mach-mediatek/Kconfig line 8
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +2
-0+ select HAVE_SMP + select LOCAL_TIMERS if SMP
ditto
so what about this instead:
select HAVE_ARM_TWD if SMP
The rest of this patch looks good.
Thanks,
Gregory
Quoted 60 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0+ select COMMON_CLK + select GENERIC_CLOCKEVENTS + select MTK_TIMER + select CLKSRC_MMIO + help + Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.arch/arm/mach-mediatek/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.oarch/arm/mach-mediatek/mediatek.c new file +40
-0@@ -0,0 +1,40 @@ +/* +* Device Tree support for Mediatek SoCs +* +* Copyright (c) 2014 MundoReader S.L. +* Author: Matthias Brugger <[email protected]> +* +* 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/kernel.h> +#include <linux/init.h> +#include <linux/of_platform.h> +#include <linux/irqchip.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +} + +static const char *const mediatek_board_dt_compat[] = { +"mediatek,mt6589" , +NULL , +}; + +DT_MACHINE_START (MEDIATEK_DT ,"Mediatek Cortex-A7 (Device Tree)" ) + .init_machine = mediatek_dt_init, + .dt_compat = mediatek_board_dt_compat, +MACHINE_END
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Matthias Brugger
maintainerRe: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
2014-04-09 22:26 GMT+02:00 Gregory CLEMENT <[email protected]>:
Quoted 128 lines
Hi Matthias,
Quoted 125 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>--- .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 ++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 14 +++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++++++ 7 files changed, 164 insertions(+) create mode 100644 arch/arm/boot/dts/mtk6589.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.cDocumentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -67,6 +67,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 Moxaarch/arm/Kconfig +2
-0@@ -995,6 +995,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"arch/arm/Makefile +1
-0@@ -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) += nomadikarch/arm/boot/dts/mtk6589.dtsi new file +61
-0@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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"; + next-level-cache = <&L2>; + reg = <0x0>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x2>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x3>; + }; + + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + system_clk: system_clk { + compatible = "fixed-clock";
Quoted 8 lines
arch/arm/boot/dts/mtk6589.dtsi line 65
Quoted 4 lines
arch/arm/boot/dts/mtk6589.dtsi new file +4
-0+ clock-frequency = <13000000>; + #clock-cells = <0>; + clock-output-names = "system_clk"; + };Is it really a fixed clock without any parent, or do you declare it as a fixed clock because you don't have any clock common framework support yet?
I don't have any common clock framework support yet.
Quoted 138 lines
Quoted 47 lines
arch/arm/boot/dts/mtk6589.dtsi new file +40
-0+ + rtc_clk: rtc_clk { + compatible = "fixed-clock"; + clock-frequency = <32000>; + #clock-cells = <0>; + clock-output-names = "rtc_clk"; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + clock-ranges; + ranges; + + gic: interrupt-controller at 10212000 { + compatible = "arm,cortex-a9-gic"; + interrupt-controller; + #interrupt-cells = <3>; + reg = <0x10211000 0x1000>, + <0x10212000 0x1000>; + }; + + L2: l2-cache-controller at 1020e000 { + compatible = "arm,pl310-cache"; + reg = <0x1020e000 0x1000>; + cache-unified; + cache-level = <2>; + }; + + timer: timer at 10008000 { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc_clk>; + clock-names = "sys_clk", "rtc_clk"; + }; + }; +};arch/arm/mach-mediatek/Kconfig new file +0
-0arch/arm/mach-mediatek/Kconfig line 6
Quoted 6 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB + select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS
LOCAL_TIMERSno longer existarch/arm/mach-mediatek/Kconfig line 8
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +2
-0+ select HAVE_SMP + select LOCAL_TIMERS if SMPditto
so what about this instead:
select
HAVE_ARM_TWDif SMPThe rest of this patch looks good.
Thanks,
Gregory
Quoted 50 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0+ select COMMON_CLK + select GENERIC_CLOCKEVENTS + select MTK_TIMER + select CLKSRC_MMIO + help + Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.arch/arm/mach-mediatek/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.oarch/arm/mach-mediatek/mediatek.c new file +30
-0@@ -0,0 +1,40 @@ +/* +* Device Tree support for Mediatek SoCs +* +* Copyright (c) 2014 MundoReader S.L. +* Author: Matthias Brugger <[email protected]> +* +* 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/kernel.h> +#include <linux/init.h> +#include <linux/of_platform.h> +#include <linux/irqchip.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +}arch/arm/mach-mediatek/mediatek.c line 40
Quoted 10 lines
arch/arm/mach-mediatek/mediatek.c new file +10
-0+ +static const char *const mediatek_board_dt_compat[] = { +"mediatek,mt6589" , +NULL , +}; + +DT_MACHINE_START (MEDIATEK_DT ,"Mediatek Cortex-A7 (Device Tree)" ) + .init_machine = mediatek_dt_init, + .dt_compat = mediatek_board_dt_compat, +MACHINE_END --
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
Quoted 138 lines · Matthias Brugger
2014-04-09 22:26 GMT+02:00 Gregory CLEMENT <[email protected]>:
Quoted 128 lines
Hi Matthias,
Quoted 125 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>--- .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 ++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 14 +++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++++++ 7 files changed, 164 insertions(+) create mode 100644 arch/arm/boot/dts/mtk6589.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.cDocumentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -67,6 +67,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 Moxaarch/arm/Kconfig +2
-0@@ -995,6 +995,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"arch/arm/Makefile +1
-0@@ -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) += nomadikarch/arm/boot/dts/mtk6589.dtsi new file +61
-0@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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"; + next-level-cache = <&L2>; + reg = <0x0>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x2>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x3>; + }; + + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + system_clk: system_clk { + compatible = "fixed-clock";Quoted 8 lines
arch/arm/boot/dts/mtk6589.dtsi line 65
Quoted 4 lines
arch/arm/boot/dts/mtk6589.dtsi new file +4
-0+ clock-frequency = <13000000>; + #clock-cells = <0>; + clock-output-names = "system_clk"; + };Is it really a fixed clock without any parent, or do you declare it as a fixed clock because you don't have any clock common framework support yet?
Quoted 1 line
I don't have any common clock framework support yet.
So maybe you should provide one (even a very simple one).
Pretending a clock is a fixed clock and ignoring its parents will be problematic when you will add the common clock framework support because the device tree is supposed to be stable and you won't be able to change it then.
Thanks,
Gregory
Quoted 142 lines
Quoted 139 lines
Quoted 48 lines
arch/arm/boot/dts/mtk6589.dtsi new file +40
-0+ + rtc_clk: rtc_clk { + compatible = "fixed-clock"; + clock-frequency = <32000>; + #clock-cells = <0>; + clock-output-names = "rtc_clk"; + }; + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + clock-ranges; + ranges; + + gic: interrupt-controller at 10212000 { + compatible = "arm,cortex-a9-gic"; + interrupt-controller; + #interrupt-cells = <3>; + reg = <0x10211000 0x1000>, + <0x10212000 0x1000>; + }; + + L2: l2-cache-controller at 1020e000 { + compatible = "arm,pl310-cache"; + reg = <0x1020e000 0x1000>; + cache-unified; + cache-level = <2>; + }; + + timer: timer at 10008000 { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc_clk>; + clock-names = "sys_clk", "rtc_clk"; + }; + }; +};arch/arm/mach-mediatek/Kconfig new file +0
-0arch/arm/mach-mediatek/Kconfig line 6
Quoted 6 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB + select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS
LOCAL_TIMERSno longer existarch/arm/mach-mediatek/Kconfig line 8
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +2
-0+ select HAVE_SMP + select LOCAL_TIMERS if SMPditto
so what about this instead:
select
HAVE_ARM_TWDif SMPThe rest of this patch looks good.
Thanks,
Gregory
Quoted 50 lines
arch/arm/mach-mediatek/Kconfig new file +6
-0+ select COMMON_CLK + select GENERIC_CLOCKEVENTS + select MTK_TIMER + select CLKSRC_MMIO + help + Support for Mediatek Cortex-A7 Quad-Core-SoC MT6589.arch/arm/mach-mediatek/Makefile new file +1
-0@@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.oarch/arm/mach-mediatek/mediatek.c new file +30
-0@@ -0,0 +1,40 @@ +/* +* Device Tree support for Mediatek SoCs +* +* Copyright (c) 2014 MundoReader S.L. +* Author: Matthias Brugger <[email protected]> +* +* 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/kernel.h> +#include <linux/init.h> +#include <linux/of_platform.h> +#include <linux/irqchip.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +}arch/arm/mach-mediatek/mediatek.c line 40
Quoted 10 lines
arch/arm/mach-mediatek/mediatek.c new file +10
-0+ +static const char *const mediatek_board_dt_compat[] = { +"mediatek,mt6589" , +NULL , +}; + +DT_MACHINE_START (MEDIATEK_DT ,"Mediatek Cortex-A7 (Device Tree)" ) + .init_machine = mediatek_dt_init, + .dt_compat = mediatek_board_dt_compat, +MACHINE_END --
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
Hi Gregory,
Am Donnerstag, 10. April 2014, 08:46:03 schrieb Gregory CLEMENT:
Quoted 2 lines · Matthias Brugger
Quoted 1 line
2014-04-09 22:26 GMT+02:00 Gregory CLEMENT <gregory.clement@free-
electrons.com>:
Quoted 79 lines
Quoted 79 lines
Quoted 78 lines
Hi Matthias,
Quoted 61 lines · Matthias Brugger
(quoted diff) +0
-0
b/arch/arm/boot/dts/mtk6589.dtsinew file mode 100644 index 0000000..6dbb74farch/arm/boot/dts/mtk6589.dtsi new file +55
-0@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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"; + next-level-cache = <&L2>; + reg = <0x0>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x2>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x3>; + }; + + }; + + clocks {arch/arm/boot/dts/mtk6589.dtsi line 65
Quoted 10 lines
arch/arm/boot/dts/mtk6589.dtsi new file +10
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges; + + system_clk: system_clk { + compatible = "fixed-clock"; + clock-frequency = <13000000>; + #clock-cells = <0>; + clock-output-names = "system_clk"; + };Is it really a fixed clock without any parent, or do you declare it as a fixed clock because you don't have any clock common framework support yet?
Quoted 8 lines
Quoted 1 line
I don't have any common clock framework support yet.
So maybe you should provide one (even a very simple one).
Pretending a clock is a fixed clock and ignoring its parents will be problematic when you will add the common clock framework support because the device tree is supposed to be stable and you won't be able to change it then.
personally I think the danger of introducing unsuitable bindings/precedents for a clock controller before it is fully understood is higher.
I'd just rename the clock above to something like dummy130m like sunxi also does for example, to reflect its unfinished state and when the clock controller is present later on change the supplying clock of the timer.
Or maybe I'm overlooking something here :-)
Heiko
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
In reply to Gregory CLEMENTQuoted 5 lines · On Thursday 10 April 2014 08:46:03 Gregory CLEMENT wrote:
Quoted 5 lines
Quoted 4 lines
Is it really a fixed clock without any parent, or do you declare it as a fixed clock because you don't have any clock common framework support yet?
Quoted 8 lines
Quoted 1 line
I don't have any common clock framework support yet.
So maybe you should provide one (even a very simple one).
Pretending a clock is a fixed clock and ignoring its parents will be problematic when you will add the common clock framework support because the device tree is supposed to be stable and you won't be able to change it then.
But is this actually a problem here? The current device tree file will keep working even if the proper driver is there, you just need to update both the driver and the dts file in order to actually use the clocks at run-time.
I guess it comes down to the question of whether we want to handle old kernels with new device trees again, which would be broken here.
Arnd
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
In reply to Matthias BruggerQuoted 6 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Quoted 6 lines
Signed-off-by Matthias Brugger <[email protected]>--- .../devicetree/bindings/vendor-prefixes.txt | 1 + arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/boot/dts/mtk6589.dtsi | 105 ++++++++++++++++++++
Please add an actual board so your dts file can actually be built.
Quoted 63 lines
arch/arm/mach-mediatek/Kconfig | 14 +++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mediatek.c | 40 ++++++++ 7 files changed, 164 insertions(+) create mode 100644 arch/arm/boot/dts/mtk6589.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.cDocumentation/devicetree/bindings/vendor-prefixes.txt +1
-0@@ -67,6 +67,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 Moxaarch/arm/Kconfig +2
-0@@ -995,6 +995,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"arch/arm/Makefile +1
-0@@ -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) += nomadikarch/arm/boot/dts/mtk6589.dtsi new file +11
-0@@ -0,0 +1,105 @@ +/* + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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
arch/arm/boot/dts/mtk6589.dtsi line 21
Quoted 10 lines
arch/arm/boot/dts/mtk6589.dtsi new file +10
-0+ * 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";
Please document this compatible property.
Quoted 52 lines
arch/arm/boot/dts/mtk6589.dtsi new file +52
-0+ interrupt-parent = <&gic>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x0>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x1>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x2>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,cortex-a7"; + next-level-cache = <&L2>; + reg = <0x3>; + }; + + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + system_clk: system_clk { + compatible = "fixed-clock"; + clock-frequency = <13000000>; + #clock-cells = <0>; + clock-output-names = "system_clk"; + }; + + rtc_clk: rtc_clk { + compatible = "fixed-clock"; + clock-frequency = <32000>; + #clock-cells = <0>; + clock-output-names = "rtc_clk"; + }; + };
arch/arm/boot/dts/mtk6589.dtsi line 83
Quoted 10 lines
arch/arm/boot/dts/mtk6589.dtsi new file +10
-0+ + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + clock-ranges; + ranges; + + gic: interrupt-controller at 10212000 { + compatible = "arm,cortex-a9-gic";
A7 is GICv2. You are missing the various virtualization extension properties.
arch/arm/boot/dts/mtk6589.dtsi line 91
Quoted 8 lines
arch/arm/boot/dts/mtk6589.dtsi new file +8
-0+ interrupt-controller; + #interrupt-cells = <3>; + reg = <0x10211000 0x1000>, + <0x10212000 0x1000>; + }; + + L2: l2-cache-controller at 1020e000 { + compatible = "arm,pl310-cache";
Really? An A7 normally has a built-in L2, not a PL310.
Quoted 20 lines
arch/arm/boot/dts/mtk6589.dtsi new file +14
-0+ reg = <0x1020e000 0x1000>; + cache-unified; + cache-level = <2>; + }; + + timer: timer at 10008000 { + compatible = "mediatek,mtk6589-timer"; + reg = <0x10008000 0x80>; + interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_LOW>; + clocks = <&system_clk>, <&rtc_clk>; + clock-names = "sys_clk", "rtc_clk"; + }; + }; +};arch/arm/mach-mediatek/Kconfig new file +0
-0
arch/arm/mach-mediatek/Kconfig line 3
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB
Then where is your GPIO driver?
arch/arm/mach-mediatek/Kconfig line 7
Quoted 4 lines
arch/arm/mach-mediatek/Kconfig new file +4
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS + select HAVE_SMP
Not needed now (going into 3.15).
arch/arm/mach-mediatek/Kconfig line 9
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +2
-0+ select LOCAL_TIMERS if SMP + select COMMON_CLK
ditto
arch/arm/mach-mediatek/Kconfig line 10
Quoted 1 line
arch/arm/mach-mediatek/Kconfig new file +1
-0+ select GENERIC_CLOCKEVENTS
ditto
arch/arm/mach-mediatek/Kconfig line 12
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +2
-0+ select MTK_TIMER + select CLKSRC_MMIO
This belongs with your timer kconfig
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>
[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS
Hell no! ;-) ARM_ARCH_TIMER is the way (please also add the missing node).
Quoted 5 lines
arch/arm/mach-mediatek/Kconfig line 7
Quoted 1 line
arch/arm/mach-mediatek/Kconfig new file +1
-0+ select HAVE_SMPNot needed now (going into 3.15).
Quoted 1 line
arch/arm/mach-mediatek/Kconfig new file +1
-0+ select LOCAL_TIMERS if SMP
No, A7 always have the arch timers.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny.
Matthias Brugger
maintainerPATCH 3/4 arm: add basic support for Mediatek MT6589 boards
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 26 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 12 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 6 lines
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig line 6
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERSHell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).
I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."
Quoted 14 lines
Quoted 6 lines
arch/arm/mach-mediatek/Kconfig line 7
Quoted 2 lines
arch/arm/mach-mediatek/Kconfig new file +1
-0+ select HAVE_SMPNot needed now (going into 3.15).
Quoted 1 line
arch/arm/mach-mediatek/Kconfig new file +1
-0+ select LOCAL_TIMERS if SMPNo, A7 always have the arch timers.
Thanks,
M.--
Jazz is not dead. It just smells funny.
Signature · 1 line
motzblog.wordpress.com
PATCH 3/4 arm: add basic support for Mediatek MT6589 boards
Quoted 31 lines · Matthias Brugger
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 30 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERS
Quoted 6 lines
Quoted 2 lines
Hell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."
This is because your bootloader/firmware is utterly broken, and doesn't set CNTFRQ (it must be set on all CPUs, from secure mode). As a *workaround*, you can set the timer frequency in the timer node, but that's just a hack, and will prevent virtual machines from running on such hardware.
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
PATCH 3/4 arm: add basic support for Mediatek MT6589 boards
Quoted 39 lines · Marc Zyngier
Quoted 31 lines · Matthias Brugger
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 30 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERSQuoted 6 lines
Quoted 2 lines
Hell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."
Quoted 5 lines
This is because your bootloader/firmware is utterly broken, and doesn't set CNTFRQ (it must be set on all CPUs, from secure mode). As a *workaround*, you can set the timer frequency in the timer node, but that's just a hack, and will prevent virtual machines from running on such hardware.
Is it?
Quoted 1 line
From what I understood from ARM's ARM, CNTFRQ must be set during the
system boot, but even though the arch timer driver can fetch the frequency from clock-frequency, I don't see anywhere that it actually writes to CNTFRQ whatever it retrieved.
But I'm probably missing something here...
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140411/b636ad7c/attachment.sig>
Matthias Brugger
maintainerPATCH 3/4 arm: add basic support for Mediatek MT6589 boards
In reply to Marc Zyngier2014-04-11 11:43 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 39 lines · Matthias Brugger
Quoted 31 lines
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 30 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERSQuoted 6 lines
Quoted 2 lines
Hell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."
Quoted 5 lines
This is because your bootloader/firmware is utterly broken, and doesn't set CNTFRQ (it must be set on all CPUs, from secure mode). As a *workaround*, you can set the timer frequency in the timer node, but that's just a hack, and will prevent virtual machines from running on such hardware.
The last days I tried to get the ARM_ARCH_TIMER working, but I wasn't able to do so.
I set the frequency in the DT node.
But reading CNTP_TVAL at the end of arch_timer_init, it always returns the same value.
When reading CNTPCT at the same place, returns zero.
As far as I understand CNTPCT will be always incremented, am I right?
Consequently, when calling mdelay in arch_timer_init the system hangs.
So can it be, that the timers are not working due to a screwed up chip design? Or do I miss something here?
Quoted 4 lines
M.--
Jazz is not dead. It just smells funny...
Signature · 1 line
motzblog.wordpress.com
PATCH 3/4 arm: add basic support for Mediatek MT6589 boards
Quoted 54 lines · Matthias Brugger
2014-04-11 11:43 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 39 lines · Matthias Brugger
Quoted 31 lines
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 30 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERSQuoted 6 lines
Quoted 2 lines
Hell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."Quoted 5 lines
This is because your bootloader/firmware is utterly broken, and doesn't set CNTFRQ (it must be set on all CPUs, from secure mode). As a *workaround*, you can set the timer frequency in the timer node, but that's just a hack, and will prevent virtual machines from running on such hardware.
The last days I tried to get the
ARM_ARCH_TIMERworking, but I wasn't able to do so.
I set the frequency in the DT node.
But readingCNTP_TVALat the end ofarch_timer_init, it always returns the same value.
When reading CNTPCT at the same place, returns zero.
As far as I understand CNTPCT will be always incremented, am I right?
Quoted 4 lines
Consequently, when calling mdelay in
arch_timer_initthe system hangs.So can it be, that the timers are not working due to a screwed up chip design? Or do I miss something here?
That would indicate that the clock that feeds into the timer is gated. Other SoC vendors have done the same thing. Do you have access to documentation describing the clock tree?
Of course, a broken design is always possible, but let's not think of the worse just yet... ;-)
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Matthias Brugger
maintainerPATCH 3/4 arm: add basic support for Mediatek MT6589 boards
2014-04-15 18:40 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 60 lines · Matthias Brugger
Quoted 54 lines
2014-04-11 11:43 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 39 lines · Matthias Brugger
Quoted 31 lines
2014-04-10 11:01 GMT+02:00 Marc Zyngier <[email protected]>:
Quoted 30 lines
A couple of things on top of Rob's comments:
Quoted 8 lines · Rob Herring
Quoted 7 lines · Matthias Brugger
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>[...]
Quoted 15 lines
arch/arm/mach-mediatek/Kconfig line 3
Quoted 9 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0@@ -0,0 +1,14 @@ +config ARCH_MEDIATEK + bool "Mediatek MT6589 SoC" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIBThen where is your GPIO driver?
Quoted 3 lines
arch/arm/mach-mediatek/Kconfig new file +3
-0+ select ARM_GIC + select CACHE_L2X0 + select HAVE_ARM_TWD if LOCAL_TIMERSQuoted 6 lines
Quoted 2 lines
Hell no! ;-)
ARM_ARCH_TIMERis the way (please also add the missing node).I considered this, but the timer wasn't able to get it's clock frequency:
"Architected timer frequency not available
Division by zero in kernel."Quoted 5 lines
This is because your bootloader/firmware is utterly broken, and doesn't set CNTFRQ (it must be set on all CPUs, from secure mode). As a *workaround*, you can set the timer frequency in the timer node, but that's just a hack, and will prevent virtual machines from running on such hardware.
The last days I tried to get the
ARM_ARCH_TIMERworking, but I wasn't able to do so.
I set the frequency in the DT node.
But readingCNTP_TVALat the end ofarch_timer_init, it always returns the same value.
When reading CNTPCT at the same place, returns zero.
As far as I understand CNTPCT will be always incremented, am I right?Quoted 4 lines
Consequently, when calling mdelay in
arch_timer_initthe system hangs.So can it be, that the timers are not working due to a screwed up chip design? Or do I miss something here?
Quoted 6 lines
That would indicate that the clock that feeds into the timer is gated. Other SoC vendors have done the same thing. Do you have access to documentation describing the clock tree?
Of course, a broken design is always possible, but let's not think of the worse just yet... ;-)
The clock tree documentation is really spare but I tried to made some changes to the registers which controls the clock gates and the DCMs. But with no luck.
So for me it looks like a broken design :(
It looks like we need the global timer from mediatek.
I will try to update the patch series with the comments given and send a v2 the next days.
Quoted 6 lines
Thanks,
M.--
Jazz is not dead. It just smells funny...
Signature · 1 line
motzblog.wordpress.com
Re: [PATCH 3/4] arm: add basic support for Mediatek MT6589 boards
In reply to Matthias BruggerQuoted 7 lines · On Wednesday 09 April 2014 21:45:35 Matthias Brugger wrote:
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>
Hi Matthias,
First of all, I'm really glad to see this get started, thanks for looking into these!
Do you know how similar the MT6589 is to the later chips like MT65x2 and MT6588? What are the on-chip devices like, is it mostly licensed IP blocks from designware and others that we already have drivers for, or all new drivers?
arch/arm/mach-mediatek/mediatek.c line 30
Quoted 7 lines
arch/arm/mach-mediatek/mediatek.c new file +7
-0+#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +}
I hope that with all the cleanup work that Russell has done in the past few weeks, we can manage to kill off the call to l2x0_of_init() here and have it done by core architecture code instead. That would let you have an empty machine file, unless you have other things you will need to add in the future.
Arnd
Matthias Brugger
maintainerPATCH 3/4 arm: add basic support for Mediatek MT6589 boards
2014-04-10 9:36 GMT+02:00 Arnd Bergmann <[email protected]>:
Quoted 11 lines · On Wednesday 09 April 2014 21:45:35 Matthias Brugger wrote:
Quoted 7 lines
This adds a generic devicetree board file and a dtsi for boards based on the MT6589 SoCs from Mediatek.
Apart from the generic parts (gic, clocks) the only component currently supported are the timers.
Signed-off-by Matthias Brugger <[email protected]>Hi Matthias,
Quoted 7 lines
First of all, I'm really glad to see this get started, thanks for looking into these!
Do you know how similar the MT6589 is to the later chips like MT65x2 and MT6588? What are the on-chip devices like, is it mostly licensed IP blocks from designware and others that we already have drivers for, or all new drivers?
Actually I don't have any information about the MT6589. For MT6572 I had a deeper look on the GPT and the UART which seem to be the same in both SoCs.
But they don't look like IP blocks from any other vendor. Most of the other on-chip devices look quite similar.
In any case don't trust me too much, as I'm just doing my first steps on an effort like this.
Quoted 16 lines
arch/arm/mach-mediatek/mediatek.c line 30
Quoted 8 lines
arch/arm/mach-mediatek/mediatek.c new file +7
-0+#include <asm/hardware/cache-l2x0.h> + +static void __init mediatek_dt_init (void ) +{ +l2x0_of_init (0 , ~0 ); +of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +}I hope that with all the cleanup work that Russell has done in the past few weeks, we can manage to kill off the call to
l2x0_of_init()here and have it done by core architecture code instead. That would let you have an empty machine file, unless you have other things you will need to add in the future.Arnd
Signature · 1 line
motzblog.wordpress.com
Matthias Brugger
maintainerPATCH 4/4 arm: mediatek: Add earlyprintk support for MT6589
In reply to Matthias Brugger--- arch/arm/Kconfig.debug | 49 +++++++++++++++++++++++++++++++++++-- arch/arm/include/debug/mediatek.S | 38 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/mediatek.S
arch/arm/Kconfig.debug +47 -2
@@ -797,6 +797,38 @@ choice Say Y here if you want kernel low-level debugging support on Ux500 based platforms. + config DEBUG_MTK6589_UART0 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART0" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART1 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART1" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART2 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART2" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART3 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART3" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + config DEBUG_VEXPRESS_UART0_DETECT bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" depends on ARCH_VEXPRESS && CPU_CP15_MMU
@@ -954,6 +986,10 @@ config DEBUG_MSM_UART bool depends on ARCH_MSM || ARCH_QCOM +config DEBUG_UART_MEDIATEK + bool + depends on ARCH_MEDIATEK + config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250
@@ -971,6 +1007,7 @@ config DEBUG_LL_INCLUDE DEBUG_IMX53_UART ||\ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART + default "debug/mediatek.S" if DEBUG_UART_MEDIATEK default "debug/msm.S" if DEBUG_MSM_UART default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
@@ -1043,6 +1080,10 @@ config DEBUG_UART_PHYS default 0xd0012000 if DEBUG_MVEBU_UART default 0xd4017000 if DEBUG_MMP_UART2 default 0xd4018000 if DEBUG_MMP_UART3 + default 0x11006000 if DEBUG_MTK6589_UART0 + default 0x11007000 if DEBUG_MTK6589_UART1 + default 0x11008000 if DEBUG_MTK6589_UART2 + default 0x11009000 if DEBUG_MTK6589_UART3 default 0xe0000000 if ARCH_SPEAR13XX default 0xf0000be0 if ARCH_EBSA110 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE
@@ -1058,7 +1099,7 @@ config DEBUG_UART_PHYS default 0xfffff700 if ARCH_IOP33X depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_LL_UART_EFM32 || \ - DEBUG_UART_8250 || DEBUG_UART_PL01X + DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_UART_MEDIATEK config DEBUG_UART_VIRT hex "Virtual base address of debug UART"
@@ -1087,6 +1128,10 @@ config DEBUG_UART_VIRT default 0xfe012000 if ARCH_ORION5X default 0xfe017000 if DEBUG_MMP_UART2 default 0xfe018000 if DEBUG_MMP_UART3 + default 0xF1006000 if DEBUG_MTK6589_UART0 + default 0xF1007000 if DEBUG_MTK6589_UART1 + default 0xF1008000 if DEBUG_MTK6589_UART2 + default 0xF1009000 if DEBUG_MTK6589_UART3 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART default 0xfe230000 if DEBUG_PICOXCELL_UART default 0xfe300000 if DEBUG_BCM_KONA_UART
@@ -1116,7 +1161,7 @@ config DEBUG_UART_VIRT default 0xff003000 if DEBUG_U300_UART default DEBUG_UART_PHYS if !MMU depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ - DEBUG_UART_8250 || DEBUG_UART_PL01X + DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_UART_MEDIATEK config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART"
arch/arm/include/debug/mediatek.S new file +38 -0
@@ -0,0 +1,38 @@ +/* + * Low-level debug macro for Mediatek SoCs + * + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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/serial_reg.h> + + .macro addruart, rp, rv, tmp + ldr \rp, =CONFIG_DEBUG_UART_PHYS + ldr \rv, =CONFIG_DEBUG_UART_VIRT + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0x0] + .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #0x14] + tst \rd, #0x40 + beq 1001b + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x14] + tst \rd, #0x40 + beq 1002b + .endm
Signature · 1 line
1.7.9.5
Re: [PATCH 4/4] arm: mediatek: Add earlyprintk support for MT6589
Hi Matthias,
Quoted 70 lines · Matthias Brugger
Signed-off-by Matthias Brugger <[email protected]>--- arch/arm/Kconfig.debug | 49 +++++++++++++++++++++++++++++++++++-- arch/arm/include/debug/mediatek.S | 38 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/mediatek.Sarch/arm/Kconfig.debug +37
-0@@ -797,6 +797,38 @@ choice Say Y here if you want kernel low-level debugging support on Ux500 based platforms. + config DEBUG_MTK6589_UART0 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART0" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART1 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART1" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART2 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART2" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART3 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART3" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + config DEBUG_VEXPRESS_UART0_DETECT bool "Autodetect UART0 on Versatile Express Cortex-A core tiles" depends on ARCH_VEXPRESS && CPU_CP15_MMU@@ -954,6 +986,10 @@ config DEBUG_MSM_UART bool depends on ARCH_MSM || ARCH_QCOM +config DEBUG_UART_MEDIATEK + bool + depends on ARCH_MEDIATEK + config DEBUG_LL_INCLUDE string default "debug/8250.S" if DEBUG_LL_UART_8250 || DEBUG_UART_8250@@ -971,6 +1007,7 @@ config DEBUG_LL_INCLUDE DEBUG_IMX53_UART ||\ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART + default "debug/mediatek.S" if DEBUG_UART_MEDIATEK default "debug/msm.S" if DEBUG_MSM_UART default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART default "debug/sirf.S" if DEBUG_SIRFPRIMA2_UART1 || DEBUG_SIRFMARCO_UART1
arch/arm/Kconfig.debug config DEBUG_UART_PHYS · line 1082
Quoted 3 lines
arch/arm/Kconfig.debug +0
-0@@ -1043,6 +1080,10 @@ config DEBUG_UART_PHYS default 0xd0012000 if DEBUG_MVEBU_UART default 0xd4017000 if DEBUG_MMP_UART2 default 0xd4018000 if DEBUG_MMP_UART3
it seems that this symbol are sorted by address so your symbols should go just after the line
default 0x101fb000 if DEBUG_NOMADIK_UART
Quoted 57 lines
arch/arm/Kconfig.debug +10
-2+ default 0x11006000 if DEBUG_MTK6589_UART0 + default 0x11007000 if DEBUG_MTK6589_UART1 + default 0x11008000 if DEBUG_MTK6589_UART2 + default 0x11009000 if DEBUG_MTK6589_UART3 default 0xe0000000 if ARCH_SPEAR13XX default 0xf0000be0 if ARCH_EBSA110 default 0xf1012000 if DEBUG_MVEBU_UART_ALTERNATE@@ -1058,7 +1099,7 @@ config DEBUG_UART_PHYS default 0xfffff700 if ARCH_IOP33X depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ DEBUG_LL_UART_EFM32 || \ - DEBUG_UART_8250 || DEBUG_UART_PL01X + DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_UART_MEDIATEK config DEBUG_UART_VIRT hex "Virtual base address of debug UART"@@ -1087,6 +1128,10 @@ config DEBUG_UART_VIRT default 0xfe012000 if ARCH_ORION5X default 0xfe017000 if DEBUG_MMP_UART2 default 0xfe018000 if DEBUG_MMP_UART3 + default 0xF1006000 if DEBUG_MTK6589_UART0 + default 0xF1007000 if DEBUG_MTK6589_UART1 + default 0xF1008000 if DEBUG_MTK6589_UART2 + default 0xF1009000 if DEBUG_MTK6589_UART3 default 0xfe100000 if DEBUG_IMX23_UART || DEBUG_IMX28_UART default 0xfe230000 if DEBUG_PICOXCELL_UART default 0xfe300000 if DEBUG_BCM_KONA_UART@@ -1116,7 +1161,7 @@ config DEBUG_UART_VIRT default 0xff003000 if DEBUG_U300_UART default DEBUG_UART_PHYS if !MMU depends on DEBUG_LL_UART_8250 || DEBUG_LL_UART_PL01X || \ - DEBUG_UART_8250 || DEBUG_UART_PL01X + DEBUG_UART_8250 || DEBUG_UART_PL01X || DEBUG_UART_MEDIATEK config DEBUG_UART_8250_SHIFT int "Register offset shift for the 8250 debug UART"arch/arm/include/debug/mediatek.S new file +15
-0@@ -0,0 +1,38 @@ +/* + * Low-level debug macro for Mediatek SoCs + * + * Copyright (c) 2014 MundoReader S.L. + * Author: Matthias Brugger <[email protected]> + * + * 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.
arch/arm/include/debug/mediatek.S line 25
Quoted 10 lines
arch/arm/include/debug/mediatek.S new file +10
-0+ */ +#include <linux/serial_reg.h> + + .macro addruart, rp, rv, tmp + ldr \rp, =CONFIG_DEBUG_UART_PHYS + ldr \rv, =CONFIG_DEBUG_UART_VIRT + .endm + + .macro senduart,rd,rx + strb \rd, [\rx, #0x0]
What about using a #define instead of numerical value?
arch/arm/include/debug/mediatek.S line 29
Quoted 4 lines
arch/arm/include/debug/mediatek.S new file +4
-0+ .endm + + .macro waituart,rd,rx +1001: ldr \rd, [\rx, #0x14]
ditto
arch/arm/include/debug/mediatek.S line 30
Quoted 1 line
arch/arm/include/debug/mediatek.S new file +1
-0+ tst \rd, #0x40
ditto
arch/arm/include/debug/mediatek.S line 35
Quoted 5 lines
arch/arm/include/debug/mediatek.S new file +5
-0+ beq 1001b + .endm + + .macro busyuart,rd,rx +1002: ldr \rd, [\rx, #0x14]
ditto
arch/arm/include/debug/mediatek.S line 36
Quoted 1 line
arch/arm/include/debug/mediatek.S new file +1
-0+ tst \rd, #0x40
ditto
arch/arm/include/debug/mediatek.S line 38
Quoted 3 lines
arch/arm/include/debug/mediatek.S new file +2
-0+ beq 1002b + .endm
This file looks very similar to arch/arm/include/debug/pl01x.S, the only difference is the value of some register offsets. Should it be possible to make it configurable and then use the same file?
Thanks,
Gregory
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
Re: [PATCH 4/4] arm: mediatek: Add earlyprintk support for MT6589
In reply to Matthias BruggerQuoted 37 lines · Matthias Brugger
Signed-off-by Matthias Brugger <[email protected]>--- arch/arm/Kconfig.debug | 49 +++++++++++++++++++++++++++++++++++-- arch/arm/include/debug/mediatek.S | 38 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/mediatek.Sarch/arm/Kconfig.debug +22
-0@@ -797,6 +797,38 @@ choice Say Y here if you want kernel low-level debugging support on Ux500 based platforms. + config DEBUG_MTK6589_UART0 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART0" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART1 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART1" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART2 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART2" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support
arch/arm/Kconfig.debug choice · line 831
Quoted 10 lines
arch/arm/Kconfig.debug +10
-0+ on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART3 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART3" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. +
Do you really need all uarts defined? Only define what you have boards using.
Also, you have no uarts defined in your dts. Please add them there (and any necessary serial driver) before adding debug functionality. Otherwise, you can't actually boot a multi-platform kernel with this series.
Matthias Brugger
maintainerRe: [PATCH 4/4] arm: mediatek: Add earlyprintk support for MT6589
2014-04-09 23:39 GMT+02:00 Rob Herring <[email protected]>:
Quoted 51 lines · Matthias Brugger
Quoted 37 lines
Signed-off-by Matthias Brugger <[email protected]>--- arch/arm/Kconfig.debug | 49 +++++++++++++++++++++++++++++++++++-- arch/arm/include/debug/mediatek.S | 38 ++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/debug/mediatek.Sarch/arm/Kconfig.debug +22
-0@@ -797,6 +797,38 @@ choice Say Y here if you want kernel low-level debugging support on Ux500 based platforms. + config DEBUG_MTK6589_UART0 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART0" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART1 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART1" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART2 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART2" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging supportarch/arm/Kconfig.debug choice · line 831
Quoted 10 lines
arch/arm/Kconfig.debug +10
-0+ on Mediatek mt6589 based platforms. + + config DEBUG_MTK6589_UART3 + depends on ARCH_MEDIATEK + bool "Mediatek mt6589 UART3" + select DEBUG_UART_MEDIATEK + help + Say Y here if you want kernel low-level debugging support + on Mediatek mt6589 based platforms. +Do you really need all uarts defined? Only define what you have boards using.
Quoted 4 lines
Also, you have no uarts defined in your dts. Please add them there (and any necessary serial driver) before adding debug functionality. Otherwise, you can't actually boot a multi-platform kernel with this series.
Up to now, there no serial driver exists. Should I skip this patch and re-submit it when the serial driver is integrated?
Signature · 1 line
motzblog.wordpress.com