21 #include <linux/kernel.h>
34 #include <linux/i2c.h>
43 #include <linux/input.h>
61 #include <mach/common.h>
62 #include <mach/irqs.h>
67 #include <asm/setup.h>
191 .offset = 0x00000000,
204 .size = 8 * 1024 * 1024,
210 .size = 8 * 1024 * 1024,
221 .parts = nor_flash_partitions,
225 static struct resource nor_flash_resources[] = {
228 .end = 0x28000000 - 1,
234 .name =
"physmap-flash",
236 .platform_data = &nor_flash_data,
238 .num_resources =
ARRAY_SIZE(nor_flash_resources),
239 .resource = nor_flash_resources,
243 static struct resource smc911x_resources[] = {
246 .end = 0x16000000 - 1,
263 .num_resources =
ARRAY_SIZE(smc911x_resources),
264 .resource = smc911x_resources,
266 .platform_data = &smsc911x_info,
283 static struct resource meram_resources[] = {
299 .name =
"sh_mobile_meram",
302 .resource = meram_resources,
304 .platform_data = &meram_info,
309 static struct resource sh_mmcif_resources[] = {
334 .get_cd = slot_cn7_get_cd,
344 .coherent_dma_mask = 0xffffffff,
345 .platform_data = &sh_mmcif_plat,
347 .num_resources =
ARRAY_SIZE(sh_mmcif_resources),
348 .resource = sh_mmcif_resources,
358 static struct resource sdhi0_resources[] = {
380 .name =
"sh_mobile_sdhi",
382 .resource = sdhi0_resources,
385 .platform_data = &sdhi0_info,
396 .get_cd = slot_cn7_get_cd,
399 static struct resource sdhi1_resources[] = {
421 .name =
"sh_mobile_sdhi",
423 .resource = sdhi1_resources,
426 .platform_data = &sdhi1_info,
431 static void usb1_host_port_power(
int port,
int power)
442 .port_power = usb1_host_port_power,
445 static struct resource usb1_host_resources[] = {
449 .end = 0xE68B00E6 - 1,
459 .name =
"r8a66597_hcd",
463 .coherent_dma_mask = 0xffffffff,
464 .platform_data = &usb1_host_data,
466 .num_resources =
ARRAY_SIZE(usb1_host_resources),
467 .resource = usb1_host_resources,
473 #ifdef CONFIG_AP4EVB_QHD
489 static struct resource keysc_resources[] = {
506 .resource = keysc_resources,
508 .platform_data = &keysc_info,
542 static struct resource mipidsi0_resources[] = {
559 .lcd_chan = &lcdc_info.ch[0],
565 .set_dot_clock = sh_mipi_set_dot_clock,
569 .
name =
"sh-mipi-dsi",
570 .num_resources =
ARRAY_SIZE(mipidsi0_resources),
571 .resource = mipidsi0_resources,
574 .platform_data = &mipidsi0_info,
585 static const struct fb_videomode ap4evb_lcdc_modes[] = {
587 #ifdef CONFIG_AP4EVB_QHD
588 .name =
"R63302(QHD)",
599 .name =
"WVGA Panel",
623 .meram_dev = &meram_info,
627 .lcd_modes = ap4evb_lcdc_modes,
629 .meram_cfg = &lcd_meram_cfg,
630 #ifdef CONFIG_AP4EVB_QHD
631 .tx_dev = &mipidsi0_device,
636 static struct resource lcdc_resources[] = {
650 .name =
"sh_mobile_lcdc_fb",
652 .resource = lcdc_resources,
654 .platform_data = &lcdc_info,
655 .coherent_dma_mask = ~0,
660 #define IRQ_FSI evt2irq(0x1840)
661 static int __fsi_set_rate(
struct clk *
clk,
long rate,
int enable)
679 static int __fsi_set_round_rate(
struct clk *
clk,
long rate,
int enable)
684 static int fsi_ak4642_set_rate(
struct device *
dev,
int rate,
int enable)
686 struct clk *fsia_ick;
690 fsia_ick =
clk_get(dev,
"icka");
691 if (IS_ERR(fsia_ick))
692 return PTR_ERR(fsia_ick);
711 ret = __fsi_set_rate(fsiack, rate, enable);
715 ret = __fsi_set_round_rate(fsia_ick, rate, enable);
716 if ((ret < 0) && enable)
717 __fsi_set_round_rate(fsiack, rate, 0);
728 static int fsi_hdmi_set_rate(
struct device *dev,
int rate,
int enable)
730 struct clk *fsib_clk;
739 fsib_rate = rate * 256;
743 fsib_rate = 85428000;
744 fdiv_rate = rate * 256;
748 pr_err(
"unsupported rate in FSI2 port B\n");
753 fsib_clk =
clk_get(dev,
"ickb");
754 if (IS_ERR(fsib_clk))
757 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
759 goto fsi_set_rate_end;
762 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
766 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
767 goto fsi_set_rate_end;
780 .set_rate = fsi_ak4642_set_rate,
787 .set_rate = fsi_hdmi_set_rate,
791 static struct resource fsi_resources[] = {
795 .end = 0xFE3C0400 - 1,
808 .resource = fsi_resources,
810 .platform_data = &fsi_info,
823 .card =
"FSI2A-AK4643",
824 .cpu_dai =
"fsia-dai",
825 .codec =
"ak4642-codec.0-0013",
826 .platform =
"sh_fsi2",
827 .codec_dai =
"ak4642-hifi",
828 .init = &fsi2_ak4643_init_info,
832 .name =
"asoc-simple-card",
834 .platform_data = &fsi2_ak4643_info,
839 static long ap4evb_clk_optimize(
unsigned long target,
unsigned long *best_freq,
840 unsigned long *parent_freq);
844 .clk_optimize_parent = ap4evb_clk_optimize,
862 .name =
"sh-mobile-hdmi",
864 .resource = hdmi_resources,
867 .platform_data = &hdmi_info,
871 static long ap4evb_clk_optimize(
unsigned long target,
unsigned long *best_freq,
872 unsigned long *parent_freq)
874 struct clk *hdmi_ick =
clk_get(&hdmi_device.
dev,
"ick");
877 if (IS_ERR(hdmi_ick)) {
878 int ret = PTR_ERR(hdmi_ick);
879 pr_err(
"Cannot get HDMI ICK: %d\n", ret);
901 .meram_dev = &meram_info,
905 .interface_type =
RGB24,
908 .meram_cfg = &hdmi_meram_cfg,
909 .tx_dev = &hdmi_device,
913 static struct resource lcdc1_resources[] = {
927 .name =
"sh_mobile_lcdc_fb",
929 .resource = lcdc1_resources,
932 .platform_data = &sh_mobile_lcdc1_info,
933 .coherent_dma_mask = ~0,
943 .card =
"FSI2B-HDMI",
944 .cpu_dai =
"fsib-dai",
945 .codec =
"sh-mobile-hdmi",
946 .platform =
"sh_fsi2",
947 .codec_dai =
"sh_mobile_hdmi-hifi",
948 .init = &fsi2_hdmi_init_info,
952 .name =
"asoc-simple-card",
955 .platform_data = &fsi2_hdmi_info,
959 static struct gpio_led ap4evb_leds[] = {
991 .platform_data = &ap4evb_leds_pdata,
1001 .board_info = &imx074_info,
1002 .i2c_adapter_id = 0,
1003 .module_name =
"imx074",
1007 .name =
"soc-camera-pdrv",
1010 .platform_data = &imx074_link,
1019 .pdev = &ap4evb_camera,
1025 .clients = csi2_clients,
1030 static struct resource csi2_resources[] = {
1033 .start = 0xffc90000,
1046 .resource = csi2_resources,
1047 .platform_data = &csi2_info,
1057 static struct resource ceu_resources[] = {
1060 .start = 0xfe910000,
1074 .name =
"sh_mobile_ceu",
1077 .resource = ceu_resources,
1079 .platform_data = &sh_mobile_ceu_info,
1080 .coherent_dma_mask = 0xffffffff,
1103 static void __init hdmi_init_pm_clock(
void)
1105 struct clk *hdmi_ick =
clk_get(&hdmi_device.
dev,
"ick");
1109 if (IS_ERR(hdmi_ick)) {
1110 ret = PTR_ERR(hdmi_ick);
1111 pr_err(
"Cannot get HDMI ICK: %d\n", ret);
1125 pr_err(
"Cannot get suitable rate: %ld\n", rate);
1132 pr_err(
"Cannot set rate %ld: %d\n", rate, ret);
1136 pr_debug(
"PLLC2 set frequency %lu\n", rate);
1140 pr_err(
"Cannot set HDMI parent: %d\n", ret);
1143 if (!IS_ERR(hdmi_ick))
1147 static void __init fsi_init_pm_clock(
void)
1149 struct clk *fsia_ick;
1153 if (IS_ERR(fsia_ick)) {
1154 ret = PTR_ERR(fsia_ick);
1155 pr_err(
"Cannot get FSI ICK: %d\n", ret);
1161 pr_err(
"Cannot set FSI-A parent: %d\n", ret);
1167 #ifdef CONFIG_AP4EVB_QHD
1168 # define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
1169 # define GPIO_TSC_PORT GPIO_PORT123
1171 # define GPIO_TSC_IRQ GPIO_FN_IRQ7_40
1172 # define GPIO_TSC_PORT GPIO_PORT40
1175 #define IRQ28 evt2irq(0x3380)
1176 #define IRQ7 evt2irq(0x02e0)
1177 static int ts_get_pendown_state(
void)
1194 static int ts_init(
void)
1203 .x_plate_ohms = 180,
1204 .get_pendown_state = ts_get_pendown_state,
1205 .init_platform_hw = ts_init,
1211 .platform_data = &tsc2007_info,
1229 #define GPIO_PORT9CR IOMEM(0xE6051009)
1230 #define GPIO_PORT10CR IOMEM(0xE605100A)
1231 #define USCCR1 IOMEM(0xE6058144)
1232 static void __init ap4evb_init(
void)
1235 {
"A4LC", &lcdc1_device, },
1236 {
"A4LC", &lcdc_device, },
1237 {
"A4MP", &fsi_device, },
1238 {
"A3SP", &sh_mmcif_device, },
1239 {
"A3SP", &sdhi0_device, },
1240 {
"A3SP", &sdhi1_device, },
1241 {
"A4R", &ceu_device, },
1247 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
1249 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
1361 #ifdef CONFIG_AP4EVB_QHD
1388 lcdc_info.
ch[0].interface_type =
RGB24;
1389 lcdc_info.
ch[0].clock_divider = 1;
1391 lcdc_info.
ch[0].panel_cfg.width = 44;
1392 lcdc_info.
ch[0].panel_cfg.height = 79;
1430 lcdc_info.
ch[0].interface_type =
RGB18;
1431 lcdc_info.
ch[0].clock_divider = 3;
1432 lcdc_info.
ch[0].flags = 0;
1433 lcdc_info.
ch[0].panel_cfg.width = 152;
1434 lcdc_info.
ch[0].panel_cfg.height = 91;
1467 #define SRCR4 IOMEM(0xe61580bc)
1475 rmobile_add_devices_to_domains(domain_devices,
1478 hdmi_init_pm_clock();
1479 fsi_init_pm_clock();
1481 pm_clk_add(&fsi_device.
dev,
"spu2");
1482 pm_clk_add(&lcdc1_device.
dev,
"hdmi");
1490 .init_machine = ap4evb_init,