Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933504AbcKIQX6 (ORCPT ); Wed, 9 Nov 2016 11:23:58 -0500 Received: from mail-bl2nam02on0120.outbound.protection.outlook.com ([104.47.38.120]:14944 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754148AbcKIQX4 (ORCPT ); Wed, 9 Nov 2016 11:23:56 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=zach.brown@ni.com; Date: Wed, 9 Nov 2016 10:08:29 -0600 From: Zach Brown To: Adrian Hunter CC: , , Subject: Re: [RFC 2/2] mmc: sdhci-pci: Use ACPI to get max frequency for Intel byt sdio host controller sub-vended by NI Message-ID: <20161109160827.GA6138@zach-desktop> References: <1478635635-14953-1-git-send-email-zach.brown@ni.com> <1478635635-14953-3-git-send-email-zach.brown@ni.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [130.164.62.11] X-ClientProxiedBy: CY4PR21CA0004.namprd21.prod.outlook.com (10.172.122.142) To CY4PR04MB0617.namprd04.prod.outlook.com (10.172.136.138) X-MS-Office365-Filtering-Correlation-Id: 8a15dae2-8fdd-4806-d225-08d408baabde X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB0617;2:GmLE+mStAmH2/IDWlU7jdWIyutb0D8mnh1nw1KrPxYQTF+vsWNUz2ybndzCiHHLnP6+rgospSBEQv0pYADlOCuZRYnlzDWfO8SDKYfgzsPaoJxiiW/d7OTHW411yrwkE8q93w4+7mIKwUHprYwGEXMuK7BzGqLzAUF376LoFPaKSBSAKLKfog0Befja76ZdrqKFLhllr9HgSPj41YSfxXg==;3:EhM2ETSU9pzdbjPNY024WEWC391P09hiaRbEnpEGo2JMkzu0pNbfu8Kum7wAKqHaq9oPstG3GzdF0QFw0KD7reinvu0PMts4/ICyn9IjxG8PJI/3Nc9ipiPpZ1zprmLcmdZbqHfEyQv1n3m89y9L4w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR04MB0617; X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB0617;25:twnASwK/uxp/pOoa1kdLYctBG+agTHNj9cSj7RhWFzeSoRyrGSXP+fzAVBEEclHNtlDF1KjtOU+yluQ0T/sx33SLQuF7RtAXEFJ9QtHvP8934N3f1tSjnYmh6PA1A3ydZG1NH2cPju0JrnUQU7GRU+VZCQfRivmuTTGuxst48FQuluvKyv7yYVoAIuPdXvCJHtukiDRwQYnQMTEvETBvu5IKLvsR8iJDiV83jFkNgtK9913/l/Kmq3I0kR+6oPZmz+7qKWUVRwo7BdWYu+ANM8yC26J1ejauLTFaWe6I6KYcgiH7Smbtl4dIZghhdsoLMEPAxNG3EgohnG+8/6FeW9CmW/yLnF3t0hCP1tRz1aiYXSlWoaeDTT9eFwYyQFJ7CSgPpM24RUyhQDEQekEHxsvQXBVHhizozDIEJo1fIBHZuhJPQXF6dJ++6kyFwn2SqfvFNaI1sml7aiYsb3m3zqNWdyiMaRlFuOfv6q23RmH41mcR40Avyc201qjMQtkAfQQkBo2MJFtHXr2HIQ+d0V3oMQp49u7fPM5WGaoIppZqhNgrLxZgNQbPkB67/tVPcewJWULRAJHFnPVcpCB+VufxiIq0VNp/ptGZdH9POXrPTpoU8CVSH5vZxD8Q1BPaxl2FVILrJhXm16yY2cXehUZ5JRutmjJClHp/I8bUTs73rsYEcg3CCcn2YQS78CC9GhG2wTfWUe96ccKDIoiDb1GPd5U3UjwBspJePEpCjkM= X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB0617;31:xiTJGKFFRYdCKAvC2sgqdf0ZfetI1+ykHwmV7hGkLe4V0IbUx0avZ5HuEdUj3XMXWjXyCh50C2cGO3sXv0n8dxZR01qss6jS9LZg+erA4eLnDqwZ+nMtOVpisxBh3+FO6HkIPhULOKJYrrBJJ6+aB80G7E9dobrInPLxlrmO0Hb+6Mfpqp3yOaJeq2tDVK2CzNxYL+swPDPjtJzVLdGACaSDgCH/2A3qbUC39tfoGsyDU7jtxVsH9maf0uX7HhtN;20:ysqI4zCTJsRll95vSsR0/mU7hExMBPdHcL/rtH2M5q+L2J2VZbvN/gQ6X+MSCMF4BeCKzJoNe9t93jqIsXL80AsN7Zhg/UBm3xa7WQkjVYGMxVmBYfCOQyT8Fs+Yz/0v12s6ZPwRwAC/tOBVNNcS+eoMNIvhByXzRsPTdxkeqyWOc+IExfavxRwKII6/YZvf9FxfzDyCJnY1HgCiI77bzNdMc9kEqmzltFjiDSewtESOaV9AhOwXaa34A5bSgvHA1ru2YTUII/Qtr3lstKSoZ+WCp5FlaZnJc6iLzo9kV2W/9+WJLFjZx6ZPU+UbBc2vRgPDwVqoebncC7wC8y1lb892pMDWXRWMO8FusC+dUjtfuN0baVwjW34yWH7wAU/6FinncPFNo4aGbR7WfxY0Kp5WiPfTaV4rFnsZqmjPl7dqQfT+UVO2NBvFpYDf8a77zcZkRsmDOu8bsse2CyBxNML5VTTOE/NV6Yxh1Up5NIFODcbdv/0usDpBP7RbCasunYzsNeWcSHeXxHmRfi8PqM8NOtlJhmSoYcxMPvZes5zjxgbBdngMc42Rj37EMjeIvZTXpUaP9ifDkFX7qq0mdr5BwC69Jq435poXyyJlYDQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(145744241990776); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:CY4PR04MB0617;BCL:0;PCL:0;RULEID:;SRVR:CY4PR04MB0617; X-Microsoft-Exchange-Diagnostics: 1;CY4PR04MB0617;4:Ujdd6jiqmO+DqO5stAwGwFbGXrVJtSE8I6L9iiXSXXims95dAJYcrV2Ue2knLKTC56jtsdWp1VvaSEgE20+zdhF8PBJ/77QZyxBB16bQmyGAzKKwDqsnrdySbD6kbuxV7fu2+oJ0kxcuwDXHJWPBknv8pbwCqZNyK9hGJnOMBwDsvd0T4LpHy5aJMguTZMXJNnzXEy+blMpchBH9BK5leG+JzI1uBpqS4AQoGfXSg7dZtOTOX+HLoVdwh6f46VCqFU6J5wrFImtB0BBYEalLkqYj8DB/VKW7V6OZmyfWLTSMIIt58juJstC+jqM5rFUSnxX0Iq17dA7h+4mgByhrG7Gs9tl3Dm7EBWEuh5AdlylD0eMVDPpocncRRUDQem5xob5ENRMygPTdj2UWadGQCgUvZ1E3zOSpvjoOtPyzAVZJiM4hFk4a58Ly5TkbKTaGBBx8QLDnPuSTBuRdtYjxng== X-Forefront-PRVS: 0121F24F22 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(24454002)(189002)(199003)(4326007)(4001350100001)(50466002)(83506001)(46406003)(50986999)(2906002)(7736002)(7846002)(23726003)(9686002)(33716001)(5660300001)(6116002)(86362001)(42186005)(101416001)(77096005)(110136003)(54356999)(105586002)(66066001)(2950100002)(189998001)(47776003)(81166006)(8676002)(106356001)(92566002)(97736004)(76176999)(586003)(305945005)(81156014)(68736007)(3846002)(6916009)(1076002)(33656002)(6666003)(97756001)(18370500001)(107986001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR04MB0617;H:zach-desktop;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR04MB0617;23:0QGcvxuRxQBVhpK8sLwQ2iPP4VmtFOsfuGnT+u3zi?= =?us-ascii?Q?fh9jxqkcdNT9cV8T1T/zMAVkde1887x9gp104B7tfKF1vHHGvKMpWQMPloKJ?= =?us-ascii?Q?XCG0shgQpjLjlIj+nu5pN1dchAC2T3JAwMFgIEEBKqsdVKzL3XC6Wb1Z7uKr?= =?us-ascii?Q?wlWH9UUY+IE7GntoeczVDIbdmRgj/b74Gvp8//ORLJtkiClg/Havk6lkEhQ7?= =?us-ascii?Q?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is= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ni.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2016 16:08:40.4196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR04MB0617 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2514 Lines: 73 On Wed, Nov 09, 2016 at 03:24:24PM +0200, Adrian Hunter wrote: > On 08/11/16 22:07, Zach Brown wrote: > > On NI 9037 boards the max SDIO frequency is limited by trace lengths > > and other layout choices. The max SDIO frequency is stored in an ACPI > > table, as MXFQ. > > > > The driver reads the ACPI entry MXFQ during sdio_probe_slot and sets the > > f_max field of the host with it. > > > > Signed-off-by: Nathan Sullivan > > Reviewed-by: Jaeden Amero > > Reviewed-by: Josh Cartwright > > Signed-off-by: Zach Brown > > --- > > drivers/mmc/host/sdhci-pci-core.c | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c > > index c333ce2..4ac7f16 100644 > > --- a/drivers/mmc/host/sdhci-pci-core.c > > +++ b/drivers/mmc/host/sdhci-pci-core.c > > @@ -27,6 +27,7 @@ > > #include > > #include > > #include > > +#include > > > > #include "sdhci.h" > > #include "sdhci-pci.h" > > @@ -377,6 +378,35 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot) > > > > static int ni_byt_sdio_probe_slot(struct sdhci_pci_slot *slot) > > { > > +#ifdef CONFIG_ACPI > > + /* Get max freq from ACPI for NI hardware */ > > + acpi_handle acpi_hdl; > > + acpi_status status; > > + struct acpi_buffer acpi_result = { > > + ACPI_ALLOCATE_BUFFER, NULL }; > > + union acpi_object *acpi_buffer; > > + int max_freq; > > + > > + status = acpi_get_handle(ACPI_HANDLE(&slot->chip->pdev->dev), "MXFQ", > > + &acpi_hdl); > > Is "MXFQ" an object that has already been deployed or are you inventing it > now? In the latter case, did you consider device properties as an alternative? > "MXFQ" is an object that we have already deployed on some of our devices. > > + if (ACPI_FAILURE(status)) > > + return -ENODEV; > > + > > + status = acpi_evaluate_object(acpi_hdl, NULL, > > + NULL, &acpi_result); > > + if (ACPI_FAILURE(status)) > > + return -EINVAL; > > + > > + acpi_buffer = (union acpi_object *)acpi_result.pointer; > > + > > + if (acpi_buffer->type != ACPI_TYPE_INTEGER) > > + return -EINVAL; > > + > > + max_freq = acpi_buffer->integer.value; > > + > > + slot->host->mmc->f_max = max_freq * 1000000; > > +#endif > > + > > slot->host->mmc->caps |= MMC_CAP_POWER_OFF_CARD | MMC_CAP_NONREMOVABLE; > > return 0; > > } > > >