diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
| -rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 59 | 
1 files changed, 50 insertions, 9 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 5a24f0b4554..7e5651ee9f8 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c @@ -21,6 +21,7 @@  #include <mach/cpu.h>  #include <mach/at91sam9260.h>  #include <mach/at91sam9260_matrix.h> +#include <mach/at91_matrix.h>  #include <mach/at91sam9_smc.h>  #include "generic.h" @@ -422,8 +423,8 @@ void __init at91_add_device_nand(struct atmel_nand_data *data)  	if (!data)  		return; -	csa = at91_sys_read(AT91_MATRIX_EBICSA); -	at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); +	csa = at91_matrix_read(AT91_MATRIX_EBICSA); +	at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);  	/* enable pin */  	if (gpio_is_valid(data->enable_pin)) @@ -641,7 +642,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)  static struct resource tcb0_resources[] = {  	[0] = {  		.start	= AT91SAM9260_BASE_TCB0, -		.end	= AT91SAM9260_BASE_TCB0 + SZ_16K - 1, +		.end	= AT91SAM9260_BASE_TCB0 + SZ_256 - 1,  		.flags	= IORESOURCE_MEM,  	},  	[1] = { @@ -671,7 +672,7 @@ static struct platform_device at91sam9260_tcb0_device = {  static struct resource tcb1_resources[] = {  	[0] = {  		.start	= AT91SAM9260_BASE_TCB1, -		.end	= AT91SAM9260_BASE_TCB1 + SZ_16K - 1, +		.end	= AT91SAM9260_BASE_TCB1 + SZ_256 - 1,  		.flags	= IORESOURCE_MEM,  	},  	[1] = { @@ -698,8 +699,25 @@ static struct platform_device at91sam9260_tcb1_device = {  	.num_resources	= ARRAY_SIZE(tcb1_resources),  }; +#if defined(CONFIG_OF) +static struct of_device_id tcb_ids[] = { +	{ .compatible = "atmel,at91rm9200-tcb" }, +	{ /*sentinel*/ } +}; +#endif +  static void __init at91_add_device_tc(void)  { +#if defined(CONFIG_OF) +	struct device_node *np; + +	np = of_find_matching_node(NULL, tcb_ids); +	if (np) { +		of_node_put(np); +		return; +	} +#endif +  	platform_device_register(&at91sam9260_tcb0_device);  	platform_device_register(&at91sam9260_tcb1_device);  } @@ -717,18 +735,42 @@ static struct resource rtt_resources[] = {  		.start	= AT91SAM9260_BASE_RTT,  		.end	= AT91SAM9260_BASE_RTT + SZ_16 - 1,  		.flags	= IORESOURCE_MEM, -	} +	}, { +		.flags	= IORESOURCE_MEM, +	},  };  static struct platform_device at91sam9260_rtt_device = {  	.name		= "at91_rtt",  	.id		= 0,  	.resource	= rtt_resources, -	.num_resources	= ARRAY_SIZE(rtt_resources),  }; + +#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) +static void __init at91_add_device_rtt_rtc(void) +{ +	at91sam9260_rtt_device.name = "rtc-at91sam9"; +	/* +	 * The second resource is needed: +	 * GPBR will serve as the storage for RTC time offset +	 */ +	at91sam9260_rtt_device.num_resources = 2; +	rtt_resources[1].start = AT91SAM9260_BASE_GPBR + +				 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; +	rtt_resources[1].end = rtt_resources[1].start + 3; +} +#else +static void __init at91_add_device_rtt_rtc(void) +{ +	/* Only one resource is needed: RTT not used as RTC */ +	at91sam9260_rtt_device.num_resources = 1; +} +#endif +  static void __init at91_add_device_rtt(void)  { +	at91_add_device_rtt_rtc();  	platform_device_register(&at91sam9260_rtt_device);  } @@ -1139,7 +1181,6 @@ static inline void configure_usart5_pins(void)  }  static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART];	/* the UARTs to use */ -struct platform_device *atmel_default_console_device;	/* the serial console device */  void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)  { @@ -1264,7 +1305,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)  	if (!data)  		return; -	csa = at91_sys_read(AT91_MATRIX_EBICSA); +	csa = at91_matrix_read(AT91_MATRIX_EBICSA);  	switch (data->chipselect) {  	case 4: @@ -1287,7 +1328,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data)  		return;  	} -	at91_sys_write(AT91_MATRIX_EBICSA, csa); +	at91_matrix_write(AT91_MATRIX_EBICSA, csa);  	if (gpio_is_valid(data->rst_pin)) {  		at91_set_multi_drive(data->rst_pin, 0);  |