ARM: davinci: convert to common clock framework
Subsystems (3)
v3 cover ARM: davinci: convert to common clock framework
This series takes the first steps towards moving mach-davinci to the common clock framework.
Basically, this series does some cleanup and rearranging to get things ready for the conversion. Then in "ARM: davinci: convert to common clock framework" we actually make the conversion. This is done by just creating a thin layer around the existing mach clock code.
There is certainly more to be done to make full use of the common clock framework, but this seems like the smallest logical set of patches to get CONFIG_COMMON_CLK switched on. Otherwise, I think we would end up with a series of 20+ patches that would be harder to review.
I have tested this on LEGO MINDSTORMS EV3 (TI AM1808), so I am confident that I haven't broken anything (too badly) in da850. But, I don't have other hardware to test.
v3 changes:
* Remove leftovers from rebasing in "ARM: davinci: don't use static clk_lookup" (fixes compile error)
v2 changes:
* Dropped "ARM: davinci: clean up map_io functions" - will resend as separate patch series
* Reworked remaining patches so that there is less shuffling around
David Lechner (5):
ARM: davinci: move davinci_clk_init() to init_time
ARM: davinci: don't use static clk_lookup
ARM: davinci: make davinci_clk_reset() static
ARM: davinci: convert to common clock framework
ARM: davinci: remove clock debugfs
arch/arm/Kconfig | 2 +- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-leopard.c | 2 +- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/board-dm644x-evm.c | 2 +- arch/arm/mach-davinci/board-dm646x-evm.c | 11 +- arch/arm/mach-davinci/board-mityomapl138.c | 2 +- arch/arm/mach-davinci/board-neuros-osd2.c | 2 +- arch/arm/mach-davinci/board-omapl138-hawk.c | 2 +- arch/arm/mach-davinci/board-sffsdr.c | 2 +- arch/arm/mach-davinci/clock.c | 299 +++++++++------------------- arch/arm/mach-davinci/clock.h | 48 +++-- arch/arm/mach-davinci/da830.c | 215 ++++++++++---------- arch/arm/mach-davinci/da850.c | 290 ++++++++++++++------------- arch/arm/mach-davinci/da8xx-dt.c | 2 +- arch/arm/mach-davinci/davinci.h | 4 + arch/arm/mach-davinci/devices-da8xx.c | 9 +- arch/arm/mach-davinci/dm355.c | 182 ++++++++--------- arch/arm/mach-davinci/dm365.c | 240 +++++++++++----------- arch/arm/mach-davinci/dm644x.c | 162 +++++++-------- arch/arm/mach-davinci/dm646x.c | 172 ++++++++-------- arch/arm/mach-davinci/include/mach/clock.h | 3 - arch/arm/mach-davinci/include/mach/common.h | 1 - arch/arm/mach-davinci/include/mach/da8xx.h | 3 + arch/arm/mach-davinci/usb-da8xx.c | 57 +++--- 27 files changed, 815 insertions(+), 905 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/5 ARM: davinci: move davinci_clk_init() to init_time
This moves the call of davinci_clk_init() from map_io to init_time for all boards.
This is the proper place to init clocks. This is also done in preparation for moving to the common clock framework.
--- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-da850-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-evm.c | 2 +- arch/arm/mach-davinci/board-dm355-leopard.c | 2 +- arch/arm/mach-davinci/board-dm365-evm.c | 2 +- arch/arm/mach-davinci/board-dm644x-evm.c | 2 +- arch/arm/mach-davinci/board-dm646x-evm.c | 11 +++++++---- arch/arm/mach-davinci/board-mityomapl138.c | 2 +- arch/arm/mach-davinci/board-neuros-osd2.c | 2 +- arch/arm/mach-davinci/board-omapl138-hawk.c | 2 +- arch/arm/mach-davinci/board-sffsdr.c | 2 +- arch/arm/mach-davinci/da830.c | 4 ++++ arch/arm/mach-davinci/da850.c | 4 ++++ arch/arm/mach-davinci/da8xx-dt.c | 2 +- arch/arm/mach-davinci/davinci.h | 4 ++++ arch/arm/mach-davinci/dm355.c | 5 +++++ arch/arm/mach-davinci/dm365.c | 5 +++++ arch/arm/mach-davinci/dm644x.c | 5 +++++ arch/arm/mach-davinci/dm646x.c | 5 +++++ arch/arm/mach-davinci/include/mach/da8xx.h | 3 +++ 20 files changed, 53 insertions(+), 15 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +1 -1
@@ -638,7 +638,7 @@ MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM") .atag_offset = 0x100, .map_io = da830_evm_map_io, .init_irq = cp_intc_init, - .init_time = davinci_timer_init, + .init_time = da830_init_time, .init_machine = da830_evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-da850-evm.c +1 -1
@@ -1481,7 +1481,7 @@ MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM") .atag_offset = 0x100, .map_io = da850_evm_map_io, .init_irq = cp_intc_init, - .init_time = davinci_timer_init, + .init_time = da850_init_time, .init_machine = da850_evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-dm355-evm.c +1 -1
@@ -416,7 +416,7 @@ MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM") .atag_offset = 0x100, .map_io = dm355_evm_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm355_init_time, .init_machine = dm355_evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-dm355-leopard.c +1 -1
@@ -271,7 +271,7 @@ MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard") .atag_offset = 0x100, .map_io = dm355_leopard_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm355_init_time, .init_machine = dm355_leopard_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-dm365-evm.c +1 -1
@@ -774,7 +774,7 @@ MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM") .atag_offset = 0x100, .map_io = dm365_evm_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm365_init_time, .init_machine = dm365_evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-dm644x-evm.c +1 -1
@@ -817,7 +817,7 @@ MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM") .atag_offset = 0x100, .map_io = davinci_evm_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm644x_init_time, .init_machine = davinci_evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-dm646x-evm.c +7 -4
@@ -721,9 +721,12 @@ static void __init evm_init_i2c(void)static void __init davinci_map_io (void ) {dm646x_init (); +} -if (machine_is_davinci_dm6467tevm ()) -davinci_set_refclk_rate (DM6467T_EVM_REF_FREQ ); +static void __init dm6467t_evm_init_time (void ) +{ +dm646x_init_time (); +davinci_set_refclk_rate (DM6467T_EVM_REF_FREQ ); }#define DM646X_EVM_PHY_ID "davinci_mdio-0:01"
@@ -797,7 +800,7 @@ MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") .atag_offset = 0x100, .map_io = davinci_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm646x_init_time, .init_machine = evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
@@ -808,7 +811,7 @@ MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM") .atag_offset = 0x100, .map_io = davinci_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm6467t_evm_init_time, .init_machine = evm_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-mityomapl138.c +1 -1
@@ -570,7 +570,7 @@ MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808") .atag_offset = 0x100, .map_io = mityomapl138_map_io, .init_irq = cp_intc_init, - .init_time = davinci_timer_init, + .init_time = da850_init_time, .init_machine = mityomapl138_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-neuros-osd2.c +1 -1
@@ -227,7 +227,7 @@ MACHINE_START(NEUROS_OSD2, "Neuros OSD2") .atag_offset = 0x100, .map_io = davinci_ntosd2_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm644x_init_time, .init_machine = davinci_ntosd2_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-omapl138-hawk.c +1 -1
@@ -334,7 +334,7 @@ MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard") .atag_offset = 0x100, .map_io = omapl138_hawk_map_io, .init_irq = cp_intc_init, - .init_time = davinci_timer_init, + .init_time = da850_init_time, .init_machine = omapl138_hawk_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/board-sffsdr.c +1 -1
@@ -150,7 +150,7 @@ MACHINE_START(SFFSDR, "Lyrtech SFFSDR") .atag_offset = 0x100, .map_io = davinci_sffsdr_map_io, .init_irq = davinci_irq_init, - .init_time = davinci_timer_init, + .init_time = dm644x_init_time, .init_machine = davinci_sffsdr_init, .init_late = davinci_init_late, .dma_zone_size = SZ_128M,
arch/arm/mach-davinci/da830.c +4 -0
@@ -1220,6 +1220,10 @@ void __init da830_init(void) da8xx_syscfg0_base =ioremap (DA8XX_SYSCFG0_BASE ,SZ_4K );WARN (!da8xx_syscfg0_base,"Unable to map syscfg0 module" ); +} +void __init da830_init_time (void ) +{davinci_clk_init (davinci_soc_info_da830.cpu_clks); +davinci_timer_init (); }
arch/arm/mach-davinci/da850.c +4 -0
@@ -1392,6 +1392,10 @@ void __init da850_init(void) v =__raw_readl (DA8XX_SYSCFG0_VIRT (DA8XX_CFGCHIP3_REG )); v &= ~CFGCHIP3_PLL1_MASTER_LOCK ;__raw_writel (v,DA8XX_SYSCFG0_VIRT (DA8XX_CFGCHIP3_REG )); +} +void __init da850_init_time (void ) +{davinci_clk_init (davinci_soc_info_da850.cpu_clks); +davinci_timer_init (); }
arch/arm/mach-davinci/da8xx-dt.c +1 -1
@@ -96,7 +96,7 @@ static const char *const da850_boards_compat[] __initconst = {DT_MACHINE_START (DA850_DT ,"Generic DA850/OMAP-L138/AM18x" ) .map_io = da850_init, - .init_time = davinci_timer_init, + .init_time = da850_init_time, .init_machine = da850_init_machine, .dt_compat = da850_boards_compat, .init_late = davinci_init_late,
arch/arm/mach-davinci/davinci.h +4 -0
@@ -83,6 +83,7 @@ int davinci_init_wdt(void);/* DM355 function declarations */ void dm355_init (void ); +void dm355_init_time (void );void dm355_init_spi0 (unsigned chipselect_mask,const struct spi_board_info *info,unsigned len);void dm355_init_asp1 (u32 evt_enable);
@@ -91,6 +92,7 @@ int dm355_gpio_register(void);/* DM365 function declarations */ void dm365_init (void ); +void dm365_init_time (void );void dm365_init_asp (void );void dm365_init_vc (void );void dm365_init_ks (struct davinci_ks_platform_data *pdata);
@@ -102,12 +104,14 @@ int dm365_gpio_register(void);/* DM644x function declarations */ void dm644x_init (void ); +void dm644x_init_time (void );void dm644x_init_asp (void );int dm644x_init_video (struct vpfe_config *,struct vpbe_config *);int dm644x_gpio_register (void );/* DM646x function declarations */ void dm646x_init (void ); +void dm646x_init_time (void );void dm646x_init_mcasp0 (struct snd_platform_data *pdata);void dm646x_init_mcasp1 (struct snd_platform_data *pdata);int dm646x_init_edma (struct edma_rsv_info *rsv);
arch/arm/mach-davinci/dm355.c +5 -0
@@ -1043,7 +1043,12 @@ void __init dm355_init(void) {davinci_common_init (&davinci_soc_info_dm355);davinci_map_sysmod (); +} + +void __init dm355_init_time (void ) +{davinci_clk_init (davinci_soc_info_dm355.cpu_clks); +davinci_timer_init (); } int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
arch/arm/mach-davinci/dm365.c +5 -0
@@ -1166,7 +1166,12 @@ void __init dm365_init(void) {davinci_common_init (&davinci_soc_info_dm365);davinci_map_sysmod (); +} + +void __init dm365_init_time (void ) +{davinci_clk_init (davinci_soc_info_dm365.cpu_clks); +davinci_timer_init (); }static struct resource dm365_vpss_resources[] = {
arch/arm/mach-davinci/dm644x.c +5 -0
@@ -931,7 +931,12 @@ void __init dm644x_init(void) {davinci_common_init (&davinci_soc_info_dm644x);davinci_map_sysmod (); +} + +void __init dm644x_init_time (void ) +{davinci_clk_init (davinci_soc_info_dm644x.cpu_clks); +davinci_timer_init (); } int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
arch/arm/mach-davinci/dm646x.c +5 -0
@@ -956,7 +956,12 @@ void __init dm646x_init(void) {davinci_common_init (&davinci_soc_info_dm646x);davinci_map_sysmod (); +} + +void __init dm646x_init_time (void ) +{davinci_clk_init (davinci_soc_info_dm646x.cpu_clks); +davinci_timer_init (); }static int __init dm646x_init_devices (void )
arch/arm/mach-davinci/include/mach/da8xx.h +3 -0
@@ -87,7 +87,10 @@ extern unsigned int da850_max_speed;#define DA8XX_ARM_RAM_BASE 0xffff0000void da830_init (void ); +void da830_init_time (void ); +void da850_init (void ); +void da850_init_time (void );int da830_register_edma (struct edma_rsv_info *rsv);int da850_register_edma (struct edma_rsv_info *rsv[2 ]);
Signature · 1 line
2.7.4
PATCH v3 2/5 ARM: davinci: don't use static clk_lookup
In reply to David LechnerIn preparation of moving to the common clock framework, usage of static struct clk_lookup is removed. The common clock framework uses an opaque struct clk, so we won't be able to use static tables as was previously done.
davinci_clk_init() is changed to init a single clock instead of a table.
--- arch/arm/mach-davinci/clock.c | 75 +++++++--------- arch/arm/mach-davinci/clock.h | 9 +- arch/arm/mach-davinci/da830.c | 111 ++++++++++++----------- arch/arm/mach-davinci/da850.c | 133 ++++++++++++++-------------- arch/arm/mach-davinci/devices-da8xx.c | 5 +- arch/arm/mach-davinci/dm355.c | 93 ++++++++++--------- arch/arm/mach-davinci/dm365.c | 123 +++++++++++++------------ arch/arm/mach-davinci/dm644x.c | 85 +++++++++--------- arch/arm/mach-davinci/dm646x.c | 89 +++++++++---------- arch/arm/mach-davinci/include/mach/common.h | 1 - arch/arm/mach-davinci/usb-da8xx.c | 15 +--- 11 files changed, 351 insertions(+), 388 deletions(-)
arch/arm/mach-davinci/clock.c +32 -43
@@ -607,62 +607,51 @@ int davinci_set_refclk_rate(unsigned long rate)return 0 ; } -int __init davinci_clk_init (struct clk_lookup *clocks) +void __init davinci_clk_init (struct clk *clk,const char *con_id, +const char *dev_id) { -struct clk_lookup *c; -struct clk *clk; -size_t num_clocks =0 ; - -for (c = clocks; c->clk; c++) { - clk = c->clk; +if (!clk->recalc) { -if (!clk->recalc) { +/* Check if clock is a PLL */ +if (clk->pll_data) + clk->recalc = clk_pllclk_recalc; -/* Check if clock is a PLL */ -if (clk->pll_data) - clk->recalc = clk_pllclk_recalc; +/* Else, if it is a PLL-derived clock */ +else if (clk->flags &CLK_PLL ) + clk->recalc = clk_sysclk_recalc; -/* Else, if it is a PLL-derived clock */ -else if (clk->flags &CLK_PLL ) - clk->recalc = clk_sysclk_recalc; - -/* Otherwise, it is a leaf clock (PSC clock) */ -else if (clk->parent) - clk->recalc = clk_leafclk_recalc; - } +/* Otherwise, it is a leaf clock (PSC clock) */ +else if (clk->parent) + clk->recalc = clk_leafclk_recalc; + } -if (clk->pll_data) { -struct pll_data *pll = clk->pll_data; +if (clk->pll_data) { +struct pll_data *pll = clk->pll_data; -if (!pll->div_ratio_mask) - pll->div_ratio_mask =PLLDIV_RATIO_MASK ; +if (!pll->div_ratio_mask) + pll->div_ratio_mask =PLLDIV_RATIO_MASK ; -if (pll->phys_base && !pll->base) { - pll->base =ioremap (pll->phys_base,SZ_4K ); -WARN_ON (!pll->base); - } +if (pll->phys_base && !pll->base) { + pll->base =ioremap (pll->phys_base,SZ_4K ); +WARN_ON (!pll->base); } + } -if (clk->recalc) - clk->rate = clk->recalc (clk); - -if (clk->lpsc) - clk->flags |=CLK_PSC ; - -if (clk->flags &PSC_LRST ) - clk->reset = davinci_clk_reset; +if (clk->recalc) + clk->rate = clk->recalc (clk); -clk_register (clk); - num_clocks++; +if (clk->lpsc) + clk->flags |=CLK_PSC ; -/* Turn on clocks that Linux doesn't otherwise manage */ -if (clk->flags &ALWAYS_ENABLED ) -clk_enable (clk); - } +if (clk->flags &PSC_LRST ) + clk->reset = davinci_clk_reset; -clkdev_add_table (clocks, num_clocks); +clk_register (clk); +clk_register_clkdev (clk, con_id, dev_id); -return 0 ; +/* Turn on clocks that Linux doesn't otherwise manage */ +if (clk->flags &ALWAYS_ENABLED ) +clk_enable (clk); }#ifdef CONFIG_DEBUG_FS
arch/arm/mach-davinci/clock.h +1 -8
@@ -118,14 +118,7 @@ struct clk {#define PSC_FORCE BIT(6)/* Force module state transtition */ #define PSC_LRST BIT(8)/* Use local reset on enable/disable */ -#define CLK (dev, con, ck) \ - { \ - .dev_id = dev, \ - .con_id = con, \ - .clk = ck, \ - } \ - -int davinci_clk_init (struct clk_lookup *clocks); +void davinci_clk_init (struct clk *clk,const char *con_id,const char *dev_id);int davinci_set_pllrate (struct pll_data *pll,unsigned int prediv,unsigned int mult,unsigned int postdiv);int davinci_set_sysclk_rate (struct clk *clk,unsigned long rate);
arch/arm/mach-davinci/da830.c +55 -56
128 lines not on this page · raw message
arch/arm/mach-davinci/da850.c +66 -67
150 lines not on this page · raw message
arch/arm/mach-davinci/devices-da8xx.c +1 -4
@@ -1059,9 +1059,6 @@ static struct clk sata_refclk = { .set_rate = davinci_simple_set_rate, }; -static struct clk_lookup sata_refclk_lookup = -CLK ("ahci_da850" ,"refclk" , &sata_refclk); -int __init da850_register_sata_refclk (int rate) {int ret;
@@ -1071,7 +1068,7 @@ int __init da850_register_sata_refclk(int rate)if (ret)return ret; -clkdev_add (&sata_refclk_lookup); +clk_register_clkdev (&sata_refclk,"refclk" ,"ahci_da850" );return 0 ; }
arch/arm/mach-davinci/dm355.c +46 -47
111 lines not on this page · raw message
arch/arm/mach-davinci/dm365.c +61 -62
141 lines not on this page · raw message
arch/arm/mach-davinci/dm644x.c +42 -43
103 lines not on this page · raw message
arch/arm/mach-davinci/dm646x.c +44 -45
107 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/common.h +0 -1
@@ -53,7 +53,6 @@ struct davinci_soc_info {u32 jtag_id_reg;struct davinci_id *ids;unsigned long ids_num; -struct clk_lookup *cpu_clks;u32 *psc_bases;unsigned long psc_bases_num;u32 pinmux_base;
arch/arm/mach-davinci/usb-da8xx.c +3 -12
@@ -133,9 +133,6 @@ static struct clk usb_refclkin = { .set_rate = davinci_simple_set_rate, }; -static struct clk_lookup usb_refclkin_lookup = -CLK (NULL ,"usb_refclkin" , &usb_refclkin); -/** * da8xx_register_usb_refclkin - register USB_REFCLKIN clock *
@@ -154,7 +151,7 @@ int __init da8xx_register_usb_refclkin(int rate)if (ret)return ret; -clkdev_add (&usb_refclkin_lookup); +clk_register_clkdev (&usb_refclkin,"usb_refclkin" ,NULL );return 0 ; }
@@ -262,9 +259,6 @@ static struct clk usb20_phy_clk = { .set_parent = usb20_phy_clk_set_parent, }; -static struct clk_lookup usb20_phy_clk_lookup = -CLK ("da8xx-usb-phy" ,"usb20_phy" , &usb20_phy_clk); -/** * da8xx_register_usb20_phy_clk - register USB0PHYCLKMUX clock *
@@ -291,7 +285,7 @@ int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin) usb20_phy_clk.parent = parent; ret =clk_register (&usb20_phy_clk);if (!ret) -clkdev_add (&usb20_phy_clk_lookup); +clk_register_clkdev (&usb20_phy_clk,"usb20_phy" ,"da8xx-usb-phy" );clk_put (parent);
@@ -324,9 +318,6 @@ static struct clk usb11_phy_clk = { .set_parent = usb11_phy_clk_set_parent, }; -static struct clk_lookup usb11_phy_clk_lookup = -CLK ("da8xx-usb-phy" ,"usb11_phy" , &usb11_phy_clk); -/** * da8xx_register_usb11_phy_clk - register USB1PHYCLKMUX clock *
@@ -348,7 +339,7 @@ int __init da8xx_register_usb11_phy_clk(bool use_usb_refclkin) usb11_phy_clk.parent = parent; ret =clk_register (&usb11_phy_clk);if (!ret) -clkdev_add (&usb11_phy_clk_lookup); +clk_register_clkdev (&usb11_phy_clk,"usb11_phy" ,"da8xx-usb-phy" );clk_put (parent);
Signature · 1 line
2.7.4
PATCH v3 3/5 ARM: davinci: make davinci_clk_reset() static
In reply to David LechnerThis makes davinci_clk_reset() static. It is not used anywhere else.
--- arch/arm/mach-davinci/clock.c | 3 +-- arch/arm/mach-davinci/clock.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
arch/arm/mach-davinci/clock.c +1 -2
@@ -59,7 +59,7 @@ void davinci_clk_disable(struct clk *clk)davinci_clk_disable (clk->parent); } -int davinci_clk_reset (struct clk *clk,bool reset) +static int davinci_clk_reset (struct clk *clk,bool reset) {unsigned long flags;
@@ -73,7 +73,6 @@ int davinci_clk_reset(struct clk *clk, bool reset)return 0 ; } -EXPORT_SYMBOL (davinci_clk_reset);int davinci_clk_reset_assert (struct clk *clk) {
arch/arm/mach-davinci/clock.h +0 -1
@@ -124,7 +124,6 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,int davinci_set_sysclk_rate (struct clk *clk,unsigned long rate);int davinci_set_refclk_rate (unsigned long rate);int davinci_simple_set_rate (struct clk *clk,unsigned long rate); -int davinci_clk_reset (struct clk *clk,bool reset);void davinci_clk_enable (struct clk *clk);void davinci_clk_disable (struct clk *clk);
Signature · 1 line
2.7.4
PATCH v3 4/5 ARM: davinci: convert to common clock framework
In reply to David LechnerThis converts the clocks in mach-davinci to the common clock framework.
Most of the patch just involves renaming struct clk to struct davinci_clk. There is also a struct clk_hw added to provide the bridge between the existing clock implementation and the common clock framework.
The clk_get_parent and clk_set_parent callbacks are dropped because all clocks currently (effectivly) have a single parent, in which case the common clock framework does not want you to implement these functions yourself.
clk_unregister() is dropped because it is not used anywhere in mach-davinci.
EXPORT_SYMBOL() is removed from functions not used outside of mach-davinci.
Fixed checkpatch.pl warning about bare use of unsigned in dump_clock().
--- arch/arm/Kconfig | 2 +- arch/arm/mach-davinci/clock.c | 162 ++++++++++++----------------- arch/arm/mach-davinci/clock.h | 40 ++++--- arch/arm/mach-davinci/da830.c | 100 +++++++++--------- arch/arm/mach-davinci/da850.c | 153 +++++++++++++-------------- arch/arm/mach-davinci/devices-da8xx.c | 6 +- arch/arm/mach-davinci/dm355.c | 84 +++++++-------- arch/arm/mach-davinci/dm365.c | 112 ++++++++++---------- arch/arm/mach-davinci/dm644x.c | 72 ++++++------- arch/arm/mach-davinci/dm646x.c | 78 +++++++------- arch/arm/mach-davinci/include/mach/clock.h | 3 - arch/arm/mach-davinci/usb-da8xx.c | 48 +++++---- 12 files changed, 425 insertions(+), 435 deletions(-)
arch/arm/Kconfig +1 -1
@@ -604,7 +604,7 @@ config ARCH_S3C24XX config ARCH_DAVINCI bool "TI DaVinci" select ARCH_HAS_HOLES_MEMORYMODEL - select CLKDEV_LOOKUP + select COMMON_CLK select CPU_ARM926T select GENERIC_ALLOCATOR select GENERIC_CLOCKEVENTS
arch/arm/mach-davinci/clock.c +68 -94
344 lines not on this page · raw message
arch/arm/mach-davinci/clock.h +26 -14
@@ -68,6 +68,7 @@#ifndef __ASSEMBLER__#include <linux/list.h> +#include <linux/clk-provider.h> #include <linux/clkdev.h> #define PLLSTAT_GOSTAT BIT(0)
@@ -84,7 +85,8 @@ struct pll_data {#define PLL_HAS_PREDIV 0x01#define PLL_HAS_POSTDIV 0x02 -struct clk { +struct davinci_clk { +struct clk_hw hw;struct list_head node;struct module *owner;const char *name;
@@ -95,18 +97,18 @@ struct clk {u8 gpsc;u8 domain;u32 flags; -struct clk *parent; +struct davinci_clk *parent;struct list_head children;/* list of children */ struct list_head childnode;/* parent's child list node */ struct pll_data *pll_data;u32 div_reg; -unsigned long (*recalc) (struct clk *); -int (*set_rate) (struct clk *clk,unsigned long rate); -int (*round_rate) (struct clk *clk,unsigned long rate); -int (*reset) (struct clk *clk,bool reset); -void (*clk_enable) (struct clk *clk); -void (*clk_disable) (struct clk *clk); -int (*set_parent) (struct clk *clk,struct clk *parent); +unsigned long (*recalc)(struct davinci_clk *clk); +int (*set_rate)(struct davinci_clk *clk,unsigned long rate); +int (*round_rate)(struct davinci_clk *clk,unsigned long rate); +int (*reset)(struct davinci_clk *clk,bool reset); +void (*clk_enable)(struct davinci_clk *clk); +void (*clk_disable)(struct davinci_clk *clk); +int (*set_parent)(struct davinci_clk *clk,struct davinci_clk *parent); };/* Clock flags: SoC-specific flags start at BIT(16) */
@@ -118,18 +120,28 @@ struct clk {#define PSC_FORCE BIT(6)/* Force module state transtition */ #define PSC_LRST BIT(8)/* Use local reset on enable/disable */ -void davinci_clk_init (struct clk *clk,const char *con_id,const char *dev_id); +void davinci_clk_init (struct davinci_clk *clk,const char *con_id, +const char *dev_id);int davinci_set_pllrate (struct pll_data *pll,unsigned int prediv,unsigned int mult,unsigned int postdiv); -int davinci_set_sysclk_rate (struct clk *clk,unsigned long rate); +int davinci_set_sysclk_rate (struct davinci_clk *clk,unsigned long rate);int davinci_set_refclk_rate (unsigned long rate); -int davinci_simple_set_rate (struct clk *clk,unsigned long rate); -void davinci_clk_enable (struct clk *clk); -void davinci_clk_disable (struct clk *clk); +int davinci_simple_set_rate (struct davinci_clk *clk,unsigned long rate); +void davinci_clk_enable (struct davinci_clk *clk); +void davinci_clk_disable (struct davinci_clk *clk); +int davinci_clk_register (struct davinci_clk *clk);extern struct platform_device davinci_wdt_device;extern void davinci_watchdog_reset (struct platform_device *); +static inline struct davinci_clk *to_davinci_clk (struct clk_hw *hw) +{ +if (IS_ERR_OR_NULL (hw)) +return (struct davinci_clk *)hw; + + return container_of(hw, struct davinci_clk, hw); +} +#endif #endif
arch/arm/mach-davinci/da830.c +50 -50
386 lines not on this page · raw message
arch/arm/mach-davinci/da850.c +77 -76
547 lines not on this page · raw message
arch/arm/mach-davinci/devices-da8xx.c +3 -3
@@ -1054,7 +1054,7 @@ int __init da8xx_register_spi_bus(int instance, unsigned num_chipselect) }#ifdef CONFIG_ARCH_DAVINCI_DA850 -static struct clk sata_refclk = { +static struct davinci_clk sata_refclk = { .name ="sata_refclk" , .set_rate = davinci_simple_set_rate, };
@@ -1064,11 +1064,11 @@ int __init da850_register_sata_refclk(int rate)int ret; sata_refclk.rate = rate; - ret =clk_register (&sata_refclk); + ret =davinci_clk_register (&sata_refclk);if (ret)return ret; -clk_register_clkdev (&sata_refclk,"refclk" ,"ahci_da850" ); +clk_register_clkdev (sata_refclk.hw.clk,"refclk" ,"ahci_da850" );return 0 ; }
arch/arm/mach-davinci/dm355.c +42 -42
306 lines not on this page · raw message
arch/arm/mach-davinci/dm365.c +56 -56
416 lines not on this page · raw message
arch/arm/mach-davinci/dm644x.c +36 -36
266 lines not on this page · raw message
arch/arm/mach-davinci/dm646x.c +39 -39
297 lines not on this page · raw message
arch/arm/mach-davinci/include/mach/clock.h +0 -3
@@ -15,9 +15,6 @@struct clk ; -extern int clk_register (struct clk *clk); -extern void clk_unregister (struct clk *clk); -int davinci_clk_reset_assert (struct clk *c);int davinci_clk_reset_deassert (struct clk *c);
arch/arm/mach-davinci/usb-da8xx.c +27 -21
134 lines not on this page · raw message
Signature · 1 line
2.7.4
Hi David,
Quoted 11 lines · David Lechner
This converts the clocks in mach-davinci to the common clock framework.
Most of the patch just involves renaming struct clk to struct
davinci_clk. There is also a structclk_hwadded to provide the bridge between the existing clock implementation and the common clock framework.The
clk_get_parentandclk_set_parentcallbacks are dropped because all clocks currently (effectivly) have a single parent, in which case the common clock framework does not want you to implement these functions yourself.
Quoted 8 lines
clk_unregister()is dropped because it is not used anywhere in mach-davinci.
EXPORT_SYMBOL()is removed from functions not used outside of mach-davinci.Fixed checkpatch.pl warning about bare use of unsigned in
dump_clock().Signed-off-by David Lechner <[email protected]>
The cleanups leading upto this patch look fine, but I am not sure about this patch itself. Ideally, we should have moved to drivers/clk also. And shared code with keystone too since the PSC and PLL implementations of the two architectures are quite similar.
I could think of this as an intermediate step while we get there, but I am afraid of the churn that would cause. For example, if we reuse keystone driver, we will be using clk_psc and we can get rid of the davinci_clk that this patch introduces.
So unless there is big roadblock to moving to drivers/clk, we should probably do that in one shot.
Thanks,
Sekhar
Quoted 28 lines · Sekhar Nori
Hi David,
Quoted 11 lines · David Lechner
This converts the clocks in mach-davinci to the common clock framework.
Most of the patch just involves renaming struct clk to struct
davinci_clk. There is also a structclk_hwadded to provide the bridge between the existing clock implementation and the common clock framework.The
clk_get_parentandclk_set_parentcallbacks are dropped because all clocks currently (effectivly) have a single parent, in which case the common clock framework does not want you to implement these functions yourself.Quoted 8 lines
clk_unregister()is dropped because it is not used anywhere in mach-davinci.
EXPORT_SYMBOL()is removed from functions not used outside of mach-davinci.Fixed checkpatch.pl warning about bare use of unsigned in
dump_clock().Signed-off-by David Lechner <[email protected]>The cleanups leading upto this patch look fine, but I am not sure about this patch itself. Ideally, we should have moved to
drivers/clkalso. And shared code with keystone too since the PSC and PLL implementations of the two architectures are quite similar.
Quoted 8 lines
I could think of this as an intermediate step while we get there, but I am afraid of the churn that would cause. For example, if we reuse keystone driver, we will be using
clk_pscand we can get rid of thedavinci_clkthat this patch introduces.So unless there is big roadblock to moving to
drivers/clk, we should probably do that in one shot.
Yes, this is intended as an intermediate step. My thinking was that it would be better to do one thing at a time, so if something breaks, it will be easier to find the problem than if we try to do everything at once. But, you are right, there will be quite a few extra intermediate steps required, for example, I have realized that in order to use the davinci_clk concurrently with other clocks in the common clock framework, at least the parent pointer and children linked list will have to be removed, introducing another intermediate step.
While avoiding the davinci_clk step would be ideal, there is quite a bit that needs to be done first before this will be possible. And the downside I see to doing it this way is that no one will be able to test any of the preparatory patches because they depend on the common clock framework. We won't even be able to compile them until all the pieces are in place and we can enable the common clock kernel configuration option.
Here is a list of some of the issues I know about so far preventing me from doing everything at once at this point in time:
* Reentrancy of clk_enable() on non-SMP systems is broken in the common clock framework [1][2], but this reentrancy is needed for the DA8xx USB PHY PLL clock [3].
* drivers/remoteproc/da8xx_remoteproc.c calls davinci_clk_reset_{assert,deassert}() in arch/arm/mach-davinci/clock.c. This needs to be moved to the PSC driver in drivers/clk. The reset framework in drivers/reset looks ideal for handling this, but it is currently device tree only and it looks like we need it to work on non-device tree boards. So, our options are: to move this hack to the PSC driver in drivers/clk/ *or* to update the reset framework to work with non-device tree boards *or* convert all of the mach-davinci boards to device tree only.
* The device tree bindings for "ti,keystone,psc-clock" are not the best and I am really not keen on reusing them. What makes sense to me would be to define a device tree node that represents the entire PSC IP block with child nodes for each clock output. Something like this:
power-controller@2350000 {
compatible = "ti,davinci-psc";
reg = <0x2350000 0xb00>;
...
clkhyperlink0: clkhyperlink0 {
#clock-cells = <0>;
clock-output-names = "hyperlink-0";
clocks = <&chipclk12>;
power-domain = <5>;
module-domain = <12>;
};
...
};But the keystone bindings assign the entire PSC register space to each clock individually (twice). And the really ugly part is that the module domain and the power domain numbers of each PSC "clock" is embedded in the register address. So, if you have reg = <0x02350030 0xb00>, <0x02350014 0x400>; what this really means is that the clock driver will iomap 0x02350000 (notice the 00 instead of the 30 and 14 at the end of each register and that the base 0x02350000 is essentially listed twice with two different sizes) and it means that this particular clock has a module domain of 12 (0x30 / 4 = 12, 4 comes from the fact these are 32-bit registers) and a power domain of 5 (0x14 / 4 = 5). You can find the numbers 12 and 5 easily in the SRM, but the numbers used in the device tree bindings are pretty meaningless. Furthermore, the driver itself stores the base address in a global variable which won't work for DA8XX since it has two PSCs instead of one. So, for this case, I'm really tempted to just write a new driver with better device tree bindings rather than trying to fix up the keystone driver to make it compatible with davinci and better device tree bindings while still maintaining backwards compatibility with wacky device tree bindings.
* The keystone PLL driver and device tree bindings are in better shape, but they cannot be used as-is with davinci family processors since the registers are laid out differently. I have a work-in-progress patch for this that I started quite a while back [4][5].
* All of the keystone clock drivers are currently device tree only, so they will need to be modified *or* as mentioned above all mach-davinci boards could be converted to device tree only.
[1]: https://patchwork.kernel.org/patch/10108437/
[2]: https://patchwork.kernel.org/patch/10115483/
[3]: https://patchwork.kernel.org/patch/9449741/
[4]: https://github.com/dlech/ev3dev-kernel/commit/5e7bf2070aa03283b605d7b86864758d24f83aa8
[5]: https://github.com/dlech/ev3dev-kernel/commit/1e34686ff57a673c8655eaedacec4d65d48f93b3
---
Also, a bit more background on my motivation here. Really, all I want is to be able to use the "pwm-clock" device tree bindings to supply a clock to a Bluetooth chip. But the driver for it requires the common clock framework.
This is just a spare time project for me, which is why I have just done the bare minimum to get CONFIG_COMMON_CLK enabled rather than trying to fix all of the hard problems to do thing the "right way". As you have seen above, there is still quite a bit of work remaining to be done, especially when doing this just for fun. It is probably just wishful thinking, but I kind of hoped that if I was able to get things this far, maybe some other interested parties might be able to help with one of the various pieces.
One way or another, I suppose I will get my Bluetooth clock eventually. :-)
Quoted 40 lines · David Lechner
Quoted 30 lines · Sekhar Nori
Hi David,
Quoted 15 lines · David Lechner
This converts the clocks in mach-davinci to the common clock framework.
Most of the patch just involves renaming struct clk to struct
davinci_clk.
There is also a structclk_hwadded to provide the bridge between the existing clock implementation and the common clock framework.The
clk_get_parentandclk_set_parentcallbacks are dropped because all clocks currently (effectivly) have a single parent, in which case the common clock framework does not want you to implement these functions yourself.
clk_unregister()is dropped because it is not used anywhere in mach-davinci.Quoted 6 lines
EXPORT_SYMBOL()is removed from functions not used outside of mach-davinci.Fixed checkpatch.pl warning about bare use of unsigned in
dump_clock().Signed-off-by David Lechner <[email protected]>The cleanups leading upto this patch look fine, but I am not sure about this patch itself. Ideally, we should have moved to
drivers/clkalso. And shared code with keystone too since the PSC and PLL implementations of the two architectures are quite similar.Quoted 8 lines
I could think of this as an intermediate step while we get there, but I am afraid of the churn that would cause. For example, if we reuse keystone driver, we will be using
clk_pscand we can get rid of thedavinci_clkthat this patch introduces.So unless there is big roadblock to moving to
drivers/clk, we should probably do that in one shot.
Quoted 8 lines
Yes, this is intended as an intermediate step. My thinking was that it would be better to do one thing at a time, so if something breaks, it will be easier to find the problem than if we try to do everything at once. But, you are right, there will be quite a few extra intermediate steps required, for example, I have realized that in order to use the
davinci_clkconcurrently with other clocks in the common clock framework, at least the parent pointer and children linked list will have to be removed, introducing another intermediate step.
Thats right, we have two clock lists now, one within mach-davinci and another in drivers/clk.
Quoted 7 lines
While avoiding the
davinci_clkstep would be ideal, there is quite a bit that needs to be done first before this will be possible. And the downside I see to doing it this way is that no one will be able to test any of the preparatory patches because they depend on the common clock framework. We won't even be able to compile them until all the pieces are in place and we can enable the common clock kernel configuration option.
Thats right, the whole conversion needs to be one big series. I dont think we can queue just the preparatory patches without the actual conversion as the preparation might change with the conversion.
Its a big change no doubt, we have to time it right and make sure it gets tested in linux-next for quite a while before getting merged.
Quoted 6 lines
Here is a list of some of the issues I know about so far preventing me from doing everything at once at this point in time:
* Reentrancy of
clk_enable()on non-SMP systems is broken in the common clock framework [1][2], but this reentrancy is needed for the DA8xx USB PHY PLL clock [3].
I see. I will look at those threads in detail, but looks like you have the attention of clock framework maintainers so hopefully that will be solved soon.
Quoted 9 lines
*
drivers/remoteproc/da8xx_remoteproc.ccalls davinci_clk_reset_{assert,deassert}() inarch/arm/mach-davinci/clock.c. This needs to be moved to the PSC driver indrivers/clk. The reset framework indrivers/resetlooks ideal for handling this, but it is currently device tree only and it looks like we need it to work on non-device tree boards. So, our options are: to move this hack to the PSC driver indrivers/clk/*or* to update the reset framework to work with non-device tree boards *or* convert all of the mach-davinci boards to device tree only.
The second option "update the reset framework to work with non-device tree boards" is what we should aim for. The last option is not happening anytime soon ;)
Quoted 23 lines
* The device tree bindings for "ti,keystone,psc-clock" are not the best and I am really not keen on reusing them. What makes sense to me would be to define a device tree node that represents the entire PSC IP block with child nodes for each clock output. Something like this:
power-controller at 2350000 {
????compatible = "ti,davinci-psc";
????reg = <0x23500000xb00>;????...
????clkhyperlink0: clkhyperlink0 {
??????? #clock-cells = <0>;
??????? clock-output-names = "hyperlink-0";
??????? clocks = <&chipclk12>;
??????? power-domain = <5>;
??????? module-domain = <12>;
????};????...
};
Quoted 8 lines
But the keystone bindings assign the entire PSC register space to each clock individually (twice). And the really ugly part is that the module domain and the power domain numbers of each PSC "clock" is embedded in the register address. So, if you have reg = <
0x023500300xb00>, <0x023500140x400>; what this really means is that the clock driver will iomap0x02350000(notice the 00 instead of the 30 and 14 at the end of each register and that the base0x02350000is essentially listed twice with two different sizes) and it means that this particular clock has a
Okay, I do see the unnecessary ioremap going on and the wasted virtual memory space. But I dont quite see that the same base (0x02350000) is being remapped again and again. From whatever I can see in of_psc_clk_init(), it just maps the addresses for "control" and "domain" provided in device tree (keystone-clocks.dtsi)
Quoted 6 lines
module domain of 12 (
0x30/ 4 = 12, 4 comes from the fact these are 32-bit registers) and a power domain of 5 (0x14/ 4 = 5). You can find the numbers 12 and 5 easily in the SRM, but the numbers used in the device tree bindings are pretty meaningless. Furthermore, the driver itself stores the base address in a global variable which won't work for DA8XX since it has two PSCs instead of one. So, for this case, I'm
Yeah, I see this issue.
Quoted 4 lines
really tempted to just write a new driver with better device tree bindings rather than trying to fix up the keystone driver to make it compatible with davinci and better device tree bindings while still maintaining backwards compatibility with wacky device tree bindings.
I think thats fine to do as well. We can also look at reusing some code (for example functions like psc_config() while using different bindings). I dont see any backward compatibility need here since DA850 is a new device altogether. We cannot change existing keystone bindings, but can definitely reuse existing keystone code where it suits while creating new bindings.
We may decide that keeping davinci PSC code handling separate is easier overall (considering we have to support non-device-tree-mode too, which keystone does not). This is something that will have to be looked into along with CCF maintainers.
Quoted 4 lines
* The keystone PLL driver and device tree bindings are in better shape, but they cannot be used as-is with davinci family processors since the registers are laid out differently. I have a work-in-progress patch for this that I started quite a while back [4][5].
Okay, I hadnt done a detailed comparison, but from the patches you have, it does look bad. I guess we are looking at drivers/clock/davinci here. And we can use the analysis you have to justify it.
Quoted 3 lines
* All of the keystone clock drivers are currently device tree only, so they will need to be modified *or* as mentioned above all mach-davinci boards could be converted to device tree only.
The later is not going to happen soon, so it will have to be the former.
Quoted 12 lines
[1]: https://patchwork.kernel.org/patch/10108437/
[2]: https://patchwork.kernel.org/patch/10115483/
[3]: https://patchwork.kernel.org/patch/9449741/
[4]:
https://github.com/dlech/ev3dev-kernel/commit/5e7bf2070aa03283b605d7b86864758d24f83aa8[5]:
https://github.com/dlech/ev3dev-kernel/commit/1e34686ff57a673c8655eaedacec4d65d48f93b3
Quoted 6 lines
---
Also, a bit more background on my motivation here. Really, all I want is to be able to use the "pwm-clock" device tree bindings to supply a clock to a Bluetooth chip. But the driver for it requires the common clock framework.
Okay.
Quoted 9 lines
This is just a spare time project for me, which is why I have just done the bare minimum to get
CONFIG_COMMON_CLKenabled rather than trying to fix all of the hard problems to do thing the "right way". As you have seen above, there is still quite a bit of work remaining to be done, especially when doing this just for fun. It is probably just wishful thinking, but I kind of hoped that if I was able to get things this far, maybe some other interested parties might be able to help with one of the various pieces.
All I can say is that issue has been noted within TI and I believe (hope) that help is on the way!
If we do go the completely separate clock driver route, I think even migrating outside of mach-davinci should not be that tough.
Quoted 2 lines
One way or another, I suppose I will get my Bluetooth clock eventually. :-)
Sure! Thanks for all your work on this platform so far!
Regards,
Sekhar
Quoted 7 lines · Sekhar Nori
All I can say is that issue has been noted within TI and I believe (hope) that help is on the way!
If we do go the completely separate clock driver route, I think even migrating outside of mach-davinci should not be that tough.
Based on your responses, I think we have a pretty clear path forward now. I'm sold on the all at once approach.
If you can pick up the first 3 patches from this series, I have one or two more I can send that depend on those changes that are not intermediate steps.
If TI is able to spend some time on this, it would be nice if they could look at fixing up the reset framework since that is something I haven't attempted yet.
And I can work on fixing up the PLL and PSC drivers I already have in drivers/clk/davinci.
Quoted 1 line · David Lechner
If you can pick up the first 3 patches from this series, I have one or two more I can send that depend on those changes that are not intermediate steps.
I take this back. I have a v4 in the works that changes things a little bit.
PATCH v3 5/5 ARM: davinci: remove clock debugfs
In reply to David LechnerThis removed the debugfs entry for mach-davinci clocks. The clocks now use the common clock framework, which provides debugfs already, so this code is redundant.
--- arch/arm/mach-davinci/clock.c | 79 ------------------------------------------- 1 file changed, 79 deletions(-)
arch/arm/mach-davinci/clock.c +0 -79
@@ -626,82 +626,3 @@ void __init davinci_clk_init(struct davinci_clk *clk, const char *con_id,if (clk->flags &ALWAYS_ENABLED )clk_prepare_enable (clk->hw.clk); } - -#ifdef CONFIG_DEBUG_FS - -#include <linux/debugfs.h> -#include <linux/seq_file.h> - -#define CLKNAME_MAX 10/* longest clock name */ -#define NEST_DELTA 2 -#define NEST_MAX 4 - -static void -dump_clock (struct seq_file *s,unsigned nest,struct davinci_clk *parent) -{ -char *state; -char buf[CLKNAME_MAX +NEST_DELTA *NEST_MAX ]; -struct davinci_clk *clk; -unsigned i; - -if (parent->flags &CLK_PLL ) - state ="pll" ; -else if (parent->flags &CLK_PSC ) - state ="psc" ; -else - state ="" ; - -/* <nest spaces> name <pad to end> */ -memset (buf,' ' ,sizeof (buf) -1 ); - buf[sizeof (buf) -1 ] =0 ; - i =strlen (parent->name); -memcpy (buf + nest, parent->name, -min (i, (unsigned )(sizeof (buf) -1 - nest))); - -seq_printf (s,"%s users=%2d %-3s %9ld Hz\n" , - buf, parent->usecount, state, parent->rate); -/* REVISIT show device associations too */ - -/* cost is now small, but not linear... */ -list_for_each_entry (clk, &parent->children, childnode) { -dump_clock (s, nest +NEST_DELTA , clk); - } -} - -static int davinci_ck_show (struct seq_file *m,void *v) -{ -struct davinci_clk *clk; - -/* -* Show clock tree; We trust nonzero usecounts equate to PSC enables... -*/ -mutex_lock (&clocks_mutex); -list_for_each_entry (clk, &clocks, node) -if (!clk->parent) -dump_clock (m,0 , clk); -mutex_unlock (&clocks_mutex); - -return 0 ; -} - -static int davinci_ck_open (struct inode *inode,struct file *file) -{ -return single_open (file, davinci_ck_show,NULL ); -} - -static const struct file_operations davinci_ck_operations = { - .open = davinci_ck_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static int __init davinci_clk_debugfs_init (void ) -{ -debugfs_create_file ("davinci_clocks" ,S_IFREG |S_IRUGO ,NULL ,NULL , - &davinci_ck_operations); -return 0 ; - -} -device_initcall (davinci_clk_debugfs_init); -#endif /* CONFIG_DEBUG_FS */
Signature · 1 line
2.7.4