|
@@ -0,0 +1,183 @@
|
|
|
+/*
|
|
|
+ * On-Chip devices setup code for the AT91SAM9G45 family
|
|
|
+ *
|
|
|
+ * Copyright (C) 2009 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/clk.h>
|
|
|
+#include <linux/platform_device.h>
|
|
|
+#include <linux/i2c-gpio.h>
|
|
|
+#include <linux/atmel-mci.h>
|
|
|
+#include <linux/platform_data/atmel-aes.h>
|
|
|
+
|
|
|
+#include <linux/platform_data/at91_adc.h>
|
|
|
+
|
|
|
+#include <linux/fb.h>
|
|
|
+#include <video/atmel_lcdc.h>
|
|
|
+
|
|
|
+#include <mach/at91_adc.h>
|
|
|
+#include <mach/at91sam9g45.h>
|
|
|
+#include <mach/at91sam9g45_matrix.h>
|
|
|
+#include <mach/at91_matrix.h>
|
|
|
+#include <mach/at91sam9_smc.h>
|
|
|
+#include <linux/platform_data/dma-atmel.h>
|
|
|
+#include <mach/atmel-mci.h>
|
|
|
+
|
|
|
+#include <media/atmel-isi.h>
|
|
|
+
|
|
|
+#include "board.h"
|
|
|
+#include "generic.h"
|
|
|
+#include "clock.h"
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * HDMAC - AHB DMA Controller
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE)
|
|
|
+static u64 hdmac_dmamask = DMA_BIT_MASK(32);
|
|
|
+
|
|
|
+static struct resource hdmac_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_BASE_DMA,
|
|
|
+ .end = AT91SAM9G45_BASE_DMA + SZ_512 - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_DMA,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_DMA,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at_hdmac_device = {
|
|
|
+ .name = "at91sam9g45_dma",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &hdmac_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ },
|
|
|
+ .resource = hdmac_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(hdmac_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_hdmac(void)
|
|
|
+{
|
|
|
+ platform_device_register(&at_hdmac_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_hdmac(void) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * USB Host (OHCI)
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#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_ohci_data;
|
|
|
+
|
|
|
+static struct resource usbh_ohci_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_OHCI_BASE,
|
|
|
+ .end = AT91SAM9G45_OHCI_BASE + SZ_1M - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91_usbh_ohci_device = {
|
|
|
+ .name = "at91_ohci",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &ohci_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &usbh_ohci_data,
|
|
|
+ },
|
|
|
+ .resource = usbh_ohci_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(usbh_ohci_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_usbh_ohci(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_ohci_data = *data;
|
|
|
+ platform_device_register(&at91_usbh_ohci_device);
|
|
|
+}
|
|
|
+#else
|
|
|
+void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data) {}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
+/* --------------------------------------------------------------------
|
|
|
+ * USB Host HS (EHCI)
|
|
|
+ * Needs an OHCI host for low and full speed management
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
+
|
|
|
+#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
|
|
|
+static u64 ehci_dmamask = DMA_BIT_MASK(32);
|
|
|
+static struct at91_usbh_data usbh_ehci_data;
|
|
|
+
|
|
|
+static struct resource usbh_ehci_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .start = AT91SAM9G45_EHCI_BASE,
|
|
|
+ .end = AT91SAM9G45_EHCI_BASE + SZ_1M - 1,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_UHPHS,
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device at91_usbh_ehci_device = {
|
|
|
+ .name = "atmel-ehci",
|
|
|
+ .id = -1,
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &ehci_dmamask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ .platform_data = &usbh_ehci_data,
|
|
|
+ },
|
|
|
+ .resource = usbh_ehci_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(usbh_ehci_resources),
|
|
|
+};
|
|
|
+
|
|
|
+void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+
|
|
|
+ if (!data)
|
|
|
+ return;
|