Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung Electronics |
| 3 | * Lukasz Majewski <l.majewski@samsung.com> |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <i2c.h> |
| 10 | |
| 11 | /* Handle multiple I2C buses instances */ |
| 12 | int get_multi_scl_pin(void) |
| 13 | { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 14 | unsigned int bus = i2c_get_bus_num(); |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 15 | |
| 16 | switch (bus) { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 17 | case I2C_0: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 18 | return CONFIG_SOFT_I2C_I2C5_SCL; |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 19 | case I2C_1: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 20 | return CONFIG_SOFT_I2C_I2C9_SCL; |
| 21 | default: |
| 22 | printf("I2C_%d not supported!\n", bus); |
| 23 | }; |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | int get_multi_sda_pin(void) |
| 29 | { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 30 | unsigned int bus = i2c_get_bus_num(); |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 31 | |
| 32 | switch (bus) { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 33 | case I2C_0: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 34 | return CONFIG_SOFT_I2C_I2C5_SDA; |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame^] | 35 | case I2C_1: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 36 | return CONFIG_SOFT_I2C_I2C9_SDA; |
| 37 | default: |
| 38 | printf("I2C_%d not supported!\n", bus); |
| 39 | }; |
| 40 | |
| 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | int multi_i2c_init(void) |
| 45 | { |
| 46 | return 0; |
| 47 | } |