]> Pileus Git - ~andy/linux/blob - arch/sh/boards/mach-kfr2r09/setup.c
Merge branches 'sh/urgent' and 'sh/regulator' into sh-latest
[~andy/linux] / arch / sh / boards / mach-kfr2r09 / setup.c
1 /*
2  * KFR2R09 board support code
3  *
4  * Copyright (C) 2009 Magnus Damm
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License.  See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/interrupt.h>
13 #include <linux/mmc/host.h>
14 #include <linux/mmc/sh_mobile_sdhi.h>
15 #include <linux/mfd/tmio.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/mtd/onenand.h>
18 #include <linux/delay.h>
19 #include <linux/clk.h>
20 #include <linux/gpio.h>
21 #include <linux/input.h>
22 #include <linux/input/sh_keysc.h>
23 #include <linux/i2c.h>
24 #include <linux/regulator/fixed.h>
25 #include <linux/regulator/machine.h>
26 #include <linux/usb/r8a66597.h>
27 #include <linux/videodev2.h>
28 #include <linux/sh_intc.h>
29 #include <media/rj54n1cb0c.h>
30 #include <media/soc_camera.h>
31 #include <media/sh_mobile_ceu.h>
32 #include <video/sh_mobile_lcdc.h>
33 #include <asm/suspend.h>
34 #include <asm/clock.h>
35 #include <asm/machvec.h>
36 #include <asm/io.h>
37 #include <cpu/sh7724.h>
38 #include <mach/kfr2r09.h>
39
40 static struct mtd_partition kfr2r09_nor_flash_partitions[] =
41 {
42         {
43                 .name = "boot",
44                 .offset = 0,
45                 .size = (4 * 1024 * 1024),
46                 .mask_flags = MTD_WRITEABLE,    /* Read-only */
47         },
48         {
49                 .name = "other",
50                 .offset = MTDPART_OFS_APPEND,
51                 .size = MTDPART_SIZ_FULL,
52         },
53 };
54
55 static struct physmap_flash_data kfr2r09_nor_flash_data = {
56         .width          = 2,
57         .parts          = kfr2r09_nor_flash_partitions,
58         .nr_parts       = ARRAY_SIZE(kfr2r09_nor_flash_partitions),
59 };
60
61 static struct resource kfr2r09_nor_flash_resources[] = {
62         [0] = {
63                 .name           = "NOR Flash",
64                 .start          = 0x00000000,
65                 .end            = 0x03ffffff,
66                 .flags          = IORESOURCE_MEM,
67         }
68 };
69
70 static struct platform_device kfr2r09_nor_flash_device = {
71         .name           = "physmap-flash",
72         .resource       = kfr2r09_nor_flash_resources,
73         .num_resources  = ARRAY_SIZE(kfr2r09_nor_flash_resources),
74         .dev            = {
75                 .platform_data = &kfr2r09_nor_flash_data,
76         },
77 };
78
79 static struct resource kfr2r09_nand_flash_resources[] = {
80         [0] = {
81                 .name           = "NAND Flash",
82                 .start          = 0x10000000,
83                 .end            = 0x1001ffff,
84                 .flags          = IORESOURCE_MEM,
85         }
86 };
87
88 static struct platform_device kfr2r09_nand_flash_device = {
89         .name           = "onenand-flash",
90         .resource       = kfr2r09_nand_flash_resources,
91         .num_resources  = ARRAY_SIZE(kfr2r09_nand_flash_resources),
92 };
93
94 static struct sh_keysc_info kfr2r09_sh_keysc_info = {
95         .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
96         .scan_timing = 3,
97         .delay = 10,
98         .keycodes = {
99                 KEY_PHONE, KEY_CLEAR, KEY_MAIL, KEY_WWW, KEY_ENTER,
100                 KEY_1, KEY_2, KEY_3, 0, KEY_UP,
101                 KEY_4, KEY_5, KEY_6, 0, KEY_LEFT,
102                 KEY_7, KEY_8, KEY_9, KEY_PROG1, KEY_RIGHT,
103                 KEY_S, KEY_0, KEY_P, KEY_PROG2, KEY_DOWN,
104                 0, 0, 0, 0, 0
105         },
106 };
107
108 static struct resource kfr2r09_sh_keysc_resources[] = {
109         [0] = {
110                 .name   = "KEYSC",
111                 .start  = 0x044b0000,
112                 .end    = 0x044b000f,
113                 .flags  = IORESOURCE_MEM,
114         },
115         [1] = {
116                 .start  = evt2irq(0xbe0),
117                 .flags  = IORESOURCE_IRQ,
118         },
119 };
120
121 static struct platform_device kfr2r09_sh_keysc_device = {
122         .name           = "sh_keysc",
123         .id             = 0, /* "keysc0" clock */
124         .num_resources  = ARRAY_SIZE(kfr2r09_sh_keysc_resources),
125         .resource       = kfr2r09_sh_keysc_resources,
126         .dev    = {
127                 .platform_data  = &kfr2r09_sh_keysc_info,
128         },
129 };
130
131 static const struct fb_videomode kfr2r09_lcdc_modes[] = {
132         {
133                 .name = "TX07D34VM0AAA",
134                 .xres = 240,
135                 .yres = 400,
136                 .left_margin = 0,
137                 .right_margin = 16,
138                 .hsync_len = 8,
139                 .upper_margin = 0,
140                 .lower_margin = 1,
141                 .vsync_len = 1,
142                 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
143         },
144 };
145
146 static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
147         .clock_source = LCDC_CLK_BUS,
148         .ch[0] = {
149                 .chan = LCDC_CHAN_MAINLCD,
150                 .fourcc = V4L2_PIX_FMT_RGB565,
151                 .interface_type = SYS18,
152                 .clock_divider = 6,
153                 .flags = LCDC_FLAGS_DWPOL,
154                 .lcd_modes = kfr2r09_lcdc_modes,
155                 .num_modes = ARRAY_SIZE(kfr2r09_lcdc_modes),
156                 .panel_cfg = {
157                         .width = 35,
158                         .height = 58,
159                         .setup_sys = kfr2r09_lcd_setup,
160                         .start_transfer = kfr2r09_lcd_start,
161                         .display_on = kfr2r09_lcd_on,
162                         .display_off = kfr2r09_lcd_off,
163                 },
164                 .sys_bus_cfg = {
165                         .ldmt2r = 0x07010904,
166                         .ldmt3r = 0x14012914,
167                         /* set 1s delay to encourage fsync() */
168                         .deferred_io_msec = 1000,
169                 },
170         }
171 };
172
173 static struct resource kfr2r09_sh_lcdc_resources[] = {
174         [0] = {
175                 .name   = "LCDC",
176                 .start  = 0xfe940000, /* P4-only space */
177                 .end    = 0xfe942fff,
178                 .flags  = IORESOURCE_MEM,
179         },
180         [1] = {
181                 .start  = evt2irq(0xf40),
182                 .flags  = IORESOURCE_IRQ,
183         },
184 };
185
186 static struct platform_device kfr2r09_sh_lcdc_device = {
187         .name           = "sh_mobile_lcdc_fb",
188         .num_resources  = ARRAY_SIZE(kfr2r09_sh_lcdc_resources),
189         .resource       = kfr2r09_sh_lcdc_resources,
190         .dev    = {
191                 .platform_data  = &kfr2r09_sh_lcdc_info,
192         },
193 };
194
195 static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
196         .on_chip = 1,
197 };
198
199 static struct resource kfr2r09_usb0_gadget_resources[] = {
200         [0] = {
201                 .start  = 0x04d80000,
202                 .end    = 0x04d80123,
203                 .flags  = IORESOURCE_MEM,
204         },
205         [1] = {
206                 .start  = evt2irq(0xa20),
207                 .end    = evt2irq(0xa20),
208                 .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
209         },
210 };
211
212 static struct platform_device kfr2r09_usb0_gadget_device = {
213         .name           = "r8a66597_udc",
214         .id             = 0,
215         .dev = {
216                 .dma_mask               = NULL,         /*  not use dma */
217                 .coherent_dma_mask      = 0xffffffff,
218                 .platform_data  = &kfr2r09_usb0_gadget_data,
219         },
220         .num_resources  = ARRAY_SIZE(kfr2r09_usb0_gadget_resources),
221         .resource       = kfr2r09_usb0_gadget_resources,
222 };
223
224 static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
225         .flags = SH_CEU_FLAG_USE_8BIT_BUS,
226 };
227
228 static struct resource kfr2r09_ceu_resources[] = {
229         [0] = {
230                 .name   = "CEU",
231                 .start  = 0xfe910000,
232                 .end    = 0xfe91009f,
233                 .flags  = IORESOURCE_MEM,
234         },
235         [1] = {
236                 .start  = evt2irq(0x880),
237                 .end    = evt2irq(0x880),
238                 .flags  = IORESOURCE_IRQ,
239         },
240         [2] = {
241                 /* place holder for contiguous memory */
242         },
243 };
244
245 static struct platform_device kfr2r09_ceu_device = {
246         .name           = "sh_mobile_ceu",
247         .id             = 0, /* "ceu0" clock */
248         .num_resources  = ARRAY_SIZE(kfr2r09_ceu_resources),
249         .resource       = kfr2r09_ceu_resources,
250         .dev    = {
251                 .platform_data  = &sh_mobile_ceu_info,
252         },
253 };
254
255 static struct i2c_board_info kfr2r09_i2c_camera = {
256         I2C_BOARD_INFO("rj54n1cb0c", 0x50),
257 };
258
259 static struct clk *camera_clk;
260
261 /* set VIO_CKO clock to 25MHz */
262 #define CEU_MCLK_FREQ 25000000
263
264 #define DRVCRB 0xA405018C
265 static int camera_power(struct device *dev, int mode)
266 {
267         int ret;
268
269         if (mode) {
270                 long rate;
271
272                 camera_clk = clk_get(NULL, "video_clk");
273                 if (IS_ERR(camera_clk))
274                         return PTR_ERR(camera_clk);
275
276                 rate = clk_round_rate(camera_clk, CEU_MCLK_FREQ);
277                 ret = clk_set_rate(camera_clk, rate);
278                 if (ret < 0)
279                         goto eclkrate;
280
281                 /* set DRVCRB
282                  *
283                  * use 1.8 V for VccQ_VIO
284                  * use 2.85V for VccQ_SR
285                  */
286                 __raw_writew((__raw_readw(DRVCRB) & ~0x0003) | 0x0001, DRVCRB);
287
288                 /* reset clear */
289                 ret = gpio_request(GPIO_PTB4, NULL);
290                 if (ret < 0)
291                         goto eptb4;
292                 ret = gpio_request(GPIO_PTB7, NULL);
293                 if (ret < 0)
294                         goto eptb7;
295
296                 ret = gpio_direction_output(GPIO_PTB4, 1);
297                 if (!ret)
298                         ret = gpio_direction_output(GPIO_PTB7, 1);
299                 if (ret < 0)
300                         goto egpioout;
301                 msleep(1);
302
303                 ret = clk_enable(camera_clk);   /* start VIO_CKO */
304                 if (ret < 0)
305                         goto eclkon;
306
307                 return 0;
308         }
309
310         ret = 0;
311
312         clk_disable(camera_clk);
313 eclkon:
314         gpio_set_value(GPIO_PTB7, 0);
315 egpioout:
316         gpio_set_value(GPIO_PTB4, 0);
317         gpio_free(GPIO_PTB7);
318 eptb7:
319         gpio_free(GPIO_PTB4);
320 eptb4:
321 eclkrate:
322         clk_put(camera_clk);
323         return ret;
324 }
325
326 static struct rj54n1_pdata rj54n1_priv = {
327         .mclk_freq      = CEU_MCLK_FREQ,
328         .ioctl_high     = false,
329 };
330
331 static struct soc_camera_link rj54n1_link = {
332         .power          = camera_power,
333         .board_info     = &kfr2r09_i2c_camera,
334         .i2c_adapter_id = 1,
335         .priv           = &rj54n1_priv,
336 };
337
338 static struct platform_device kfr2r09_camera = {
339         .name   = "soc-camera-pdrv",
340         .id     = 0,
341         .dev    = {
342                 .platform_data = &rj54n1_link,
343         },
344 };
345
346 /* Fixed 3.3V regulator to be used by SDHI0 */
347 static struct regulator_consumer_supply fixed3v3_power_consumers[] =
348 {
349         REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
350         REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
351 };
352
353 static struct resource kfr2r09_sh_sdhi0_resources[] = {
354         [0] = {
355                 .name   = "SDHI0",
356                 .start  = 0x04ce0000,
357                 .end    = 0x04ce00ff,
358                 .flags  = IORESOURCE_MEM,
359         },
360         [1] = {
361                 .start  = evt2irq(0xe80),
362                 .flags  = IORESOURCE_IRQ,
363         },
364 };
365
366 static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
367         .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
368         .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
369         .tmio_flags     = TMIO_MMC_WRPROTECT_DISABLE,
370         .tmio_caps      = MMC_CAP_SDIO_IRQ,
371 };
372
373 static struct platform_device kfr2r09_sh_sdhi0_device = {
374         .name           = "sh_mobile_sdhi",
375         .num_resources  = ARRAY_SIZE(kfr2r09_sh_sdhi0_resources),
376         .resource       = kfr2r09_sh_sdhi0_resources,
377         .dev = {
378                 .platform_data  = &sh7724_sdhi0_data,
379         },
380 };
381
382 static struct platform_device *kfr2r09_devices[] __initdata = {
383         &kfr2r09_nor_flash_device,
384         &kfr2r09_nand_flash_device,
385         &kfr2r09_sh_keysc_device,
386         &kfr2r09_sh_lcdc_device,
387         &kfr2r09_ceu_device,
388         &kfr2r09_camera,
389         &kfr2r09_sh_sdhi0_device,
390 };
391
392 #define BSC_CS0BCR 0xfec10004
393 #define BSC_CS0WCR 0xfec10024
394 #define BSC_CS4BCR 0xfec10010
395 #define BSC_CS4WCR 0xfec10030
396 #define PORT_MSELCRB 0xa4050182
397
398 #ifdef CONFIG_I2C
399 static int kfr2r09_usb0_gadget_i2c_setup(void)
400 {
401         struct i2c_adapter *a;
402         struct i2c_msg msg;
403         unsigned char buf[2];
404         int ret;
405
406         a = i2c_get_adapter(0);
407         if (!a)
408                 return -ENODEV;
409
410         /* set bit 1 (the second bit) of chip at 0x09, register 0x13 */
411         buf[0] = 0x13;
412         msg.addr = 0x09;
413         msg.buf = buf;
414         msg.len = 1;
415         msg.flags = 0;
416         ret = i2c_transfer(a, &msg, 1);
417         if (ret != 1)
418                 return -ENODEV;
419
420         buf[0] = 0;
421         msg.addr = 0x09;
422         msg.buf = buf;
423         msg.len = 1;
424         msg.flags = I2C_M_RD;
425         ret = i2c_transfer(a, &msg, 1);
426         if (ret != 1)
427                 return -ENODEV;
428
429         buf[1] = buf[0] | (1 << 1);
430         buf[0] = 0x13;
431         msg.addr = 0x09;
432         msg.buf = buf;
433         msg.len = 2;
434         msg.flags = 0;
435         ret = i2c_transfer(a, &msg, 1);
436         if (ret != 1)
437                 return -ENODEV;
438
439         return 0;
440 }
441
442 static int kfr2r09_serial_i2c_setup(void)
443 {
444         struct i2c_adapter *a;
445         struct i2c_msg msg;
446         unsigned char buf[2];
447         int ret;
448
449         a = i2c_get_adapter(0);
450         if (!a)
451                 return -ENODEV;
452
453         /* set bit 6 (the 7th bit) of chip at 0x09, register 0x13 */
454         buf[0] = 0x13;
455         msg.addr = 0x09;
456         msg.buf = buf;
457         msg.len = 1;
458         msg.flags = 0;
459         ret = i2c_transfer(a, &msg, 1);
460         if (ret != 1)
461                 return -ENODEV;
462
463         buf[0] = 0;
464         msg.addr = 0x09;
465         msg.buf = buf;
466         msg.len = 1;
467         msg.flags = I2C_M_RD;
468         ret = i2c_transfer(a, &msg, 1);
469         if (ret != 1)
470                 return -ENODEV;
471
472         buf[1] = buf[0] | (1 << 6);
473         buf[0] = 0x13;
474         msg.addr = 0x09;
475         msg.buf = buf;
476         msg.len = 2;
477         msg.flags = 0;
478         ret = i2c_transfer(a, &msg, 1);
479         if (ret != 1)
480                 return -ENODEV;
481
482         return 0;
483 }
484 #else
485 static int kfr2r09_usb0_gadget_i2c_setup(void)
486 {
487         return -ENODEV;
488 }
489
490 static int kfr2r09_serial_i2c_setup(void)
491 {
492         return -ENODEV;
493 }
494 #endif
495
496 static int kfr2r09_usb0_gadget_setup(void)
497 {
498         int plugged_in;
499
500         gpio_request(GPIO_PTN4, NULL); /* USB_DET */
501         gpio_direction_input(GPIO_PTN4);
502         plugged_in = gpio_get_value(GPIO_PTN4);
503         if (!plugged_in)
504                 return -ENODEV; /* no cable plugged in */
505
506         if (kfr2r09_usb0_gadget_i2c_setup() != 0)
507                 return -ENODEV; /* unable to configure using i2c */
508
509         __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
510         gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
511         gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
512         gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
513         msleep(20); /* wait 20ms to let the clock settle */
514         clk_enable(clk_get(NULL, "usb0"));
515         __raw_writew(0x0600, 0xa40501d4);
516
517         return 0;
518 }
519
520 extern char kfr2r09_sdram_enter_start;
521 extern char kfr2r09_sdram_enter_end;
522 extern char kfr2r09_sdram_leave_start;
523 extern char kfr2r09_sdram_leave_end;
524
525 static int __init kfr2r09_devices_setup(void)
526 {
527         /* register board specific self-refresh code */
528         sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
529                                         SUSP_SH_RSTANDBY,
530                                         &kfr2r09_sdram_enter_start,
531                                         &kfr2r09_sdram_enter_end,
532                                         &kfr2r09_sdram_leave_start,
533                                         &kfr2r09_sdram_leave_end);
534
535         regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
536                                      ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
537
538         /* enable SCIF1 serial port for YC401 console support */
539         gpio_request(GPIO_FN_SCIF1_RXD, NULL);
540         gpio_request(GPIO_FN_SCIF1_TXD, NULL);
541         kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
542         gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
543         gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
544
545         /* setup NOR flash at CS0 */
546         __raw_writel(0x36db0400, BSC_CS0BCR);
547         __raw_writel(0x00000500, BSC_CS0WCR);
548
549         /* setup NAND flash at CS4 */
550         __raw_writel(0x36db0400, BSC_CS4BCR);
551         __raw_writel(0x00000500, BSC_CS4WCR);
552
553         /* setup KEYSC pins */
554         gpio_request(GPIO_FN_KEYOUT0, NULL);
555         gpio_request(GPIO_FN_KEYOUT1, NULL);
556         gpio_request(GPIO_FN_KEYOUT2, NULL);
557         gpio_request(GPIO_FN_KEYOUT3, NULL);
558         gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
559         gpio_request(GPIO_FN_KEYIN0, NULL);
560         gpio_request(GPIO_FN_KEYIN1, NULL);
561         gpio_request(GPIO_FN_KEYIN2, NULL);
562         gpio_request(GPIO_FN_KEYIN3, NULL);
563         gpio_request(GPIO_FN_KEYIN4, NULL);
564         gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
565
566         /* setup LCDC pins for SYS panel */
567         gpio_request(GPIO_FN_LCDD17, NULL);
568         gpio_request(GPIO_FN_LCDD16, NULL);
569         gpio_request(GPIO_FN_LCDD15, NULL);
570         gpio_request(GPIO_FN_LCDD14, NULL);
571         gpio_request(GPIO_FN_LCDD13, NULL);
572         gpio_request(GPIO_FN_LCDD12, NULL);
573         gpio_request(GPIO_FN_LCDD11, NULL);
574         gpio_request(GPIO_FN_LCDD10, NULL);
575         gpio_request(GPIO_FN_LCDD9, NULL);
576         gpio_request(GPIO_FN_LCDD8, NULL);
577         gpio_request(GPIO_FN_LCDD7, NULL);
578         gpio_request(GPIO_FN_LCDD6, NULL);
579         gpio_request(GPIO_FN_LCDD5, NULL);
580         gpio_request(GPIO_FN_LCDD4, NULL);
581         gpio_request(GPIO_FN_LCDD3, NULL);
582         gpio_request(GPIO_FN_LCDD2, NULL);
583         gpio_request(GPIO_FN_LCDD1, NULL);
584         gpio_request(GPIO_FN_LCDD0, NULL);
585         gpio_request(GPIO_FN_LCDRS, NULL); /* LCD_RS */
586         gpio_request(GPIO_FN_LCDCS, NULL); /* LCD_CS/ */
587         gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */
588         gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */
589         gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */
590         gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */
591         gpio_direction_output(GPIO_PTE4, 1);
592         gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */
593         gpio_direction_output(GPIO_PTF4, 1);
594         gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
595         gpio_direction_output(GPIO_PTU0, 1);
596
597         /* setup USB function */
598         if (kfr2r09_usb0_gadget_setup() == 0)
599                 platform_device_register(&kfr2r09_usb0_gadget_device);
600
601         /* CEU */
602         gpio_request(GPIO_FN_VIO_CKO, NULL);
603         gpio_request(GPIO_FN_VIO0_CLK, NULL);
604         gpio_request(GPIO_FN_VIO0_VD, NULL);
605         gpio_request(GPIO_FN_VIO0_HD, NULL);
606         gpio_request(GPIO_FN_VIO0_FLD, NULL);
607         gpio_request(GPIO_FN_VIO0_D7, NULL);
608         gpio_request(GPIO_FN_VIO0_D6, NULL);
609         gpio_request(GPIO_FN_VIO0_D5, NULL);
610         gpio_request(GPIO_FN_VIO0_D4, NULL);
611         gpio_request(GPIO_FN_VIO0_D3, NULL);
612         gpio_request(GPIO_FN_VIO0_D2, NULL);
613         gpio_request(GPIO_FN_VIO0_D1, NULL);
614         gpio_request(GPIO_FN_VIO0_D0, NULL);
615
616         platform_resource_setup_memory(&kfr2r09_ceu_device, "ceu", 4 << 20);
617
618         /* SDHI0 connected to yc304 */
619         gpio_request(GPIO_FN_SDHI0CD, NULL);
620         gpio_request(GPIO_FN_SDHI0D3, NULL);
621         gpio_request(GPIO_FN_SDHI0D2, NULL);
622         gpio_request(GPIO_FN_SDHI0D1, NULL);
623         gpio_request(GPIO_FN_SDHI0D0, NULL);
624         gpio_request(GPIO_FN_SDHI0CMD, NULL);
625         gpio_request(GPIO_FN_SDHI0CLK, NULL);
626
627         return platform_add_devices(kfr2r09_devices,
628                                     ARRAY_SIZE(kfr2r09_devices));
629 }
630 device_initcall(kfr2r09_devices_setup);
631
632 /* Return the board specific boot mode pin configuration */
633 static int kfr2r09_mode_pins(void)
634 {
635         /* MD0=1, MD1=1, MD2=0: Clock Mode 3
636          * MD3=0: 16-bit Area0 Bus Width
637          * MD5=1: Little Endian
638          * MD8=1: Test Mode Disabled
639          */
640         return MODE_PIN0 | MODE_PIN1 | MODE_PIN5 | MODE_PIN8;
641 }
642
643 /*
644  * The Machine Vector
645  */
646 static struct sh_machine_vector mv_kfr2r09 __initmv = {
647         .mv_name                = "kfr2r09",
648         .mv_mode_pins           = kfr2r09_mode_pins,
649 };