|
@@ -0,0 +1,165 @@
|
|
|
|
+/*
|
|
|
|
+ * arch/arm/mach-at91/at91sam9261_devices.c
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
|
|
|
|
+ * Copyright (C) 2005 David Brownell
|
|
|
|
+ *
|
|
|
|
+ * 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/at91sam9261.h>
|
|
|
|
+#include <mach/at91sam9261_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 = AT91SAM9261_UHP_BASE,
|
|
|
|
+ .end = AT91SAM9261_UHP_BASE + SZ_1M - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9261_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 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(&at91sam9261_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 = AT91SAM9261_BASE_UDP,
|
|
|
|
+ .end = AT91SAM9261_BASE_UDP + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9261_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;
|
|
|
|
+ platform_device_register(&at91sam9261_udc_device);
|
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+void __init at91_add_device_udc(struct at91_udc_data *data) {}
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* --------------------------------------------------------------------
|
|
|
|
+ * MMC / SD
|
|
|
|
+ * -------------------------------------------------------------------- */
|
|
|
|
+
|
|
|
|
+#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
|
|
|
|
+static u64 mmc_dmamask = DMA_BIT_MASK(32);
|
|
|
|
+static struct mci_platform_data mmc_data;
|
|
|
|
+
|
|
|
|
+static struct resource mmc_resources[] = {
|
|
|
|
+ [0] = {
|
|
|
|
+ .start = AT91SAM9261_BASE_MCI,
|
|
|
|
+ .end = AT91SAM9261_BASE_MCI + SZ_16K - 1,
|
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
|
+ },
|
|
|
|
+ [1] = {
|
|
|
|
+ .start = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI,
|
|
|
|
+ .end = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI,
|
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct platform_device at91sam9261_mmc_device = {
|
|
|
|
+ .name = "atmel_mci",
|
|
|
|
+ .id = -1,
|
|
|
|
+ .dev = {
|
|
|
|
+ .dma_mask = &mmc_dmamask,
|
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
|
+ .platform_data = &mmc_data,
|
|
|
|
+ },
|
|
|
|
+ .resource = mmc_resources,
|