Stephen Carlson | e36d49c | 2021-06-22 16:35:20 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2014 Freescale Semiconductor, Inc. |
| 4 | * Copyright 2020-21 NXP |
| 5 | * Copyright 2021 Microsoft Corporation |
| 6 | */ |
| 7 | |
| 8 | #ifndef __NXP_I2C_COMMON_H__ |
| 9 | #define __NXP_I2C_COMMON_H__ |
| 10 | |
| 11 | /* Common functionality shared by the I2C drivers for VID and the mux. */ |
| 12 | #ifdef CONFIG_DM_I2C |
| 13 | #define DEVICE_HANDLE_T struct udevice * |
| 14 | |
| 15 | #define I2C_READ(dev, register, data, length) \ |
| 16 | dm_i2c_read(dev, register, data, length) |
| 17 | #define I2C_WRITE(dev, register, data, length) \ |
| 18 | dm_i2c_write(dev, register, data, length) |
| 19 | #else |
| 20 | #define DEVICE_HANDLE_T int |
| 21 | |
| 22 | #define I2C_READ(dev, register, data, length) \ |
| 23 | i2c_read(dev, register, 1, data, length) |
| 24 | #define I2C_WRITE(dev, register, data, length) \ |
| 25 | i2c_write(dev, register, 1, data, length) |
| 26 | #endif |
| 27 | |
| 28 | int fsl_i2c_get_device(int address, int bus, DEVICE_HANDLE_T *dev); |
| 29 | |
| 30 | #endif |