Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752400AbcC3Jkm (ORCPT ); Wed, 30 Mar 2016 05:40:42 -0400 Received: from mail-am1on0071.outbound.protection.outlook.com ([157.56.112.71]:46310 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751954AbcC3Jk2 convert rfc822-to-8bit (ORCPT ); Wed, 30 Mar 2016 05:40:28 -0400 X-Greylist: delayed 1981 seconds by postgrey-1.27 at vger.kernel.org; Wed, 30 Mar 2016 05:40:27 EDT From: Haibo Chen To: Mark Brown , Geert Uytterhoeven CC: Bjorn Andersson , Krzysztof Kozlowski , Ivaylo Dimitrov , Liam Girdwood , "linux-kernel@vger.kernel.org" , Ulf Hansson , linux-mmc , linux-samsung-soc , Javier Martinez Canillas , Marek Szyprowski , "linux-renesas-soc@vger.kernel.org" Subject: RE: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints Thread-Topic: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints Thread-Index: AQHRhZQlTF5GUjRWCEqfBuFH1KaNI59oL42AgAQ55oCAAJv9gIADVK8AgAAxmYCAADRNAIAABhuAgADvuTA= Date: Wed, 30 Mar 2016 09:07:21 +0000 Message-ID: References: <1458587912-32665-1-git-send-email-broonie@kernel.org> <1458587912-32665-2-git-send-email-broonie@kernel.org> <56F0624C.8010004@gmail.com> <20160327090859.GH5028@sirena.org.uk> <20160329145823.GK2350@sirena.org.uk> <20160329182725.GD2350@sirena.org.uk> In-Reply-To: <20160329182725.GD2350@sirena.org.uk> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.158.241.86] x-ms-office365-filtering-correlation-id: f797275c-9e76-44ed-0259-08d3587ab419 x-microsoft-exchange-diagnostics: 1;HE1PR0401MB1803;5:KDXmcM8HONzG16FvuMB+TOIcGu4V5FLWK2VmZpv1ZfGol00j9/D4YcD2W+IigRnANGCPyJtpgV0Jnyp4KXDTxKq5NKcPmzLinV758oBQ5o0Or9ROWc0MprOcGPSyVIu85cKTR135v7QBOBhEg1/QUQ==;24:/bfW82okBQCQ0S6nVUjoQME/LgWodKtKakpmLk3oJ7QI8CI0eM+gqRba+LX6lfKQFNEd53cxQ66WKdrvXRZ7vp5n3McByWVKl37YAQunFuM= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB1803; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:HE1PR0401MB1803;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0401MB1803; x-forefront-prvs: 08978A8F5C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(24454002)(377454003)(13464003)(93886004)(189998001)(3660700001)(81166005)(54356999)(2900100001)(76176999)(66066001)(2950100001)(76576001)(5008740100001)(74316001)(86362001)(5003600100002)(87936001)(4326007)(2906002)(77096005)(5890100001)(5004730100002)(1220700001)(1096002)(19580395003)(122556002)(19580405001)(586003)(5002640100001)(6116002)(3846002)(102836003)(106116001)(33656002)(10400500002)(92566002)(3280700002)(5001770100001)(50986999);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0401MB1803;H:HE1PR0401MB1801.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Mar 2016 09:07:21.7664 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB1803 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3995 Lines: 93 Hi Brown, I also meet the similar issue on i.MX6 platforms. With your patch ---> regulator: core: Ensure we are at least in bounds for our constraints When I insert an SD3.0 card, shows the following log: root@imx6qdlsolo:~# [ 59.733941] sdhci-esdhc-imx 2190000.usdhc: could not set regulator OCR (-22) [ 60.829911] sdhci-esdhc-imx 2190000.usdhc: could not set regulator OCR (-22) [ 61.917951] sdhci-esdhc-imx 2190000.usdhc: could not set regulator OCR (-22) [ 63.009498] sdhci-esdhc-imx 2190000.usdhc: could not set regulator OCR (-22) I did a quick debug, and find when I change the operator && to != , this issue gone. - if (constraints->min_uV != constraints->max_uV) { + if (constraints->min_uV && constraints->max_uV) { In our sdhci.c, we call the function regulator_set_voltage ---> regulator_set_voltage_unlocked(struct regulator *regulator, int min_uV, int max_uV) here, the parameter min_uV is 3300000, and the max_uV is 3400000 currently with your patch (the upper operator is &&), when insert a SD3.0 card, it will do the sanity check, and return -EINVAL but when I change the upper operator from && to !=, before the sanity check, it will first get the current_uV, and then go to out. I'm not familiar with regulator common code. Hope the upper describe can help you debug this issue. The following attach our dts piece code. 126 &usdhc1 { 127 pinctrl-names = "default", "state_100mhz", "state_200mhz"; 128 pinctrl-0 = <&pinctrl_usdhc1>; 129 pinctrl-1 = <&pinctrl_usdhc1_100mhz>; 130 pinctrl-2 = <&pinctrl_usdhc1_200mhz>; 131 cd-gpios = <&gpio1 19 GPIO_ACTIVE_LOW>; 132 keep-power-in-suspend; 133 wakeup-source; 134 vmmc-supply = <®_sd1_vmmc>; 135 status = "okay"; 136 }; regulators { 26 compatible = "simple-bus"; 27 #address-cells = <1>; 28 #size-cells = <0>; 29 30 reg_sd1_vmmc: sd1_regulator { 31 compatible = "regulator-fixed"; 32 regulator-name = "VSD_3V3"; 33 regulator-min-microvolt = <3300000>; 34 regulator-max-microvolt = <3300000>; 35 gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>; 36 enable-active-high; 37 }; 38 }; Best Regards Haibo Chen > -----Original Message----- > From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc- > owner@vger.kernel.org] On Behalf Of Mark Brown > Sent: Wednesday, March 30, 2016 2:27 AM > To: Geert Uytterhoeven > Cc: Bjorn Andersson ; Krzysztof Kozlowski > ; Ivaylo Dimitrov ; > Liam Girdwood ; linux-kernel@vger.kernel.org; Ulf > Hansson ; linux-mmc ; > linux-samsung-soc ; Javier Martinez > Canillas ; Marek Szyprowski > ; linux-renesas-soc@vger.kernel.org > Subject: Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for > our constraints > > On Tue, Mar 29, 2016 at 08:05:34PM +0200, Geert Uytterhoeven wrote: > > > sh_mobile_sdhi ee100000.sd: Got WP GPIO ======> sh_mobile_sdhi > > ee100000.sd: could not set regulator OCR (-22) > > gpio_rcar e6055400.gpio: sense irq = 6, type = 3 > > sh_mobile_sdhi ee100000.sd: mmc0 base at 0xee100000 clock rate > > 97 MHz > > > The line marked with the arrow is introduced by the changed check, and > > looks to be the origin of the failure. > > This isn't making any sense. Why would a change in how we apply voltage > constraints on initial probe of the regulator have an impact here? The changed > code shouldn't even be executing at the point where the SDHCI driver is trying > to use the regulator. There's something else going on here.