1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <linux/delay.h>
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/platform_device.h>
30#include <linux/gpio.h>
31#include <linux/input.h>
32#include <linux/io.h>
33#include <linux/i2c.h>
34#include <linux/leds.h>
35#include <linux/mfd/tmio.h>
36#include <linux/mmc/host.h>
37#include <linux/mmc/sh_mmcif.h>
38#include <linux/mmc/sh_mobile_sdhi.h>
39#include <linux/mtd/mtd.h>
40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h>
43#include <linux/pm_clock.h>
44#include <linux/regulator/fixed.h>
45#include <linux/regulator/machine.h>
46#include <linux/smsc911x.h>
47#include <linux/sh_intc.h>
48#include <linux/tca6416_keypad.h>
49#include <linux/usb/renesas_usbhs.h>
50#include <linux/dma-mapping.h>
51
52#include <video/sh_mobile_hdmi.h>
53#include <video/sh_mobile_lcdc.h>
54#include <media/sh_mobile_ceu.h>
55#include <media/soc_camera.h>
56#include <media/soc_camera_platform.h>
57#include <sound/sh_fsi.h>
58#include <sound/simple_card.h>
59
60#include <mach/common.h>
61#include <mach/irqs.h>
62#include <mach/sh7372.h>
63
64#include <asm/mach/arch.h>
65#include <asm/mach-types.h>
66
67#include "sh-gpio.h"
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211static struct regulator_consumer_supply fixed1v8_power_consumers[] =
212{
213
214
215
216
217 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
218 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
219 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
220 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
221};
222
223static struct regulator_consumer_supply fixed3v3_power_consumers[] =
224{
225 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
226 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
227 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
228 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.2"),
229};
230
231
232static struct regulator_consumer_supply dummy_supplies[] = {
233 REGULATOR_SUPPLY("vddvario", "smsc911x"),
234 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
235};
236
237
238static struct mtd_partition nor_flash_partitions[] = {
239 {
240 .name = "loader",
241 .offset = 0x00000000,
242 .size = 512 * 1024,
243 .mask_flags = MTD_WRITEABLE,
244 },
245 {
246 .name = "bootenv",
247 .offset = MTDPART_OFS_APPEND,
248 .size = 512 * 1024,
249 .mask_flags = MTD_WRITEABLE,
250 },
251 {
252 .name = "kernel_ro",
253 .offset = MTDPART_OFS_APPEND,
254 .size = 8 * 1024 * 1024,
255 .mask_flags = MTD_WRITEABLE,
256 },
257 {
258 .name = "kernel",
259 .offset = MTDPART_OFS_APPEND,
260 .size = 8 * 1024 * 1024,
261 },
262 {
263 .name = "data",
264 .offset = MTDPART_OFS_APPEND,
265 .size = MTDPART_SIZ_FULL,
266 },
267};
268
269static struct physmap_flash_data nor_flash_data = {
270 .width = 2,
271 .parts = nor_flash_partitions,
272 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
273};
274
275static struct resource nor_flash_resources[] = {
276 [0] = {
277 .start = 0x20000000,
278 .end = 0x28000000 - 1,
279 .flags = IORESOURCE_MEM,
280 }
281};
282
283static struct platform_device nor_flash_device = {
284 .name = "physmap-flash",
285 .dev = {
286 .platform_data = &nor_flash_data,
287 },
288 .num_resources = ARRAY_SIZE(nor_flash_resources),
289 .resource = nor_flash_resources,
290};
291
292
293static struct resource smc911x_resources[] = {
294 {
295 .start = 0x14000000,
296 .end = 0x16000000 - 1,
297 .flags = IORESOURCE_MEM,
298 }, {
299 .start = evt2irq(0x02c0) ,
300 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
301 },
302};
303
304static struct smsc911x_platform_config smsc911x_info = {
305 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
306 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
307 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
308};
309
310static struct platform_device smc911x_device = {
311 .name = "smsc911x",
312 .id = -1,
313 .num_resources = ARRAY_SIZE(smc911x_resources),
314 .resource = smc911x_resources,
315 .dev = {
316 .platform_data = &smsc911x_info,
317 },
318};
319
320
321static struct sh_mobile_meram_info mackerel_meram_info = {
322 .addr_mode = SH_MOBILE_MERAM_MODE1,
323};
324
325static struct resource meram_resources[] = {
326 [0] = {
327 .name = "regs",
328 .start = 0xe8000000,
329 .end = 0xe807ffff,
330 .flags = IORESOURCE_MEM,
331 },
332 [1] = {
333 .name = "meram",
334 .start = 0xe8080000,
335 .end = 0xe81fffff,
336 .flags = IORESOURCE_MEM,
337 },
338};
339
340static struct platform_device meram_device = {
341 .name = "sh_mobile_meram",
342 .id = 0,
343 .num_resources = ARRAY_SIZE(meram_resources),
344 .resource = meram_resources,
345 .dev = {
346 .platform_data = &mackerel_meram_info,
347 },
348};
349
350
351static struct fb_videomode mackerel_lcdc_modes[] = {
352 {
353 .name = "WVGA Panel",
354 .xres = 800,
355 .yres = 480,
356 .left_margin = 220,
357 .right_margin = 110,
358 .hsync_len = 70,
359 .upper_margin = 20,
360 .lower_margin = 5,
361 .vsync_len = 5,
362 .sync = 0,
363 },
364};
365
366static int mackerel_set_brightness(int brightness)
367{
368 gpio_set_value(GPIO_PORT31, brightness);
369
370 return 0;
371}
372
373static int mackerel_get_brightness(void)
374{
375 return gpio_get_value(GPIO_PORT31);
376}
377
378static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
379 .icb[0] = {
380 .meram_size = 0x40,
381 },
382 .icb[1] = {
383 .meram_size = 0x40,
384 },
385};
386
387static struct sh_mobile_lcdc_info lcdc_info = {
388 .meram_dev = &mackerel_meram_info,
389 .clock_source = LCDC_CLK_BUS,
390 .ch[0] = {
391 .chan = LCDC_CHAN_MAINLCD,
392 .fourcc = V4L2_PIX_FMT_RGB565,
393 .lcd_modes = mackerel_lcdc_modes,
394 .num_modes = ARRAY_SIZE(mackerel_lcdc_modes),
395 .interface_type = RGB24,
396 .clock_divider = 3,
397 .flags = 0,
398 .panel_cfg = {
399 .width = 152,
400 .height = 91,
401 },
402 .bl_info = {
403 .name = "sh_mobile_lcdc_bl",
404 .max_brightness = 1,
405 .set_brightness = mackerel_set_brightness,
406 .get_brightness = mackerel_get_brightness,
407 },
408 .meram_cfg = &lcd_meram_cfg,
409 }
410};
411
412static struct resource lcdc_resources[] = {
413 [0] = {
414 .name = "LCDC",
415 .start = 0xfe940000,
416 .end = 0xfe943fff,
417 .flags = IORESOURCE_MEM,
418 },
419 [1] = {
420 .start = intcs_evt2irq(0x580),
421 .flags = IORESOURCE_IRQ,
422 },
423};
424
425static struct platform_device lcdc_device = {
426 .name = "sh_mobile_lcdc_fb",
427 .num_resources = ARRAY_SIZE(lcdc_resources),
428 .resource = lcdc_resources,
429 .dev = {
430 .platform_data = &lcdc_info,
431 .coherent_dma_mask = ~0,
432 },
433};
434
435
436static struct sh_mobile_hdmi_info hdmi_info = {
437 .flags = HDMI_SND_SRC_SPDIF,
438};
439
440static struct resource hdmi_resources[] = {
441 [0] = {
442 .name = "HDMI",
443 .start = 0xe6be0000,
444 .end = 0xe6be00ff,
445 .flags = IORESOURCE_MEM,
446 },
447 [1] = {
448
449 .start = evt2irq(0x17e0),
450 .flags = IORESOURCE_IRQ,
451 },
452};
453
454static struct platform_device hdmi_device = {
455 .name = "sh-mobile-hdmi",
456 .num_resources = ARRAY_SIZE(hdmi_resources),
457 .resource = hdmi_resources,
458 .id = -1,
459 .dev = {
460 .platform_data = &hdmi_info,
461 },
462};
463
464static const struct sh_mobile_meram_cfg hdmi_meram_cfg = {
465 .icb[0] = {
466 .meram_size = 0x100,
467 },
468 .icb[1] = {
469 .meram_size = 0x100,
470 },
471};
472
473static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
474 .meram_dev = &mackerel_meram_info,
475 .clock_source = LCDC_CLK_EXTERNAL,
476 .ch[0] = {
477 .chan = LCDC_CHAN_MAINLCD,
478 .fourcc = V4L2_PIX_FMT_RGB565,
479 .interface_type = RGB24,
480 .clock_divider = 1,
481 .flags = LCDC_FLAGS_DWPOL,
482 .meram_cfg = &hdmi_meram_cfg,
483 .tx_dev = &hdmi_device,
484 }
485};
486
487static struct resource hdmi_lcdc_resources[] = {
488 [0] = {
489 .name = "LCDC1",
490 .start = 0xfe944000,
491 .end = 0xfe947fff,
492 .flags = IORESOURCE_MEM,
493 },
494 [1] = {
495 .start = intcs_evt2irq(0x1780),
496 .flags = IORESOURCE_IRQ,
497 },
498};
499
500static struct platform_device hdmi_lcdc_device = {
501 .name = "sh_mobile_lcdc_fb",
502 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
503 .resource = hdmi_lcdc_resources,
504 .id = 1,
505 .dev = {
506 .platform_data = &hdmi_lcdc_info,
507 .coherent_dma_mask = ~0,
508 },
509};
510
511static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
512 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
513};
514
515static struct asoc_simple_card_info fsi2_hdmi_info = {
516 .name = "HDMI",
517 .card = "FSI2B-HDMI",
518 .cpu_dai = "fsib-dai",
519 .codec = "sh-mobile-hdmi",
520 .platform = "sh_fsi2",
521 .codec_dai = "sh_mobile_hdmi-hifi",
522 .init = &fsi2_hdmi_init_info,
523};
524
525static struct platform_device fsi_hdmi_device = {
526 .name = "asoc-simple-card",
527 .id = 1,
528 .dev = {
529 .platform_data = &fsi2_hdmi_info,
530 },
531};
532
533static void __init hdmi_init_pm_clock(void)
534{
535 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
536 int ret;
537 long rate;
538
539 if (IS_ERR(hdmi_ick)) {
540 ret = PTR_ERR(hdmi_ick);
541 pr_err("Cannot get HDMI ICK: %d\n", ret);
542 goto out;
543 }
544
545 ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk);
546 if (ret < 0) {
547 pr_err("Cannot set PLLC2 parent: %d, %d users\n",
548 ret, sh7372_pllc2_clk.usecount);
549 goto out;
550 }
551
552 pr_debug("PLLC2 initial frequency %lu\n",
553 clk_get_rate(&sh7372_pllc2_clk));
554
555 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
556 if (rate < 0) {
557 pr_err("Cannot get suitable rate: %ld\n", rate);
558 ret = rate;
559 goto out;
560 }
561
562 ret = clk_set_rate(&sh7372_pllc2_clk, rate);
563 if (ret < 0) {
564 pr_err("Cannot set rate %ld: %d\n", rate, ret);
565 goto out;
566 }
567
568 pr_debug("PLLC2 set frequency %lu\n", rate);
569
570 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
571 if (ret < 0)
572 pr_err("Cannot set HDMI parent: %d\n", ret);
573
574out:
575 if (!IS_ERR(hdmi_ick))
576 clk_put(hdmi_ick);
577}
578
579
580
581
582
583
584
585#define USBHS0_POLL_INTERVAL (HZ * 5)
586
587struct usbhs_private {
588 void __iomem *usbphyaddr;
589 void __iomem *usbcrcaddr;
590 struct renesas_usbhs_platform_info info;
591 struct delayed_work work;
592 struct platform_device *pdev;
593};
594
595#define usbhs_get_priv(pdev) \
596 container_of(renesas_usbhs_get_info(pdev), \
597 struct usbhs_private, info)
598
599#define usbhs_is_connected(priv) \
600 (!((1 << 7) & __raw_readw(priv->usbcrcaddr)))
601
602static int usbhs_get_vbus(struct platform_device *pdev)
603{
604 return usbhs_is_connected(usbhs_get_priv(pdev));
605}
606
607static void usbhs_phy_reset(struct platform_device *pdev)
608{
609 struct usbhs_private *priv = usbhs_get_priv(pdev);
610
611
612 __raw_writew(0x8a0a, priv->usbcrcaddr);
613}
614
615static int usbhs0_get_id(struct platform_device *pdev)
616{
617 return USBHS_GADGET;
618}
619
620static void usbhs0_work_function(struct work_struct *work)
621{
622 struct usbhs_private *priv = container_of(work, struct usbhs_private,
623 work.work);
624
625 renesas_usbhs_call_notify_hotplug(priv->pdev);
626 schedule_delayed_work(&priv->work, USBHS0_POLL_INTERVAL);
627}
628
629static int usbhs0_hardware_init(struct platform_device *pdev)
630{
631 struct usbhs_private *priv = usbhs_get_priv(pdev);
632
633 priv->pdev = pdev;
634 INIT_DELAYED_WORK(&priv->work, usbhs0_work_function);
635 schedule_delayed_work(&priv->work, USBHS0_POLL_INTERVAL);
636 return 0;
637}
638
639static void usbhs0_hardware_exit(struct platform_device *pdev)
640{
641 struct usbhs_private *priv = usbhs_get_priv(pdev);
642
643 cancel_delayed_work_sync(&priv->work);
644}
645
646static struct usbhs_private usbhs0_private = {
647 .usbcrcaddr = IOMEM(0xe605810c),
648 .info = {
649 .platform_callback = {
650 .hardware_init = usbhs0_hardware_init,
651 .hardware_exit = usbhs0_hardware_exit,
652 .phy_reset = usbhs_phy_reset,
653 .get_id = usbhs0_get_id,
654 .get_vbus = usbhs_get_vbus,
655 },
656 .driver_param = {
657 .buswait_bwait = 4,
658 .d0_tx_id = SHDMA_SLAVE_USB0_TX,
659 .d1_rx_id = SHDMA_SLAVE_USB0_RX,
660 },
661 },
662};
663
664static struct resource usbhs0_resources[] = {
665 [0] = {
666 .name = "USBHS0",
667 .start = 0xe6890000,
668 .end = 0xe68900e6 - 1,
669 .flags = IORESOURCE_MEM,
670 },
671 [1] = {
672 .start = evt2irq(0x1ca0) ,
673 .flags = IORESOURCE_IRQ,
674 },
675};
676
677static struct platform_device usbhs0_device = {
678 .name = "renesas_usbhs",
679 .id = 0,
680 .dev = {
681 .platform_data = &usbhs0_private.info,
682 },
683 .num_resources = ARRAY_SIZE(usbhs0_resources),
684 .resource = usbhs0_resources,
685};
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702#define IRQ8 evt2irq(0x0300)
703#define USB_PHY_MODE (1 << 4)
704#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
705#define USB_PHY_ON (1 << 1)
706#define USB_PHY_OFF (1 << 0)
707#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
708
709static irqreturn_t usbhs1_interrupt(int irq, void *data)
710{
711 struct platform_device *pdev = data;
712 struct usbhs_private *priv = usbhs_get_priv(pdev);
713
714 dev_dbg(&pdev->dev, "%s\n", __func__);
715
716 renesas_usbhs_call_notify_hotplug(pdev);
717
718
719 __raw_writew(__raw_readw(priv->usbphyaddr) | USB_PHY_INT_CLR,
720 priv->usbphyaddr);
721
722 return IRQ_HANDLED;
723}
724
725static int usbhs1_hardware_init(struct platform_device *pdev)
726{
727 struct usbhs_private *priv = usbhs_get_priv(pdev);
728 int ret;
729
730
731 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr);
732
733 ret = request_irq(IRQ8, usbhs1_interrupt, IRQF_TRIGGER_HIGH,
734 dev_name(&pdev->dev), pdev);
735 if (ret) {
736 dev_err(&pdev->dev, "request_irq err\n");
737 return ret;
738 }
739
740
741 __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->usbphyaddr);
742
743 return 0;
744}
745
746static void usbhs1_hardware_exit(struct platform_device *pdev)
747{
748 struct usbhs_private *priv = usbhs_get_priv(pdev);
749
750
751 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->usbphyaddr);
752
753 free_irq(IRQ8, pdev);
754}
755
756static int usbhs1_get_id(struct platform_device *pdev)
757{
758 return USBHS_HOST;
759}
760
761static u32 usbhs1_pipe_cfg[] = {
762 USB_ENDPOINT_XFER_CONTROL,
763 USB_ENDPOINT_XFER_ISOC,
764 USB_ENDPOINT_XFER_ISOC,
765 USB_ENDPOINT_XFER_BULK,
766 USB_ENDPOINT_XFER_BULK,
767 USB_ENDPOINT_XFER_BULK,
768 USB_ENDPOINT_XFER_INT,
769 USB_ENDPOINT_XFER_INT,
770 USB_ENDPOINT_XFER_INT,
771 USB_ENDPOINT_XFER_BULK,
772 USB_ENDPOINT_XFER_BULK,
773 USB_ENDPOINT_XFER_BULK,
774 USB_ENDPOINT_XFER_BULK,
775 USB_ENDPOINT_XFER_BULK,
776 USB_ENDPOINT_XFER_BULK,
777 USB_ENDPOINT_XFER_BULK,
778};
779
780static struct usbhs_private usbhs1_private = {
781 .usbphyaddr = IOMEM(0xe60581e2),
782 .usbcrcaddr = IOMEM(0xe6058130),
783 .info = {
784 .platform_callback = {
785 .hardware_init = usbhs1_hardware_init,
786 .hardware_exit = usbhs1_hardware_exit,
787 .get_id = usbhs1_get_id,
788 .phy_reset = usbhs_phy_reset,
789 },
790 .driver_param = {
791 .buswait_bwait = 4,
792 .has_otg = 1,
793 .pipe_type = usbhs1_pipe_cfg,
794 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg),
795 .d0_tx_id = SHDMA_SLAVE_USB1_TX,
796 .d1_rx_id = SHDMA_SLAVE_USB1_RX,
797 },
798 },
799};
800
801static struct resource usbhs1_resources[] = {
802 [0] = {
803 .name = "USBHS1",
804 .start = 0xe68b0000,
805 .end = 0xe68b00e6 - 1,
806 .flags = IORESOURCE_MEM,
807 },
808 [1] = {
809 .start = evt2irq(0x1ce0) ,
810 .flags = IORESOURCE_IRQ,
811 },
812};
813
814static struct platform_device usbhs1_device = {
815 .name = "renesas_usbhs",
816 .id = 1,
817 .dev = {
818 .platform_data = &usbhs1_private.info,
819 },
820 .num_resources = ARRAY_SIZE(usbhs1_resources),
821 .resource = usbhs1_resources,
822};
823
824
825static struct gpio_led mackerel_leds[] = {
826 {
827 .name = "led0",
828 .gpio = GPIO_PORT0,
829 .default_state = LEDS_GPIO_DEFSTATE_ON,
830 },
831 {
832 .name = "led1",
833 .gpio = GPIO_PORT1,
834 .default_state = LEDS_GPIO_DEFSTATE_ON,
835 },
836 {
837 .name = "led2",
838 .gpio = GPIO_PORT2,
839 .default_state = LEDS_GPIO_DEFSTATE_ON,
840 },
841 {
842 .name = "led3",
843 .gpio = GPIO_PORT159,
844 .default_state = LEDS_GPIO_DEFSTATE_ON,
845 }
846};
847
848static struct gpio_led_platform_data mackerel_leds_pdata = {
849 .leds = mackerel_leds,
850 .num_leds = ARRAY_SIZE(mackerel_leds),
851};
852
853static struct platform_device leds_device = {
854 .name = "leds-gpio",
855 .id = 0,
856 .dev = {
857 .platform_data = &mackerel_leds_pdata,
858 },
859};
860
861
862#define IRQ_FSI evt2irq(0x1840)
863static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
864{
865 int ret;
866
867 if (rate <= 0)
868 return 0;
869
870 if (!enable) {
871 clk_disable(clk);
872 return 0;
873 }
874
875 ret = clk_set_rate(clk, clk_round_rate(clk, rate));
876 if (ret < 0)
877 return ret;
878
879 return clk_enable(clk);
880}
881
882static int fsi_b_set_rate(struct device *dev, int rate, int enable)
883{
884 struct clk *fsib_clk;
885 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
886 long fsib_rate = 0;
887 long fdiv_rate = 0;
888 int ackmd_bpfmd;
889 int ret;
890
891
892 switch (rate) {
893 case 44100:
894 fsib_rate = rate * 256;
895 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
896 break;
897 case 48000:
898 fsib_rate = 85428000;
899 fdiv_rate = rate * 256;
900 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
901 break;
902 default:
903 pr_err("unsupported rate in FSI2 port B\n");
904 return -EINVAL;
905 }
906
907
908 fsib_clk = clk_get(dev, "ickb");
909 if (IS_ERR(fsib_clk))
910 return -EIO;
911
912
913 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
914 if (ret < 0)
915 goto fsi_set_rate_end;
916
917
918 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
919 if (ret < 0) {
920
921 if (enable)
922 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
923 goto fsi_set_rate_end;
924 }
925
926 ret = ackmd_bpfmd;
927
928fsi_set_rate_end:
929 clk_put(fsib_clk);
930 return ret;
931}
932
933static struct sh_fsi_platform_info fsi_info = {
934 .port_a = {
935 .flags = SH_FSI_BRS_INV,
936 .tx_id = SHDMA_SLAVE_FSIA_TX,
937 .rx_id = SHDMA_SLAVE_FSIA_RX,
938 },
939 .port_b = {
940 .flags = SH_FSI_BRS_INV |
941 SH_FSI_BRM_INV |
942 SH_FSI_LRS_INV |
943 SH_FSI_FMT_SPDIF,
944 .set_rate = fsi_b_set_rate,
945 }
946};
947
948static struct resource fsi_resources[] = {
949 [0] = {
950
951
952 .name = "FSI",
953 .start = 0xFE1F0000,
954 .end = 0xFE1F0400 - 1,
955 .flags = IORESOURCE_MEM,
956 },
957 [1] = {
958 .start = IRQ_FSI,
959 .flags = IORESOURCE_IRQ,
960 },
961};
962
963static struct platform_device fsi_device = {
964 .name = "sh_fsi2",
965 .id = -1,
966 .num_resources = ARRAY_SIZE(fsi_resources),
967 .resource = fsi_resources,
968 .dev = {
969 .platform_data = &fsi_info,
970 },
971};
972
973static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = {
974 .fmt = SND_SOC_DAIFMT_LEFT_J,
975 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
976 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
977 .sysclk = 11289600,
978};
979
980static struct asoc_simple_card_info fsi2_ak4643_info = {
981 .name = "AK4643",
982 .card = "FSI2A-AK4643",
983 .cpu_dai = "fsia-dai",
984 .codec = "ak4642-codec.0-0013",
985 .platform = "sh_fsi2",
986 .codec_dai = "ak4642-hifi",
987 .init = &fsi2_ak4643_init_info,
988};
989
990static struct platform_device fsi_ak4643_device = {
991 .name = "asoc-simple-card",
992 .dev = {
993 .platform_data = &fsi2_ak4643_info,
994 },
995};
996
997
998static struct mtd_partition nand_partition_info[] = {
999 {
1000 .name = "system",
1001 .offset = 0,
1002 .size = 128 * 1024 * 1024,
1003 },
1004 {
1005 .name = "userdata",
1006 .offset = MTDPART_OFS_APPEND,
1007 .size = 256 * 1024 * 1024,
1008 },
1009 {
1010 .name = "cache",
1011 .offset = MTDPART_OFS_APPEND,
1012 .size = 128 * 1024 * 1024,
1013 },
1014};
1015
1016static struct resource nand_flash_resources[] = {
1017 [0] = {
1018 .start = 0xe6a30000,
1019 .end = 0xe6a3009b,
1020 .flags = IORESOURCE_MEM,
1021 }
1022};
1023
1024static struct sh_flctl_platform_data nand_flash_data = {
1025 .parts = nand_partition_info,
1026 .nr_parts = ARRAY_SIZE(nand_partition_info),
1027 .flcmncr_val = CLK_16B_12L_4H | TYPESEL_SET
1028 | SHBUSSEL | SEL_16BIT | SNAND_E,
1029 .use_holden = 1,
1030};
1031
1032static struct platform_device nand_flash_device = {
1033 .name = "sh_flctl",
1034 .resource = nand_flash_resources,
1035 .num_resources = ARRAY_SIZE(nand_flash_resources),
1036 .dev = {
1037 .platform_data = &nand_flash_data,
1038 },
1039};
1040
1041
1042
1043
1044
1045static int slot_cn7_get_cd(struct platform_device *pdev)
1046{
1047 return !gpio_get_value(GPIO_PORT41);
1048}
1049
1050
1051static struct sh_mobile_sdhi_info sdhi0_info = {
1052 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
1053 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
1054 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
1055 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
1056 .cd_gpio = GPIO_PORT172,
1057};
1058
1059static struct resource sdhi0_resources[] = {
1060 [0] = {
1061 .name = "SDHI0",
1062 .start = 0xe6850000,
1063 .end = 0xe68500ff,
1064 .flags = IORESOURCE_MEM,
1065 },
1066 [1] = {
1067 .start = evt2irq(0x0e00) ,
1068 .flags = IORESOURCE_IRQ,
1069 },
1070 [2] = {
1071 .start = evt2irq(0x0e20) ,
1072 .flags = IORESOURCE_IRQ,
1073 },
1074 [3] = {
1075 .start = evt2irq(0x0e40) ,
1076 .flags = IORESOURCE_IRQ,
1077 },
1078};
1079
1080static struct platform_device sdhi0_device = {
1081 .name = "sh_mobile_sdhi",
1082 .num_resources = ARRAY_SIZE(sdhi0_resources),
1083 .resource = sdhi0_resources,
1084 .id = 0,
1085 .dev = {
1086 .platform_data = &sdhi0_info,
1087 },
1088};
1089
1090#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1091
1092static struct sh_mobile_sdhi_info sdhi1_info = {
1093 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
1094 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
1095 .tmio_ocr_mask = MMC_VDD_165_195,
1096 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
1097 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
1098 MMC_CAP_NEEDS_POLL,
1099 .get_cd = slot_cn7_get_cd,
1100};
1101
1102static struct resource sdhi1_resources[] = {
1103 [0] = {
1104 .name = "SDHI1",
1105 .start = 0xe6860000,
1106 .end = 0xe68600ff,
1107 .flags = IORESOURCE_MEM,
1108 },
1109 [1] = {
1110 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
1111 .start = evt2irq(0x0e80),
1112 .flags = IORESOURCE_IRQ,
1113 },
1114 [2] = {
1115 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
1116 .start = evt2irq(0x0ea0),
1117 .flags = IORESOURCE_IRQ,
1118 },
1119 [3] = {
1120 .name = SH_MOBILE_SDHI_IRQ_SDIO,
1121 .start = evt2irq(0x0ec0),
1122 .flags = IORESOURCE_IRQ,
1123 },
1124};
1125
1126static struct platform_device sdhi1_device = {
1127 .name = "sh_mobile_sdhi",
1128 .num_resources = ARRAY_SIZE(sdhi1_resources),
1129 .resource = sdhi1_resources,
1130 .id = 1,
1131 .dev = {
1132 .platform_data = &sdhi1_info,
1133 },
1134};
1135#endif
1136
1137
1138
1139
1140
1141static int slot_cn23_get_cd(struct platform_device *pdev)
1142{
1143 return !gpio_get_value(GPIO_PORT162);
1144}
1145
1146
1147static struct sh_mobile_sdhi_info sdhi2_info = {
1148 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
1149 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
1150 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
1151 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
1152 MMC_CAP_NEEDS_POLL,
1153 .get_cd = slot_cn23_get_cd,
1154};
1155
1156static struct resource sdhi2_resources[] = {
1157 [0] = {
1158 .name = "SDHI2",
1159 .start = 0xe6870000,
1160 .end = 0xe68700ff,
1161 .flags = IORESOURCE_MEM,
1162 },
1163 [1] = {
1164 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
1165 .start = evt2irq(0x1200),
1166 .flags = IORESOURCE_IRQ,
1167 },
1168 [2] = {
1169 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
1170 .start = evt2irq(0x1220),
1171 .flags = IORESOURCE_IRQ,
1172 },
1173 [3] = {
1174 .name = SH_MOBILE_SDHI_IRQ_SDIO,
1175 .start = evt2irq(0x1240),
1176 .flags = IORESOURCE_IRQ,
1177 },
1178};
1179
1180static struct platform_device sdhi2_device = {
1181 .name = "sh_mobile_sdhi",
1182 .num_resources = ARRAY_SIZE(sdhi2_resources),
1183 .resource = sdhi2_resources,
1184 .id = 2,
1185 .dev = {
1186 .platform_data = &sdhi2_info,
1187 },
1188};
1189
1190
1191static struct resource sh_mmcif_resources[] = {
1192 [0] = {
1193 .name = "MMCIF",
1194 .start = 0xE6BD0000,
1195 .end = 0xE6BD00FF,
1196 .flags = IORESOURCE_MEM,
1197 },
1198 [1] = {
1199
1200 .start = evt2irq(0x1ac0),
1201 .flags = IORESOURCE_IRQ,
1202 },
1203 [2] = {
1204
1205 .start = evt2irq(0x1ae0),
1206 .flags = IORESOURCE_IRQ,
1207 },
1208};
1209
1210static struct sh_mmcif_plat_data sh_mmcif_plat = {
1211 .sup_pclk = 0,
1212 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
1213 .caps = MMC_CAP_4_BIT_DATA |
1214 MMC_CAP_8_BIT_DATA |
1215 MMC_CAP_NEEDS_POLL,
1216 .get_cd = slot_cn7_get_cd,
1217 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
1218 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
1219};
1220
1221static struct platform_device sh_mmcif_device = {
1222 .name = "sh_mmcif",
1223 .id = 0,
1224 .dev = {
1225 .dma_mask = NULL,
1226 .coherent_dma_mask = 0xffffffff,
1227 .platform_data = &sh_mmcif_plat,
1228 },
1229 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
1230 .resource = sh_mmcif_resources,
1231};
1232
1233
1234static int mackerel_camera_add(struct soc_camera_device *icd);
1235static void mackerel_camera_del(struct soc_camera_device *icd);
1236
1237static int camera_set_capture(struct soc_camera_platform_info *info,
1238 int enable)
1239{
1240 return 0;
1241}
1242
1243static struct soc_camera_platform_info camera_info = {
1244 .format_name = "UYVY",
1245 .format_depth = 16,
1246 .format = {
1247 .code = V4L2_MBUS_FMT_UYVY8_2X8,
1248 .colorspace = V4L2_COLORSPACE_SMPTE170M,
1249 .field = V4L2_FIELD_NONE,
1250 .width = 640,
1251 .height = 480,
1252 },
1253 .mbus_param = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
1254 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
1255 V4L2_MBUS_DATA_ACTIVE_HIGH,
1256 .mbus_type = V4L2_MBUS_PARALLEL,
1257 .set_capture = camera_set_capture,
1258};
1259
1260static struct soc_camera_link camera_link = {
1261 .bus_id = 0,
1262 .add_device = mackerel_camera_add,
1263 .del_device = mackerel_camera_del,
1264 .module_name = "soc_camera_platform",
1265 .priv = &camera_info,
1266};
1267
1268static struct platform_device *camera_device;
1269
1270static void mackerel_camera_release(struct device *dev)
1271{
1272 soc_camera_platform_release(&camera_device);
1273}
1274
1275static int mackerel_camera_add(struct soc_camera_device *icd)
1276{
1277 return soc_camera_platform_add(icd, &camera_device, &camera_link,
1278 mackerel_camera_release, 0);
1279}
1280
1281static void mackerel_camera_del(struct soc_camera_device *icd)
1282{
1283 soc_camera_platform_del(icd, camera_device, &camera_link);
1284}
1285
1286static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
1287 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
1288 .max_width = 8188,
1289 .max_height = 8188,
1290};
1291
1292static struct resource ceu_resources[] = {
1293 [0] = {
1294 .name = "CEU",
1295 .start = 0xfe910000,
1296 .end = 0xfe91009f,
1297 .flags = IORESOURCE_MEM,
1298 },
1299 [1] = {
1300 .start = intcs_evt2irq(0x880),
1301 .flags = IORESOURCE_IRQ,
1302 },
1303 [2] = {
1304
1305 },
1306};
1307
1308static struct platform_device ceu_device = {
1309 .name = "sh_mobile_ceu",
1310 .id = 0,
1311 .num_resources = ARRAY_SIZE(ceu_resources),
1312 .resource = ceu_resources,
1313 .dev = {
1314 .platform_data = &sh_mobile_ceu_info,
1315 .coherent_dma_mask = 0xffffffff,
1316 },
1317};
1318
1319static struct platform_device mackerel_camera = {
1320 .name = "soc-camera-pdrv",
1321 .id = 0,
1322 .dev = {
1323 .platform_data = &camera_link,
1324 },
1325};
1326
1327static struct platform_device *mackerel_devices[] __initdata = {
1328 &nor_flash_device,
1329 &smc911x_device,
1330 &lcdc_device,
1331 &usbhs0_device,
1332 &usbhs1_device,
1333 &leds_device,
1334 &fsi_device,
1335 &fsi_ak4643_device,
1336 &fsi_hdmi_device,
1337 &nand_flash_device,
1338 &sdhi0_device,
1339#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1340 &sdhi1_device,
1341#endif
1342 &sdhi2_device,
1343 &sh_mmcif_device,
1344 &ceu_device,
1345 &mackerel_camera,
1346 &hdmi_device,
1347 &hdmi_lcdc_device,
1348 &meram_device,
1349};
1350
1351
1352#define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
1353{ \
1354 .type = ev_type, \
1355 .code = ev_code, \
1356 .active_low = act_low, \
1357}
1358
1359#define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
1360
1361static struct tca6416_button mackerel_gpio_keys[] = {
1362 KEYPAD_BUTTON_LOW(KEY_HOME),
1363 KEYPAD_BUTTON_LOW(KEY_MENU),
1364 KEYPAD_BUTTON_LOW(KEY_BACK),
1365 KEYPAD_BUTTON_LOW(KEY_POWER),
1366};
1367
1368static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
1369 .buttons = mackerel_gpio_keys,
1370 .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
1371 .rep = 1,
1372 .use_polling = 0,
1373 .pinmask = 0x000F,
1374};
1375
1376
1377#define IRQ7 evt2irq(0x02e0)
1378#define IRQ9 evt2irq(0x0320)
1379
1380static struct i2c_board_info i2c0_devices[] = {
1381 {
1382 I2C_BOARD_INFO("ak4643", 0x13),
1383 },
1384
1385 {
1386 I2C_BOARD_INFO("tca6408-keys", 0x20),
1387 .platform_data = &mackerel_tca6416_keys_info,
1388 .irq = IRQ9,
1389 },
1390
1391 {
1392 I2C_BOARD_INFO("st1232-ts", 0x55),
1393 .irq = IRQ7,
1394 },
1395};
1396
1397#define IRQ21 evt2irq(0x32a0)
1398
1399static struct i2c_board_info i2c1_devices[] = {
1400
1401 {
1402 I2C_BOARD_INFO("adxl34x", 0x53),
1403 .irq = IRQ21,
1404 },
1405};
1406
1407#define GPIO_PORT9CR IOMEM(0xE6051009)
1408#define GPIO_PORT10CR IOMEM(0xE605100A)
1409#define GPIO_PORT167CR IOMEM(0xE60520A7)
1410#define GPIO_PORT168CR IOMEM(0xE60520A8)
1411#define SRCR4 IOMEM(0xe61580bc)
1412#define USCCR1 IOMEM(0xE6058144)
1413static void __init mackerel_init(void)
1414{
1415 struct pm_domain_device domain_devices[] = {
1416 { "A4LC", &lcdc_device, },
1417 { "A4LC", &hdmi_lcdc_device, },
1418 { "A4LC", &meram_device, },
1419 { "A4MP", &fsi_device, },
1420 { "A3SP", &usbhs0_device, },
1421 { "A3SP", &usbhs1_device, },
1422 { "A3SP", &nand_flash_device, },
1423 { "A3SP", &sh_mmcif_device, },
1424 { "A3SP", &sdhi0_device, },
1425#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1426 { "A3SP", &sdhi1_device, },
1427#endif
1428 { "A3SP", &sdhi2_device, },
1429 { "A4R", &ceu_device, },
1430 };
1431 u32 srcr4;
1432 struct clk *clk;
1433
1434 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
1435 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
1436 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
1437 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1438 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
1439
1440
1441 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1442
1443 sh7372_pinmux_init();
1444
1445
1446 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
1447 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
1448
1449
1450 gpio_request(GPIO_FN_CS5A, NULL);
1451 gpio_request(GPIO_FN_IRQ6_39, NULL);
1452
1453
1454 gpio_request(GPIO_FN_LCDD23, NULL);
1455 gpio_request(GPIO_FN_LCDD22, NULL);
1456 gpio_request(GPIO_FN_LCDD21, NULL);
1457 gpio_request(GPIO_FN_LCDD20, NULL);
1458 gpio_request(GPIO_FN_LCDD19, NULL);
1459 gpio_request(GPIO_FN_LCDD18, NULL);
1460 gpio_request(GPIO_FN_LCDD17, NULL);
1461 gpio_request(GPIO_FN_LCDD16, NULL);
1462 gpio_request(GPIO_FN_LCDD15, NULL);
1463 gpio_request(GPIO_FN_LCDD14, NULL);
1464 gpio_request(GPIO_FN_LCDD13, NULL);
1465 gpio_request(GPIO_FN_LCDD12, NULL);
1466 gpio_request(GPIO_FN_LCDD11, NULL);
1467 gpio_request(GPIO_FN_LCDD10, NULL);
1468 gpio_request(GPIO_FN_LCDD9, NULL);
1469 gpio_request(GPIO_FN_LCDD8, NULL);
1470 gpio_request(GPIO_FN_LCDD7, NULL);
1471 gpio_request(GPIO_FN_LCDD6, NULL);
1472 gpio_request(GPIO_FN_LCDD5, NULL);
1473 gpio_request(GPIO_FN_LCDD4, NULL);
1474 gpio_request(GPIO_FN_LCDD3, NULL);
1475 gpio_request(GPIO_FN_LCDD2, NULL);
1476 gpio_request(GPIO_FN_LCDD1, NULL);
1477 gpio_request(GPIO_FN_LCDD0, NULL);
1478 gpio_request(GPIO_FN_LCDDISP, NULL);
1479 gpio_request(GPIO_FN_LCDDCK, NULL);
1480
1481 gpio_request(GPIO_PORT31, NULL);
1482 gpio_direction_output(GPIO_PORT31, 0);
1483
1484 gpio_request(GPIO_PORT151, NULL);
1485 gpio_direction_output(GPIO_PORT151, 1);
1486
1487
1488 gpio_request(GPIO_FN_VBUS0_0, NULL);
1489 gpio_request_pulldown(GPIO_PORT168CR);
1490
1491
1492 gpio_request(GPIO_FN_VBUS0_1, NULL);
1493 gpio_request_pulldown(GPIO_PORT167CR);
1494 gpio_request(GPIO_FN_IDIN_1_113, NULL);
1495
1496
1497 gpio_request(GPIO_FN_FSIAIBT, NULL);
1498 gpio_request(GPIO_FN_FSIAILR, NULL);
1499 gpio_request(GPIO_FN_FSIAISLD, NULL);
1500 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1501 gpio_request(GPIO_PORT161, NULL);
1502 gpio_direction_output(GPIO_PORT161, 0);
1503
1504 gpio_request(GPIO_PORT9, NULL);
1505 gpio_request(GPIO_PORT10, NULL);
1506 gpio_direction_none(GPIO_PORT9CR);
1507 gpio_direction_none(GPIO_PORT10CR);
1508
1509 intc_set_priority(IRQ_FSI, 3);
1510
1511
1512 gpio_request(GPIO_FN_FSIBCK, NULL);
1513 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1);
1514
1515
1516 clk = clk_get(NULL, "spu_clk");
1517 if (!IS_ERR(clk)) {
1518 clk_set_rate(clk, clk_round_rate(clk, 119600000));
1519 clk_put(clk);
1520 }
1521
1522
1523 gpio_request(GPIO_FN_IRQ9_42, NULL);
1524 irq_set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
1525
1526
1527 gpio_request(GPIO_FN_IRQ7_40, NULL);
1528 irq_set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
1529
1530
1531 gpio_request(GPIO_FN_IRQ21, NULL);
1532 irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
1533
1534
1535 gpio_request(GPIO_FN_SDHIWP0, NULL);
1536 gpio_request(GPIO_FN_SDHICMD0, NULL);
1537 gpio_request(GPIO_FN_SDHICLK0, NULL);
1538 gpio_request(GPIO_FN_SDHID0_3, NULL);
1539 gpio_request(GPIO_FN_SDHID0_2, NULL);
1540 gpio_request(GPIO_FN_SDHID0_1, NULL);
1541 gpio_request(GPIO_FN_SDHID0_0, NULL);
1542
1543
1544 gpio_request(GPIO_FN_IRQ26_172, NULL);
1545
1546#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1547
1548 gpio_request(GPIO_FN_SDHICMD1, NULL);
1549 gpio_request(GPIO_FN_SDHICLK1, NULL);
1550 gpio_request(GPIO_FN_SDHID1_3, NULL);
1551 gpio_request(GPIO_FN_SDHID1_2, NULL);
1552 gpio_request(GPIO_FN_SDHID1_1, NULL);
1553 gpio_request(GPIO_FN_SDHID1_0, NULL);
1554#endif
1555
1556 gpio_request(GPIO_PORT41, NULL);
1557 gpio_direction_input(GPIO_PORT41);
1558
1559
1560 gpio_request(GPIO_FN_SDHICMD2, NULL);
1561 gpio_request(GPIO_FN_SDHICLK2, NULL);
1562 gpio_request(GPIO_FN_SDHID2_3, NULL);
1563 gpio_request(GPIO_FN_SDHID2_2, NULL);
1564 gpio_request(GPIO_FN_SDHID2_1, NULL);
1565 gpio_request(GPIO_FN_SDHID2_0, NULL);
1566
1567
1568 gpio_request(GPIO_PORT162, NULL);
1569 gpio_direction_input(GPIO_PORT162);
1570
1571
1572 gpio_request(GPIO_FN_MMCD0_0, NULL);
1573 gpio_request(GPIO_FN_MMCD0_1, NULL);
1574 gpio_request(GPIO_FN_MMCD0_2, NULL);
1575 gpio_request(GPIO_FN_MMCD0_3, NULL);
1576 gpio_request(GPIO_FN_MMCD0_4, NULL);
1577 gpio_request(GPIO_FN_MMCD0_5, NULL);
1578 gpio_request(GPIO_FN_MMCD0_6, NULL);
1579 gpio_request(GPIO_FN_MMCD0_7, NULL);
1580 gpio_request(GPIO_FN_MMCCMD0, NULL);
1581 gpio_request(GPIO_FN_MMCCLK0, NULL);
1582
1583
1584 gpio_request(GPIO_FN_D0_NAF0, NULL);
1585 gpio_request(GPIO_FN_D1_NAF1, NULL);
1586 gpio_request(GPIO_FN_D2_NAF2, NULL);
1587 gpio_request(GPIO_FN_D3_NAF3, NULL);
1588 gpio_request(GPIO_FN_D4_NAF4, NULL);
1589 gpio_request(GPIO_FN_D5_NAF5, NULL);
1590 gpio_request(GPIO_FN_D6_NAF6, NULL);
1591 gpio_request(GPIO_FN_D7_NAF7, NULL);
1592 gpio_request(GPIO_FN_D8_NAF8, NULL);
1593 gpio_request(GPIO_FN_D9_NAF9, NULL);
1594 gpio_request(GPIO_FN_D10_NAF10, NULL);
1595 gpio_request(GPIO_FN_D11_NAF11, NULL);
1596 gpio_request(GPIO_FN_D12_NAF12, NULL);
1597 gpio_request(GPIO_FN_D13_NAF13, NULL);
1598 gpio_request(GPIO_FN_D14_NAF14, NULL);
1599 gpio_request(GPIO_FN_D15_NAF15, NULL);
1600 gpio_request(GPIO_FN_FCE0, NULL);
1601 gpio_request(GPIO_FN_WE0_FWE, NULL);
1602 gpio_request(GPIO_FN_FRB, NULL);
1603 gpio_request(GPIO_FN_A4_FOE, NULL);
1604 gpio_request(GPIO_FN_A5_FCDE, NULL);
1605 gpio_request(GPIO_FN_RD_FSC, NULL);
1606
1607
1608 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
1609 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
1610
1611
1612 gpio_request(GPIO_FN_VIO_CLK, NULL);
1613 gpio_request(GPIO_FN_VIO_VD, NULL);
1614 gpio_request(GPIO_FN_VIO_HD, NULL);
1615 gpio_request(GPIO_FN_VIO_FIELD, NULL);
1616 gpio_request(GPIO_FN_VIO_CKO, NULL);
1617 gpio_request(GPIO_FN_VIO_D7, NULL);
1618 gpio_request(GPIO_FN_VIO_D6, NULL);
1619 gpio_request(GPIO_FN_VIO_D5, NULL);
1620 gpio_request(GPIO_FN_VIO_D4, NULL);
1621 gpio_request(GPIO_FN_VIO_D3, NULL);
1622 gpio_request(GPIO_FN_VIO_D2, NULL);
1623 gpio_request(GPIO_FN_VIO_D1, NULL);
1624 gpio_request(GPIO_FN_VIO_D0, NULL);
1625
1626
1627 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1628 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1629
1630
1631 srcr4 = __raw_readl(SRCR4);
1632 __raw_writel(srcr4 | (1 << 13), SRCR4);
1633 udelay(50);
1634 __raw_writel(srcr4 & ~(1 << 13), SRCR4);
1635
1636 i2c_register_board_info(0, i2c0_devices,
1637 ARRAY_SIZE(i2c0_devices));
1638 i2c_register_board_info(1, i2c1_devices,
1639 ARRAY_SIZE(i2c1_devices));
1640
1641 sh7372_add_standard_devices();
1642
1643 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
1644
1645 rmobile_add_devices_to_domains(domain_devices,
1646 ARRAY_SIZE(domain_devices));
1647
1648 hdmi_init_pm_clock();
1649 sh7372_pm_init();
1650 pm_clk_add(&fsi_device.dev, "spu2");
1651 pm_clk_add(&hdmi_lcdc_device.dev, "hdmi");
1652}
1653
1654MACHINE_START(MACKEREL, "mackerel")
1655 .map_io = sh7372_map_io,
1656 .init_early = sh7372_add_early_devices,
1657 .init_irq = sh7372_init_irq,
1658 .handle_irq = shmobile_handle_irq_intc,
1659 .init_machine = mackerel_init,
1660 .init_late = sh7372_pm_init_late,
1661 .timer = &shmobile_timer,
1662MACHINE_END
1663