Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751142AbdCMH5X (ORCPT ); Mon, 13 Mar 2017 03:57:23 -0400 Received: from mail-sn1nam02on0058.outbound.protection.outlook.com ([104.47.36.58]:59019 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750783AbdCMH5P (ORCPT ); Mon, 13 Mar 2017 03:57:15 -0400 From: Piotr Sroka To: Masahiro Yamada CC: linux-mmc , Adrian Hunter , Ulf Hansson , Linux Kernel Mailing List Subject: RE: [v2 PATCH 3/3] mmc: sdhci-cadence: Update PHY delay configuration Thread-Topic: [v2 PATCH 3/3] mmc: sdhci-cadence: Update PHY delay configuration Thread-Index: AQHSln8jciSgWn5fkkGB6GObxzP5rqGJBXYAgAAbfICAAq44AIAGoJ+g Date: Mon, 13 Mar 2017 07:57:11 +0000 Message-ID: References: <1488807587-5375-1-git-send-email-piotrs@cadence.com> In-Reply-To: Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNccGlvdHJzXGFwcGRhdGFccm9hbWluZ1wwOWQ4NDliNi0zMmQzLTRhNDAtODVlZS02Yjg0YmEyOWUzNWJcbXNnc1xtc2ctYWFlZGNiNmMtMDdjMi0xMWU3LTg3ZmUtYjg3NjNmYWJhNWQxXGFtZS10ZXN0XGFhZWRjYjZlLTA3YzItMTFlNy04N2ZlLWI4NzYzZmFiYTVkMWJvZHkudHh0IiBzej0iNDIxNiIgdD0iMTMxMzM4NjU0MzQxMjUwMTY4IiBoPSJrQzBDenZDWkRkMEZsN3lmU05oTFFxblJvdEE9IiBpZD0iIiBibD0iMCIgYm89IjEiLz48L21ldGE+ authentication-results: socionext.com; dkim=none (message not signed) header.d=none;socionext.com; dmarc=none action=none header.from=cadence.com; x-originating-ip: [213.131.238.28] x-ms-office365-filtering-correlation-id: 52dd95fa-05b2-4a2c-6b07-08d469e68e78 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR07MB3087; x-microsoft-exchange-diagnostics: 1;MWHPR07MB3087;7:FfpNUCano4ZiDZNqYWQftuXRPfvjnhY8Fd6fhICCGWa1WTyiyqTH2mIr2G7PY6AoEx8B0ypNXUdwWDRW9hbEaL9D8wQXbRMLnPp4fQJyNGaCHhbdS0a4bDiS4PVDnyC9VXZKIGIq3/j0mvVjsziJj7c4RgfOxR6Xk2z61dQ3OzdLAW6c4gDLeHjxj1I4XqFDkm1BVcYJAV9reUGj4qzsfBO21buj2Ww6Eq0p9ZELifhvKkVbWGM77EsVLgsM5SSDVEjE0wPHTSCWrzTdzGr+Xx8zsgTph/j1OWSQrJvRqZm99CNBjy9LiFOCO5C3kFQnuNY16l8uXv99GV3FdhEURQ==;20:3eHXOgAHtWAADnblav9ev0In3aQnWRHIDrvMTgwq8CAMSXh5pFSRuwzW/9MQhm6xagCgOk9MkyxzzUNwhFZ0m2YKNfhIy/VDmkO/Fdnynx84hGJsFGY8zRfJ7B8gxIyuJYReZ7e8LHAxZVj7y+zNGz09xOzVpeaN+33RNNNnnxSGNOVQCICcyO02Y/4T5VKonp3qmBReNQXz/x7g6xU7N33T68cH08mRw8O6wPgqeTLF43QWQIf4wqaTYbt6Heeo x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(72806322054110); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6072148);SRVR:MWHPR07MB3087;BCL:0;PCL:0;RULEID:;SRVR:MWHPR07MB3087; x-forefront-prvs: 0245702D7B x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39450400003)(377454003)(76104003)(13464003)(377424004)(6116002)(102836003)(2950100002)(7696004)(66066001)(2900100001)(5660300001)(99286003)(6916009)(3846002)(6246003)(53936002)(86362001)(189998001)(50986999)(74316002)(7736002)(15650500001)(9686003)(305945005)(54356999)(229853002)(76176999)(3280700002)(8676002)(3660700001)(106116001)(93886004)(25786008)(8936002)(2906002)(53546006)(55016002)(6506006)(110136004)(81166006)(38730400002)(4326008)(6436002)(122556002)(33656002)(77096006);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR07MB3087;H:MWHPR07MB3088.namprd07.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Mar 2017 07:57:11.8312 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3087 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v2D7vQbL011994 Content-Length: 4024 Lines: 93 Hi Masahiro > -----Original Message----- > From: Masahiro Yamada [mailto:yamada.masahiro@socionext.com] > Sent: 09 March, 2017 3:37 AM > Subject: Re: [v2 PATCH 3/3] mmc: sdhci-cadence: Update PHY delay configuration > > Hi Piotr, > > 2017-03-07 20:00 GMT+09:00 Piotr Sroka : > > Hi Masahiro, > > > >> -----Original Message----- > >> Sent: 07 March, 2017 9:03 AM > >> To: Piotr Sroka > >> Subject: Re: [v2 PATCH 3/3] mmc: sdhci-cadence: Update PHY delay > >> configuration > >> > >> > >> With this patch, we will have two groups for PHY parameters. > >> > >> (A) specified via a data array associated with a compatible string > >> > >> (B) specified with DT property > >> > >> I am confused. > >> What is the difference between (A) and (B)? > > > > The first group of delays are input delays. These delays are set in current version of sdhci-cadence driver in sdhci_cdns_phy_init > function. > > Following by spec: > > They are provided to help in meeting timings relations between data window and sampling clock. > > The clock is fixed position in respect to the SDCLK. And the idea of sampling is to delay and align the data to the data window. > > If the default values of the delays are not sufficient/correct for the > > chip/board implementation those can be adjusted > > > > The second group are DLL delays. > > There are three delays > > SDHCI_CDNS_PHY_DLY_SDCLK - sdclk delay line use to delay outgoing > > sdclk signal SDHCI_CDNS_PHY_DLY_HSMMC - sdclk delay line use to delay > > outgoing sdclk signal for for HS200, HS400 and HS400ES > > SDHCI_CDNS_PHY_DLY_STROBE - DLL strobe delay for HS400ES Following by spec: > > They allows to setup basic DLL parameters. In general the default values are sufficient to start working in any speed mode. The > default values of delays and phase detect select can be adjusted depending on the chip/board implementation. > > > > It was not clear what makes one group different from the other. > > After all, parameters from both groups > should be adjusted depending on chip/board implementation. > > > > In general all PHY delays values either should be properly hardcoded in HW or they should be properly set by FW depending on the > chip/board. > > So PHY driver should do not touch PHY delays at all or should set values which are proper for specific chip/board. > > > > I am not sure where exactly they should be placed in dts file or in compatible data. > > I am not quite sure, either. > (comments are appreciated.) > > > FWIW: > The first group (data associated with compatible) allows per-chip adjustment, > but not per-board. Pros are, we will not break DT compatibility, > and we can avoid a list of properties difficult to understand. > Cons are, we can not make fine-grained adjustment for each board. > > > The second group (DT property) gives more flexibility for per-chip and per-board adjustment. > A bad thing is we will end up with specifying a bunch of mysterious properties from DT. > > It looks that "input delays" and "DLL sdclk delays" should be defined in dts file because they depend on a chip and a board implementation. On the other hand the less dts properties the better. There is one more way to handle input delays. It can be achieved by PHY training. PHY training is similar to the tuning and it should be done when proper timing mode is selected and clock frequency is set. To make it possible the sdhci_set_ios function need to be global. Then I could create sdhci_cdns_set_ios function as follows: void sdhci_cdns_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { . . . sdhci_set_ios(mmc, ios); /* execute PHY training if needed */ sdhci_cdns_exec_phy_training(host); } The mmc framework configures timing and frequency separately so PHY training should be executed every time if timing or clock frequency is changed. I am not sure If I can change sdhci_set_ios to global function. So maybe put all delays to dts file would be a better solution? What do you think? Best Regards Piotr Sroka