u-boot/board/freescale/common/i2c_common.h
Stephen Carlson 15347d2dea board: freescale: Refactor NXP common mux code
Refactors similar mux code from multiple NXP boards into a common location,
and allows it to be disabled in config.

New config: CONFIG_FSL_USE_PCA9547_MUX to enable PCA9547 mux functionality.

Signed-off-by: Stephen Carlson <stcarlso@linux.microsoft.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-07-20 14:18:04 +05:30

30 lines
840 B
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2014 Freescale Semiconductor, Inc.
* Copyright 2020-21 NXP
* Copyright 2021 Microsoft Corporation
*/
#ifndef __NXP_I2C_COMMON_H__
#define __NXP_I2C_COMMON_H__
/* Common functionality shared by the I2C drivers for VID and the mux. */
#ifdef CONFIG_DM_I2C
#define DEVICE_HANDLE_T struct udevice *
#define I2C_READ(dev, register, data, length) \
dm_i2c_read(dev, register, data, length)
#define I2C_WRITE(dev, register, data, length) \
dm_i2c_write(dev, register, data, length)
#else
#define DEVICE_HANDLE_T int
#define I2C_READ(dev, register, data, length) \
i2c_read(dev, register, 1, data, length)
#define I2C_WRITE(dev, register, data, length) \
i2c_write(dev, register, 1, data, length)
#endif
int fsl_i2c_get_device(int address, int bus, DEVICE_HANDLE_T *dev);
#endif