blob: 71c32c0b6ebcb90b2afe065362aa323b632959ca [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2 * Copyright (C) 2012 Samsung Electronics
3 * Lukasz Majewski <l.majewski@samsung.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
9#include <i2c.h>
10
11#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
19/* Handle multiple I2C buses instances */
20int get_multi_scl_pin(void)
21{
22 unsigned int bus = i2c_get_bus_num();
23
24 switch (bus) {
25 case I2C_0:
26 return CONFIG_SOFT_I2C_I2C5_SCL;
27 case I2C_1:
28 return CONFIG_SOFT_I2C_I2C9_SCL;
29 case I2C_2:
30 return CONFIG_SOFT_I2C_I2C10_SCL;
31 default:
32 printf("I2C_%d not supported!\n", bus);
33 };
34
35 return 0;
36}
37
38int get_multi_sda_pin(void)
39{
40 unsigned int bus = i2c_get_bus_num();
41
42 switch (bus) {
43 case I2C_0:
44 return CONFIG_SOFT_I2C_I2C5_SDA;
45 case I2C_1:
46 return CONFIG_SOFT_I2C_I2C9_SDA;
47 case I2C_2:
48 return CONFIG_SOFT_I2C_I2C10_SDA;
49 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}