Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[pandora-kernel.git] / arch / mips / txx9 / generic / setup_tx4939.c
index c2bf150..e9f95dc 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/txx9tmr.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/ndfmc.h>
+#include <asm/txx9/dmac.h>
 #include <asm/txx9/tx4939.h>
 
 static void __init tx4939_wdr_init(void)
@@ -259,11 +260,6 @@ void __init tx4939_setup(void)
        for (i = 0; i < TX4939_NR_TMR; i++)
                txx9_tmr_init(TX4939_TMR_REG(i) & 0xfffffffffULL);
 
-       /* DMA */
-       for (i = 0; i < 2; i++)
-               ____raw_writeq(TX4938_DMA_MCR_MSTEN,
-                              (void __iomem *)(TX4939_DMA_REG(i) + 0x50));
-
        /* set PCIC1 reset (required to prevent hangup on BIST) */
        txx9_set64(&tx4939_ccfgptr->clkctr, TX4939_CLKCTR_PCI1RST);
        pcfg = ____raw_readq(&tx4939_ccfgptr->pcfg);
@@ -322,19 +318,15 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
 }
 
 #if defined(CONFIG_TC35815) || defined(CONFIG_TC35815_MODULE)
-static int tx4939_get_eth_speed(struct net_device *dev)
+static u32 tx4939_get_eth_speed(struct net_device *dev)
 {
-       struct ethtool_cmd cmd = { ETHTOOL_GSET };
-       int speed = 100;        /* default 100Mbps */
-       int err;
-       if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
-               return speed;
-       err = dev->ethtool_ops->get_settings(dev, &cmd);
-       if (err < 0)
-               return speed;
-       speed = cmd.speed == SPEED_100 ? 100 : 10;
-       return speed;
+       struct ethtool_cmd cmd;
+       if (dev_ethtool_get_settings(dev, &cmd))
+               return 100;     /* default 100Mbps */
+
+       return ethtool_cmd_speed(&cmd);
 }
+
 static int tx4939_netdev_event(struct notifier_block *this,
                               unsigned long event,
                               void *ptr)
@@ -347,8 +339,7 @@ static int tx4939_netdev_event(struct notifier_block *this,
                else if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(1))
                        bit = TX4939_PCFG_SPEED1;
                if (bit) {
-                       int speed = tx4939_get_eth_speed(dev);
-                       if (speed == 100)
+                       if (tx4939_get_eth_speed(dev) == 100)
                                txx9_set64(&tx4939_ccfgptr->pcfg, bit);
                        else
                                txx9_clear64(&tx4939_ccfgptr->pcfg, bit);
@@ -474,6 +465,53 @@ void __init tx4939_ndfmc_init(unsigned int hold, unsigned int spw,
        txx9_ndfmc_init(TX4939_NDFMC_REG & 0xfffffffffULL, &plat_data);
 }
 
+void __init tx4939_dmac_init(int memcpy_chan0, int memcpy_chan1)
+{
+       struct txx9dmac_platform_data plat_data = {
+               .have_64bit_regs = true,
+       };
+       int i;
+
+       for (i = 0; i < 2; i++) {
+               plat_data.memcpy_chan = i ? memcpy_chan1 : memcpy_chan0;
+               txx9_dmac_init(i, TX4939_DMA_REG(i) & 0xfffffffffULL,
+                              TXX9_IRQ_BASE + TX4939_IR_DMA(i, 0),
+                              &plat_data);
+       }
+}
+
+void __init tx4939_aclc_init(void)
+{
+       u64 pcfg = __raw_readq(&tx4939_ccfgptr->pcfg);
+
+       if ((pcfg & TX4939_PCFG_I2SMODE_MASK) == TX4939_PCFG_I2SMODE_ACLC)
+               txx9_aclc_init(TX4939_ACLC_REG & 0xfffffffffULL,
+                              TXX9_IRQ_BASE + TX4939_IR_ACLC, 1, 0, 1);
+}
+
+void __init tx4939_sramc_init(void)
+{
+       if (tx4939_sram_resource.start)
+               txx9_sramc_init(&tx4939_sram_resource);
+}
+
+void __init tx4939_rng_init(void)
+{
+       static struct resource res = {
+               .start = TX4939_RNG_REG & 0xfffffffffULL,
+               .end = (TX4939_RNG_REG & 0xfffffffffULL) + 0x30 - 1,
+               .flags = IORESOURCE_MEM,
+       };
+       static struct platform_device pdev = {
+               .name = "tx4939-rng",
+               .id = -1,
+               .num_resources = 1,
+               .resource = &res,
+       };
+
+       platform_device_register(&pdev);
+}
+
 static void __init tx4939_stop_unused_modules(void)
 {
        __u64 pcfg, rst = 0, ckd = 0;