[PATCH 2/9] SPEAr13xx: Add source files
Arnd Bergmann
arnd at arndb.de
Fri Apr 20 14:15:57 EDT 2012
On Friday 20 April 2012, Viresh Kumar wrote:
> +static struct dw_dma_slave uart1_dma_param[] = {
> + {
> + /* Tx */
> + .cfg_hi = DWC_CFGH_DST_PER(SPEAR1340_DMA_REQ_UART1_TX),
> + .cfg_lo = 0,
> + .src_master = DMA_MASTER_MEMORY,
> + .dst_master = SPEAR1340_DMA_MASTER_UART1,
> + }, {
> + /* Rx */
> + .cfg_hi = DWC_CFGH_SRC_PER(SPEAR1340_DMA_REQ_UART1_RX),
> + .cfg_lo = 0,
> + .src_master = SPEAR1340_DMA_MASTER_UART1,
> + .dst_master = DMA_MASTER_MEMORY,
> + }
> +};
> +
> +static struct amba_pl011_data uart1_data = {
> + .dma_filter = dw_dma_filter,
> + .dma_tx_param = &uart1_dma_param[0],
> + .dma_rx_param = &uart1_dma_param[1],
> +};
Again, I hope that we can remove this eventually when we have the DMA bindings,
but it's ok for now.
> +/* SATA device registration */
> +static int sata_miphy_init(struct device *dev, void __iomem *addr)
> +{
> + writel(SPEAR1340_SATA_CFG_VAL, SPEAR1340_PCIE_SATA_CFG);
> + writel(SPEAR1340_PCIE_SATA_MIPHY_CFG_SATA_25M_CRYSTAL_CLK,
> + SPEAR1340_PCIE_MIPHY_CFG);
> + /* Switch on sata power domain */
> + writel((readl(SPEAR1340_PCM_CFG) | (0x800)), SPEAR1340_PCM_CFG);
> + msleep(20);
> + /* Disable PCIE SATA Controller reset */
> + writel((readl(SPEAR1340_PERIP1_SW_RST) & (~0x1000)),
> + SPEAR1340_PERIP1_SW_RST);
> + msleep(20);
> +
> + return 0;
> +}
> +
> +void sata_miphy_exit(struct device *dev)
> +{
> + writel(0, SPEAR1340_PCIE_SATA_CFG);
> + writel(0, SPEAR1340_PCIE_MIPHY_CFG);
> +
> + /* Enable PCIE SATA Controller reset */
> + writel((readl(SPEAR1340_PERIP1_SW_RST) | (0x1000)),
> + SPEAR1340_PERIP1_SW_RST);
> + msleep(20);
> + /* Switch off sata power domain */
> + writel((readl(SPEAR1340_PCM_CFG) & (~0x800)), SPEAR1340_PCM_CFG);
> + msleep(20);
> +}
> +
> +int sata_suspend(struct device *dev)
> +{
> + if (dev->power.power_state.event == PM_EVENT_FREEZE)
> + return 0;
> +
> + sata_miphy_exit(dev);
> +
> + return 0;
> +}
I'd like to see this done differently, with a ahci_spear driver derived from
ahci_platform that provides these functions in a modular driver that registers
to a spear specific identifier string and is able to do the platform specific
based on information it can find in the device tree. That would however require
changes to the existing ahci_platform code and I'd first like to hear what
Jeff and others have to say about this.
Arnd
More information about the linux-arm-kernel
mailing list