* [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value
@ 2014-03-11 11:33 Chew Chiau Ee
[not found] ` <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Chew Chiau Ee @ 2014-03-11 11:33 UTC (permalink / raw)
To: Wolfram Sang
Cc: Mika Westerberg, Lim Lee Booi, Chew Chiau Ee,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Chew, Chiau Ee <chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
v2 changelog:
* Add 'dw_' prefix to struct scl_sda_cfg
* Add Baytrail HCNT/LCNT/SDA hold time values directly in the
struct instead of using macro definition
* Replace tab before "=" with space in struct
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 094509bc..91d468f 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 {
baytrail,
};
+struct dw_scl_sda_cfg {
+ u32 ss_hcnt;
+ u32 fs_hcnt;
+ u32 ss_lcnt;
+ u32 fs_lcnt;
+ u32 sda_hold;
+};
+
struct dw_pci_controller {
u32 bus_num;
u32 bus_cfg;
@@ -65,6 +73,7 @@ struct dw_pci_controller {
u32 rx_fifo_depth;
u32 clk_khz;
u32 functionality;
+ struct dw_scl_sda_cfg *scl_sda_cfg;
};
#define INTEL_MID_STD_CFG (DW_IC_CON_MASTER | \
@@ -77,6 +86,15 @@ struct dw_pci_controller {
I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK)
+/* BayTrail HCNT/LCNT/SDA hold time */
+static struct dw_scl_sda_cfg byt_config = {
+ .ss_hcnt = 0x200,
+ .fs_hcnt = 0x55,
+ .ss_lcnt = 0x200,
+ .fs_lcnt = 0x99,
+ .sda_hold = 0x6,
+};
+
static struct dw_pci_controller dw_pci_controllers[] = {
[moorestown_0] = {
.bus_num = 0,
@@ -148,6 +166,7 @@ static struct dw_pci_controller dw_pci_controllers[] = {
.rx_fifo_depth = 32,
.clk_khz = 100000,
.functionality = I2C_FUNC_10BIT_ADDR,
+ .scl_sda_cfg = &byt_config,
},
};
static struct i2c_algorithm i2c_dw_algo = {
@@ -187,6 +206,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
struct i2c_adapter *adap;
int r;
struct dw_pci_controller *controller;
+ struct dw_scl_sda_cfg *cfg;
if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) {
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,
DW_DEFAULT_FUNCTIONALITY;
dev->master_cfg = controller->bus_cfg;
+ if (controller->scl_sda_cfg) {
+ cfg = controller->scl_sda_cfg;
+ dev->ss_hcnt = cfg->ss_hcnt;
+ dev->fs_hcnt = cfg->fs_hcnt;
+ dev->ss_lcnt = cfg->ss_lcnt;
+ dev->fs_lcnt = cfg->fs_lcnt;
+ dev->sda_hold_time = cfg->sda_hold;
+ }
pci_set_drvdata(pdev, dev);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* RE: [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value [not found] ` <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2014-03-11 3:39 ` Chew, Chiau Ee 2014-03-11 11:11 ` Mika Westerberg 2014-03-12 7:16 ` Wolfram Sang 2 siblings, 0 replies; 4+ messages in thread From: Chew, Chiau Ee @ 2014-03-11 3:39 UTC (permalink / raw) To: Wolfram Sang Cc: Mika Westerberg, Lim, Lee Booi, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > Subject: [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA > hold time value > > From: Chew, Chiau Ee <chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > v2 changelog: > * Add 'dw_' prefix to struct scl_sda_cfg > * Add Baytrail HCNT/LCNT/SDA hold time values directly in the > struct instead of using macro definition > * Replace tab before "=" with space in struct > > drivers/i2c/busses/i2c-designware-pcidrv.c | 28 > ++++++++++++++++++++++++++++ > 1 files changed, 28 insertions(+), 0 deletions(-) > I have misplaced the changelog in the previous v2 patch which would cause the removal of signed-off-by line. I'm resending this to fix that problem. Sorry for any confusion and inconvenience caused. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value [not found] ` <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2014-03-11 3:39 ` Chew, Chiau Ee @ 2014-03-11 11:11 ` Mika Westerberg 2014-03-12 7:16 ` Wolfram Sang 2 siblings, 0 replies; 4+ messages in thread From: Mika Westerberg @ 2014-03-11 11:11 UTC (permalink / raw) To: Chew Chiau Ee Cc: Wolfram Sang, Lim Lee Booi, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Tue, Mar 11, 2014 at 07:33:45PM +0800, Chew Chiau Ee wrote: > From: Chew, Chiau Ee <chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Acked-by: Mika Westerberg <mika.westerberg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value [not found] ` <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 2014-03-11 3:39 ` Chew, Chiau Ee 2014-03-11 11:11 ` Mika Westerberg @ 2014-03-12 7:16 ` Wolfram Sang 2 siblings, 0 replies; 4+ messages in thread From: Wolfram Sang @ 2014-03-12 7:16 UTC (permalink / raw) To: Chew Chiau Ee Cc: Mika Westerberg, Lim Lee Booi, linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 670 bytes --] On Tue, Mar 11, 2014 at 07:33:45PM +0800, Chew Chiau Ee wrote: > From: Chew, Chiau Ee <chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> Applied to for-next, thanks! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-12 7:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 11:33 [PATCHv2 RESEND] i2c: designware-pci: set ideal HCNT, LCNT and SDA hold time value Chew Chiau Ee
[not found] ` <1394537625-27205-1-git-send-email-chiau.ee.chew-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-03-11 3:39 ` Chew, Chiau Ee
2014-03-11 11:11 ` Mika Westerberg
2014-03-12 7:16 ` Wolfram Sang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).