Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031891AbbKFEtG (ORCPT ); Thu, 5 Nov 2015 23:49:06 -0500 Received: from mail-by2on0064.outbound.protection.outlook.com ([207.46.100.64]:44179 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030793AbbKFEtE convert rfc822-to-8bit (ORCPT ); Thu, 5 Nov 2015 23:49:04 -0500 X-Greylist: delayed 859 seconds by postgrey-1.27 at vger.kernel.org; Thu, 05 Nov 2015 23:49:03 EST Authentication-Results: spf=none (sender IP is 165.204.84.222) smtp.mailfrom=amd.com; linux.intel.com; dkim=none (message not signed) header.d=none;linux.intel.com; dmarc=permerror action=none header.from=amd.com; X-WSS-ID: 0NXDM1Q-08-L4F-02 X-M-MSG: From: "Yu, Xiangliang" To: Mika Westerberg CC: "andriy.shevchenko@linux.intel.com" , "jarkko.nikula@linux.intel.com" , "wsa@the-dreams.de" , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Xue, Ken" , "Wan, Vincent" , "Huang, Ray" , "Wang, Annie" , "Li, Tony" Subject: RE: [PATCH 1/1] I2C: designware: fix IO timeout issue for AMD controller Thread-Topic: [PATCH 1/1] I2C: designware: fix IO timeout issue for AMD controller Thread-Index: AQHRF5yV0mHRMR8KnUO8SEzCTsabDp6M7QYAgAFP1bA= Date: Fri, 6 Nov 2015 04:34:19 +0000 Message-ID: <1C99EED8F51BBC41A8F1E645B51245F41AE8AA50@scybexdag03.amd.com> References: <1446726884-30558-1-git-send-email-Xiangliang.Yu@amd.com> <20151105135216.GN1509@lahna.fi.intel.com> In-Reply-To: <20151105135216.GN1509@lahna.fi.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.237.170.105] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(428002)(13464003)(24454002)(199003)(377454003)(189002)(2920100001)(76176999)(105586002)(106116001)(50466002)(106466001)(23726002)(189998001)(53416004)(46406003)(5004730100002)(86362001)(55846006)(19580405001)(33656002)(102836002)(92566002)(97736004)(2950100001)(77096005)(47776003)(97756001)(110136002)(50986999)(19580395003)(54356999)(5003600100002)(5008740100001)(5007970100001)(101416001)(5001920100001)(2900100001)(87936001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM3PR12MB0860;H:atltwp02.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0860;2:RLbOpXKK5pWstGcnn8XgsqjVs0AxN0Q8hZpfK0zOJHd0daorjs5dWrFyXDq0gV6x22zMi7o+PIIGmEwZnaks3u6vV+4HQieKNLtBbQ/hx9KdWhO40SszIybmpVg34OLFzo06sjoExdrM2dkFtJUBukqeuyUQxLnKgVyXgBx9Ytw=;3:ayWg9PV9nh03N8Q10co9uIfQOAFH4Pd7VhaXtiQwt2B2KMlltgQya31jiozywE63e/FXSiAfDmJkq1xf3nd9f4PgxE7Tfh868seE3z0aNWIiL4pZQUORXrCBz/PT/as+FO21h6WpRYXuW26mShIqTFeXzPOZDk3oghlol8P8v3Ppn4djb6Cc3/eADO7xGvatE14JR8iemD+pozbgzh/Fo+j9s2YvxSqsMdLrQIwZ5qBClFb8ALuFwC+KoXCuTwU6;25:dSTvIWV0fgDxTfSMTAGseDET+2CTuNZEWt1iTnfnsR7JcKxo3JYxIWUUCkqq6336AuU5bw5k21Yhackv8jQvmZ5kC6g9sAewWL7arw4mv0j/Hb+3Ehj24naITKrdW0rorY+RXIoxebmcsirOp57eJLsv3nB3bgOCbwQXkoaejmvntBnHseeci1WG0w7T9Fw6RG0D00BMmbUP2T6WkjMOHV+XERG9R5dE4C7TbMY7P20pRAPs6PtunMIkoHLB2pUfbl0BFa229CA6MIrPP/soIQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0860; X-Microsoft-Exchange-Diagnostics: 1;DM3PR12MB0860;20:1Y/YSO0FHGVCoNbhKu+aYa056v6WqGUBBJpP5QKKEThStleegb4hjb2tydFjaIWbMgVO5iBjrvwxCPu1uqtF1kbR6qW7ytS9ZJZOtNr6utotH1Tb6GWd1zLplw+9m4BVwfjoRVOjgLCO8DySXRLjWvhzZQ+/cXPjZdIgRA0YTzUFQ9WH0rS36xhZKV2G/TuIdCe4ve4xUDS/jWh77o1u7AMasiVSc/ce9joVkDsa1wW6v1TvBU2EgQVCAOn/tVAhM0bV3HS/0C6iQ+OZ0a2CfncwpJyoZDZ9MehioC7hjTPm+52g2fLwyqsC5JIACgz08I9S7qf8MADzeVrmmz2R9KAnJSwklALnr1NVa/RO3pIxzlxBRelhM5JZFRuWa4+jR77y3zDjoekNdJlzdM9dr0u5lmQh26gqgmggTaetcECgxqFZNcVfVSaZ9AEe09Z5T7tqbwEPzHw9sqRErQictzXUC4vTh3fOXxbZ+uqepSipchrJsmIv/2do25FVaY22;4:XUf0BQxa4HLoXP2hEKT2Xf4YVfacEQk2zNPZXL5W87PfUUdXiyJmGnPAR9OwUUJa2mKsVqizcuHf7b+gSR4Z5jrgVrsuYw9QHiMAkV9DS89NUmckNrAt2cDas+Xbl/4slzr/jToBZLKQkrTKjxxGBQPVL746UmMRakFENgMOZu306FVr8I3uZJpEpJI5lqkGtsxnvbId7js1KD8Jma8Z9ISR5sHGvDKzFHMrnL/Tb7uLABzi7VUolyUSKkgLvqfxKWC5g//IInjEtL3v4ur+sJWV81CGZXwugRcEGZq/JOUXHjJm7jNmcjLPsJLrtIXTLyRkGHGwTYPyrs/0N7arhXylIHwUHIO2la2XPbzR7m2bZptq8Cv3nBED8qoLPqU2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(10201501046)(3002001);SRVR:DM3PR12MB0860;BCL:0;PCL:0;RULEID:;SRVR:DM3PR12MB0860; X-Forefront-PRVS: 07521929C1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM3PR12MB0860;23:5zadNkEb2cqVsqro6q26PrbBUhqt8L/FpJjQIEQWT?= =?us-ascii?Q?BLPSr9fR9WXLDdrNCY5rkMkEziL8aByQqPilSqwPQS2el7OP0c2sJZjZ+qOr?= =?us-ascii?Q?tDPaRe+PBwatHBxsw38z3uIs07BHpZWr6OHkWyi/DKeDvs0XTLQSxp1Axzoh?= =?us-ascii?Q?1N0iDuNlubSPvVBbJBYGsQjLnDyy7pL1BSrvGWrqdxbaGZdteuKM2choPXl3?= =?us-ascii?Q?Y8sBisKbKf5lcsueTLVMCOHYzxVmvuC+uvWkPKnI6+YAlwOnlNG2xk2dxcAk?= =?us-ascii?Q?JUGIbDr9ZwFY5r4jwhAqZ99OYjlQB3GeI4uIS9BTeW5OEoGIrqwXfpGj+t8K?= =?us-ascii?Q?c0GKZzMVtRvUKLjlPhJHjjs6wc6CQ/DGpxajQBT9gh7JaYJqIUdpo0DmBRPd?= =?us-ascii?Q?cJu+Ki6JTfYA3AJEH+kU/7m/YlgL1R1hNww938ol564A3m27W1dWtKRj8tzO?= =?us-ascii?Q?rTHGeVYYhkosNYbKKi738r4BoNut2/lu4A64xpuKsgYjBmKh5myEYomwOpO5?= =?us-ascii?Q?yt7dvQOWPdmEgRmmUy1Ba4iDCV/6ObCpVhuXYFX/BAv4Rbb8Y6j/FlsTAbsO?= =?us-ascii?Q?IEljWWT4CgI4VPiGwgrbT3eW4w0qFXr0yfmsOdYUqDmSazta37UtZx/7w+ht?= =?us-ascii?Q?b0Aa4c5QhLGz8M6hSFiFVQA9bzzZU6mJCpchLJ6ERWifM0zaa1JDXP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Gy+411m1kobwfyySZ8+CiHkfaFDJuQ8ALebqqpwpAcuq/z SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2015 04:34:41.1749 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.222];Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0860 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4450 Lines: 114 > -----Original Message----- > From: Mika Westerberg [mailto:mika.westerberg@linux.intel.com] > Sent: Thursday, November 05, 2015 9:52 PM > To: Yu, Xiangliang > Cc: andriy.shevchenko@linux.intel.com; jarkko.nikula@linux.intel.com; > wsa@the-dreams.de; linux-i2c@vger.kernel.org; linux- > kernel@vger.kernel.org; Xue, Ken; Wan, Vincent; Huang, Ray; Wang, Annie; > Li, Tony > Subject: Re: [PATCH 1/1] I2C: designware: fix IO timeout issue for AMD > controller > > On Thu, Nov 05, 2015 at 08:34:44PM +0800, Xiangliang Yu wrote: > > Because of some hardware limitation, AMD I2C controller can't trigger > > next interrupt if interrupt status has been changed after clearing > > interrupt status bits. Then, I2C will lost interrupt and IO timeout. > > > > According to hardware design, this patch implements a workaround to > > disable i2c controller interrupt after clearing interrupt bits when > > entering ISR and to enable i2c interrupt before exiting ISR. > > > > To reduce the performance impacts on other vendors, use unlikely > > function to check flag in ISR. > > > > Signed-off-by: Xiangliang Yu > > --- > > drivers/i2c/busses/i2c-designware-core.c | 6 ++++++ > > drivers/i2c/busses/i2c-designware-core.h | 1 + > > drivers/i2c/busses/i2c-designware-platdrv.c | 4 ++++ > > 3 files changed, 11 insertions(+) > > > > diff --git a/drivers/i2c/busses/i2c-designware-core.c > > b/drivers/i2c/busses/i2c-designware-core.c > > index 7441cdc..04e7b65 100644 > > --- a/drivers/i2c/busses/i2c-designware-core.c > > +++ b/drivers/i2c/busses/i2c-designware-core.c > > @@ -783,6 +783,9 @@ irqreturn_t i2c_dw_isr(int this_irq, void *dev_id) > > > > stat = i2c_dw_read_clear_intrbits(dev); > > What if the status changes right here, before you go and mask the interrupt? Have no effect, because i2c controller can't trigger next interrupt. > > > > > + if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) > > + i2c_dw_disable_int(dev); > > + > > if (stat & DW_IC_INTR_TX_ABRT) { > > dev->cmd_err |= DW_IC_ERR_TX_ABRT; > > dev->status = STATUS_IDLE; > > @@ -811,6 +814,9 @@ tx_aborted: > > if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || > dev->msg_err) > > complete(&dev->cmd_complete); > > > > + if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) > > + dw_writel(dev, DW_IC_INTR_DEFAULT_MASK, > DW_IC_INTR_MASK); > > The driver disables TX interrupt when it is not needed anymore or when TX > gets aborted but the above will re-enable all interrupts regardless. > Is that the intention? No, i2c controller can trigger next interrupt only after re-enable all interrupt. > > > + > > return IRQ_HANDLED; > > } > > EXPORT_SYMBOL_GPL(i2c_dw_isr); > > diff --git a/drivers/i2c/busses/i2c-designware-core.h > > b/drivers/i2c/busses/i2c-designware-core.h > > index 9630222..808ef6a 100644 > > --- a/drivers/i2c/busses/i2c-designware-core.h > > +++ b/drivers/i2c/busses/i2c-designware-core.h > > @@ -111,6 +111,7 @@ struct dw_i2c_dev { > > > > #define ACCESS_SWAP 0x00000001 > > #define ACCESS_16BIT 0x00000002 > > +#define ACCESS_INTR_MASK 0x00000004 > > > > extern u32 dw_readl(struct dw_i2c_dev *dev, int offset); extern void > > dw_writel(struct dw_i2c_dev *dev, u32 b, int offset); diff --git > > a/drivers/i2c/busses/i2c-designware-platdrv.c > > b/drivers/i2c/busses/i2c-designware-platdrv.c > > index 472b882..0c59357 100644 > > --- a/drivers/i2c/busses/i2c-designware-platdrv.c > > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c > > @@ -251,6 +251,10 @@ static int dw_i2c_probe(struct platform_device > *pdev) > > dev->rx_fifo_depth = ((param1 >> 8) & 0xff) + 1; > > dev->adapter.nr = pdev->id; > > } > > + > > + if (!strncmp(pdev->name, "AMD0010", 7)) > > + dev->accessor_flags |= ACCESS_INTR_MASK; > > + > > Can't you put this to ->driver_data? For example it could refer to a > configuration structure that then contains quirk flags. I think it will need to add a function to support it, but the function Is rarely used. It will easy to add if i2c driver has quirk mechanisms. Added code is very simple and have no influence on others. > > > r = i2c_dw_init(dev); > > if (r) > > return r; > > -- > > 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/