Merge branch 'davinci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / sh / drivers / pci / pci-sh7751.c
index 70c1999..17811e5 100644 (file)
@@ -44,25 +44,25 @@ static int __init __area_sdram_check(struct pci_channel *chan,
        return 1;
 }
 
-static struct resource sh7751_io_resource = {
-       .name   = "SH7751_IO",
-       .start  = SH7751_PCI_IO_BASE,
-       .end    = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
-       .flags  = IORESOURCE_IO
-};
-
-static struct resource sh7751_mem_resource = {
-       .name   = "SH7751_mem",
-       .start  = SH7751_PCI_MEMORY_BASE,
-       .end    = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
-       .flags  = IORESOURCE_MEM
+static struct resource sh7751_pci_resources[] = {
+       {
+               .name   = "SH7751_IO",
+               .start  = SH7751_PCI_IO_BASE,
+               .end    = SH7751_PCI_IO_BASE + SH7751_PCI_IO_SIZE - 1,
+               .flags  = IORESOURCE_IO
+       }, {
+               .name   = "SH7751_mem",
+               .start  = SH7751_PCI_MEMORY_BASE,
+               .end    = SH7751_PCI_MEMORY_BASE + SH7751_PCI_MEM_SIZE - 1,
+               .flags  = IORESOURCE_MEM
+       },
 };
 
 static struct pci_channel sh7751_pci_controller = {
        .pci_ops        = &sh4_pci_ops,
-       .mem_resource   = &sh7751_mem_resource,
+       .resources      = sh7751_pci_resources,
+       .nr_resources   = ARRAY_SIZE(sh7751_pci_resources),
        .mem_offset     = 0x00000000,
-       .io_resource    = &sh7751_io_resource,
        .io_offset      = 0x00000000,
        .io_map_base    = SH7751_PCI_IO_BASE,
 };
@@ -79,7 +79,6 @@ static int __init sh7751_pci_init(void)
        struct pci_channel *chan = &sh7751_pci_controller;
        unsigned int id;
        u32 word, reg;
-       int ret;
 
        printk(KERN_NOTICE "PCI: Starting intialization.\n");
 
@@ -93,13 +92,10 @@ static int __init sh7751_pci_init(void)
                return -ENODEV;
        }
 
-       if ((ret = sh4_pci_check_direct(chan)) != 0)
-               return ret;
-
        /* Set the BCR's to enable PCI access */
-       reg = ctrl_inl(SH7751_BCR1);
+       reg = __raw_readl(SH7751_BCR1);
        reg |= 0x80000;
-       ctrl_outl(reg, SH7751_BCR1);
+       __raw_writel(reg, SH7751_BCR1);
 
        /* Turn the clocks back on (not done in reset)*/
        pci_write_reg(chan, 0, SH4_PCICLKR);
@@ -132,13 +128,13 @@ static int __init sh7751_pci_init(void)
        /* Set the local 16MB PCI memory space window to
         * the lowest PCI mapped address
         */
-       word = chan->mem_resource->start & SH4_PCIMBR_MASK;
+       word = chan->resources[1].start & SH4_PCIMBR_MASK;
        pr_debug("PCI: Setting upper bits of Memory window to 0x%x\n", word);
        pci_write_reg(chan, word , SH4_PCIMBR);
 
        /* Make sure the MSB's of IO window are set to access PCI space
         * correctly */
-       word = chan->io_resource->start & SH4_PCIIOBR_MASK;
+       word = chan->resources[0].start & SH4_PCIIOBR_MASK;
        pr_debug("PCI: Setting upper bits of IO window to 0x%x\n", word);
        pci_write_reg(chan, word, SH4_PCIIOBR);
 
@@ -159,13 +155,13 @@ static int __init sh7751_pci_init(void)
                return -1;
 
        /* configure the wait control registers */
-       word = ctrl_inl(SH7751_WCR1);
+       word = __raw_readl(SH7751_WCR1);
        pci_write_reg(chan, word, SH4_PCIWCR1);
-       word = ctrl_inl(SH7751_WCR2);
+       word = __raw_readl(SH7751_WCR2);
        pci_write_reg(chan, word, SH4_PCIWCR2);
-       word = ctrl_inl(SH7751_WCR3);
+       word = __raw_readl(SH7751_WCR3);
        pci_write_reg(chan, word, SH4_PCIWCR3);
-       word = ctrl_inl(SH7751_MCR);
+       word = __raw_readl(SH7751_MCR);
        pci_write_reg(chan, word, SH4_PCIMCR);
 
        /* NOTE: I'm ignoring the PCI error IRQs for now..
@@ -180,8 +176,6 @@ static int __init sh7751_pci_init(void)
        word = SH4_PCICR_PREFIX | SH4_PCICR_CFIN | SH4_PCICR_ARBM;
        pci_write_reg(chan, word, SH4_PCICR);
 
-       register_pci_controller(chan);
-
-       return 0;
+       return register_pci_controller(chan);
 }
 arch_initcall(sh7751_pci_init);