Add Cygnus audio clock support
Subsystems (3)
Ray Jui
maintainerv2 cover Add Cygnus audio clock support
This patch series adds support for the Cygnus audio clock based on existing iProc clock support
I re-applied this patch series to v4.5-rc1. Full kernel tree is available from GITHUB:
repo: https://github.com/Broadcom/cygnus-linux.git
branch: cygnus-audio-clk-v2
Changes from v1:
- Remove function prototype of a non-exist function 'iproc_audiopll_clk_setup'
- Remove __init macros from all functions prototypes in iproc-clk.h
Ray Jui (1):
clk: iproc: Remove __init from header
Simran Rai (3):
Documentation: dt-bindings: Add DT bindings for Cygnus audio clock
clk: iproc: Add support for Cygnus audio clocks
ARM: dts: enable audio clock support for Cygnus
.../bindings/clock/brcm,iproc-clocks.txt | 6 +++ arch/arm/boot/dts/bcm-cygnus-clock.dtsi | 9 ++++ drivers/clk/bcm/clk-cygnus.c | 59 ++++++++++++++++++++++ drivers/clk/bcm/clk-iproc-pll.c | 41 +++++++++++++-- drivers/clk/bcm/clk-iproc.h | 43 ++++++++++++---- include/dt-bindings/clock/bcm-cygnus.h | 6 +++ 6 files changed, 148 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.1
Ray Jui
maintainerPATCH RESEND v2 1/4 Documentation: dt-bindings: Add DT bindings for Cygnus audio clock
From: Simran Rai <[email protected]>
This patch adds audio clock device tree binding documentation to an existing Cygnus clock DT bindings document.
--- Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/clock/brcm,iproc-clocks.txt +6 -0
@@ -92,6 +92,7 @@ PLL and leaf clock compatible strings for Cygnus are: "brcm,cygnus-lcpll0" "brcm,cygnus-mipipll" "brcm,cygnus-asiu-clk" + "brcm,cygnus-audiopll" The following table defines the set of PLL/clock index and ID for Cygnus. These clock IDs are defined in:
@@ -131,6 +132,11 @@ These clock IDs are defined in: ch4_unused mipipll 5 BCM_CYGNUS_MIPIPLL_CH4_UNUSED ch5_unused mipipll 6 BCM_CYGNUS_MIPIPLL_CH5_UNUSED + audiopll crystal 0 BCM_CYGNUS_AUDIOPLL + ch0_audio audiopll 1 BCM_CYGNUS_AUDIOPLL_CH0 + ch1_audio audiopll 2 BCM_CYGNUS_AUDIOPLL_CH1 + ch2_audio audiopll 3 BCM_CYGNUS_AUDIOPLL_CH2 + Northstar and Northstar Plus ------ PLL and leaf clock compatible strings for Northstar and Northstar Plus are:
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH RESEND v2 1/4] Documentation: dt-bindings: Add DT bindings for Cygnus audio clock
Quoted 10 lines · Ray Jui
From: Simran Rai <[email protected]>
This patch adds audio clock device tree binding documentation to an existing Cygnus clock DT bindings document.
Signed-off-by Simran Rai <[email protected]>Reviewed-by Ray Jui <[email protected]>Reviewed-by Lori Hikichi <[email protected]>Reviewed-by Scott Branden <[email protected]>---
Applied to clk-iproc
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Ray Jui
maintainerPATCH RESEND v2 2/4 clk: iproc: Add support for Cygnus audio clocks
In reply to Ray JuiFrom: Simran Rai <[email protected]>
This patch adds support for Broadcom Cygnus audio PLL and leaf clocks
--- drivers/clk/bcm/clk-cygnus.c | 59 ++++++++++++++++++++++++++++++++++ drivers/clk/bcm/clk-iproc-pll.c | 41 ++++++++++++++++++++--- drivers/clk/bcm/clk-iproc.h | 21 ++++++++++++ include/dt-bindings/clock/bcm-cygnus.h | 6 ++++ 4 files changed, 122 insertions(+), 5 deletions(-)
drivers/clk/bcm/clk-cygnus.c +59 -0
@@ -268,3 +268,62 @@ static void __init cygnus_asiu_init(struct device_node *node)iproc_asiu_setup (node, asiu_div, asiu_gate,ARRAY_SIZE (asiu_div)); }CLK_OF_DECLARE (cygnus_asiu_clk,"brcm,cygnus-asiu-clk" , cygnus_asiu_init); + +/* +* AUDIO PLL VCO frequency parameter table +* +* PLL output frequency = ((ndiv_int + ndiv_frac / 2^20) * +* (parent clock rate / pdiv) +* +* On Cygnus, parent is the 25MHz oscillator +*/ +static const struct iproc_pll_vco_param audiopll_vco_params[] = { +/* rate (Hz) ndiv_int ndiv_frac pdiv */ + {1354750204UL ,54 ,199238 ,1 }, + {1769470191UL ,70 ,816639 ,1 }, +}; + +static const struct iproc_pll_ctrl audiopll = { + .flags =IPROC_CLK_PLL_NEEDS_SW_CFG |IPROC_CLK_PLL_HAS_NDIV_FRAC | +IPROC_CLK_PLL_USER_MODE_ON |IPROC_CLK_PLL_RESET_ACTIVE_LOW , + .reset =RESET_VAL (0x5c ,0 ,1 ), + .dig_filter =DF_VAL (0x48 ,0 ,3 ,6 ,4 ,3 ,3 ), + .sw_ctrl =SW_CTRL_VAL (0x4 ,0 ), + .ndiv_int =REG_VAL (0x8 ,0 ,10 ), + .ndiv_frac =REG_VAL (0x8 ,10 ,20 ), + .pdiv =REG_VAL (0x44 ,0 ,4 ), + .vco_ctrl =VCO_CTRL_VAL (0x0c ,0x10 ), + .status =REG_VAL (0x54 ,0 ,1 ), + .macro_mode =REG_VAL (0x0 ,0 ,3 ), +}; + +static const struct iproc_clk_ctrl audiopll_clk[] = { + [BCM_CYGNUS_AUDIOPLL_CH0 ] = { + .channel =BCM_CYGNUS_AUDIOPLL_CH0 , + .flags =IPROC_CLK_AON | +IPROC_CLK_MCLK_DIV_BY_2 , + .enable =ENABLE_VAL (0x14 ,8 ,10 ,9 ), + .mdiv =REG_VAL (0x14 ,0 ,8 ), + }, + [BCM_CYGNUS_AUDIOPLL_CH1 ] = { + .channel =BCM_CYGNUS_AUDIOPLL_CH1 , + .flags =IPROC_CLK_AON , + .enable =ENABLE_VAL (0x18 ,8 ,10 ,9 ), + .mdiv =REG_VAL (0x18 ,0 ,8 ), + }, + [BCM_CYGNUS_AUDIOPLL_CH2 ] = { + .channel =BCM_CYGNUS_AUDIOPLL_CH2 , + .flags =IPROC_CLK_AON , + .enable =ENABLE_VAL (0x1c ,8 ,10 ,9 ), + .mdiv =REG_VAL (0x1c ,0 ,8 ), + }, +}; + +static void __init cygnus_audiopll_clk_init (struct device_node *node) +{ +iproc_pll_clk_setup (node, &audiopll, audiopll_vco_params, +ARRAY_SIZE (audiopll_vco_params), audiopll_clk, +ARRAY_SIZE (audiopll_clk)); +} +CLK_OF_DECLARE (cygnus_audiopll,"brcm,cygnus-audiopll" , + cygnus_audiopll_clk_init);
drivers/clk/bcm/clk-iproc-pll.c +36 -5
83 lines not on this page · raw message
drivers/clk/bcm/clk-iproc.h +21 -0
@@ -61,6 +61,26 @@#define IPROC_CLK_PLL_SPLIT_STAT_CTRL BIT(6)/* +* Some PLLs have an additional divide by 2 in master clock calculation; +* MCLK = VCO_freq / (Mdiv * 2). Identify this to let the driver know +* of modified calculations +*/ +#define IPROC_CLK_MCLK_DIV_BY_2 BIT(7) + +/* +* Some PLLs provide a look up table for the leaf clock frequencies and +* auto calculates VCO frequency parameters based on the provided leaf +* clock frequencies. They have a user mode that allows the divider +* controls to be determined by the user +*/ +#define IPROC_CLK_PLL_USER_MODE_ON BIT(8) + +/* +* Some PLLs have an active low reset +*/ +#define IPROC_CLK_PLL_RESET_ACTIVE_LOW BIT(9) + +/* * Parameters for VCO frequency configuration * * VCO frequency =
@@ -149,6 +169,7 @@ struct iproc_pll_ctrl {struct iproc_clk_reg_op pdiv;struct iproc_pll_vco_ctrl vco_ctrl;struct iproc_clk_reg_op status; +struct iproc_clk_reg_op macro_mode; };/*
include/dt-bindings/clock/bcm-cygnus.h +6 -0
@@ -65,4 +65,10 @@#define BCM_CYGNUS_ASIU_ADC_CLK 1#define BCM_CYGNUS_ASIU_PWM_CLK 2 +/* AUDIO clock ID */ +#define BCM_CYGNUS_AUDIOPLL 0 +#define BCM_CYGNUS_AUDIOPLL_CH0 1 +#define BCM_CYGNUS_AUDIOPLL_CH1 2 +#define BCM_CYGNUS_AUDIOPLL_CH2 3 +#endif /* _CLOCK_BCM_CYGNUS_H */
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH RESEND v2 2/4] clk: iproc: Add support for Cygnus audio clocks
Quoted 9 lines · Ray Jui
From: Simran Rai <[email protected]>
This patch adds support for Broadcom Cygnus audio PLL and leaf clocks
Signed-off-by Simran Rai <[email protected]>Reviewed-by Scott Branden <[email protected]>Signed-off-by Ray Jui <[email protected]>---
Applied to clk-iproc
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Ray Jui
maintainerPATCH RESEND v2 3/4 clk: iproc: Remove __init from header
In reply to Ray JuiRemove __init macro from all function prototypes in clk-iproc.h
--- drivers/clk/bcm/clk-iproc.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/clk/bcm/clk-iproc.h +11 -11
@@ -204,16 +204,16 @@ struct iproc_asiu_div { unsigned int low_width; }; -void __init iproc_armpll_setup (struct device_node *node); -void __init iproc_pll_clk_setup (struct device_node *node, -const struct iproc_pll_ctrl *pll_ctrl, -const struct iproc_pll_vco_param *vco, -unsigned int num_vco_entries, -const struct iproc_clk_ctrl *clk_ctrl, -unsigned int num_clks); -void __init iproc_asiu_setup (struct device_node *node, -const struct iproc_asiu_div *div, -const struct iproc_asiu_gate *gate, -unsigned int num_clks); +void iproc_armpll_setup (struct device_node *node); +void iproc_pll_clk_setup (struct device_node *node, +const struct iproc_pll_ctrl *pll_ctrl, +const struct iproc_pll_vco_param *vco, +unsigned int num_vco_entries, +const struct iproc_clk_ctrl *clk_ctrl, +unsigned int num_clks); +void iproc_asiu_setup (struct device_node *node, +const struct iproc_asiu_div *div, +const struct iproc_asiu_gate *gate, +unsigned int num_clks);#endif /* _CLK_IPROC_H */
Signature · 1 line
1.9.1
Stephen Boyd
AppliedRe: [PATCH RESEND v2 3/4] clk: iproc: Remove __init from header
Quoted 4 lines · Ray Jui
Remove
__initmacro from all function prototypes inclk-iproc.hSigned-off-by Ray Jui <[email protected]>---
Applied to clk-iproc
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Ray Jui
maintainerPATCH RESEND v2 4/4 ARM: dts: enable audio clock support for Cygnus
In reply to Ray JuiFrom: Simran Rai <[email protected]>
Add audio clock to the existing Broadcom Cygnus clock DT
--- arch/arm/boot/dts/bcm-cygnus-clock.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/bcm-cygnus-clock.dtsi +9 -0
@@ -121,4 +121,13 @@ clocks { clocks = <&osc>; clock-output-names = "keypad", "adc/touch", "pwm"; }; + + audiopll: audiopll { + #clock-cells = <1>; + compatible = "brcm,cygnus-audiopll"; + reg = <0x180aeb00 0x68>; + clocks = <&osc>; + clock-output-names = "audiopll", "ch0_audio", + "ch1_audio", "ch2_audio"; + }; };
Signature · 1 line
1.9.1
Ray Jui
maintainerRe: [PATCH RESEND v2 4/4] ARM: dts: enable audio clock support for Cygnus
Hi Florian,
With Stephen merging the first 3 patches into the clk tree, could you please take this DT patch now?
Thanks,
Ray
Quoted 30 lines · Ray Jui
From: Simran Rai <[email protected]>
Add audio clock to the existing Broadcom Cygnus clock DT
Signed-off-by Simran Rai <[email protected]>Reviewed-by Ray Jui <[email protected]>Reviewed-by Scott Branden <[email protected]>--- arch/arm/boot/dts/bcm-cygnus-clock.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm/boot/dts/bcm-cygnus-clock.dtsi +9
-0@@ -121,4 +121,13 @@ clocks { clocks = <&osc>; clock-output-names = "keypad", "adc/touch", "pwm"; }; + + audiopll: audiopll { + #clock-cells = <1>; + compatible = "brcm,cygnus-audiopll"; + reg = <0x180aeb00 0x68>; + clocks = <&osc>; + clock-output-names = "audiopll", "ch0_audio", + "ch1_audio", "ch2_audio"; + }; };
Florian Fainelli
AppliedRe: [PATCH RESEND v2 4/4] ARM: dts: enable audio clock support for Cygnus
Quoted 17 lines · Ray Jui
Hi Florian,
With Stephen merging the first 3 patches into the clk tree, could you please take this DT patch now?
Thanks,
Ray
Quoted 7 lines · Ray Jui
From: Simran Rai <[email protected]>
Add audio clock to the existing Broadcom Cygnus clock DT
Signed-off-by Simran Rai <[email protected]>Reviewed-by Ray Jui <[email protected]>Reviewed-by Scott Branden <[email protected]>
Applied to devicetree/next, thanks everyone!
Signature · 1 line
Florian