Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / sparc / kernel / pcic.c
index bfd31aac2df3b2c7992f082fd08b9f5ba78da4c2..5ca7e8f42bd9712a37b54ceca8f6943ef33d9962 100644 (file)
 #include <asm/pcic.h>
 #include <asm/timer.h>
 #include <asm/uaccess.h>
+#include <asm/irq_regs.h>
 
 
-unsigned int pcic_pin_to_irq(unsigned int pin, char *name);
-
 /*
  * I studied different documents and many live PROMs both from 2.30
  * family and 3.xx versions. I came to the amazing conclusion: there is
@@ -600,7 +599,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 /*
  * Normally called from {do_}pci_scan_bus...
  */
-void __init pcibios_fixup_bus(struct pci_bus *bus)
+void __devinit pcibios_fixup_bus(struct pci_bus *bus)
 {
        struct pci_dev *dev;
        int i, has_io, has_mem;
@@ -680,7 +679,7 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
  * pcic_pin_to_irq() is exported to ebus.c.
  */
 unsigned int
-pcic_pin_to_irq(unsigned int pin, char *name)
+pcic_pin_to_irq(unsigned int pin, const char *name)
 {
        struct linux_pcic *pcic = &pcic0;
        unsigned int irq;
@@ -708,13 +707,13 @@ static void pcic_clear_clock_irq(void)
        pcic_timer_dummy = readl(pcic0.pcic_regs+PCI_SYS_LIMIT);
 }
 
-static irqreturn_t pcic_timer_handler (int irq, void *h, struct pt_regs *regs)
+static irqreturn_t pcic_timer_handler (int irq, void *h)
 {
        write_seqlock(&xtime_lock);     /* Dummy, to show that we remember */
        pcic_clear_clock_irq();
-       do_timer(regs);
+       do_timer(1);
 #ifndef CONFIG_SMP
-       update_process_times(user_mode(regs));
+       update_process_times(user_mode(get_irq_regs()));
 #endif
        write_sequnlock(&xtime_lock);
        return IRQ_HANDLED;
@@ -765,8 +764,6 @@ static __inline__ unsigned long do_gettimeoffset(void)
        return count;
 }
 
-extern unsigned long wall_jiffies;
-
 static void pci_do_gettimeofday(struct timeval *tv)
 {
        unsigned long flags;
@@ -775,26 +772,17 @@ static void pci_do_gettimeofday(struct timeval *tv)
        unsigned long max_ntp_tick = tick_usec - tickadj;
 
        do {
-               unsigned long lost;
-
                seq = read_seqbegin_irqsave(&xtime_lock, flags);
                usec = do_gettimeoffset();
-               lost = jiffies - wall_jiffies;
 
                /*
                 * If time_adjust is negative then NTP is slowing the clock
                 * so make sure not to go into next possible interval.
                 * Better to lose some accuracy than have time go backwards..
                 */
-               if (unlikely(time_adjust < 0)) {
+               if (unlikely(time_adjust < 0))
                        usec = min(usec, max_ntp_tick);
 
-                       if (lost)
-                               usec += lost * max_ntp_tick;
-               }
-               else if (unlikely(lost))
-                       usec += lost * tick_usec;
-
                sec = xtime.tv_sec;
                usec += (xtime.tv_nsec / 1000);
        } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
@@ -819,8 +807,7 @@ static int pci_do_settimeofday(struct timespec *tv)
         * wall time.  Discover what correction gettimeofday() would have
         * made, and then undo it!
         */
-       tv->tv_nsec -= 1000 * (do_gettimeoffset() + 
-                               (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ));
+       tv->tv_nsec -= 1000 * do_gettimeoffset();
        while (tv->tv_nsec < 0) {
                tv->tv_nsec += NSEC_PER_SEC;
                tv->tv_sec--;
@@ -853,7 +840,7 @@ static void watchdog_reset() {
 /*
  * Other archs parse arguments here.
  */
-char * __init pcibios_setup(char *str)
+char * __devinit pcibios_setup(char *str)
 {
        return str;
 }
@@ -955,6 +942,14 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource)
        return -ENXIO;
 }
 
+struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
+{
+       struct pcidev_cookie *pc = pdev->sysdata;
+
+       return pc->prom_node;
+}
+EXPORT_SYMBOL(pci_device_to_OF_node);
+
 /*
  * This probably belongs here rather than ioport.c because
  * we do not want this crud linked into SBus kernels.