From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752903AbdLNPFE (ORCPT ); Thu, 14 Dec 2017 10:05:04 -0500 Received: from muru.com ([72.249.23.125]:60280 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752506AbdLNPFC (ORCPT ); Thu, 14 Dec 2017 10:05:02 -0500 Date: Thu, 14 Dec 2017 07:04:57 -0800 From: Tony Lindgren To: Kishon Vijay Abraham I Cc: Ulf Hansson , Rob Herring , Adrian Hunter , Mark Rutland , Russell King , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, nsekhar@ti.com Subject: Re: [PATCH 06/12] mmc: sdhci_omap: Add support to set IODELAY values Message-ID: <20171214150457.GH14441@atomide.com> References: <20171214130941.26666-1-kishon@ti.com> <20171214130941.26666-7-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171214130941.26666-7-kishon@ti.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, * Kishon Vijay Abraham I [171214 13:13]: > The data manual of J6/J6 Eco recommends to set different IODELAY values > depending on the mode in which the MMC/SD is enumerated in order to > ensure IO timings are met. > > Add support to set the IODELAY values depending on the various MMC > modes using the pinctrl APIs. ... > --- a/drivers/mmc/host/sdhci-omap.c > +++ b/drivers/mmc/host/sdhci-omap.c > @@ -105,6 +109,20 @@ struct sdhci_omap_host { > struct sdhci_host *host; > u8 bus_mode; > u8 power_mode; > + u8 timing; > + u8 flags; > + > + struct pinctrl *pinctrl; > + struct pinctrl_state *pinctrl_state; > + struct pinctrl_state *default_pinctrl_state; > + struct pinctrl_state *sdr104_pinctrl_state; > + struct pinctrl_state *hs200_1_8v_pinctrl_state; > + struct pinctrl_state *ddr50_pinctrl_state; > + struct pinctrl_state *sdr50_pinctrl_state; > + struct pinctrl_state *sdr25_pinctrl_state; > + struct pinctrl_state *sdr12_pinctrl_state; > + struct pinctrl_state *hs_pinctrl_state; > + struct pinctrl_state *ddr_1_8v_pinctrl_state; > }; You can make the pinctrl code more generic by allocating an array of states and have just: struct pinctrl_state **pinctrl_state; Then access it with omap_host->pinctrl_state[MMC_TIMING_MMC_HS200] and so on. This way the code gets simplified and you can do a generic function to initialize things and call it from a for loop etc. Just remember that pinctrl use can be optional as the pins can be set up in the bootloader alone. Then you can just continue with the default iodelay state like we are currently doing. Regards, Tony