]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
sparc: leon3: Move snoop detection from startup.S to arch_cpu_init()
authorFrancois Retief <fgretief@spaceteq.co.za>
Wed, 28 Oct 2015 13:48:41 +0000 (15:48 +0200)
committerFrancois Retief <fgretief@spaceteq.co.za>
Thu, 3 Dec 2015 11:15:48 +0000 (13:15 +0200)
Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
arch/sparc/cpu/leon3/cpu_init.c
arch/sparc/cpu/leon3/start.S
arch/sparc/cpu/leon3/usb_uhci.c
arch/sparc/include/asm/global_data.h

index a0526cd36c5bf0a9b8aea64fcbb2bf0a424e5c42..421859e0e2c119d210dd09de15e23402324fafd0 100644 (file)
@@ -30,7 +30,6 @@ DECLARE_GLOBAL_DATA_PTR;
 ambapp_dev_irqmp *irqmp = NULL;
 ambapp_dev_gptimer *gptimer = NULL;
 unsigned int gptimer_irq = 0;
-int leon3_snooping_avail = 0;
 
 /*
  * Breath some life into the CPU...
@@ -63,12 +62,24 @@ void cpu_init_f2(void)
        ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
 }
 
+/* If cache snooping is available in hardware the result will be set
+ * to 0x800000, otherwise 0.
+ */
+static unsigned int snoop_detect(void)
+{
+       unsigned int result;
+       asm("lda [%%g0] 2, %0" : "=r"(result));
+       return result & 0x00800000;
+}
+
 int arch_cpu_init(void)
 {
        gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
        gd->bus_clk = CONFIG_SYS_CLK_FREQ;
        gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
 
+       gd->arch.snooping_available = snoop_detect();
+
        return 0;
 }
 
index fe4795cc9a16257eb1ce014697090fa6a6050906..1988ee1f6b6bf3566588f95ea040ad31fdbc0d67 100644 (file)
@@ -209,8 +209,6 @@ _trap_table:
        SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;     ! f8-fb
        SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP;     ! fc-ff
 
-       .extern leon3_snooping_avail
-
        .section        ".text"
        .extern _nomem_amba_init, _nomem_memory_ctrl_init
        .align 4
@@ -401,19 +399,6 @@ prom_relocate_loop:
        nop
        nop
 
-/* If CACHE snooping is available in hardware the
- * variable leon3_snooping_avail will be set to
- * 0x800000 else 0.
- */
-snoop_detect:
-       sethi   %hi(0x00800000), %o0
-       lda     [%g0] 2, %o1
-       and     %o0, %o1, %o0
-       sethi   %hi(leon3_snooping_avail+CONFIG_SYS_RELOC_MONITOR_BASE-CONFIG_SYS_TEXT_BASE), %o1
-       st      %o0, [%lo(leon3_snooping_avail+CONFIG_SYS_RELOC_MONITOR_BASE-CONFIG_SYS_TEXT_BASE)+%o1]
-
-/*     call    relocate*/
-       nop
 /* Call relocated init functions */
 jump:
        SPARC_LOAD_ADDRESS(cpu_init_f2, l7, o1)
index 1be84c646b8f164574cf28d005ddf9e7e5beda71..242b83fbcfa617ad30e387e95399789fa2c6aaab 100644 (file)
 #include <usb.h>
 #include "usb_uhci.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #define USB_MAX_TEMP_TD      128       /* number of temporary TDs for bulk and control transfers */
 #define USB_MAX_TEMP_INT_TD  32        /* number of temporary TDs for Interrupt transfers */
 
-extern int leon3_snooping_avail;
 /*
 #define out16r(address,data) (*(unsigned short *)(address) = \
  (unsigned short)( \
@@ -573,7 +574,7 @@ void usb_check_skel(void)
        if (qh_cntrl.dev_ptr != 0) {    /* it's a device assigned check if this caused IRQ */
                dev = (struct usb_device *)qh_cntrl.dev_ptr;
                /* Flush cache now that hardware updated DATA and TDs/QHs */
-               if (!leon3_snooping_avail)
+               if (!gd->arch.snooping_avail)
                        sparc_dcache_flush_all();
                usb_get_td_status(&tmp_td[0], dev);     /* update status */
                if (!(dev->status & USB_ST_NOT_PROC)) { /* is not active anymore, disconnect devices */
@@ -584,7 +585,7 @@ void usb_check_skel(void)
        if (qh_bulk.dev_ptr != 0) {     /* it's a device assigned check if this caused IRQ */
                dev = (struct usb_device *)qh_bulk.dev_ptr;
                /* Flush cache now that hardware updated DATA and TDs/QHs */
-               if (!leon3_snooping_avail)
+               if (!gd->arch.snooping_avail)
                        sparc_dcache_flush_all();
                usb_get_td_status(&tmp_td[0], dev);     /* update status */
                if (!(dev->status & USB_ST_NOT_PROC)) { /* is not active anymore, disconnect devices */
index 71820f095d07f96dfe11d4dee9c238e378e5b6ec..8c6557ad1f40fc62daa3660b3c96c61f0dda9586 100644 (file)
@@ -2,8 +2,8 @@
  * (C) Copyright 2002-2010
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
+ * (C) Copyright 2007, 2015
+ * Daniel Hellstrom, Cobham, Gaisler, daniel@gaisler.com.
  *
  * SPDX-License-Identifier:    GPL-2.0+
  */
@@ -17,6 +17,9 @@
 struct arch_global_data {
        void *uart;
        unsigned int uart_freq;
+#ifdef CONFIG_LEON3
+       unsigned int snooping_available;
+#endif
 };
 
 #include <asm-generic/global_data.h>