~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/board/samsung/common/multi_i2c.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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 */
 
20
int 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
 
 
38
int 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
 
 
56
int multi_i2c_init(void)
 
57
{
 
58
        return 0;
 
59
}