public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/6] WIP: arm: trats: add support for new I2C framework
Date: Fri, 16 Nov 2012 11:45:38 +0100	[thread overview]
Message-ID: <50A61952.2020903@denx.de> (raw)
In-Reply-To: <1352967325-26426-7-git-send-email-p.wilczek@samsung.com>

Hello Piotr,

On 15.11.2012 09:15, Piotr Wilczek wrote:
> This enables new i2c framework on Trats board.
> Hardware s3c24x0 i2c driver is used instead of software i2c.
>
> Signed-off-by: Piotr Wilczek<p.wilczek@samsung.com>
> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
> CC: Minkyu Kang<mk7.kang@samsung.com>
> ---
>   board/samsung/trats/trats.c |   26 +++++++++++++++++++++-----
>   include/configs/trats.h     |   16 ++++++++++++++--
>   2 files changed, 35 insertions(+), 7 deletions(-)
>
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index e11a892..71e1975 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -24,8 +24,10 @@
>    */
>
>   #include<common.h>
> +#include<i2c.h>
>   #include<lcd.h>
>   #include<asm/io.h>
> +#include<asm/arch/pinmux.h>
>   #include<asm/arch/cpu.h>
>   #include<asm/arch/gpio.h>
>   #include<asm/arch/mmc.h>
> @@ -61,6 +63,19 @@ static int hwrevision(int rev)
>
>   struct s3c_plat_otg_data s5pc210_otg_data;
>
> +void i2c_init_pinmux(void)
> +{
> +	int i, err;
> +	for (i = 0; i<  CONFIG_MAX_I2C_NUM; i++) {
> +		err = exynos_pinmux_config((PERIPH_ID_I2C0 + i),
> +						PINMUX_FLAG_NONE);
> +		if (err) {
> +			debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i));
> +			return;
> +		}
> +	}
> +}
> +

Is this change multibus specific? Why?

>   int board_init(void)
>   {
>   	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
> @@ -68,6 +83,8 @@ int board_init(void)
>   	check_hw_revision();
>   	printf("HW Revision:\t0x%x\n", board_rev);
>
> +	i2c_init_pinmux();
> +

Why this call not in i2c_init_board(void)?

>   #if defined(CONFIG_PMIC)
>   	pmic_init();
>   #endif
> @@ -77,14 +94,9 @@ int board_init(void)
>
>   void i2c_init_board(void)
>   {
> -	struct exynos4_gpio_part1 *gpio1 =
> -		(struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
>   	struct exynos4_gpio_part2 *gpio2 =
>   		(struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
>
> -	/* I2C_5 ->  PMIC */
> -	s5p_gpio_direction_output(&gpio1->b, 7, 1);
> -	s5p_gpio_direction_output(&gpio1->b, 6, 1);

Here again, what has this to do with the new multibus framework?

>   	/* I2C_9 ->  FG */
>   	s5p_gpio_direction_output(&gpio2->y4, 0, 1);
>   	s5p_gpio_direction_output(&gpio2->y4, 1, 1);
> @@ -415,6 +427,8 @@ static int lcd_power(void)
>   	int ret = 0;
>   	struct pmic *p = get_pmic();
>
> +	i2c_set_bus_num(0);
                         ^
                         Fix number? Please use here a define.

> +
>   	if (pmic_probe(p))
>   		return 0;
>
> @@ -475,6 +489,8 @@ static int mipi_power(void)
>   	int ret = 0;
>   	struct pmic *p = get_pmic();
>
> +	i2c_set_bus_num(0);
> +
>   	if (pmic_probe(p))
>   		return 0;
>
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 106fd37..54423f4 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -33,6 +33,7 @@
>   #define CONFIG_SAMSUNG		/* in a SAMSUNG core */
>   #define CONFIG_S5P		/* which is in a S5P Family */
>   #define CONFIG_EXYNOS4210	/* which is in a EXYNOS4210 */
> +#define CONFIG_EXYNOS4
>   #define CONFIG_TRATS		/* working with TRATS */
>   #define CONFIG_TIZEN		/* TIZEN lib */
>
> @@ -211,18 +212,29 @@
>   #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
>   #define CONFIG_SYS_CACHELINE_SIZE       32
>
> -
>   #define CONFIG_SYS_I2C
>   #define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
>   #define CONFIG_SYS_I2C_SOFT_SPEED	50000
>   #define CONFIG_SYS_I2C_SOFT_SLAVE	0xFE
> -#define CONFIG_SYS_I2C_ADAPTERS		{&soft_i2c_adap[0]}

Why you delete here this adapter? You can use now in the new
Framework Hard and soft i2c adapter ...

>   #define CONFIG_SOFT_I2C_READ_REPEATED_START
>   #define CONFIG_SYS_I2C_INIT_BOARD
>   #define CONFIG_I2C_MULTI_BUS
>   #define CONFIG_SOFT_I2C_MULTI_BUS
>   #define CONFIG_SYS_MAX_I2C_BUS	15
>
> +#define CONFIG_HARD_I2C

No longer needed

> +#define CONFIG_DRIVER_S3C24X0_I2C
> +#define CONFIG_MAX_I2C_NUM	8
> +#define CONFIG_SYS_I2C_SPEED	100000
> +#define CONFIG_SYS_I2C_SLAVE	0x0

This defines please rename, as posted in previous EMail ...

> +#define CONFIG_CMD_I2C
> +
> +#define CONFIG_SYS_I2C_ADAPTERS		{&s3c24x0_i2c_adap[5]}
> +#define CONFIG_SYS_NUM_I2C_ADAPTERS 1
> +#define CONFIG_SYS_I2C_BUSSES	{{0, {{{0, "S3C24X0"}, 0x00, 5}}}, \

You use here only one bus, so you do not need to define this here.

> +				}
> +#define CONFIG_SYS_NUM_I2C_BUSSES 1
> +
>   #include<asm/arch/gpio.h>
>
>   /* I2C PMIC */

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-11-16 10:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-15  8:15 [U-Boot] [PATCH 0/6] Bring new I2C framwork to Samsung Trats board Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 1/6] exynos:clock: Add i2c clock Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 2/6] exynos:cpu: Add Exynos4 I2C spacing Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 3/6] exynos:pinmux: Add pinmux support for i2c Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 4/6] drivers:i2c: Modify I2C driver for Exynos4 Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 5/6] WIP: i2c: s3c24x0: modify driver for new I2C framework Piotr Wilczek
2012-11-16 10:34   ` Heiko Schocher
2012-11-16 12:27     ` Piotr Wilczek
2012-11-15  8:15 ` [U-Boot] [PATCH 6/6] WIP: arm: trats: add support " Piotr Wilczek
2012-11-16 10:45   ` Heiko Schocher [this message]
2012-11-16 12:51     ` Piotr Wilczek
2012-11-20 12:19 ` [U-Boot] [PATCH v2 0/6] Bring new I2C framwork to Samsung Trats board Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 1/6] exynos:clock: Add i2c clock Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 2/6] exynos:cpu: Add Exynos4 I2C spacing Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 3/6] exynos:pinmux: Add pinmux support for i2c Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 4/6] drivers:i2c: Modify I2C driver for Exynos4 Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 5/6] drivers:i2c:s3c24x0: modify driver for new I2C framework Piotr Wilczek
2012-11-20 12:19   ` [U-Boot] [PATCH v2 6/6] arm:trats: add support " Piotr Wilczek

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=50A61952.2020903@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox