All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/8] ti: common: board_detect: Introduce function to set the address length.
Date: Fri, 28 Apr 2017 05:58:29 +0200	[thread overview]
Message-ID: <5902BDE5.1010000@denx.de> (raw)
In-Reply-To: <20170420152549.28031-4-fcooper@ti.com>

Hello Franklin,

Am 20.04.2017 um 17:25 schrieb Franklin S Cooper Jr:
> Reading from the I2C EEPROM used typically requires using an address length
> of 2. However, when using DM for I2C the default address length used is 1.
> To fix this introduce a new function that allows the address length to be
> changed. The logic to do so was copied from cmd/i2c.c.
>
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
>   board/ti/common/board_detect.c | 37 +++++++++++++++++++++++++++++++++++++

Reviewed-by: Heiko Schocher <hs@denx.de>

Applied to u-boot-i2c/next

bye,
Heiko
>   1 file changed, 37 insertions(+)
>
> diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
> index c55e24e..1e695f4 100644
> --- a/board/ti/common/board_detect.c
> +++ b/board/ti/common/board_detect.c
> @@ -10,10 +10,47 @@
>
>   #include <common.h>
>   #include <asm/omap_common.h>
> +#include <dm/uclass.h>
>   #include <i2c.h>
>
>   #include "board_detect.h"
>
> +#if defined(CONFIG_DM_I2C_COMPAT)
> +/**
> + * ti_i2c_set_alen - Set chip's i2c address length
> + * @bus_addr - I2C bus number
> + * @dev_addr - I2C eeprom id
> + * @alen     - I2C address length in bytes
> + *
> + * DM_I2C by default sets the address length to be used to 1. This
> + * function allows this address length to be changed to match the
> + * eeprom used for board detection.
> + */
> +int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen)
> +{
> +	struct udevice *dev;
> +	struct udevice *bus;
> +	int rc;
> +
> +	rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus);
> +	if (rc)
> +		return rc;
> +	rc = i2c_get_chip(bus, dev_addr, 1, &dev);
> +	if (rc)
> +		return rc;
> +	rc = i2c_set_chip_offset_len(dev, alen);
> +	if (rc)
> +		return rc;
> +
> +	return 0;
> +}
> +#else
> +int __maybe_unused ti_i2c_set_alen(int bus_addr, int dev_addr, int alen)
> +{
> +	return 0;
> +}
> +#endif
> +
>   /**
>    * ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device
>    * @i2c_bus: i2c bus number to initialize
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  parent reply	other threads:[~2017-04-28  3:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 15:25 [U-Boot] [PATCH v2 0/8] drivers: i2c: davinci_i2c: Convert driver to DM Franklin S Cooper Jr
2017-04-20 15:25 ` [U-Boot] [PATCH v2 1/8] i2c: davinci: Split functions into two parts for future DM support Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  3:54   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 2/8] drivers: i2c: davinci_i2c: Update davinci i2c driver to driver model Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  3:55   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 3/8] ti: common: board_detect: Introduce function to set the address length Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  3:58   ` Heiko Schocher [this message]
2017-04-20 15:25 ` [U-Boot] [PATCH v2 4/8] ti: common: board_detect: Set alen to expected value before i2c read Franklin S Cooper Jr
2017-04-28  4:00   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 5/8] ARM: dts: k2g: Add I2C nodes to 66AK2Gx Franklin S Cooper Jr
2017-04-28  4:01   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 6/8] ARM: dts: keystone2: add I2C aliases for davinci I2C nodes Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  4:03   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 7/8] ARM: dts: keystone-k2g-evm: Enable I2C0 and I2C1 Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  4:05   ` Heiko Schocher
2017-04-20 15:25 ` [U-Boot] [PATCH v2 8/8] ARM: keystone: Enable DM_I2C by default Franklin S Cooper Jr
2017-04-26 19:16   ` Tom Rini
2017-04-28  4:07   ` Heiko Schocher
2017-04-21  4:08 ` [U-Boot] [PATCH v2 0/8] drivers: i2c: davinci_i2c: Convert driver to DM Vignesh R
2017-04-21  9:13   ` Vignesh R
2017-06-08  5:13 ` Lokesh Vutla

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=5902BDE5.1010000@denx.de \
    --to=hs@denx.de \
    --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.