clk: bcm: kona: Add bus clock support, bus clocks for BCM21664/BCM281xx
Subsystems (5)
v3 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 v3:
- Fix DT schema example in BCM281xx bus clock bindings
- Move CLOCK_COUNT defines from dt-bindings header to the driver
- Fix BCM21664 UARTBx_APB IDs being out of order compared to clock
driver
- Link to v2: https://lore.kernel.org/r/[email protected]
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 (9):
clk: bcm: kona: Move CLOCK_COUNT defines into the driver
dt-bindings: clock: brcm,kona-ccu: Drop CLOCK_COUNT defines from DT headers
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 | 49 +++++++- arch/arm/boot/dts/broadcom/bcm11351.dtsi | 33 ++++-- arch/arm/boot/dts/broadcom/bcm2166x-common.dtsi | 28 +++-- drivers/clk/bcm/clk-bcm21664.c | 91 ++++++++++++++ drivers/clk/bcm/clk-bcm281xx.c | 131 +++++++++++++++++++++ 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 | 17 ++- include/dt-bindings/clock/bcm281xx.h | 24 +++- 10 files changed, 528 insertions(+), 33 deletions(-)
---
base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04
change-id: 20250212-kona-bus-clock-4297eefae940
Best regards,
Signature · 1 line
Artur Weber <[email protected]>
PATCH v3 1/9 clk: bcm: kona: Move CLOCK_COUNT defines into the driver
CLOCK_COUNT defines for each CCU are stored in the DT binding header. This is not correct - they are not used by device trees, only internally by the driver.
Move the CLOCK_COUNT defines directly into the driver in preparation for dropping them from the DT binding include.
--- drivers/clk/bcm/clk-bcm21664.c | 8 ++++++++ drivers/clk/bcm/clk-bcm281xx.c | 10 ++++++++++ 2 files changed, 18 insertions(+)
drivers/clk/bcm/clk-bcm21664.c +8 -0
@@ -17,6 +17,8 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), }; +#define BCM21664_ROOT_CCU_CLOCK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1) +static struct ccu_data root_ccu_data = {BCM21664_CCU_COMMON (root,ROOT ),/* no policy control */
@@ -39,6 +41,8 @@ static struct peri_clk_data hub_timer_data = { .trig = TRIGGER(0x0a40, 4), }; +#define BCM21664_AON_CCU_CLOCK_COUNT (BCM21664_AON_CCU_HUB_TIMER + 1) +static struct ccu_data aon_ccu_data = {BCM21664_CCU_COMMON (aon,AON ), .policy = {
@@ -122,6 +126,8 @@ static struct peri_clk_data sdio4_sleep_data = { .gate = HW_SW_GATE(0x0360, 18, 2, 3), }; +#define BCM21664_MASTER_CCU_CLOCK_COUNT (BCM21664_MASTER_CCU_SDIO4_SLEEP + 1) +static struct ccu_data master_ccu_data = {BCM21664_CCU_COMMON (master,MASTER ), .policy = {
@@ -225,6 +231,8 @@ static struct peri_clk_data bsc4_data = { .trig = TRIGGER(0x0afc, 19), }; +#define BCM21664_SLAVE_CCU_CLOCK_COUNT (BCM21664_SLAVE_CCU_BSC4 + 1) +static struct ccu_data slave_ccu_data = {BCM21664_CCU_COMMON (slave,SLAVE ), .policy = {
drivers/clk/bcm/clk-bcm281xx.c +10 -0
@@ -19,6 +19,8 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), }; +#define BCM281XX_ROOT_CCU_CLOCK_COUNT (BCM281XX_ROOT_CCU_FRAC_1M + 1) +static struct ccu_data root_ccu_data = {BCM281XX_CCU_COMMON (root,ROOT ), .kona_clks = {
@@ -57,6 +59,8 @@ static struct peri_clk_data pmu_bsc_var_data = { .trig = TRIGGER(0x0a40, 2), }; +#define BCM281XX_AON_CCU_CLOCK_COUNT (BCM281XX_AON_CCU_PMU_BSC_VAR + 1) +static struct ccu_data aon_ccu_data = {BCM281XX_CCU_COMMON (aon,AON ), .kona_clks = {
@@ -80,6 +84,8 @@ static struct peri_clk_data tmon_1m_data = { .trig = TRIGGER(0x0e84, 1), }; +#define BCM281XX_HUB_CCU_CLOCK_COUNT (BCM281XX_HUB_CCU_TMON_1M + 1) +static struct ccu_data hub_ccu_data = {BCM281XX_CCU_COMMON (hub,HUB ), .kona_clks = {
@@ -172,6 +178,8 @@ static struct peri_clk_data hsic2_12m_data = { .trig = TRIGGER(0x0afc, 5), }; +#define BCM281XX_MASTER_CCU_CLOCK_COUNT (BCM281XX_MASTER_CCU_HSIC2_12M + 1) +static struct ccu_data master_ccu_data = {BCM281XX_CCU_COMMON (master,MASTER ), .kona_clks = {
@@ -301,6 +309,8 @@ static struct peri_clk_data pwm_data = { .trig = TRIGGER(0x0afc, 15), }; +#define BCM281XX_SLAVE_CCU_CLOCK_COUNT (BCM281XX_SLAVE_CCU_PWM + 1) +static struct ccu_data slave_ccu_data = {BCM281XX_CCU_COMMON (slave,SLAVE ), .kona_clks = {
Signature · 1 line
2.48.1
Re: [PATCH v3 1/9] clk: bcm: kona: Move CLOCK_COUNT defines into the driver
Quoted 18 lines · Artur Weber
CLOCK_COUNTdefines for each CCU are stored in the DT binding header. This is not correct - they are not used by device trees, only internally by the driver.Move the
CLOCK_COUNTdefines directly into the driver in preparation for dropping them from the DT binding include.Signed-off-by Artur Weber <[email protected]>--- drivers/clk/bcm/clk-bcm21664.c | 8 ++++++++ drivers/clk/bcm/clk-bcm281xx.c | 10 ++++++++++ 2 files changed, 18 insertions(+)drivers/clk/bcm/clk-bcm21664.c +0
-0
drivers/clk/bcm/clk-bcm21664.c static struct peri_clk_data frac_1m_data = { · line 20
Quoted 4 lines
drivers/clk/bcm/clk-bcm21664.c +1
-0@@ -17,6 +17,8 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), }; +#define BCM21664_ROOT_CCU_CLOCK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1)
I hit that wall too, no worries. It might surprise you but 0+1 != 1 :), so you redefine a define. You need to test this patch bisectability.
Best regards,
Krzysztof
Re: [PATCH v3 1/9] clk: bcm: kona: Move CLOCK_COUNT defines into the driver
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Artur Weber
CLOCK_COUNTdefines for each CCU are stored in the DT binding header. This is not correct - they are not used by device trees, only internally by the driver.Move the
CLOCK_COUNTdefines directly into the driver in preparation for dropping them from the DT binding include.Signed-off-by Artur Weber <[email protected]>--- drivers/clk/bcm/clk-bcm21664.c | 8 ++++++++ drivers/clk/bcm/clk-bcm281xx.c | 10 ++++++++++ 2 files changed, 18 insertions(+)drivers/clk/bcm/clk-bcm21664.c +0
-0@@ -17,6 +17,8 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), };
Quoted 3 lines
drivers/clk/bcm/clk-bcm21664.c static struct peri_clk_data frac_1m_data = { · line 20
Quoted 1 line
drivers/clk/bcm/clk-bcm21664.c +1
-0+#define BCM21664_ROOT_CCU_CLOCK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1)I hit that wall too, no worries. It might surprise you but 0+1 != 1 :),
Do you mean that I should specify the clock count directly rather than incrementing the last ID? Some other drivers seem to do this the way I did here (samsung/clk-exynos*, renesas/r9a06g032-clocks.c).
Quoted 1 line
so you redefine a define. You need to test this patch bisectability.
I assume renaming the define to not collide with the old name is the way to go?
Best regards
Artur
Re: [PATCH v3 1/9] clk: bcm: kona: Move CLOCK_COUNT defines into the driver
Quoted 23 lines · Artur Weber
Quoted 22 lines · Krzysztof Kozlowski
Quoted 21 lines · Artur Weber
CLOCK_COUNTdefines for each CCU are stored in the DT binding header. This is not correct - they are not used by device trees, only internally by the driver.Move the
CLOCK_COUNTdefines directly into the driver in preparation for dropping them from the DT binding include.Signed-off-by Artur Weber <[email protected]>--- drivers/clk/bcm/clk-bcm21664.c | 8 ++++++++ drivers/clk/bcm/clk-bcm281xx.c | 10 ++++++++++ 2 files changed, 18 insertions(+)drivers/clk/bcm/clk-bcm21664.c +0
-0@@ -17,6 +17,8 @@ static struct peri_clk_data frac_1m_data = { .clocks = CLOCKS("ref_crystal"), };
Quoted 7 lines
Quoted 3 lines
drivers/clk/bcm/clk-bcm21664.c static struct peri_clk_data frac_1m_data = { · line 20
Quoted 1 line
drivers/clk/bcm/clk-bcm21664.c +1
-0+#define BCM21664_ROOT_CCU_CLOCK_COUNT (BCM21664_ROOT_CCU_FRAC_1M + 1)I hit that wall too, no worries. It might surprise you but 0+1 != 1 :),
Do you mean that I should specify the clock count directly rather than incrementing the last ID? Some other drivers seem to do this the way I did here (samsung/clk-exynos*,
renesas/r9a06g032-clocks.c).
Just build and test your patches...
Best regards,
Krzysztof
PATCH v3 2/9 dt-bindings: clock: brcm,kona-ccu: Drop CLOCK_COUNT defines from DT headers
In reply to Artur WeberThe CLOCK_COUNT defines are not used by device trees, only by the clock driver. Keeping them in the DT binding header is frowned upon.
Since they're being moved to the clock driver directly, drop these defines from the dt-bindings header and only keep clock IDs.
---
Changes in v3:
- Add this commit
--- include/dt-bindings/clock/bcm21664.h | 4 ---- include/dt-bindings/clock/bcm281xx.h | 5 ----- 2 files changed, 9 deletions(-)
include/dt-bindings/clock/bcm21664.h +0 -4
@@ -21,12 +21,10 @@/* root CCU clock ids */ #define BCM21664_ROOT_CCU_FRAC_1M 0 -#define BCM21664_ROOT_CCU_CLOCK_COUNT 1/* aon CCU clock ids */ #define BCM21664_AON_CCU_HUB_TIMER 0 -#define BCM21664_AON_CCU_CLOCK_COUNT 1/* master CCU clock ids */
@@ -38,7 +36,6 @@#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/* slave CCU clock ids */
@@ -49,6 +46,5 @@#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#endif /* _CLOCK_BCM21664_H */
include/dt-bindings/clock/bcm281xx.h +0 -5
@@ -27,19 +27,16 @@/* root CCU clock ids */ #define BCM281XX_ROOT_CCU_FRAC_1M 0 -#define BCM281XX_ROOT_CCU_CLOCK_COUNT 1/* aon CCU clock ids */ #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/* hub CCU clock ids */ #define BCM281XX_HUB_CCU_TMON_1M 0 -#define BCM281XX_HUB_CCU_CLOCK_COUNT 1/* master CCU clock ids */
@@ -50,7 +47,6 @@#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/* slave CCU clock ids */
@@ -64,6 +60,5 @@#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#endif /* _CLOCK_BCM281XX_H */
Signature · 1 line
2.48.1
Re: [PATCH v3 2/9] dt-bindings: clock: brcm,kona-ccu: Drop CLOCK_COUNT defines from DT headers
Quoted 10 lines · Artur Weber
The
CLOCK_COUNTdefines are not used by device trees, only by the clock driver. Keeping them in the DT binding header is frowned upon.Since they're being moved to the clock driver directly, drop these defines from the dt-bindings header and only keep clock IDs.
Signed-off-by Artur Weber <[email protected]>---
Changes in v3:
- Add this commit
Best regards,
Krzysztof
PATCH v3 3/9 dt-bindings: clock: brcm,kona-ccu: Add BCM21664 bus clocks
In reply to Artur WeberAdd 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 v3:
- Fix UARTBx_APB clocks being out of order in DT binding header
- Drop CLOCK_COUNT defines from DT binding 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 | 13 +++++++++++++ 2 files changed, 29 insertions(+), 2 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 +13 -0
@@ -25,6 +25,7 @@/* aon CCU clock ids */ #define BCM21664_AON_CCU_HUB_TIMER 0 +#define BCM21664_AON_CCU_HUB_TIMER_APB 1/* master CCU clock ids */
@@ -36,6 +37,11 @@#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_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/* slave CCU clock ids */
@@ -46,5 +52,12 @@#define BCM21664_SLAVE_CCU_BSC2 4#define BCM21664_SLAVE_CCU_BSC3 5#define BCM21664_SLAVE_CCU_BSC4 6 +#define BCM21664_SLAVE_CCU_UARTB_APB 7 +#define BCM21664_SLAVE_CCU_UARTB2_APB 8 +#define BCM21664_SLAVE_CCU_UARTB3_APB 9 +#define BCM21664_SLAVE_CCU_BSC1_APB 10 +#define BCM21664_SLAVE_CCU_BSC2_APB 11 +#define BCM21664_SLAVE_CCU_BSC3_APB 12 +#define BCM21664_SLAVE_CCU_BSC4_APB 13#endif /* _CLOCK_BCM21664_H */
Signature · 1 line
2.48.1
Re: [PATCH v3 3/9] dt-bindings: clock: brcm,kona-ccu: Add BCM21664 bus clocks
Quoted 6 lines · Artur Weber
Add bus clocks for
hub_timer, sdio, bsc, uart andusb_otg_ahbto the allowed clock output names for BCM21664 CCUs and add the relevant clock IDs to theclock/bcm21664.hdt-bindings header.Signed-off-by Artur Weber <[email protected]>---
Best regards,
Krzysztof
PATCH v3 4/9 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 v3:
- Add more clock output names to example
- Drop CLOCK_COUNT defines from the DT binding header
Changes in v2:
- Add this commit (BCM281xx bus clocks)
--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 33 ++++++++++++++++++++-- include/dt-bindings/clock/bcm281xx.h | 19 +++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +31 -2
@@ -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:
@@ -190,6 +209,16 @@ examples: "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"; }; ...
include/dt-bindings/clock/bcm281xx.h +19 -0
@@ -33,6 +33,8 @@#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_HUB_TIMER_APB 3 +#define BCM281XX_AON_CCU_PMU_BSC_APB 4/* hub CCU clock ids */
@@ -47,6 +49,13 @@#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_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/* slave CCU clock ids */
@@ -60,5 +69,15 @@#define BCM281XX_SLAVE_CCU_BSC2 7#define BCM281XX_SLAVE_CCU_BSC3 8#define BCM281XX_SLAVE_CCU_PWM 9 +#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#endif /* _CLOCK_BCM281XX_H */
Signature · 1 line
2.48.1
Re: [PATCH v3 4/9] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
Quoted 3 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.
Please squash the patch so we see complete change.
Quoted 54 lines
Signed-off-by Artur Weber <[email protected]>---
Changes in v3:
- Add more clock output names to example
- DropCLOCK_COUNTdefines from the DT binding headerChanges in v2:
- Add this commit (BCM281xx bus clocks)--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 33 ++++++++++++++++++++-- include/dt-bindings/clock/bcm281xx.h | 19 +++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +10
-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
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml allOf: · line 137
Quoted 10 lines
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +10
-0+ - 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
Why pwm_apb cannot be after pwm? Any idea for sorting here?
Best regards,
Krzysztof
Re: [PATCH v3 4/9] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
Quoted 66 lines · Krzysztof Kozlowski
Quoted 3 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.Please squash the patch so we see complete change.
Quoted 58 lines
Signed-off-by Artur Weber <[email protected]>---
Changes in v3:
- Add more clock output names to example
- DropCLOCK_COUNTdefines from the DT binding headerChanges in v2:
- Add this commit (BCM281xx bus clocks)--- .../devicetree/bindings/clock/brcm,kona-ccu.yaml | 33 ++++++++++++++++++++-- include/dt-bindings/clock/bcm281xx.h | 19 +++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +14
-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
Quoted 8 lines
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml allOf: · line 137
Quoted 6 lines
Documentation/devicetree/bindings/clock/brcm,kona-ccu.yaml +6
-0+ - const: ssp0_apb + - const: ssp2_apb + - const: bsc1_apb + - const: bsc2_apb + - const: bsc3_apb + - const: pwm_apbWhy
pwm_apbcannot be after pwm? Any idea for sorting here?
I placed all bus clocks corresponding to peripheral clocks at the end of the clock list (so as to not modify the IDs of previous clocks), in the same order as their corresponding peripheral clocks. This applies both to the dt-bindings/clock/bcm281xx.h header and to the clock binding here (I kept the same order of clock names here as clock IDs in the header).
The same reasoning applies to the BCM21664 bus clocks patch.
Best regards
Artur
Re: [PATCH v3 4/9] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
In reply to Krzysztof KozlowskiQuoted 6 lines · Krzysztof Kozlowski
Quoted 3 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.Please squash the patch so we see complete change.
Squash which patch(-es)? Both CCU bindings and the dt-bindings header are modified in this patch, as outlined in the commit message (though now that I look at it, I could reword the first sentence to specifically imply "add bus clocks *to the binding*"...). What is missing?
(Sorry for the separate reply, I meant to reply to this in the previous message but accidentally removed my reply.)
Best regards
Artur
Re: [PATCH v3 4/9] dt-bindings: clock: brcm,kona-ccu: Add BCM281xx bus clocks
Quoted 6 lines · Artur Weber
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 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 6 lines
Quoted 1 line
Please squash the patch so we see complete change.
Squash which patch(-es)? Both CCU bindings and the dt-bindings header are modified in this patch, as outlined in the commit message (though now that I look at it, I could reword the first sentence to specifically imply "add bus clocks *to the binding*"...). What is missing?
If I got it correctly, you are changing the same lines in bindings in two patches, so squash these two patches.
Best regards,
Krzysztof
PATCH v3 5/9 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 v3 6/9 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 v3:
- Adapt to CLOCK_COUNT defines being moved
Changes in v2:
- Adapt to dropped prereq clocks
--- drivers/clk/bcm/clk-bcm21664.c | 89 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-)
drivers/clk/bcm/clk-bcm21664.c +86 -3
@@ -41,7 +41,12 @@ static struct peri_clk_data hub_timer_data = { .trig = TRIGGER(0x0a40, 4), }; -#define BCM21664_AON_CCU_CLOCK_COUNT (BCM21664_AON_CCU_HUB_TIMER + 1) +static struct bus_clk_data hub_timer_apb_data = { + .gate =HW_SW_GATE (0x0414 ,18 ,3 ,2 ), + .hyst =HYST (0x0414 ,10 ,11 ), +}; + +#define BCM21664_AON_CCU_CLOCK_COUNT (BCM21664_AON_CCU_HUB_TIMER_APB + 1)static struct ccu_data aon_ccu_data = {BCM21664_CCU_COMMON (aon,AON ),
@@ -52,6 +57,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, }, };
@@ -126,7 +133,27 @@ static struct peri_clk_data sdio4_sleep_data = { .gate = HW_SW_GATE(0x0360, 18, 2, 3), }; -#define BCM21664_MASTER_CCU_CLOCK_COUNT (BCM21664_MASTER_CCU_SDIO4_SLEEP + 1) +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 ), +}; + +#define BCM21664_MASTER_CCU_CLOCK_COUNT (BCM21664_MASTER_CCU_USB_OTG_AHB + 1)static struct ccu_data master_ccu_data = {BCM21664_CCU_COMMON (master,MASTER ),
@@ -151,6 +178,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, }, };
@@ -231,7 +268,39 @@ static struct peri_clk_data bsc4_data = { .trig = TRIGGER(0x0afc, 19), }; -#define BCM21664_SLAVE_CCU_CLOCK_COUNT (BCM21664_SLAVE_CCU_BSC4 + 1) +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 ), +}; + +#define BCM21664_SLAVE_CCU_CLOCK_COUNT (BCM21664_SLAVE_CCU_BSC4_APB + 1)static struct ccu_data slave_ccu_data = {BCM21664_CCU_COMMON (slave,SLAVE ),
@@ -254,6 +323,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 v3 7/9 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 v3:
- Adapt to CLOCK_COUNT defines being moved
Changes in v2:
- Add this patch (BCM281xx bus clocks)
--- drivers/clk/bcm/clk-bcm281xx.c | 127 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 3 deletions(-)
drivers/clk/bcm/clk-bcm281xx.c +124 -3
@@ -59,7 +59,17 @@ static struct peri_clk_data pmu_bsc_var_data = { .trig = TRIGGER(0x0a40, 2), }; -#define BCM281XX_AON_CCU_CLOCK_COUNT (BCM281XX_AON_CCU_PMU_BSC_VAR + 1) +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 ), +}; + +#define BCM281XX_AON_CCU_CLOCK_COUNT (BCM281XX_AON_CCU_PMU_BSC_APB + 1)static struct ccu_data aon_ccu_data = {BCM281XX_CCU_COMMON (aon,AON ),
@@ -70,6 +80,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, }, };
@@ -178,7 +192,36 @@ static struct peri_clk_data hsic2_12m_data = { .trig = TRIGGER(0x0afc, 5), }; -#define BCM281XX_MASTER_CCU_CLOCK_COUNT (BCM281XX_MASTER_CCU_HSIC2_12M + 1) +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 ), +}; + +#define BCM281XX_MASTER_CCU_CLOCK_COUNT (BCM281XX_MASTER_CCU_USB_OTG_AHB + 1)static struct ccu_data master_ccu_data = {BCM281XX_CCU_COMMON (master,MASTER ),
@@ -197,6 +240,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, }, };
@@ -309,7 +366,51 @@ static struct peri_clk_data pwm_data = { .trig = TRIGGER(0x0afc, 15), }; -#define BCM281XX_SLAVE_CCU_CLOCK_COUNT (BCM281XX_SLAVE_CCU_PWM + 1) +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 ), +}; + +#define BCM281XX_SLAVE_CCU_CLOCK_COUNT (BCM281XX_SLAVE_CCU_PWM_APB + 1)static struct ccu_data slave_ccu_data = {BCM281XX_CCU_COMMON (slave,SLAVE ),
@@ -334,6 +435,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 v3 8/9 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 v3 9/9 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