2012-09-04 23:15:20 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Samsung Electronics
|
|
|
|
* Lukasz Majewski <l.majewski@samsung.com>
|
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2012-09-04 23:15:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <i2c.h>
|
|
|
|
|
2013-09-20 13:01:26 +00:00
|
|
|
#ifndef CONFIG_SOFT_I2C_I2C10_SCL
|
|
|
|
#define CONFIG_SOFT_I2C_I2C10_SCL 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef CONFIG_SOFT_I2C_I2C10_SDA
|
|
|
|
#define CONFIG_SOFT_I2C_I2C10_SDA 0
|
|
|
|
#endif
|
|
|
|
|
2012-09-04 23:15:20 +00:00
|
|
|
/* Handle multiple I2C buses instances */
|
|
|
|
int get_multi_scl_pin(void)
|
|
|
|
{
|
2013-08-16 13:33:33 +00:00
|
|
|
unsigned int bus = i2c_get_bus_num();
|
2012-09-04 23:15:20 +00:00
|
|
|
|
|
|
|
switch (bus) {
|
2013-08-16 13:33:33 +00:00
|
|
|
case I2C_0:
|
2012-09-04 23:15:20 +00:00
|
|
|
return CONFIG_SOFT_I2C_I2C5_SCL;
|
2013-08-16 13:33:33 +00:00
|
|
|
case I2C_1:
|
2012-09-04 23:15:20 +00:00
|
|
|
return CONFIG_SOFT_I2C_I2C9_SCL;
|
2013-09-20 13:01:26 +00:00
|
|
|
case I2C_2:
|
|
|
|
return CONFIG_SOFT_I2C_I2C10_SCL;
|
2012-09-04 23:15:20 +00:00
|
|
|
default:
|
|
|
|
printf("I2C_%d not supported!\n", bus);
|
|
|
|
};
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int get_multi_sda_pin(void)
|
|
|
|
{
|
2013-08-16 13:33:33 +00:00
|
|
|
unsigned int bus = i2c_get_bus_num();
|
2012-09-04 23:15:20 +00:00
|
|
|
|
|
|
|
switch (bus) {
|
2013-08-16 13:33:33 +00:00
|
|
|
case I2C_0:
|
2012-09-04 23:15:20 +00:00
|
|
|
return CONFIG_SOFT_I2C_I2C5_SDA;
|
2013-08-16 13:33:33 +00:00
|
|
|
case I2C_1:
|
2012-09-04 23:15:20 +00:00
|
|
|
return CONFIG_SOFT_I2C_I2C9_SDA;
|
2013-09-20 13:01:26 +00:00
|
|
|
case I2C_2:
|
|
|
|
return CONFIG_SOFT_I2C_I2C10_SDA;
|
2012-09-04 23:15:20 +00:00
|
|
|
default:
|
|
|
|
printf("I2C_%d not supported!\n", bus);
|
|
|
|
};
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int multi_i2c_init(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|