From: Kuo-Jung Su <dantesu@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] i2c: fti2c010: cosmetic: coding style cleanup
Date: Mon, 25 Nov 2013 10:48:12 +0800 [thread overview]
Message-ID: <1385347693-1192-2-git-send-email-dantesu@gmail.com> (raw)
In-Reply-To: <1385347693-1192-1-git-send-email-dantesu@gmail.com>
From: Kuo-Jung Su <dantesu@faraday-tech.com>
Coding style cleanup
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Cc: Heiko Schocher <hs@denx.de>
---
drivers/i2c/fti2c010.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/drivers/i2c/fti2c010.c b/drivers/i2c/fti2c010.c
index ddeb941..ec6afc9 100644
--- a/drivers/i2c/fti2c010.c
+++ b/drivers/i2c/fti2c010.c
@@ -18,22 +18,23 @@
#endif
#ifndef CONFIG_SYS_I2C_SPEED
-#define CONFIG_SYS_I2C_SPEED 50000
+#define CONFIG_SYS_I2C_SPEED 5000
#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
-/* 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 {
- void __iomem *regs;
+ struct fti2c010_regs *regs;
uint bus;
uint speed;
};
@@ -41,25 +42,25 @@ struct fti2c010_chip {
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,
- .regs = (void __iomem *)CONFIG_FTI2C010_BASE1,
+ .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE1,
},
# 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,
- .regs = (void __iomem *)CONFIG_FTI2C010_BASE3,
+ .regs = (struct fti2c010_regs *)CONFIG_FTI2C010_BASE3,
},
# 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;
- for (ts = get_timer(0); get_timer(ts) < CFG_CMD_TIMEOUT; ) {
+ for (ts = get_timer(0); get_timer(ts) < CONFIG_FTI2C010_TIMEOUT; ) {
stat = readl(®s->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;
- uint clk = CONFIG_FTI2C010_FREQ;
+ uint clk = CONFIG_FTI2C010_CLOCK;
uint gsr = 0, tsr = 32;
uint spd, div;
--
1.7.9.5
next prev parent reply other threads:[~2013-11-25 2:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 2:48 [U-Boot] [PATCH 0/2] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-11-25 2:48 ` Kuo-Jung Su [this message]
2013-11-25 2:48 ` [U-Boot] [PATCH 2/2] " Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 0/4] i2c: fti2c010: bug fix & new driver model Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 2/4] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 3/4] i2c: fti2c010: serial out r/w address in MSB order Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 4/4] cmd_eeprom: bug fix for i2c read/write Kuo-Jung Su
2013-11-28 10:39 ` Alexey Brodkin
2013-11-29 0:59 ` Kuo-Jung Su
2013-11-29 9:10 ` Alexey Brodkin
2013-11-29 9:32 ` Kuo-Jung Su
2013-11-29 9:56 ` Alexey Brodkin
2013-11-29 15:04 ` Kuo-Jung Su
2013-12-02 2:57 ` [U-Boot] [PATCH v3 0/4] i2c: fti2c010: bug fix & new driver model Kuo-Jung Su
2013-12-02 2:57 ` [U-Boot] [PATCH v3 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-12-02 7:30 ` [U-Boot] [PATCH v3 0/4] i2c: fti2c010: bug fix & new driver model Heiko Schocher
2013-12-02 8:09 ` Kuo-Jung Su
2013-12-02 8:36 ` Heiko Schocher
2013-12-02 8:02 ` Kuo-Jung Su
2013-12-02 8:02 ` [U-Boot] [PATCH v3 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-12-09 6:52 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 2/4] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-12-09 6:53 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 3/4] i2c: fti2c010: serial out r/w address in MSB order Kuo-Jung Su
2013-12-09 6:55 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 4/4] cmd_eeprom: bug fix for i2c read/write Kuo-Jung Su
2013-12-02 11:09 ` Alexey Brodkin
2013-12-03 0:55 ` Kuo-Jung Su
2013-12-03 7:42 ` Alexey Brodkin
2013-12-09 6:56 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-09 10:35 ` Alexey Brodkin
2013-12-09 11:21 ` Heiko Schocher
2013-12-10 10:18 ` Alexey Brodkin
2013-12-11 1:13 ` Kuo-Jung Su
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1385347693-1192-2-git-send-email-dantesu@gmail.com \
--to=dantesu@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.