Make checkpatch-clean
Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Eran Man <eran@nbase.co.il>
i2c_init(int speed, int slaveaddr)
{
unsigned int n, m, freq, margin, power;
i2c_init(int speed, int slaveaddr)
{
unsigned int n, m, freq, margin, power;
- unsigned int actualFreq, actualN=0, actualM=0;
+ unsigned int actualFreq, actualN = 0, actualM = 0;
unsigned int control, status;
unsigned int minMargin = 0xffffffff;
unsigned int tclk = 125000000;
DP(puts("i2c_init\n"));
unsigned int control, status;
unsigned int minMargin = 0xffffffff;
unsigned int tclk = 125000000;
DP(puts("i2c_init\n"));
- for(n = 0 ; n < 8 ; n++)
- {
- for(m = 0 ; m < 16 ; m++)
- {
+ for (n = 0 ; n < 8 ; n++) {
+ for (m = 0 ; m < 16 ; m++) {
power = 2<<n; /* power = 2^(n+1) */
freq = tclk/(10*(m+1)*power);
if (speed > freq)
margin = speed - freq;
else
margin = freq - speed;
power = 2<<n; /* power = 2^(n+1) */
freq = tclk/(10*(m+1)*power);
if (speed > freq)
margin = speed - freq;
else
margin = freq - speed;
- if(margin < minMargin)
- {
+ if (margin < minMargin) {
minMargin = margin;
actualFreq = freq;
actualN = n;
minMargin = margin;
actualFreq = freq;
actualN = n;
udelay(I2C_DELAY);
if (count > 20) {
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
udelay(I2C_DELAY);
if (count > 20) {
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
/* Output slave address */
/* Output slave address */
data = (dev_addr << 1);
/* set the read bit */
data = (dev_addr << 1);
/* set the read bit */
udelay(I2C_DELAY);
if (count > 20) {
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
udelay(I2C_DELAY);
if (count > 20) {
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
if (bits == 10) {
printf("10 bit I2C addressing not yet implemented\n");
if (bits == 10) {
printf("10 bit I2C addressing not yet implemented\n");
-i2c_get_data(uchar* return_data, int len) {
+i2c_get_data(uchar *return_data, int len) {
unsigned int data, status = 0;
int count = 0;
unsigned int data, status = 0;
int count = 0;
count++;
while ((status & 0xff) != 0x50) {
udelay(I2C_DELAY);
count++;
while ((status & 0xff) != 0x50) {
udelay(I2C_DELAY);
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
return 0;
}
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
return 0;
}
RESET_REG_BITS(I2C_CONTROL, BIT2|BIT3);
while ((status & 0xff) != 0x58) {
udelay(I2C_DELAY);
RESET_REG_BITS(I2C_CONTROL, BIT2|BIT3);
while ((status & 0xff) != 0x58) {
udelay(I2C_DELAY);
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /* stop */
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /* stop */
count++;
while ((status & 0xff) != 0x28) {
udelay(I2C_DELAY);
count++;
while ((status & 0xff) != 0x28) {
udelay(I2C_DELAY);
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
GT_REG_WRITE(I2C_CONTROL, (0x1 << 4)); /*stop*/
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
}
GT_REG_READ(I2C_STATUS_BAUDE_RATE, &status);
count++;
-i2c_read(uchar dev_addr, unsigned int offset, int len, uchar* data,
+i2c_read(uchar dev_addr, unsigned int offset, int len, uchar *data,
int ten_bit)
{
uchar status = 0;
int ten_bit)
{
uchar status = 0;
status = i2c_start();
if (status) {
status = i2c_start();
if (status) {