Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/broadcom For the AMACs, turn off read-allocate/...



details:   https://anonhg.NetBSD.org/src/rev/affaa99da323
branches:  trunk
changeset: 782283:affaa99da323
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Oct 26 04:46:06 2012 +0000

description:
For the AMACs, turn off read-allocate/write-allocate when doing DMA.

diffstat:

 sys/arch/arm/broadcom/bcm53xx_idm.c |  25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 9f7c852a66bd -r affaa99da323 sys/arch/arm/broadcom/bcm53xx_idm.c
--- a/sys/arch/arm/broadcom/bcm53xx_idm.c       Fri Oct 26 04:45:36 2012 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_idm.c       Fri Oct 26 04:46:06 2012 +0000
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_idm.c,v 1.1 2012/09/01 00:04:44 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_idm.c,v 1.2 2012/10/26 04:46:06 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -64,15 +64,28 @@
         * To enable any GMAC, we must enable all off them.
         */
        static const bus_size_t regoff[] = {
-               IDM_BASE + IDM_AMAC0_BASE + IDM_RESET_CONTROL,
-               IDM_BASE + IDM_AMAC1_BASE + IDM_RESET_CONTROL,
-               IDM_BASE + IDM_AMAC2_BASE + IDM_RESET_CONTROL,
-               IDM_BASE + IDM_AMAC3_BASE + IDM_RESET_CONTROL,
+               IDM_BASE + IDM_AMAC0_BASE,
+               IDM_BASE + IDM_AMAC1_BASE,
+               IDM_BASE + IDM_AMAC2_BASE,
+               IDM_BASE + IDM_AMAC3_BASE,
        };
        static bool bcmeth_init_done;
        if (!bcmeth_init_done) {
                for (size_t idx = 0; idx < __arraycount(regoff); idx++) {
-                       bus_space_write_4(bst, bsh, regoff[idx], 0);
+                       const bus_size_t off = regoff[idx];
+                       bus_space_write_4(bst, bsh, off + IDM_RESET_CONTROL, 0);
+                       uint32_t v = bus_space_read_4(bst, bsh,
+                           off + IDM_IO_CONTROL_DIRECT);
+                       /*
+                        * Clear read-allocate and write-allocate bits from
+                        * ACP cache access so we don't pollute the caches.
+                        */
+                       v &= ~IO_CONTROL_DIRECT_ARCACHE;
+                       v &= ~IO_CONTROL_DIRECT_AWCACHE;
+                       v |= __SHIFTIN(AXCACHE_C|AXCACHE_B, IO_CONTROL_DIRECT_ARCACHE);
+                       v |= __SHIFTIN(AXCACHE_C|AXCACHE_B, IO_CONTROL_DIRECT_AWCACHE);
+                       bus_space_write_4(bst, bsh, off + IDM_IO_CONTROL_DIRECT,
+                           v);
                }
                bcmeth_init_done = true;
        }



Home | Main Index | Thread Index | Old Index