#include <linux/init.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
+#include <linux/ath9k_platform.h>
-#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/platform.h>
},
};
+
static u64 ar71xx_ehci_dmamask = DMA_BIT_MASK(32);
+static struct ar71xx_ehci_platform_data ar71xx_ehci_data;
+
static struct platform_device ar71xx_ehci_device = {
.name = "ar71xx-ehci",
.id = -1,
.dev = {
.dma_mask = &ar71xx_ehci_dmamask,
.coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &ar71xx_ehci_data,
},
};
(RESET_MODULE_USB_HOST | RESET_MODULE_USB_PHY \
| RESET_MODULE_USB_OHCI_DLL)
-void __init ar71xx_add_device_usb(void)
+static void ar71xx_usb_setup(void)
{
ar71xx_device_stop(AR71XX_USB_RESET_MASK);
mdelay(1000);
ar71xx_usb_ctrl_wr(USB_CTRL_REG_FLADJ, 0x20c00);
mdelay(900);
+}
+
+static void ar91xx_usb_setup(void)
+{
+ ar71xx_device_stop(RESET_MODULE_USBSUS_OVERRIDE);
+ mdelay(10);
+
+ ar71xx_device_start(RESET_MODULE_USB_HOST);
+ mdelay(10);
+
+ ar71xx_device_start(RESET_MODULE_USB_PHY);
+ mdelay(10);
+}
+
+void __init ar71xx_add_device_usb(void)
+{
+ switch (ar71xx_soc) {
+ case AR71XX_SOC_AR7130:
+ case AR71XX_SOC_AR7141:
+ case AR71XX_SOC_AR7161:
+ ar71xx_usb_setup();
+ platform_device_register(&ar71xx_ohci_device);
+ platform_device_register(&ar71xx_ehci_device);
+ break;
- platform_device_register(&ar71xx_ohci_device);
- platform_device_register(&ar71xx_ehci_device);
+ case AR71XX_SOC_AR9130:
+ case AR71XX_SOC_AR9132:
+ ar91xx_usb_setup();
+ ar71xx_ehci_data.is_ar91xx = 1;
+ platform_device_register(&ar71xx_ehci_device);
+ break;
+
+ default:
+ BUG();
+ }
}
-#ifdef CONFIG_AR71XX_EARLY_SERIAL
-static void __init ar71xx_add_device_uart(void) {};
-#else
+#ifndef CONFIG_AR71XX_EARLY_SERIAL
static struct resource ar71xx_uart_resources[] = {
{
.start = AR71XX_UART_BASE,
},
};
-static void __init ar71xx_add_device_uart(void)
+void __init ar71xx_add_device_uart(void)
{
ar71xx_uart_data[0].uartclk = ar71xx_ahb_freq;
platform_device_register(&ar71xx_uart_device);
break;
}
- memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN);
- pdata->mac_addr[5] += ar71xx_eth_instance;
+ if (is_valid_ether_addr(ar71xx_mac_base)) {
+ memcpy(pdata->mac_addr, ar71xx_mac_base, ETH_ALEN);
+ pdata->mac_addr[5] += ar71xx_eth_instance;
+ } else {
+ random_ether_addr(pdata->mac_addr);
+ printk(KERN_DEBUG
+ "ar71xx: using random MAC address for eth%d\n",
+ ar71xx_eth_instance);
+ }
platform_device_register(pdev);
ar71xx_eth_instance++;
struct spi_board_info const *info,
unsigned n)
{
- ar71xx_gpio_function_enable(GPIO_FUNC_SPI_EN);
-
spi_register_board_info(info, n);
ar71xx_spi_device.dev.platform_data = pdata;
platform_device_register(&ar71xx_spi_device);
memset(&pdata, 0, sizeof(pdata));
pdata.num_leds = num_leds;
- pdata.leds = leds;
+ pdata.leds = p;
err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
if (err)
t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]);
+ if (t != ETH_ALEN)
+ t = sscanf(mac_str, "%02hhx.%02hhx.%02hhx.%02hhx.%02hhx.%02hhx",
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]);
+
if (t == ETH_ALEN)
ar71xx_set_mac_base(tmp);
else
"\"%s\"\n", mac_str);
}
-static int __init ar71xx_machine_setup(void)
+static struct resource ar91xx_wmac_resources[] = {
+ {
+ .start = AR91XX_WMAC_BASE,
+ .end = AR91XX_WMAC_BASE + AR91XX_WMAC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ }, {
+ .start = AR71XX_CPU_IRQ_WMAC,
+ .end = AR71XX_CPU_IRQ_WMAC,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct ath9k_platform_data ar91xx_wmac_data;
+
+static struct platform_device ar91xx_wmac_device = {
+ .name = "ath9k",
+ .id = -1,
+ .resource = ar91xx_wmac_resources,
+ .num_resources = ARRAY_SIZE(ar91xx_wmac_resources),
+ .dev = {
+ .platform_data = &ar91xx_wmac_data,
+ },
+};
+
+void __init ar91xx_add_device_wmac(void)
{
- ar71xx_gpio_init();
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
- ar71xx_add_device_uart();
- ar71xx_add_device_wdt();
+ memcpy(ar91xx_wmac_data.eeprom_data, ee,
+ sizeof(ar91xx_wmac_data.eeprom_data));
- mips_machine_setup(ar71xx_mach_type);
- return 0;
-}
+ ar71xx_device_stop(RESET_MODULE_AMBA2WMAC);
+ mdelay(10);
-arch_initcall(ar71xx_machine_setup);
+ ar71xx_device_start(RESET_MODULE_AMBA2WMAC);
+ mdelay(10);
+
+ platform_device_register(&ar91xx_wmac_device);
+}