]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
i2c: fti2c010: cosmetic: coding style cleanup
authorKuo-Jung Su <dantesu@faraday-tech.com>
Mon, 2 Dec 2013 08:02:56 +0000 (16:02 +0800)
committerHeiko Schocher <hs@denx.de>
Thu, 5 Dec 2013 11:25:00 +0000 (12:25 +0100)
Coding style cleanup

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Cc: Heiko Schocher <hs@denx.de>
drivers/i2c/fti2c010.c

index ddeb941fafbc81b981b17006ab4848ce0c99b592..ec6afc973489d26320e6fb3348ca5399226406a9 100644 (file)
 #endif
 
 #ifndef CONFIG_SYS_I2C_SPEED
 #endif
 
 #ifndef CONFIG_SYS_I2C_SPEED
-#define CONFIG_SYS_I2C_SPEED    50000
+#define CONFIG_SYS_I2C_SPEED    5000
 #endif
 
 #endif
 
-#ifndef CONFIG_FTI2C010_FREQ
-#define CONFIG_FTI2C010_FREQ    clk_get_rate("I2C")
+#ifndef CONFIG_FTI2C010_CLOCK
+#define CONFIG_FTI2C010_CLOCK   clk_get_rate("I2C")
 #endif
 
 #endif
 
-/* command timeout */
-#define CFG_CMD_TIMEOUT         10 /* ms */
+#ifndef CONFIG_FTI2C010_TIMEOUT
+#define CONFIG_FTI2C010_TIMEOUT 10 /* ms */
+#endif
 
 
-/* 7-bit chip address + 1-bit read/write */
-#define I2C_RD(chip)            ((((chip) << 1) & 0xff) | 1)
-#define I2C_WR(chip)            (((chip) << 1) & 0xff)
+/* 7-bit dev address + 1-bit read/write */
+#define I2C_RD(dev)             ((((dev) << 1) & 0xfe) | 1)
+#define I2C_WR(dev)             (((dev) << 1) & 0xfe)
 
 struct fti2c010_chip {
 
 struct fti2c010_chip {
-       void __iomem *regs;
+       struct fti2c010_regs *regs;
        uint bus;
        uint speed;
 };
        uint bus;
        uint speed;
 };
@@ -41,25 +42,25 @@ struct fti2c010_chip {
 static struct fti2c010_chip chip_list[] = {
        {
                .bus  = 0,
 static struct fti2c010_chip chip_list[] = {
        {
                .bus  = 0,
-               .regs = (void __iomem *)CONFIG_FTI2C010_BASE,
+               .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE,
        },
 #ifdef CONFIG_I2C_MULTI_BUS
 # ifdef CONFIG_FTI2C010_BASE1
        {
                .bus  = 1,
        },
 #ifdef CONFIG_I2C_MULTI_BUS
 # ifdef CONFIG_FTI2C010_BASE1
        {
                .bus  = 1,
-               .regs = (void __iomem *)CONFIG_FTI2C010_BASE1,
+               .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE1,
        },
 # endif
 # ifdef CONFIG_FTI2C010_BASE2
        {
                .bus  = 2,
        },
 # endif
 # ifdef CONFIG_FTI2C010_BASE2
        {
                .bus  = 2,
-               .regs = (void __iomem *)CONFIG_FTI2C010_BASE2,
+               .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE2,
        },
 # endif
 # ifdef CONFIG_FTI2C010_BASE3
        {
                .bus  = 3,
        },
 # endif
 # ifdef CONFIG_FTI2C010_BASE3
        {
                .bus  = 3,
-               .regs = (void __iomem *)CONFIG_FTI2C010_BASE3,
+               .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE3,
        },
 # endif
 #endif  /* #ifdef CONFIG_I2C_MULTI_BUS */
        },
 # endif
 #endif  /* #ifdef CONFIG_I2C_MULTI_BUS */
@@ -73,7 +74,7 @@ static int fti2c010_wait(uint32_t mask)
        uint32_t stat, ts;
        struct fti2c010_regs *regs = curr->regs;
 
        uint32_t stat, ts;
        struct fti2c010_regs *regs = curr->regs;
 
-       for (ts = get_timer(0); get_timer(ts) < CFG_CMD_TIMEOUT; ) {
+       for (ts = get_timer(0); get_timer(ts) < CONFIG_FTI2C010_TIMEOUT; ) {
                stat = readl(&regs->sr);
                if ((stat & mask) == mask) {
                        ret = 0;
                stat = readl(&regs->sr);
                if ((stat & mask) == mask) {
                        ret = 0;
@@ -324,7 +325,7 @@ uint i2c_get_bus_num(void)
 int i2c_set_bus_speed(uint speed)
 {
        struct fti2c010_regs *regs = curr->regs;
 int i2c_set_bus_speed(uint speed)
 {
        struct fti2c010_regs *regs = curr->regs;
-       uint clk = CONFIG_FTI2C010_FREQ;
+       uint clk = CONFIG_FTI2C010_CLOCK;
        uint gsr = 0, tsr = 32;
        uint spd, div;
 
        uint gsr = 0, tsr = 32;
        uint spd, div;