From: Yingjoe Chen <yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
To: Matthias Brugger <matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: xudong chen <xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
srv_heupstream
<srv_heupstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Eddie Huang <eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
Nathan Chung
<nathan.chung-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>,
YH Chen <yh.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 3/3] I2C: mediatek: Add driver for MediaTek I2C controller
Date: Fri, 31 Oct 2014 22:38:08 +0800 [thread overview]
Message-ID: <1414766288.5833.46.camel@mtksdaap41> (raw)
In-Reply-To: <CABuKBeK1O2q37RMVE0Yjp2=QgkzXZfh=vxXiZrw-JMiYMxb-QQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Fri, 2014-10-31 at 11:48 +0100, Matthias Brugger wrote:
> 2014-10-31 7:31 GMT+01:00 xudong chen <xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>:
> > On Thu, 2014-10-30 at 14:16 +0100, Matthias Brugger wrote:
> >> 2014-10-29 6:37 GMT+01:00 Xudong Chen <xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>:
> >> > The mediatek SoCs have I2C controller that handle I2C transfer.
> >> > This patch include common I2C bus driver.
> >> > This driver is compatible with I2C controller on mt65xx/mt81xx.
> >> >
> >> > Signed-off-by: Xudong Chen <xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
> >> > Change-Id: Icc17e326b9df46a226d536956e103f17b0382b6e
> >> > ---
> >> > drivers/i2c/busses/Kconfig | 9 +
> >> > drivers/i2c/busses/Makefile | 1 +
> >> > drivers/i2c/busses/i2c-mt65xx.c | 728 ++++++++++++++++++++++++++++++++++++++++
> >> > 3 files changed, 738 insertions(+)
> >> > create mode 100644 drivers/i2c/busses/i2c-mt65xx.c
> >> >
> >> > diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> >> > index 917c358..0d7d0a4 100644
> >> > --- a/drivers/i2c/busses/Kconfig
> >> > +++ b/drivers/i2c/busses/Kconfig
> >> > @@ -564,6 +564,15 @@ config I2C_MPC
> >> > This driver can also be built as a module. If so, the module
> >> > will be called i2c-mpc.
> >> >
> >> > +config I2C_MT65XX
> >> > + tristate "MediaTek I2C adapter"
> >> > + depends on ARCH_MEDIATEK
> >> > + help
> >> > + This selects the MediaTek(R) Integrated Inter Circuit bus driver
> >> > + for MT65xx and MT81xx.
> >> > + If you want to use MediaTek(R) I2C interface, say Y or M here.
> >> > + If unsure, say N.
> >> > +
> >> > config I2C_MV64XXX
> >> > tristate "Marvell mv64xxx I2C Controller"
> >> > depends on MV64X60 || PLAT_ORION || ARCH_SUNXI
> >> > diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> >> > index 78d56c5..7a9f0f3 100644
> >> > --- a/drivers/i2c/busses/Makefile
> >> > +++ b/drivers/i2c/busses/Makefile
> >> > @@ -54,6 +54,7 @@ obj-$(CONFIG_I2C_IMX) += i2c-imx.o
> >> > obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
> >> > obj-$(CONFIG_I2C_KEMPLD) += i2c-kempld.o
> >> > obj-$(CONFIG_I2C_MPC) += i2c-mpc.o
> >> > +obj-$(CONFIG_I2C_MT65XX) += i2c-mt65xx.o
> >> > +
> >> > +static int mt_i2c_do_transfer(struct mt_i2c *i2c)
> >> > +{
> >> > + u16 addr_reg;
> >> > + u16 control_reg;
> >> > + int tmo = i2c->adap.timeout;
> >> > +
> >> > + i2c->trans_stop = false;
> >> > + i2c->irq_stat = 0;
> >> > +
> >> > + /* If use i2c pin from PMIC mt6397 side, need set PATH_DIR first */
> >> > + if (i2c->have_pmic)
> >> > + i2c_writew(I2C_CONTROL_WRAPPER, i2c, OFFSET_PATH_DIR);
> >>
> >> So this is some sort of multiplexer bit, right?
> >> I think in this case we need to build a multi function device (mfd)
> >> where the pmic driver will set this bit.
> >>
> > Hi,
> >
> > This feature means the chip can use I2C pins from PMIC(mt6397).
> > In this case,
> > 1. We actually control the register on mt8135 and the DMA/Control Logic
> > is on mt8135, only use pins from mt6397. If set register OFFSET_PATH_DIR
> > bit0 to 1, the I2C data will go/from PMIC pins.
>
> Sorry but I'm a bit puzzled. mt6397 is the PMIC, right?
> So from the mt6589 datasheet it says:
> "PATH_DIR Decides transmission direction
> If set, the I2C data will go/from PMIC; otherwise, the I2C data will
> go/from main die."
>
> From my understanding the I2C bus will be multiplexed depending on
> this bit. The bit decides if it the data will be send to the PMIC or
> to some other I2C peripheral.
>
> So we need a mfd and the PMIC device driver sets/unsets the PATH_DIR register.
Yes, mt6397 is the PMIC work with mt8135 or mt8127.
I think the datasheet is a little misleading here. AFAIK, on 8135 even
if your clear the bit for I2C4, there are no corresponding pins for this
i2c port on 8135. So it is not really multiplexed. Base on my
understanding this is more like "Set this bit if this a PMIC I2C port".
In order to use i2c4, we do need a PMIC pinmux driver to set pinmux
function for this i2c port. Since all the i2c control logic and
registers are on mt8135, it is strange to have PMIC device driver set
this bit on mt8135. Also, since mt8127 doesn't support this, it will be
even stranger when using this pmic and driver with mt8127.
Joe.C
next prev parent reply other threads:[~2014-10-31 14:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 5:37 [PATCH 0/3] ARM: mediatek: Add driver for Mediatek I2C controller Xudong Chen
2014-10-29 5:37 ` [PATCH 1/3] dt-bindings: Add I2C bindings for mt65xx/mt81xx Xudong Chen
2014-10-30 12:38 ` Matthias Brugger
2014-10-31 1:38 ` xudong chen
2014-10-31 10:50 ` Matthias Brugger
2014-10-29 5:37 ` [PATCH 2/3] ARM: mediatek: Add I2C node for mt8135 and mt8127 Xudong Chen
2014-10-29 5:37 ` [PATCH 3/3] I2C: mediatek: Add driver for MediaTek I2C controller Xudong Chen
[not found] ` <1414561058-23803-4-git-send-email-xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2014-10-30 13:16 ` Matthias Brugger
2014-10-30 13:25 ` Wolfram Sang
2014-10-30 14:49 ` Yingjoe Chen
[not found] ` <CABuKBe+RXboBEZD7Bu_kSbVwiapJJcAuuw_wo=xw67osJWJ20w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-31 6:31 ` xudong chen
2014-10-31 10:48 ` Matthias Brugger
[not found] ` <CABuKBeK1O2q37RMVE0Yjp2=QgkzXZfh=vxXiZrw-JMiYMxb-QQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-31 14:38 ` Yingjoe Chen [this message]
2014-10-31 16:10 ` Matthias Brugger
[not found] ` <CABuKBeJ2NxcVn=yapcvNs1xLU+eye4JWESBwdcWoeqO=-vMBKw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-03 5:44 ` xudong chen
2014-11-03 8:11 ` Sascha Hauer
[not found] ` <1414561058-23803-1-git-send-email-xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2014-10-29 6:26 ` [PATCH 0/3] ARM: mediatek: Add driver for Mediatek " xudong chen
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=1414766288.5833.46.camel@mtksdaap41 \
--to=yingjoe.chen-nus5lvnupcjwk0htik3j/w@public.gmane.org \
--cc=arm-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=eddie.huang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
--cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=nathan.chung-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=srv_heupstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
--cc=xudong.chen-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=yh.chen-NuS5LvNUpcJWk0Htik3J/w@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).