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] Exynos5250: I2C: Fix driver as per new I2C multibus/multiadapter support
Date: Tue, 03 Sep 2013 09:01:17 +0200	[thread overview]
Message-ID: <5225893D.6070900@denx.de> (raw)
In-Reply-To: <1378189214-22972-1-git-send-email-rajeshwari.s@samsung.com>

Hello Rajeshwari,

Am 03.09.2013 08:20, schrieb Rajeshwari S Shinde:
> This patch fixes the S3C24xx I2C driver as per new I2C
> multibus/multiadapter support for Exynos5250.
>
> Change-Id: I95873fef7d312310670e3bb33ad9532c10f60463
> Signed-off-by: Rajeshwari S Shinde<rajeshwari.s@samsung.com>
> ---
>   drivers/i2c/s3c24x0_i2c.c       | 14 +++++++-------
>   include/configs/exynos5250-dt.h |  3 ++-
>   2 files changed, 9 insertions(+), 8 deletions(-)

Hmm.. could you switch to the new i2c framework instead fixing
the old state of the driver?

Also there is another board which uses this driver:

[hs at pollux u-boot]$ grep -lr CONFIG_DRIVER_S3C24X0_I2C include/configs/
include/configs/exynos5250-dt.h
include/configs/VCMA9.h
[hs at pollux u-boot]$

Please fix this too, if switching to the new framework ... thanks!

> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index cd09c78..5fdb85f 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -53,7 +53,7 @@
>   static unsigned int g_current_bus __attribute__((section(".data")));
>   #ifdef CONFIG_OF_CONTROL
>   static int i2c_busses __attribute__((section(".data")));
> -static struct s3c24x0_i2c_bus i2c_bus[CONFIG_MAX_I2C_NUM]
> +static struct s3c24x0_i2c_bus i2c_bus_data[CONFIG_SYS_NUM_I2C_BUSES]
>   			__attribute__((section(".data")));
>   #endif
>
> @@ -160,7 +160,7 @@ int i2c_set_bus_num(unsigned int bus)
>   {
>   	struct s3c24x0_i2c *i2c;
>
> -	if ((bus<  0) || (bus>= CONFIG_MAX_I2C_NUM)) {
> +	if ((bus<  0) || (bus>= CONFIG_SYS_NUM_I2C_BUSES)) {
>   		debug("Bad bus: %d\n", bus);
>   		return -1;
>   	}
> @@ -503,12 +503,12 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
>   void board_i2c_init(const void *blob)
>   {
>   	int i;
> -	int node_list[CONFIG_MAX_I2C_NUM];
> +	int node_list[CONFIG_SYS_NUM_I2C_BUSES];
>   	int count;
>
>   	count = fdtdec_find_aliases_for_id(blob, "i2c",
>   		COMPAT_SAMSUNG_S3C2440_I2C, node_list,
> -		CONFIG_MAX_I2C_NUM);
> +		CONFIG_SYS_NUM_I2C_BUSES);
>
>   	for (i = 0; i<  count; i++) {
>   		struct s3c24x0_i2c_bus *bus;
> @@ -516,7 +516,7 @@ void board_i2c_init(const void *blob)
>
>   		if (node<= 0)
>   			continue;
> -		bus =&i2c_bus[i];
> +		bus =&i2c_bus_data[i];
>   		bus->regs = (struct s3c24x0_i2c *)
>   			fdtdec_get_addr(blob, node, "reg");
>   		bus->id = pinmux_decode_periph_id(blob, node);
> @@ -529,7 +529,7 @@ void board_i2c_init(const void *blob)
>   static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
>   {
>   	if (bus_idx<  i2c_busses)
> -		return&i2c_bus[bus_idx];
> +		return&i2c_bus_data[bus_idx];
>
>   	debug("Undefined bus: %d\n", bus_idx);
>   	return NULL;
> @@ -540,7 +540,7 @@ int i2c_get_bus_num_fdt(int node)
>   	int i;
>
>   	for (i = 0; i<  i2c_busses; i++) {
> -		if (node == i2c_bus[i].node)
> +		if (node == i2c_bus_data[i].node)
>   			return i;
>   	}
>
> diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
> index 2b93a45..e6a2cd0 100644
> --- a/include/configs/exynos5250-dt.h
> +++ b/include/configs/exynos5250-dt.h
> @@ -254,8 +254,9 @@
>   #define CONFIG_SYS_I2C_SPEED	100000		/* 100 Kbps */
>   #define CONFIG_DRIVER_S3C24X0_I2C
>   #define CONFIG_I2C_MULTI_BUS

no longer needed, if you use the new framework ...

> -#define CONFIG_MAX_I2C_NUM	8
>   #define CONFIG_SYS_I2C_SLAVE    0x0
> +#define CONFIG_SYS_I2C_MAX_HOPS 1

you do not need the CONFIG_SYS_I2C_MAX_HOPS define, this define is
only needed, if using muxes and using the new framework ...

> +#define CONFIG_SYS_NUM_I2C_BUSES 8

no longer needed if you use the new framework ...

>   #define CONFIG_I2C_EDID
>
>   /* PMIC */

I prefer to switch to the new framework, such it is done for the
tegra driver, see commit:

http://git.denx.de/?p=u-boot.git;a=commitdiff;h=1f2ba722ac06393d6abe6d4734824d3b98ea9108

maybe a fix like this is for you also necessary, as you use fdt:

http://git.denx.de/?p=u-boot.git;a=commitdiff;h=cdce889959c611876690a9f0a3c7ed9aa46189c4

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2013-09-03  7:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03  6:20 [U-Boot] [PATCH] Exynos5250: I2C: Fix driver as per new I2C multibus/multiadapter support Rajeshwari S Shinde
2013-09-03  7:01 ` Heiko Schocher [this message]
2013-09-03  9:54   ` Rajeshwari Birje

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=5225893D.6070900@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.