static void ar934x_nfc_setup(void) { ath79_nfc_resources[0].start = AR934X_NFC_BASE; ath79_nfc_resources[0].end = AR934X_NFC_BASE + AR934X_NFC_SIZE - 1; ath79_nfc_resources[0].flags = IORESOURCE_MEM; ath79_nfc_resources[1].start = ATH79_MISC_IRQ(21); ath79_nfc_resources[1].end = ATH79_MISC_IRQ(21); ath79_nfc_resources[1].flags = IORESOURCE_IRQ; ath79_nfc_data.hw_reset = ar934x_nfc_hw_reset; platform_device_register(&ath79_nfc_device); }
void __init arch_init_irq(void) { if (soc_is_ar71xx()) { ath79_ip2_handler = ar71xx_ip2_handler; ath79_ip3_handler = ar71xx_ip3_handler; } else if (soc_is_ar724x()) { ath79_ip2_handler = ar724x_ip2_handler; ath79_ip3_handler = ar724x_ip3_handler; } else if (soc_is_ar913x()) { ath79_ip2_handler = ar913x_ip2_handler; ath79_ip3_handler = ar913x_ip3_handler; } else if (soc_is_ar933x()) { ath79_ip2_handler = ar933x_ip2_handler; ath79_ip3_handler = ar933x_ip3_handler; } else if (soc_is_ar934x()) { ath79_ip2_handler = ath79_default_ip2_handler; ath79_ip3_handler = ar934x_ip3_handler; } else if (soc_is_qca955x()) { ath79_ip2_handler = ath79_default_ip2_handler; ath79_ip3_handler = ath79_default_ip3_handler; } else { BUG(); } cp0_perfcount_irq = ATH79_MISC_IRQ(5); mips_cpu_irq_init(); ath79_misc_irq_init(); if (soc_is_ar934x()) ar934x_ip2_irq_init(); else if (soc_is_qca955x()) qca955x_irq_init(); }
static void __init ath79_usb_setup(void) { void __iomem *usb_ctrl_base; ath79_device_reset_set(AR71XX_USB_RESET_MASK); mdelay(1000); ath79_device_reset_clear(AR71XX_USB_RESET_MASK); usb_ctrl_base = ioremap(AR71XX_USB_CTRL_BASE, AR71XX_USB_CTRL_SIZE); /* Turning on the Buff and Desc swap bits */ __raw_writel(0xf0000, usb_ctrl_base + AR71XX_USB_CTRL_REG_CONFIG); /* WAR for HW bug. Here it adjusts the duration between two SOFS */ __raw_writel(0x20c00, usb_ctrl_base + AR71XX_USB_CTRL_REG_FLADJ); iounmap(usb_ctrl_base); mdelay(900); ath79_usb_register("ohci-platform", -1, AR71XX_OHCI_BASE, AR71XX_OHCI_SIZE, ATH79_MISC_IRQ(6), &ath79_ohci_pdata, sizeof(ath79_ohci_pdata)); ath79_usb_register("ehci-platform", -1, AR71XX_EHCI_BASE, AR71XX_EHCI_SIZE, ATH79_CPU_IRQ(3), &ath79_ehci_pdata_v1, sizeof(ath79_ehci_pdata_v1)); }
static int ath79_pcm_close(struct snd_pcm_substream *ss) { struct snd_soc_pcm_runtime *runtime = ss->private_data; struct snd_soc_platform *platform = runtime->platform; struct ath79_pcm_pltfm_priv *prdata = snd_soc_platform_get_drvdata(platform); struct ath79_pcm_rt_priv *rtpriv; if (!prdata) return 0; if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) { prdata->playback = NULL; } else { prdata->capture = NULL; } if (!prdata->playback && !prdata->capture) { free_irq(ATH79_MISC_IRQ(7), prdata); kfree(prdata); snd_soc_platform_set_drvdata(platform, NULL); } rtpriv = ss->runtime->private_data; kfree(rtpriv); return 0; }
static void qca955x_nfc_setup(void) { ath79_nfc_data.hw_reset = qca955x_nfc_hw_reset; ath79_nfc_init_resource(ath79_nfc_resources, QCA955X_NFC_BASE, QCA955X_NFC_SIZE, ATH79_MISC_IRQ(21)); platform_device_register(&ath79_nfc_device); }
static void ar934x_nfc_setup(void) { ath79_nfc_data.hw_reset = ar934x_nfc_hw_reset; ath79_nfc_init_resource(ath79_nfc_resources, AR934X_NFC_BASE, AR934X_NFC_SIZE, ATH79_MISC_IRQ(21)); platform_device_register(&ath79_nfc_device); }
static int ath79_pcm_open(struct snd_pcm_substream *ss) { struct snd_soc_pcm_runtime *runtime = ss->private_data; struct snd_soc_platform *platform = runtime->platform; struct ath79_pcm_pltfm_priv *prdata = snd_soc_platform_get_drvdata(platform); struct ath79_pcm_rt_priv *rtpriv; int err; if (prdata == NULL) { prdata = kzalloc(sizeof(struct ath79_pcm_pltfm_priv), GFP_KERNEL); if (prdata == NULL) return -ENOMEM; err = request_irq(ATH79_MISC_IRQ(7), ath79_pcm_interrupt, 0, "ath79-pcm", prdata); if (err) { kfree(prdata); return -EBUSY; } snd_soc_platform_set_drvdata(platform, prdata); } if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) { prdata->playback = ss; } else { prdata->capture = ss; } /* Allocate/Initialize the buffer linked list head */ rtpriv = kmalloc(sizeof(*rtpriv), GFP_KERNEL); if (!rtpriv) { return -ENOMEM; } snd_printd("%s: 0x%xB allocated at 0x%08x\n", __FUNCTION__, sizeof(*rtpriv), (u32) rtpriv); ss->runtime->private_data = rtpriv; rtpriv->last_played = NULL; INIT_LIST_HEAD(&rtpriv->dma_head); if(ss->stream == SNDRV_PCM_STREAM_PLAYBACK) rtpriv->direction = SNDRV_PCM_STREAM_PLAYBACK; else rtpriv->direction = SNDRV_PCM_STREAM_CAPTURE; snd_soc_set_runtime_hwparams(ss, &ath79_pcm_hardware); return 0; }
static void ath79_misc_irq_handler(unsigned int irq, struct irq_desc *desc) { void __iomem *base = ath79_reset_base; u32 pending; pending = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_STATUS) & __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); if (!pending) { spurious_interrupt(); return; } while (pending) { int bit = __ffs(pending); generic_handle_irq(ATH79_MISC_IRQ(bit)); pending &= ~BIT(bit); } }
int get_c0_perfcount_int(void) { return ATH79_MISC_IRQ(5); }
#include "common.h" #include "dev-common.h" static struct resource ath79_uart_resources[] = { { .start = AR71XX_UART_BASE, .end = AR71XX_UART_BASE + AR71XX_UART_SIZE - 1, .flags = IORESOURCE_MEM, }, }; #define AR71XX_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP) static struct plat_serial8250_port ath79_uart_data[] = { { .mapbase = AR71XX_UART_BASE, .irq = ATH79_MISC_IRQ(3), .flags = AR71XX_UART_FLAGS, .iotype = UPIO_MEM32, .regshift = 2, }, { /* terminating entry */ } }; static struct platform_device ath79_uart_device = { .name = "serial8250", .id = PLAT8250_DEV_PLATFORM, .resource = ath79_uart_resources, .num_resources = ARRAY_SIZE(ath79_uart_resources), .dev = { .platform_data = ath79_uart_data
#define DRIVER_NAME "ar933x-uart" #define AR71XX_APB_BASE 0x18000000 #define AR71XX_UART_SIZE 0x100 #define AR934X_UART1_BASE (AR71XX_APB_BASE + 0x00500000) #define AR934X_UART1_FIFO_SIZE 4 static struct resource ar933x_uart_resources[] = { { .start = AR934X_UART1_BASE, .end = AR934X_UART1_BASE + 0x14 - 1, .flags = IORESOURCE_MEM, }, { .start = ATH79_MISC_IRQ(6), .end = ATH79_MISC_IRQ(6), .flags = IORESOURCE_IRQ, }, }; static struct platform_device ar933x_uart_device = { .name = DRIVER_NAME, .id = -1, .resource = ar933x_uart_resources, .num_resources = ARRAY_SIZE(ar933x_uart_resources), }; static int __init ar933x_uart_reg_init(void) { platform_device_register(&ar933x_uart_device);