From: Guenter Roeck <linux@roeck-us.net>
To: monstr@monstr.eu
Cc: Harini Katakam <harinik@xilinx.com>,
grant.likely@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, rob@landley.net, michals@xilinx.com,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] watchdog: Add Cadence WDT driver
Date: Tue, 01 Apr 2014 17:32:42 -0700 [thread overview]
Message-ID: <533B5AAA.50707@roeck-us.net> (raw)
In-Reply-To: <533AA0F7.2080304@monstr.eu>
On 04/01/2014 04:20 AM, Michal Simek wrote:
> Hi Guenter,
>
>>> +/**
>>> + * struct cdns_wdt - Watchdog device structure
>>> + * @regs: baseaddress of device
>>> + * @rst: reset flag
>>> + * @clk: struct clk * of a clock source
>>> + * @prescaler: for saving prescaler value
>>> + * @ctrl_clksel: counter clock prescaler selection
>>> + * @io_lock: spinlock for IO register access
>>> + * @cdns_wdt_device: watchdog device structure
>>> + * @cdns_wdt_notifier: notifier structure
>>> + *
>>> + * Structure containing parameters specific to cadence watchdog.
>>> + */
>>> +struct cdns_wdt {
>>> + void __iomem *regs;
>>> + u32 rst;
>>> + struct clk *clk;
>>> + u32 prescaler;
>>> + u32 ctrl_clksel;
>>> + spinlock_t io_lock;
>>> + struct watchdog_device cdns_wdt_device;
>>> + struct notifier_block cdns_wdt_notifier;
>>> +};
>>> +
>>> +/* Write access to Registers */
>>> +static inline void cdns_wdt_writereg(void __iomem *offset, u32 val)
>>> +{
>>> + writel_relaxed(val, offset);
>>> +}
>>> +
>>
>> Not really sure if this function provides any value.
>
> I can't see any problem to use this helper IO function
> but maybe we could do it a little bit differently.
> Currently implementation is just passing values to writel_relaxed()
>
> What about to do it like this?
>
> static inline void cdns_wdt_writereg(struct cdns_wdt *wdt, u32 offset, u32 val)
> {
> writel_relaxed(val, wdt->regs + offset);
> }
>
Yes, that would make more sense.
Guenter
> This solution was suggested by Mark here too.
> https://lkml.org/lkml/2014/3/17/234
>
> The reason for having one IO helper function is
> 1. Simper debugging when you add printks to one location and
> you get full list for accesses
> 2. This driver can be also used by BE Linux on Microblaze in PL
> that's why there could be a need to autodetect endianess directly
> on the IP itself. Then using helper function is necessary.
> 3. We have met with secure monitor implementation where all these
> io accesses should be done via smc calls and having
> IO helper function is easier for change.
>
> Thanks,
> Michal
>
next prev parent reply other threads:[~2014-04-02 0:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 10:31 [PATCH 1/2] watchdog: Add Cadence WDT driver Harini Katakam
2014-03-28 10:32 ` [PATCH 2/2] devicetree: Add Cadence WDT devicetree bindings documentation Harini Katakam
2014-03-31 10:30 ` [PATCH 1/2] watchdog: Add Cadence WDT driver One Thousand Gnomes
2014-04-01 0:24 ` Guenter Roeck
2014-04-01 0:32 ` Guenter Roeck
2014-04-01 7:35 ` Harini Katakam
2014-04-01 11:20 ` Michal Simek
2014-04-02 0:32 ` Guenter Roeck [this message]
[not found] ` <533B5AAA.50707-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-04-02 5:47 ` Michal Simek
-- strict thread matches above, loose matches on Subject: below --
2014-03-28 10:36 Harini Katakam
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=533B5AAA.50707@roeck-us.net \
--to=linux@roeck-us.net \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=harinik@xilinx.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=michals@xilinx.com \
--cc=monstr@monstr.eu \
--cc=pawel.moll@arm.com \
--cc=rob@landley.net \
--cc=robh+dt@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).