static void __init eva_init(void)
{
	struct platform_device *usb = NULL;

	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
	regulator_register_always_on(3, "fixed-5.0V", fixed5v0_power_consumers,
				     ARRAY_SIZE(fixed5v0_power_consumers), 5000000);

	pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
	pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));

	r8a7740_pinmux_init();
	r8a7740_meram_workaround();

	/* LCDC0 */
	gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */

	/* GETHER */
	gpio_request_one(18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */

	/* USB */
	gpio_request_one(159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */

	if (gpio_get_value(159)) {
		/* USB Host */
	} else {
		/* USB Func */
		/*
		 * The USBHS interrupt handlers needs to read the IRQ pin value
		 * (HI/LOW) to diffentiate USB connection and disconnection
		 * events (usbhsf_get_vbus()). We thus need to select both the
		 * intc_irq7_1 pin group and GPIO 209 here.
		 */
		gpio_request_one(209, GPIOF_IN, NULL);

		platform_device_register(&usbhsf_device);
		usb = &usbhsf_device;
	}

	/* CON1/CON15 Camera */
	gpio_request_one(173, GPIOF_OUT_INIT_LOW, NULL);  /* STANDBY */
	gpio_request_one(172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
	/* see mt9t111_power() */
	gpio_request_one(158, GPIOF_OUT_INIT_LOW, NULL);  /* CAM_PON */

	/* FSI-WM8978 */
	gpio_request(7, NULL);
	gpio_request(8, NULL);
	gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
	gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */

	/*
	 * CAUTION
	 *
	 * DBGMD/LCDC0/FSIA MUX
	 * DBGMD_SELECT_B should be set after setting PFC Function.
	 */
	gpio_request_one(176, GPIOF_OUT_INIT_HIGH, NULL);

	/*
	 * We can switch CON8/CON14 by SW1.5,
	 * but it needs after DBGMD_SELECT_B
	 */
	gpio_request_one(6, GPIOF_IN, NULL);
	if (gpio_get_value(6)) {
		/* CON14 enable */
	} else {
		/* CON8 (SDHI1) enable */
		pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
					  ARRAY_SIZE(eva_sdhi1_pinctrl_map));

		platform_device_register(&vcc_sdhi1);
		platform_device_register(&sdhi1_device);
	}


#ifdef CONFIG_CACHE_L2X0
	/* Early BRESP enable, Shared attribute override enable, 32K*8way */
	l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
#endif

	i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
	i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));

	r8a7740_add_standard_devices();

	platform_add_devices(eva_devices,
			     ARRAY_SIZE(eva_devices));

	rmobile_add_device_to_domain("A4LC", &lcdc0_device);
	rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
	if (usb)
		rmobile_add_device_to_domain("A3SP", usb);

	r8a7740_pm_init();
}
Example #2
0
static void __init eva_init(void)
{
	struct platform_device *usb = NULL;

	regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
				     ARRAY_SIZE(fixed3v3_power_consumers), 3300000);

	r8a7740_pinmux_init();
	r8a7740_meram_workaround();

	/* SCIFA1 */
	gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
	gpio_request(GPIO_FN_SCIFA1_TXD, NULL);

	/* LCDC0 */
	gpio_request(GPIO_FN_LCDC0_SELECT,	NULL);
	gpio_request(GPIO_FN_LCD0_D0,		NULL);
	gpio_request(GPIO_FN_LCD0_D1,		NULL);
	gpio_request(GPIO_FN_LCD0_D2,		NULL);
	gpio_request(GPIO_FN_LCD0_D3,		NULL);
	gpio_request(GPIO_FN_LCD0_D4,		NULL);
	gpio_request(GPIO_FN_LCD0_D5,		NULL);
	gpio_request(GPIO_FN_LCD0_D6,		NULL);
	gpio_request(GPIO_FN_LCD0_D7,		NULL);
	gpio_request(GPIO_FN_LCD0_D8,		NULL);
	gpio_request(GPIO_FN_LCD0_D9,		NULL);
	gpio_request(GPIO_FN_LCD0_D10,		NULL);
	gpio_request(GPIO_FN_LCD0_D11,		NULL);
	gpio_request(GPIO_FN_LCD0_D12,		NULL);
	gpio_request(GPIO_FN_LCD0_D13,		NULL);
	gpio_request(GPIO_FN_LCD0_D14,		NULL);
	gpio_request(GPIO_FN_LCD0_D15,		NULL);
	gpio_request(GPIO_FN_LCD0_D16,		NULL);
	gpio_request(GPIO_FN_LCD0_D17,		NULL);
	gpio_request(GPIO_FN_LCD0_D18_PORT40,	NULL);
	gpio_request(GPIO_FN_LCD0_D19_PORT4,	NULL);
	gpio_request(GPIO_FN_LCD0_D20_PORT3,	NULL);
	gpio_request(GPIO_FN_LCD0_D21_PORT2,	NULL);
	gpio_request(GPIO_FN_LCD0_D22_PORT0,	NULL);
	gpio_request(GPIO_FN_LCD0_D23_PORT1,	NULL);
	gpio_request(GPIO_FN_LCD0_DCK,		NULL);
	gpio_request(GPIO_FN_LCD0_VSYN,		NULL);
	gpio_request(GPIO_FN_LCD0_HSYN,		NULL);
	gpio_request(GPIO_FN_LCD0_DISP,		NULL);
	gpio_request(GPIO_FN_LCD0_LCLK_PORT165,	NULL);

	gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
	gpio_request_one(GPIO_PORT202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */

	/* Touchscreen */
	gpio_request(GPIO_FN_IRQ10,	NULL); /* TP_INT */
	gpio_request_one(GPIO_PORT166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */

	/* GETHER */
	gpio_request(GPIO_FN_ET_CRS,		NULL);
	gpio_request(GPIO_FN_ET_MDC,		NULL);
	gpio_request(GPIO_FN_ET_MDIO,		NULL);
	gpio_request(GPIO_FN_ET_TX_ER,		NULL);
	gpio_request(GPIO_FN_ET_RX_ER,		NULL);
	gpio_request(GPIO_FN_ET_ERXD0,		NULL);
	gpio_request(GPIO_FN_ET_ERXD1,		NULL);
	gpio_request(GPIO_FN_ET_ERXD2,		NULL);
	gpio_request(GPIO_FN_ET_ERXD3,		NULL);
	gpio_request(GPIO_FN_ET_TX_CLK,		NULL);
	gpio_request(GPIO_FN_ET_TX_EN,		NULL);
	gpio_request(GPIO_FN_ET_ETXD0,		NULL);
	gpio_request(GPIO_FN_ET_ETXD1,		NULL);
	gpio_request(GPIO_FN_ET_ETXD2,		NULL);
	gpio_request(GPIO_FN_ET_ETXD3,		NULL);
	gpio_request(GPIO_FN_ET_PHY_INT,	NULL);
	gpio_request(GPIO_FN_ET_COL,		NULL);
	gpio_request(GPIO_FN_ET_RX_DV,		NULL);
	gpio_request(GPIO_FN_ET_RX_CLK,		NULL);

	gpio_request_one(GPIO_PORT18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */

	/* USB */
	gpio_request_one(GPIO_PORT159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */

	if (gpio_get_value(GPIO_PORT159)) {
		/* USB Host */
	} else {
		/* USB Func */
		/*
		 * A1 chip has 2 IRQ7 pin and it was controled by MSEL register.
		 * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
		 * USB connection/disconnection (usbhsf_get_vbus()).
		 * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
		 * and select GPIO_PORT209 here
		 */
		gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
		gpio_request_one(GPIO_PORT209, GPIOF_IN, NULL);

		platform_device_register(&usbhsf_device);
		usb = &usbhsf_device;
	}

	/* SDHI0 */
	gpio_request(GPIO_FN_SDHI0_CMD, NULL);
	gpio_request(GPIO_FN_SDHI0_CLK, NULL);
	gpio_request(GPIO_FN_SDHI0_D0, NULL);
	gpio_request(GPIO_FN_SDHI0_D1, NULL);
	gpio_request(GPIO_FN_SDHI0_D2, NULL);
	gpio_request(GPIO_FN_SDHI0_D3, NULL);
	gpio_request(GPIO_FN_SDHI0_WP, NULL);

	/*
	 * MMCIF
	 *
	 * Here doesn't care SW1.4 status,
	 * since CON2 is not mounted.
	 */
	gpio_request(GPIO_FN_MMC1_CLK_PORT103,	NULL);
	gpio_request(GPIO_FN_MMC1_CMD_PORT104,	NULL);
	gpio_request(GPIO_FN_MMC1_D0_PORT149,	NULL);
	gpio_request(GPIO_FN_MMC1_D1_PORT148,	NULL);
	gpio_request(GPIO_FN_MMC1_D2_PORT147,	NULL);
	gpio_request(GPIO_FN_MMC1_D3_PORT146,	NULL);
	gpio_request(GPIO_FN_MMC1_D4_PORT145,	NULL);
	gpio_request(GPIO_FN_MMC1_D5_PORT144,	NULL);
	gpio_request(GPIO_FN_MMC1_D6_PORT143,	NULL);
	gpio_request(GPIO_FN_MMC1_D7_PORT142,	NULL);

	/* CEU0 */
	gpio_request(GPIO_FN_VIO0_D7,		NULL);
	gpio_request(GPIO_FN_VIO0_D6,		NULL);
	gpio_request(GPIO_FN_VIO0_D5,		NULL);
	gpio_request(GPIO_FN_VIO0_D4,		NULL);
	gpio_request(GPIO_FN_VIO0_D3,		NULL);
	gpio_request(GPIO_FN_VIO0_D2,		NULL);
	gpio_request(GPIO_FN_VIO0_D1,		NULL);
	gpio_request(GPIO_FN_VIO0_D0,		NULL);
	gpio_request(GPIO_FN_VIO0_CLK,		NULL);
	gpio_request(GPIO_FN_VIO0_HD,		NULL);
	gpio_request(GPIO_FN_VIO0_VD,		NULL);
	gpio_request(GPIO_FN_VIO0_FIELD,	NULL);
	gpio_request(GPIO_FN_VIO_CKO,		NULL);

	/* CON1/CON15 Camera */
	gpio_request_one(GPIO_PORT173, GPIOF_OUT_INIT_LOW, NULL);  /* STANDBY */
	gpio_request_one(GPIO_PORT172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
	/* see mt9t111_power() */
	gpio_request_one(GPIO_PORT158, GPIOF_OUT_INIT_LOW, NULL);  /* CAM_PON */

	/* FSI-WM8978 */
	gpio_request(GPIO_FN_FSIAIBT,		NULL);
	gpio_request(GPIO_FN_FSIAILR,		NULL);
	gpio_request(GPIO_FN_FSIAOMC,		NULL);
	gpio_request(GPIO_FN_FSIAOSLD,		NULL);
	gpio_request(GPIO_FN_FSIAISLD_PORT5,	NULL);

	gpio_request(GPIO_PORT7, NULL);
	gpio_request(GPIO_PORT8, NULL);
	gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
	gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */

	/* FSI-HDMI */
	gpio_request(GPIO_FN_FSIBCK,		NULL);

	/* HDMI */
	gpio_request(GPIO_FN_HDMI_HPD,		NULL);
	gpio_request(GPIO_FN_HDMI_CEC,		NULL);

	/*
	 * CAUTION
	 *
	 * DBGMD/LCDC0/FSIA MUX
	 * DBGMD_SELECT_B should be set after setting PFC Function.
	 */
	gpio_request_one(GPIO_PORT176, GPIOF_OUT_INIT_HIGH, NULL);

	/*
	 * We can switch CON8/CON14 by SW1.5,
	 * but it needs after DBGMD_SELECT_B
	 */
	gpio_request_one(GPIO_PORT6, GPIOF_IN, NULL);
	if (gpio_get_value(GPIO_PORT6)) {
		/* CON14 enable */
	} else {
		/* CON8 (SDHI1) enable */
		gpio_request(GPIO_FN_SDHI1_CLK,	NULL);
		gpio_request(GPIO_FN_SDHI1_CMD,	NULL);
		gpio_request(GPIO_FN_SDHI1_D0,	NULL);
		gpio_request(GPIO_FN_SDHI1_D1,	NULL);
		gpio_request(GPIO_FN_SDHI1_D2,	NULL);
		gpio_request(GPIO_FN_SDHI1_D3,	NULL);
		gpio_request(GPIO_FN_SDHI1_CD,	NULL);
		gpio_request(GPIO_FN_SDHI1_WP,	NULL);

		/* SDSLOT2_PON */
		gpio_request_one(GPIO_PORT16, GPIOF_OUT_INIT_HIGH, NULL);

		platform_device_register(&sdhi1_device);
	}


#ifdef CONFIG_CACHE_L2X0
	/* Early BRESP enable, Shared attribute override enable, 32K*8way */
	l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
#endif

	i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
	i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));

	r8a7740_add_standard_devices();

	platform_add_devices(eva_devices,
			     ARRAY_SIZE(eva_devices));

	rmobile_add_device_to_domain("A4LC", &lcdc0_device);
	rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
	if (usb)
		rmobile_add_device_to_domain("A3SP", usb);

	r8a7740_pm_init();
}