mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-21 02:33:07 +00:00
2147a16983
Use CONFIG_IS_ENABLED() macro, which provides more convenient way to check $(SPL)DM_I2C/$(SPL)DM_I2C_GPIO configs for both SPL and U-Boot proper. CONFIG_IS_ENABLED(DM_I2C) expands to: - 1 if CONFIG_SPL_BUILD is undefined and CONFIG_DM_I2C is set to 'y', - 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_DM_I2C is set to 'y', - 0 otherwise. All occurences were replaced automatically using these bash cmds: $ find . -type f -exec sed -i 's/ifndef CONFIG_DM_I2C/if !CONFIG_IS_ENABLED(DM_I2C)/g' {} + $ find . -type f -exec sed -i 's/ifdef CONFIG_DM_I2C/if CONFIG_IS_ENABLED(DM_I2C)/g' {} + $ find . -type f -exec sed -i 's/defined(CONFIG_DM_I2C)/CONFIG_IS_ENABLED(DM_I2C)/g' {} + $ find . -type f -exec sed -i 's/ifndef CONFIG_DM_I2C_GPIO/if !CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} + $ find . -type f -exec sed -i 's/ifdef CONFIG_DM_I2C_GPIO/if CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} + $ find . -type f -exec sed -i 's/defined(CONFIG_DM_I2C_GPIO)/CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} + Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
81 lines
1.8 KiB
C
81 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Freescale I2C Controller
|
|
*
|
|
* Copyright 2006 Freescale Semiconductor, Inc.
|
|
*
|
|
* Based on earlier versions by Gleb Natapov <gnatapov@mrv.com>,
|
|
* Xianghua Xiao <x.xiao@motorola.com>, Eran Liberty (liberty@freescale.com),
|
|
* and Jeff Brown.
|
|
* Some bits are taken from linux driver writen by adrian@humboldt.co.uk.
|
|
*/
|
|
|
|
#ifndef _ASM_FSL_I2C_H_
|
|
#define _ASM_FSL_I2C_H_
|
|
|
|
#include <asm/types.h>
|
|
#include <linux/compiler.h>
|
|
|
|
typedef struct fsl_i2c_base {
|
|
|
|
u8 adr; /* I2C slave address */
|
|
u8 res0[3];
|
|
#define I2C_ADR 0xFE
|
|
#define I2C_ADR_SHIFT 1
|
|
#define I2C_ADR_RES ~(I2C_ADR)
|
|
|
|
u8 fdr; /* I2C frequency divider register */
|
|
u8 res1[3];
|
|
#define IC2_FDR 0x3F
|
|
#define IC2_FDR_SHIFT 0
|
|
#define IC2_FDR_RES ~(IC2_FDR)
|
|
|
|
u8 cr; /* I2C control redister */
|
|
u8 res2[3];
|
|
#define I2C_CR_MEN 0x80
|
|
#define I2C_CR_MIEN 0x40
|
|
#define I2C_CR_MSTA 0x20
|
|
#define I2C_CR_MTX 0x10
|
|
#define I2C_CR_TXAK 0x08
|
|
#define I2C_CR_RSTA 0x04
|
|
#define I2C_CR_BIT6 0x02 /* required for workaround A004447 */
|
|
#define I2C_CR_BCST 0x01
|
|
|
|
u8 sr; /* I2C status register */
|
|
u8 res3[3];
|
|
#define I2C_SR_MCF 0x80
|
|
#define I2C_SR_MAAS 0x40
|
|
#define I2C_SR_MBB 0x20
|
|
#define I2C_SR_MAL 0x10
|
|
#define I2C_SR_BCSTM 0x08
|
|
#define I2C_SR_SRW 0x04
|
|
#define I2C_SR_MIF 0x02
|
|
#define I2C_SR_RXAK 0x01
|
|
|
|
u8 dr; /* I2C data register */
|
|
u8 res4[3];
|
|
#define I2C_DR 0xFF
|
|
#define I2C_DR_SHIFT 0
|
|
#define I2C_DR_RES ~(I2C_DR)
|
|
|
|
u8 dfsrr; /* I2C digital filter sampling rate register */
|
|
u8 res5[3];
|
|
#define I2C_DFSRR 0x3F
|
|
#define I2C_DFSRR_SHIFT 0
|
|
#define I2C_DFSRR_RES ~(I2C_DR)
|
|
|
|
/* Fill out the reserved block */
|
|
u8 res6[0xE8];
|
|
} fsl_i2c_t;
|
|
|
|
#if CONFIG_IS_ENABLED(DM_I2C)
|
|
struct fsl_i2c_dev {
|
|
struct fsl_i2c_base __iomem *base; /* register base */
|
|
u32 i2c_clk;
|
|
u32 index;
|
|
u8 slaveadd;
|
|
uint speed;
|
|
};
|
|
#endif
|
|
|
|
#endif /* _ASM_I2C_H_ */
|