All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@codeaurora.org>
To: linux-arm-msm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, davidb@codeaurora.org,
	Daniel Walker <dwalker@codeaurora.org>
Subject: [PATCH 6/7] msm: mahimahi: add gpio pin muxing code
Date: Thu, 20 Jan 2011 12:32:44 -0800	[thread overview]
Message-ID: <1295555565-21563-7-git-send-email-dwalker@codeaurora.org> (raw)
In-Reply-To: <1295555565-21563-1-git-send-email-dwalker@codeaurora.org>

Add in old style pin muxing code. This code is from Google's
tree. However, the other way to do this is to use gpiomux, but
it's currently not mature enough to have on/off configurations.

This code was taken from Google's tree, with slight modifications
and clean up.

Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
 arch/arm/mach-msm/board-mahimahi-mmc.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/board-mahimahi-mmc.c b/arch/arm/mach-msm/board-mahimahi-mmc.c
index 991818e..13e45d0 100644
--- a/arch/arm/mach-msm/board-mahimahi-mmc.c
+++ b/arch/arm/mach-msm/board-mahimahi-mmc.c
@@ -54,6 +54,34 @@ static struct msm_mmc_gpio sdc1_gpio_cfg[] = {
 	{67, "sdc1_dat_0"},
 };
 
+static void config_gpio_table(uint32_t *table, int len)
+{
+	int n;
+	unsigned id;
+	for (n = 0; n < len; n++) {
+		id = table[n];
+		msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
+	}
+}
+
+static uint32_t sdcard_on_gpio_table[] = {
+	PCOM_GPIO_CFG(62, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
+	PCOM_GPIO_CFG(63, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
+	PCOM_GPIO_CFG(64, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT3 */
+	PCOM_GPIO_CFG(65, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT2 */
+	PCOM_GPIO_CFG(66, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
+	PCOM_GPIO_CFG(67, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
+};
+
+static uint32_t sdcard_off_gpio_table[] = {
+	PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
+	PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
+	PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
+	PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
+	PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
+	PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
+};
+
 static struct vreg	*sdslot_vreg;
 static uint32_t		sdslot_vdd = 0xffffffff;
 static uint32_t		sdslot_vreg_enabled;
@@ -86,6 +114,8 @@ static uint32_t mahimahi_sdslot_switchvdd(struct device *dev, unsigned int vdd)
 	sdslot_vdd = vdd;
 
 	if (vdd == 0) {
+		config_gpio_table(sdcard_off_gpio_table,
+				  ARRAY_SIZE(sdcard_off_gpio_table));
 		vreg_disable(sdslot_vreg);
 		sdslot_vreg_enabled = 0;
 		return 0;
@@ -95,6 +125,8 @@ static uint32_t mahimahi_sdslot_switchvdd(struct device *dev, unsigned int vdd)
 		ret = vreg_enable(sdslot_vreg);
 		if (ret)
 			pr_err("Error enabling vreg (%d)\n", ret);
+		config_gpio_table(sdcard_on_gpio_table,
+				  ARRAY_SIZE(sdcard_on_gpio_table));
 		sdslot_vreg_enabled = 1;
 	}
 
-- 
1.7.0.4

-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

WARNING: multiple messages have this Message-ID (diff)
From: dwalker@codeaurora.org (Daniel Walker)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/7] msm: mahimahi: add gpio pin muxing code
Date: Thu, 20 Jan 2011 12:32:44 -0800	[thread overview]
Message-ID: <1295555565-21563-7-git-send-email-dwalker@codeaurora.org> (raw)
In-Reply-To: <1295555565-21563-1-git-send-email-dwalker@codeaurora.org>

Add in old style pin muxing code. This code is from Google's
tree. However, the other way to do this is to use gpiomux, but
it's currently not mature enough to have on/off configurations.

This code was taken from Google's tree, with slight modifications
and clean up.

Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
 arch/arm/mach-msm/board-mahimahi-mmc.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-msm/board-mahimahi-mmc.c b/arch/arm/mach-msm/board-mahimahi-mmc.c
index 991818e..13e45d0 100644
--- a/arch/arm/mach-msm/board-mahimahi-mmc.c
+++ b/arch/arm/mach-msm/board-mahimahi-mmc.c
@@ -54,6 +54,34 @@ static struct msm_mmc_gpio sdc1_gpio_cfg[] = {
 	{67, "sdc1_dat_0"},
 };
 
+static void config_gpio_table(uint32_t *table, int len)
+{
+	int n;
+	unsigned id;
+	for (n = 0; n < len; n++) {
+		id = table[n];
+		msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
+	}
+}
+
+static uint32_t sdcard_on_gpio_table[] = {
+	PCOM_GPIO_CFG(62, 1, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
+	PCOM_GPIO_CFG(63, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
+	PCOM_GPIO_CFG(64, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT3 */
+	PCOM_GPIO_CFG(65, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT2 */
+	PCOM_GPIO_CFG(66, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
+	PCOM_GPIO_CFG(67, 1, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
+};
+
+static uint32_t sdcard_off_gpio_table[] = {
+	PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
+	PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
+	PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
+	PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
+	PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
+	PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
+};
+
 static struct vreg	*sdslot_vreg;
 static uint32_t		sdslot_vdd = 0xffffffff;
 static uint32_t		sdslot_vreg_enabled;
@@ -86,6 +114,8 @@ static uint32_t mahimahi_sdslot_switchvdd(struct device *dev, unsigned int vdd)
 	sdslot_vdd = vdd;
 
 	if (vdd == 0) {
+		config_gpio_table(sdcard_off_gpio_table,
+				  ARRAY_SIZE(sdcard_off_gpio_table));
 		vreg_disable(sdslot_vreg);
 		sdslot_vreg_enabled = 0;
 		return 0;
@@ -95,6 +125,8 @@ static uint32_t mahimahi_sdslot_switchvdd(struct device *dev, unsigned int vdd)
 		ret = vreg_enable(sdslot_vreg);
 		if (ret)
 			pr_err("Error enabling vreg (%d)\n", ret);
+		config_gpio_table(sdcard_on_gpio_table,
+				  ARRAY_SIZE(sdcard_on_gpio_table));
 		sdslot_vreg_enabled = 1;
 	}
 
-- 
1.7.0.4

-- 
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2011-01-20 20:32 UTC|newest]

Thread overview: 157+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-20 20:32 [PATCH 0/7] Nexus One Support Daniel Walker
2011-01-20 20:32 ` Daniel Walker
2011-01-20 20:32 ` [PATCH 1/7] msm: qsd8x50: add uart platform data Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-20 20:32 ` [PATCH 2/7] [ARM] msm: qsd8k memory base is at 0x20000000 Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-20 20:32 ` [PATCH 3/7] msm: qsd8x50: add acpuclock code Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-20 20:32 ` [PATCH 4/7] msm: mahimahi: add mahimahi board file Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-20 20:32 ` [PATCH 5/7] msm: mahimahi: add in mmc support code Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-20 20:32 ` Daniel Walker [this message]
2011-01-20 20:32   ` [PATCH 6/7] msm: mahimahi: add gpio pin muxing code Daniel Walker
2011-01-20 20:32 ` [PATCH 7/7] msm: mahimahi: initialize mmc at start up Daniel Walker
2011-01-20 20:32   ` Daniel Walker
2011-01-21  0:42 ` [PATCH 0/7] Nexus One Support Dima Zavin
2011-01-21  0:42   ` Dima Zavin
2011-01-21  0:42   ` Dima Zavin
2011-01-21  0:55   ` Daniel Walker
2011-01-21  0:55     ` Daniel Walker
2011-01-21  1:41     ` Joe Perches
2011-01-21  1:41       ` Joe Perches
2011-01-21  1:58       ` Daniel Walker
2011-01-21  1:58         ` Daniel Walker
2011-01-21  2:13         ` Dima Zavin
2011-01-21  2:13           ` Dima Zavin
2011-01-21 15:47           ` Daniel Walker
2011-01-21 15:47             ` Daniel Walker
2011-01-21  2:25         ` Joe Perches
2011-01-21  2:25           ` Joe Perches
2011-01-21  3:41           ` Theodore Tso
2011-01-21  3:41             ` Theodore Tso
2011-01-21 15:46           ` Daniel Walker
2011-01-21 15:46             ` Daniel Walker
2011-01-21 17:48             ` Jesse Barnes
2011-01-21 17:48               ` Jesse Barnes
2011-01-21 17:56               ` Daniel Walker
2011-01-21 17:56                 ` Daniel Walker
2011-01-21 17:59                 ` Christoph Hellwig
2011-01-21 17:59                   ` Christoph Hellwig
2011-01-21 17:56               ` Jesse Barnes
2011-01-21 17:56                 ` Jesse Barnes
2011-01-21 17:56                 ` Jesse Barnes
2011-01-21 18:00                 ` Daniel Walker
2011-01-21 18:00                   ` Daniel Walker
2011-01-21 18:04                   ` Jesse Barnes
2011-01-21 18:04                     ` Jesse Barnes
2011-01-21 18:18                     ` Daniel Walker
2011-01-21 18:18                       ` Daniel Walker
2011-01-21 18:27                       ` Jesse Barnes
2011-01-21 18:27                         ` Jesse Barnes
2011-01-21 18:35                         ` Daniel Walker
2011-01-21 18:35                           ` Daniel Walker
2011-01-21 20:44                       ` Dima Zavin
2011-01-21 20:44                         ` Dima Zavin
2011-01-21 20:49                         ` Daniel Walker
2011-01-21 20:49                           ` Daniel Walker
2011-01-21 20:49                           ` Daniel Walker
2011-01-21 21:01                           ` Jesse Barnes
2011-01-21 21:01                             ` Jesse Barnes
2011-01-21 21:01                             ` Jesse Barnes
2011-01-21 21:26                             ` Daniel Walker
2011-01-21 21:26                               ` Daniel Walker
2011-01-21 21:42                               ` Dima Zavin
2011-01-21 21:42                                 ` Dima Zavin
2011-01-21 21:42                                 ` Dima Zavin
2011-01-22 13:58                                 ` David Woodhouse
2011-01-22 13:58                                   ` David Woodhouse
2011-01-21 21:02                           ` Joe Perches
2011-01-21 21:02                             ` Joe Perches
2011-01-21 21:02                             ` Joe Perches
2011-01-21 21:24                             ` Daniel Walker
2011-01-21 21:24                               ` Daniel Walker
2011-01-21 21:24                               ` Daniel Walker
2011-01-22 11:18                               ` Pekka Enberg
2011-01-22 11:18                                 ` Pekka Enberg
2011-01-22 11:18                                 ` Pekka Enberg
2011-01-22 12:20                                 ` Russell King - ARM Linux
2011-01-22 12:20                                   ` Russell King - ARM Linux
2011-01-22 18:06                                   ` Dima Zavin
2011-01-22 18:06                                     ` Dima Zavin
2011-01-22 18:06                                     ` Dima Zavin
2011-01-22 18:49                                     ` Russell King - ARM Linux
2011-01-22 18:49                                       ` Russell King - ARM Linux
2011-01-22 18:49                                       ` Russell King - ARM Linux
2011-01-22 20:50                                       ` Christoph Hellwig
2011-01-22 20:50                                         ` Christoph Hellwig
2011-01-22 19:22                                   ` Brian Swetland
2011-01-22 19:22                                     ` Brian Swetland
2011-01-22 19:49                                     ` Nicolas Pitre
2011-01-22 19:49                                       ` Nicolas Pitre
2011-01-22 19:59                                       ` Brian Swetland
2011-01-22 19:59                                         ` Brian Swetland
2011-01-22 19:59                                         ` Brian Swetland
2011-01-22 20:53                                     ` Christoph Hellwig
2011-01-22 20:53                                       ` Christoph Hellwig
2011-01-22 21:04                                     ` Russell King - ARM Linux
2011-01-22 21:04                                       ` Russell King - ARM Linux
2011-01-22 21:57                                       ` Alan Cox
2011-01-22 21:57                                         ` Alan Cox
2011-01-23  2:38                                     ` David Woodhouse
2011-01-23  2:38                                       ` David Woodhouse
2011-01-22 20:41                                   ` Christoph Hellwig
2011-01-22 20:41                                     ` Christoph Hellwig
2011-01-21 21:05                           ` Pekka Enberg
2011-01-21 21:05                             ` Pekka Enberg
2011-01-21 21:05                             ` Pekka Enberg
2011-01-21 21:17                             ` Joe Perches
2011-01-21 21:17                               ` Joe Perches
2011-01-21 23:49                             ` Ted Ts'o
2011-01-21 23:49                               ` Ted Ts'o
2011-01-22  0:03                               ` Daniel Walker
2011-01-22  0:03                                 ` Daniel Walker
2011-01-22  1:58                                 ` Steven Rostedt
2011-01-22  1:58                                   ` Steven Rostedt
2011-01-22  2:13                                   ` Daniel Walker
2011-01-22  2:13                                     ` Daniel Walker
2011-01-22  2:32                                     ` Steven Rostedt
2011-01-22  2:32                                       ` Steven Rostedt
2011-01-22  2:31                                 ` Ted Ts'o
2011-01-22  2:31                                   ` Ted Ts'o
2011-01-22  8:19                               ` Pekka Enberg
2011-01-22  8:19                                 ` Pekka Enberg
2011-01-22 10:35                                 ` Dima Zavin
2011-01-22 10:35                                   ` Dima Zavin
2011-01-22 10:35                                   ` Dima Zavin
2011-01-22 10:45                                   ` Anca Emanuel
2011-01-22 10:45                                     ` Anca Emanuel
2011-01-22 10:45                                     ` Anca Emanuel
2011-01-22 11:03                                     ` Pekka Enberg
2011-01-22 11:03                                       ` Pekka Enberg
2011-01-22 11:15                                   ` Pekka Enberg
2011-01-22 11:15                                     ` Pekka Enberg
2011-01-22 17:28                                     ` Thomas Gleixner
2011-01-22 17:28                                       ` Thomas Gleixner
2011-01-22 18:07                                       ` Denis 'GNUtoo' Carikli
2011-01-22 18:07                                         ` Denis 'GNUtoo' Carikli
2011-01-22 18:07                                         ` Denis 'GNUtoo' Carikli
2011-01-22 18:15                                         ` Dima Zavin
2011-01-22 18:15                                           ` Dima Zavin
2011-01-22 18:15                                           ` Dima Zavin
2011-01-22 20:55                                 ` Christoph Hellwig
2011-01-22 20:55                                   ` Christoph Hellwig
2011-01-22 21:56                                   ` Pekka Enberg
2011-01-22 21:56                                     ` Pekka Enberg
2011-01-22 21:56                                     ` Pekka Enberg
2011-01-22 21:58                                     ` Christoph Hellwig
2011-01-22 21:58                                       ` Christoph Hellwig
2011-01-22 22:13                                       ` Pekka Enberg
2011-01-22 22:13                                         ` Pekka Enberg
2011-01-22 22:13                                         ` Pekka Enberg
2011-02-04 13:36 ` Pavel Machek
2011-02-04 13:36   ` Pavel Machek
2011-02-07 17:36   ` Daniel Walker
2011-02-07 17:36     ` Daniel Walker
2011-02-07 17:36     ` Daniel Walker

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=1295555565-21563-7-git-send-email-dwalker@codeaurora.org \
    --to=dwalker@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.