From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Viresh Kumar <vireshk@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Vinod Koul <vkoul@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
dmaengine <dmaengine@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
linux-clk <linux-clk@vger.kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Milan Stevanovic <milan.stevanovic@se.com>,
Jimmy Lalande <jimmy.lalande@se.com>,
Laetitia MARIOTTINI <laetitia.mariottini@se.com>
Subject: Re: [PATCH 3/8] soc: renesas: rzn1-sysc: Export function to set dmamux
Date: Mon, 21 Feb 2022 16:01:21 +0100 [thread overview]
Message-ID: <20220221160121.6a7a0ed6@xps13> (raw)
In-Reply-To: <CAMuHMdWBfJSeEOev81WYSEw+9FAcUzBnN2n5BHJ2n0ig=6fxKQ@mail.gmail.com>
Hi Geert,
geert@linux-m68k.org wrote on Mon, 21 Feb 2022 10:16:24 +0100:
> Hi Miquel,
>
> On Fri, Feb 18, 2022 at 7:12 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > The dmamux register is located within the system controller.
> >
> > Without syscon, we need an extra helper in order to give write access to
> > this register to a dmamux driver.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>
> Thanks for your patch!
>
> > --- a/drivers/clk/renesas/r9a06g032-clocks.c
> > +++ b/drivers/clk/renesas/r9a06g032-clocks.c
>
> Missing #include <linux/soc/renesas/r9a06g032-syscon.h>
>
> > @@ -315,6 +315,27 @@ struct r9a06g032_priv {
> > void __iomem *reg;
> > };
> >
> > +/* Exported helper to access the DMAMUX register */
> > +static struct r9a06g032_priv *syscon_priv;
>
> I'd call this sysctrl_priv, as that matches the bindings and
> binding header file name.
Ok.
>
> > +int r9a06g032_syscon_set_dmamux(u32 mask, u32 val)
> > +{
> > + u32 dmamux;
> > +
> > + if (!syscon_priv)
> > + return -EPROBE_DEFER;
> > +
> > + spin_lock(&syscon_priv->lock);
>
> This needs propection against interrupts => spin_lock_irqsave().
Yes.
>
> > +
> > + dmamux = readl(syscon_priv->reg + R9A06G032_SYSCON_DMAMUX);
> > + dmamux &= ~mask;
> > + dmamux |= val & mask;
> > + writel(dmamux, syscon_priv->reg + R9A06G032_SYSCON_DMAMUX);
> > +
> > + spin_unlock(&syscon_priv->lock);
> > +
> > + return 0;
> > +}
> > +
> > /* register/bit pairs are encoded as an uint16_t */
> > static void
> > clk_rdesc_set(struct r9a06g032_priv *clocks,
>
> > --- a/include/dt-bindings/clock/r9a06g032-sysctrl.h
> > +++ b/include/dt-bindings/clock/r9a06g032-sysctrl.h
> > @@ -145,4 +145,6 @@
> > #define R9A06G032_CLK_UART6 152
> > #define R9A06G032_CLK_UART7 153
> >
> > +#define R9A06G032_SYSCON_DMAMUX 0xA0
>
> I don't think this needs to be part of the bindings, so please move
> it to the driver source file.
I've moved it to the top of the file. There definitions are a bit mixed
with the code, I don't like this, so I kept it at the top.
>
> > --- /dev/null
> > +++ b/include/linux/soc/renesas/r9a06g032-syscon.h
>
> r9a06g032-sysctrl.h etc.
Done.
>
> > @@ -0,0 +1,11 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef __LINUX_SOC_RENESAS_R9A06G032_SYSCON_H__
> > +#define __LINUX_SOC_RENESAS_R9A06G032_SYSCON_H__
> > +
> > +#ifdef CONFIG_CLK_R9A06G032
> > +int r9a06g032_syscon_set_dmamux(u32 mask, u32 val);
> > +#else
> > +static inline int r9a06g032_syscon_set_dmamux(u32 mask, u32 val) { return -ENODEV; }
> > +#endif
> > +
> > +#endif /* __LINUX_SOC_RENESAS_R9A06G032_SYSCON_H__ */
> > --
> > 2.27.0
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
Thanks,
Miquèl
next prev parent reply other threads:[~2022-02-21 15:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 18:12 [PATCH 0/8] RZN1 DMA support Miquel Raynal
2022-02-18 18:12 ` [PATCH 1/8] dt-bindings: dma: Introduce RZN1 dmamux bindings Miquel Raynal
2022-02-18 18:12 ` [PATCH 2/8] dt-bindings: dma: Introduce RZN1 DMA compatible Miquel Raynal
2022-02-21 2:36 ` Rob Herring
2022-02-21 14:24 ` Miquel Raynal
2022-02-18 18:12 ` [PATCH 3/8] soc: renesas: rzn1-sysc: Export function to set dmamux Miquel Raynal
2022-02-20 18:16 ` kernel test robot
2022-02-20 19:28 ` kernel test robot
2022-02-21 9:16 ` Geert Uytterhoeven
2022-02-21 15:01 ` Miquel Raynal [this message]
2022-02-25 18:32 ` Rob Herring
2022-02-27 14:09 ` Miquel Raynal
2022-02-18 18:12 ` [PATCH 4/8] dma: dmamux: Introduce RZN1 DMA router support Miquel Raynal
2022-02-20 10:56 ` Andy Shevchenko
2022-02-21 15:13 ` Miquel Raynal
2022-02-21 16:47 ` Andy Shevchenko
2022-02-20 21:22 ` kernel test robot
2022-02-21 4:15 ` kernel test robot
2022-02-18 18:12 ` [PATCH 5/8] dma: dw: Avoid partial transfers Miquel Raynal
2022-02-20 10:49 ` Andy Shevchenko
2022-02-21 8:14 ` Phil Edworthy
2022-02-21 12:59 ` Miquel Raynal
2022-02-21 16:52 ` Andy Shevchenko
2022-02-23 7:45 ` Phil Edworthy
2022-02-23 8:01 ` Phil Edworthy
2022-02-23 13:38 ` Andy Shevchenko
2022-02-18 18:12 ` [PATCH 6/8] dma: dw: Add RZN1 compatible Miquel Raynal
2022-02-18 18:12 ` [PATCH 7/8] ARM: dts: r9a06g032: Add the two DMA nodes Miquel Raynal
2022-02-18 18:12 ` [PATCH 8/8] ARM: dts: r9a06g032: Describe the DMA router Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220221160121.6a7a0ed6@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=geert@linux-m68k.org \
--cc=jimmy.lalande@se.com \
--cc=laetitia.mariottini@se.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=milan.stevanovic@se.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=vireshk@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).