aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-08-07 07:27:24 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-08-18 03:56:56 -0400
commitb007a3ef958413736a9e2ba698ad6675a9d519ab (patch)
tree90c3bff5b8c49677bb131681978d14be8a2c51b5
parentd9875690d9b89a866022ff49e3fcea892345ad92 (diff)
i2c: nomadik: Add default configuration into the Nomadik I2C driver
At this moment in time there is only one known configuration for the Nomadik I2C driver. By not holding that configuration in the driver adds some unnecessary overhead in platform code. The configuration has already been removed from platform code, this patch checks for any over-riding configurations. If there aren't any, the default is used. [LinusW says: "Right now this is causing boot regressions so we need it badly..."] Acked-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 5e6f1eed4f83..61b00edacb08 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -350,10 +350,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
350 350
351 i2c_clk = clk_get_rate(dev->clk); 351 i2c_clk = clk_get_rate(dev->clk);
352 352
353 /* fallback to std. mode if machine has not provided it */
354 if (dev->cfg.clk_freq == 0)
355 dev->cfg.clk_freq = 100000;
356
357 /* 353 /*
358 * The spec says, in case of std. mode the divider is 354 * The spec says, in case of std. mode the divider is
359 * 2 whereas it is 3 for fast and fastplus mode of 355 * 2 whereas it is 3 for fast and fastplus mode of
@@ -911,20 +907,32 @@ static const struct i2c_algorithm nmk_i2c_algo = {
911 .functionality = nmk_i2c_functionality 907 .functionality = nmk_i2c_functionality
912}; 908};
913 909
910static struct nmk_i2c_controller u8500_i2c = {
911 /*
912 * Slave data setup time; 250ns, 100ns, and 10ns, which
913 * is 14, 6 and 2 respectively for a 48Mhz i2c clock.
914 */
915 .slsu = 0xe,
916 .tft = 1, /* Tx FIFO threshold */
917 .rft = 8, /* Rx FIFO threshold */
918 .clk_freq = 400000, /* fast mode operation */
919 .timeout = 200, /* Slave response timeout(ms) */
920 .sm = I2C_FREQ_MODE_FAST,
921};
922
914static atomic_t adapter_id = ATOMIC_INIT(0); 923static atomic_t adapter_id = ATOMIC_INIT(0);
915 924
916static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) 925static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
917{ 926{
918 int ret = 0; 927 int ret = 0;
919 struct nmk_i2c_controller *pdata = 928 struct nmk_i2c_controller *pdata = adev->dev.platform_data;
920 adev->dev.platform_data;
921 struct nmk_i2c_dev *dev; 929 struct nmk_i2c_dev *dev;
922 struct i2c_adapter *adap; 930 struct i2c_adapter *adap;
923 931
924 if (!pdata) { 932 if (!pdata)
925 dev_warn(&adev->dev, "no platform data\n"); 933 /* No i2c configuration found, using the default. */
926 return -ENODEV; 934 pdata = &u8500_i2c;
927 } 935
928 dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL); 936 dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
929 if (!dev) { 937 if (!dev) {
930 dev_err(&adev->dev, "cannot allocate memory\n"); 938 dev_err(&adev->dev, "cannot allocate memory\n");