From: Michal Simek <monstr@monstr.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] i2c:zynq: I2C multi-bus support on Zynq
Date: Thu, 19 Sep 2013 11:29:14 +0200 [thread overview]
Message-ID: <523AC3EA.70304@monstr.eu> (raw)
In-Reply-To: <EFBFAB0BC299D345A30F813A3C85DA8701252C2D@EDPR-EX01.logicpd.com>
On 09/18/2013 06:28 PM, Michael Burr wrote:
> This amends my previous patch (of Sept. 17, 2013, 5:29 p.m):
>> Initialize both bus masters as needed in 'i2c_init'.
> The behavior of this code should be unchanged from the
> old version if CONFIG_I2C_MULTI_BUS is not defined.
>
> According to Heiko, this driver should be ported to the new
> multibus framework (which I will try to do in the near
> future), so I don't expect this patch to be accepted now.
> I am submitting this only to make sure that the current
> iteration of my code is self-consistent (i.e. not broken!).
> This version may also be helpful to anyone who still has
> the older framework.
yes. Please clear this commit message.
>
> Signed-off-by: Michael Burr <michael.burr@logicpd.com>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Michal Simek <monstr@monstr.eu>
> ---
> drivers/i2c/zynq_i2c.c | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/zynq_i2c.c b/drivers/i2c/zynq_i2c.c
> index 1c9ae30..6610869 100644
> --- a/drivers/i2c/zynq_i2c.c
> +++ b/drivers/i2c/zynq_i2c.c
> @@ -7,7 +7,7 @@
> *
> * Copyright (c) 2012-2013 Xilinx, Michal Simek
> *
> - * SPDX-License-Identifier: GPL-2.0+
> + * SPDX-License-Identifier: GPL-2.0+
Probably unrelated change.
> */
>
> #include <common.h>
> @@ -72,9 +72,8 @@ static struct zynq_i2c_registers *zynq_i2c;
> /* I2C init called by cmd_i2c when doing 'i2c reset'. */
> void i2c_init(int requested_speed, int slaveadd)
> {
> -#ifdef CONFIG_I2C_MULTI_BUS
> - current_bus = 0;
> -#endif
I can't see this in Tom's master branch. Which branch/repo did you used?
> +#if defined(CONFIG_I2C_MULTI_BUS) || !defined(CONFIG_ZYNQ_I2C1)
> + /* Hard-code setup for Zynq PS I2C0 */
> zynq_i2c = (struct zynq_i2c_registers *)ZYNQ_I2C_BASEADDR0;
>
> /* 111MHz / ( (3 * 17) * 22 ) = ~100KHz */
> @@ -84,6 +83,24 @@ void i2c_init(int requested_speed, int slaveadd)
> /* Enable master mode, ack, and 7-bit addressing */
> setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_MS |
> ZYNQ_I2C_CONTROL_ACKEN | ZYNQ_I2C_CONTROL_NEA);
> +#endif
> +#if defined(CONFIG_I2C_MULTI_BUS) || defined(CONFIG_ZYNQ_I2C1)
> + /* Hard-code setup for Zynq PS I2C1 */
> + zynq_i2c = (struct zynq_i2c_registers *)ZYNQ_I2C_BASEADDR1;
> +
> + /* 111MHz / ( (3 * 17) * 22 ) = ~100KHz */
> + writel((16 << ZYNQ_I2C_CONTROL_DIV_B_SHIFT) |
> + (2 << ZYNQ_I2C_CONTROL_DIV_A_SHIFT), &zynq_i2c->control);
> +
> + /* Enable master mode, ack, and 7-bit addressing */
> + setbits_le32(&zynq_i2c->control, ZYNQ_I2C_CONTROL_MS |
> + ZYNQ_I2C_CONTROL_ACKEN | ZYNQ_I2C_CONTROL_NEA);
> +#endif
> +#if defined(CONFIG_I2C_MULTI_BUS)
> + /* Initially select bus '0' */
> + zynq_i2c = (struct zynq_i2c_registers *)ZYNQ_I2C_BASEADDR0;
> + current_bus = 0;
> +#endif
You probably have to use different logic here when you should support
both i2c controllers.
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130919/d28b67ae/attachment.pgp>
prev parent reply other threads:[~2013-09-19 9:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 16:28 [U-Boot] i2c:zynq: I2C multi-bus support on Zynq Michael Burr
2013-09-19 5:29 ` Heiko Schocher
2013-09-19 9:29 ` Michal Simek [this message]
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=523AC3EA.70304@monstr.eu \
--to=monstr@monstr.eu \
--cc=u-boot@lists.denx.de \
/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.