public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..)
@ 2015-06-03  9:33 Christian Gmeiner
  2015-06-03  9:33 ` [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c() Christian Gmeiner
  2015-06-08  6:50 ` [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Stefano Babic
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Gmeiner @ 2015-06-03  9:33 UTC (permalink / raw)
  To: u-boot

Make it possible to use the i2c bus in SPL.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 board/bachmann/ot1200/ot1200.c | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index e434ed9..a33d496 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -120,6 +120,27 @@ static void setup_iomux_features(void)
 		ARRAY_SIZE(feature_pads));
 }
 
+#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
+
+/* I2C3 - IO expander  */
+static struct i2c_pads_info i2c_pad_info2 = {
+	.scl = {
+		.i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
+		.gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
+		.gp = IMX_GPIO_NR(3, 17)
+	},
+	.sda = {
+		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
+		.gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
+		.gp = IMX_GPIO_NR(3, 18)
+	}
+};
+
+static void setup_iomux_i2c(void)
+{
+	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
+}
+
 static void ccgr_init(void)
 {
 	struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
@@ -151,6 +172,7 @@ int board_early_init_f(void)
 
 	setup_iomux_uart();
 	setup_iomux_spi();
+	setup_iomux_i2c();
 	setup_iomux_features();
 
 	return 0;
@@ -236,22 +258,6 @@ int board_mmc_init(bd_t *bis)
 	return 0;
 }
 
-#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
-
-/* I2C3 - IO expander  */
-static struct i2c_pads_info i2c_pad_info2 = {
-	.scl = {
-		.i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
-		.gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
-		.gp = IMX_GPIO_NR(3, 17)
-	},
-	.sda = {
-		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
-		.gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
-		.gp = IMX_GPIO_NR(3, 18)
-	}
-};
-
 static iomux_v3_cfg_t const pwm_pad[] = {
 	MX6_PAD_SD1_CMD__PWM4_OUT | MUX_PAD_CTRL(OUTPUT_40OHM),
 };
@@ -315,8 +321,6 @@ int board_init(void)
 
 	backlight_lcd_off();
 
-	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
-
 	leds_on();
 
 #ifdef CONFIG_CMD_SATA
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c()
  2015-06-03  9:33 [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Christian Gmeiner
@ 2015-06-03  9:33 ` Christian Gmeiner
  2015-06-08  6:50   ` Stefano Babic
  2015-06-08  6:50 ` [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Stefano Babic
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Gmeiner @ 2015-06-03  9:33 UTC (permalink / raw)
  To: u-boot

On this bus there is a EEPROM containing EDID and ddr3
calibration information.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 board/bachmann/ot1200/ot1200.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index a33d496..2237b7a 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -122,6 +122,20 @@ static void setup_iomux_features(void)
 
 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
 
+/* I2C2 - EEPROM */
+static struct i2c_pads_info i2c_pad_info1 = {
+	.scl = {
+		.i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
+		.gpio_mode = MX6_PAD_EIM_EB2__GPIO2_IO30 | PC,
+		.gp = IMX_GPIO_NR(2, 30)
+	},
+	.sda = {
+		.i2c_mode = MX6_PAD_EIM_D16__I2C2_SDA | PC,
+		.gpio_mode = MX6_PAD_EIM_D16__GPIO3_IO16 | PC,
+		.gp = IMX_GPIO_NR(3, 16)
+	}
+};
+
 /* I2C3 - IO expander  */
 static struct i2c_pads_info i2c_pad_info2 = {
 	.scl = {
@@ -138,6 +152,7 @@ static struct i2c_pads_info i2c_pad_info2 = {
 
 static void setup_iomux_i2c(void)
 {
+	setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
 	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
 }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..)
  2015-06-03  9:33 [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Christian Gmeiner
  2015-06-03  9:33 ` [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c() Christian Gmeiner
@ 2015-06-08  6:50 ` Stefano Babic
  1 sibling, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2015-06-08  6:50 UTC (permalink / raw)
  To: u-boot

On 03/06/2015 11:33, Christian Gmeiner wrote:
> Make it possible to use the i2c bus in SPL.
> 
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  board/bachmann/ot1200/ot1200.c | 40 ++++++++++++++++++++++------------------
>  1 file changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
> index e434ed9..a33d496 100644
> --- a/board/bachmann/ot1200/ot1200.c
> +++ b/board/bachmann/ot1200/ot1200.c
> @@ -120,6 +120,27 @@ static void setup_iomux_features(void)
>  		ARRAY_SIZE(feature_pads));
>  }
>  
> +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
> +
> +/* I2C3 - IO expander  */
> +static struct i2c_pads_info i2c_pad_info2 = {
> +	.scl = {
> +		.i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
> +		.gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
> +		.gp = IMX_GPIO_NR(3, 17)
> +	},
> +	.sda = {
> +		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
> +		.gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
> +		.gp = IMX_GPIO_NR(3, 18)
> +	}
> +};
> +
> +static void setup_iomux_i2c(void)
> +{
> +	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
> +}
> +
>  static void ccgr_init(void)
>  {
>  	struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
> @@ -151,6 +172,7 @@ int board_early_init_f(void)
>  
>  	setup_iomux_uart();
>  	setup_iomux_spi();
> +	setup_iomux_i2c();
>  	setup_iomux_features();
>  
>  	return 0;
> @@ -236,22 +258,6 @@ int board_mmc_init(bd_t *bis)
>  	return 0;
>  }
>  
> -#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
> -
> -/* I2C3 - IO expander  */
> -static struct i2c_pads_info i2c_pad_info2 = {
> -	.scl = {
> -		.i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
> -		.gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
> -		.gp = IMX_GPIO_NR(3, 17)
> -	},
> -	.sda = {
> -		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
> -		.gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
> -		.gp = IMX_GPIO_NR(3, 18)
> -	}
> -};
> -
>  static iomux_v3_cfg_t const pwm_pad[] = {
>  	MX6_PAD_SD1_CMD__PWM4_OUT | MUX_PAD_CTRL(OUTPUT_40OHM),
>  };
> @@ -315,8 +321,6 @@ int board_init(void)
>  
>  	backlight_lcd_off();
>  
> -	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
> -
>  	leds_on();
>  
>  #ifdef CONFIG_CMD_SATA
> 
Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c()
  2015-06-03  9:33 ` [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c() Christian Gmeiner
@ 2015-06-08  6:50   ` Stefano Babic
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2015-06-08  6:50 UTC (permalink / raw)
  To: u-boot

On 03/06/2015 11:33, Christian Gmeiner wrote:
> On this bus there is a EEPROM containing EDID and ddr3
> calibration information.
> 
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
>  board/bachmann/ot1200/ot1200.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
> index a33d496..2237b7a 100644
> --- a/board/bachmann/ot1200/ot1200.c
> +++ b/board/bachmann/ot1200/ot1200.c
> @@ -122,6 +122,20 @@ static void setup_iomux_features(void)
>  
>  #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
>  
> +/* I2C2 - EEPROM */
> +static struct i2c_pads_info i2c_pad_info1 = {
> +	.scl = {
> +		.i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC,
> +		.gpio_mode = MX6_PAD_EIM_EB2__GPIO2_IO30 | PC,
> +		.gp = IMX_GPIO_NR(2, 30)
> +	},
> +	.sda = {
> +		.i2c_mode = MX6_PAD_EIM_D16__I2C2_SDA | PC,
> +		.gpio_mode = MX6_PAD_EIM_D16__GPIO3_IO16 | PC,
> +		.gp = IMX_GPIO_NR(3, 16)
> +	}
> +};
> +
>  /* I2C3 - IO expander  */
>  static struct i2c_pads_info i2c_pad_info2 = {
>  	.scl = {
> @@ -138,6 +152,7 @@ static struct i2c_pads_info i2c_pad_info2 = {
>  
>  static void setup_iomux_i2c(void)
>  {
> +	setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
>  	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
>  }
>  
> 
Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-08  6:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03  9:33 [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Christian Gmeiner
2015-06-03  9:33 ` [U-Boot] [PATCH 2/2] ot1200: setup i2c bus 1 in setup_iomux_i2c() Christian Gmeiner
2015-06-08  6:50   ` Stefano Babic
2015-06-08  6:50 ` [U-Boot] [PATCH 1/2] ot1200: setup i2c bus in board_early_init_f(..) Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox