2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26 #if defined(CONFIG_SYS_L2_BAB7xx)
30 #include <asm/processor.h>
32 /* defines L2CR register for MPC750 */
34 #define L2CR_E 0x80000000
35 #define L2CR_256K 0x10000000
36 #define L2CR_512K 0x20000000
37 #define L2CR_1024K 0x30000000
38 #define L2CR_I 0x00200000
39 #define L2CR_SL 0x00008000
40 #define L2CR_IP 0x00000001
42 /*----------------------------------------------------------------------------*/
44 static int dummy (int dummy
)
49 /*----------------------------------------------------------------------------*/
51 int l2_cache_enable (int l2control
)
53 if (l2control
) /* BAB750 */
55 mtspr(SPRN_L2CR
, l2control
);
56 mtspr(SPRN_L2CR
, (l2control
| L2CR_I
));
57 while (mfspr(SPRN_L2CR
) & L2CR_IP
)
59 mtspr(SPRN_L2CR
, (l2control
| L2CR_E
));
64 int picr1
, picr2
, mask
;
65 int picr2CacheSize
, cacheSize
;
70 devbusfn
= pci_find_device(PCI_VENDOR_ID_MOTOROLA
,
71 PCI_DEVICE_ID_MOTOROLA_MPC106
, 0);
75 pci_read_config_dword (devbusfn
, PCI_PICR2
, ®32
);
76 reg32
&= ~PICR2_L2_EN
;
77 pci_write_config_dword (devbusfn
, PCI_PICR2
, reg32
);
80 if (*(volatile unsigned char *) (CONFIG_SYS_ISA_IO
+ 0x220) & 0x04)
82 /* cache size is 512 KB */
83 picr2CacheSize
= PICR2_L2_SIZE_512K
;
88 /* cache size is 256 KB */
89 picr2CacheSize
= PICR2_L2_SIZE_256K
;
95 ~(PICR1_CF_BREAD_WS(1) |
96 PICR1_CF_BREAD_WS(2) |
101 PICR1_CF_L2_CACHE_MASK
);
104 (PICR1_CF_CBA(0x3f) |
108 PICR1_CF_L2_COPY_BACK
); /* PICR1_CF_L2_WRITE_THROUGH */
110 pci_read_config_dword (devbusfn
, PCI_PICR1
, ®32
);
113 pci_write_config_dword (devbusfn
, PCI_PICR1
, reg32
);
116 * invalidate all L2 cache
122 PICR2_CF_L2_HIT_DELAY(1) |
123 PICR2_CF_APHASE_WS(1) |
126 pci_write_config_dword (devbusfn
, PCI_PICR2
, picr2
);
131 for (d
=0; d
<(int *)(2*cacheSize
); d
++)
134 pci_write_config_dword (devbusfn
, PCI_PICR2
,
135 (picr2
| PICR2_CF_FLUSH_L2
));
139 (PICR2_CF_FAST_CASTOUT
|
141 PICR2_CF_ADDR_ONLY_DISABLE
|
146 PICR2_CF_APHASE_WS(1) |
147 PICR2_CF_DATA_RAM_PBURST
|
148 PICR2_CF_L2_HIT_DELAY(1) |
149 PICR2_CF_SNOOP_WS(2) |
152 pci_write_config_dword (devbusfn
, PCI_PICR2
, picr2
);
157 /*----------------------------------------------------------------------------*/
159 #endif /* (CONFIG_SYS_L2_BAB7xx) */