diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
| -rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 91 | 
1 files changed, 64 insertions, 27 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 352468f265a..0b1d71a7d9b 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c @@ -21,10 +21,13 @@  #include <mach/at91sam9rl_matrix.h>  #include <mach/at91_matrix.h>  #include <mach/at91sam9_smc.h> +#include <mach/hardware.h>  #include <linux/platform_data/dma-atmel.h> +#include <linux/platform_data/at91_adc.h>  #include "board.h"  #include "generic.h" +#include "gpio.h"  /* -------------------------------------------------------------------- @@ -498,7 +501,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) {}  #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)  static u64 lcdc_dmamask = DMA_BIT_MASK(32); -static struct atmel_lcdfb_info lcdc_data; +static struct atmel_lcdfb_pdata lcdc_data;  static struct resource lcdc_resources[] = {  	[0] = { @@ -525,7 +528,7 @@ static struct platform_device at91_lcdc_device = {  	.num_resources	= ARRAY_SIZE(lcdc_resources),  }; -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data)  {  	if (!data) {  		return; @@ -557,7 +560,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)  	platform_device_register(&at91_lcdc_device);  }  #else -void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} +void __init at91_add_device_lcdc(struct atmel_lcdfb_pdata *data) {}  #endif @@ -607,14 +610,13 @@ static void __init at91_add_device_tc(void) { }  /* -------------------------------------------------------------------- - *  Touchscreen + *  ADC and Touchscreen   * -------------------------------------------------------------------- */ -#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE) -static u64 tsadcc_dmamask = DMA_BIT_MASK(32); -static struct at91_tsadcc_data tsadcc_data; +#if IS_ENABLED(CONFIG_AT91_ADC) +static struct at91_adc_data adc_data; -static struct resource tsadcc_resources[] = { +static struct resource adc_resources[] = {  	[0] = {  		.start	= AT91SAM9RL_BASE_TSC,  		.end	= AT91SAM9RL_BASE_TSC + SZ_16K - 1, @@ -627,36 +629,71 @@ static struct resource tsadcc_resources[] = {  	}  }; -static struct platform_device at91sam9rl_tsadcc_device = { -	.name		= "atmel_tsadcc", -	.id		= -1, -	.dev		= { -				.dma_mask		= &tsadcc_dmamask, -				.coherent_dma_mask	= DMA_BIT_MASK(32), -				.platform_data		= &tsadcc_data, +static struct platform_device at91_adc_device = { +	.name           = "at91sam9rl-adc", +	.id             = -1, +	.dev            = { +		.platform_data  = &adc_data,  	}, -	.resource	= tsadcc_resources, -	.num_resources	= ARRAY_SIZE(tsadcc_resources), +	.resource       = adc_resources, +	.num_resources  = ARRAY_SIZE(adc_resources),  }; -void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) +static struct at91_adc_trigger at91_adc_triggers[] = { +	[0] = { +		.name = "external-rising", +		.value = 1, +		.is_external = true, +	}, +	[1] = { +		.name = "external-falling", +		.value = 2, +		.is_external = true, +	}, +	[2] = { +		.name = "external-any", +		.value = 3, +		.is_external = true, +	}, +	[3] = { +		.name = "continuous", +		.value = 6, +		.is_external = false, +	}, +}; + +void __init at91_add_device_adc(struct at91_adc_data *data)  {  	if (!data)  		return; -	at91_set_A_periph(AT91_PIN_PA17, 0);	/* AD0_XR */ -	at91_set_A_periph(AT91_PIN_PA18, 0);	/* AD1_XL */ -	at91_set_A_periph(AT91_PIN_PA19, 0);	/* AD2_YT */ -	at91_set_A_periph(AT91_PIN_PA20, 0);	/* AD3_TB */ - -	tsadcc_data = *data; -	platform_device_register(&at91sam9rl_tsadcc_device); +	if (test_bit(0, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PA17, 0); +	if (test_bit(1, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PA18, 0); +	if (test_bit(2, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PA19, 0); +	if (test_bit(3, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PA20, 0); +	if (test_bit(4, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PD6, 0); +	if (test_bit(5, &data->channels_used)) +		at91_set_A_periph(AT91_PIN_PD7, 0); + +	if (data->use_external_triggers) +		at91_set_A_periph(AT91_PIN_PB15, 0); + +	data->startup_time = 40; +	data->trigger_number = 4; +	data->trigger_list = at91_adc_triggers; + +	adc_data = *data; +	platform_device_register(&at91_adc_device);  }  #else -void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} +void __init at91_add_device_adc(struct at91_adc_data *data) {}  #endif -  /* --------------------------------------------------------------------   *  RTC   * -------------------------------------------------------------------- */  | 
