From: Baruch Siach <baruch-NswTu9S1W3P6gbPvEgmw2w@public.gmane.org>
To: Zhangfei Gao <zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Dirk Brandewie
<dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
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 06:23:00 +0300 [thread overview]
Message-ID: <20130609032300.GB4312@tarshish> (raw)
In-Reply-To: <1370745402-11844-3-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Hi Zhangfei Gao,
On Sun, Jun 09, 2013 at 10:36:42AM +0800, Zhangfei Gao wrote:
> Add support hisilicon i2c driver, which reuse designware i2c ip
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
> .../devicetree/bindings/i2c/i2c-designware-hs.txt | 30 +++
> drivers/i2c/busses/Kconfig | 10 +
> drivers/i2c/busses/Makefile | 1 +
> drivers/i2c/busses/i2c-designware-hs.c | 194 ++++++++++++++++++++
> 4 files changed, 235 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/i2c/i2c-designware-hs.txt
> create mode 100644 drivers/i2c/busses/i2c-designware-hs.c
>
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-designware-hs.txt b/Documentation/devicetree/bindings/i2c/i2c-designware-hs.txt
> new file mode 100644
> index 0000000..08908fa
> --- /dev/null
> +++ 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
> + #address-cells = <1>;
> + #size-cells = <0>;
> + reg = <0xfcb08000 0x1000>;
> + interrupts = <0 28 4>;
> + clocks = <&pclk>;
> + status = "disabled";
> + };
> +
> + Client in i2c0 bus with add 0x58 could be added as example
> + i2c0: i2c@fcb08000 {
> + status = "ok";
The convention is to use "okay".
> + 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?
> +static struct i2c_algorithm hs_i2c_dw_algo = {
> + .master_xfer = i2c_dw_xfer,
> + .functionality = i2c_dw_func,
> +};
> +static u32 hs_i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
> +{
> + return clk_get_rate(dev->clk)/1000;
> +}
> +
> +static int hs_dw_i2c_probe(struct platform_device *pdev)
> +{
> + struct dw_i2c_dev *d;
> + struct i2c_adapter *adap;
> + struct resource *iores;
> + struct pinctrl *pinctrl;
> + int r;
> +
> + d = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
> + if (!d)
> + return -ENOMEM;
> +
> + /* NOTE: driver uses the static register mapping */
> + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!iores)
> + return -EINVAL;
> +
> + d->base = devm_request_and_ioremap(&pdev->dev, iores);
> + if (!d->base)
> + return -EADDRNOTAVAIL;
> +
> + d->irq = platform_get_irq(pdev, 0);
> + if (d->irq < 0) {
> + dev_err(&pdev->dev, "no irq resource?\n");
> + return d->irq; /* -ENXIO */
> + }
[...]
baruch
--
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 parent reply other threads:[~2013-06-09 3:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1370745402-11844-1-git-send-email-zhangfei.gao@linaro.org>
[not found] ` <1370745402-11844-3-git-send-email-zhangfei.gao@linaro.org>
[not found] ` <1370745402-11844-3-git-send-email-zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-09 3:23 ` Baruch Siach [this message]
2013-06-09 8:59 ` [PATCH 2/2] i2c: designware: Add i2c-designware-hs zhangfei gao
[not found] ` <CAMj5BkhPp_-b19WFM-XitJ5-qDd9-dETp7UdNRLkRbdcq_h-Vg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-06-09 9:50 ` Baruch Siach
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=20130609032300.GB4312@tarshish \
--to=baruch-nswtu9s1w3p6gbpvegmw2w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
--cc=zhangfei.gao-QSEj5FYQhm4dnm+yROfE0A@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 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).