clk: bcm: kona: Add bus clock support, bus clocks for BCM21664/BCM281xx
Subsystems (5)
v2 cover clk: bcm: kona: Add bus clock support, bus clocks for BCM21664/BCM281xx
This patchset does the following:
- Introduce support for bus clocks. These are fairly similar to peripheral clocks, but only implement policy, gate and hyst.
- Add matching bus clocks for BCM21664 and BCM281xx peripheral clocks and update device tree bindings to match.
The previous (RFC) version of this patchset also introduced a prerequisite clock mechanism to enable bus clocks before their corresponding peripheral clocks. It seems that this is unnecessary - the way these clocks are initialized leaves them enabled by default. Thus, the prerequisite mechanism has been dropped from this version.
This is fine for now, and more accurate to hardware (bus clocks are a prerequisite for the bus, not the peripheral clock). I had an idea to connect bus clocks to buses using "simple-pm-bus" in DT, but this is a task for another patchset.
---
Changes in v2:
- Drop prerequisite clock patch
- Move clock/bcm21664.h dt-bindings header change to dt-bindings patch
- Add BCM281xx bus clocks
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Artur Weber (7):
dt-bindings: clock: brcm,kona-ccu: Add BCM21664 bus clocks
dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
clk: bcm: kona: Add support for bus clocks
clk: bcm21664: Add matching bus clocks for peripheral clocks
clk: bcm281xx: Add corresponding bus clocks for peripheral clocks
ARM: dts: bcm2166x-common: Add matching bus clocks for peripheral clocks
ARM: dts: bcm11351: Add corresponding bus clocks for peripheral clocks
.../devicetree/bindings/clock/brcm,kona-ccu.yaml | 37 ++++++- arch/arm/boot/dts/broadcom/bcm11351.dtsi | 33 ++++-- arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 28 +++-- drivers/clk/bcm/clk-bcm21664.c | 83 ++++++++++++++ drivers/clk/bcm/clk-bcm281xx.c | 121 +++++++++++++++++++++ drivers/clk/bcm/clk-kona-setup.c | 116 ++++++++++++++++++++ drivers/clk/bcm/clk-kona.c | 62 ++++++++++- drivers/clk/bcm/clk-kona.h | 10 ++ include/dt-bindings/clock/bcm21664.h | 19 +++- include/dt-bindings/clock/bcm281xx.h | 25 ++++- 10 files changed, 505 insertions(+), 29 deletions(-)
---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250212-kona-bus-clock-4297eefae940
Best regards,
Signature · 1 line
Artur Weber <[email protected]>
PATCH v2 1/7 dt-bindings: clock: brcm,kona-ccu: Add BCM21664 bus clocks
Add bus clocks for hub_timer, sdio, bsc, uart and usb_otg_ahb to the allowed clock output names for BCM21664 CCUs and add the relevant clock IDs to the clock/bcm21664.h dt-bindings header.
---
Changes in v2:
- Move clock ID dt-bindings header changes into this commit
--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 18 ++++++++++++++++-- include/dt-bindings/clock/bcm21664.h | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +16 -2
@@ -40,7 +40,7 @@ properties: clock-output-names: minItems: 1 - maxItems: 10 + maxItems: 14 required: - compatible
@@ -124,7 +124,9 @@ allOf: then: properties: clock-output-names: - const: hub_timer + items: + - const: hub_timer + - const: hub_timer_apb - if: properties: compatible:
@@ -142,6 +144,11 @@ allOf: - const: sdio2_sleep - const: sdio3_sleep - const: sdio4_sleep + - const: sdio1_ahb + - const: sdio2_ahb + - const: sdio3_ahb + - const: sdio4_ahb + - const: usb_otg_ahb - if: properties: compatible:
@@ -158,6 +165,13 @@ allOf: - const: bsc2 - const: bsc3 - const: bsc4 + - const: uartb_apb + - const: uartb2_apb + - const: uartb3_apb + - const: bsc1_apb + - const: bsc2_apb + - const: bsc3_apb + - const: bsc4_apb additionalProperties: false
include/dt-bindings/clock/bcm21664.h +16 -3
@@ -26,7 +26,8 @@/* aon CCU clock ids */ #define BCM21664_AON_CCU_HUB_TIMER 0 -#define BCM21664_AON_CCU_CLOCK_COUNT 1 +#define BCM21664_AON_CCU_HUB_TIMER_APB 1 +#define BCM21664_AON_CCU_CLOCK_COUNT 2/* master CCU clock ids */
@@ -38,7 +39,12 @@#define BCM21664_MASTER_CCU_SDIO2_SLEEP 5#define BCM21664_MASTER_CCU_SDIO3_SLEEP 6#define BCM21664_MASTER_CCU_SDIO4_SLEEP 7 -#define BCM21664_MASTER_CCU_CLOCK_COUNT 8 +#define BCM21664_MASTER_CCU_SDIO1_AHB 8 +#define BCM21664_MASTER_CCU_SDIO2_AHB 9 +#define BCM21664_MASTER_CCU_SDIO3_AHB 10 +#define BCM21664_MASTER_CCU_SDIO4_AHB 11 +#define BCM21664_MASTER_CCU_USB_OTG_AHB 12 +#define BCM21664_MASTER_CCU_CLOCK_COUNT 13/* slave CCU clock ids */
@@ -49,6 +55,13 @@#define BCM21664_SLAVE_CCU_BSC2 4#define BCM21664_SLAVE_CCU_BSC3 5#define BCM21664_SLAVE_CCU_BSC4 6 -#define BCM21664_SLAVE_CCU_CLOCK_COUNT 7 +#define BCM21664_SLAVE_CCU_BSC1_APB 7 +#define BCM21664_SLAVE_CCU_BSC2_APB 8 +#define BCM21664_SLAVE_CCU_BSC3_APB 9 +#define BCM21664_SLAVE_CCU_BSC4_APB 10 +#define BCM21664_SLAVE_CCU_UARTB_APB 11 +#define BCM21664_SLAVE_CCU_UARTB2_APB 12 +#define BCM21664_SLAVE_CCU_UARTB3_APB 13 +#define BCM21664_SLAVE_CCU_CLOCK_COUNT 14#endif /* _CLOCK_BCM21664_H */
Signature · 1 line
2.48.1
Re: [PATCH v2 1/7] dt-bindings: clock: brcm,kona-ccu: Add BCM21664 bus clocks
include/dt-bindings/clock/bcm21664.h line 29
Quoted 9 lines · Artur Weber
include/dt-bindings/clock/bcm21664.h +0
-1@@ -26,7 +26,8 @@/* aon CCU clock ids */ #define BCM21664_AON_CCU_HUB_TIMER 0 -#define BCM21664_AON_CCU_CLOCK_COUNT 1
Same comment as other patch - this cannot change or it is not an ABI.
Best regards,
Krzysztof
PATCH v2 2/7 dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
In reply to Artur WeberAdd bus clocks corresponding to peripheral clocks currently supported by the BCM281xx clock driver and add the relevant clock IDs to the clock/bcm281xx.h dt-bindings header.
---
Changes in v2:
- Add this commit (BCM281xx bus clocks)
--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 21 +++++++++++++++++- include/dt-bindings/clock/bcm281xx.h | 25 +++++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +20 -1
@@ -40,7 +40,7 @@ properties: clock-output-names: minItems: 1 - maxItems: 14 + maxItems: 20 required: - compatible
@@ -61,6 +61,8 @@ allOf: - const: hub_timer - const: pmu_bsc - const: pmu_bsc_var + - const: hub_timer_apb + - const: pmu_bsc_apb - if: properties: compatible:
@@ -86,6 +88,13 @@ allOf: - const: usb_ic - const: hsic2_48m - const: hsic2_12m + - const: sdio1_ahb + - const: sdio2_ahb + - const: sdio3_ahb + - const: sdio4_ahb + - const: usb_ic_ahb + - const: hsic2_ahb + - const: usb_otg_ahb - if: properties: compatible:
@@ -116,6 +125,16 @@ allOf: - const: bsc2 - const: bsc3 - const: pwm + - const: uartb_apb + - const: uartb2_apb + - const: uartb3_apb + - const: uartb4_apb + - const: ssp0_apb + - const: ssp2_apb + - const: bsc1_apb + - const: bsc2_apb + - const: bsc3_apb + - const: pwm_apb - if: properties: compatible:
include/dt-bindings/clock/bcm281xx.h +22 -3
@@ -34,7 +34,9 @@#define BCM281XX_AON_CCU_HUB_TIMER 0#define BCM281XX_AON_CCU_PMU_BSC 1#define BCM281XX_AON_CCU_PMU_BSC_VAR 2 -#define BCM281XX_AON_CCU_CLOCK_COUNT 3 +#define BCM281XX_AON_CCU_HUB_TIMER_APB 3 +#define BCM281XX_AON_CCU_PMU_BSC_APB 4 +#define BCM281XX_AON_CCU_CLOCK_COUNT 5/* hub CCU clock ids */
@@ -50,7 +52,14 @@#define BCM281XX_MASTER_CCU_USB_IC 4#define BCM281XX_MASTER_CCU_HSIC2_48M 5#define BCM281XX_MASTER_CCU_HSIC2_12M 6 -#define BCM281XX_MASTER_CCU_CLOCK_COUNT 7 +#define BCM281XX_MASTER_CCU_SDIO1_AHB 7 +#define BCM281XX_MASTER_CCU_SDIO2_AHB 8 +#define BCM281XX_MASTER_CCU_SDIO3_AHB 9 +#define BCM281XX_MASTER_CCU_SDIO4_AHB 10 +#define BCM281XX_MASTER_CCU_USB_IC_AHB 11 +#define BCM281XX_MASTER_CCU_HSIC2_AHB 12 +#define BCM281XX_MASTER_CCU_USB_OTG_AHB 13 +#define BCM281XX_MASTER_CCU_CLOCK_COUNT 14/* slave CCU clock ids */
@@ -64,6 +73,16 @@#define BCM281XX_SLAVE_CCU_BSC2 7#define BCM281XX_SLAVE_CCU_BSC3 8#define BCM281XX_SLAVE_CCU_PWM 9 -#define BCM281XX_SLAVE_CCU_CLOCK_COUNT 10 +#define BCM281XX_SLAVE_CCU_UARTB_APB 10 +#define BCM281XX_SLAVE_CCU_UARTB2_APB 11 +#define BCM281XX_SLAVE_CCU_UARTB3_APB 12 +#define BCM281XX_SLAVE_CCU_UARTB4_APB 13 +#define BCM281XX_SLAVE_CCU_SSP0_APB 14 +#define BCM281XX_SLAVE_CCU_SSP2_APB 15 +#define BCM281XX_SLAVE_CCU_BSC1_APB 16 +#define BCM281XX_SLAVE_CCU_BSC2_APB 17 +#define BCM281XX_SLAVE_CCU_BSC3_APB 18 +#define BCM281XX_SLAVE_CCU_PWM_APB 19 +#define BCM281XX_SLAVE_CCU_CLOCK_COUNT 20#endif /* _CLOCK_BCM281XX_H */
Signature · 1 line
2.48.1
Rob Herring (Arm)
maintainerRe: [PATCH v2 2/7] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
Quoted 4 lines · Artur Weber
Add bus clocks corresponding to peripheral clocks currently supported by the BCM281xx clock driver and add the relevant clock IDs to the
clock/bcm281xx.hdt-bindings header.
Quoted 9 lines
Signed-off-by Artur Weber <[email protected]>---
Changes in v2:
- Add this commit (BCM281xx bus clocks)--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 21 +++++++++++++++++- include/dt-bindings/clock/bcm281xx.h | 25 +++++++++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/brcm,kona-ccu.example.dtb: clock-controller@3e011000: clock-output-names: ['uartb', 'uartb2', 'uartb3', 'uartb4', 'ssp0', 'ssp2', 'bsc1', 'bsc2', 'bsc3', 'pwm'] is too short
from schema $id: http://devicetree.org/schemas/clock/brcm,kona-ccu.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH v2 2/7] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
In reply to Artur Weberinclude/dt-bindings/clock/bcm281xx.h line 37
Quoted 12 lines · Artur Weber
- if:
properties:
compatible:include/dt-bindings/clock/bcm281xx.h +0
-1@@ -34,7 +34,9 @@#define BCM281XX_AON_CCU_HUB_TIMER 0#define BCM281XX_AON_CCU_PMU_BSC 1#define BCM281XX_AON_CCU_PMU_BSC_VAR 2 -#define BCM281XX_AON_CCU_CLOCK_COUNT 3
You cannot change defines, it is an ABI. Unless it is not an ABI... so just drop all these counts in separate patch, just like we were doing for other platforms.
Best regards,
Krzysztof
Re: [PATCH v2 2/7] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
Quoted 17 lines · Krzysztof Kozlowski
include/dt-bindings/clock/bcm281xx.h line 37
Quoted 12 lines · Artur Weber
- if:
properties:
compatible:include/dt-bindings/clock/bcm281xx.h +0
-1@@ -34,7 +34,9 @@#define BCM281XX_AON_CCU_HUB_TIMER 0#define BCM281XX_AON_CCU_PMU_BSC 1#define BCM281XX_AON_CCU_PMU_BSC_VAR 2 -#define BCM281XX_AON_CCU_CLOCK_COUNT 3You cannot change defines, it is an ABI. Unless it is not an ABI... so just drop all these counts in separate patch, just like we were doing for other platforms.
The clock count defines are not used in device trees, only in the driver. Most likely clock count defines were included since the driver already uses clock ID defines from the DT binding header.
I'll drop the clock count defines in the next version, and see what I can do to adapt the clock driver.
Best regards
Artur
PATCH v2 3/7 clk: bcm: kona: Add support for bus clocks
In reply to Artur WeberIntroduce support for bus clocks into the Broadcom Kona common clock driver. Most of these functions have been adapted from their peripheral clock counterparts, as they are nearly identical (bus clocks are just much more limited in terms of allowed operations).
--- drivers/clk/bcm/clk-kona-setup.c | 116 +++++++++++++++++++++++++++++++++++++++ drivers/clk/bcm/clk-kona.c | 62 ++++++++++++++++++++- drivers/clk/bcm/clk-kona.h | 10 ++++ 3 files changed, 187 insertions(+), 1 deletion(-)
drivers/clk/bcm/clk-kona-setup.c +116 -0
@@ -167,6 +167,58 @@ static bool peri_clk_data_offsets_valid(struct kona_clk *bcm_clk)return true; } +static bool bus_clk_data_offsets_valid (struct kona_clk *bcm_clk) +{ +struct bus_clk_data *bus; +struct bcm_clk_policy *policy; +struct bcm_clk_gate *gate; +struct bcm_clk_hyst *hyst; +const char *name; +u32 range; +u32 limit; + +BUG_ON (bcm_clk->type != bcm_clk_bus); + bus = bcm_clk->u.bus; + name = bcm_clk->init_data.name; + range = bcm_clk->ccu->range; + + limit = range -sizeof (u32); + limit =round_down (limit,sizeof (u32)); + + policy = &bus->policy; +if (policy_exists (policy)) { +if (policy->offset > limit) { +pr_err ("%s: bad policy offset for %s (%u > %u)\n" , + __func__, name, policy->offset, limit); +return false; + } + } + + gate = &bus->gate; + hyst = &bus->hyst; +if (gate_exists (gate)) { +if (gate->offset > limit) { +pr_err ("%s: bad gate offset for %s (%u > %u)\n" , + __func__, name, gate->offset, limit); +return false; + } + +if (hyst_exists (hyst)) { +if (hyst->offset > limit) { +pr_err ("%s: bad hysteresis offset for %s " +"(%u > %u)\n" , __func__, + name, hyst->offset, limit); +return false; + } + } + }else if (hyst_exists (hyst)) { +pr_err ("%s: hysteresis but no gate for %s\n" , __func__, name); +return false; + } + +return true; +} +/* A bit position must be less than the number of bits in a 32-bit register. */ static bool bit_posn_valid (u32 bit_posn,const char *field_name,const char *clock_name)
@@ -481,9 +533,46 @@ peri_clk_data_valid(struct kona_clk *bcm_clk)return kona_dividers_valid (bcm_clk); } +/* Determine whether the set of bus clock registers are valid. */ +static bool +bus_clk_data_valid (struct kona_clk *bcm_clk) +{ +struct bus_clk_data *bus; +struct bcm_clk_policy *policy; +struct bcm_clk_gate *gate; +struct bcm_clk_hyst *hyst; +const char *name; + +BUG_ON (bcm_clk->type != bcm_clk_bus); + +if (!bus_clk_data_offsets_valid (bcm_clk)) +return false; + + bus = bcm_clk->u.bus; + name = bcm_clk->init_data.name; + + policy = &bus->policy; +if (policy_exists (policy) && !policy_valid (policy, name)) +return false; + + gate = &bus->gate; +if (gate_exists (gate) && !gate_valid (gate,"gate" , name)) +return false; + + hyst = &bus->hyst; +if (hyst_exists (hyst) && !hyst_valid (hyst, name)) +return false; + +return true; +} +static bool kona_clk_valid (struct kona_clk *bcm_clk) {switch (bcm_clk->type) { +case bcm_clk_bus: +if (!bus_clk_data_valid (bcm_clk)) +return false; +break ;case bcm_clk_peri:if (!peri_clk_data_valid (bcm_clk))return false;
@@ -656,6 +745,14 @@ static void peri_clk_teardown(struct peri_clk_data *data,clk_sel_teardown (&data->sel, init_data); } +static void bus_clk_teardown (struct bus_clk_data *data, +struct clk_init_data *init_data) +{ + init_data->num_parents =0 ; +kfree (init_data->parent_names); + init_data->parent_names =NULL ; +} +/* * Caller is responsible for freeing the parent_names[] and * parent_sel[] arrays in the peripheral clock's "data" structure
@@ -670,9 +767,23 @@ peri_clk_setup(struct peri_clk_data *data, struct clk_init_data *init_data)return clk_sel_setup (data->clocks, &data->sel, init_data); } +static int +bus_clk_setup (struct bus_clk_data *data,struct clk_init_data *init_data) +{ + init_data->flags =CLK_IGNORE_UNUSED ; + + init_data->parent_names =NULL ; + init_data->num_parents =0 ; + +return 0 ; +} +static void bcm_clk_teardown (struct kona_clk *bcm_clk) {switch (bcm_clk->type) { +case bcm_clk_bus: +bus_clk_teardown (bcm_clk->u.data, &bcm_clk->init_data); +break ;case bcm_clk_peri:peri_clk_teardown (bcm_clk->u.data, &bcm_clk->init_data);break ;
@@ -702,6 +813,11 @@ static int kona_clk_setup(struct kona_clk *bcm_clk)struct clk_init_data *init_data = &bcm_clk->init_data;switch (bcm_clk->type) { +case bcm_clk_bus: + ret =bus_clk_setup (bcm_clk->u.data, init_data); +if (ret) +return ret; +break ;case bcm_clk_peri: ret =peri_clk_setup (bcm_clk->u.data, init_data);if (ret)
drivers/clk/bcm/clk-kona.c +61 -1
77 lines not on this page · raw message
drivers/clk/bcm/clk-kona.h +10 -0
@@ -390,6 +390,14 @@ struct peri_clk_data {struct bcm_clk_sel sel;const char *clocks[];/* must be last; use CLOCKS() to declare */ }; + +struct bus_clk_data { +struct bcm_clk_policy policy; +struct bcm_clk_gate gate; +struct bcm_clk_hyst hyst; +const char *clocks[];/* must be last; use CLOCKS() to declare */ +}; +#define CLOCKS (...) { __VA_ARGS__, NULL, }#define NO_CLOCKS { NULL, }/* Must use of no parent clocks */
@@ -401,6 +409,7 @@ struct kona_clk {union {void *data;struct peri_clk_data *peri; +struct bus_clk_data *bus; } u; };#define to_kona_clk (_hw) \
@@ -488,6 +497,7 @@ struct ccu_data {/* Exported globals */ extern struct clk_ops kona_peri_clk_ops; +extern struct clk_ops kona_bus_clk_ops;/* Externally visible functions */
Signature · 1 line
2.48.1
PATCH v2 4/7 clk: bcm21664: Add matching bus clocks for peripheral clocks
In reply to Artur WeberNow that bus clock support has been implemented into the Broadcom Kona clock driver, add bus clocks corresponding to HUB_TIMER, SDIO, UART and BSC, as well as the USB OTG bus clock.
---
Changes in v2:
- Adapt to dropped prereq clocks
--- drivers/clk/bcm/clk-bcm21664.c | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+)
drivers/clk/bcm/clk-bcm21664.c +83 -0
@@ -39,6 +39,11 @@ static struct peri_clk_data hub_timer_data = { .trig = TRIGGER(0x0a40, 4), }; +static struct bus_clk_data hub_timer_apb_data = { + .gate =HW_SW_GATE (0x0414 ,18 ,3 ,2 ), + .hyst =HYST (0x0414 ,10 ,11 ), +}; +static struct ccu_data aon_ccu_data = {BCM21664_CCU_COMMON (aon,AON ), .policy = {
@@ -48,6 +53,8 @@ static struct ccu_data aon_ccu_data = { .kona_clks = { [BCM21664_AON_CCU_HUB_TIMER ] = KONA_CLK(aon, hub_timer, peri), + [BCM21664_AON_CCU_HUB_TIMER_APB ] = + KONA_CLK(aon, hub_timer_apb, bus), [BCM21664_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
@@ -122,6 +129,26 @@ static struct peri_clk_data sdio4_sleep_data = { .gate = HW_SW_GATE(0x0360, 18, 2, 3), }; +static struct bus_clk_data sdio1_ahb_data = { + .gate =HW_SW_GATE (0x0358 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data sdio2_ahb_data = { + .gate =HW_SW_GATE (0x035c ,16 ,0 ,1 ), +}; + +static struct bus_clk_data sdio3_ahb_data = { + .gate =HW_SW_GATE (0x0364 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data sdio4_ahb_data = { + .gate =HW_SW_GATE (0x0360 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data usb_otg_ahb_data = { + .gate =HW_SW_GATE (0x0348 ,16 ,0 ,1 ), +}; +static struct ccu_data master_ccu_data = {BCM21664_CCU_COMMON (master,MASTER ), .policy = {
@@ -145,6 +172,16 @@ static struct ccu_data master_ccu_data = { KONA_CLK(master, sdio3_sleep, peri), [BCM21664_MASTER_CCU_SDIO4_SLEEP ] = KONA_CLK(master, sdio4_sleep, peri), + [BCM21664_MASTER_CCU_SDIO1_AHB ] = + KONA_CLK(master, sdio1_ahb, bus), + [BCM21664_MASTER_CCU_SDIO2_AHB ] = + KONA_CLK(master, sdio2_ahb, bus), + [BCM21664_MASTER_CCU_SDIO3_AHB ] = + KONA_CLK(master, sdio3_ahb, bus), + [BCM21664_MASTER_CCU_SDIO4_AHB ] = + KONA_CLK(master, sdio4_ahb, bus), + [BCM21664_MASTER_CCU_USB_OTG_AHB ] = + KONA_CLK(master, usb_otg_ahb, bus), [BCM21664_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
@@ -225,6 +262,38 @@ static struct peri_clk_data bsc4_data = { .trig = TRIGGER(0x0afc, 19), }; +static struct bus_clk_data uartb_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0400 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data uartb2_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0404 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data uartb3_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0408 ,16 ,0 ,1 ), +}; + +static struct bus_clk_data bsc1_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0458 ,16 ,0 ,1 ), + .hyst =HYST (0x0458 ,8 ,9 ), +}; + +static struct bus_clk_data bsc2_apb_data = { + .gate =HW_SW_GATE_AUTO (0x045c ,16 ,0 ,1 ), + .hyst =HYST (0x045c ,8 ,9 ), +}; + +static struct bus_clk_data bsc3_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0470 ,16 ,0 ,1 ), + .hyst =HYST (0x0470 ,8 ,9 ), +}; + +static struct bus_clk_data bsc4_apb_data = { + .gate =HW_SW_GATE_AUTO (0x0474 ,16 ,0 ,1 ), + .hyst =HYST (0x0474 ,8 ,9 ), +}; +static struct ccu_data slave_ccu_data = {BCM21664_CCU_COMMON (slave,SLAVE ), .policy = {
@@ -246,6 +315,20 @@ static struct ccu_data slave_ccu_data = { KONA_CLK(slave, bsc3, peri), [BCM21664_SLAVE_CCU_BSC4 ] = KONA_CLK(slave, bsc4, peri), + [BCM21664_SLAVE_CCU_UARTB_APB ] = + KONA_CLK(slave, uartb_apb, bus), + [BCM21664_SLAVE_CCU_UARTB2_APB ] = + KONA_CLK(slave, uartb2_apb, bus), + [BCM21664_SLAVE_CCU_UARTB3_APB ] = + KONA_CLK(slave, uartb3_apb, bus), + [BCM21664_SLAVE_CCU_BSC1_APB ] = + KONA_CLK(slave, bsc1_apb, bus), + [BCM21664_SLAVE_CCU_BSC2_APB ] = + KONA_CLK(slave, bsc2_apb, bus), + [BCM21664_SLAVE_CCU_BSC3_APB ] = + KONA_CLK(slave, bsc3_apb, bus), + [BCM21664_SLAVE_CCU_BSC4_APB ] = + KONA_CLK(slave, bsc4_apb, bus), [BCM21664_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
Signature · 1 line
2.48.1
PATCH v2 5/7 clk: bcm281xx: Add corresponding bus clocks for peripheral clocks
In reply to Artur WeberAdd bus clocks corresponding to peripheral clocks currently supported by the BCM281xx clock driver.
---
Changes in v2:
- Add this patch (BCM281xx bus clocks)
--- drivers/clk/bcm/clk-bcm281xx.c | 121 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+)
drivers/clk/bcm/clk-bcm281xx.c +121 -0
@@ -57,6 +57,16 @@ static struct peri_clk_data pmu_bsc_var_data = { .trig = TRIGGER(0x0a40, 2), }; +static struct bus_clk_data hub_timer_apb_data = { + .gate =HW_SW_GATE (0x0414 ,18 ,3 ,2 ), + .hyst =HYST (0x0414 ,10 ,11 ), +}; + +static struct bus_clk_data pmu_bsc_apb_data = { + .gate =HW_SW_GATE (0x0418 ,18 ,3 ,2 ), + .hyst =HYST (0x0418 ,10 ,11 ), +}; +static struct ccu_data aon_ccu_data = {BCM281XX_CCU_COMMON (aon,AON ), .kona_clks = {
@@ -66,6 +76,10 @@ static struct ccu_data aon_ccu_data = { KONA_CLK(aon, pmu_bsc, peri), [BCM281XX_AON_CCU_PMU_BSC_VAR ] = KONA_CLK(aon, pmu_bsc_var, peri), + [BCM281XX_AON_CCU_HUB_TIMER_APB ] = + KONA_CLK(aon, hub_timer_apb, bus), + [BCM281XX_AON_CCU_PMU_BSC_APB ] = + KONA_CLK(aon, pmu_bsc_apb, bus), [BCM281XX_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
@@ -172,6 +186,35 @@ static struct peri_clk_data hsic2_12m_data = { .trig = TRIGGER(0x0afc, 5), }; +static struct bus_clk_data sdio1_ahb_data = { + .gate =HW_SW_GATE (0x0358 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data sdio2_ahb_data = { + .gate =HW_SW_GATE (0x035c ,16 ,1 ,0 ), +}; + +static struct bus_clk_data sdio3_ahb_data = { + .gate =HW_SW_GATE (0x0364 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data sdio4_ahb_data = { + .gate =HW_SW_GATE (0x0360 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data usb_ic_ahb_data = { + .gate =HW_SW_GATE (0x0354 ,16 ,1 ,0 ), +}; + +/* also called usbh_ahb */ +static struct bus_clk_data hsic2_ahb_data = { + .gate =HW_SW_GATE (0x0370 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data usb_otg_ahb_data = { + .gate =HW_SW_GATE (0x0348 ,16 ,1 ,0 ), +}; +static struct ccu_data master_ccu_data = {BCM281XX_CCU_COMMON (master,MASTER ), .kona_clks = {
@@ -189,6 +232,20 @@ static struct ccu_data master_ccu_data = { KONA_CLK(master, hsic2_48m, peri), [BCM281XX_MASTER_CCU_HSIC2_12M ] = KONA_CLK(master, hsic2_12m, peri), + [BCM281XX_MASTER_CCU_SDIO1_AHB ] = + KONA_CLK(master, sdio1_ahb, bus), + [BCM281XX_MASTER_CCU_SDIO2_AHB ] = + KONA_CLK(master, sdio2_ahb, bus), + [BCM281XX_MASTER_CCU_SDIO3_AHB ] = + KONA_CLK(master, sdio3_ahb, bus), + [BCM281XX_MASTER_CCU_SDIO4_AHB ] = + KONA_CLK(master, sdio4_ahb, bus), + [BCM281XX_MASTER_CCU_USB_IC_AHB ] = + KONA_CLK(master, usb_ic_ahb, bus), + [BCM281XX_MASTER_CCU_HSIC2_AHB ] = + KONA_CLK(master, hsic2_ahb, bus), + [BCM281XX_MASTER_CCU_USB_OTG_AHB ] = + KONA_CLK(master, usb_otg_ahb, bus), [BCM281XX_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
@@ -301,6 +358,50 @@ static struct peri_clk_data pwm_data = { .trig = TRIGGER(0x0afc, 15), }; +static struct bus_clk_data uartb_apb_data = { + .gate =HW_SW_GATE (0x0400 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data uartb2_apb_data = { + .gate =HW_SW_GATE (0x0404 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data uartb3_apb_data = { + .gate =HW_SW_GATE (0x0408 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data uartb4_apb_data = { + .gate =HW_SW_GATE (0x040c ,16 ,1 ,0 ), +}; + +static struct bus_clk_data ssp0_apb_data = { + .gate =HW_SW_GATE (0x0410 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data ssp2_apb_data = { + .gate =HW_SW_GATE (0x0418 ,16 ,1 ,0 ), +}; + +static struct bus_clk_data bsc1_apb_data = { + .gate =HW_SW_GATE (0x0458 ,16 ,1 ,0 ), + .hyst =HYST (0x0458 ,8 ,9 ), +}; + +static struct bus_clk_data bsc2_apb_data = { + .gate =HW_SW_GATE (0x045c ,16 ,1 ,0 ), + .hyst =HYST (0x045c ,8 ,9 ), +}; + +static struct bus_clk_data bsc3_apb_data = { + .gate =HW_SW_GATE (0x0484 ,16 ,1 ,0 ), + .hyst =HYST (0x0484 ,8 ,9 ), +}; + +static struct bus_clk_data pwm_apb_data = { + .gate =HW_SW_GATE (0x0468 ,16 ,1 ,0 ), + .hyst =HYST (0x0468 ,8 ,9 ), +}; +static struct ccu_data slave_ccu_data = {BCM281XX_CCU_COMMON (slave,SLAVE ), .kona_clks = {
@@ -324,6 +425,26 @@ static struct ccu_data slave_ccu_data = { KONA_CLK(slave, bsc3, peri), [BCM281XX_SLAVE_CCU_PWM ] = KONA_CLK(slave, pwm, peri), + [BCM281XX_SLAVE_CCU_UARTB_APB ] = + KONA_CLK(slave, uartb_apb, bus), + [BCM281XX_SLAVE_CCU_UARTB2_APB ] = + KONA_CLK(slave, uartb2_apb, bus), + [BCM281XX_SLAVE_CCU_UARTB3_APB ] = + KONA_CLK(slave, uartb3_apb, bus), + [BCM281XX_SLAVE_CCU_UARTB4_APB ] = + KONA_CLK(slave, uartb4_apb, bus), + [BCM281XX_SLAVE_CCU_SSP0_APB ] = + KONA_CLK(slave, ssp0_apb, bus), + [BCM281XX_SLAVE_CCU_SSP2_APB ] = + KONA_CLK(slave, ssp2_apb, bus), + [BCM281XX_SLAVE_CCU_BSC1_APB ] = + KONA_CLK(slave, bsc1_apb, bus), + [BCM281XX_SLAVE_CCU_BSC2_APB ] = + KONA_CLK(slave, bsc2_apb, bus), + [BCM281XX_SLAVE_CCU_BSC3_APB ] = + KONA_CLK(slave, bsc3_apb, bus), + [BCM281XX_SLAVE_CCU_PWM_APB ] = + KONA_CLK(slave, pwm_apb, bus), [BCM281XX_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK, }, };
Signature · 1 line
2.48.1
PATCH v2 6/7 ARM: dts: bcm2166x-common: Add matching bus clocks for peripheral clocks
In reply to Artur WeberFollowing changes in the clock driver, add bus clocks for timer, SDIO, BSC and UART to the DTS clock output names. Replace the usb_otg_ahb fixed clock with the real bus clock.
--- arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-)
arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi +18 -10
@@ -143,7 +143,7 @@ usbotg: usb@e20000 { compatible = "snps,dwc2"; reg = <0x00e20000 0x10000>; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&usb_otg_ahb_clk>; + clocks = <&master_ccu BCM21664_MASTER_CCU_USB_OTG_AHB>; clock-names = "otg"; phys = <&usbphy>; phy-names = "usb2-phy";
@@ -248,12 +248,6 @@ var_52m_clk: var_52m { clock-frequency = <52000000>; }; - usb_otg_ahb_clk: usb_otg_ahb { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <52000000>; - }; - ref_96m_clk: ref_96m { #clock-cells = <0>; compatible = "fixed-clock";
@@ -301,7 +295,8 @@ aon_ccu: aon_ccu@35002000 { compatible = "brcm,bcm21664-aon-ccu"; reg = <0x35002000 0x0f00>; #clock-cells = <1>; - clock-output-names = "hub_timer"; + clock-output-names = "hub_timer", + "hub_timer_apb"; }; slave_ccu: slave_ccu@3e011000 {
@@ -314,7 +309,15 @@ slave_ccu: slave_ccu@3e011000 { "bsc1", "bsc2", "bsc3", - "bsc4"; + "bsc4", + "uartb_apb", + "uartb2_apb", + "uartb3_apb", + "bsc1_apb", + "bsc2_apb", + "bsc3_apb", + "bsc4_apb"; + }; master_ccu: master_ccu@3f001000 {
@@ -328,7 +331,12 @@ master_ccu: master_ccu@3f001000 { "sdio1_sleep", "sdio2_sleep", "sdio3_sleep", - "sdio4_sleep"; + "sdio4_sleep", + "sdio1_ahb", + "sdio2_ahb", + "sdio3_ahb", + "sdio4_ahb", + "usb_otg_ahb"; }; }; };
Signature · 1 line
2.48.1
PATCH v2 7/7 ARM: dts: bcm11351: Add corresponding bus clocks for peripheral clocks
In reply to Artur WeberFollowing changes in the clock driver, add matching bus clocks for existing peripheral clocks. Replace the usb_otg_ahb fixed clock with the real bus clock.
---
Changes in v2:
- Add this patch (BCM281xx bus clocks)
--- arch/arm/boot/dts/broadcom/bcm11351.dtsi | 33 ++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
arch/arm/boot/dts/broadcom/bcm11351.dtsi +23 -10
@@ -233,7 +233,9 @@ aon_ccu: aon_ccu@35002000 { #clock-cells = <1>; clock-output-names = "hub_timer", "pmu_bsc", - "pmu_bsc_var"; + "pmu_bsc_var", + "hub_timer_apb", + "pmu_bsc_apb"; }; master_ccu: master_ccu@3f001000 {
@@ -246,7 +248,14 @@ master_ccu: master_ccu@3f001000 { "sdio4", "usb_ic", "hsic2_48m", - "hsic2_12m"; + "hsic2_12m", + "sdio1_ahb", + "sdio2_ahb", + "sdio3_ahb", + "sdio4_ahb", + "usb_ic_ahb", + "hsic2_ahb", + "usb_otg_ahb"; }; slave_ccu: slave_ccu@3e011000 {
@@ -262,7 +271,17 @@ slave_ccu: slave_ccu@3e011000 { "bsc1", "bsc2", "bsc3", - "pwm"; + "pwm", + "uartb_apb", + "uartb2_apb", + "uartb3_apb", + "uartb4_apb", + "ssp0_apb", + "ssp2_apb", + "bsc1_apb", + "bsc2_apb", + "bsc3_apb", + "pwm_apb"; }; ref_1m_clk: ref_1m {
@@ -325,12 +344,6 @@ var_52m_clk: var_52m { clock-frequency = <52000000>; }; - usb_otg_ahb_clk: usb_otg_ahb { - compatible = "fixed-clock"; - clock-frequency = <52000000>; - #clock-cells = <0>; - }; - ref_96m_clk: ref_96m { #clock-cells = <0>; compatible = "fixed-clock";
@@ -396,7 +409,7 @@ usbotg: usb@3f120000 { compatible = "snps,dwc2"; reg = <0x3f120000 0x10000>; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&usb_otg_ahb_clk>; + clocks = <&master_ccu BCM281XX_MASTER_CCU_USB_OTG_AHB>; clock-names = "otg"; phys = <&usbphy>; phy-names = "usb2-phy";
Signature · 1 line
2.48.1