2023-08-30 18:52:59

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 0/5] ARM: omap: omap4-embt2ws: 32K clock for WLAN

To have WLAN working properly, enable a 32K clock of the TWL6032.
In earlier tests, it was still enabled from a previous boot into
the vendor system.

Changes in V2:
- no separate device node for the clock
- converted toplevel node of TWL

Andreas Kemnade (5):
dt-bindings: mfd: convert twl-family.tx to json-schema
dt-bindings: mfd: ti,twl: Add clock provider properties
mfd: twl-core: Add a clock subdevice for the TWL6032
clk: twl: add clock driver for TWL6032
ARM: dts: omap4-embt2ws: enable 32K clock on WLAN

.../devicetree/bindings/mfd/ti,twl.yaml | 72 +++++++
.../devicetree/bindings/mfd/twl-family.txt | 46 ----
.../boot/dts/ti/omap/omap4-epson-embt2ws.dts | 8 +
drivers/clk/Kconfig | 9 +
drivers/clk/Makefile | 1 +
drivers/clk/clk-twl.c | 197 ++++++++++++++++++
drivers/mfd/twl-core.c | 16 ++
7 files changed, 303 insertions(+), 46 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/ti,twl.yaml
delete mode 100644 Documentation/devicetree/bindings/mfd/twl-family.txt
create mode 100644 drivers/clk/clk-twl.c

--
2.39.2



2023-08-30 19:23:42

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 2/5] dt-bindings: mfd: ti,twl: Add clock provider properties

Since these devices provide clock outputs, add the corresponding
property.

Signed-off-by: Andreas Kemnade <[email protected]>
---
Documentation/devicetree/bindings/mfd/ti,twl.yaml | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
index 3d7b3e0addafa..6bb781b95ecdb 100644
--- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
+++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
@@ -37,6 +37,9 @@ properties:
"#interrupt-cells":
const: 1

+ "#clock-cells":
+ const: 1
+
additionalProperties: true

required:
--
2.39.2


2023-08-30 22:03:00

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 3/5] mfd: twl-core: Add a clock subdevice for the TWL6032

Clock device needs no separate devicetree node, so add it as
a platform device. Other devices in the family also have controllable
clocks, but due to the lack of testing, just add it for the TWL6032
now.

Signed-off-by: Andreas Kemnade <[email protected]>
---
drivers/mfd/twl-core.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index ce01a87f8dc39..234500b2e53fc 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -31,6 +31,8 @@
#include <linux/regulator/machine.h>

#include <linux/i2c.h>
+
+#include <linux/mfd/core.h>
#include <linux/mfd/twl.h>

/* Register descriptions for audio */
@@ -690,6 +692,10 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = {
{ /* sentinel */ },
};

+static const struct mfd_cell twl6032_cells[] = {
+ { .name = "twl6032-clk" },
+};
+
/* NOTE: This driver only handles a single twl4030/tps659x0 chip */
static int
twl_probe(struct i2c_client *client)
@@ -836,6 +842,16 @@ twl_probe(struct i2c_client *client)
TWL4030_DCDC_GLOBAL_CFG);
}

+ if (id->driver_data == (TWL6030_CLASS | TWL6032_SUBCLASS)) {
+ status = devm_mfd_add_devices(&client->dev,
+ PLATFORM_DEVID_NONE,
+ twl6032_cells,
+ ARRAY_SIZE(twl6032_cells),
+ NULL, 0, NULL);
+ if (status < 0)
+ goto free;
+ }
+
status = of_platform_populate(node, NULL, twl_auxdata_lookup,
&client->dev);

--
2.39.2


2023-08-30 23:08:25

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 1/5] dt-bindings: mfd: convert twl-family.tx to json-schema

Convert the TWL[46]030 binding to DT schema format. To do it as a step by
step work, do not include / handle nodes for subdevices yet, just convert
things with minimal corrections. There are already some bindings for its
subdevices in the tree.

Signed-off-by: Andreas Kemnade <[email protected]>
---
.../devicetree/bindings/mfd/ti,twl.yaml | 69 +++++++++++++++++++
.../devicetree/bindings/mfd/twl-family.txt | 46 -------------
2 files changed, 69 insertions(+), 46 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mfd/ti,twl.yaml
delete mode 100644 Documentation/devicetree/bindings/mfd/twl-family.txt

diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
new file mode 100644
index 0000000000000..3d7b3e0addafa
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/ti,twl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments TWL family
+
+maintainers:
+ - Tony Lindgren <[email protected]>
+
+description: |
+ The TWLs are Integrated Power Management Chips.
+ Some version might contain much more analog function like
+ USB transceiver or Audio amplifier.
+ These chips are connected to an i2c bus.
+
+properties:
+ compatible:
+ description:
+ TWL4030 for integrated power-management/audio CODEC device used in OMAP3
+ based boards
+ TWL6030/32 for integrated power-management used in OMAP4 based boards
+ enum:
+ - ti,twl4030
+ - ti,twl6030
+ - ti,twl6032
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ interrupt-controller: true
+
+ "#interrupt-cells":
+ const: 1
+
+additionalProperties: true
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-controller
+ - "#interrupt-cells"
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pmic@48 {
+ compatible = "ti,twl6030";
+ reg = <0x48>;
+ interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&gic>;
+
+ rtc {
+ compatible = "ti,twl4030-rtc";
+ interrupts = <11>;
+ };
+ };
+ };
+
diff --git a/Documentation/devicetree/bindings/mfd/twl-family.txt b/Documentation/devicetree/bindings/mfd/twl-family.txt
deleted file mode 100644
index c2f9302965dea..0000000000000
--- a/Documentation/devicetree/bindings/mfd/twl-family.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-Texas Instruments TWL family
-
-The TWLs are Integrated Power Management Chips.
-Some version might contain much more analog function like
-USB transceiver or Audio amplifier.
-These chips are connected to an i2c bus.
-
-
-Required properties:
-- compatible : Must be "ti,twl4030";
- For Integrated power-management/audio CODEC device used in OMAP3
- based boards
-- compatible : Must be "ti,twl6030";
- For Integrated power-management used in OMAP4 based boards
-- interrupts : This i2c device has an IRQ line connected to the main SoC
-- interrupt-controller : Since the twl support several interrupts internally,
- it is considered as an interrupt controller cascaded to the SoC one.
-- #interrupt-cells = <1>;
-
-Optional node:
-- Child nodes contain in the twl. The twl family is made of several variants
- that support a different number of features.
- The children nodes will thus depend of the capability of the variant.
-
-
-Example:
-/*
- * Integrated Power Management Chip
- * https://www.ti.com/lit/ds/symlink/twl6030.pdf
- */
-twl@48 {
- compatible = "ti,twl6030";
- reg = <0x48>;
- interrupts = <39>; /* IRQ_SYS_1N cascaded to gic */
- interrupt-controller;
- #interrupt-cells = <1>;
- interrupt-parent = <&gic>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- twl_rtc {
- compatible = "ti,twl_rtc";
- interrupts = <11>;
- reg = <0>;
- };
-};
--
2.39.2


2023-08-31 00:08:50

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 5/5] ARM: dts: omap4-embt2ws: enable 32K clock on WLAN

WLAN did only work if clock was left enabled by the original system,
so make it fully enable the needed resources itself.

Signed-off-by: Andreas Kemnade <[email protected]>
---
arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts b/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
index ee86981b2e448..9d2f2d8639496 100644
--- a/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
+++ b/arch/arm/boot/dts/ti/omap/omap4-epson-embt2ws.dts
@@ -69,6 +69,12 @@ unknown_supply: unknown-supply {
regulator-name = "unknown";
};

+ wl12xx_pwrseq: wl12xx-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ clocks = <&twl 1>;
+ clock-names = "ext_clock";
+ };
+
/* regulator for wl12xx on sdio2 */
wl12xx_vmmc: wl12xx-vmmc {
pinctrl-names = "default";
@@ -92,6 +98,7 @@ &i2c1 {
twl: pmic@48 {
compatible = "ti,twl6032";
reg = <0x48>;
+ #clock-cells = <1>;
/* IRQ# = 7 */
interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
interrupt-controller;
@@ -316,6 +323,7 @@ &mmc3 {
pinctrl-names = "default";
pinctrl-0 = <&wl12xx_pins>;
vmmc-supply = <&wl12xx_vmmc>;
+ mmc-pwrseq = <&wl12xx_pwrseq>;
interrupts-extended = <&wakeupgen GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH
&omap4_pmx_core 0x12e>;
non-removable;
--
2.39.2


2023-09-01 00:01:42

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 2/5] dt-bindings: mfd: ti,twl: Add clock provider properties

On Wed, Aug 30, 2023 at 08:20:35PM +0200, Andreas Kemnade wrote:
> Since these devices provide clock outputs, add the corresponding
> property.
>
> Signed-off-by: Andreas Kemnade <[email protected]>
> ---
> Documentation/devicetree/bindings/mfd/ti,twl.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl.yaml b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> index 3d7b3e0addafa..6bb781b95ecdb 100644
> --- a/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> +++ b/Documentation/devicetree/bindings/mfd/ti,twl.yaml
> @@ -37,6 +37,9 @@ properties:
> "#interrupt-cells":
> const: 1
>
> + "#clock-cells":
> + const: 1
> +

Acked-by: Conor Dooley <[email protected]>

Thanks,
Conor.

> additionalProperties: true
>
> required:
> --
> 2.39.2
>


Attachments:
(No filename) (870.00 B)
signature.asc (235.00 B)
Download all attachments