|  | @@ -0,0 +1,135 @@
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * arch/arm/mach-at91/at91sam9263_devices.c
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + *  Copyright (C) 2007 Atmel Corporation.
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * This program is free software; you can redistribute it and/or modify
 | 
	
		
			
				|  |  | + * it under the terms of the GNU General Public License as published by
 | 
	
		
			
				|  |  | + * the Free Software Foundation; either version 2 of the License, or
 | 
	
		
			
				|  |  | + * (at your option) any later version.
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +#include <asm/mach/arch.h>
 | 
	
		
			
				|  |  | +#include <asm/mach/map.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <linux/dma-mapping.h>
 | 
	
		
			
				|  |  | +#include <linux/gpio.h>
 | 
	
		
			
				|  |  | +#include <linux/platform_device.h>
 | 
	
		
			
				|  |  | +#include <linux/i2c-gpio.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <linux/fb.h>
 | 
	
		
			
				|  |  | +#include <video/atmel_lcdc.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include <mach/at91sam9263.h>
 | 
	
		
			
				|  |  | +#include <mach/at91sam9263_matrix.h>
 | 
	
		
			
				|  |  | +#include <mach/at91_matrix.h>
 | 
	
		
			
				|  |  | +#include <mach/at91sam9_smc.h>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#include "board.h"
 | 
	
		
			
				|  |  | +#include "generic.h"
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* --------------------------------------------------------------------
 | 
	
		
			
				|  |  | + *  USB Host
 | 
	
		
			
				|  |  | + * -------------------------------------------------------------------- */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 | 
	
		
			
				|  |  | +static u64 ohci_dmamask = DMA_BIT_MASK(32);
 | 
	
		
			
				|  |  | +static struct at91_usbh_data usbh_data;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource usbh_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91SAM9263_UHP_BASE,
 | 
	
		
			
				|  |  | +		.end	= AT91SAM9263_UHP_BASE + SZ_1M - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91SAM9263_ID_UHP,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91SAM9263_ID_UHP,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91_usbh_device = {
 | 
	
		
			
				|  |  | +	.name		= "at91_ohci",
 | 
	
		
			
				|  |  | +	.id		= -1,
 | 
	
		
			
				|  |  | +	.dev		= {
 | 
	
		
			
				|  |  | +				.dma_mask		= &ohci_dmamask,
 | 
	
		
			
				|  |  | +				.coherent_dma_mask	= DMA_BIT_MASK(32),
 | 
	
		
			
				|  |  | +				.platform_data		= &usbh_data,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	.resource	= usbh_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(usbh_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void __init at91_add_device_usbh(struct at91_usbh_data *data)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	int i;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if (!data)
 | 
	
		
			
				|  |  | +		return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	/* Enable VBus control for UHP ports */
 | 
	
		
			
				|  |  | +	for (i = 0; i < data->ports; i++) {
 | 
	
		
			
				|  |  | +		if (gpio_is_valid(data->vbus_pin[i]))
 | 
	
		
			
				|  |  | +			at91_set_gpio_output(data->vbus_pin[i],
 | 
	
		
			
				|  |  | +					     data->vbus_pin_active_low[i]);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	/* Enable overcurrent notification */
 | 
	
		
			
				|  |  | +	for (i = 0; i < data->ports; i++) {
 | 
	
		
			
				|  |  | +		if (gpio_is_valid(data->overcurrent_pin[i]))
 | 
	
		
			
				|  |  | +			at91_set_gpio_input(data->overcurrent_pin[i], 1);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	usbh_data = *data;
 | 
	
		
			
				|  |  | +	platform_device_register(&at91_usbh_device);
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +#else
 | 
	
		
			
				|  |  | +void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* --------------------------------------------------------------------
 | 
	
		
			
				|  |  | + *  USB Device (Gadget)
 | 
	
		
			
				|  |  | + * -------------------------------------------------------------------- */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
 | 
	
		
			
				|  |  | +static struct at91_udc_data udc_data;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct resource udc_resources[] = {
 | 
	
		
			
				|  |  | +	[0] = {
 | 
	
		
			
				|  |  | +		.start	= AT91SAM9263_BASE_UDP,
 | 
	
		
			
				|  |  | +		.end	= AT91SAM9263_BASE_UDP + SZ_16K - 1,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_MEM,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	[1] = {
 | 
	
		
			
				|  |  | +		.start	= NR_IRQS_LEGACY + AT91SAM9263_ID_UDP,
 | 
	
		
			
				|  |  | +		.end	= NR_IRQS_LEGACY + AT91SAM9263_ID_UDP,
 | 
	
		
			
				|  |  | +		.flags	= IORESOURCE_IRQ,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +static struct platform_device at91_udc_device = {
 | 
	
		
			
				|  |  | +	.name		= "at91_udc",
 | 
	
		
			
				|  |  | +	.id		= -1,
 | 
	
		
			
				|  |  | +	.dev		= {
 | 
	
		
			
				|  |  | +				.platform_data		= &udc_data,
 | 
	
		
			
				|  |  | +	},
 | 
	
		
			
				|  |  | +	.resource	= udc_resources,
 | 
	
		
			
				|  |  | +	.num_resources	= ARRAY_SIZE(udc_resources),
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void __init at91_add_device_udc(struct at91_udc_data *data)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	if (!data)
 | 
	
		
			
				|  |  | +		return;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if (gpio_is_valid(data->vbus_pin)) {
 | 
	
		
			
				|  |  | +		at91_set_gpio_input(data->vbus_pin, 0);
 | 
	
		
			
				|  |  | +		at91_set_deglitch(data->vbus_pin, 1);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	/* Pullup pin is handled internally by USB device peripheral */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	udc_data = *data;
 |