diff options
author | Chew, Chiau Ee <chiau.ee.chew@intel.com> | 2014-03-11 07:33:45 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-03-12 03:14:04 -0400 |
commit | 8efd1e9ee3bd55e20cb36e56ca53096cf2b3a930 (patch) | |
tree | db5abf2de8a390ddf456e2ac7f899f65c93bf7e8 /drivers/i2c | |
parent | 4fda99627dc037d3b316c3b3250075645cfcbe4d (diff) |
i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value
On Intel BayTrail, there was case whereby the resulting fast mode
bus speed becomes slower (~20% slower compared to expected speed)
if using the HCNT/LCNT calculated in the core layer. Thus, this
patch is added to allow pci glue layer to pass in optimal
HCNT/LCNT/SDA hold time values to core layer since the core
layer supports cofigurable HCNT/LCNT/SDA hold time values now.
Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-pcidrv.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 094509bcc089..91d468f8cd39 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | |||
@@ -58,6 +58,14 @@ enum dw_pci_ctl_id_t { | |||
58 | baytrail, | 58 | baytrail, |
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct dw_scl_sda_cfg { | ||
62 | u32 ss_hcnt; | ||
63 | u32 fs_hcnt; | ||
64 | u32 ss_lcnt; | ||
65 | u32 fs_lcnt; | ||
66 | u32 sda_hold; | ||
67 | }; | ||
68 | |||
61 | struct dw_pci_controller { | 69 | struct dw_pci_controller { |
62 | u32 bus_num; | 70 | u32 bus_num; |
63 | u32 bus_cfg; | 71 | u32 bus_cfg; |
@@ -65,6 +73,7 @@ struct dw_pci_controller { | |||
65 | u32 rx_fifo_depth; | 73 | u32 rx_fifo_depth; |
66 | u32 clk_khz; | 74 | u32 clk_khz; |
67 | u32 functionality; | 75 | u32 functionality; |
76 | struct dw_scl_sda_cfg *scl_sda_cfg; | ||
68 | }; | 77 | }; |
69 | 78 | ||
70 | #define INTEL_MID_STD_CFG (DW_IC_CON_MASTER | \ | 79 | #define INTEL_MID_STD_CFG (DW_IC_CON_MASTER | \ |
@@ -77,6 +86,15 @@ struct dw_pci_controller { | |||
77 | I2C_FUNC_SMBUS_WORD_DATA | \ | 86 | I2C_FUNC_SMBUS_WORD_DATA | \ |
78 | I2C_FUNC_SMBUS_I2C_BLOCK) | 87 | I2C_FUNC_SMBUS_I2C_BLOCK) |
79 | 88 | ||
89 | /* BayTrail HCNT/LCNT/SDA hold time */ | ||
90 | static struct dw_scl_sda_cfg byt_config = { | ||
91 | .ss_hcnt = 0x200, | ||
92 | .fs_hcnt = 0x55, | ||
93 | .ss_lcnt = 0x200, | ||
94 | .fs_lcnt = 0x99, | ||
95 | .sda_hold = 0x6, | ||
96 | }; | ||
97 | |||
80 | static struct dw_pci_controller dw_pci_controllers[] = { | 98 | static struct dw_pci_controller dw_pci_controllers[] = { |
81 | [moorestown_0] = { | 99 | [moorestown_0] = { |
82 | .bus_num = 0, | 100 | .bus_num = 0, |
@@ -148,6 +166,7 @@ static struct dw_pci_controller dw_pci_controllers[] = { | |||
148 | .rx_fifo_depth = 32, | 166 | .rx_fifo_depth = 32, |
149 | .clk_khz = 100000, | 167 | .clk_khz = 100000, |
150 | .functionality = I2C_FUNC_10BIT_ADDR, | 168 | .functionality = I2C_FUNC_10BIT_ADDR, |
169 | .scl_sda_cfg = &byt_config, | ||
151 | }, | 170 | }, |
152 | }; | 171 | }; |
153 | static struct i2c_algorithm i2c_dw_algo = { | 172 | static struct i2c_algorithm i2c_dw_algo = { |
@@ -187,6 +206,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, | |||
187 | struct i2c_adapter *adap; | 206 | struct i2c_adapter *adap; |
188 | int r; | 207 | int r; |
189 | struct dw_pci_controller *controller; | 208 | struct dw_pci_controller *controller; |
209 | struct dw_scl_sda_cfg *cfg; | ||
190 | 210 | ||
191 | if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) { | 211 | if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) { |
192 | dev_err(&pdev->dev, "%s: invalid driver data %ld\n", __func__, | 212 | dev_err(&pdev->dev, "%s: invalid driver data %ld\n", __func__, |
@@ -224,6 +244,14 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, | |||
224 | DW_DEFAULT_FUNCTIONALITY; | 244 | DW_DEFAULT_FUNCTIONALITY; |
225 | 245 | ||
226 | dev->master_cfg = controller->bus_cfg; | 246 | dev->master_cfg = controller->bus_cfg; |
247 | if (controller->scl_sda_cfg) { | ||
248 | cfg = controller->scl_sda_cfg; | ||
249 | dev->ss_hcnt = cfg->ss_hcnt; | ||
250 | dev->fs_hcnt = cfg->fs_hcnt; | ||
251 | dev->ss_lcnt = cfg->ss_lcnt; | ||
252 | dev->fs_lcnt = cfg->fs_lcnt; | ||
253 | dev->sda_hold_time = cfg->sda_hold; | ||
254 | } | ||
227 | 255 | ||
228 | pci_set_drvdata(pdev, dev); | 256 | pci_set_drvdata(pdev, dev); |
229 | 257 | ||