|  | @@ -502,3 +502,199 @@ static struct resource twi_resources[] = {
 | 
	
		
			
				|  |  |  		.start	= AT91RM9200_BASE_TWI,
 | 
	
		
			
				|  |  |  		.end	= AT91RM9200_BASE_TWI + SZ_16K - 1,
 | 
	
		
			
				|  |  |  		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TWI,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91rm9200_twi_device = {
 | 
	
		
			
				|  |  | +	.name		= "i2c-at91rm9200",
 | 
	
		
			
				|  |  | +	.id		= 0,
 | 
	
		
			
				|  |  | +	.resource	= twi_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(twi_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	/* pins used for TWI interface */
 | 
	
		
			
				|  |  | +	at91_set_A_periph(AT91_PIN_PA25, 0);		/* TWD */
 | 
	
		
			
				|  |  | +	at91_set_multi_drive(AT91_PIN_PA25, 1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	at91_set_A_periph(AT91_PIN_PA26, 0);		/* TWCK */
 | 
	
		
			
				|  |  | +	at91_set_multi_drive(AT91_PIN_PA26, 1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	i2c_register_board_info(0, devices, nr_devices);
 | 
	
		
			
				|  |  | +	platform_device_register(&at91rm9200_twi_device);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#else
 | 
	
		
			
				|  |  | +void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* --------------------------------------------------------------------
 | 
	
		
			
				|  |  | + *  SPI
 | 
	
		
			
				|  |  | + * -------------------------------------------------------------------- */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
 | 
	
		
			
				|  |  | +static u64 spi_dmamask = DMA_BIT_MASK(32);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource spi_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91RM9200_BASE_SPI,
 | 
	
		
			
				|  |  | +		.end	= AT91RM9200_BASE_SPI + SZ_16K - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_SPI,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91rm9200_spi_device = {
 | 
	
		
			
				|  |  | +	.name		= "atmel_spi",
 | 
	
		
			
				|  |  | +	.id		= 0,
 | 
	
		
			
				|  |  | +	.dev		= {
 | 
	
		
			
				|  |  | +				.dma_mask		= &spi_dmamask,
 | 
	
		
			
				|  |  | +				.coherent_dma_mask	= DMA_BIT_MASK(32),
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	.resource	= spi_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(spi_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static const unsigned spi_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PA4, AT91_PIN_PA5, AT91_PIN_PA6 };
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	int i;
 | 
	
		
			
				|  |  | +	unsigned long cs_pin;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	at91_set_A_periph(AT91_PIN_PA0, 0);	/* MISO */
 | 
	
		
			
				|  |  | +	at91_set_A_periph(AT91_PIN_PA1, 0);	/* MOSI */
 | 
	
		
			
				|  |  | +	at91_set_A_periph(AT91_PIN_PA2, 0);	/* SPCK */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	/* Enable SPI chip-selects */
 | 
	
		
			
				|  |  | +	for (i = 0; i < nr_devices; i++) {
 | 
	
		
			
				|  |  | +		if (devices[i].controller_data)
 | 
	
		
			
				|  |  | +			cs_pin = (unsigned long) devices[i].controller_data;
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			cs_pin = spi_standard_cs[devices[i].chip_select];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if (devices[i].chip_select == 0)	/* for CS0 errata */
 | 
	
		
			
				|  |  | +			at91_set_A_periph(cs_pin, 0);
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			at91_set_gpio_output(cs_pin, 1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		/* pass chip-select pin to driver */
 | 
	
		
			
				|  |  | +		devices[i].controller_data = (void *) cs_pin;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	spi_register_board_info(devices, nr_devices);
 | 
	
		
			
				|  |  | +	platform_device_register(&at91rm9200_spi_device);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#else
 | 
	
		
			
				|  |  | +void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* --------------------------------------------------------------------
 | 
	
		
			
				|  |  | + *  Timer/Counter blocks
 | 
	
		
			
				|  |  | + * -------------------------------------------------------------------- */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef CONFIG_ATMEL_TCLIB
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource tcb0_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91RM9200_BASE_TCB0,
 | 
	
		
			
				|  |  | +		.end	= AT91RM9200_BASE_TCB0 + SZ_16K - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC0,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[2] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[3] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC2,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91rm9200_tcb0_device = {
 | 
	
		
			
				|  |  | +	.name		= "atmel_tcb",
 | 
	
		
			
				|  |  | +	.id		= 0,
 | 
	
		
			
				|  |  | +	.resource	= tcb0_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(tcb0_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource tcb1_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91RM9200_BASE_TCB1,
 | 
	
		
			
				|  |  | +		.end	= AT91RM9200_BASE_TCB1 + SZ_16K - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC3,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[2] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC4,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[3] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91RM9200_ID_TC5,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91rm9200_tcb1_device = {
 | 
	
		
			
				|  |  | +	.name		= "atmel_tcb",
 | 
	
		
			
				|  |  | +	.id		= 1,
 | 
	
		
			
				|  |  | +	.resource	= tcb1_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(tcb1_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static void __init at91_add_device_tc(void)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	platform_device_register(&at91rm9200_tcb0_device);
 | 
	
		
			
				|  |  | +	platform_device_register(&at91rm9200_tcb1_device);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#else
 | 
	
		
			
				|  |  | +static void __init at91_add_device_tc(void) { }
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* --------------------------------------------------------------------
 | 
	
		
			
				|  |  | + *  RTC
 | 
	
		
			
				|  |  | + * -------------------------------------------------------------------- */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
 | 
	
		
			
				|  |  | +static struct resource rtc_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91RM9200_BASE_RTC,
 | 
	
		
			
				|  |  | +		.end	= AT91RM9200_BASE_RTC + SZ_256 - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91_ID_SYS,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91_ID_SYS,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91rm9200_rtc_device = {
 | 
	
		
			
				|  |  | +	.name		= "at91_rtc",
 | 
	
		
			
				|  |  | +	.id		= -1,
 |