linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: Add SDHI power control support to Ecovec
Date: Fri, 27 Nov 2009 04:36:58 +0000	[thread overview]
Message-ID: <20091127043658.13573.80166.sendpatchset@rxone.opensource.se> (raw)

From: Magnus Damm <damm@opensource.se>

This patch adds support for SDHI power control to the
Ecovec board. Platform data and power control callbacks
for SDHI0 and SDHI1 are added. Power is by default off.

Signed-off-by: Magnus Damm <damm@opensource.se>
---

 Depends on the SDHI power control patch.

 arch/sh/boards/mach-ecovec24/setup.c |   36 ++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

--- 0012/arch/sh/boards/mach-ecovec24/setup.c
+++ work/arch/sh/boards/mach-ecovec24/setup.c	2009-11-26 17:57:38.000000000 +0900
@@ -20,6 +20,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/tsc2007.h>
 #include <linux/input.h>
+#include <linux/mfd/sh_mobile_sdhi.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/tw9910.h>
@@ -423,6 +424,15 @@ static struct i2c_board_info ts_i2c_clie
 };
 
 /* SHDI0 */
+static void sdhi0_set_pwr(struct platform_device *pdev, int state)
+{
+	gpio_set_value(GPIO_PTB6, state);
+}
+
+static struct sh_mobile_sdhi_info sdhi0_info = {
+	.set_pwr = sdhi0_set_pwr,
+};
+
 static struct resource sdhi0_resources[] = {
 	[0] = {
 		.name	= "SDHI0",
@@ -441,12 +451,24 @@ static struct platform_device sdhi0_devi
 	.num_resources  = ARRAY_SIZE(sdhi0_resources),
 	.resource       = sdhi0_resources,
 	.id             = 0,
+	.dev	= {
+		.platform_data	= &sdhi0_info,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI0,
 	},
 };
 
 /* SHDI1 */
+static void sdhi1_set_pwr(struct platform_device *pdev, int state)
+{
+	gpio_set_value(GPIO_PTB7, state);
+}
+
+static struct sh_mobile_sdhi_info sdhi1_info = {
+	.set_pwr = sdhi1_set_pwr,
+};
+
 static struct resource sdhi1_resources[] = {
 	[0] = {
 		.name	= "SDHI1",
@@ -465,6 +487,9 @@ static struct platform_device sdhi1_devi
 	.num_resources  = ARRAY_SIZE(sdhi1_resources),
 	.resource       = sdhi1_resources,
 	.id             = 1,
+	.dev	= {
+		.platform_data	= &sdhi1_info,
+	},
 	.archdata = {
 		.hwblk_id = HWBLK_SDHI1,
 	},
@@ -865,7 +890,7 @@ static int __init arch_setup(void)
 	gpio_direction_input(GPIO_PTR5);
 	gpio_direction_input(GPIO_PTR6);
 
-	/* enable SDHI0 */
+	/* enable SDHI0 (needs DS2.4 set to ON) */
 	gpio_request(GPIO_FN_SDHI0CD,  NULL);
 	gpio_request(GPIO_FN_SDHI0WP,  NULL);
 	gpio_request(GPIO_FN_SDHI0CMD, NULL);
@@ -874,8 +899,10 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI0D2,  NULL);
 	gpio_request(GPIO_FN_SDHI0D1,  NULL);
 	gpio_request(GPIO_FN_SDHI0D0,  NULL);
+	gpio_request(GPIO_PTB6, NULL);
+	gpio_direction_output(GPIO_PTB6, 0);
 
-	/* enable SDHI1 */
+	/* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */
 	gpio_request(GPIO_FN_SDHI1CD,  NULL);
 	gpio_request(GPIO_FN_SDHI1WP,  NULL);
 	gpio_request(GPIO_FN_SDHI1CMD, NULL);
@@ -884,11 +911,8 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI1D2,  NULL);
 	gpio_request(GPIO_FN_SDHI1D1,  NULL);
 	gpio_request(GPIO_FN_SDHI1D0,  NULL);
-
-	gpio_request(GPIO_PTB6, NULL);
 	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB6, 1);
-	gpio_direction_output(GPIO_PTB7, 1);
+	gpio_direction_output(GPIO_PTB7, 0);
 
 	/* I/O buffer drive ability is high for SDHI1 */
 	ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);

         reply	other threads:[~2009-11-27  4:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-27  9:28 [PATCH] sh: Improve kfr2r09 serial port setup code Magnus Damm
2009-11-27  7:38 ` [PATCH] sh: Break out SuperH PFC code Magnus Damm
2009-11-27  7:32   ` [PATCH] sh: Move KEYSC header file Magnus Damm
2009-11-27  5:16     ` [PATCH] sh: Add CPG save/restore code for sh7724 R-standby Magnus Damm
2009-11-27  4:36       ` Magnus Damm [this message]
2009-11-27  4:31         ` [PATCH] mfd: Add power control platform data to SDHI driver Magnus Damm
2009-11-27 19:47           ` Samuel Ortiz
2009-11-28 13:10           ` Magnus Damm
2009-11-29 23:56           ` Samuel Ortiz
2009-11-30  3:05           ` Paul Mundt
2009-11-28  1:43     ` [PATCH] sh: Move KEYSC header file Dmitry Torokhov

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=20091127043658.13573.80166.sendpatchset@rxone.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=linux-sh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).