Example #1
0
/*
 * Register the M2S specific SPI controllers and devices with the kernel.
 */
void __init m2s_spi_init(void)
{
	int	p = m2s_platform_get();

#if defined(CONFIG_M2S_MSS_SPI0)
	spi_m2s_dev0_data.ref_clk = m2s_clock_get(SPI0_M2S_CLK);
	platform_set_drvdata(&spi_m2s_dev0, &spi_m2s_dev0_data);
	platform_device_register(&spi_m2s_dev0);
#endif

#if defined(CONFIG_M2S_MSS_SPI1)
	spi_m2s_dev1_data.ref_clk = m2s_clock_get(SPI1_M2S_CLK);
	platform_set_drvdata(&spi_m2s_dev1, &spi_m2s_dev1_data);
	platform_device_register(&spi_m2s_dev1);
#endif

	if (p == PLATFORM_M2S_SOM) {
#if defined(CONFIG_M2S_MSS_SPI0) && defined(CONFIG_MTD_M25P80)
		/*
		 * SPI Flash partitioning:
		 * 0-1ffff:		U-boot environment
		 * 20000-3fffff:	Linux bootable image
		 * 400000-end of Flash:	JFFS2 filesystem
		 */
#		define M2S_SOM_SF_MTD_OFFSET		0x010000 /* 64 KB */
#		define M2S_SOM_SF_MTD_SIZE0		0x400000 /*  4 MB */
#		define M2S_SOM_SF_MTD_SIZE1		0xBF0000 /*~12 MB */
		static struct mtd_partition m2s_som_sf_mtd[] = {
			{
				.name = "spi_flash_uboot_env",
				.offset = 0,
				.size = M2S_SOM_SF_MTD_OFFSET,
			}, {
				.name = "spi_flash_linux_image",
				.offset = M2S_SOM_SF_MTD_OFFSET,
				.size = M2S_SOM_SF_MTD_SIZE0,
			}, {
				.name = "spi_flash_jffs2",
Example #2
0
/*
 * Register the M2S specific I2C devices with the kernel.
 */
void __init m2s_i2c_init(void)
{
	int p = m2s_platform_get();

#if defined(CONFIG_M2S_MSS_I2C0)

	/*
 	 * Reset the I2C controller and then bring it out of reset
 	 */
	writel(readl(&M2S_SYSREG->soft_reset_cr) | I2C0_RST_CLR,
		&M2S_SYSREG->soft_reset_cr);
	writel(readl(&M2S_SYSREG->soft_reset_cr) & ~I2C0_RST_CLR,
		&M2S_SYSREG->soft_reset_cr);

	/*
 	 * Pass the device parameters to the driver
 	 */
	i2c_m2s_data_dev0.ref_clk = m2s_clock_get(CLCK_PCLK0);
	platform_set_drvdata(&i2c_m2s_dev0, &i2c_m2s_data_dev0);

	/*
	 * Register a platform device for this interface
	 */
	platform_device_register(&i2c_m2s_dev0);
#endif

#if defined(CONFIG_M2S_MSS_I2C1)

	/*
 	 * Reset the I2C controller and then bring it out of reset
 	 */
	writel(readl(&M2S_SYSREG->soft_reset_cr) | I2C1_RST_CLR,
		&M2S_SYSREG->soft_reset_cr);
	writel(readl(&M2S_SYSREG->soft_reset_cr) & ~I2C1_RST_CLR,
		&M2S_SYSREG->soft_reset_cr);

	/*
 	 * Pass the device parameters to the driver
 	 */
	i2c_m2s_data_dev1.ref_clk = m2s_clock_get(CLCK_PCLK1);
	platform_set_drvdata(&i2c_m2s_dev1, &i2c_m2s_data_dev1);

	/*
	 * Register a platform device for this interface
	 */
	platform_device_register(&i2c_m2s_dev1);
#endif

	/*
 	 * Perform board-specific I2C device registration
 	 */
	if (p == PLATFORM_M2S_SOM || p == PLATFORM_M2S_FG484_SOM) {
#if defined(CONFIG_M2S_MSS_I2C1)

		/*
		 * This assumes that a compatible I2C Flash is
		 * wired to I2C_1 in the baseboard area.
		 */
#if defined(CONFIG_EEPROM_AT24)
		static struct i2c_board_info i2c_eeprom__m2s_som= {
			I2C_BOARD_INFO("24c512", 0x51)
		};
#endif

#if defined(CONFIG_EEPROM_AT24)
		i2c_register_board_info(1, &i2c_eeprom__m2s_som, 1);
#endif

#endif
	}
}