Beispiel #1
0
/*
 * Register the Flash platform device with the kernel.
 */
void __init lpc178x_flash_init(void)
{
	unsigned int size = 0;

	/*
	 * Calculate Flash and partition sizes at run time
	 */
	switch (lpc178x_platform_get()) {
	case PLATFORM_LPC178X_EA_LPC1788:
		size = 16*1024*1024;
		break;
	case PLATFORM_LPC178X_LNX_EVB:
		size = 16*1024*1024;
		break;
	default:
		printk(KERN_ERR "%s: Unknown platform %#x, exit\n", __func__,
			lpc178x_platform_get());
		goto xit;
	}

	flash_resources[0].end = flash_resources[0].start + size - 1;
	flash_partitions[2].size = size - FLASH_JFFS2_OFFSET;

	/*
	 * Register a platform device for the external Flash.
	 * If there is no external Flash in your design, or
	 * you don't want to use it in your application, just
	 * comment out the line below.
	 */
	platform_device_register(&flash_dev);
xit:
	return;
}
Beispiel #2
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;
	}
}
Beispiel #3
0
void __init lpc178x_i2c_init(void)
{
#if	defined(CONFIG_LPC178X_I2C0) || \
	defined(CONFIG_LPC178X_I2C1) || \
	defined(CONFIG_LPC178X_I2C2)

	int platform = lpc178x_platform_get();
#endif
	/*
	 * Register platform devices
	 */
#if defined(CONFIG_LPC178X_I2C0)
	platform_device_register(&lpc178x_i2c0_device);

	switch (platform) {
	case PLATFORM_LPC178X_EA_LPC1788:
		i2c_register_board_info(0, ea_lpc1788_bdinfo_i2c0,
			sizeof(ea_lpc1788_bdinfo_i2c0) /
			sizeof (struct i2c_board_info));
		break;
	default:
		break;
	}
#endif

#if defined(CONFIG_LPC178X_I2C1)
	platform_device_register(&lpc178x_i2c1_device);
#endif

#if defined(CONFIG_LPC178X_I2C2)
	platform_device_register(&lpc178x_i2c2_device);
#endif
}
Beispiel #4
0
void __init lpc178x_fb_init(void)
{
	int platform;
	int have_lcd;
	int ret;

	/*
	 * Run board-specific code
	 */
	have_lcd = 0;
	ret = 0;
	platform = lpc178x_platform_get();
	switch (platform) {
	case PLATFORM_LPC178X_EA_LPC1788:
		have_lcd = 1;
		/*
		 * This code finally makes the function
		 * `ealcd004_pca9532_probe()` to execute.
		 */
		ret = i2c_add_driver(&ealcd004_pca9532_driver);
		if (ret < 0)
			goto out;
		ret = i2c_register_board_info(0, &ea_lpc1788_lcd_004_dimmer, 1);
		if (ret < 0)
			goto out;
		break;
	case PLATFORM_LPC178X_LNX_EVB:
		/* Do not configure LCD on LPC-LNX-EVB for now */
		break;
	default:
		break;
	}

	if (!have_lcd)
		goto out;

	/*
	 * Enable the power on the LCD controller module of the MCU
	 * before we call `amba_device_register()`. This is required, because
	 * `amba_device_register()` will try to read the AMBA device ID
	 * from the LCD controller module's register map; if the power on
	 * the module is off, its registers are not accessible.
	 */
	lpc178x_periph_enable(LPC178X_SCC_PCONP_PCLCD_MSK, 1);

	amba_device_register(&lpc178x_fb_device, &iomem_resource);

out:
	if (ret < 0) {
		printk(KERN_ERR "lpc178x fb: Could not initialize "
			"the LCD screen.\n");
	}
}
Beispiel #5
0
static int lpc178x_clcd_setup(struct clcd_fb *fb)
{
	int platform;
	int ret;
	dma_addr_t dma;

	ret = 0;
	fb->panel = NULL;

	/*
	 * Find the correct panel configuration
	 */
	platform = lpc178x_platform_get();
	switch (platform) {
	case PLATFORM_LPC178X_EA_LPC1788:
		fb->panel = &ea_lpc1788_lcd_004_panel;
		break;
	default:
		break;
	}

	if (!fb->panel) {
		ret = -ENODEV;
		goto out;
	}

	fb->fb.fix.smem_len = fb->panel->bpp *
		fb->panel->mode.xres * fb->panel->mode.yres / 8;
	fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
		fb->fb.fix.smem_len, &dma, GFP_KERNEL);
	if (!fb->fb.screen_base) {
		printk(KERN_ERR "CLCD: unable to map framebuffer\n");
		ret = -ENOMEM;
		goto out;
	}

	fb->fb.fix.smem_start = dma;

out:
	return ret;
}
Beispiel #6
0
void __init lpc178x_eth_init(void)
{
#if defined(CONFIG_LPC178X_MAC)
	int	platform;

	/*
	 * Fix-up and register platform device
	 */
	platform = lpc178x_platform_get();
	switch (platform) {
	case PLATFORM_LPC178X_EA_LPC1788:
	case PLATFORM_LPC178X_LNX_EVB:
		lpc178x_net_device.dev.platform_data = &lpc178x_common_eth_data;
		break;
	default:
		break;
	}

	platform_device_register(&lpc178x_net_device);
#endif
}