aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/Kconfig12
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c82
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c48
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c454
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c10
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c52
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c30
-rw-r--r--arch/arm/mach-shmobile/board-kzm9d.c10
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c320
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c59
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c10
11 files changed, 1003 insertions, 84 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index eedb0d1888c3..4cacc2d22fbe 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -59,6 +59,7 @@ config MACH_G4EVM
59 bool "G4EVM board" 59 bool "G4EVM board"
60 depends on ARCH_SH7377 60 depends on ARCH_SH7377
61 select ARCH_REQUIRE_GPIOLIB 61 select ARCH_REQUIRE_GPIOLIB
62 select REGULATOR_FIXED_VOLTAGE if REGULATOR
62 63
63config MACH_AP4EVB 64config MACH_AP4EVB
64 bool "AP4EVB board" 65 bool "AP4EVB board"
@@ -66,6 +67,7 @@ config MACH_AP4EVB
66 select ARCH_REQUIRE_GPIOLIB 67 select ARCH_REQUIRE_GPIOLIB
67 select SH_LCD_MIPI_DSI 68 select SH_LCD_MIPI_DSI
68 select SND_SOC_AK4642 if SND_SIMPLE_CARD 69 select SND_SOC_AK4642 if SND_SIMPLE_CARD
70 select REGULATOR_FIXED_VOLTAGE if REGULATOR
69 71
70choice 72choice
71 prompt "AP4EVB LCD panel selection" 73 prompt "AP4EVB LCD panel selection"
@@ -84,6 +86,7 @@ config MACH_AG5EVM
84 bool "AG5EVM board" 86 bool "AG5EVM board"
85 select ARCH_REQUIRE_GPIOLIB 87 select ARCH_REQUIRE_GPIOLIB
86 select SH_LCD_MIPI_DSI 88 select SH_LCD_MIPI_DSI
89 select REGULATOR_FIXED_VOLTAGE if REGULATOR
87 depends on ARCH_SH73A0 90 depends on ARCH_SH73A0
88 91
89config MACH_MACKEREL 92config MACH_MACKEREL
@@ -91,15 +94,18 @@ config MACH_MACKEREL
91 depends on ARCH_SH7372 94 depends on ARCH_SH7372
92 select ARCH_REQUIRE_GPIOLIB 95 select ARCH_REQUIRE_GPIOLIB
93 select SND_SOC_AK4642 if SND_SIMPLE_CARD 96 select SND_SOC_AK4642 if SND_SIMPLE_CARD
97 select REGULATOR_FIXED_VOLTAGE if REGULATOR
94 98
95config MACH_KOTA2 99config MACH_KOTA2
96 bool "KOTA2 board" 100 bool "KOTA2 board"
97 select ARCH_REQUIRE_GPIOLIB 101 select ARCH_REQUIRE_GPIOLIB
102 select REGULATOR_FIXED_VOLTAGE if REGULATOR
98 depends on ARCH_SH73A0 103 depends on ARCH_SH73A0
99 104
100config MACH_BONITO 105config MACH_BONITO
101 bool "bonito board" 106 bool "bonito board"
102 select ARCH_REQUIRE_GPIOLIB 107 select ARCH_REQUIRE_GPIOLIB
108 select REGULATOR_FIXED_VOLTAGE if REGULATOR
103 depends on ARCH_R8A7740 109 depends on ARCH_R8A7740
104 110
105config MACH_ARMADILLO800EVA 111config MACH_ARMADILLO800EVA
@@ -107,22 +113,28 @@ config MACH_ARMADILLO800EVA
107 depends on ARCH_R8A7740 113 depends on ARCH_R8A7740
108 select ARCH_REQUIRE_GPIOLIB 114 select ARCH_REQUIRE_GPIOLIB
109 select USE_OF 115 select USE_OF
116 select REGULATOR_FIXED_VOLTAGE if REGULATOR
117 select SND_SOC_WM8978 if SND_SIMPLE_CARD
110 118
111config MACH_MARZEN 119config MACH_MARZEN
112 bool "MARZEN board" 120 bool "MARZEN board"
113 depends on ARCH_R8A7779 121 depends on ARCH_R8A7779
114 select ARCH_REQUIRE_GPIOLIB 122 select ARCH_REQUIRE_GPIOLIB
123 select REGULATOR_FIXED_VOLTAGE if REGULATOR
115 124
116config MACH_KZM9D 125config MACH_KZM9D
117 bool "KZM9D board" 126 bool "KZM9D board"
118 depends on ARCH_EMEV2 127 depends on ARCH_EMEV2
119 select USE_OF 128 select USE_OF
129 select REGULATOR_FIXED_VOLTAGE if REGULATOR
120 130
121config MACH_KZM9G 131config MACH_KZM9G
122 bool "KZM-A9-GT board" 132 bool "KZM-A9-GT board"
123 depends on ARCH_SH73A0 133 depends on ARCH_SH73A0
124 select ARCH_REQUIRE_GPIOLIB 134 select ARCH_REQUIRE_GPIOLIB
125 select USE_OF 135 select USE_OF
136 select SND_SOC_AK4642 if SND_SIMPLE_CARD
137 select REGULATOR_FIXED_VOLTAGE if REGULATOR
126 138
127comment "SH-Mobile System Configuration" 139comment "SH-Mobile System Configuration"
128 140
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 5a6f22f05e99..d82c010fdfc6 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -27,6 +27,8 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
30#include <linux/serial_sci.h> 32#include <linux/serial_sci.h>
31#include <linux/smsc911x.h> 33#include <linux/smsc911x.h>
32#include <linux/gpio.h> 34#include <linux/gpio.h>
@@ -52,6 +54,12 @@
52#include <asm/hardware/cache-l2x0.h> 54#include <asm/hardware/cache-l2x0.h>
53#include <asm/traps.h> 55#include <asm/traps.h>
54 56
57/* Dummy supplies, where voltage doesn't matter */
58static struct regulator_consumer_supply dummy_supplies[] = {
59 REGULATOR_SUPPLY("vddvario", "smsc911x"),
60 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
61};
62
55static struct resource smsc9220_resources[] = { 63static struct resource smsc9220_resources[] = {
56 [0] = { 64 [0] = {
57 .start = 0x14000000, 65 .start = 0x14000000,
@@ -142,6 +150,13 @@ static struct platform_device fsi_device = {
142 .resource = fsi_resources, 150 .resource = fsi_resources,
143}; 151};
144 152
153/* Fixed 1.8V regulator to be used by MMCIF */
154static struct regulator_consumer_supply fixed1v8_power_consumers[] =
155{
156 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
157 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
158};
159
145static struct resource sh_mmcif_resources[] = { 160static struct resource sh_mmcif_resources[] = {
146 [0] = { 161 [0] = {
147 .name = "MMCIF", 162 .name = "MMCIF",
@@ -364,6 +379,13 @@ static struct platform_device mipidsi0_device = {
364 }, 379 },
365}; 380};
366 381
382/* Fixed 2.8V regulators to be used by SDHI0 */
383static struct regulator_consumer_supply fixed2v8_power_consumers[] =
384{
385 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
386 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
387};
388
367/* SDHI0 */ 389/* SDHI0 */
368static struct sh_mobile_sdhi_info sdhi0_info = { 390static struct sh_mobile_sdhi_info sdhi0_info = {
369 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 391 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
@@ -408,8 +430,57 @@ static struct platform_device sdhi0_device = {
408 }, 430 },
409}; 431};
410 432
411void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state) 433/* Fixed 3.3V regulator to be used by SDHI1 */
434static struct regulator_consumer_supply cn4_power_consumers[] =
412{ 435{
436 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
437 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
438};
439
440static struct regulator_init_data cn4_power_init_data = {
441 .constraints = {
442 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
443 },
444 .num_consumer_supplies = ARRAY_SIZE(cn4_power_consumers),
445 .consumer_supplies = cn4_power_consumers,
446};
447
448static struct fixed_voltage_config cn4_power_info = {
449 .supply_name = "CN4 SD/MMC Vdd",
450 .microvolts = 3300000,
451 .gpio = GPIO_PORT114,
452 .enable_high = 1,
453 .init_data = &cn4_power_init_data,
454};
455
456static struct platform_device cn4_power = {
457 .name = "reg-fixed-voltage",
458 .id = 2,
459 .dev = {
460 .platform_data = &cn4_power_info,
461 },
462};
463
464static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
465{
466 static int power_gpio = -EINVAL;
467
468 if (power_gpio < 0) {
469 int ret = gpio_request(GPIO_PORT114, "sdhi1_power");
470 if (!ret) {
471 power_gpio = GPIO_PORT114;
472 gpio_direction_output(power_gpio, 0);
473 }
474 }
475
476 /*
477 * If requesting the GPIO above failed, it means, that the regulator got
478 * probed and grabbed the GPIO, but we don't know, whether the sdhi
479 * driver already uses the regulator. If it doesn't, we have to toggle
480 * the GPIO ourselves, even though it is now owned by the fixed
481 * regulator driver. We have to live with the race in case the driver
482 * gets unloaded and the GPIO freed between these two steps.
483 */
413 gpio_set_value(GPIO_PORT114, state); 484 gpio_set_value(GPIO_PORT114, state);
414} 485}
415 486
@@ -455,6 +526,7 @@ static struct platform_device sdhi1_device = {
455}; 526};
456 527
457static struct platform_device *ag5evm_devices[] __initdata = { 528static struct platform_device *ag5evm_devices[] __initdata = {
529 &cn4_power,
458 &eth_device, 530 &eth_device,
459 &keysc_device, 531 &keysc_device,
460 &fsi_device, 532 &fsi_device,
@@ -468,6 +540,12 @@ static struct platform_device *ag5evm_devices[] __initdata = {
468 540
469static void __init ag5evm_init(void) 541static void __init ag5evm_init(void)
470{ 542{
543 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
544 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
545 regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers,
546 ARRAY_SIZE(fixed2v8_power_consumers), 3300000);
547 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
548
471 sh73a0_pinmux_init(); 549 sh73a0_pinmux_init();
472 550
473 /* enable SCIFA2 */ 551 /* enable SCIFA2 */
@@ -562,8 +640,6 @@ static void __init ag5evm_init(void)
562 gpio_request(GPIO_FN_SDHID1_2_PU, NULL); 640 gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
563 gpio_request(GPIO_FN_SDHID1_1_PU, NULL); 641 gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
564 gpio_request(GPIO_FN_SDHID1_0_PU, NULL); 642 gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
565 gpio_request(GPIO_PORT114, "sdhi1_power");
566 gpio_direction_output(GPIO_PORT114, 0);
567 643
568#ifdef CONFIG_CACHE_L2X0 644#ifdef CONFIG_CACHE_L2X0
569 /* Shared attribute override enable, 64K*8way */ 645 /* Shared attribute override enable, 64K*8way */
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 7cac1df3085c..f172ca85905c 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -34,6 +34,8 @@
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/i2c/tsc2007.h> 35#include <linux/i2c/tsc2007.h>
36#include <linux/io.h> 36#include <linux/io.h>
37#include <linux/regulator/fixed.h>
38#include <linux/regulator/machine.h>
37#include <linux/smsc911x.h> 39#include <linux/smsc911x.h>
38#include <linux/sh_intc.h> 40#include <linux/sh_intc.h>
39#include <linux/sh_clk.h> 41#include <linux/sh_clk.h>
@@ -159,6 +161,27 @@
159 * CN12: 3.3v 161 * CN12: 3.3v
160 */ 162 */
161 163
164/* Dummy supplies, where voltage doesn't matter */
165static struct regulator_consumer_supply fixed1v8_power_consumers[] =
166{
167 /* J22 default position: 1.8V */
168 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
169 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
170 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
171 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
172};
173
174static struct regulator_consumer_supply fixed3v3_power_consumers[] =
175{
176 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
177 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
178};
179
180static struct regulator_consumer_supply dummy_supplies[] = {
181 REGULATOR_SUPPLY("vddvario", "smsc911x"),
182 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
183};
184
162/* MTD */ 185/* MTD */
163static struct mtd_partition nor_flash_partitions[] = { 186static struct mtd_partition nor_flash_partitions[] = {
164 { 187 {
@@ -1138,21 +1161,6 @@ static void __init fsi_init_pm_clock(void)
1138 clk_put(fsia_ick); 1161 clk_put(fsia_ick);
1139} 1162}
1140 1163
1141/*
1142 * FIXME !!
1143 *
1144 * gpio_no_direction
1145 * are quick_hack.
1146 *
1147 * current gpio frame work doesn't have
1148 * the method to control only pull up/down/free.
1149 * this function should be replaced by correct gpio function
1150 */
1151static void __init gpio_no_direction(u32 addr)
1152{
1153 __raw_writeb(0x00, addr);
1154}
1155
1156/* TouchScreen */ 1164/* TouchScreen */
1157#ifdef CONFIG_AP4EVB_QHD 1165#ifdef CONFIG_AP4EVB_QHD
1158# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123 1166# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
@@ -1224,6 +1232,12 @@ static void __init ap4evb_init(void)
1224 u32 srcr4; 1232 u32 srcr4;
1225 struct clk *clk; 1233 struct clk *clk;
1226 1234
1235 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
1236 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
1237 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
1238 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1239 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1240
1227 /* External clock source */ 1241 /* External clock source */
1228 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1242 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1229 1243
@@ -1302,8 +1316,8 @@ static void __init ap4evb_init(void)
1302 1316
1303 gpio_request(GPIO_PORT9, NULL); 1317 gpio_request(GPIO_PORT9, NULL);
1304 gpio_request(GPIO_PORT10, NULL); 1318 gpio_request(GPIO_PORT10, NULL);
1305 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1319 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1306 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1320 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1307 1321
1308 /* card detect pin for MMC slot (CN7) */ 1322 /* card detect pin for MMC slot (CN7) */
1309 gpio_request(GPIO_PORT41, NULL); 1323 gpio_request(GPIO_PORT41, NULL);
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index d131e12c9ac8..cf10f92856dc 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -28,6 +28,8 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h>
31#include <linux/sh_eth.h> 33#include <linux/sh_eth.h>
32#include <linux/videodev2.h> 34#include <linux/videodev2.h>
33#include <linux/usb/renesas_usbhs.h> 35#include <linux/usb/renesas_usbhs.h>
@@ -37,14 +39,20 @@
37#include <linux/mmc/sh_mobile_sdhi.h> 39#include <linux/mmc/sh_mobile_sdhi.h>
38#include <mach/common.h> 40#include <mach/common.h>
39#include <mach/irqs.h> 41#include <mach/irqs.h>
42#include <mach/r8a7740.h>
43#include <media/mt9t112.h>
44#include <media/sh_mobile_ceu.h>
45#include <media/soc_camera.h>
40#include <asm/page.h> 46#include <asm/page.h>
41#include <asm/mach-types.h> 47#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 48#include <asm/mach/arch.h>
43#include <asm/mach/map.h> 49#include <asm/mach/map.h>
44#include <asm/mach/time.h> 50#include <asm/mach/time.h>
45#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
46#include <mach/r8a7740.h>
47#include <video/sh_mobile_lcdc.h> 52#include <video/sh_mobile_lcdc.h>
53#include <video/sh_mobile_hdmi.h>
54#include <sound/sh_fsi.h>
55#include <sound/simple_card.h>
48 56
49/* 57/*
50 * CON1 Camera Module 58 * CON1 Camera Module
@@ -108,6 +116,14 @@
108 */ 116 */
109 117
110/* 118/*
119 * FSI-WM8978
120 *
121 * this command is required when playback.
122 *
123 * # amixer set "Headphone" 50
124 */
125
126/*
111 * USB function 127 * USB function
112 * 128 *
113 * When you use USB Function, 129 * When you use USB Function,
@@ -117,14 +133,8 @@
117 * These are a little bit complex. 133 * These are a little bit complex.
118 * see 134 * see
119 * usbhsf_power_ctrl() 135 * usbhsf_power_ctrl()
120 *
121 * CAUTION
122 *
123 * It uses autonomy mode for USB hotplug at this point
124 * (= usbhs_private.platform_callback.get_vbus is NULL),
125 * since we don't know what's happen on PM control
126 * on this workaround.
127 */ 136 */
137#define IRQ7 evt2irq(0x02e0)
128#define USBCR1 0xe605810a 138#define USBCR1 0xe605810a
129#define USBH 0xC6700000 139#define USBH 0xC6700000
130#define USBH_USBCTR 0x10834 140#define USBH_USBCTR 0x10834
@@ -204,6 +214,20 @@ static void usbhsf_power_ctrl(struct platform_device *pdev,
204 } 214 }
205} 215}
206 216
217static int usbhsf_get_vbus(struct platform_device *pdev)
218{
219 return gpio_get_value(GPIO_PORT209);
220}
221
222static irqreturn_t usbhsf_interrupt(int irq, void *data)
223{
224 struct platform_device *pdev = data;
225
226 renesas_usbhs_call_notify_hotplug(pdev);
227
228 return IRQ_HANDLED;
229}
230
207static void usbhsf_hardware_exit(struct platform_device *pdev) 231static void usbhsf_hardware_exit(struct platform_device *pdev)
208{ 232{
209 struct usbhsf_private *priv = usbhsf_get_priv(pdev); 233 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
@@ -227,11 +251,14 @@ static void usbhsf_hardware_exit(struct platform_device *pdev)
227 priv->host = NULL; 251 priv->host = NULL;
228 priv->func = NULL; 252 priv->func = NULL;
229 priv->usbh_base = NULL; 253 priv->usbh_base = NULL;
254
255 free_irq(IRQ7, pdev);
230} 256}
231 257
232static int usbhsf_hardware_init(struct platform_device *pdev) 258static int usbhsf_hardware_init(struct platform_device *pdev)
233{ 259{
234 struct usbhsf_private *priv = usbhsf_get_priv(pdev); 260 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
261 int ret;
235 262
236 priv->phy = clk_get(&pdev->dev, "phy"); 263 priv->phy = clk_get(&pdev->dev, "phy");
237 priv->usb24 = clk_get(&pdev->dev, "usb24"); 264 priv->usb24 = clk_get(&pdev->dev, "usb24");
@@ -251,6 +278,14 @@ static int usbhsf_hardware_init(struct platform_device *pdev)
251 return -EIO; 278 return -EIO;
252 } 279 }
253 280
281 ret = request_irq(IRQ7, usbhsf_interrupt, IRQF_TRIGGER_NONE,
282 dev_name(&pdev->dev), pdev);
283 if (ret) {
284 dev_err(&pdev->dev, "request_irq err\n");
285 return ret;
286 }
287 irq_set_irq_type(IRQ7, IRQ_TYPE_EDGE_BOTH);
288
254 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */ 289 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
255 clk_set_rate(priv->usb24, 290 clk_set_rate(priv->usb24,
256 clk_get_rate(clk_get_parent(priv->usb24))); 291 clk_get_rate(clk_get_parent(priv->usb24)));
@@ -262,6 +297,7 @@ static struct usbhsf_private usbhsf_private = {
262 .info = { 297 .info = {
263 .platform_callback = { 298 .platform_callback = {
264 .get_id = usbhsf_get_id, 299 .get_id = usbhsf_get_id,
300 .get_vbus = usbhsf_get_vbus,
265 .hardware_init = usbhsf_hardware_init, 301 .hardware_init = usbhsf_hardware_init,
266 .hardware_exit = usbhsf_hardware_exit, 302 .hardware_exit = usbhsf_hardware_exit,
267 .power_ctrl = usbhsf_power_ctrl, 303 .power_ctrl = usbhsf_power_ctrl,
@@ -269,6 +305,8 @@ static struct usbhsf_private usbhsf_private = {
269 .driver_param = { 305 .driver_param = {
270 .buswait_bwait = 5, 306 .buswait_bwait = 5,
271 .detection_delay = 5, 307 .detection_delay = 5,
308 .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
309 .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
272 }, 310 },
273 } 311 }
274}; 312};
@@ -384,6 +422,103 @@ static struct platform_device lcdc0_device = {
384 }, 422 },
385}; 423};
386 424
425/*
426 * LCDC1/HDMI
427 */
428static struct sh_mobile_hdmi_info hdmi_info = {
429 .flags = HDMI_OUTPUT_PUSH_PULL |
430 HDMI_OUTPUT_POLARITY_HI |
431 HDMI_32BIT_REG |
432 HDMI_HAS_HTOP1 |
433 HDMI_SND_SRC_SPDIF,
434};
435
436static struct resource hdmi_resources[] = {
437 [0] = {
438 .name = "HDMI",
439 .start = 0xe6be0000,
440 .end = 0xe6be03ff,
441 .flags = IORESOURCE_MEM,
442 },
443 [1] = {
444 .start = evt2irq(0x1700),
445 .flags = IORESOURCE_IRQ,
446 },
447 [2] = {
448 .name = "HDMI emma3pf",
449 .start = 0xe6be4000,
450 .end = 0xe6be43ff,
451 .flags = IORESOURCE_MEM,
452 },
453};
454
455static struct platform_device hdmi_device = {
456 .name = "sh-mobile-hdmi",
457 .num_resources = ARRAY_SIZE(hdmi_resources),
458 .resource = hdmi_resources,
459 .id = -1,
460 .dev = {
461 .platform_data = &hdmi_info,
462 },
463};
464
465static const struct fb_videomode lcdc1_mode = {
466 .name = "HDMI 720p",
467 .xres = 1280,
468 .yres = 720,
469 .pixclock = 13468,
470 .left_margin = 220,
471 .right_margin = 110,
472 .hsync_len = 40,
473 .upper_margin = 20,
474 .lower_margin = 5,
475 .vsync_len = 5,
476 .refresh = 60,
477 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
478};
479
480static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
481 .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
482 .ch[0] = {
483 .chan = LCDC_CHAN_MAINLCD,
484 .fourcc = V4L2_PIX_FMT_RGB565,
485 .interface_type = RGB24,
486 .clock_divider = 1,
487 .flags = LCDC_FLAGS_DWPOL,
488 .lcd_modes = &lcdc1_mode,
489 .num_modes = 1,
490 .tx_dev = &hdmi_device,
491 .panel_cfg = {
492 .width = 1280,
493 .height = 720,
494 },
495 },
496};
497
498static struct resource hdmi_lcdc_resources[] = {
499 [0] = {
500 .name = "LCDC1",
501 .start = 0xfe944000,
502 .end = 0xfe948000 - 1,
503 .flags = IORESOURCE_MEM,
504 },
505 [1] = {
506 .start = intcs_evt2irq(0x1780),
507 .flags = IORESOURCE_IRQ,
508 },
509};
510
511static struct platform_device hdmi_lcdc_device = {
512 .name = "sh_mobile_lcdc_fb",
513 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
514 .resource = hdmi_lcdc_resources,
515 .id = 1,
516 .dev = {
517 .platform_data = &hdmi_lcdc_info,
518 .coherent_dma_mask = ~0,
519 },
520};
521
387/* GPIO KEY */ 522/* GPIO KEY */
388#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } 523#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
389 524
@@ -407,6 +542,17 @@ static struct platform_device gpio_keys_device = {
407 }, 542 },
408}; 543};
409 544
545/* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */
546static struct regulator_consumer_supply fixed3v3_power_consumers[] =
547{
548 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
549 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
550 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
551 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
552 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
553 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
554};
555
410/* SDHI0 */ 556/* SDHI0 */
411/* 557/*
412 * FIXME 558 * FIXME
@@ -418,6 +564,8 @@ static struct platform_device gpio_keys_device = {
418 */ 564 */
419#define IRQ31 evt2irq(0x33E0) 565#define IRQ31 evt2irq(0x33E0)
420static struct sh_mobile_sdhi_info sdhi0_info = { 566static struct sh_mobile_sdhi_info sdhi0_info = {
567 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
568 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
421 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\ 569 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
422 MMC_CAP_NEEDS_POLL, 570 MMC_CAP_NEEDS_POLL,
423 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 571 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -458,6 +606,8 @@ static struct platform_device sdhi0_device = {
458 606
459/* SDHI1 */ 607/* SDHI1 */
460static struct sh_mobile_sdhi_info sdhi1_info = { 608static struct sh_mobile_sdhi_info sdhi1_info = {
609 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
610 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
461 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 611 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
462 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34, 612 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
463 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 613 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
@@ -532,12 +682,209 @@ static struct platform_device sh_mmcif_device = {
532 .resource = sh_mmcif_resources, 682 .resource = sh_mmcif_resources,
533}; 683};
534 684
685/* Camera */
686static int mt9t111_power(struct device *dev, int mode)
687{
688 struct clk *mclk = clk_get(NULL, "video1");
689
690 if (IS_ERR(mclk)) {
691 dev_err(dev, "can't get video1 clock\n");
692 return -EINVAL;
693 }
694
695 if (mode) {
696 /* video1 (= CON1 camera) expect 24MHz */
697 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
698 clk_enable(mclk);
699 gpio_direction_output(GPIO_PORT158, 1);
700 } else {
701 gpio_direction_output(GPIO_PORT158, 0);
702 clk_disable(mclk);
703 }
704
705 clk_put(mclk);
706
707 return 0;
708}
709
710static struct i2c_board_info i2c_camera_mt9t111 = {
711 I2C_BOARD_INFO("mt9t112", 0x3d),
712};
713
714static struct mt9t112_camera_info mt9t111_info = {
715 .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
716};
717
718static struct soc_camera_link mt9t111_link = {
719 .i2c_adapter_id = 0,
720 .bus_id = 0,
721 .board_info = &i2c_camera_mt9t111,
722 .power = mt9t111_power,
723 .priv = &mt9t111_info,
724};
725
726static struct platform_device camera_device = {
727 .name = "soc-camera-pdrv",
728 .id = 0,
729 .dev = {
730 .platform_data = &mt9t111_link,
731 },
732};
733
734/* CEU0 */
735static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
736 .flags = SH_CEU_FLAG_LOWER_8BIT,
737};
738
739static struct resource ceu0_resources[] = {
740 [0] = {
741 .name = "CEU",
742 .start = 0xfe910000,
743 .end = 0xfe91009f,
744 .flags = IORESOURCE_MEM,
745 },
746 [1] = {
747 .start = intcs_evt2irq(0x0500),
748 .flags = IORESOURCE_IRQ,
749 },
750 [2] = {
751 /* place holder for contiguous memory */
752 },
753};
754
755static struct platform_device ceu0_device = {
756 .name = "sh_mobile_ceu",
757 .id = 0,
758 .num_resources = ARRAY_SIZE(ceu0_resources),
759 .resource = ceu0_resources,
760 .dev = {
761 .platform_data = &sh_mobile_ceu0_info,
762 .coherent_dma_mask = 0xffffffff,
763 },
764};
765
766/* FSI */
767static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
768{
769 struct clk *fsib;
770 int ret;
771
772 /* it support 48KHz only */
773 if (48000 != rate)
774 return -EINVAL;
775
776 fsib = clk_get(dev, "ickb");
777 if (IS_ERR(fsib))
778 return -EINVAL;
779
780 if (enable) {
781 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
782 clk_enable(fsib);
783 } else {
784 ret = 0;
785 clk_disable(fsib);
786 }
787
788 clk_put(fsib);
789
790 return ret;
791}
792
793static struct sh_fsi_platform_info fsi_info = {
794 /* FSI-WM8978 */
795 .port_a = {
796 .tx_id = SHDMA_SLAVE_FSIA_TX,
797 },
798 /* FSI-HDMI */
799 .port_b = {
800 .flags = SH_FSI_FMT_SPDIF |
801 SH_FSI_ENABLE_STREAM_MODE,
802 .set_rate = fsi_hdmi_set_rate,
803 .tx_id = SHDMA_SLAVE_FSIB_TX,
804 }
805};
806
807static struct resource fsi_resources[] = {
808 [0] = {
809 .name = "FSI",
810 .start = 0xfe1f0000,
811 .end = 0xfe1f8400 - 1,
812 .flags = IORESOURCE_MEM,
813 },
814 [1] = {
815 .start = evt2irq(0x1840),
816 .flags = IORESOURCE_IRQ,
817 },
818};
819
820static struct platform_device fsi_device = {
821 .name = "sh_fsi2",
822 .id = -1,
823 .num_resources = ARRAY_SIZE(fsi_resources),
824 .resource = fsi_resources,
825 .dev = {
826 .platform_data = &fsi_info,
827 },
828};
829
830/* FSI-WM8978 */
831static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
832 .fmt = SND_SOC_DAIFMT_I2S,
833 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
834 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
835 .sysclk = 12288000,
836};
837
838static struct asoc_simple_card_info fsi_wm8978_info = {
839 .name = "wm8978",
840 .card = "FSI2A-WM8978",
841 .cpu_dai = "fsia-dai",
842 .codec = "wm8978.0-001a",
843 .platform = "sh_fsi2",
844 .codec_dai = "wm8978-hifi",
845 .init = &fsi_wm8978_init_info,
846};
847
848static struct platform_device fsi_wm8978_device = {
849 .name = "asoc-simple-card",
850 .id = 0,
851 .dev = {
852 .platform_data = &fsi_wm8978_info,
853 },
854};
855
856/* FSI-HDMI */
857static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
858 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
859};
860
861static struct asoc_simple_card_info fsi2_hdmi_info = {
862 .name = "HDMI",
863 .card = "FSI2B-HDMI",
864 .cpu_dai = "fsib-dai",
865 .codec = "sh-mobile-hdmi",
866 .platform = "sh_fsi2",
867 .codec_dai = "sh_mobile_hdmi-hifi",
868 .init = &fsi2_hdmi_init_info,
869};
870
871static struct platform_device fsi_hdmi_device = {
872 .name = "asoc-simple-card",
873 .id = 1,
874 .dev = {
875 .platform_data = &fsi2_hdmi_info,
876 },
877};
878
535/* I2C */ 879/* I2C */
536static struct i2c_board_info i2c0_devices[] = { 880static struct i2c_board_info i2c0_devices[] = {
537 { 881 {
538 I2C_BOARD_INFO("st1232-ts", 0x55), 882 I2C_BOARD_INFO("st1232-ts", 0x55),
539 .irq = evt2irq(0x0340), 883 .irq = evt2irq(0x0340),
540 }, 884 },
885 {
886 I2C_BOARD_INFO("wm8978", 0x1a),
887 },
541}; 888};
542 889
543/* 890/*
@@ -549,6 +896,13 @@ static struct platform_device *eva_devices[] __initdata = {
549 &sh_eth_device, 896 &sh_eth_device,
550 &sdhi0_device, 897 &sdhi0_device,
551 &sh_mmcif_device, 898 &sh_mmcif_device,
899 &hdmi_device,
900 &hdmi_lcdc_device,
901 &camera_device,
902 &ceu0_device,
903 &fsi_device,
904 &fsi_hdmi_device,
905 &fsi_wm8978_device,
552}; 906};
553 907
554static void __init eva_clock_init(void) 908static void __init eva_clock_init(void)
@@ -556,10 +910,14 @@ static void __init eva_clock_init(void)
556 struct clk *system = clk_get(NULL, "system_clk"); 910 struct clk *system = clk_get(NULL, "system_clk");
557 struct clk *xtal1 = clk_get(NULL, "extal1"); 911 struct clk *xtal1 = clk_get(NULL, "extal1");
558 struct clk *usb24s = clk_get(NULL, "usb24s"); 912 struct clk *usb24s = clk_get(NULL, "usb24s");
913 struct clk *fsibck = clk_get(NULL, "fsibck");
914 struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
559 915
560 if (IS_ERR(system) || 916 if (IS_ERR(system) ||
561 IS_ERR(xtal1) || 917 IS_ERR(xtal1) ||
562 IS_ERR(usb24s)) { 918 IS_ERR(usb24s) ||
919 IS_ERR(fsibck) ||
920 IS_ERR(fsib)) {
563 pr_err("armadillo800eva board clock init failed\n"); 921 pr_err("armadillo800eva board clock init failed\n");
564 goto clock_error; 922 goto clock_error;
565 } 923 }
@@ -570,6 +928,11 @@ static void __init eva_clock_init(void)
570 /* usb24s use extal1 (= system) clock (= 24MHz) */ 928 /* usb24s use extal1 (= system) clock (= 24MHz) */
571 clk_set_parent(usb24s, system); 929 clk_set_parent(usb24s, system);
572 930
931 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
932 clk_set_parent(fsib, fsibck);
933 clk_set_rate(fsibck, 12288000);
934 clk_set_rate(fsib, 12288000);
935
573clock_error: 936clock_error:
574 if (!IS_ERR(system)) 937 if (!IS_ERR(system))
575 clk_put(system); 938 clk_put(system);
@@ -577,14 +940,23 @@ clock_error:
577 clk_put(xtal1); 940 clk_put(xtal1);
578 if (!IS_ERR(usb24s)) 941 if (!IS_ERR(usb24s))
579 clk_put(usb24s); 942 clk_put(usb24s);
943 if (!IS_ERR(fsibck))
944 clk_put(fsibck);
945 if (!IS_ERR(fsib))
946 clk_put(fsib);
580} 947}
581 948
582/* 949/*
583 * board init 950 * board init
584 */ 951 */
952#define GPIO_PORT7CR 0xe6050007
953#define GPIO_PORT8CR 0xe6050008
585static void __init eva_init(void) 954static void __init eva_init(void)
586{ 955{
587 eva_clock_init(); 956 struct platform_device *usb = NULL;
957
958 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
959 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
588 960
589 r8a7740_pinmux_init(); 961 r8a7740_pinmux_init();
590 r8a7740_meram_workaround(); 962 r8a7740_meram_workaround();
@@ -668,8 +1040,19 @@ static void __init eva_init(void)
668 /* USB Host */ 1040 /* USB Host */
669 } else { 1041 } else {
670 /* USB Func */ 1042 /* USB Func */
671 gpio_request(GPIO_FN_VBUS, NULL); 1043 /*
1044 * A1 chip has 2 IRQ7 pin and it was controled by MSEL register.
1045 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
1046 * USB connection/disconnection (usbhsf_get_vbus()).
1047 * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
1048 * and select GPIO_PORT209 here
1049 */
1050 gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
1051 gpio_request(GPIO_PORT209, NULL);
1052 gpio_direction_input(GPIO_PORT209);
1053
672 platform_device_register(&usbhsf_device); 1054 platform_device_register(&usbhsf_device);
1055 usb = &usbhsf_device;
673 } 1056 }
674 1057
675 /* SDHI0 */ 1058 /* SDHI0 */
@@ -707,6 +1090,48 @@ static void __init eva_init(void)
707 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL); 1090 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
708 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL); 1091 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
709 1092
1093 /* CEU0 */
1094 gpio_request(GPIO_FN_VIO0_D7, NULL);
1095 gpio_request(GPIO_FN_VIO0_D6, NULL);
1096 gpio_request(GPIO_FN_VIO0_D5, NULL);
1097 gpio_request(GPIO_FN_VIO0_D4, NULL);
1098 gpio_request(GPIO_FN_VIO0_D3, NULL);
1099 gpio_request(GPIO_FN_VIO0_D2, NULL);
1100 gpio_request(GPIO_FN_VIO0_D1, NULL);
1101 gpio_request(GPIO_FN_VIO0_D0, NULL);
1102 gpio_request(GPIO_FN_VIO0_CLK, NULL);
1103 gpio_request(GPIO_FN_VIO0_HD, NULL);
1104 gpio_request(GPIO_FN_VIO0_VD, NULL);
1105 gpio_request(GPIO_FN_VIO0_FIELD, NULL);
1106 gpio_request(GPIO_FN_VIO_CKO, NULL);
1107
1108 /* CON1/CON15 Camera */
1109 gpio_request(GPIO_PORT173, NULL); /* STANDBY */
1110 gpio_request(GPIO_PORT172, NULL); /* RST */
1111 gpio_request(GPIO_PORT158, NULL); /* CAM_PON */
1112 gpio_direction_output(GPIO_PORT173, 0);
1113 gpio_direction_output(GPIO_PORT172, 1);
1114 gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */
1115
1116 /* FSI-WM8978 */
1117 gpio_request(GPIO_FN_FSIAIBT, NULL);
1118 gpio_request(GPIO_FN_FSIAILR, NULL);
1119 gpio_request(GPIO_FN_FSIAOMC, NULL);
1120 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1121 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1122
1123 gpio_request(GPIO_PORT7, NULL);
1124 gpio_request(GPIO_PORT8, NULL);
1125 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1126 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1127
1128 /* FSI-HDMI */
1129 gpio_request(GPIO_FN_FSIBCK, NULL);
1130
1131 /* HDMI */
1132 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1133 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1134
710 /* 1135 /*
711 * CAUTION 1136 * CAUTION
712 * 1137 *
@@ -753,6 +1178,13 @@ static void __init eva_init(void)
753 1178
754 platform_add_devices(eva_devices, 1179 platform_add_devices(eva_devices,
755 ARRAY_SIZE(eva_devices)); 1180 ARRAY_SIZE(eva_devices));
1181
1182 eva_clock_init();
1183
1184 rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device);
1185 rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device);
1186 if (usb)
1187 rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb);
756} 1188}
757 1189
758static void __init eva_earlytimer_init(void) 1190static void __init eva_earlytimer_init(void)
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index e9b32cfbf741..4129008eae29 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -26,6 +26,8 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/regulator/fixed.h>
30#include <linux/regulator/machine.h>
29#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
30#include <linux/videodev2.h> 32#include <linux/videodev2.h>
31#include <mach/common.h> 33#include <mach/common.h>
@@ -75,6 +77,12 @@
75 * S38.2 = OFF 77 * S38.2 = OFF
76 */ 78 */
77 79
80/* Dummy supplies, where voltage doesn't matter */
81static struct regulator_consumer_supply dummy_supplies[] = {
82 REGULATOR_SUPPLY("vddvario", "smsc911x"),
83 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
84};
85
78/* 86/*
79 * FPGA 87 * FPGA
80 */ 88 */
@@ -360,6 +368,8 @@ static void __init bonito_init(void)
360{ 368{
361 u16 val; 369 u16 val;
362 370
371 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
372
363 r8a7740_pinmux_init(); 373 r8a7740_pinmux_init();
364 bonito_fpga_init(); 374 bonito_fpga_init();
365 375
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index f1257321999a..fa5dfc5c8ed6 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -26,6 +26,8 @@
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
29#include <linux/regulator/fixed.h>
30#include <linux/regulator/machine.h>
29#include <linux/usb/r8a66597.h> 31#include <linux/usb/r8a66597.h>
30#include <linux/io.h> 32#include <linux/io.h>
31#include <linux/input.h> 33#include <linux/input.h>
@@ -196,6 +198,15 @@ static struct platform_device keysc_device = {
196 }, 198 },
197}; 199};
198 200
201/* Fixed 3.3V regulator to be used by SDHI0 and SDHI1 */
202static struct regulator_consumer_supply fixed3v3_power_consumers[] =
203{
204 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
205 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
206 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
207 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
208};
209
199/* SDHI */ 210/* SDHI */
200static struct sh_mobile_sdhi_info sdhi0_info = { 211static struct sh_mobile_sdhi_info sdhi0_info = {
201 .tmio_caps = MMC_CAP_SDIO_IRQ, 212 .tmio_caps = MMC_CAP_SDIO_IRQ,
@@ -271,26 +282,11 @@ static struct platform_device *g4evm_devices[] __initdata = {
271#define GPIO_SDHID1_D3 0xe6052106 282#define GPIO_SDHID1_D3 0xe6052106
272#define GPIO_SDHICMD1 0xe6052107 283#define GPIO_SDHICMD1 0xe6052107
273 284
274/*
275 * FIXME !!
276 *
277 * gpio_pull_up is quick_hack.
278 *
279 * current gpio frame work doesn't have
280 * the method to control only pull up/down/free.
281 * this function should be replaced by correct gpio function
282 */
283static void __init gpio_pull_up(u32 addr)
284{
285 u8 data = __raw_readb(addr);
286
287 data &= 0x0F;
288 data |= 0xC0;
289 __raw_writeb(data, addr);
290}
291
292static void __init g4evm_init(void) 285static void __init g4evm_init(void)
293{ 286{
287 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
288 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
289
294 sh7377_pinmux_init(); 290 sh7377_pinmux_init();
295 291
296 /* Lit DS14 LED */ 292 /* Lit DS14 LED */
@@ -351,11 +347,11 @@ static void __init g4evm_init(void)
351 gpio_request(GPIO_FN_SDHID0_3, NULL); 347 gpio_request(GPIO_FN_SDHID0_3, NULL);
352 gpio_request(GPIO_FN_SDHICMD0, NULL); 348 gpio_request(GPIO_FN_SDHICMD0, NULL);
353 gpio_request(GPIO_FN_SDHIWP0, NULL); 349 gpio_request(GPIO_FN_SDHIWP0, NULL);
354 gpio_pull_up(GPIO_SDHID0_D0); 350 gpio_request_pullup(GPIO_SDHID0_D0);
355 gpio_pull_up(GPIO_SDHID0_D1); 351 gpio_request_pullup(GPIO_SDHID0_D1);
356 gpio_pull_up(GPIO_SDHID0_D2); 352 gpio_request_pullup(GPIO_SDHID0_D2);
357 gpio_pull_up(GPIO_SDHID0_D3); 353 gpio_request_pullup(GPIO_SDHID0_D3);
358 gpio_pull_up(GPIO_SDHICMD0); 354 gpio_request_pullup(GPIO_SDHICMD0);
359 355
360 /* SDHI1 */ 356 /* SDHI1 */
361 gpio_request(GPIO_FN_SDHICLK1, NULL); 357 gpio_request(GPIO_FN_SDHICLK1, NULL);
@@ -364,11 +360,11 @@ static void __init g4evm_init(void)
364 gpio_request(GPIO_FN_SDHID1_2, NULL); 360 gpio_request(GPIO_FN_SDHID1_2, NULL);
365 gpio_request(GPIO_FN_SDHID1_3, NULL); 361 gpio_request(GPIO_FN_SDHID1_3, NULL);
366 gpio_request(GPIO_FN_SDHICMD1, NULL); 362 gpio_request(GPIO_FN_SDHICMD1, NULL);
367 gpio_pull_up(GPIO_SDHID1_D0); 363 gpio_request_pullup(GPIO_SDHID1_D0);
368 gpio_pull_up(GPIO_SDHID1_D1); 364 gpio_request_pullup(GPIO_SDHID1_D1);
369 gpio_pull_up(GPIO_SDHID1_D2); 365 gpio_request_pullup(GPIO_SDHID1_D2);
370 gpio_pull_up(GPIO_SDHID1_D3); 366 gpio_request_pullup(GPIO_SDHID1_D3);
371 gpio_pull_up(GPIO_SDHICMD1); 367 gpio_request_pullup(GPIO_SDHICMD1);
372 368
373 sh7377_add_standard_devices(); 369 sh7377_add_standard_devices();
374 370
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index f60f1b281cc4..21dbe54304d5 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -27,6 +27,8 @@
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
30#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
31#include <linux/gpio.h> 33#include <linux/gpio.h>
32#include <linux/input.h> 34#include <linux/input.h>
@@ -49,6 +51,12 @@
49#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
50#include <asm/traps.h> 52#include <asm/traps.h>
51 53
54/* Dummy supplies, where voltage doesn't matter */
55static struct regulator_consumer_supply dummy_supplies[] = {
56 REGULATOR_SUPPLY("vddvario", "smsc911x"),
57 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
58};
59
52/* SMSC 9220 */ 60/* SMSC 9220 */
53static struct resource smsc9220_resources[] = { 61static struct resource smsc9220_resources[] = {
54 [0] = { 62 [0] = {
@@ -288,6 +296,13 @@ static struct platform_device leds_tpu30_device = {
288 .resource = tpu30_resources, 296 .resource = tpu30_resources,
289}; 297};
290 298
299/* Fixed 1.8V regulator to be used by MMCIF */
300static struct regulator_consumer_supply fixed1v8_power_consumers[] =
301{
302 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
303 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
304};
305
291/* MMCIF */ 306/* MMCIF */
292static struct resource mmcif_resources[] = { 307static struct resource mmcif_resources[] = {
293 [0] = { 308 [0] = {
@@ -321,6 +336,15 @@ static struct platform_device mmcif_device = {
321 .resource = mmcif_resources, 336 .resource = mmcif_resources,
322}; 337};
323 338
339/* Fixed 3.3V regulator to be used by SDHI0 and SDHI1 */
340static struct regulator_consumer_supply fixed3v3_power_consumers[] =
341{
342 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
343 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
344 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
345 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
346};
347
324/* SDHI0 */ 348/* SDHI0 */
325static struct sh_mobile_sdhi_info sdhi0_info = { 349static struct sh_mobile_sdhi_info sdhi0_info = {
326 .tmio_caps = MMC_CAP_SD_HIGHSPEED, 350 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
@@ -411,6 +435,12 @@ static struct platform_device *kota2_devices[] __initdata = {
411 435
412static void __init kota2_init(void) 436static void __init kota2_init(void)
413{ 437{
438 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
439 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
440 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
441 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
442 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
443
414 sh73a0_pinmux_init(); 444 sh73a0_pinmux_init();
415 445
416 /* SCIFA2 (UART2) */ 446 /* SCIFA2 (UART2) */
diff --git a/arch/arm/mach-shmobile/board-kzm9d.c b/arch/arm/mach-shmobile/board-kzm9d.c
index 6a33cf393428..2c986eaae7b4 100644
--- a/arch/arm/mach-shmobile/board-kzm9d.c
+++ b/arch/arm/mach-shmobile/board-kzm9d.c
@@ -21,6 +21,8 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/regulator/fixed.h>
25#include <linux/regulator/machine.h>
24#include <linux/smsc911x.h> 26#include <linux/smsc911x.h>
25#include <mach/common.h> 27#include <mach/common.h>
26#include <mach/emev2.h> 28#include <mach/emev2.h>
@@ -28,6 +30,12 @@
28#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
29#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
30 32
33/* Dummy supplies, where voltage doesn't matter */
34static struct regulator_consumer_supply dummy_supplies[] = {
35 REGULATOR_SUPPLY("vddvario", "smsc911x"),
36 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
37};
38
31/* Ether */ 39/* Ether */
32static struct resource smsc911x_resources[] = { 40static struct resource smsc911x_resources[] = {
33 [0] = { 41 [0] = {
@@ -63,6 +71,8 @@ static struct platform_device *kzm9d_devices[] __initdata = {
63 71
64void __init kzm9d_add_standard_devices(void) 72void __init kzm9d_add_standard_devices(void)
65{ 73{
74 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
75
66 emev2_add_standard_devices(); 76 emev2_add_standard_devices();
67 77
68 platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices)); 78 platform_add_devices(kzm9d_devices, ARRAY_SIZE(kzm9d_devices));
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index c0ae815e7beb..53b7ea92c32c 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -30,9 +30,14 @@
30#include <linux/mmc/sh_mobile_sdhi.h> 30#include <linux/mmc/sh_mobile_sdhi.h>
31#include <linux/mfd/tmio.h> 31#include <linux/mfd/tmio.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/regulator/fixed.h>
34#include <linux/regulator/machine.h>
33#include <linux/smsc911x.h> 35#include <linux/smsc911x.h>
34#include <linux/usb/r8a66597.h> 36#include <linux/usb/r8a66597.h>
37#include <linux/usb/renesas_usbhs.h>
35#include <linux/videodev2.h> 38#include <linux/videodev2.h>
39#include <sound/sh_fsi.h>
40#include <sound/simple_card.h>
36#include <mach/irqs.h> 41#include <mach/irqs.h>
37#include <mach/sh73a0.h> 42#include <mach/sh73a0.h>
38#include <mach/common.h> 43#include <mach/common.h>
@@ -54,6 +59,20 @@
54#define GPIO_PCF8575_PORT15 (GPIO_NR + 13) 59#define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
55#define GPIO_PCF8575_PORT16 (GPIO_NR + 14) 60#define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
56 61
62/* Dummy supplies, where voltage doesn't matter */
63static struct regulator_consumer_supply dummy_supplies[] = {
64 REGULATOR_SUPPLY("vddvario", "smsc911x"),
65 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
66};
67
68/*
69 * FSI-AK4648
70 *
71 * this command is required when playback.
72 *
73 * # amixer set "LINEOUT Mixer DACL" on
74 */
75
57/* SMSC 9221 */ 76/* SMSC 9221 */
58static struct resource smsc9221_resources[] = { 77static struct resource smsc9221_resources[] = {
59 [0] = { 78 [0] = {
@@ -112,6 +131,151 @@ static struct platform_device usb_host_device = {
112 .resource = usb_resources, 131 .resource = usb_resources,
113}; 132};
114 133
134/* USB Func CN17 */
135struct usbhs_private {
136 unsigned int phy;
137 unsigned int cr2;
138 struct renesas_usbhs_platform_info info;
139};
140
141#define IRQ15 intcs_evt2irq(0x03e0)
142#define USB_PHY_MODE (1 << 4)
143#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
144#define USB_PHY_ON (1 << 1)
145#define USB_PHY_OFF (1 << 0)
146#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
147
148#define usbhs_get_priv(pdev) \
149 container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
150
151static int usbhs_get_vbus(struct platform_device *pdev)
152{
153 struct usbhs_private *priv = usbhs_get_priv(pdev);
154
155 return !((1 << 7) & __raw_readw(priv->cr2));
156}
157
158static void usbhs_phy_reset(struct platform_device *pdev)
159{
160 struct usbhs_private *priv = usbhs_get_priv(pdev);
161
162 /* init phy */
163 __raw_writew(0x8a0a, priv->cr2);
164}
165
166static int usbhs_get_id(struct platform_device *pdev)
167{
168 return USBHS_GADGET;
169}
170
171static irqreturn_t usbhs_interrupt(int irq, void *data)
172{
173 struct platform_device *pdev = data;
174 struct usbhs_private *priv = usbhs_get_priv(pdev);
175
176 renesas_usbhs_call_notify_hotplug(pdev);
177
178 /* clear status */
179 __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy);
180
181 return IRQ_HANDLED;
182}
183
184static int usbhs_hardware_init(struct platform_device *pdev)
185{
186 struct usbhs_private *priv = usbhs_get_priv(pdev);
187 int ret;
188
189 /* clear interrupt status */
190 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
191
192 ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH,
193 dev_name(&pdev->dev), pdev);
194 if (ret) {
195 dev_err(&pdev->dev, "request_irq err\n");
196 return ret;
197 }
198
199 /* enable USB phy interrupt */
200 __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy);
201
202 return 0;
203}
204
205static void usbhs_hardware_exit(struct platform_device *pdev)
206{
207 struct usbhs_private *priv = usbhs_get_priv(pdev);
208
209 /* clear interrupt status */
210 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
211
212 free_irq(IRQ15, pdev);
213}
214
215static u32 usbhs_pipe_cfg[] = {
216 USB_ENDPOINT_XFER_CONTROL,
217 USB_ENDPOINT_XFER_ISOC,
218 USB_ENDPOINT_XFER_ISOC,
219 USB_ENDPOINT_XFER_BULK,
220 USB_ENDPOINT_XFER_BULK,
221 USB_ENDPOINT_XFER_BULK,
222 USB_ENDPOINT_XFER_INT,
223 USB_ENDPOINT_XFER_INT,
224 USB_ENDPOINT_XFER_INT,
225 USB_ENDPOINT_XFER_BULK,
226 USB_ENDPOINT_XFER_BULK,
227 USB_ENDPOINT_XFER_BULK,
228 USB_ENDPOINT_XFER_BULK,
229 USB_ENDPOINT_XFER_BULK,
230 USB_ENDPOINT_XFER_BULK,
231 USB_ENDPOINT_XFER_BULK,
232};
233
234static struct usbhs_private usbhs_private = {
235 .phy = 0xe60781e0, /* USBPHYINT */
236 .cr2 = 0xe605810c, /* USBCR2 */
237 .info = {
238 .platform_callback = {
239 .hardware_init = usbhs_hardware_init,
240 .hardware_exit = usbhs_hardware_exit,
241 .get_id = usbhs_get_id,
242 .phy_reset = usbhs_phy_reset,
243 .get_vbus = usbhs_get_vbus,
244 },
245 .driver_param = {
246 .buswait_bwait = 4,
247 .has_otg = 1,
248 .pipe_type = usbhs_pipe_cfg,
249 .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg),
250 },
251 },
252};
253
254static struct resource usbhs_resources[] = {
255 [0] = {
256 .start = 0xE6890000,
257 .end = 0xE68900e6 - 1,
258 .flags = IORESOURCE_MEM,
259 },
260 [1] = {
261 .start = gic_spi(62),
262 .end = gic_spi(62),
263 .flags = IORESOURCE_IRQ,
264 },
265};
266
267static struct platform_device usbhs_device = {
268 .name = "renesas_usbhs",
269 .id = -1,
270 .dev = {
271 .dma_mask = NULL,
272 .coherent_dma_mask = 0xffffffff,
273 .platform_data = &usbhs_private.info,
274 },
275 .num_resources = ARRAY_SIZE(usbhs_resources),
276 .resource = usbhs_resources,
277};
278
115/* LCDC */ 279/* LCDC */
116static struct fb_videomode kzm_lcdc_mode = { 280static struct fb_videomode kzm_lcdc_mode = {
117 .name = "WVGA Panel", 281 .name = "WVGA Panel",
@@ -166,6 +330,13 @@ static struct platform_device lcdc_device = {
166 }, 330 },
167}; 331};
168 332
333/* Fixed 1.8V regulator to be used by MMCIF */
334static struct regulator_consumer_supply fixed1v8_power_consumers[] =
335{
336 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
337 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
338};
339
169/* MMCIF */ 340/* MMCIF */
170static struct resource sh_mmcif_resources[] = { 341static struct resource sh_mmcif_resources[] = {
171 [0] = { 342 [0] = {
@@ -187,6 +358,8 @@ static struct resource sh_mmcif_resources[] = {
187static struct sh_mmcif_plat_data sh_mmcif_platdata = { 358static struct sh_mmcif_plat_data sh_mmcif_platdata = {
188 .ocr = MMC_VDD_165_195, 359 .ocr = MMC_VDD_165_195,
189 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 360 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
361 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
362 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
190}; 363};
191 364
192static struct platform_device mmc_device = { 365static struct platform_device mmc_device = {
@@ -200,6 +373,15 @@ static struct platform_device mmc_device = {
200 .resource = sh_mmcif_resources, 373 .resource = sh_mmcif_resources,
201}; 374};
202 375
376/* Fixed 2.8V regulators to be used by SDHI0 and SDHI2 */
377static struct regulator_consumer_supply fixed2v8_power_consumers[] =
378{
379 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
380 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
381 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
382 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
383};
384
203/* SDHI */ 385/* SDHI */
204static struct sh_mobile_sdhi_info sdhi0_info = { 386static struct sh_mobile_sdhi_info sdhi0_info = {
205 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, 387 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
@@ -240,6 +422,50 @@ static struct platform_device sdhi0_device = {
240 }, 422 },
241}; 423};
242 424
425/* Micro SD */
426static struct sh_mobile_sdhi_info sdhi2_info = {
427 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
428 TMIO_MMC_USE_GPIO_CD |
429 TMIO_MMC_WRPROTECT_DISABLE,
430 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
431 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
432 .cd_gpio = GPIO_PORT13,
433};
434
435static struct resource sdhi2_resources[] = {
436 [0] = {
437 .name = "SDHI2",
438 .start = 0xee140000,
439 .end = 0xee1400ff,
440 .flags = IORESOURCE_MEM,
441 },
442 [1] = {
443 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
444 .start = gic_spi(103),
445 .flags = IORESOURCE_IRQ,
446 },
447 [2] = {
448 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
449 .start = gic_spi(104),
450 .flags = IORESOURCE_IRQ,
451 },
452 [3] = {
453 .name = SH_MOBILE_SDHI_IRQ_SDIO,
454 .start = gic_spi(105),
455 .flags = IORESOURCE_IRQ,
456 },
457};
458
459static struct platform_device sdhi2_device = {
460 .name = "sh_mobile_sdhi",
461 .id = 2,
462 .num_resources = ARRAY_SIZE(sdhi2_resources),
463 .resource = sdhi2_resources,
464 .dev = {
465 .platform_data = &sdhi2_info,
466 },
467};
468
243/* KEY */ 469/* KEY */
244#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 } 470#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
245 471
@@ -267,11 +493,74 @@ static struct platform_device gpio_keys_device = {
267 }, 493 },
268}; 494};
269 495
496/* FSI-AK4648 */
497static struct sh_fsi_platform_info fsi_info = {
498 .port_a = {
499 .tx_id = SHDMA_SLAVE_FSI2A_TX,
500 },
501};
502
503static struct resource fsi_resources[] = {
504 [0] = {
505 .name = "FSI",
506 .start = 0xEC230000,
507 .end = 0xEC230400 - 1,
508 .flags = IORESOURCE_MEM,
509 },
510 [1] = {
511 .start = gic_spi(146),
512 .flags = IORESOURCE_IRQ,
513 },
514};
515
516static struct platform_device fsi_device = {
517 .name = "sh_fsi2",
518 .id = -1,
519 .num_resources = ARRAY_SIZE(fsi_resources),
520 .resource = fsi_resources,
521 .dev = {
522 .platform_data = &fsi_info,
523 },
524};
525
526static struct asoc_simple_dai_init_info fsi2_ak4648_init_info = {
527 .fmt = SND_SOC_DAIFMT_LEFT_J,
528 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
529 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
530 .sysclk = 11289600,
531};
532
533static struct asoc_simple_card_info fsi2_ak4648_info = {
534 .name = "AK4648",
535 .card = "FSI2A-AK4648",
536 .cpu_dai = "fsia-dai",
537 .codec = "ak4642-codec.0-0012",
538 .platform = "sh_fsi2",
539 .codec_dai = "ak4642-hifi",
540 .init = &fsi2_ak4648_init_info,
541};
542
543static struct platform_device fsi_ak4648_device = {
544 .name = "asoc-simple-card",
545 .dev = {
546 .platform_data = &fsi2_ak4648_info,
547 },
548};
549
270/* I2C */ 550/* I2C */
271static struct pcf857x_platform_data pcf8575_pdata = { 551static struct pcf857x_platform_data pcf8575_pdata = {
272 .gpio_base = GPIO_PCF8575_BASE, 552 .gpio_base = GPIO_PCF8575_BASE,
273}; 553};
274 554
555static struct i2c_board_info i2c0_devices[] = {
556 {
557 I2C_BOARD_INFO("ak4648", 0x12),
558 },
559 {
560 I2C_BOARD_INFO("r2025sd", 0x32),
561 }
562};
563
275static struct i2c_board_info i2c1_devices[] = { 564static struct i2c_board_info i2c1_devices[] = {
276 { 565 {
277 I2C_BOARD_INFO("st1232-ts", 0x55), 566 I2C_BOARD_INFO("st1232-ts", 0x55),
@@ -289,10 +578,14 @@ static struct i2c_board_info i2c3_devices[] = {
289static struct platform_device *kzm_devices[] __initdata = { 578static struct platform_device *kzm_devices[] __initdata = {
290 &smsc_device, 579 &smsc_device,
291 &usb_host_device, 580 &usb_host_device,
581 &usbhs_device,
292 &lcdc_device, 582 &lcdc_device,
293 &mmc_device, 583 &mmc_device,
294 &sdhi0_device, 584 &sdhi0_device,
585 &sdhi2_device,
295 &gpio_keys_device, 586 &gpio_keys_device,
587 &fsi_device,
588 &fsi_ak4648_device,
296}; 589};
297 590
298/* 591/*
@@ -350,6 +643,12 @@ device_initcall(as3711_enable_lcdc_backlight);
350 643
351static void __init kzm_init(void) 644static void __init kzm_init(void)
352{ 645{
646 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
647 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
648 regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers,
649 ARRAY_SIZE(fixed2v8_power_consumers), 2800000);
650 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
651
353 sh73a0_pinmux_init(); 652 sh73a0_pinmux_init();
354 653
355 /* enable SCIFA4 */ 654 /* enable SCIFA4 */
@@ -427,15 +726,36 @@ static void __init kzm_init(void)
427 gpio_request(GPIO_PORT15, NULL); 726 gpio_request(GPIO_PORT15, NULL);
428 gpio_direction_output(GPIO_PORT15, 1); /* power */ 727 gpio_direction_output(GPIO_PORT15, 1); /* power */
429 728
729 /* enable Micro SD */
730 gpio_request(GPIO_FN_SDHID2_0, NULL);
731 gpio_request(GPIO_FN_SDHID2_1, NULL);
732 gpio_request(GPIO_FN_SDHID2_2, NULL);
733 gpio_request(GPIO_FN_SDHID2_3, NULL);
734 gpio_request(GPIO_FN_SDHICMD2, NULL);
735 gpio_request(GPIO_FN_SDHICLK2, NULL);
736 gpio_request(GPIO_PORT14, NULL);
737 gpio_direction_output(GPIO_PORT14, 1); /* power */
738
430 /* I2C 3 */ 739 /* I2C 3 */
431 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL); 740 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
432 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL); 741 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
433 742
743 /* enable FSI2 port A (ak4648) */
744 gpio_request(GPIO_FN_FSIACK, NULL);
745 gpio_request(GPIO_FN_FSIAILR, NULL);
746 gpio_request(GPIO_FN_FSIAIBT, NULL);
747 gpio_request(GPIO_FN_FSIAISLD, NULL);
748 gpio_request(GPIO_FN_FSIAOSLD, NULL);
749
750 /* enable USB */
751 gpio_request(GPIO_FN_VBUS_0, NULL);
752
434#ifdef CONFIG_CACHE_L2X0 753#ifdef CONFIG_CACHE_L2X0
435 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 754 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
436 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff); 755 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
437#endif 756#endif
438 757
758 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
439 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices)); 759 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
440 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices)); 760 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
441 761
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 9640f34122bd..7ea2b31e3199 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -41,6 +41,8 @@
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h> 42#include <linux/mtd/sh_flctl.h>
43#include <linux/pm_clock.h> 43#include <linux/pm_clock.h>
44#include <linux/regulator/fixed.h>
45#include <linux/regulator/machine.h>
44#include <linux/smsc911x.h> 46#include <linux/smsc911x.h>
45#include <linux/sh_intc.h> 47#include <linux/sh_intc.h>
46#include <linux/tca6416_keypad.h> 48#include <linux/tca6416_keypad.h>
@@ -203,31 +205,32 @@
203 * amixer set "HPOUTR Mixer DACH" on 205 * amixer set "HPOUTR Mixer DACH" on
204 */ 206 */
205 207
206/* 208/* Fixed 3.3V and 1.8V regulators to be used by multiple devices */
207 * FIXME !! 209static struct regulator_consumer_supply fixed1v8_power_consumers[] =
208 *
209 * gpio_no_direction
210 * gpio_pull_down
211 * are quick_hack.
212 *
213 * current gpio frame work doesn't have
214 * the method to control only pull up/down/free.
215 * this function should be replaced by correct gpio function
216 */
217static void __init gpio_no_direction(u32 addr)
218{ 210{
219 __raw_writeb(0x00, addr); 211 /*
220} 212 * J22 on mackerel switches mmcif.0 and sdhi.1 between 1.8V and 3.3V
213 * Since we cannot support both voltages, we support the default 1.8V
214 */
215 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
216 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
217 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
218 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
219};
221 220
222static void __init gpio_pull_down(u32 addr) 221static struct regulator_consumer_supply fixed3v3_power_consumers[] =
223{ 222{
224 u8 data = __raw_readb(addr); 223 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
225 224 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
226 data &= 0x0F; 225 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
227 data |= 0xA0; 226 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
227};
228 228
229 __raw_writeb(data, addr); 229/* Dummy supplies, where voltage doesn't matter */
230} 230static struct regulator_consumer_supply dummy_supplies[] = {
231 REGULATOR_SUPPLY("vddvario", "smsc911x"),
232 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
233};
231 234
232/* MTD */ 235/* MTD */
233static struct mtd_partition nor_flash_partitions[] = { 236static struct mtd_partition nor_flash_partitions[] = {
@@ -1409,6 +1412,12 @@ static void __init mackerel_init(void)
1409 u32 srcr4; 1412 u32 srcr4;
1410 struct clk *clk; 1413 struct clk *clk;
1411 1414
1415 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
1416 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
1417 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
1418 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1419 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1420
1412 /* External clock source */ 1421 /* External clock source */
1413 clk_set_rate(&sh7372_dv_clki_clk, 27000000); 1422 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1414 1423
@@ -1458,11 +1467,11 @@ static void __init mackerel_init(void)
1458 1467
1459 /* USBHS0 */ 1468 /* USBHS0 */
1460 gpio_request(GPIO_FN_VBUS0_0, NULL); 1469 gpio_request(GPIO_FN_VBUS0_0, NULL);
1461 gpio_pull_down(GPIO_PORT168CR); /* VBUS0_0 pull down */ 1470 gpio_request_pulldown(GPIO_PORT168CR); /* VBUS0_0 pull down */
1462 1471
1463 /* USBHS1 */ 1472 /* USBHS1 */
1464 gpio_request(GPIO_FN_VBUS0_1, NULL); 1473 gpio_request(GPIO_FN_VBUS0_1, NULL);
1465 gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */ 1474 gpio_request_pulldown(GPIO_PORT167CR); /* VBUS0_1 pull down */
1466 gpio_request(GPIO_FN_IDIN_1_113, NULL); 1475 gpio_request(GPIO_FN_IDIN_1_113, NULL);
1467 1476
1468 /* enable FSI2 port A (ak4643) */ 1477 /* enable FSI2 port A (ak4643) */
@@ -1475,8 +1484,8 @@ static void __init mackerel_init(void)
1475 1484
1476 gpio_request(GPIO_PORT9, NULL); 1485 gpio_request(GPIO_PORT9, NULL);
1477 gpio_request(GPIO_PORT10, NULL); 1486 gpio_request(GPIO_PORT10, NULL);
1478 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1487 gpio_direction_none(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1479 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1488 gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1480 1489
1481 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */ 1490 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
1482 1491
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index 14de3787cafc..3a528cf4366c 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -27,6 +27,8 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
30#include <linux/smsc911x.h> 32#include <linux/smsc911x.h>
31#include <mach/hardware.h> 33#include <mach/hardware.h>
32#include <mach/r8a7779.h> 34#include <mach/r8a7779.h>
@@ -37,6 +39,12 @@
37#include <asm/hardware/gic.h> 39#include <asm/hardware/gic.h>
38#include <asm/traps.h> 40#include <asm/traps.h>
39 41
42/* Dummy supplies, where voltage doesn't matter */
43static struct regulator_consumer_supply dummy_supplies[] = {
44 REGULATOR_SUPPLY("vddvario", "smsc911x"),
45 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
46};
47
40/* SMSC LAN89218 */ 48/* SMSC LAN89218 */
41static struct resource smsc911x_resources[] = { 49static struct resource smsc911x_resources[] = {
42 [0] = { 50 [0] = {
@@ -73,6 +81,8 @@ static struct platform_device *marzen_devices[] __initdata = {
73 81
74static void __init marzen_init(void) 82static void __init marzen_init(void)
75{ 83{
84 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
85
76 r8a7779_pinmux_init(); 86 r8a7779_pinmux_init();
77 87
78 /* SCIF2 (CN18: DEBUG0) */ 88 /* SCIF2 (CN18: DEBUG0) */