static void pxa250_start_rx_dma(struct net_device *dev) { struct pxa250_irda *si = dev->priv; int ch=si->rxdma_ch; if (!si->rxskb) { DBG("rx buffer went missing\n"); /* return; */ } DCSR(ch)=0; DCSR(ch)=DCSR_NODESC; DSADR(ch) = __PREG(ICDR); DTADR(ch) = si->rxbuf_dma; /* phisical address */; /* We should never do END_IRQ. !!!*/ DCMD(ch) = DCMD_ENDIRQEN| DCMD_INCTRGADDR | DCMD_FLOWSRC | DCMD_BURST8 | DCMD_WIDTH1 | HPSIR_MAX_RXLEN; /* * All right information will be available as soon as we set RXE flag */ DCSR(ch) = DCSR_ENDINTR | DCSR_BUSERR; DCSR(ch) = DCSR_RUN | DCSR_NODESC ; }
/** * ssp_exit - undo the effects of ssp_init * * release and free resources for the SSP port. */ void ssp_exit(void) { Ser4SSCR0 &= ~SSCR0_SSE; free_irq(IRQ_Ser4SSP, NULL); release_mem_region(__PREG(Ser4SSCR0), 0x18); }
inline static void pxa_irda_fir_dma_rx_start(struct pxa_irda *si) { DCSR(si->rxdma) = DCSR_NODESC; DSADR(si->rxdma) = __PREG(ICDR); DTADR(si->rxdma) = si->dma_rx_buff_phy; DCMD(si->rxdma) = DCMD_INCTRGADDR | DCMD_FLOWSRC | DCMD_WIDTH1 | DCMD_BURST32 | IRDA_FRAME_SIZE_LIMIT; DCSR(si->rxdma) |= DCSR_RUN; }
inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si) { DCSR(si->txdma) = DCSR_NODESC; DSADR(si->txdma) = si->dma_tx_buff_phy; DTADR(si->txdma) = __PREG(ICDR); DCMD(si->txdma) = DCMD_INCSRCADDR | DCMD_FLOWTRG | DCMD_ENDIRQEN | DCMD_WIDTH1 | DCMD_BURST32 | si->dma_tx_buff_len; DCSR(si->txdma) |= DCSR_RUN; }
static int pxa_irda_remove(struct platform_device *_dev) { struct net_device *dev = platform_get_drvdata(_dev); if (dev) { struct pxa_irda *si = netdev_priv(dev); unregister_netdev(dev); kfree(si->tx_buff.head); kfree(si->rx_buff.head); free_netdev(dev); } release_mem_region(__PREG(STUART), 0x24); release_mem_region(__PREG(FICP), 0x1c); return 0; }
static int sa1100_irda_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); if (dev) { struct sa1100_irda *si = dev->priv; unregister_netdev(dev); kfree(si->tx_buff.head); kfree(si->rx_buff.head); free_netdev(dev); } release_mem_region(__PREG(Ser2HSCR2), 0x04); release_mem_region(__PREG(Ser2HSCR0), 0x1c); release_mem_region(__PREG(Ser2UTCR0), 0x24); return 0; }
/* * On Assabet, we must probe for the Neponset board _before_ * paging_init() has occurred to actually determine the amount * of RAM available. To do so, we map the appropriate IO section * in the page table here in order to access GPIO registers. */ static void __init map_sa1100_gpio_regs( void ) { unsigned long phys = __PREG(GPLR) & PMD_MASK; unsigned long virt = io_p2v(phys); int prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_DOMAIN(DOMAIN_IO); pmd_t pmd; pmd_val(pmd) = phys | prot; set_pmd(pmd_offset(pgd_offset_k(virt), virt), pmd); }
/** * ssp_init - setup the SSP port * * initialise and claim resources for the SSP port. * * Returns: * %-ENODEV if the SSP port is unavailable * %-EBUSY if the resources are already in use * %0 on success */ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) { int ret; if (port > PXA_SSP_PORTS || port == 0) return -ENODEV; mutex_lock(&mutex); if (use_count[port - 1]) { mutex_unlock(&mutex); return -EBUSY; } use_count[port - 1]++; if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { use_count[port - 1]--; mutex_unlock(&mutex); return -EBUSY; } dev->port = port; /* do we need to get irq */ if (!(init_flags & SSP_NO_IRQ)) { ret = request_irq(ssp_info[port-1].irq, ssp_interrupt, 0, "SSP", dev); if (ret) goto out_region; dev->irq = ssp_info[port-1].irq; } else dev->irq = 0; /* turn on SSP port clock */ pxa_set_cken(ssp_info[port-1].clock, 1); mutex_unlock(&mutex); return 0; out_region: release_mem_region(__PREG(SSCR0_P(port)), 0x2c); use_count[port - 1]--; mutex_unlock(&mutex); return ret; }
/* * On Assabet, we must probe for the Neponset board _before_ * paging_init() has occurred to actually determine the amount * of RAM available. To do so, we map the appropriate IO section * in the page table here in order to access GPIO registers. */ static void __init map_sa1100_gpio_regs( void ) { unsigned long phys = __PREG(GPLR) & PMD_MASK; unsigned long virt = (unsigned long)io_p2v(phys); int prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_DOMAIN(DOMAIN_IO); pmd_t *pmd; pmd = pmd_offset(pud_offset(pgd_offset_k(virt), virt), virt); *pmd = __pmd(phys | prot); flush_pmd_entry(pmd); }
static int __init pxa250_irda_init(void) { struct net_device *dev; int err; /* STUART */ err = request_mem_region(__PREG(STRBR), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; /* FIR */ err = request_mem_region(__PREG(ICCR0), 0x1c, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_2; rtnl_lock(); dev = dev_alloc("irda%d", &err); if (dev) { dev->irq = IRQ_STUART; dev->init = pxa250_irda_net_init; dev->uninit = pxa250_irda_net_uninit; err = register_netdevice(dev); if (err) kfree(dev); else netdev = dev; } rtnl_unlock(); if (err) { release_mem_region(__PREG(ICCR0), 0x1c); err_mem_2: release_mem_region(__PREG(STRBR), 0x24); } err_mem_1: return err; }
static void __exit pxa250_irda_exit(void) { struct net_device *dev = netdev; netdev = NULL; if (dev) { rtnl_lock(); unregister_netdevice(dev); rtnl_unlock(); } release_mem_region(__PREG(ICCR0), 0x1c); release_mem_region(__PREG(STRBR), 0x24); /* * We now know that the netdevice is no longer in use, and all * references to our driver have been removed. The only structure * which may still be present is the netdevice, which will get * cleaned up by net/core/dev.c */ }
static int pxa_irda_remove(struct platform_device *_dev) { struct net_device *dev = platform_get_drvdata(_dev); if (dev) { struct pxa_irda *si = netdev_priv(dev); unregister_netdev(dev); if (gpio_is_valid(si->pdata->gpio_pwdown)) gpio_free(si->pdata->gpio_pwdown); if (si->pdata->shutdown) si->pdata->shutdown(si->dev); kfree(si->tx_buff.head); kfree(si->rx_buff.head); clk_put(si->fir_clk); clk_put(si->sir_clk); free_netdev(dev); } release_mem_region(__PREG(STUART), 0x24); release_mem_region(__PREG(FICP), 0x1c); return 0; }
/** * ssp_init - setup the SSP port * * initialise and claim resources for the SSP port. * * Returns: * %-ENODEV if the SSP port is unavailable * %-EBUSY if the resources are already in use * %0 on success */ int ssp_init(void) { int ret; if (!(PPAR & PPAR_SPR) && (Ser4MCCR0 & MCCR0_MCE)) return -ENODEV; if (!request_mem_region(__PREG(Ser4SSCR0), 0x18, "SSP")) { return -EBUSY; } Ser4SSSR = SSSR_ROR; ret = request_irq(IRQ_Ser4SSP, ssp_interrupt, 0, "SSP", NULL); if (ret) goto out_region; return 0; out_region: release_mem_region(__PREG(Ser4SSCR0), 0x18); return ret; }
/** * ssp_exit - undo the effects of ssp_init * * release and free resources for the SSP port. */ void ssp_exit(struct ssp_dev *dev) { mutex_lock(&mutex); SSCR0_P(dev->port) &= ~SSCR0_SSE; if (dev->port > PXA_SSP_PORTS || dev->port == 0) { printk(KERN_WARNING "SSP: tried to close invalid port\n"); return; } pxa_set_cken(ssp_info[dev->port-1].clock, 0); if (dev->irq) free_irq(dev->irq, dev); release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); use_count[dev->port - 1]--; mutex_unlock(&mutex); }
static #endif int __init sa1100_irda_init(void) { struct net_device *dev; int err; /* * Limit power level a sensible range. */ if (power_level < 1) power_level = 1; if (power_level > 3) power_level = 3; err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; err = request_mem_region(__PREG(Ser2HSCR0), 0x1c, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_2; err = request_mem_region(__PREG(Ser2HSCR2), 0x04, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_3; rtnl_lock(); dev = dev_alloc("irda%d", &err); if (dev) { dev->irq = IRQ_Ser2ICP; dev->init = sa1100_irda_net_init; dev->uninit = sa1100_irda_net_uninit; err = register_netdevice(dev); if (err) kfree(dev); else netdev = dev; } rtnl_unlock(); if (err) { release_mem_region(__PREG(Ser2HSCR2), 0x04); err_mem_3: release_mem_region(__PREG(Ser2HSCR0), 0x1c); err_mem_2: release_mem_region(__PREG(Ser2UTCR0), 0x24); } err_mem_1: return err; }
static struct resource sa11x0uart3_resources[] = { [0] = DEFINE_RES_MEM(__PREG(Ser3UTCR0), SZ_64K), [1] = DEFINE_RES_IRQ(IRQ_Ser3UART), }; static struct platform_device sa11x0uart3_device = { .name = "sa11x0-uart", .id = 3, .num_resources = ARRAY_SIZE(sa11x0uart3_resources), .resource = sa11x0uart3_resources, }; static struct resource sa11x0mcp_resources[] = { [0] = DEFINE_RES_MEM(__PREG(Ser4MCCR0), SZ_64K), [1] = DEFINE_RES_MEM(__PREG(Ser4MCCR1), 4), [2] = DEFINE_RES_IRQ(IRQ_Ser4MCP), }; static u64 sa11x0mcp_dma_mask = 0xffffffffUL; static struct platform_device sa11x0mcp_device = { .name = "sa11x0-mcp", .id = -1, .dev = { .dma_mask = &sa11x0mcp_dma_mask, .coherent_dma_mask = 0xffffffff, }, .num_resources = ARRAY_SIZE(sa11x0mcp_resources), .resource = sa11x0mcp_resources, };
} static void sa11x0_register_device(struct platform_device *dev, void *data) { int err; dev->dev.platform_data = data; err = platform_device_register(dev); if (err) printk(KERN_ERR "Unable to register device %s: %d\n", dev->name, err); } static struct resource sa11x0udc_resources[] = { [0] = { .start = __PREG(Ser0UDCCR), .end = __PREG(Ser0UDCCR) + 0xffff, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_Ser0UDC, .end = IRQ_Ser0UDC, .flags = IORESOURCE_IRQ, }, }; static u64 sa11x0udc_dma_mask = 0xffffffffUL; static struct platform_device sa11x0udc_device = { .name = "sa11x0-udc", .id = -1,
} static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { .read = pxa2xx_ac97_read, .write = pxa2xx_ac97_write, .warm_reset = pxa2xx_ac97_warm_reset, .reset = pxa2xx_ac97_cold_reset, }; static struct pxad_param pxa2xx_ac97_pcm_stereo_in_req = { .prio = PXAD_PRIO_LOWEST, .drcmr = 11, }; static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_in = { .addr = __PREG(PCDR), .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, .maxburst = 32, .filter_data = &pxa2xx_ac97_pcm_stereo_in_req, }; static struct pxad_param pxa2xx_ac97_pcm_stereo_out_req = { .prio = PXAD_PRIO_LOWEST, .drcmr = 12, }; static struct snd_dmaengine_dai_dma_data pxa2xx_ac97_pcm_stereo_out = { .addr = __PREG(PCDR), .addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES, .maxburst = 32, .filter_data = &pxa2xx_ac97_pcm_stereo_out_req,
[2] = { .name = "smc91x-attrib", .start = 0x0e000000, .end = 0x0e0fffff, .flags = IORESOURCE_MEM, }, }; /* ADS7846 is connected through SSP ... and if your board has J5 populated, * you can select it to replace the ucb1400 by switching the touchscreen cable * (to J5) and poking board registers (as done below). Else it's only useful * for the temperature sensors. */ static struct resource pxa_ssp_resources[] = { [0] = { .start = __PREG(SSCR0_P(1)), .end = __PREG(SSCR0_P(1)) + 0x14, .flags = IORESOURCE_MEM, }, [1] = { .start = IRQ_SSP, .end = IRQ_SSP, .flags = IORESOURCE_IRQ, }, }; static struct pxa2xx_spi_master pxa_ssp_master_info = { .ssp_type = PXA25x_SSP, .clock_enable = CKEN_SSP, .num_chipselect = 0, };
static int pxa_irda_probe(struct platform_device *pdev) { struct net_device *dev; struct pxa_irda *si; unsigned int baudrate_mask; int err; if (!pdev->dev.platform_data) return -ENODEV; err = request_mem_region(__PREG(STUART), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; err = request_mem_region(__PREG(FICP), 0x1c, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_2; dev = alloc_irdadev(sizeof(struct pxa_irda)); if (!dev) goto err_mem_3; si = netdev_priv(dev); si->dev = &pdev->dev; si->pdata = pdev->dev.platform_data; si->sir_clk = clk_get(&pdev->dev, "UARTCLK"); si->fir_clk = clk_get(&pdev->dev, "FICPCLK"); if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) { err = PTR_ERR(IS_ERR(si->sir_clk) ? si->sir_clk : si->fir_clk); goto err_mem_4; } /* * Initialise the SIR buffers */ err = pxa_irda_init_iobuf(&si->rx_buff, 14384); if (err) goto err_mem_4; err = pxa_irda_init_iobuf(&si->tx_buff, 4000); if (err) goto err_mem_5; if (si->pdata->startup) err = si->pdata->startup(si->dev); if (err) goto err_startup; dev->hard_start_xmit = pxa_irda_hard_xmit; dev->open = pxa_irda_start; dev->stop = pxa_irda_stop; dev->do_ioctl = pxa_irda_ioctl; dev->get_stats = pxa_irda_stats; irda_init_max_qos_capabilies(&si->qos); baudrate_mask = 0; if (si->pdata->transceiver_cap & IR_SIRMODE) baudrate_mask |= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; if (si->pdata->transceiver_cap & IR_FIRMODE) baudrate_mask |= IR_4000000 << 8; si->qos.baud_rate.bits &= baudrate_mask; si->qos.min_turn_time.bits = 7; /* 1ms or more */ irda_qos_bits_to_value(&si->qos); err = register_netdev(dev); if (err == 0) dev_set_drvdata(&pdev->dev, dev); if (err) { if (si->pdata->shutdown) si->pdata->shutdown(si->dev); err_startup: kfree(si->tx_buff.head); err_mem_5: kfree(si->rx_buff.head); err_mem_4: if (si->sir_clk && !IS_ERR(si->sir_clk)) clk_put(si->sir_clk); if (si->fir_clk && !IS_ERR(si->fir_clk)) clk_put(si->fir_clk); free_netdev(dev); err_mem_3: release_mem_region(__PREG(FICP), 0x1c); err_mem_2: release_mem_region(__PREG(STUART), 0x24); } err_mem_1: return err; }
.name = "sa1100-mtd", .id = -1, }; void sa11x0_register_mtd(struct flash_platform_data *flash, struct resource *res, int nr) { flash->name = "sa1100"; sa11x0mtd_device.resource = res; sa11x0mtd_device.num_resources = nr; sa11x0_register_device(&sa11x0mtd_device, flash); } static struct resource sa11x0ir_resources[] = { { .start = __PREG(Ser2UTCR0), .end = __PREG(Ser2UTCR0) + 0x24 - 1, .flags = IORESOURCE_MEM, }, { .start = __PREG(Ser2HSCR0), .end = __PREG(Ser2HSCR0) + 0x1c - 1, .flags = IORESOURCE_MEM, }, { .start = __PREG(Ser2HSCR2), .end = __PREG(Ser2HSCR2) + 0x04 - 1, .flags = IORESOURCE_MEM, }, { .start = IRQ_Ser2ICP, .end = IRQ_Ser2ICP, .flags = IORESOURCE_IRQ, }
static int pxa250_irda_hard_xmit(struct sk_buff *skb, struct net_device *dev) { struct pxa250_irda *si = dev->priv; int speed = irda_get_next_speed(skb); int mtt; __ECHO_IN; /* * Does this packet contain a request to change the interface * speed? If so, remember it until we complete the transmission * of this frame. */ if (speed != si->speed && speed != -1) si->newspeed = speed; /* * If this is an empty frame, we can bypass a lot. */ if (skb->len == 0) { if (si->newspeed) { si->newspeed = 0; pxa250_irda_set_speed(dev, speed); } dev_kfree_skb(skb); return 0; } DBG("stop queue\n"); netif_stop_queue(dev); if(!IS_FIR(si)) { si->tx_buff.data = si->tx_buff.head; si->tx_buff.len = async_wrap_skb(skb, si->tx_buff.data, si->tx_buff.truesize); pxa250_sir_transmit(dev); dev_kfree_skb(skb); dev->trans_start = jiffies; return 0; } else /* FIR */ { DBG("Enter FIR transmit\n"); /* * We must not be transmitting... */ if (si->txskb) BUG(); disable_irq(si->fir_irq); netif_stop_queue(dev); DBG("queue stoped\n"); si->txskb = skb; /* we could not just map so we'll need some triks */ /* skb->data may be not DMA capable -Sed- */ if (skb->len > TXBUFF_MAX_SIZE) { printk (KERN_ERR "skb data too large\n"); printk (KERN_ERR "len=%d",skb->len); BUG(); } DBG("gonna copy %d bytes to txbuf\n",skb->len); memcpy (si->txbuf_dma_virt, skb->data , skb->len); /* Actual sending ;must not be receiving !!! */ /* Write data and source address */ DBG("ICSR1 & RNE =%d\n",(ICSR1 & ICSR1_RNE) ? 1 : 0 ); /*Disable receiver and enable transifer */ ICCR0 &= ~ICCR0_RXE; if (ICSR1 & ICSR1_TBY) BUG(); ICCR0 |= ICCR0_TXE; DBG("FICP status %x\n",ICSR0); if (0){ int i; DBG("sending packet\n"); for (i=0;i<skb->len;i++) (i % 64) ? printk ("%2x ",skb->data[i]) : printk ("%2x \n",skb->data[i]) ; DBG(" done\n"); } /* * If we have a mean turn-around time, impose the specified * specified delay. We could shorten this by timing from * the point we received the packet. */ mtt = irda_get_mtt(skb); if(mtt) udelay(mtt); DCSR(si->txdma_ch)=0; DCSR(si->txdma_ch)=DCSR_NODESC; DSADR(si->txdma_ch) = si->txbuf_dma; /* phisic address */ DTADR(si->txdma_ch) = __PREG(ICDR); DCMD(si->txdma_ch) = DCMD_ENDIRQEN| DCMD_INCSRCADDR | DCMD_FLOWTRG | DCMD_BURST8 | DCMD_WIDTH1 | skb->len; DCSR(si->txdma_ch) = DCSR_ENDINTR | DCSR_BUSERR; DCSR(si->txdma_ch) = DCSR_RUN | DCSR_NODESC ; DBG("FICP status %x\n",ICSR0); return 0; } }
static int pxa_irda_probe(struct platform_device *pdev) { struct net_device *dev; struct pxa_irda *si; unsigned int baudrate_mask; int err; if (!pdev->dev.platform_data) return -ENODEV; err = request_mem_region(__PREG(STUART), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; err = request_mem_region(__PREG(FICP), 0x1c, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_2; dev = alloc_irdadev(sizeof(struct pxa_irda)); if (!dev) goto err_mem_3; SET_NETDEV_DEV(dev, &pdev->dev); si = netdev_priv(dev); si->dev = &pdev->dev; si->pdata = pdev->dev.platform_data; si->sir_clk = clk_get(&pdev->dev, "UARTCLK"); si->fir_clk = clk_get(&pdev->dev, "FICPCLK"); if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) { err = PTR_ERR(IS_ERR(si->sir_clk) ? si->sir_clk : si->fir_clk); goto err_mem_4; } /* * Initialise the SIR buffers */ err = pxa_irda_init_iobuf(&si->rx_buff, 14384); if (err) goto err_mem_4; err = pxa_irda_init_iobuf(&si->tx_buff, 4000); if (err) goto err_mem_5; if (gpio_is_valid(si->pdata->gpio_pwdown)) { err = gpio_request(si->pdata->gpio_pwdown, "IrDA switch"); if (err) goto err_startup; err = gpio_direction_output(si->pdata->gpio_pwdown, !si->pdata->gpio_pwdown_inverted); if (err) { gpio_free(si->pdata->gpio_pwdown); goto err_startup; } } if (si->pdata->startup) { err = si->pdata->startup(si->dev); if (err) goto err_startup; } if (gpio_is_valid(si->pdata->gpio_pwdown) && si->pdata->startup) dev_warn(si->dev, "gpio_pwdown and startup() both defined!\n"); dev->netdev_ops = &pxa_irda_netdev_ops; irda_init_max_qos_capabilies(&si->qos); baudrate_mask = 0; if (si->pdata->transceiver_cap & IR_SIRMODE) baudrate_mask |= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; if (si->pdata->transceiver_cap & IR_FIRMODE) baudrate_mask |= IR_4000000 << 8; si->qos.baud_rate.bits &= baudrate_mask; si->qos.min_turn_time.bits = 7; /* 1ms or more */ irda_qos_bits_to_value(&si->qos); err = register_netdev(dev); if (err == 0) dev_set_drvdata(&pdev->dev, dev); if (err) { if (si->pdata->shutdown) si->pdata->shutdown(si->dev); err_startup: kfree(si->tx_buff.head); err_mem_5: kfree(si->rx_buff.head); err_mem_4: if (si->sir_clk && !IS_ERR(si->sir_clk)) clk_put(si->sir_clk); if (si->fir_clk && !IS_ERR(si->fir_clk)) clk_put(si->fir_clk); free_netdev(dev); err_mem_3: release_mem_region(__PREG(FICP), 0x1c); err_mem_2: release_mem_region(__PREG(STUART), 0x24); } err_mem_1: return err; }
if (!pxa2xx_ac97_try_cold_reset(ac97)) { pxa2xx_ac97_try_warm_reset(ac97); } pxa2xx_ac97_finish_reset(ac97); } static struct snd_ac97_bus_ops pxa2xx_ac97_ops = { .read = pxa2xx_ac97_read, .write = pxa2xx_ac97_write, .reset = pxa2xx_ac97_reset, }; static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = { .name = "AC97 PCM out", .dev_addr = __PREG(PCDR), .drcmr = &DRCMR(12), .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | DCMD_BURST32 | DCMD_WIDTH4, }; static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = { .name = "AC97 PCM in", .dev_addr = __PREG(PCDR), .drcmr = &DRCMR(11), .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | DCMD_BURST32 | DCMD_WIDTH4, }; static struct snd_pcm *pxa2xx_ac97_pcm; static struct snd_ac97 *pxa2xx_ac97_ac97;
.resource = pxafb_resources, }; void __init set_pxa_fb_info(struct pxafb_mach_info *info) { pxa_device_fb.dev.platform_data = info; } void __init set_pxa_fb_parent(struct device *parent_dev) { pxa_device_fb.dev.parent = parent_dev; } static struct resource pxa_resource_ffuart[] = { { .start = __PREG(FFUART), .end = __PREG(FFUART) + 35, .flags = IORESOURCE_MEM, }, { .start = IRQ_FFUART, .end = IRQ_FFUART, .flags = IORESOURCE_IRQ, } }; struct platform_device pxa_device_ffuart= { .name = "pxa2xx-uart", .id = 0, .resource = pxa_resource_ffuart, .num_resources = ARRAY_SIZE(pxa_resource_ffuart), };
static int serial_pxa_probe(struct platform_device *dev) { struct uart_pxa_port *sport; struct resource *mmres, *irqres; int ret; mmres = platform_get_resource(dev, IORESOURCE_MEM, 0); irqres = platform_get_resource(dev, IORESOURCE_IRQ, 0); if (!mmres || !irqres) return -ENODEV; sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL); if (!sport) return -ENOMEM; sport->clk = clk_get(&dev->dev, "UARTCLK"); if (IS_ERR(sport->clk)) { ret = PTR_ERR(sport->clk); goto err_free; } sport->port.type = PORT_PXA; sport->port.iotype = UPIO_MEM; sport->port.mapbase = mmres->start; sport->port.irq = irqres->start; sport->port.fifosize = 64; sport->port.ops = &serial_pxa_pops; sport->port.line = dev->id; sport->port.dev = &dev->dev; sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; sport->port.uartclk = clk_get_rate(sport->clk); /* * Is it worth keeping this? */ if (mmres->start == __PREG(FFUART)) sport->name = "FFUART"; else if (mmres->start == __PREG(BTUART)) sport->name = "BTUART"; else if (mmres->start == __PREG(STUART)) sport->name = "STUART"; else if (mmres->start == __PREG(HWUART)) sport->name = "HWUART"; else sport->name = "???"; sport->port.membase = ioremap(mmres->start, mmres->end - mmres->start + 1); if (!sport->port.membase) { ret = -ENOMEM; goto err_clk; } serial_pxa_ports[dev->id] = sport; uart_add_one_port(&serial_pxa_reg, &sport->port); platform_set_drvdata(dev, sport); return 0; err_clk: clk_put(sport->clk); err_free: kfree(sport); return ret; }
{ pxa2xx_ac97_try_cold_reset(ac97); pxa2xx_ac97_finish_reset(ac97); } struct snd_ac97_bus_ops soc_ac97_ops = { .read = pxa2xx_ac97_read, .write = pxa2xx_ac97_write, .warm_reset = pxa2xx_ac97_warm_reset, .reset = pxa2xx_ac97_cold_reset, }; static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_out = { .name = "AC97 PCM Stereo out", .dev_addr = __PREG(PCDR), .drcmr = &DRCMR(12), .dcmd = DCMD_INCSRCADDR | DCMD_FLOWTRG | DCMD_BURST32 | DCMD_WIDTH4, }; static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_stereo_in = { .name = "AC97 PCM Stereo in", .dev_addr = __PREG(PCDR), .drcmr = &DRCMR(11), .dcmd = DCMD_INCTRGADDR | DCMD_FLOWSRC | DCMD_BURST32 | DCMD_WIDTH4, }; static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_aux_mono_out = { .name = "AC97 Aux PCM (Slot 5) Mono out",
static int sa1100_irda_probe(struct platform_device *pdev) { struct net_device *dev; struct sa1100_irda *si; unsigned int baudrate_mask; int err; if (!pdev->dev.platform_data) return -EINVAL; err = request_mem_region(__PREG(Ser2UTCR0), 0x24, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_1; err = request_mem_region(__PREG(Ser2HSCR0), 0x1c, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_2; err = request_mem_region(__PREG(Ser2HSCR2), 0x04, "IrDA") ? 0 : -EBUSY; if (err) goto err_mem_3; dev = alloc_irdadev(sizeof(struct sa1100_irda)); if (!dev) goto err_mem_4; si = dev->priv; si->dev = &pdev->dev; si->pdata = pdev->dev.platform_data; /* * Initialise the HP-SIR buffers */ err = sa1100_irda_init_iobuf(&si->rx_buff, 14384); if (err) goto err_mem_5; err = sa1100_irda_init_iobuf(&si->tx_buff, 4000); if (err) goto err_mem_5; dev->hard_start_xmit = sa1100_irda_hard_xmit; dev->open = sa1100_irda_start; dev->stop = sa1100_irda_stop; dev->do_ioctl = sa1100_irda_ioctl; dev->get_stats = sa1100_irda_stats; dev->irq = IRQ_Ser2ICP; irda_init_max_qos_capabilies(&si->qos); /* * We support original IRDA up to 115k2. (we don't currently * support 4Mbps). Min Turn Time set to 1ms or greater. */ baudrate_mask = IR_9600; switch (max_rate) { case 4000000: baudrate_mask |= IR_4000000 << 8; case 115200: baudrate_mask |= IR_115200; case 57600: baudrate_mask |= IR_57600; case 38400: baudrate_mask |= IR_38400; case 19200: baudrate_mask |= IR_19200; } si->qos.baud_rate.bits &= baudrate_mask; si->qos.min_turn_time.bits = 7; irda_qos_bits_to_value(&si->qos); si->utcr4 = UTCR4_HPSIR; if (tx_lpm) si->utcr4 |= UTCR4_Z1_6us; /* * Initially enable HP-SIR modulation, and ensure that the port * is disabled. */ Ser2UTCR3 = 0; Ser2UTCR4 = si->utcr4; Ser2HSCR0 = HSCR0_UART; err = register_netdev(dev); if (err == 0) platform_set_drvdata(pdev, dev); if (err) { err_mem_5: kfree(si->tx_buff.head); kfree(si->rx_buff.head); free_netdev(dev); err_mem_4: release_mem_region(__PREG(Ser2HSCR2), 0x04); err_mem_3: release_mem_region(__PREG(Ser2HSCR0), 0x1c); err_mem_2: release_mem_region(__PREG(Ser2UTCR0), 0x24); } err_mem_1: return err; }
MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR; } pxa2xx_transceiver_mode(dev, mode); if (mode & IR_OFF) { MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF; } else { MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_FULL; } local_irq_restore(flags); } static struct pxaficp_platform_data mainstone_ficp_platform_data = { .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, .transceiver_mode = mainstone_irda_transceiver_mode, .uart_irq = IRQ_STUART, .uart_reg_base = __PREG(STUART), }; static struct gpio_keys_button gpio_keys_button[] = { [0] = { .desc = "wakeup", .code = KEY_SUSPEND, .type = EV_KEY, .gpio = 1, .wakeup = 1, }, }; static struct gpio_keys_platform_data mainstone_gpio_keys = { .buttons = gpio_keys_button, .nbuttons = 1,
.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, .iotype = UPIO_MEM, }, { /* COM4 */ .mapbase = 0x11800000, .irq = gpio_to_irq(ZEUS_UARTD_GPIO), .irqflags = IRQF_TRIGGER_RISING, .uartclk = 14745600, .regshift = 1, .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, .iotype = UPIO_MEM, }, /* Internal UARTs */ { /* FFUART */ .membase = (void *)&FFUART, .mapbase = __PREG(FFUART), .irq = IRQ_FFUART, .uartclk = 921600 * 16, .regshift = 2, .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, .iotype = UPIO_MEM, }, { /* BTUART */ .membase = (void *)&BTUART, .mapbase = __PREG(BTUART), .irq = IRQ_BTUART, .uartclk = 921600 * 16, .regshift = 2, .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, .iotype = UPIO_MEM, },