aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-11-26 23:36:58 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-11-29 22:02:48 -0500
commit98779ad8226c6f6e301fa186c07247e78c6f7253 (patch)
tree5c85cb597c5706ad55d32782469924176f34d0d2 /arch/sh
parentbe9cd7b6f84fd0cc59c8770771073b5c66f958ac (diff)
sh: Add SDHI power control support to Ecovec
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> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 2274985753a4..5932f049e782 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -20,6 +20,7 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/i2c/tsc2007.h> 21#include <linux/i2c/tsc2007.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/mfd/sh_mobile_sdhi.h>
23#include <video/sh_mobile_lcdc.h> 24#include <video/sh_mobile_lcdc.h>
24#include <media/sh_mobile_ceu.h> 25#include <media/sh_mobile_ceu.h>
25#include <asm/heartbeat.h> 26#include <asm/heartbeat.h>
@@ -421,6 +422,15 @@ static struct i2c_board_info ts_i2c_clients = {
421}; 422};
422 423
423/* SHDI0 */ 424/* SHDI0 */
425static void sdhi0_set_pwr(struct platform_device *pdev, int state)
426{
427 gpio_set_value(GPIO_PTB6, state);
428}
429
430static struct sh_mobile_sdhi_info sdhi0_info = {
431 .set_pwr = sdhi0_set_pwr,
432};
433
424static struct resource sdhi0_resources[] = { 434static struct resource sdhi0_resources[] = {
425 [0] = { 435 [0] = {
426 .name = "SDHI0", 436 .name = "SDHI0",
@@ -439,12 +449,24 @@ static struct platform_device sdhi0_device = {
439 .num_resources = ARRAY_SIZE(sdhi0_resources), 449 .num_resources = ARRAY_SIZE(sdhi0_resources),
440 .resource = sdhi0_resources, 450 .resource = sdhi0_resources,
441 .id = 0, 451 .id = 0,
452 .dev = {
453 .platform_data = &sdhi0_info,
454 },
442 .archdata = { 455 .archdata = {
443 .hwblk_id = HWBLK_SDHI0, 456 .hwblk_id = HWBLK_SDHI0,
444 }, 457 },
445}; 458};
446 459
447/* SHDI1 */ 460/* SHDI1 */
461static void sdhi1_set_pwr(struct platform_device *pdev, int state)
462{
463 gpio_set_value(GPIO_PTB7, state);
464}
465
466static struct sh_mobile_sdhi_info sdhi1_info = {
467 .set_pwr = sdhi1_set_pwr,
468};
469
448static struct resource sdhi1_resources[] = { 470static struct resource sdhi1_resources[] = {
449 [0] = { 471 [0] = {
450 .name = "SDHI1", 472 .name = "SDHI1",
@@ -463,6 +485,9 @@ static struct platform_device sdhi1_device = {
463 .num_resources = ARRAY_SIZE(sdhi1_resources), 485 .num_resources = ARRAY_SIZE(sdhi1_resources),
464 .resource = sdhi1_resources, 486 .resource = sdhi1_resources,
465 .id = 1, 487 .id = 1,
488 .dev = {
489 .platform_data = &sdhi1_info,
490 },
466 .archdata = { 491 .archdata = {
467 .hwblk_id = HWBLK_SDHI1, 492 .hwblk_id = HWBLK_SDHI1,
468 }, 493 },
@@ -748,7 +773,7 @@ static int __init arch_setup(void)
748 gpio_direction_input(GPIO_PTR5); 773 gpio_direction_input(GPIO_PTR5);
749 gpio_direction_input(GPIO_PTR6); 774 gpio_direction_input(GPIO_PTR6);
750 775
751 /* enable SDHI0 */ 776 /* enable SDHI0 (needs DS2.4 set to ON) */
752 gpio_request(GPIO_FN_SDHI0CD, NULL); 777 gpio_request(GPIO_FN_SDHI0CD, NULL);
753 gpio_request(GPIO_FN_SDHI0WP, NULL); 778 gpio_request(GPIO_FN_SDHI0WP, NULL);
754 gpio_request(GPIO_FN_SDHI0CMD, NULL); 779 gpio_request(GPIO_FN_SDHI0CMD, NULL);
@@ -757,8 +782,10 @@ static int __init arch_setup(void)
757 gpio_request(GPIO_FN_SDHI0D2, NULL); 782 gpio_request(GPIO_FN_SDHI0D2, NULL);
758 gpio_request(GPIO_FN_SDHI0D1, NULL); 783 gpio_request(GPIO_FN_SDHI0D1, NULL);
759 gpio_request(GPIO_FN_SDHI0D0, NULL); 784 gpio_request(GPIO_FN_SDHI0D0, NULL);
785 gpio_request(GPIO_PTB6, NULL);
786 gpio_direction_output(GPIO_PTB6, 0);
760 787
761 /* enable SDHI1 */ 788 /* enable SDHI1 (needs DS2.6,7 set to ON,OFF) */
762 gpio_request(GPIO_FN_SDHI1CD, NULL); 789 gpio_request(GPIO_FN_SDHI1CD, NULL);
763 gpio_request(GPIO_FN_SDHI1WP, NULL); 790 gpio_request(GPIO_FN_SDHI1WP, NULL);
764 gpio_request(GPIO_FN_SDHI1CMD, NULL); 791 gpio_request(GPIO_FN_SDHI1CMD, NULL);
@@ -767,11 +794,8 @@ static int __init arch_setup(void)
767 gpio_request(GPIO_FN_SDHI1D2, NULL); 794 gpio_request(GPIO_FN_SDHI1D2, NULL);
768 gpio_request(GPIO_FN_SDHI1D1, NULL); 795 gpio_request(GPIO_FN_SDHI1D1, NULL);
769 gpio_request(GPIO_FN_SDHI1D0, NULL); 796 gpio_request(GPIO_FN_SDHI1D0, NULL);
770
771 gpio_request(GPIO_PTB6, NULL);
772 gpio_request(GPIO_PTB7, NULL); 797 gpio_request(GPIO_PTB7, NULL);
773 gpio_direction_output(GPIO_PTB6, 1); 798 gpio_direction_output(GPIO_PTB7, 0);
774 gpio_direction_output(GPIO_PTB7, 1);
775 799
776 /* I/O buffer drive ability is high for SDHI1 */ 800 /* I/O buffer drive ability is high for SDHI1 */
777 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); 801 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);