mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
ppc4xx: Cleanup PPC4xx I2C infrastructure
This patch cleans up the PPC4xx I2C intrastructure: - Use C struct to describe the I2C registers instead of defines - Coding style cleanup (braces, whitespace, comments, line length) - Extract common code from i2c_read() and i2c_write() - Remove unneeded IIC defines from ppc405.h & ppc440.h Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* (C) Copyright 2007
|
||||
* (C) Copyright 2007-2009
|
||||
* Stefan Roese, DENX Software Engineering, sr@denx.de.
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
@@ -52,22 +52,26 @@
|
||||
#define I2C_BASE_ADDR (0xEF600500 + I2C_BUS_OFFS)
|
||||
#endif
|
||||
|
||||
#define I2C_REGISTERS_BASE_ADDRESS I2C_BASE_ADDR
|
||||
#define IIC_MDBUF (I2C_REGISTERS_BASE_ADDRESS+IICMDBUF)
|
||||
#define IIC_SDBUF (I2C_REGISTERS_BASE_ADDRESS+IICSDBUF)
|
||||
#define IIC_LMADR (I2C_REGISTERS_BASE_ADDRESS+IICLMADR)
|
||||
#define IIC_HMADR (I2C_REGISTERS_BASE_ADDRESS+IICHMADR)
|
||||
#define IIC_CNTL (I2C_REGISTERS_BASE_ADDRESS+IICCNTL)
|
||||
#define IIC_MDCNTL (I2C_REGISTERS_BASE_ADDRESS+IICMDCNTL)
|
||||
#define IIC_STS (I2C_REGISTERS_BASE_ADDRESS+IICSTS)
|
||||
#define IIC_EXTSTS (I2C_REGISTERS_BASE_ADDRESS+IICEXTSTS)
|
||||
#define IIC_LSADR (I2C_REGISTERS_BASE_ADDRESS+IICLSADR)
|
||||
#define IIC_HSADR (I2C_REGISTERS_BASE_ADDRESS+IICHSADR)
|
||||
#define IIC_CLKDIV (I2C_REGISTERS_BASE_ADDRESS+IIC0_CLKDIV)
|
||||
#define IIC_INTRMSK (I2C_REGISTERS_BASE_ADDRESS+IICINTRMSK)
|
||||
#define IIC_XFRCNT (I2C_REGISTERS_BASE_ADDRESS+IICXFRCNT)
|
||||
#define IIC_XTCNTLSS (I2C_REGISTERS_BASE_ADDRESS+IICXTCNTLSS)
|
||||
#define IIC_DIRECTCNTL (I2C_REGISTERS_BASE_ADDRESS+IICDIRECTCNTL)
|
||||
struct ppc4xx_i2c {
|
||||
u8 mdbuf;
|
||||
u8 res1;
|
||||
u8 sdbuf;
|
||||
u8 res2;
|
||||
u8 lmadr;
|
||||
u8 hmadr;
|
||||
u8 cntl;
|
||||
u8 mdcntl;
|
||||
u8 sts;
|
||||
u8 extsts;
|
||||
u8 lsadr;
|
||||
u8 hsadr;
|
||||
u8 clkdiv;
|
||||
u8 intrmsk;
|
||||
u8 xfrcnt;
|
||||
u8 xtcntlss;
|
||||
u8 directcntl;
|
||||
u8 intr;
|
||||
};
|
||||
|
||||
/* MDCNTL Register Bit definition */
|
||||
#define IIC_MDCNTL_HSCL 0x01
|
||||
|
||||
@@ -565,25 +565,6 @@
|
||||
#define MAL0_RCBS16 (MAL_DCR_BASE + 0x70) /* RX 16 Channel buffer size */
|
||||
#define MAL0_RCBS24 (MAL_DCR_BASE + 0x78) /* RX 24 Channel buffer size */
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
| IIC Register Offsets
|
||||
'----------------------------------------------------------------------------*/
|
||||
#define IICMDBUF 0x00
|
||||
#define IICSDBUF 0x02
|
||||
#define IICLMADR 0x04
|
||||
#define IICHMADR 0x05
|
||||
#define IICCNTL 0x06
|
||||
#define IICMDCNTL 0x07
|
||||
#define IICSTS 0x08
|
||||
#define IICEXTSTS 0x09
|
||||
#define IICLSADR 0x0A
|
||||
#define IICHSADR 0x0B
|
||||
#define IIC0_CLKDIV 0x0C
|
||||
#define IICINTRMSK 0x0D
|
||||
#define IICXFRCNT 0x0E
|
||||
#define IICXTCNTLSS 0x0F
|
||||
#define IICDIRECTCNTL 0x10
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
| UART Register Offsets
|
||||
'----------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1713,25 +1713,6 @@
|
||||
#define CPR0_PERD_PERDV0_MASK 0x07000000
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
| IIC Register Offsets
|
||||
'----------------------------------------------------------------------------*/
|
||||
#define IICMDBUF 0x00
|
||||
#define IICSDBUF 0x02
|
||||
#define IICLMADR 0x04
|
||||
#define IICHMADR 0x05
|
||||
#define IICCNTL 0x06
|
||||
#define IICMDCNTL 0x07
|
||||
#define IICSTS 0x08
|
||||
#define IICEXTSTS 0x09
|
||||
#define IICLSADR 0x0A
|
||||
#define IICHSADR 0x0B
|
||||
#define IIC0_CLKDIV 0x0C
|
||||
#define IICINTRMSK 0x0D
|
||||
#define IICXFRCNT 0x0E
|
||||
#define IICXTCNTLSS 0x0F
|
||||
#define IICDIRECTCNTL 0x10
|
||||
|
||||
/*-----------------------------------------------------------------------------
|
||||
| PCI Internal Registers et. al. (accessed via plb)
|
||||
+----------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user