Re: [PATCH 8/8] clocksource: xilinx_ttc: add OF_CLK support
2012/10/31 Josh Cartwright : > Add support for retrieving TTC configuration from device tree. This > includes the ability to pull information about the driving clocks from > the of_clk bindings. > > Signed-off-by: Josh Cartwright > --- > arch/arm/boot/dts/zynq-7000.dtsi | 53 > arch/arm/boot/dts/zynq-zc702.dts | 10 ++ > drivers/clocksource/xilinx_ttc.c | 273 > ++- > 3 files changed, 218 insertions(+), 118 deletions(-) > > diff --git a/arch/arm/boot/dts/zynq-7000.dtsi > b/arch/arm/boot/dts/zynq-7000.dtsi > index 5fb763f..9a2442c 100644 > --- a/arch/arm/boot/dts/zynq-7000.dtsi > +++ b/arch/arm/boot/dts/zynq-7000.dtsi > @@ -109,5 +109,58 @@ > }; > }; > }; > + > + ttc0: ttc0@f8001000 { > + #address-cells = <1>; > + #size-cells = <0>; > + compatible = "xlnx,ttc"; > + reg = <0xF8001000 0x1000>; > + clocks = <_clk 3>; > + clock-names = "cpu_1x"; > + clock-ranges; > + > + ttc0_0: ttc0.0 { > + status = "disabled"; > + reg = <0>; > + interrupts = <0 10 4>; > + }; > + ttc0_1: ttc0.1 { > + status = "disabled"; > + reg = <1>; > + interrupts = <0 11 4>; > + }; > + ttc0_2: ttc0.2 { > + status = "disabled"; > + reg = <2>; > + interrupts = <0 12 4>; > + }; > + }; > + > + ttc1: ttc0@f8002000 { Also this is ttc1: ttc1. These type of faults can be simple removed by proper dts node generation. Thanks, Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 8/8] clocksource: xilinx_ttc: add OF_CLK support
2012/10/31 Josh Cartwright josh.cartwri...@ni.com: Add support for retrieving TTC configuration from device tree. This includes the ability to pull information about the driving clocks from the of_clk bindings. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- arch/arm/boot/dts/zynq-7000.dtsi | 53 arch/arm/boot/dts/zynq-zc702.dts | 10 ++ drivers/clocksource/xilinx_ttc.c | 273 ++- 3 files changed, 218 insertions(+), 118 deletions(-) diff --git a/arch/arm/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index 5fb763f..9a2442c 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi @@ -109,5 +109,58 @@ }; }; }; + + ttc0: ttc0@f8001000 { + #address-cells = 1; + #size-cells = 0; + compatible = xlnx,ttc; + reg = 0xF8001000 0x1000; + clocks = cpu_clk 3; + clock-names = cpu_1x; + clock-ranges; + + ttc0_0: ttc0.0 { + status = disabled; + reg = 0; + interrupts = 0 10 4; + }; + ttc0_1: ttc0.1 { + status = disabled; + reg = 1; + interrupts = 0 11 4; + }; + ttc0_2: ttc0.2 { + status = disabled; + reg = 2; + interrupts = 0 12 4; + }; + }; + + ttc1: ttc0@f8002000 { Also this is ttc1: ttc1. These type of faults can be simple removed by proper dts node generation. Thanks, Michal -- Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 8/8] clocksource: xilinx_ttc: add OF_CLK support
On Wed, Oct 31, 2012 at 01:56:14PM -0600, Josh Cartwright wrote: > Add support for retrieving TTC configuration from device tree. This > includes the ability to pull information about the driving clocks from > the of_clk bindings. > > Signed-off-by: Josh Cartwright > --- > diff --git a/drivers/clocksource/xilinx_ttc.c > b/drivers/clocksource/xilinx_ttc.c > index ff38b3e..a4718f7 100644 > --- a/drivers/clocksource/xilinx_ttc.c > +++ b/drivers/clocksource/xilinx_ttc.c > @@ -209,7 +153,8 @@ static struct clocksource clocksource_xttcpss = { > static int xttcpss_set_next_event(unsigned long cycles, > struct clock_event_device *evt) > { > - struct xttcpss_timer *timer = [XTTCPSS_CLOCKEVENT]; > + struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt); > + struct xttcpss_timer *timer = >xttc; > > xttcpss_set_interval(timer, cycles); > return 0; > @@ -224,12 +169,14 @@ static int xttcpss_set_next_event(unsigned long cycles, > static void xttcpss_set_mode(enum clock_event_mode mode, > struct clock_event_device *evt) > { > - struct xttcpss_timer *timer = [XTTCPSS_CLOCKEVENT]; > + struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt); > + struct xttcpss_timer *timer = >xttc; > u32 ctrl_reg; > > switch (mode) { > case CLOCK_EVT_MODE_PERIODIC: > - xttcpss_set_interval(timer, TIMER_RATE / HZ); > + xttcpss_set_interval(timer, > + clk_get_rate(xttce->clk) / PRESCALE); I discovered with further testing that the above calculation is broken; calculated interval also needs to be divided by HZ. (I'll post a v2; just wanted to get this out there in the slim chance anyone's testing this ;) Josh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 8/8] clocksource: xilinx_ttc: add OF_CLK support
On Wed, Oct 31, 2012 at 01:56:14PM -0600, Josh Cartwright wrote: Add support for retrieving TTC configuration from device tree. This includes the ability to pull information about the driving clocks from the of_clk bindings. Signed-off-by: Josh Cartwright josh.cartwri...@ni.com --- diff --git a/drivers/clocksource/xilinx_ttc.c b/drivers/clocksource/xilinx_ttc.c index ff38b3e..a4718f7 100644 --- a/drivers/clocksource/xilinx_ttc.c +++ b/drivers/clocksource/xilinx_ttc.c @@ -209,7 +153,8 @@ static struct clocksource clocksource_xttcpss = { static int xttcpss_set_next_event(unsigned long cycles, struct clock_event_device *evt) { - struct xttcpss_timer *timer = timers[XTTCPSS_CLOCKEVENT]; + struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt); + struct xttcpss_timer *timer = xttce-xttc; xttcpss_set_interval(timer, cycles); return 0; @@ -224,12 +169,14 @@ static int xttcpss_set_next_event(unsigned long cycles, static void xttcpss_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) { - struct xttcpss_timer *timer = timers[XTTCPSS_CLOCKEVENT]; + struct xttcpss_timer_clockevent *xttce = to_xttcpss_timer_clkevent(evt); + struct xttcpss_timer *timer = xttce-xttc; u32 ctrl_reg; switch (mode) { case CLOCK_EVT_MODE_PERIODIC: - xttcpss_set_interval(timer, TIMER_RATE / HZ); + xttcpss_set_interval(timer, + clk_get_rate(xttce-clk) / PRESCALE); I discovered with further testing that the above calculation is broken; calculated interval also needs to be divided by HZ. (I'll post a v2; just wanted to get this out there in the slim chance anyone's testing this ;) Josh -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/