Ł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 | |
Piotr Wilczek | ecda331 | 2013-09-20 15:01:26 +0200 | [diff] [blame] | 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 | |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 19 | /* Handle multiple I2C buses instances */ |
| 20 | int get_multi_scl_pin(void) |
| 21 | { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 22 | unsigned int bus = i2c_get_bus_num(); |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 23 | |
| 24 | switch (bus) { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 25 | case I2C_0: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 26 | return CONFIG_SOFT_I2C_I2C5_SCL; |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 27 | case I2C_1: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 28 | return CONFIG_SOFT_I2C_I2C9_SCL; |
Piotr Wilczek | ecda331 | 2013-09-20 15:01:26 +0200 | [diff] [blame] | 29 | case I2C_2: |
| 30 | return CONFIG_SOFT_I2C_I2C10_SCL; |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 31 | default: |
| 32 | printf("I2C_%d not supported!\n", bus); |
| 33 | }; |
| 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | int get_multi_sda_pin(void) |
| 39 | { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 40 | unsigned int bus = i2c_get_bus_num(); |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 41 | |
| 42 | switch (bus) { |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 43 | case I2C_0: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 44 | return CONFIG_SOFT_I2C_I2C5_SDA; |
Łukasz Majewski | 2936df1 | 2013-08-16 15:33:33 +0200 | [diff] [blame] | 45 | case I2C_1: |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 46 | return CONFIG_SOFT_I2C_I2C9_SDA; |
Piotr Wilczek | ecda331 | 2013-09-20 15:01:26 +0200 | [diff] [blame] | 47 | case I2C_2: |
| 48 | return CONFIG_SOFT_I2C_I2C10_SDA; |
Łukasz Majewski | 7ca8f73 | 2012-09-04 23:15:20 +0000 | [diff] [blame] | 49 | default: |
| 50 | printf("I2C_%d not supported!\n", bus); |
| 51 | }; |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | int multi_i2c_init(void) |
| 57 | { |
| 58 | return 0; |
| 59 | } |