Пример #1
0
/*
 * Initialize the GPIO Alternative Functions of the LPC178x/7x.
 */
void __init lpc178x_iomux_init(void)
{
	int platform;

	/*
	 * Enable power on GPIO. This is not really necessary, because power
	 * on GPIO is enabled on SoC reset.
	 */
	lpc178x_periph_enable(LPC178X_SCC_PCONP_PCGPIO_MSK, 1);

	/*
	 * Configure IOs depending on the board we're running on, and
	 * the configuration options we're using.
	 * Let's control platform strictly: if some of it does not need to
	 * play with iomux, it must be present in switch below (otherwise,
	 * the warning message will be printed-out)
	 */
	platform = lpc178x_platform_get();
	switch (platform) {
	case PLATFORM_LPC178X_EA_LPC1788:
		lpc178x_gpio_config_table(
			ea_lpc1788_gpio, ARRAY_SIZE(ea_lpc1788_gpio));
		break;
	case PLATFORM_LPC178X_LNX_EVB:
		lpc178x_gpio_config_table(
			lpc_lnx_evb_gpio, ARRAY_SIZE(lpc_lnx_evb_gpio));
		break;
	default:
		printk(KERN_WARNING "%s: unsupported platform %d\n", __func__,
			platform);
		break;
	}
}
Пример #2
0
/*
 * Configure all necessary GPIO pins
 */
static void gpio_init(void)
{
	/*
	 * Enable power on GPIO. This is not really necessary, because power
	 * on GPIO is enabled on SoC reset.
	 */
	lpc178x_periph_enable(LPC178X_SCC_PCONP_PCGPIO_MSK, 1);

	/*
	 * Configure GPIO pins using the `ea_lpc1788_gpio[]` table
	 */
	lpc178x_gpio_config_table(ea_lpc1788_gpio, ARRAY_SIZE(ea_lpc1788_gpio));

#ifdef CONFIG_NR_DRAM_BANKS
	/*
	 * Configure GPIO pins used for the External Memory Controller (EMC)
	 */
	struct lpc178x_gpio_dsc dsc;

	/* Configure EMC data pins (DQ0..DQ31) */
	dsc.port = 3;
	for (dsc.pin = 0; dsc.pin <= LPC178X_EMC_DATA_PINS; dsc.pin++)
		lpc178x_gpio_config(&dsc, LPC178X_GPIO_EMC_REGVAL);

	/*
	 * Configure EMC row/column address pins (A0..A11) and
	 * NOR FLash address pins.
	*/
	dsc.port = 4;
	for (dsc.pin = 0; dsc.pin <= LPC178X_EMC_ADDR_PINS; dsc.pin++)
		lpc178x_gpio_config(&dsc, LPC178X_GPIO_EMC_REGVAL);
#endif
}