summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-05-03 17:46:27 +0200
committerHeiko Schocher <hs@denx.de>2014-05-14 12:59:12 +0200
commit2072e7262965bb48d7fffb1e283101e6ed8b21a8 (patch)
tree07cb986d4c61ad22cf1085c56215c61ef516b59a /drivers/i2c
parentfab356a0b87d57d474d6e87408f1ede98a503150 (diff)
mvtwsi: Remove unnecessary twsi_baud_rate and twsi_slave_address globals
These are used only once, so their is no need to have them global. This also stops mvtwsi from using any bss vars making it easier to use before dram init (to talk to the pmic to set the dram voltage). Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/mvtwsi.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index b44944378a9..5ba0e038624 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -219,24 +219,12 @@ static int twsi_stop(int status)
(CONFIG_SYS_TCLK / (10 * (m + 1) * (1 << n)))
/*
- * These are required to be reprogrammed before enabling the controller
- * because a reset loses them.
- * Default values come from the spec, but a twsi_reset will change them.
- * twsi_slave_address left uninitialized lest checkpatch.pl complains.
- */
-
-/* Baudrate generator: m (bits 6..3) = 8, n (bits 2..0) = 4 */
-static u8 twsi_baud_rate = 0x44; /* baudrate at controller reset */
-/* Default slave address is 0 (so is an uninitialized static) */
-static u8 twsi_slave_address;
-
-/*
* Reset controller.
* Called at end of i2c_init unsuccessful i2c transactions.
* Controller reset also resets the baud rate and slave address, so
* re-establish them.
*/
-static void twsi_reset(void)
+static void twsi_reset(u8 baud_rate, u8 slave_address)
{
/* ensure controller will be enabled by any twsi*() function */
twsi_control_flags = MVTWSI_CONTROL_TWSIEN;
@@ -245,9 +233,9 @@ static void twsi_reset(void)
/* wait 2 ms -- this is what the Marvell LSP does */
udelay(20000);
/* set baud rate */
- writel(twsi_baud_rate, &twsi->baudrate);
+ writel(baud_rate, &twsi->baudrate);
/* set slave address even though we don't use it */
- writel(twsi_slave_address, &twsi->slave_address);
+ writel(slave_address, &twsi->slave_address);
writel(0, &twsi->xtnd_slave_addr);
/* assert STOP but don't care for the result */
(void) twsi_stop(0);
@@ -275,11 +263,8 @@ void i2c_init(int requested_speed, int slaveadd)
}
}
}
- /* save baud rate and slave for later calls to twsi_reset */
- twsi_baud_rate = baud;
- twsi_slave_address = slaveadd;
/* reset controller */
- twsi_reset();
+ twsi_reset(baud, slaveadd);
}
/*