ARM: bcm281xx: Add timer driver
Subsystems (6)
PATCH v4 1/1 ARM: bcm281xx: Add timer driver
This adds support for the Broadcom timer, used in the following SoCs:
BCM11130, BCM11140, BCM11351, BCM28145, BCM28155
Updates from V3:
- Migrate to 3.9 timer framework updates
Updates from V2:
- prepend static fns + fields with kona_
Updates from V1:
- Rename bcm_timer.c to bcm_kona_timer.c
- Pull .h into bcm_kona_timer.c
- Make timers static
- Clean up comment block
- Switched to using clockevents_config_and_register
- Added an error to the get_timer loop if it repeats too much
- Added to Documentation/devicetree/bindings/arm/bcm/bcm,kona-timer.txt
- Added missing readl to timer_disable_and_clear
Note: bcm,kona-timer was kept as the 'compatible' field to make it specific enough for when there are multiple bcm timers (bcm,timer is too generic).
Documentation/devicetree/bindings/arm/bcm/bcm,kona-timer.txt new file +19 -0
@@ -0,0 +1,19 @@ +Broadcom Kona Family timer +----------------------------------------------------- +This timer is used in the following Broadcom SoCs: + BCM11130, BCM11140, BCM11351, BCM28145, BCM28155 + +Required properties: +- compatible : "bcm,kona-timer" +- reg : Register range for the timer +- interrupts : interrupt for the timer +- clock-frequency: frequency that the clock operates + +Example: + timer at 35006000 { + compatible = "bcm,kona-timer"; + reg = <0x35006000 0x1000>; + interrupts = <0x0 7 0x4>; + clock-frequency = <32768>; + }; +
arch/arm/boot/dts/bcm11351.dtsi +8 -0
@@ -47,4 +47,12 @@ cache-unified; cache-level = <2>; }; + + timer at 35006000 { + compatible = "bcm,kona-timer"; + reg = <0x35006000 0x1000>; + interrupts = <0x0 7 0x4>; + clock-frequency = <32768>; + }; + };
arch/arm/mach-bcm/board_bcm.c +2 -4
@@ -20,10 +20,8 @@#include <asm/mach/arch.h> #include <asm/mach/time.h> -static void timer_init (void ) -{ -} +extern void kona_timer_init (void );static void __init board_init (void ) {
@@ -35,7 +33,7 @@ static const char * const bcm11351_dt_compat[] = { "bcm,bcm11351", NULL, };DT_MACHINE_START (BCM11351_DT ,"Broadcom Application Processor" ) .init_irq = irqchip_init, - .init_time = timer_init, + .init_time = kona_timer_init, .init_machine = board_init, .dt_compat = bcm11351_dt_compat,MACHINE_END
drivers/clocksource/Makefile +1 -0
@@ -19,5 +19,6 @@ obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o obj-$(CONFIG_SUNXI_TIMER) += sunxi_timer.o obj-$(CONFIG_ARCH_TEGRA) += tegra20_timer.o obj-$(CONFIG_VT8500_TIMER) += vt8500_timer.o +obj-$(CONFIG_ARCH_BCM) += bcm_kona_timer.o obj-$(CONFIG_CLKSRC_ARM_GENERIC) += arm_generic.o
drivers/clocksource/bcm_kona_timer.c new file +208 -0
208 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 1/1 ARM: bcm281xx: Add timer driver
Quoted 9 lines · Christian Daudt
This adds support for the Broadcom timer, used in the following SoCs:
BCM11130, BCM11140, BCM11351, BCM28145, BCM28155drivers/clocksource/bcm_kona_timer.c +4
-0+static const struct of_device_id bcm_timer_ids[]__initconst = { + {.compatible ="bcm,kona-timer" }, + {}, +};
drivers/clocksource/bcm_kona_timer.c line 114
Quoted 10 lines
drivers/clocksource/bcm_kona_timer.c +10
-0+ +static void __init kona_timers_init (void ) +{ +struct device_node *node; +u32 freq; + + node =of_find_matching_node (NULL , bcm_timer_ids); + +if (!node) +panic ("No timer" );
I assume this is for 3.10 now. Can you rework this to remove bcm_timer_ids[] and that of_find_matching_node() call, and replace it with e.g.:
CLOCKSOURCE_OF_DECLARE(kona, "bcm,kona-timer", kona_timer_init);
You'd need to change the prototype of kona_timer_init() to accept the DT node pointer, and pass this through to kona_timers_init().
This would remove the need to have board_bcm.c call the custom kona_timer_init(); it could use the new standardized clocksource_of_init instead.
PATCH v4 1/1 ARM: bcm281xx: Add timer driver
Quoted 11 lines · Stephen Warren
Quoted 10 lines · Christian Daudt
This adds support for the Broadcom timer, used in the following SoCs:
BCM11130, BCM11140, BCM11351, BCM28145, BCM28155drivers/clocksource/bcm_kona_timer.c +7
-0+static const struct of_device_id bcm_timer_ids[]__initconst = { + {.compatible ="bcm,kona-timer" }, + {}, +}; + +static void __init kona_timers_init (void ) +{
Quoted 8 lines
drivers/clocksource/bcm_kona_timer.c line 114
Quoted 7 lines
drivers/clocksource/bcm_kona_timer.c +7
-0+struct device_node *node; +u32 freq; + + node =of_find_matching_node (NULL , bcm_timer_ids); + +if (!node) +panic ("No timer" );I assume this is for 3.10 now.
Oh. I missed 3.9 window ? Got busy with other stuff. Oh well, try again.
Quoted 5 lines
Can you rework this to remove
bcm_timer_ids[] and thatof_find_matching_node()call, and replace it with e.g.:
CLOCKSOURCE_OF_DECLARE(kona, "bcm,kona-timer", kona_timer_init);
where can I find an example ? I looked throught armsoc/for-next and the code there has CLOCKSOURCE_OF_DECLARE but it still has of_find_matching_node calls in the init fns - is it still in the process of being removed ?
Thanks,
csd
PATCH v4 1/1 ARM: bcm281xx: Add timer driver
Quoted 26 lines · Christian Daudt
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Christian Daudt
This adds support for the Broadcom timer, used in the following SoCs:
BCM11130, BCM11140, BCM11351, BCM28145, BCM28155drivers/clocksource/bcm_kona_timer.c +7
-0+static const struct of_device_id bcm_timer_ids[]__initconst = { + {.compatible ="bcm,kona-timer" }, + {}, +}; + +static void __init kona_timers_init (void ) +{Quoted 8 lines
drivers/clocksource/bcm_kona_timer.c line 114
Quoted 7 lines
drivers/clocksource/bcm_kona_timer.c +7
-0+struct device_node *node; +u32 freq; + + node =of_find_matching_node (NULL , bcm_timer_ids); + +if (!node) +panic ("No timer" );I assume this is for 3.10 now.
Oh. I missed 3.9 window ? Got busy with other stuff. Oh well, try again.
Quoted 4 lines
Can you rework this to remove
bcm_timer_ids[] and thatof_find_matching_node()call, and replace it with e.g.:
Quoted 6 lines
Quoted 1 line
CLOCKSOURCE_OF_DECLARE(kona, "bcm,kona-timer", kona_timer_init);where can I find an example ? I looked throught armsoc/for-next and the code there has
CLOCKSOURCE_OF_DECLAREbut it still hasof_find_matching_nodecalls in the init fns - is it still in the process of being removed ?
It looks like Rob's patches that would allow you to eliminate the of_find_matching_node() call aren't checked in yet; I'm not sure if they'll make 3.9 or not. I has assumed so, but even if not, I imagine they will be available as a dependency branch for you to build on top of in 3.10. Those are:
https://lkml.org/lkml/2013/2/7/417
However, you could still convert to CLOCKSOURCE_OF_DECLARE right now; the patches to enable that should be in arm-soc's for-next; see drivers/clocksource/tegra20_timer.c there for example.
PATCH v4 1/1 ARM: bcm281xx: Add timer driver
Quoted 38 lines · Stephen Warren
Quoted 26 lines · Christian Daudt
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Christian Daudt
This adds support for the Broadcom timer, used in the following SoCs:
BCM11130, BCM11140, BCM11351, BCM28145, BCM28155drivers/clocksource/bcm_kona_timer.c +7
-0+static const struct of_device_id bcm_timer_ids[]__initconst = { + {.compatible ="bcm,kona-timer" }, + {}, +}; + +static void __init kona_timers_init (void ) +{Quoted 8 lines
drivers/clocksource/bcm_kona_timer.c line 114
Quoted 7 lines
drivers/clocksource/bcm_kona_timer.c +7
-0+struct device_node *node; +u32 freq; + + node =of_find_matching_node (NULL , bcm_timer_ids); + +if (!node) +panic ("No timer" );I assume this is for 3.10 now.
Oh. I missed 3.9 window ? Got busy with other stuff. Oh well, try again.
Quoted 4 lines
Can you rework this to remove
bcm_timer_ids[] and thatof_find_matching_node()call, and replace it with e.g.:Quoted 5 lines
Quoted 1 line
CLOCKSOURCE_OF_DECLARE(kona, "bcm,kona-timer", kona_timer_init);where can I find an example ? I looked throught armsoc/for-next and the code there has
CLOCKSOURCE_OF_DECLAREbut it still hasof_find_matching_nodecalls in the init fns - is it still in the process of being removed ?It looks like Rob's patches that would allow you to eliminate the
of_find_matching_node()call aren't checked in yet; I'm not sure if they'll make 3.9 or not. I has assumed so, but even if not, I imagine they will be available as a dependency branch for you to build on top of in 3.10. Those are:
Quoted 5 lines
https://lkml.org/lkml/2013/2/7/417
However, you could still convert to
CLOCKSOURCE_OF_DECLAREright now; the patches to enable that should be in arm-soc's for-next; seedrivers/clocksource/tegra20_timer.cthere for example.
Ok, I've added the CLOCKSOURCE_OF_DECLARE and switched to clocksource_of_init in board_bcm, following what is in for-next. If this can't make it to 3.9 then I'll add the of_find_matching_node elimination in the next patch.
Thanks,
csd