ST SPEAr: Updating Clock Support
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v6 13/63 ST SPEAr: Updating Clock Support
- Adding support for divisor per parent clock
- Adding ENABLED_ON_INIT feature in clk
- Adding clk_set_rate, round_rate_index & clk_round_rate
- Simplified clk_recalc functions
- Added/updating clock definitions
--- arch/arm/mach-spear13xx/clock.c | 621 ++++++++++++++++++- arch/arm/mach-spear13xx/include/mach/misc_regs.h | 101 ++-- arch/arm/mach-spear3xx/clock.c | 431 +++++++++++-- arch/arm/mach-spear3xx/include/mach/misc_regs.h | 5 +- arch/arm/mach-spear6xx/clock.c | 331 ++++++++--- arch/arm/mach-spear6xx/include/mach/misc_regs.h | 5 +- arch/arm/plat-spear/clock.c | 705 +++++++++++++++++----- arch/arm/plat-spear/include/plat/clock.h | 94 +++- 8 files changed, 1918 insertions(+), 375 deletions(-)
arch/arm/mach-spear13xx/clock.c +595 -26
@@ -53,10 +53,10 @@ static struct clk rtc_clk = {static struct pclk_info pll_pclk_info[] = { { .pclk = &osc1_24m_clk, - .pclk_mask =OSC_24M_MASK , + .pclk_val =OSC_24M_VAL , }, { .pclk = &osc3_25m_clk, - .pclk_mask =OSC_25M_MASK , + .pclk_val =OSC_25M_VAL , }, };
@@ -88,16 +88,45 @@ static struct pll_clk_config pll1_config = { .masks = &pll_masks, }; +/* pll rate configuration table, in ascending order of rates */ +struct pll_rate_tbl pll_rtbl[] = { +/* PCLK 24MHz */ + {.mode =0 , .m =0x7D , .n =0x03 , .p =0x2 },/* 500 MHz */ + {.mode =0 , .m =0xA6 , .n =0x03 , .p =0x2 },/* 664 MHz */ + {.mode =0 , .m =0xC8 , .n =0x03 , .p =0x2 },/* 800 MHz */ + {.mode =0 , .m =0xFA , .n =0x06 , .p =0x1 },/* 1000 MHz */ +}; +/* pll1 clock */ static struct clk pll1_clk = { + .flags =ENABLED_ON_INIT , .pclk_sel = &pll_pclk_sel, .pclk_sel_shift =PLL1_CLK_SHIFT , .en_reg =PLL1_CTR , .en_reg_bit =PLL_ENABLE , + .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, + .set_rate = &pll_clk_set_rate, + .rate_config = {pll_rtbl,ARRAY_SIZE (pll_rtbl),3 }, .private_data = &pll1_config, }; +/* pll1div2 clock */ +static struct clk pll1div2_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &pll1_clk, + .div_factor =2 , + .recalc = &follow_parent, +}; + +/* pll1div4 clock */ +static struct clk pll1div4_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &pll1_clk, + .div_factor =4 , + .recalc = &follow_parent, +}; +/* pll2 configuration structure */ static struct pll_clk_config pll2_config = { .mode_reg =PLL2_CTR ,
@@ -111,7 +140,10 @@ static struct clk pll2_clk = { .pclk_sel_shift = PLL2_CLK_SHIFT, .en_reg = PLL2_CTR, .en_reg_bit = PLL_ENABLE, + .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, + .set_rate = &pll_clk_set_rate, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 3}, .private_data = &pll2_config, };
@@ -128,7 +160,10 @@ static struct clk pll3_clk = { .pclk_sel_shift = PLL3_CLK_SHIFT, .en_reg = PLL3_CTR, .en_reg_bit = PLL_ENABLE, + .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, + .set_rate = &pll_clk_set_rate, + .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 3}, .private_data = &pll3_config, };
@@ -139,12 +174,24 @@ static struct pll_clk_config pll4_config = { .masks = &pll_masks, }; +/* pll4 rate configuration table, in ascending order of rates */ +struct pll_rate_tbl pll4_rtbl[] = { + {.mode =0 , .m =0x7D , .n =0x03 , .p =0x2 },/* 500 MHz */ + {.mode =0 , .m =0xA6 , .n =0x03 , .p =0x2 },/* 664 MHz */ + {.mode =0 , .m =0xC8 , .n =0x03 , .p =0x2 },/* 800 MHz */ + {.mode =0 , .m =0xFA , .n =0x06 , .p =0x1 },/* 1000 MHz */ +}; +/* pll4 (DDR) clock */ static struct clk pll4_clk = { + .flags =ENABLED_ON_INIT , .pclk = &osc1_24m_clk, .en_reg =PLL4_CTR , .en_reg_bit =PLL_ENABLE , + .calc_rate = &pll_calc_rate, .recalc = &pll_clk_recalc, + .set_rate = &pll_clk_set_rate, + .rate_config = {pll4_rtbl,ARRAY_SIZE (pll4_rtbl),3 }, .private_data = &pll4_config, };
@@ -192,10 +239,10 @@ static struct clk apb_clk = {static struct pclk_info gpt_pclk_info[] = { { .pclk = &osc1_24m_clk, - .pclk_mask =GPT_OSC24_MASK , + .pclk_val =GPT_OSC24_VAL , }, { .pclk = &apb_clk, - .pclk_mask =GPT_APB_MASK , + .pclk_val =GPT_APB_VAL , }, };
@@ -246,15 +293,8 @@ static struct clk gpt3_clk = {/* watch dog timer clock */ static struct clk wdt_clk = { .flags =ALWAYS_ENABLED , - .pclk = &apb_clk, - .recalc = &follow_parent, -}; - -/* smi clock */ -static struct clk smi_clk = { - .pclk = &ahb_clk, - .en_reg =PERIP1_CLK_ENB , - .en_reg_bit =SMI_CLK_ENB , + .pclk = &cpu_clk, + .div_factor =2 , .recalc = &follow_parent, };
@@ -270,22 +310,42 @@ static struct aux_clk_masks aux_masks = { .yscale_sel_shift = AUX_YSCALE_SHIFT, }; +/* clocks derived multiple parents (pll1, pll5, synthesizers or others) */ /* uart configurations */ -static struct aux_clk_config uart_config = { +static struct aux_clk_config uart_synth_config = { .synth_reg =UART_CLK_SYNT , .masks = &aux_masks, }; -/* clocks derived from pll1 or pll5 */ +/* aux rate configuration table, in ascending order of rates */ +struct aux_rate_tbl aux_rtbl[] = { +/* For PLL1div2 = 500 MHz */ + {.xscale =1 , .yscale =6 , .eq =1 },/* 83 MHz */ + {.xscale =1 , .yscale =4 , .eq =1 },/* 125 MHz */ + {.xscale =1 , .yscale =3 , .eq =1 },/* 166 MHz */ + {.xscale =1 , .yscale =2 , .eq =1 },/* 250 MHz */ +}; + +/* uart synth clock */ +static struct clk uart_synth_clk = { + .en_reg =UART_CLK_SYNT , + .en_reg_bit =AUX_SYNT_ENB , + .pclk = &pll1div2_clk, + .calc_rate = &aux_calc_rate, + .recalc = &aux_clk_recalc, + .set_rate = &aux_clk_set_rate, + .rate_config = {aux_rtbl,ARRAY_SIZE (aux_rtbl),0 }, + .private_data = &uart_synth_config, +}; +/* uart parents */ static struct pclk_info uart_pclk_info[] = { { .pclk = &pll5_clk, - .pclk_mask =AUX_CLK_PLL5_MASK , + .pclk_val =AUX_CLK_PLL5_VAL , }, { - .pclk = &pll1_clk, - .pclk_mask =AUX_CLK_PLL1_MASK , - .scalable =1 , + .pclk = &uart_synth_clk, + .pclk_val =AUX_CLK_SYNT_VAL , }, };
@@ -303,10 +363,469 @@ static struct clk uart_clk = { .en_reg_bit = UART_CLK_ENB, .pclk_sel = &uart_pclk_sel, .pclk_sel_shift = UART_CLK_SHIFT, + .recalc = &follow_parent, +}; + +/* sdhci configurations */ +static struct aux_clk_config sdhci_synth_config = { + .synth_reg =SDHCI_CLK_SYNT , + .masks = &aux_masks, +}; + +/* sdhci synth clock */ +static struct clk sdhci_synth_clk = { + .en_reg =SDHCI_CLK_SYNT , + .en_reg_bit =AUX_SYNT_ENB , + .pclk = &pll1div2_clk, + .calc_rate = &aux_calc_rate, + .recalc = &aux_clk_recalc, + .set_rate = &aux_clk_set_rate, + .rate_config = {aux_rtbl,ARRAY_SIZE (aux_rtbl),2 }, + .private_data = &sdhci_synth_config, +}; + +/* sdhci clock */ +static struct clk sdhci_clk = { + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =SDHCI_CLK_ENB , + .pclk = &sdhci_synth_clk, + .recalc = &follow_parent, +}; + +/* cfxd configurations */ +static struct aux_clk_config cfxd_synth_config = { + .synth_reg =CFXD_CLK_SYNT , + .masks = &aux_masks, +}; + +/* cfxd synth clock */ +static struct clk cfxd_synth_clk = { + .en_reg =CFXD_CLK_SYNT , + .en_reg_bit =AUX_SYNT_ENB , + .pclk = &pll1div2_clk, + .calc_rate = &aux_calc_rate, + .recalc = &aux_clk_recalc, + .set_rate = &aux_clk_set_rate, + .rate_config = {aux_rtbl,ARRAY_SIZE (aux_rtbl),2 }, + .private_data = &cfxd_synth_config, +}; + +/* cfxd clock */ +static struct clk cfxd_clk = { + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =CFXD_CLK_ENB , + .pclk = &cfxd_synth_clk, + .recalc = &follow_parent, +}; + +/* C3 clk configurations */ +static struct aux_clk_config c3_synth_config = { + .synth_reg =C3_CLK_SYNT , + .masks = &aux_masks, +}; + +/* c3 synth clock */ +static struct clk c3_synth_clk = { + .en_reg =C3_CLK_SYNT , + .en_reg_bit =AUX_SYNT_ENB , + .pclk = &pll1div2_clk, + .calc_rate = &aux_calc_rate, + .recalc = &aux_clk_recalc, + .set_rate = &aux_clk_set_rate, + .rate_config = {aux_rtbl,ARRAY_SIZE (aux_rtbl),0 }, + .private_data = &c3_synth_config, +}; + +/* c3 parents */ +static struct pclk_info c3_pclk_info[] = { + { + .pclk = &pll5_clk, + .pclk_val =AUX_CLK_PLL5_VAL , + }, { + .pclk = &c3_synth_clk, + .pclk_val =AUX_CLK_SYNT_VAL , + }, +}; + +/* c3 parent select structure */ +static struct pclk_sel c3_pclk_sel = { + .pclk_info = c3_pclk_info, + .pclk_count =ARRAY_SIZE (c3_pclk_info), + .pclk_sel_reg =PERIP_CLK_CFG , + .pclk_sel_mask =C3_CLK_MASK , +}; + +/* c3 clock */ +static struct clk c3_clk = { + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =C3_CLK_ENB , + .pclk_sel = &c3_pclk_sel, + .pclk_sel_shift =C3_CLK_SHIFT , + .recalc = &follow_parent, +}; + +/* gmac phy clk configurations */ +static struct aux_clk_config gmac_phy_synth_config = { + .synth_reg =GMAC_CLK_SYNT , + .masks = &aux_masks, +}; + +/* gmii external pad clock for phy operation */ +static struct clk gmii_txclk125_pad = { + .flags =ALWAYS_ENABLED , + .rate =125000000 , +}; + +/* gmac phy set of input clks*/ +static struct pclk_info gmac_phy_input_pclk_info[] = { + { + .pclk = &gmii_txclk125_pad, + .pclk_val =GMAC_PHY_PAD_VAL , + }, { + .pclk = &pll2_clk, + .pclk_val =GMAC_PHY_PLL2_VAL , + }, { + .pclk = &osc3_25m_clk, + .pclk_val =GMAC_PHY_OSC3_VAL , + }, +}; + +static struct pclk_sel gmac_phy_input_pclk_sel = { + .pclk_info = gmac_phy_input_pclk_info, + .pclk_count =ARRAY_SIZE (gmac_phy_input_pclk_info), + .pclk_sel_reg =GMAC_CLK_CFG , + .pclk_sel_mask =GMAC_PHY_INPUT_CLK_MASK , +}; + +static struct clk gmac_phy_input_clk = { + .flags =ALWAYS_ENABLED , + .pclk_sel = &gmac_phy_input_pclk_sel, + .pclk_sel_shift =GMAC_PHY_INPUT_CLK_SHIFT , + .recalc = &follow_parent, +}; + +/* gmac rate configuration table, in ascending order of rates */ +struct aux_rate_tbl gmac_rtbl[] = { +/* For gmac phy input clk */ + {.xscale =1 , .yscale =6 , .eq =1 },/* divided by 6 */ + {.xscale =1 , .yscale =4 , .eq =1 },/* divided by 4 */ + {.xscale =1 , .yscale =3 , .eq =1 },/* divided by 3 */ + {.xscale =1 , .yscale =2 , .eq =1 },/* divided by 2 */ +}; + +static struct clk gmac_phy_synth_clk = { + .en_reg =GMAC_CLK_CFG , + .en_reg_bit =GMAC_PHY_SYNT_ENB , + .pclk = &gmac_phy_input_clk, + .calc_rate = &aux_calc_rate, .recalc = &aux_clk_recalc, - .private_data = &uart_config, + .set_rate = &aux_clk_set_rate, + .rate_config = {gmac_rtbl,ARRAY_SIZE (gmac_rtbl),0 }, + .private_data = &gmac_phy_synth_config, +}; + +/* gmac phy parents */ +static struct pclk_info gmac_phy_pclk_info[] = { + { + .pclk = &gmac_phy_input_clk, + .pclk_val =0 , + }, { + .pclk = &gmac_phy_synth_clk, + .pclk_val =1 , + } +}; + +/* gmac phy parent select structure */ +static struct pclk_sel gmac_phy_pclk_sel = { + .pclk_info = gmac_phy_pclk_info, + .pclk_count =ARRAY_SIZE (gmac_phy_pclk_info), + .pclk_sel_reg =GMAC_CLK_CFG , + .pclk_sel_mask =GMAC_PHY_CLK_MASK , +}; + +/* gmac phy clock */ +static struct clk gmac_phy_clk = { + .flags =ALWAYS_ENABLED , + .pclk_sel = &gmac_phy_pclk_sel, + .pclk_sel_shift =GMAC_PHY_CLK_SHIFT , + .recalc = &follow_parent, +}; + +/* clcd synthesizers masks */ +static struct clcd_synth_masks clcd_masks = { + .div_factor_mask =CLCD_SYNT_DIV_FACTOR_MASK , + .div_factor_shift =CLCD_SYNT_DIV_FACTOR_SHIFT , +}; + +static struct clcd_clk_config clcd_synth_config = { + .synth_reg =CLCD_CLK_SYNT , + .masks = &clcd_masks, +}; + +/* clcd synth parents */ +static struct pclk_info clcd_synth_pclk_info[] = { + { + .pclk = &pll1div4_clk, + .pclk_val =CLCD_SYNT_PLL1_DIV4_VAL , + }, { + .pclk = &pll2_clk, + .pclk_val =CLCD_SYNT_PLL2_VAL , + }, +}; + +/* clcd synth parent select structure */ +static struct pclk_sel clcd_synth_pclk_sel = { + .pclk_info = clcd_synth_pclk_info, + .pclk_count =ARRAY_SIZE (clcd_synth_pclk_info), + .pclk_sel_reg =PLL_CFG , + .pclk_sel_mask =CLCD_SYNT_CLK_MASK , +}; + +/* clcd rate configuration table, in ascending order of rates */ +struct clcd_rate_tbl clcd_rtbl[] = { +/* For pll1div4 = 250 MHz */ + {.div =0x4000 },/* 62.5 MHz */ + {.div =0x2000 },/* 125 MHz */ +}; + +/* clcd synth clock */ +static struct clk clcd_synth_clk = { + .en_reg =CLCD_CLK_SYNT , + .en_reg_bit =CLCD_SYNT_ENB , + .pclk_sel = &clcd_synth_pclk_sel, + .pclk_sel_shift =CLCD_SYNT_CLK_SHIFT , + .calc_rate = &clcd_calc_rate, + .recalc = &clcd_clk_recalc, + .set_rate = &clcd_clk_set_rate, + .rate_config = {clcd_rtbl,ARRAY_SIZE (clcd_rtbl),1 }, + .private_data = &clcd_synth_config, +}; + +/* clcd clock parents */ +static struct pclk_info clcd_pclk_info[] = { + { + .pclk = &pll5_clk, + .pclk_val =AUX_CLK_PLL5_VAL , + }, { + .pclk = &clcd_synth_clk, + .pclk_val =AUX_CLK_SYNT_VAL , + }, +}; + +/* clcd parent select structure */ +static struct pclk_sel clcd_pclk_sel = { + .pclk_info = clcd_pclk_info, + .pclk_count =ARRAY_SIZE (clcd_pclk_info), + .pclk_sel_reg =PERIP_CLK_CFG , + .pclk_sel_mask =CLCD_CLK_MASK , +}; + +/* clcd clock */ +static struct clk clcd_clk = { + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =CLCD_CLK_ENB , + .pclk_sel = &clcd_pclk_sel, + .pclk_sel_shift =CLCD_CLK_SHIFT , + .recalc = &follow_parent, +}; + +/* clock derived from ahb clk */ + +/* i2c clock */ +static struct clk i2c_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =I2C_CLK_ENB , + .recalc = &follow_parent, +}; + +/* dma clock */ +static struct clk dma0_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =DMA0_CLK_ENB , + .recalc = &follow_parent, +}; + +static struct clk dma1_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =DMA1_CLK_ENB , + .recalc = &follow_parent, +}; + +/* jpeg clock */ +static struct clk jpeg_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =JPEG_CLK_ENB , + .recalc = &follow_parent, +}; + +/* gmac clock */ +static struct clk gmac_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =GMAC_CLK_ENB , + .recalc = &follow_parent, +}; + +/* fsmc clock */ +static struct clk fsmc_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =FSMC_CLK_ENB , + .recalc = &follow_parent, +}; + +/* smi clock */ +static struct clk smi_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =SMI_CLK_ENB , + .recalc = &follow_parent, +}; + +/* uhc0 clock */ +static struct clk uhci0_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =UHC0_CLK_ENB , + .recalc = &follow_parent, +}; + +/* uhc1 clock */ +static struct clk uhci1_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =UHC1_CLK_ENB , + .recalc = &follow_parent, +}; + +/* usbd clock */ +static struct clk usbd_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =USBD_CLK_ENB , + .recalc = &follow_parent, +}; + +/* pci clocks */ +static struct clk pcie0_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =PCIE0_CLK_ENB , + .recalc = &follow_parent, +}; + +static struct clk pcie1_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =PCIE1_CLK_ENB , + .recalc = &follow_parent, }; +static struct clk pcie2_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =PCIE2_CLK_ENB , + .recalc = &follow_parent, +}; + +/* sysram clocks */ +static struct clk sysram0_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =SYSRAM0_CLK_ENB , + .recalc = &follow_parent, +}; + +static struct clk sysram1_clk = { + .pclk = &ahb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =SYSRAM1_CLK_ENB , + .recalc = &follow_parent, +}; + +/* clock derived from apb clk */ +/* adc clock */ +static struct clk adc_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =ADC_CLK_ENB , + .recalc = &follow_parent, +}; + +/* ssp clock */ +static struct clk ssp_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =SSP_CLK_ENB , + .recalc = &follow_parent, +}; + +/* gpio clock */ +static struct clk gpio0_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =GPIO0_CLK_ENB , + .recalc = &follow_parent, +}; + +/* gpio clock */ +static struct clk gpio1_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =GPIO1_CLK_ENB , + .recalc = &follow_parent, +}; + +/* i2s0 clock */ +static struct clk i2s0_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =I2S0_CLK_ENB , + .recalc = &follow_parent, +}; + +/* i2s1 clock */ +static struct clk i2s1_clk = { + .pclk = &apb_clk, + .en_reg =PERIP1_CLK_ENB , + .en_reg_bit =I2S1_CLK_ENB , + .recalc = &follow_parent, +}; + +/* keyboard clock */ +static struct clk kbd_clk = { + .pclk = &apb_clk, + .en_reg =PERIP2_CLK_ENB , + .en_reg_bit =KBD_CLK_ENB , + .recalc = &follow_parent, +}; + +/* spear1300 machine specific clock structures */ +#ifdef CONFIG_MACH_SPEAR1300 + +#endif + +/* spear1310 machine specific clock structures */ +#ifdef CONFIG_MACH_SPEAR1310 +/* can0 clock */ +static struct clk can0_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &apb_clk, + .recalc = &follow_parent, +}; + +/* can1 clock */ +static struct clk can1_clk = { + .flags =ALWAYS_ENABLED , + .pclk = &apb_clk, + .recalc = &follow_parent, +}; +#endif +/* array of all spear 13xx clock lookups */ static struct clk_lookup spear_clk_lookups[] = {/* root clks */
@@ -315,7 +834,7 @@ static struct clk_lookup spear_clk_lookups[] = { {.con_id = "osc3_25m_clk", .clk = &osc3_25m_clk}, /* clock derived from 32 KHz osc clk */ - {.dev_id = "rtc", .clk = &rtc_clk}, + {.dev_id = "rtc-spear", .clk = &rtc_clk}, /* clock derived from 24/25 MHz osc1/osc3 clk */ {.con_id = "pll1_clk", .clk = &pll1_clk},
@@ -328,18 +847,68 @@ static struct clk_lookup spear_clk_lookups[] = {/* clock derived from pll1 clk */ {.con_id = "cpu_clk", .clk = &cpu_clk}, {.con_id = "ahb_clk", .clk = &ahb_clk}, - { .con_id = "apb_clk", .clk = &apb_clk}, + {.con_id = "apb_clk", .clk = &apb_clk}, + + /* synthesizers/prescaled clocks */ + {.con_id = "pll1div2_clk", .clk = &pll1div2_clk}, + {.con_id = "pll1div4_clk", .clk = &pll1div4_clk}, + {.con_id = "c3_synth_clk", .clk = &c3_synth_clk}, + {.con_id = "gmii_txclk123_pad_clk", .clk = &gmii_txclk125_pad}, + {.con_id = "clcd_synth_clk", .clk = &clcd_synth_clk}, + {.con_id = "uart_synth_clk", .clk = &uart_synth_clk}, + {.con_id = "sdhci_synth_clk", .clk = &sdhci_synth_clk}, + {.con_id = "cfxd_synth_clk", .clk = &cfxd_synth_clk}, + {.con_id = "gmac_phy_input_clk", .clk = &gmac_phy_input_clk}, + {.con_id = "gmac_phy_synth_clk", .clk = &gmac_phy_synth_clk}, + {.con_id = "gmac_phy_clk", .clk = &gmac_phy_clk}, /* clocks having multiple parent source from above clocks */ - {.dev_id = "uart", .clk = &uart_clk}, + {.dev_id = "clcd", .clk = &clcd_clk}, {.dev_id = "gpt0", .clk = &gpt0_clk}, {.dev_id = "gpt1", .clk = &gpt1_clk}, {.dev_id = "gpt2", .clk = &gpt2_clk}, {.dev_id = "gpt3", .clk = &gpt3_clk}, + {.dev_id = "uart", .clk = &uart_clk}, - /* clock derived from ahb/apb clk */ - { .dev_id = "smi", .clk = &smi_clk}, - { .dev_id = "wdt", .clk = &wdt_clk}, + /* clock derived from ahb clk */ + {.dev_id = "smi", .clk = &smi_clk}, + {.con_id = "usbh.0_clk", .clk = &uhci0_clk}, + {.con_id = "usbh.1_clk", .clk = &uhci1_clk}, + {.dev_id = "usbd", .clk = &usbd_clk}, + {.dev_id = "i2c_designware.0", .clk = &i2c_clk}, + {.dev_id = "dma0", .clk = &dma0_clk}, + {.dev_id = "dma1", .clk = &dma1_clk}, + {.dev_id = "jpeg", .clk = &jpeg_clk}, + {.dev_id = "gmac", .clk = &gmac_clk}, + {.dev_id = "c3", .clk = &c3_clk}, + {.dev_id = "pcie0", .clk = &pcie0_clk}, + {.dev_id = "pcie1", .clk = &pcie1_clk}, + {.dev_id = "pcie2", .clk = &pcie2_clk}, + {.dev_id = "cfxd", .clk = &cfxd_clk}, + {.dev_id = "sdhci", .clk = &sdhci_clk}, + {.con_id = "fsmc", .clk = &fsmc_clk}, + {.dev_id = "sysram0", .clk = &sysram0_clk}, + {.dev_id = "sysram1", .clk = &sysram1_clk}, + + /* clock derived from apb clk */ + {.dev_id = "i2s0", .clk = &i2s0_clk}, + {.dev_id = "i2s1", .clk = &i2s1_clk}, + {.dev_id = "adc", .clk = &adc_clk}, + {.dev_id = "ssp-pl022", .clk = &ssp_clk}, + {.dev_id = "gpio0", .clk = &gpio0_clk}, + {.dev_id = "gpio1", .clk = &gpio1_clk}, + {.dev_id = "keyboard", .clk = &kbd_clk}, + {.dev_id = "wdt", .clk = &wdt_clk}, + +/* spear1300 machine specific clock structures */ +#ifdef CONFIG_MACH_SPEAR1300 +#endif + + /* spear1310 machine specific clock structures */ +#ifdef CONFIG_MACH_SPEAR1310 + {.dev_id = "c_can_platform.0", .clk = &can0_clk}, + {.dev_id = "c_can_platform.1", .clk = &can1_clk}, +#endif };void __init clk_init (void )
arch/arm/mach-spear13xx/include/mach/misc_regs.h +64 -37
149 lines not on this page · raw message
arch/arm/mach-spear3xx/clock.c +366 -65
588 lines not on this page · raw message
arch/arm/mach-spear3xx/include/mach/misc_regs.h +3 -2
@@ -63,8 +63,8 @@#define GPT1_CLK_SHIFT 11#define GPT2_CLK_SHIFT 12#define GPT_CLK_MASK 0x1 -#define AUX_CLK_PLL3_MASK 0 -#define AUX_CLK_PLL1_MASK 1 +#define AUX_CLK_PLL3_VAL 0 +#define AUX_CLK_PLL1_VAL 1#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)/* PERIP1_CLK_ENB register masks */
@@ -113,6 +113,7 @@#define RAS3_CLK_SYNT (MISC_BASE + 0x074)#define RAS4_CLK_SYNT (MISC_BASE + 0x078)/* aux clk synthesiser register masks for irda to ras4 */ +#define AUX_SYNT_ENB 31#define AUX_EQ_SEL_SHIFT 30#define AUX_EQ_SEL_MASK 1#define AUX_EQ1_SEL 0
arch/arm/mach-spear6xx/clock.c +238 -93
487 lines not on this page · raw message
arch/arm/mach-spear6xx/include/mach/misc_regs.h +3 -2
@@ -66,8 +66,8 @@#define GPT2_CLK_SHIFT 11#define GPT3_CLK_SHIFT 12#define GPT_CLK_MASK 0x1 -#define AUX_CLK_PLL3_MASK 0 -#define AUX_CLK_PLL1_MASK 1 +#define AUX_CLK_PLL3_VAL 0 +#define AUX_CLK_PLL1_VAL 1#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)/* PERIP1_CLK_ENB register masks */
@@ -123,6 +123,7 @@#define RAS3_CLK_SYNT (MISC_BASE + 0x074)#define RAS4_CLK_SYNT (MISC_BASE + 0x078)/* aux clk synthesiser register masks for irda to ras4 */ +#define AUX_SYNT_ENB 31#define AUX_EQ_SEL_SHIFT 30#define AUX_EQ_SEL_MASK 1#define AUX_EQ1_SEL 0
arch/arm/plat-spear/clock.c +567 -138
874 lines not on this page · raw message
arch/arm/plat-spear/include/plat/clock.h +82 -12
139 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.2.2
Part of the diff is not shown here. View the raw message.
PATCH v6 13/63 ST SPEAr: Updating Clock Support
Quoted 21 lines · Viresh Kumar
<snip>
arch/arm/plat-spear/clock.c +12
-5-/* -* Set pclk as cclk's parent and add clock sibling node to current parents -* children list +/** +* clk_round_rate - adjust a rate to the exact rate a clock can provide +* @clk: clock source +* @rate: desired clock rate in Hz +* +* Returns rounded clock rate in Hz, or negative errno. */ -static void change_parent (struct clk *cclk,struct clk *pclk) +long clk_round_rate (struct clk *clk,unsigned long drate) { -unsigned long flags; +long rate =0 ; +int index; + +/* +* propagate call to parent who supports calc_rate. Similar approach is
arch/arm/plat-spear/clock.c void clk_register(struct clk_lookup *cl) · line 450
Quoted 10 lines
arch/arm/plat-spear/clock.c +10
-0+* used in clk_set_rate. +*/ +if (!clk->calc_rate) { +u32 mult; +if (!clk->pclk) +return clk->rate; + + mult = clk->div_factor ? clk->div_factor :1 ; +return clk_round_rate (clk->pclk, mult * drate) / mult; + }
Now it looks OK.
Stanley.