summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-04-14 14:15:48 +0200
committerHeiko Schocher <hs@denx.de>2016-05-17 08:28:48 +0200
commit6150be9094bb155022da3843b56e6314edf54305 (patch)
tree9de8c274909a14408bc1c32c19c35c21f3fed5ba /drivers
parenta13767bc0ee8ccaf4e7f64192e7f1d408dc7f900 (diff)
downloadtalos-obmc-uboot-6150be9094bb155022da3843b56e6314edf54305.tar.gz
talos-obmc-uboot-6150be9094bb155022da3843b56e6314edf54305.zip
i2c: cdns: Moving speed setup from probe to set_bus_speed function
set_bus_speed is the right function where bus speed should be setup. This move enable option to remove probe and remove functions which are empty. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/i2c-cdns.c48
1 files changed, 11 insertions, 37 deletions
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index 66bd580aad..0bc6aaaa6f 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -115,41 +115,6 @@ struct i2c_cdns_bus {
struct cdns_i2c_regs __iomem *regs; /* register base */
};
-
-/** cdns_i2c_probe() - Probe method
- * @dev: udevice pointer
- *
- * DM callback called when device is probed
- */
-static int cdns_i2c_probe(struct udevice *dev)
-{
- struct i2c_cdns_bus *bus = dev_get_priv(dev);
-
- /* TODO: Calculate dividers based on CPU_CLK_1X */
- /* 111MHz / ( (3 * 17) * 22 ) = ~100KHz */
- writel((16 << CDNS_I2C_CONTROL_DIV_B_SHIFT) |
- (2 << CDNS_I2C_CONTROL_DIV_A_SHIFT), &bus->regs->control);
-
- /* Enable master mode, ack, and 7-bit addressing */
- setbits_le32(&bus->regs->control, CDNS_I2C_CONTROL_MS |
- CDNS_I2C_CONTROL_ACKEN | CDNS_I2C_CONTROL_NEA);
-
- debug("%s bus %d at %p\n", __func__, dev->seq, bus->regs);
-
- return 0;
-}
-
-static int cdns_i2c_remove(struct udevice *dev)
-{
- struct i2c_cdns_bus *bus = dev_get_priv(dev);
-
- debug("%s bus %d at %p\n", __func__, dev->seq, bus->regs);
-
- unmap_sysmem(bus->regs);
-
- return 0;
-}
-
/* Wait for an interrupt */
static u32 cdns_i2c_wait(struct cdns_i2c_regs *cdns_i2c, u32 mask)
{
@@ -170,12 +135,23 @@ static u32 cdns_i2c_wait(struct cdns_i2c_regs *cdns_i2c, u32 mask)
static int cdns_i2c_set_bus_speed(struct udevice *dev, unsigned int speed)
{
+ struct i2c_cdns_bus *bus = dev_get_priv(dev);
+
if (speed != 100000) {
printf("%s, failed to set clock speed to %u\n", __func__,
speed);
return -EINVAL;
}
+ /* TODO: Calculate dividers based on CPU_CLK_1X */
+ /* 111MHz / ( (3 * 17) * 22 ) = ~100KHz */
+ writel((16 << CDNS_I2C_CONTROL_DIV_B_SHIFT) |
+ (2 << CDNS_I2C_CONTROL_DIV_A_SHIFT), &bus->regs->control);
+
+ /* Enable master mode, ack, and 7-bit addressing */
+ setbits_le32(&bus->regs->control, CDNS_I2C_CONTROL_MS |
+ CDNS_I2C_CONTROL_ACKEN | CDNS_I2C_CONTROL_NEA);
+
return 0;
}
@@ -335,8 +311,6 @@ U_BOOT_DRIVER(cdns_i2c) = {
.name = "i2c-cdns",
.id = UCLASS_I2C,
.of_match = cdns_i2c_of_match,
- .probe = cdns_i2c_probe,
- .remove = cdns_i2c_remove,
.ofdata_to_platdata = cdns_i2c_ofdata_to_platdata,
.priv_auto_alloc_size = sizeof(struct i2c_cdns_bus),
.ops = &cdns_i2c_ops,
OpenPOWER on IntegriCloud