blob: 71c32c0b6ebcb90b2afe065362aa323b632959ca [file] [log] [blame]
Łukasz Majewskib2d76522012-09-04 23:15:20 +00001/*
2 * Copyright (C) 2012 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Łukasz Majewskib2d76522012-09-04 23:15:20 +00006 */
7
8#include <common.h>
9#include <i2c.h>
10
Piotr Wilczekc2dd3252013-09-20 15:01:26 +020011#ifndef CONFIG_SOFT_I2C_I2C10_SCL
12#define CONFIG_SOFT_I2C_I2C10_SCL 0
13#endif
14
15#ifndef CONFIG_SOFT_I2C_I2C10_SDA
16#define CONFIG_SOFT_I2C_I2C10_SDA 0
17#endif
18
Łukasz Majewskib2d76522012-09-04 23:15:20 +000019/* Handle multiple I2C buses instances */
20int get_multi_scl_pin(void)
21{
Łukasz Majewskide55e752013-08-16 15:33:33 +020022 unsigned int bus = i2c_get_bus_num();
Łukasz Majewskib2d76522012-09-04 23:15:20 +000023
24 switch (bus) {
Łukasz Majewskide55e752013-08-16 15:33:33 +020025 case I2C_0:
Łukasz Majewskib2d76522012-09-04 23:15:20 +000026 return CONFIG_SOFT_I2C_I2C5_SCL;
Łukasz Majewskide55e752013-08-16 15:33:33 +020027 case I2C_1:
Łukasz Majewskib2d76522012-09-04 23:15:20 +000028 return CONFIG_SOFT_I2C_I2C9_SCL;
Piotr Wilczekc2dd3252013-09-20 15:01:26 +020029 case I2C_2:
30 return CONFIG_SOFT_I2C_I2C10_SCL;
Łukasz Majewskib2d76522012-09-04 23:15:20 +000031 default:
32 printf("I2C_%d not supported!\n", bus);
33 };
34
35 return 0;
36}
37
38int get_multi_sda_pin(void)
39{
Łukasz Majewskide55e752013-08-16 15:33:33 +020040 unsigned int bus = i2c_get_bus_num();
Łukasz Majewskib2d76522012-09-04 23:15:20 +000041
42 switch (bus) {
Łukasz Majewskide55e752013-08-16 15:33:33 +020043 case I2C_0:
Łukasz Majewskib2d76522012-09-04 23:15:20 +000044 return CONFIG_SOFT_I2C_I2C5_SDA;
Łukasz Majewskide55e752013-08-16 15:33:33 +020045 case I2C_1:
Łukasz Majewskib2d76522012-09-04 23:15:20 +000046 return CONFIG_SOFT_I2C_I2C9_SDA;
Piotr Wilczekc2dd3252013-09-20 15:01:26 +020047 case I2C_2:
48 return CONFIG_SOFT_I2C_I2C10_SDA;
Łukasz Majewskib2d76522012-09-04 23:15:20 +000049 default:
50 printf("I2C_%d not supported!\n", bus);
51 };
52
53 return 0;
54}
55
56int multi_i2c_init(void)
57{
58 return 0;
59}