From: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
To: Robert ABEL
<rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>,
wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH 6/6] i2c: Xilinx IIC: add DT Endianness support
Date: Mon, 3 Aug 2015 07:32:21 +0200 [thread overview]
Message-ID: <55BEFCE5.70109@xilinx.com> (raw)
In-Reply-To: <1438344034-20211-8-git-send-email-rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>
On 07/31/2015 02:00 PM, Robert ABEL wrote:
> Signed-off-by: Robert ABEL <rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-xiic.c | 38 ++++++++++++++++++++++++++++++++++++--
> 1 file changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 6a834bc..ab040a5 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -76,6 +76,8 @@ enum xilinx_i2c_reason {
> * @state: Current controller state
> * @reasons: Reason for entering STATE_ERROR.
> * Only valid while in STATE_ERROR.
> + * @getreg32: Register Read function, respects DT endianness.
> + * @setreg32: Register Write function, respects DT endianness.
> */
> struct xiic_i2c {
> void __iomem * base;
> @@ -87,6 +89,8 @@ struct xiic_i2c {
> unsigned int nmsgs;
> enum xilinx_i2c_state state;
> enum xilinx_i2c_reason reason;
> + u32 (*getreg32)(const volatile void __iomem *addr);
> + void (*setreg32)(u32 value, volatile void __iomem *addr);
> };
>
>
> @@ -175,8 +179,28 @@ struct xiic_i2c {
> static void xiic_enqueue_msg(struct xiic_i2c *i2c);
>
> #define xiic_msg_space(i2c) ((i2c)->msg->len - (i2c)->pos)
> -#define xiic_getreg32(i2c, reg) ioread32(i2c->base + reg)
> -#define xiic_setreg32(i2c, reg, value) iowrite32(value, i2c->base + reg)
> +#define xiic_getreg32(i2c, reg) (i2c->getreg32(i2c->base + reg))
> +#define xiic_setreg32(i2c, reg, value) (i2c->setreg32(value, i2c->base + reg))
> +
> +static u32 xiic_getreg32le(const volatile void __iomem *addr)
> +{
> + return ioread32(addr);
> +}
> +
> +static void xiic_setreg32le(u32 value, volatile void __iomem *addr)
> +{
> + iowrite32(value, addr);
> +}
> +
> +static u32 xiic_getreg32be(const volatile void __iomem *addr)
> +{
> + return ioread32be(addr);
> +}
> +
> +static void xiic_setreg32be(u32 value, volatile void __iomem *addr)
> +{
> + iowrite32be(value, addr);
> +}
>
> static inline void xiic_irq_dis(struct xiic_i2c *i2c, u32 mask)
> {
> @@ -1114,6 +1138,16 @@ static int xiic_i2c_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "Cannot claim IRQ\n");
> return ret;
> }
> +
> + i2c->getreg32 = xiic_getreg32le;
> + i2c->setreg32 = xiic_setreg32le;
> +
> +#if defined(CONFIG_OF)
> + if (of_device_is_big_endian(pdev->dev.of_node)) {
> + i2c->getreg32 = xiic_getreg32be;
> + i2c->setreg32 = xiic_setreg32be;
> + }
> +#endif
>
> xiic_reinit(i2c);
>
>
NACK for this. Previous driver version did automatic detection directly
on the IP. You are changing it to be OF driven with is error prone and
highly depends on user.
Thanks,
Michal
next prev parent reply other threads:[~2015-08-03 5:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 12:00 [PATCH 0/6] i2c: Xilinx IIC: rework driver Robert ABEL
[not found] ` <1438344034-20211-1-git-send-email-rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>
2015-07-31 12:00 ` [PATCH 0/6] i2c: Xilinx IIC: rename register defines Robert ABEL
2015-07-31 12:00 ` [PATCH 1/6] i2c: Xilinx IIC: remove Endianness hack Robert ABEL
2015-07-31 12:00 ` [PATCH 2/6] i2x: Xilinx IIC: remove non-initial tabs Robert ABEL
2015-07-31 12:00 ` [PATCH 3/6] i2c: Xilinx IIC: make all ioread/write calls 32-bit Robert ABEL
2015-07-31 12:00 ` [PATCH 4/6] i2c: Xilinx IIC: completely redo FSM/ISR logic Robert ABEL
2015-07-31 12:00 ` [PATCH 5/6] i2c: Xilinx IIC: make reset after TX error configurable Robert ABEL
[not found] ` <1438344034-20211-7-git-send-email-rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>
2015-08-03 5:34 ` Michal Simek
[not found] ` <55BEFD63.6090108-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2015-08-03 7:50 ` Robert Abel
[not found] ` <CAMdRc4F__S-dQOOsZv0pUtER5+-kwH=Mt+wfanvJXHWqS=YRMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-06 9:18 ` Michal Simek
[not found] ` <55C32666.6070304-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2015-08-06 9:40 ` Robert Abel
2015-07-31 12:00 ` [PATCH 6/6] i2c: Xilinx IIC: add DT Endianness support Robert ABEL
[not found] ` <1438344034-20211-8-git-send-email-rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org>
2015-08-03 5:32 ` Michal Simek [this message]
[not found] ` <55BEFCE5.70109-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2015-08-03 7:46 ` Robert Abel
2015-08-03 5:26 ` [PATCH 0/6] i2c: Xilinx IIC: rework driver Michal Simek
[not found] ` <55BEFB87.1090909-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2015-08-03 7:30 ` Robert Abel
[not found] ` <CAMdRc4EKRQki+Pm-Et29FyaKARkiCeNGsGYMAQFVyYyvxW2EOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-08-03 7:44 ` Michal Simek
[not found] ` <55BF1BF5.4010809-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2015-08-03 7:56 ` Robert Abel
[not found] ` <CAKfKVtG6rRyb70Mxe46Rd9czkx6kSaf91pTeysRf78vtpypFBA@mail.gmail.com>
[not found] ` <CAMdRc4EmQN7SAxgcuauowuz5vOvNn2QYsv99=yUNQOSFRVVr8Q@mail.gmail.com>
[not found] ` <CAMdRc4EmQN7SAxgcuauowuz5vOvNn2QYsv99=yUNQOSFRVVr8Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-07-31 20:53 ` Fwd: " Robert Abel
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=55BEFCE5.70109@xilinx.com \
--to=michal.simek-gjffaj9ahvfqt0dzr+alfa@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rabel-Ejy783gw450hGw5VS8l+XCM2BslAju9D@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.