Message ID | 20240930-th1520-pinctrl-v3-0-32cea2bdbecb@tenstorrent.com (mailing list archive) |
---|---|
Headers | show |
Series | pinctrl: Add T-Head TH1520 SoC pin controllers | expand |
On Mon, Sep 30, 2024 at 9:51 PM Drew Fustini <dfustini@tenstorrent.com> wrote: > This adds a pin control driver created by Emil for the T-Head TH1520 > RISC-V SoC used on the Lichee Pi 4A and BeagleV Ahead boards and updates > the device trees to make use of it. Thanks Drew, v3 looks good. I've merged it to an immutable branch: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=ib-thead-th1520 Then I merged that into my "devel" branch for v6.13. You can merge the DTS/DTSI files through the SoC tree, FWIW: Acked-by: Linus Walleij <linus.walleij@linaro.org> I think I'll make a stab at using guarded mutexes etc and see what you think about it! Yours, Linus Walleij
On Tue, Oct 01, 2024 at 02:13:20PM +0200, Linus Walleij wrote: > On Mon, Sep 30, 2024 at 9:51 PM Drew Fustini <dfustini@tenstorrent.com> wrote: > > > This adds a pin control driver created by Emil for the T-Head TH1520 > > RISC-V SoC used on the Lichee Pi 4A and BeagleV Ahead boards and updates > > the device trees to make use of it. > > Thanks Drew, v3 looks good. I've merged it to an immutable branch: > https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=ib-thead-th1520 > > Then I merged that into my "devel" branch for v6.13. Thanks for taking this. Will that also end up in linux-next eventually? I'm working on a TH1520 Ethernet driver which depends on the pinctrl driver. Andrew Lunn replied to me that all the dependencies need to be in linux-next [1]. > You can merge the DTS/DTSI files through the SoC tree, FWIW: > Acked-by: Linus Walleij <linus.walleij@linaro.org> Thanks, I'll take the dts through my thead tree [2]. > I think I'll make a stab at using guarded mutexes etc and see what > you think about it! Do you mean using scoped_guard() for thp->mutex in th1520_pinctrl_dt_node_to_map()? thanks, drew [1] https://lore.kernel.org/linux-riscv/99af411c-ff40-4396-a6e2-5aac179ba1be@lunn.ch/T/#t [2] https://github.com/pdp7/linux/tree/thead-dt-for-next
On Wed, Oct 2, 2024 at 8:35 PM Drew Fustini <dfustini@tenstorrent.com> wrote: > > Then I merged that into my "devel" branch for v6.13. > > Thanks for taking this. Will that also end up in linux-next eventually? Yes next -next. > I'm working on a TH1520 Ethernet driver which depends on the pinctrl > driver. Andrew Lunn replied to me that all the dependencies need to be > in linux-next [1]. Well compile-time dependencies for sure, run-time dependencies we are usually a bit lax with as long as we know they will get there eventually. > > I think I'll make a stab at using guarded mutexes etc and see what > > you think about it! > > Do you mean using scoped_guard() for thp->mutex in > th1520_pinctrl_dt_node_to_map()? For all mutex and spinlocks in the driver. Yours, Linus Walleij
On Wed, Oct 02, 2024 at 10:46:41PM +0200, Linus Walleij wrote: > On Wed, Oct 2, 2024 at 8:35 PM Drew Fustini <dfustini@tenstorrent.com> wrote: > > > > Then I merged that into my "devel" branch for v6.13. > > > > Thanks for taking this. Will that also end up in linux-next eventually? > > Yes next -next. > > > I'm working on a TH1520 Ethernet driver which depends on the pinctrl > > driver. Andrew Lunn replied to me that all the dependencies need to be > > in linux-next [1]. > > Well compile-time dependencies for sure, run-time dependencies > we are usually a bit lax with as long as we know they will > get there eventually. > > > > I think I'll make a stab at using guarded mutexes etc and see what > > > you think about it! > > > > Do you mean using scoped_guard() for thp->mutex in > > th1520_pinctrl_dt_node_to_map()? > > For all mutex and spinlocks in the driver. The thp->lock spinlock is already using scoped_guard() everywhere. I will post a patch that adds guard() for the thp->mutex like this: diff --git a/drivers/pinctrl/pinctrl-th1520.c b/drivers/pinctrl/pinctrl-th1520.c index 1bb78b212fd5..b7c2d998e9e7 100644 --- a/drivers/pinctrl/pinctrl-th1520.c +++ b/drivers/pinctrl/pinctrl-th1520.c @@ -444,8 +444,8 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, return -ENOMEM; nmaps = 0; - mutex_lock(&thp->mutex); - for_each_available_child_of_node(np, child) { + guard(mutex)(&thp->mutex); + for_each_available_child_of_node_scoped(np, child) { unsigned int rollback = nmaps; enum th1520_muxtype muxtype; struct property *prop; @@ -530,7 +530,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, *maps = map; *num_maps = nmaps; - mutex_unlock(&thp->mutex); return 0; free_configs: @@ -538,7 +537,6 @@ static int th1520_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, put_child: of_node_put(child); th1520_pinctrl_dt_free_map(pctldev, map, nmaps); - mutex_unlock(&thp->mutex); return ret; } -- Thanks, Drew
On Mon, Sep 30, 2024 at 12:50:50PM -0700, Drew Fustini wrote: > This adds a pin control driver created by Emil for the T-Head TH1520 > RISC-V SoC used on the Lichee Pi 4A and BeagleV Ahead boards and updates > the device trees to make use of it. > > Changes in v3: > - Add Rb from Rob for the binding > - Rebase on 6.12-rc1 which enables AP_SUBSYS clock controller in dts > - Update dts to use AP_SUBSYS clock controller instead of fixed clocks > - Remove unneeded defines from the driver for dt unit addresses > - Link to v2: https://lore.kernel.org/linux-riscv/20240914-th1520-pinctrl-v2-0-3ba67dde882c@tenstorrent.com/ > > [...] I've applied the dts patches to my thead-dt-for-next [1] [3/8] riscv: dts: thead: Add TH1520 pin control nodes commit: ad36d24e4fac83a6cf916fbf7eb458ed5179758b [4/8] riscv: dts: thead: Add TH1520 GPIO ranges commit: 5c0a6b845d1670c7a10d8016cb352c21b0133935 [5/8] riscv: dts: thead: Adjust TH1520 GPIO labels commit: 2a3aaf5fd062e9a820c420b02795acf6e031c855 [6/8] riscv: dts: thead: Add Lichee Pi 4M GPIO line names commit: 753c9640121235b3ea26137f3a2dcbb301fa8556 [7/8] riscv: dts: thead: Add TH1520 pinctrl settings for UART0 commit: 5aa0a71414f1e4fcacd64146d40e78ecdfc26374 [8/8] riscv: dtb: thead: Add BeagleV Ahead LEDs commit: ddc5ab7259a525670fbea6e9bda5334022aae050 Thanks, Drew [1] https://github.com/pdp7/linux/commits/thead-dt-for-next/
This adds a pin control driver created by Emil for the T-Head TH1520 RISC-V SoC used on the Lichee Pi 4A and BeagleV Ahead boards and updates the device trees to make use of it. Changes in v3: - Add Rb from Rob for the binding - Rebase on 6.12-rc1 which enables AP_SUBSYS clock controller in dts - Update dts to use AP_SUBSYS clock controller instead of fixed clocks - Remove unneeded defines from the driver for dt unit addresses - Link to v2: https://lore.kernel.org/linux-riscv/20240914-th1520-pinctrl-v2-0-3ba67dde882c@tenstorrent.com/ Changes in v2: - Add thead,pad-group device tree property - Change driver to use the thead,pad-group property instead of the unit address to identify the pad group of the pin controller being probed - Return -EINVAL if no pin group can be determined during probe. In v1, there was a bug that instead returned an unitialized variable - Link to v1: https://lore.kernel.org/r/20240902-th1520-pinctrl-v1-0-639bf83ef50a@tenstorrent.com Signed-off-by: Drew Fustini <dfustini@tenstorrent.com> --- Emil Renner Berthing (8): dt-bindings: pinctrl: Add thead,th1520-pinctrl bindings pinctrl: Add driver for the T-Head TH1520 SoC riscv: dts: thead: Add TH1520 pin control nodes riscv: dts: thead: Add TH1520 GPIO ranges riscv: dts: thead: Adjust TH1520 GPIO labels riscv: dts: thead: Add Lichee Pi 4M GPIO line names riscv: dts: thead: Add TH1520 pinctrl settings for UART0 riscv: dtb: thead: Add BeagleV Ahead LEDs .../bindings/pinctrl/thead,th1520-pinctrl.yaml | 176 ++++ MAINTAINERS | 2 + arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 87 ++ .../boot/dts/thead/th1520-lichee-module-4a.dtsi | 43 + arch/riscv/boot/dts/thead/th1520-lichee-pi-4a.dts | 28 + arch/riscv/boot/dts/thead/th1520.dtsi | 65 +- drivers/pinctrl/Kconfig | 13 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-th1520.c | 907 +++++++++++++++++++++ 9 files changed, 1306 insertions(+), 16 deletions(-) --- base-commit: 9852d85ec9d492ebef56dc5f229416c925758edc change-id: 20240930-th1520-pinctrl-d42163ea2c11 Best regards,