From: baruch@tkos.co.il (Baruch Siach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] i2c: designware: Add i2c-designware-hs
Date: Sun, 9 Jun 2013 12:50:26 +0300 [thread overview]
Message-ID: <20130609095026.GF4312@tarshish> (raw)
In-Reply-To: <CAMj5BkhPp_-b19WFM-XitJ5-qDd9-dETp7UdNRLkRbdcq_h-Vg@mail.gmail.com>
Hi zhangfei gao,
On Sun, Jun 09, 2013 at 04:59:48PM +0800, zhangfei gao wrote:
> >> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware-hs.txt
> >> @@ -0,0 +1,30 @@
> >> +* Hisilicon I2C Controller
> >> +
> >> +Required properties :
> >> +
> >> + - compatible : should be "hisilicon,designware-i2c"
> >> + - reg : Offset and length of the register set for the device
> >> + - interrupts : <IRQ> where IRQ is the interrupt number.
> >> +
> >> +Example :
> >> +
> >> + i2c0: i2c at fcb08000 {
> >> + compatible = "hs,designware-i2c";
> >
> > A few comments on this one:
> >
> > 1. You should Cc devicetree-discuss at lists.ozlabs.org on patches touching ftd
> > bindings (added to Cc)
> >
> > 2. The convention is to use the IC block designer in the "compatible" property
> > prefix, in this case Symopsys (snps)
> >
> > 3. This does not match the compatible property in hs_dw_i2c_of_match[] below
> > where you use "hisilicon,designware-i2c"
> >
> > 4. Please update Documentation/devicetree/bindings/vendor-prefixes.txt when
> > adding new vendor prefixes
>
> Thanks Baruch for the kind education, really useful.
> How about using .compatible = "snps,hisilicon-i2c"
I don't think this is needed. See below.
> >> + Client in i2c0 bus with add 0x58 could be added as example
> >> + i2c0: i2c at fcb08000 {
> >> + status = "ok";
> >
> > The convention is to use "okay".
> got it.
>
> >
> >> + pinctrl-names = "default";
> >> + pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>;
> >> + i2c_client1: i2c_client at 58 {
> >> + compatible = "hisilicon,i2c_client_tpa2028";
> >> + reg = <0x58>;
> >> + };
> >> + };
> >
> > [...]
> >
> > The code below looks like a direct copy of i2c-designware-platdrv.c. Is there
> > any reason you can't use that code instead?
>
> Not understood i2c-designware-platdrv.c can be directly touched.
> Usually, there is register function, or external function call.
>
> It would be great if we could directly add hisilicon support in
> i2c-designware-platdrv.c.
> How about adding these code to distinguish.
>
> The concern is will platdrv.c become bigger and bigger?
The overall code size becomes much bigger when duplicating the code. It makes
code maintenance harder.
> What in case private register have to be accessed?
Good question. I don't know what is the common convention in this case. Do you
have such a need here?
> struct dw_i2c_data {
> u32 accessor_flags;
> unsigned int tx_fifo_depth;
> unsigned int rx_fifo_depth;
> };
>
> static struct dw_i2c_data hisilicon_data = {
> .accessor_flags = ACCESS_32BIT,
This should be detected automatically in i2c_dw_init(). When ACCESS_16BIT is
not set, access is 32bit wide. Doesn't it work for you?
> .tx_fifo_depth = 16,
> .rx_fifo_depth = 16,
These should be encoded in new device-tree properties named "tx-fifo-size",
and "rx-fifo-size". For example, see
Documentation/devicetree/bindings/powerpc/4xx/emac.txt.
baruch
> };
> { .compatible = "snps,hisilicon-i2c", .data = &hisilicon_data},
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
WARNING: multiple messages have this Message-ID (diff)
From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
To: zhangfei gao <zhangfei.gao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Dirk Brandewie
<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Zhangfei Gao
<zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
device-tree
<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
linux-arm-kernel
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Subject: Re: [PATCH 2/2] i2c: designware: Add i2c-designware-hs
Date: Sun, 9 Jun 2013 12:50:26 +0300 [thread overview]
Message-ID: <20130609095026.GF4312@tarshish> (raw)
In-Reply-To: <CAMj5BkhPp_-b19WFM-XitJ5-qDd9-dETp7UdNRLkRbdcq_h-Vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi zhangfei gao,
On Sun, Jun 09, 2013 at 04:59:48PM +0800, zhangfei gao wrote:
> >> +++ b/Documentation/devicetree/bindings/i2c/i2c-designware-hs.txt
> >> @@ -0,0 +1,30 @@
> >> +* Hisilicon I2C Controller
> >> +
> >> +Required properties :
> >> +
> >> + - compatible : should be "hisilicon,designware-i2c"
> >> + - reg : Offset and length of the register set for the device
> >> + - interrupts : <IRQ> where IRQ is the interrupt number.
> >> +
> >> +Example :
> >> +
> >> + i2c0: i2c@fcb08000 {
> >> + compatible = "hs,designware-i2c";
> >
> > A few comments on this one:
> >
> > 1. You should Cc devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org on patches touching ftd
> > bindings (added to Cc)
> >
> > 2. The convention is to use the IC block designer in the "compatible" property
> > prefix, in this case Symopsys (snps)
> >
> > 3. This does not match the compatible property in hs_dw_i2c_of_match[] below
> > where you use "hisilicon,designware-i2c"
> >
> > 4. Please update Documentation/devicetree/bindings/vendor-prefixes.txt when
> > adding new vendor prefixes
>
> Thanks Baruch for the kind education, really useful.
> How about using .compatible = "snps,hisilicon-i2c"
I don't think this is needed. See below.
> >> + Client in i2c0 bus with add 0x58 could be added as example
> >> + i2c0: i2c@fcb08000 {
> >> + status = "ok";
> >
> > The convention is to use "okay".
> got it.
>
> >
> >> + pinctrl-names = "default";
> >> + pinctrl-0 = <&i2c0_pmx_func &i2c0_cfg_func>;
> >> + i2c_client1: i2c_client@58 {
> >> + compatible = "hisilicon,i2c_client_tpa2028";
> >> + reg = <0x58>;
> >> + };
> >> + };
> >
> > [...]
> >
> > The code below looks like a direct copy of i2c-designware-platdrv.c. Is there
> > any reason you can't use that code instead?
>
> Not understood i2c-designware-platdrv.c can be directly touched.
> Usually, there is register function, or external function call.
>
> It would be great if we could directly add hisilicon support in
> i2c-designware-platdrv.c.
> How about adding these code to distinguish.
>
> The concern is will platdrv.c become bigger and bigger?
The overall code size becomes much bigger when duplicating the code. It makes
code maintenance harder.
> What in case private register have to be accessed?
Good question. I don't know what is the common convention in this case. Do you
have such a need here?
> struct dw_i2c_data {
> u32 accessor_flags;
> unsigned int tx_fifo_depth;
> unsigned int rx_fifo_depth;
> };
>
> static struct dw_i2c_data hisilicon_data = {
> .accessor_flags = ACCESS_32BIT,
This should be detected automatically in i2c_dw_init(). When ACCESS_16BIT is
not set, access is 32bit wide. Doesn't it work for you?
> .tx_fifo_depth = 16,
> .rx_fifo_depth = 16,
These should be encoded in new device-tree properties named "tx-fifo-size",
and "rx-fifo-size". For example, see
Documentation/devicetree/bindings/powerpc/4xx/emac.txt.
baruch
> };
> { .compatible = "snps,hisilicon-i2c", .data = &hisilicon_data},
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org - tel: +972.2.679.5364, http://www.tkos.co.il -
next prev parent reply other threads:[~2013-06-09 9:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-09 2:36 [PATCH 0/2] support i2c-designware-hs Zhangfei Gao
2013-06-09 2:36 ` [PATCH 1/2] i2c-designware: support no DW_IC_COMP_TYPE platform Zhangfei Gao
2013-06-09 3:06 ` Baruch Siach
2013-06-09 8:47 ` zhangfei
2013-06-09 2:36 ` [PATCH 2/2] i2c: designware: Add i2c-designware-hs Zhangfei Gao
2013-06-09 3:23 ` Baruch Siach
2013-06-09 3:23 ` Baruch Siach
2013-06-09 8:59 ` zhangfei gao
2013-06-09 8:59 ` zhangfei gao
2013-06-09 9:50 ` Baruch Siach [this message]
2013-06-09 9:50 ` Baruch Siach
2013-06-09 16:03 ` zhangfei
2013-06-09 16:03 ` zhangfei
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=20130609095026.GF4312@tarshish \
--to=baruch@tkos.co.il \
--cc=linux-arm-kernel@lists.infradead.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.