From: Simon Baatz <gmbnomis@gmail.com>
To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Cc: jason@lakedaemon.net, andrew@lunn.ch, cjb@laptop.org,
thomas.petazzoni@free-electrons.com
Subject: [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines
Date: Mon, 22 Apr 2013 21:54:58 +0200 [thread overview]
Message-ID: <1366660500-26835-2-git-send-email-gmbnomis@gmail.com> (raw)
In-Reply-To: <1366660500-26835-1-git-send-email-gmbnomis@gmail.com>
The slot-gpio helper functions allow to specify whether card detect and
write protect GPIO lines are active high or active low. Since DT
allows to specify active low/high for GPIO lines as well, we can simply
initialize the flags for slot-gpio using the GPIO flags to support all
cases.
We need to adapt the dts files that use CD/WP via GPIO accordingly.
Only the dts for "MPL CEC4" is affected by this change.
Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
---
arch/arm/boot/dts/kirkwood-mplcec4.dts | 2 +-
drivers/mmc/host/mvsdio.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 7588241..bf3a58c 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -136,7 +136,7 @@
pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>;
pinctrl-names = "default";
status = "okay";
- cd-gpios = <&gpio1 15 0>;
+ cd-gpios = <&gpio1 15 1>;
/* No WP GPIO */
};
};
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 145cdaf..d444efd 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -691,6 +691,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
struct resource *r;
int ret, irq;
int gpio_card_detect, gpio_write_protect;
+ enum of_gpio_flags gpio_flags;
struct pinctrl *pinctrl;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -731,8 +732,17 @@ static int __init mvsd_probe(struct platform_device *pdev)
}
host->base_clock = clk_get_rate(host->clk) / 2;
- gpio_card_detect = of_get_named_gpio(np, "cd-gpios", 0);
- gpio_write_protect = of_get_named_gpio(np, "wp-gpios", 0);
+ gpio_card_detect = of_get_named_gpio_flags(np, "cd-gpios", 0,
+ &gpio_flags);
+ if (gpio_is_valid(gpio_card_detect) &&
+ !(gpio_flags & OF_GPIO_ACTIVE_LOW))
+ mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
+
+ gpio_write_protect = of_get_named_gpio_flags(np, "wp-gpios", 0,
+ &gpio_flags);
+ if (gpio_is_valid(gpio_write_protect) &&
+ !(gpio_flags & OF_GPIO_ACTIVE_LOW))
+ mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
} else {
const struct mvsdio_platform_data *mvsd_data;
mvsd_data = pdev->dev.platform_data;
--
1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: gmbnomis@gmail.com (Simon Baatz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines
Date: Mon, 22 Apr 2013 21:54:58 +0200 [thread overview]
Message-ID: <1366660500-26835-2-git-send-email-gmbnomis@gmail.com> (raw)
In-Reply-To: <1366660500-26835-1-git-send-email-gmbnomis@gmail.com>
The slot-gpio helper functions allow to specify whether card detect and
write protect GPIO lines are active high or active low. Since DT
allows to specify active low/high for GPIO lines as well, we can simply
initialize the flags for slot-gpio using the GPIO flags to support all
cases.
We need to adapt the dts files that use CD/WP via GPIO accordingly.
Only the dts for "MPL CEC4" is affected by this change.
Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
---
arch/arm/boot/dts/kirkwood-mplcec4.dts | 2 +-
drivers/mmc/host/mvsdio.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/kirkwood-mplcec4.dts b/arch/arm/boot/dts/kirkwood-mplcec4.dts
index 7588241..bf3a58c 100644
--- a/arch/arm/boot/dts/kirkwood-mplcec4.dts
+++ b/arch/arm/boot/dts/kirkwood-mplcec4.dts
@@ -136,7 +136,7 @@
pinctrl-0 = <&pmx_sdio &pmx_sdio_cd>;
pinctrl-names = "default";
status = "okay";
- cd-gpios = <&gpio1 15 0>;
+ cd-gpios = <&gpio1 15 1>;
/* No WP GPIO */
};
};
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
index 145cdaf..d444efd 100644
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
@@ -691,6 +691,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
struct resource *r;
int ret, irq;
int gpio_card_detect, gpio_write_protect;
+ enum of_gpio_flags gpio_flags;
struct pinctrl *pinctrl;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -731,8 +732,17 @@ static int __init mvsd_probe(struct platform_device *pdev)
}
host->base_clock = clk_get_rate(host->clk) / 2;
- gpio_card_detect = of_get_named_gpio(np, "cd-gpios", 0);
- gpio_write_protect = of_get_named_gpio(np, "wp-gpios", 0);
+ gpio_card_detect = of_get_named_gpio_flags(np, "cd-gpios", 0,
+ &gpio_flags);
+ if (gpio_is_valid(gpio_card_detect) &&
+ !(gpio_flags & OF_GPIO_ACTIVE_LOW))
+ mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
+
+ gpio_write_protect = of_get_named_gpio_flags(np, "wp-gpios", 0,
+ &gpio_flags);
+ if (gpio_is_valid(gpio_write_protect) &&
+ !(gpio_flags & OF_GPIO_ACTIVE_LOW))
+ mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
} else {
const struct mvsdio_platform_data *mvsd_data;
mvsd_data = pdev->dev.platform_data;
--
1.7.9.5
next prev parent reply other threads:[~2013-04-22 19:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 19:54 [PATCH 0/3] ARM: Kirkwood: Add DT support for (eSATA) Sheevaplug Simon Baatz
2013-04-22 19:54 ` Simon Baatz
2013-04-22 19:54 ` Simon Baatz [this message]
2013-04-22 19:54 ` [PATCH 1/3] mmc: mvsdio: Support inverted CD and WP GPIO lines Simon Baatz
2013-04-22 20:03 ` Chris Ball
2013-04-22 20:03 ` Chris Ball
2013-04-22 20:37 ` Andrew Lunn
2013-04-22 20:37 ` Andrew Lunn
2013-04-22 21:09 ` Jason Cooper
2013-04-22 21:09 ` Jason Cooper
2013-04-22 21:45 ` Andrew Lunn
2013-04-22 21:45 ` Andrew Lunn
2013-04-22 21:50 ` Chris Ball
2013-04-22 21:50 ` Chris Ball
2013-04-23 1:48 ` Thomas Petazzoni
2013-04-23 1:48 ` Thomas Petazzoni
2013-04-23 21:22 ` Simon Baatz
2013-04-23 21:22 ` Simon Baatz
2013-04-22 22:54 ` Jason Cooper
2013-04-22 22:54 ` Jason Cooper
2013-04-22 19:54 ` [PATCH 2/3] ARM: Kirkwood: Add dts files for Sheevaplug and eSATA Sheevaplug Simon Baatz
2013-04-22 19:54 ` Simon Baatz
2013-04-22 19:55 ` [PATCH 3/3] ARM: Kirkwood: Add DT support for Sheevaplug and Sheevaplug eSATA Simon Baatz
2013-04-22 19:55 ` Simon Baatz
2013-04-23 5:00 ` [PATCH 0/3] ARM: Kirkwood: Add DT support for (eSATA) Sheevaplug Andrew Lunn
2013-04-23 5:00 ` Andrew Lunn
2013-05-13 17:30 ` Jason Cooper
2013-05-13 17:30 ` Jason Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1366660500-26835-2-git-send-email-gmbnomis@gmail.com \
--to=gmbnomis@gmail.com \
--cc=andrew@lunn.ch \
--cc=cjb@laptop.org \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.