
On Thu, Feb 21, 2013 at 10:00:20AM +0100, Thierry Reding wrote:
On Wed, Feb 20, 2013 at 02:05:46PM -0700, Tom Warren wrote:
This patchset adds device-tree support to the Tegra MMC driver. All device config is done via properties in the DT files instead of hard-coded config options/function arguments.
I've tested this on my Seaboard and everything works fine, including card detect. For the other T20 boards, I've used the Linux kernel DTS files for the sdhci nodes where there wasn't one already, or expanded the info that was already there. Everything builds fine, but I haven't tested anything but Seaboard.
v2: Changes as per Stephen's & Simon's review v3: Changes as per Stephen/Lucas/Thierry/Simon's feedback v4: Additional changes as per Stephen/Lucas/Thierry/Simon v5: Additional changes as per Stephen/Lucas/Andy
Hi Tom,
Joseph Lo posted some patches recently which make changes to the Linux driver to use common MMC code. This results in the third cell of the GPIO specifier to actually become meaningful. That is, boards now need to define the CD GPIO as low-active in order for card-detection to work properly.
I wonder if we should be integrating similar changes into this patch series. fdtdec_get_gpio() seems to already support that functionality, so I think the only changes necessary would be to change the third cell in the specifier and make tegra_mmc_getcd() return fdtdec_get_gpio() instead of !fdtdec_get_gpio().
The below patch is what I used on top of your v5 series and verified that card-detection continues to work as expected.
Thierry
diff --git a/board/avionic-design/dts/tegra20-tamonten.dtsi b/board/avionic-design/dts/tegra20-tamonten.dtsi index 6296f77..d4c3293 100644 --- a/board/avionic-design/dts/tegra20-tamonten.dtsi +++ b/board/avionic-design/dts/tegra20-tamonten.dtsi @@ -476,7 +476,7 @@ };
sdhci@c8000600 { - cd-gpios = <&gpio 58 0>; /* gpio PH2 */ + cd-gpios = <&gpio 58 1>; /* gpio PH2 */ wp-gpios = <&gpio 59 0>; /* gpio PH3 */ bus-width = <4>; status = "okay"; diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 7e8f0b8..6063d08 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -490,7 +490,7 @@ int tegra_mmc_getcd(struct mmc *mmc) debug("tegra_mmc_getcd called\n");
if (fdt_gpio_isvalid(&host->cd_gpio)) - return !fdtdec_get_gpio(&host->cd_gpio); + return fdtdec_get_gpio(&host->cd_gpio);
return 1; }