summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>2013-10-11 16:23:54 +0900
committerHeiko Schocher <hs@denx.de>2013-10-17 07:20:25 +0200
commitb55b8eef35f9ca04cf790381bab14510278b08a4 (patch)
treea47147f5aa69f7e62a155640c25d6b75f990956f /drivers/i2c
parent13c2433ccb4d9a5efb95ad953c2b3a0eb1909988 (diff)
downloadu-boot-imx-b55b8eef35f9ca04cf790381bab14510278b08a4.zip
u-boot-imx-b55b8eef35f9ca04cf790381bab14510278b08a4.tar.gz
u-boot-imx-b55b8eef35f9ca04cf790381bab14510278b08a4.tar.bz2
i2c: sh_i2c: Avoid using I2C prior to relocation
If user uses the I2C in before the relocation, board of sh and rmobile will not start. This will solve this problem. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/sh_i2c.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c
index 58f8bf1..808202c 100644
--- a/drivers/i2c/sh_i2c.c
+++ b/drivers/i2c/sh_i2c.c
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2011 Renesas Solutions Corp.
- * Copyright (C) 2011 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+ * Copyright (C) 2011, 2013 Renesas Solutions Corp.
+ * Copyright (C) 2011, 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -8,6 +8,8 @@
#include <common.h>
#include <asm/io.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* Every register is 32bit aligned, but only 8bits in size */
#define ureg(name) u8 name; u8 __pad_##name##0; u16 __pad_##name##1;
struct sh_i2c {
@@ -240,6 +242,10 @@ void i2c_init(int speed, int slaveaddr)
{
int num, denom, tmp;
+ /* No i2c support prior to relocation */
+ if (!(gd->flags & GD_FLG_RELOC))
+ return;
+
#ifdef CONFIG_I2C_MULTI_BUS
current_bus = 0;
#endif