mfd: twl: Add clock for TWL6030
Subsystems (3)
Andreas Kemnade
maintainerv5 cover mfd: twl: Add clock for TWL6030
Previously the clock support for only implemented for TWL6032 so add it also for the TWL6030. There are devices out there where especially WLAN only works if these clocks are enabled by some patched U-Boot. This allows to explicitly specify the clock requirements.
Changes in V5:
- fix unprepare 6032 vs 30 mismatch
Changes in V4:
- cleanup if (TWL6032_SUBCLASS)
Changes in V3:
- use type enum in driver_data and twl_clock_info
- revert back to store device instead of platform_device
Changes in V2:
- cleanup some defines
- no separate ops for 6030
- remove is_prepared()
- update Kconfig
Andreas Kemnade (3):
mfd: twl-core: Add a clock subdevice for the TWL6030
clk: twl: remove is_prepared
clk: twl: add TWL6030 support
drivers/clk/Kconfig | 2 +- drivers/clk/clk-twl.c | 69 ++++++++++++++++++++++++++---------------- drivers/mfd/twl-core.c | 26 +++++++++++----- 3 files changed, 62 insertions(+), 35 deletions(-)
Signature · 1 line
2.39.5
Andreas Kemnade
maintainerPATCH v5 1/3 mfd: twl-core: Add a clock subdevice for the TWL6030
Also the TWL6030 has some clocks, so add a subdevice for that.
--- drivers/mfd/twl-core.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/mfd/twl-core.c +18 -8
@@ -711,6 +711,10 @@ static struct of_dev_auxdata twl_auxdata_lookup[] = { { /* sentinel */ }, }; +static const struct mfd_cell twl6030_cells[] = { + { .name ="twl6030-clk" }, +}; +static const struct mfd_cell twl6032_cells[] = { { .name ="twl6032-clk" }, };
@@ -861,17 +865,23 @@ 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 (twl_class_is_6030 ()) { +const struct mfd_cell *cells; +int num_cells; + +if (id->driver_data &TWL6032_SUBCLASS ) { + cells = twl6032_cells; + num_cells =ARRAY_SIZE (twl6032_cells); + }else { + cells = twl6030_cells; + num_cells =ARRAY_SIZE (twl6030_cells); + } + + status =devm_mfd_add_devices (&client->dev,PLATFORM_DEVID_NONE , + cells, num_cells,NULL ,0 ,NULL );if (status <0 ) goto free; - } -if (twl_class_is_6030 ()) {if (of_device_is_system_power_controller (node)) {if (!pm_power_off) pm_power_off = twl6030_power_off;
Signature · 1 line
2.39.5
Re: (subset) [PATCH v5 1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
Quoted 3 lines · Andreas Kemnade
Also the TWL6030 has some clocks, so add a subdevice for that.
Applied, thanks!
[1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
commit: 5ebc60259a0fdd13aef077726b1773f1ae091efc
--
Lee Jones [李琼斯]
Andreas Kemnade
maintainerRe: (subset) [PATCH v5 1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
Am Tue, 15 Oct 2024 09:33:10 +0100
schrieb Lee Jones <[email protected]>:
Quoted 10 lines · Andreas Kemnade
Quoted 3 lines
Also the TWL6030 has some clocks, so add a subdevice for that.
Applied, thanks!
[1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
commit: 5ebc60259a0fdd13aef077726b1773f1ae091efc
hmm, this does not appear in linux-next. Did anything went wrong?
Regards,
Andreas
Lee Jones
maintainerRe: (subset) [PATCH v5 1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
Quoted 8 lines · Andreas Kemnade
Am Tue, 15 Oct 2024 09:33:10 +0100
schrieb Lee Jones <[email protected]>:Quoted 5 lines · Andreas Kemnade
Quoted 3 lines
Also the TWL6030 has some clocks, so add a subdevice for that.
Quoted 6 lines
Quoted 5 lines
Applied, thanks!
[1/3] mfd: twl-core: Add a clock subdevice for the TWL6030
commit: 5ebc60259a0fdd13aef077726b1773f1ae091efchmm, this does not appear in linux-next. Did anything went wrong?
Looks like a clerical error on my part.
Thanks for noticing. Re-applied and pushed.
Signature · 1 line
Lee Jones [李琼斯]
Andreas Kemnade
maintainerPATCH v5 2/3 clk: twl: remove is_prepared
In reply to Andreas KemnadeRemove is_prepared to simplify adding of TWL6030 support. The default implementation should be enough.
--- drivers/clk/clk-twl.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/clk/clk-twl.c +0 -17
@@ -77,26 +77,9 @@ static void twl6032_clks_unprepare(struct clk_hw *hw)dev_err (cinfo->dev,"clk unprepare failed\n" ); } -static int twl6032_clks_is_prepared (struct clk_hw *hw) -{ -struct twl_clock_info *cinfo =to_twl_clks_info (hw); -int val; - - val =twlclk_read (cinfo,TWL_MODULE_PM_RECEIVER ,VREG_STATE ); -if (val <0 ) { -dev_err (cinfo->dev,"clk read failed\n" ); -return val; - } - - val &=TWL6030_CFG_STATE_MASK ; - -return val ==TWL6030_CFG_STATE_ON ; -} -static const struct clk_ops twl6032_clks_ops = { .prepare = twl6032_clks_prepare, .unprepare = twl6032_clks_unprepare, - .is_prepared = twl6032_clks_is_prepared, .recalc_rate = twl_clks_recalc_rate, };
Signature · 1 line
2.39.5
Re: [PATCH v5 2/3] clk: twl: remove is_prepared
Quoting Andreas Kemnade (2024-10-14 09:11:08)
Quoted 6 lines
Remove
is_preparedto simplify adding of TWL6030 support. The default implementation should be enough.Signed-off-by Andreas Kemnade <[email protected]>Reviewed-by Roger Quadros <[email protected]>---
Applied to clk-next
Andreas Kemnade
maintainerPATCH v5 3/3 clk: twl: add TWL6030 support
In reply to Andreas KemnadeThe TWL6030 has similar clocks, so add support for it. Take care of the resource grouping handling needed.
--- drivers/clk/Kconfig | 2 +- drivers/clk/clk-twl.c | 52 +++++++++++++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 10 deletions(-)
drivers/clk/Kconfig +1 -1
@@ -291,7 +291,7 @@ config CLK_TWL help Enable support for controlling the clock resources on TWL family PMICs. These devices have some 32K clock outputs which can be - controlled by software. For now, only the TWL6032 clocks are + controlled by software. For now, the TWL6032 and TWL6030 clocks are supported. config CLK_TWL6040
drivers/clk/clk-twl.c +43 -9
91 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v5 3/3] clk: twl: add TWL6030 support
Quoted 4 lines · Andreas Kemnade
The TWL6030 has similar clocks, so add support for it. Take care of the resource grouping handling needed.
Signed-off-by Andreas Kemnade <[email protected]>
Re: [PATCH v5 3/3] clk: twl: add TWL6030 support
In reply to Andreas KemnadeQuoting Andreas Kemnade (2024-10-14 09:11:09)
Quoted 5 lines
The TWL6030 has similar clocks, so add support for it. Take care of the resource grouping handling needed.
Signed-off-by Andreas Kemnade <[email protected]>---
Applied to clk-next