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 3/3] WIP: tegra: i2c: Enable new I2C framework
Date: Tue, 17 Jan 2012 09:51:24 +0100	[thread overview]
Message-ID: <4F15368C.8010701@denx.de> (raw)
In-Reply-To: <1326784345-19953-4-git-send-email-sjg@chromium.org>

Hello Simon,

Simon Glass wrote:
> This is just a rough patch to show how this might be done.
> 
> Not to be applied, please.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>  drivers/i2c/tegra2_i2c.c   |   53 +++++++++++++++++++------------------------
>  include/configs/seaboard.h |    2 +
>  2 files changed, 25 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/tegra2_i2c.c b/drivers/i2c/tegra2_i2c.c
> index b42d9ac..93f3269 100644
> --- a/drivers/i2c/tegra2_i2c.c
> +++ b/drivers/i2c/tegra2_i2c.c
> @@ -30,7 +30,9 @@
>  #include <asm/arch/gpio.h>
>  #include <asm/arch/pinmux.h>
>  #include <asm/arch/tegra2_i2c.h>
> +
>  #include <fdtdec.h>
> +#include <i2c.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -296,12 +298,7 @@ static int tegra2_i2c_read_data(u32 addr, u8 *data, u32 len)
>  #error "Please enable device tree support to use this driver"
>  #endif
>  
> -unsigned int i2c_get_bus_speed(void)
> -{
> -	return i2c_controllers[i2c_bus_num].speed;
> -}
> -
> -int i2c_set_bus_speed(unsigned int speed)
> +uint tegra_i2c_set_bus_speed(unsigned int speed)

static

>  {
>  	struct i2c_bus *i2c_bus;
>  
> @@ -309,7 +306,7 @@ int i2c_set_bus_speed(unsigned int speed)
>  	i2c_bus->speed = speed;
>  	i2c_init_controller(i2c_bus);
>  
> -	return 0;
> +	return 0;	/* TODO: return actual speed */
>  }
>  
>  static int i2c_get_config(const void *blob, int node, struct i2c_bus *i2c_bus)
> @@ -404,7 +401,7 @@ int i2c_init_board(void)
>  	return 0;
>  }
>  
> -void i2c_init(int speed, int slaveaddr)
> +void tegra_i2c_init(int speed, int slaveaddr)

static, add this for all functions

[...]
> diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
> index d2d0115..64c804a 100644
> --- a/include/configs/seaboard.h
> +++ b/include/configs/seaboard.h
> @@ -79,6 +79,8 @@
>  #define CONFIG_SYS_MAX_I2C_BUS		4

This define is no longer valid if using the new framework.
Do you have really 4 busses with only one i2c adapter?

This works only, if you have i2c muxes! In this case you have to
define

/*
 * how many muxes are maximal consecutively connected on
 * one i2c bus
 */
#define CONFIG_SYS_I2C_MAX_HOPS	1

and for example using a PCA9547 mux:

#define CONFIG_SYS_I2C_BUSSES   {       {0, {I2C_NULL_HOP}}, \
                                        {0, {{I2C_MUX_PCA9547, 0x70, 1}}}, \
                                        {0, {{I2C_MUX_PCA9547, 0x70, 2}}}, \
                                        {0, {{I2C_MUX_PCA9547, 0x70, 3}}},
				}

or you use other i2c adapters like soft_i2c, but I could not see
this in your patch ... and in this case you must define
CONFIG_SYS_NUM_I2C_ADAPTERS ...

>  #define CONFIG_SYS_I2C_SPEED		100000

should not longer be defined, instead you should make a option to define
a i2c speed for your i2c driver ... for example
#define CONFIG_SYS_I2C_TEGRA2_SPEED	100000

>  #define CONFIG_CMD_I2C
> +#define CONFIG_SYS_I2C
> +#define CONFIG_SYS_I2C_ADAPTERS		{&tegra_i2c_adap}

You must have a define in drivers/i2c/Makefile which "activates" your
drivers/i2c/tegra2_i2c.c ... this must defined in your board config
file too (maybe a CONFIG_SYS_I2C_TEGRA2 ?)!

Also you must have a change in drivers/i2c/i2c_core.c

#ifdef CONFIG_SYS_I2C_TEGRA2
extern struct i2c_adap       tegra_i2c_adap[];
#endif

or?

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

  reply	other threads:[~2012-01-17  8:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17  7:12 [U-Boot] [PATCH 0/3] Bring in new I2C framework Simon Glass
2012-01-17  7:12 ` [U-Boot] [PATCH 1/3] i2c: add i2c_core and prepare for new multibus support Simon Glass
2012-01-17 19:23   ` Mike Frysinger
2012-01-18 20:11   ` Tabi Timur-B04825
2012-01-18 20:41     ` Mike Frysinger
2012-01-18 20:43       ` Timur Tabi
2012-01-18 21:37     ` Simon Glass
2012-01-18 21:39       ` Timur Tabi
2012-01-18 22:21         ` Simon Glass
2012-01-18 22:24           ` Timur Tabi
2012-01-19  5:36       ` Wolfgang Denk
2012-01-19  6:35         ` Heiko Schocher
2012-01-19  6:53           ` Simon Glass
2012-01-19  7:53             ` Heiko Schocher
2012-01-19 18:07               ` Simon Glass
2012-01-19 11:20             ` Wolfgang Denk
2012-01-19 18:10               ` Simon Glass
2012-01-19 18:47               ` Timur Tabi
2012-01-20  6:50                 ` Heiko Schocher
2012-01-17  7:12 ` [U-Boot] [PATCH 2/3] i2c: common changes for multibus/multiadapter support Simon Glass
2012-01-17  7:12 ` [U-Boot] [PATCH 3/3] WIP: tegra: i2c: Enable new I2C framework Simon Glass
2012-01-17  8:51   ` Heiko Schocher [this message]
2012-01-17  8:30 ` [U-Boot] [PATCH 0/3] Bring in " Heiko Schocher

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=4F15368C.8010701@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.