Skip to content

Commit

Permalink
Merge branch 'sh/sdhi-mfd'
Browse files Browse the repository at this point in the history
Conflicts:
	arch/sh/boards/mach-ecovec24/setup.c
	arch/sh/boards/mach-kfr2r09/setup.c
  • Loading branch information
Paul Mundt committed Oct 26, 2009
2 parents f32154c + 96987d9 commit 15893fb
Show file tree
Hide file tree
Showing 9 changed files with 355 additions and 50 deletions.
52 changes: 28 additions & 24 deletions arch/sh/boards/board-ap325rxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include <linux/i2c.h>
#include <linux/smsc911x.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <media/ov772x.h>
#include <media/soc_camera.h>
#include <media/soc_camera_platform.h>
Expand Down Expand Up @@ -409,17 +407,25 @@ static struct platform_device ceu_device = {
},
};

struct spi_gpio_platform_data sdcard_cn3_platform_data = {
.sck = GPIO_PTD0,
.mosi = GPIO_PTD1,
.miso = GPIO_PTD2,
.num_chipselect = 1,
static struct resource sdhi0_cn3_resources[] = {
[0] = {
.name = "SDHI0",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 101,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device sdcard_cn3_device = {
.name = "spi_gpio",
.dev = {
.platform_data = &sdcard_cn3_platform_data,
static struct platform_device sdhi0_cn3_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(sdhi0_cn3_resources),
.resource = sdhi0_cn3_resources,
.archdata = {
.hwblk_id = HWBLK_SDHI0,
},
};

Expand Down Expand Up @@ -470,20 +476,11 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
&lcdc_device,
&ceu_device,
&nand_flash_device,
&sdcard_cn3_device,
&sdhi0_cn3_device,
&ap325rxa_camera[0],
&ap325rxa_camera[1],
};

static struct spi_board_info ap325rxa_spi_devices[] = {
{
.modalias = "mmc_spi",
.max_speed_hz = 5000000,
.chip_select = 0,
.controller_data = (void *) GPIO_PTD5,
},
};

static int __init ap325rxa_devices_setup(void)
{
/* LD3 and LD4 LEDs */
Expand Down Expand Up @@ -578,12 +575,19 @@ static int __init ap325rxa_devices_setup(void)

platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);

/* SDHI0 */
gpio_request(GPIO_FN_SDHI0CD_PTD, NULL);
gpio_request(GPIO_FN_SDHI0WP_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D3_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D2_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D1_PTD, NULL);
gpio_request(GPIO_FN_SDHI0D0_PTD, NULL);
gpio_request(GPIO_FN_SDHI0CMD_PTD, NULL);
gpio_request(GPIO_FN_SDHI0CLK_PTD, NULL);

i2c_register_board_info(0, ap325rxa_i2c_devices,
ARRAY_SIZE(ap325rxa_i2c_devices));

spi_register_board_info(ap325rxa_spi_devices,
ARRAY_SIZE(ap325rxa_spi_devices));

return platform_add_devices(ap325rxa_devices,
ARRAY_SIZE(ap325rxa_devices));
}
Expand Down
79 changes: 78 additions & 1 deletion arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,54 @@ static struct i2c_board_info ts_i2c_clients = {
.irq = IRQ0,
};

/* SHDI0 */
static struct resource sdhi0_resources[] = {
[0] = {
.name = "SDHI0",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 101,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device sdhi0_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(sdhi0_resources),
.resource = sdhi0_resources,
.id = 0,
.archdata = {
.hwblk_id = HWBLK_SDHI0,
},
};

/* SHDI1 */
static struct resource sdhi1_resources[] = {
[0] = {
.name = "SDHI1",
.start = 0x04cf0000,
.end = 0x04cf01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 24,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device sdhi1_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(sdhi1_resources),
.resource = sdhi1_resources,
.id = 1,
.archdata = {
.hwblk_id = HWBLK_SDHI1,
},
};

static struct platform_device *ecovec_devices[] __initdata = {
&heartbeat_device,
&nor_flash_device,
Expand All @@ -438,6 +486,8 @@ static struct platform_device *ecovec_devices[] __initdata = {
&ceu0_device,
&ceu1_device,
&keysc_device,
&sdhi0_device,
&sdhi1_device,
};

#define EEPROM_ADDR 0x50
Expand Down Expand Up @@ -710,6 +760,34 @@ static int __init arch_setup(void)
gpio_direction_input(GPIO_PTR5);
gpio_direction_input(GPIO_PTR6);

/* enable SDHI0 */
gpio_request(GPIO_FN_SDHI0CD, NULL);
gpio_request(GPIO_FN_SDHI0WP, NULL);
gpio_request(GPIO_FN_SDHI0CMD, NULL);
gpio_request(GPIO_FN_SDHI0CLK, NULL);
gpio_request(GPIO_FN_SDHI0D3, NULL);
gpio_request(GPIO_FN_SDHI0D2, NULL);
gpio_request(GPIO_FN_SDHI0D1, NULL);
gpio_request(GPIO_FN_SDHI0D0, NULL);

/* enable SDHI1 */
gpio_request(GPIO_FN_SDHI1CD, NULL);
gpio_request(GPIO_FN_SDHI1WP, NULL);
gpio_request(GPIO_FN_SDHI1CMD, NULL);
gpio_request(GPIO_FN_SDHI1CLK, NULL);
gpio_request(GPIO_FN_SDHI1D3, NULL);
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);

/* I/O buffer drive ability is high for SDHI1 */
ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);

/* enable I2C device */
i2c_register_board_info(1, i2c1_devices,
ARRAY_SIZE(i2c1_devices));
Expand All @@ -726,7 +804,6 @@ static int __init devices_setup(void)
}
device_initcall(devices_setup);


static struct sh_machine_vector mv_ecovec __initmv = {
.mv_name = "R0P7724 (EcoVec)",
};
33 changes: 33 additions & 0 deletions arch/sh/boards/mach-kfr2r09/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,36 @@ static struct platform_device kfr2r09_camera = {
},
};

static struct resource kfr2r09_sh_sdhi0_resources[] = {
[0] = {
.name = "SDHI0",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 101,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device kfr2r09_sh_sdhi0_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
.resource = kfr2r09_sh_sdhi0_resources,
.archdata = {
.hwblk_id = HWBLK_SDHI0,
},
};

static struct platform_device *kfr2r09_devices[] __initdata = {
&kfr2r09_nor_flash_device,
&kfr2r09_nand_flash_device,
&kfr2r09_sh_keysc_device,
&kfr2r09_sh_lcdc_device,
&kfr2r09_ceu_device,
&kfr2r09_camera,
&kfr2r09_sh_sdhi0_device,
};

#define BSC_CS0BCR 0xfec10004
Expand Down Expand Up @@ -500,6 +523,16 @@ static int __init kfr2r09_devices_setup(void)

platform_resource_setup_memory(&kfr2r09_ceu_device, "ceu", 4 << 20);

/* SDHI0 connected to yc304 */
gpio_request(GPIO_FN_SDHI0CD, NULL);
gpio_request(GPIO_FN_SDHI0WP, NULL);
gpio_request(GPIO_FN_SDHI0D3, NULL);
gpio_request(GPIO_FN_SDHI0D2, NULL);
gpio_request(GPIO_FN_SDHI0D1, NULL);
gpio_request(GPIO_FN_SDHI0D0, NULL);
gpio_request(GPIO_FN_SDHI0CMD, NULL);
gpio_request(GPIO_FN_SDHI0CLK, NULL);

return platform_add_devices(kfr2r09_devices,
ARRAY_SIZE(kfr2r09_devices));
}
Expand Down
52 changes: 28 additions & 24 deletions arch/sh/boards/mach-migor/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <linux/delay.h>
#include <linux/clk.h>
#include <linux/gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h>
#include <video/sh_mobile_lcdc.h>
#include <media/sh_mobile_ceu.h>
#include <media/ov772x.h>
Expand Down Expand Up @@ -390,17 +388,25 @@ static struct platform_device migor_ceu_device = {
},
};

struct spi_gpio_platform_data sdcard_cn9_platform_data = {
.sck = GPIO_PTD0,
.mosi = GPIO_PTD1,
.miso = GPIO_PTD2,
.num_chipselect = 1,
static struct resource sdhi_cn9_resources[] = {
[0] = {
.name = "SDHI",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 101,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device sdcard_cn9_device = {
.name = "spi_gpio",
.dev = {
.platform_data = &sdcard_cn9_platform_data,
static struct platform_device sdhi_cn9_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(sdhi_cn9_resources),
.resource = sdhi_cn9_resources,
.archdata = {
.hwblk_id = HWBLK_SDHI,
},
};

Expand Down Expand Up @@ -467,20 +473,11 @@ static struct platform_device *migor_devices[] __initdata = {
&migor_ceu_device,
&migor_nor_flash_device,
&migor_nand_flash_device,
&sdcard_cn9_device,
&sdhi_cn9_device,
&migor_camera[0],
&migor_camera[1],
};

static struct spi_board_info migor_spi_devices[] = {
{
.modalias = "mmc_spi",
.max_speed_hz = 5000000,
.chip_select = 0,
.controller_data = (void *) GPIO_PTD5,
},
};

static int __init migor_devices_setup(void)
{

Expand Down Expand Up @@ -525,6 +522,16 @@ static int __init migor_devices_setup(void)
gpio_request(GPIO_PTA1, NULL);
gpio_direction_input(GPIO_PTA1);

/* SDHI */
gpio_request(GPIO_FN_SDHICD, NULL);
gpio_request(GPIO_FN_SDHIWP, NULL);
gpio_request(GPIO_FN_SDHID3, NULL);
gpio_request(GPIO_FN_SDHID2, NULL);
gpio_request(GPIO_FN_SDHID1, NULL);
gpio_request(GPIO_FN_SDHID0, NULL);
gpio_request(GPIO_FN_SDHICMD, NULL);
gpio_request(GPIO_FN_SDHICLK, NULL);

/* Touch Panel */
gpio_request(GPIO_FN_IRQ6, NULL);

Expand Down Expand Up @@ -612,9 +619,6 @@ static int __init migor_devices_setup(void)
i2c_register_board_info(0, migor_i2c_devices,
ARRAY_SIZE(migor_i2c_devices));

spi_register_board_info(migor_spi_devices,
ARRAY_SIZE(migor_spi_devices));

return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
}
arch_initcall(migor_devices_setup);
Expand Down
33 changes: 33 additions & 0 deletions arch/sh/boards/mach-se/7724/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,28 @@ static struct platform_device sh7724_usb1_gadget_device = {
.resource = sh7724_usb1_gadget_resources,
};

static struct resource sdhi0_cn7_resources[] = {
[0] = {
.name = "SDHI0",
.start = 0x04ce0000,
.end = 0x04ce01ff,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = 101,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device sdhi0_cn7_device = {
.name = "sh_mobile_sdhi",
.num_resources = ARRAY_SIZE(sdhi0_cn7_resources),
.resource = sdhi0_cn7_resources,
.archdata = {
.hwblk_id = HWBLK_SDHI0,
},
};

static struct platform_device *ms7724se_devices[] __initdata = {
&heartbeat_device,
&smc91x_eth_device,
Expand All @@ -460,6 +482,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
&sh7724_usb0_host_device,
&sh7724_usb1_gadget_device,
&fsi_device,
&sdhi0_cn7_device,
};

#define EEPROM_OP 0xBA206000
Expand Down Expand Up @@ -698,6 +721,16 @@ static int __init devices_setup(void)
clk_set_rate(&fsimcka_clk, 11000);
clk_put(fsia_clk);

/* SDHI0 connected to cn7 */
gpio_request(GPIO_FN_SDHI0CD, NULL);
gpio_request(GPIO_FN_SDHI0WP, NULL);
gpio_request(GPIO_FN_SDHI0D3, NULL);
gpio_request(GPIO_FN_SDHI0D2, NULL);
gpio_request(GPIO_FN_SDHI0D1, NULL);
gpio_request(GPIO_FN_SDHI0D0, NULL);
gpio_request(GPIO_FN_SDHI0CMD, NULL);
gpio_request(GPIO_FN_SDHI0CLK, NULL);

/*
* enable SH-Eth
*
Expand Down
Loading

0 comments on commit 15893fb

Please sign in to comment.