update bcm963xx patch and add some binary compatibility hacks (incomplete)
[openwrt.git] / target / linux / brcm63xx-2.6 / patches / 001-bcm963xx.patch
1 diff -urN linux.old/arch/mips/bcm963xx/bcm63xx_led.c linux.dev/arch/mips/bcm963xx/bcm63xx_led.c
2 --- linux.old/arch/mips/bcm963xx/bcm63xx_led.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux.dev/arch/mips/bcm963xx/bcm63xx_led.c 2006-08-25 00:39:38.000000000 +0200
4 @@ -0,0 +1,582 @@
5 +/*
6 +<:copyright-gpl
7 + Copyright 2002 Broadcom Corp. All Rights Reserved.
8 +
9 + This program is free software; you can distribute it and/or modify it
10 + under the terms of the GNU General Public License (Version 2) as
11 + published by the Free Software Foundation.
12 +
13 + This program is distributed in the hope it will be useful, but WITHOUT
14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 + for more details.
17 +
18 + You should have received a copy of the GNU General Public License along
19 + with this program; if not, write to the Free Software Foundation, Inc.,
20 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
21 +:>
22 +*/
23 +/***************************************************************************
24 + * File Name : bcm63xx_led.c
25 + *
26 + * Description:
27 + *
28 + * This file contains bcm963xx board led control API functions.
29 + *
30 + * To use it, do the following
31 + *
32 + * 1). define in the board.c the following led mappping (this is for 6345GW board):
33 + * const LED_MAP_PAIR cLedMapping45GW[] =
34 + * { // led name Initial state physical pin (ledMask)
35 + * {kLedUsb, kLedStateOff, GPIO_LED_PIN_7},
36 + * {kLedAdsl, kLedStateOff, GPIO_LED_PIN_8},
37 + * {kLedPPP, kLedStateOff, GPIO_LED_PIN_9}, // PPP and WanData share PIN_9
38 + * {kLedWanData, kLedStateOff, GPIO_LED_PIN_9},
39 + * {kLedWireless, kLedStateOff, GPIO_LED_PIN_10},
40 + * {kLedEnd, kLedStateOff, 0 } // NOTE: kLedEnd has to be at the end.
41 + *
42 + * 2). };To initialize led API and initial state of the leds, call the following function with the mapping
43 + * pointer from the above struct
44 + *
45 + * boardLedInit((PLED_MAP_PAIR) &cLedMapping45R);
46 + *
47 + * 3). Sample call for kernel mode:
48 + *
49 + * kerSysLedCtrl(kLedAdsl, kLedStateBlinkOnce); // kLedxxx defines in board.h
50 + *
51 + * 4). Sample call for user mode
52 + *
53 + * sysLedCtrl(kLedAdsl, kLedStateBlinkOnce); // kLedxxx defines in board_api.h
54 + *
55 + *
56 + * Created on : 10/28/2002 seanl
57 + *
58 + ***************************************************************************/
59 +
60 +/* Includes. */
61 +#include <linux/init.h>
62 +#include <linux/fs.h>
63 +#include <linux/capability.h>
64 +#include <linux/slab.h>
65 +#include <linux/errno.h>
66 +#include <linux/module.h>
67 +#include <linux/netdevice.h>
68 +#include <asm/uaccess.h>
69 +
70 +#include <bcm_map_part.h>
71 +#include <board.h>
72 +
73 +#define k100ms (HZ / 10) // ~100 ms
74 +#define kFastBlinkCount 0 // ~100ms
75 +#define kSlowBlinkCount 5 // ~600ms
76 +
77 +#define MAX_VIRT_LEDS 12
78 +
79 +// uncomment // for debug led
80 +//#define DEBUG_LED
81 +
82 +// global variables:
83 +struct timer_list gLedTimer;
84 +int gTimerOn = FALSE;
85 +int gLedCount = 0;
86 +
87 +typedef struct ledinfo
88 +{
89 + unsigned short ledMask; // mask for led: ie. giop 10 = 0x0400
90 + unsigned short ledActiveLow; // GPIO bit reset to turn on LED
91 + unsigned short ledMaskFail; // mask for led: ie. giop 10 = 0x0400
92 + unsigned short ledActiveLowFail;// GPIO bit reset to turn on LED
93 + BOARD_LED_STATE ledState; // current led state
94 + BOARD_LED_STATE savedLedState; // used in blink once for restore to the orignal ledState
95 + int blinkCountDown; // if == 0, do blink (toggle). Is assgined value and dec by 1 at each timer.
96 +} LED_INFO, *PLED_INFO;
97 +
98 +static PLED_INFO gLed = NULL;
99 +static PLED_INFO gpVirtLeds[MAX_VIRT_LEDS];
100 +static HANDLE_LED_FUNC gLedHwFunc[MAX_VIRT_LEDS];
101 +static HANDLE_LED_FUNC gLedHwFailFunc[MAX_VIRT_LEDS];
102 +
103 +#if 0 /* BROKEN */
104 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
105 +static int gLedOffInBridgeMode = 1;
106 +#elif defined(CONFIG_BCM96345)
107 +static int gLedOffInBridgeMode = 0;
108 +#endif
109 +#endif
110 +
111 +void ledTimerExpire(void);
112 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed );
113 +
114 +//**************************************************************************************
115 +// LED operations
116 +//**************************************************************************************
117 +
118 +// turn led on and set the ledState
119 +void ledOn(PLED_INFO pLed)
120 +{
121 + if( pLed->ledMask )
122 + {
123 + GPIO->GPIODir |= pLed->ledMask; // turn on the direction bit in case was turned off by some one
124 + if( pLed->ledActiveLow )
125 + GPIO->GPIOio &= ~pLed->ledMask; // turn on the led
126 + else
127 + GPIO->GPIOio |= pLed->ledMask; // turn on the led
128 + pLed->ledState = pLed->savedLedState = kLedStateOn;
129 + }
130 +}
131 +
132 +
133 +// turn led off and set the ledState
134 +void ledOff(PLED_INFO pLed)
135 +{
136 + if( pLed->ledMask )
137 + {
138 + GPIO->GPIODir |= pLed->ledMask; // turn on the direction bit in case was turned off by some one
139 + if( pLed->ledActiveLow )
140 + GPIO->GPIOio |= pLed->ledMask; // turn off the led
141 + else
142 + GPIO->GPIOio &= ~pLed->ledMask; // turn off the led
143 + pLed->ledState = pLed->savedLedState = kLedStateOff;
144 + }
145 +}
146 +
147 +// turn led on and set the ledState
148 +void ledOnFail(PLED_INFO pLed)
149 +{
150 + if( pLed->ledMaskFail )
151 + {
152 + GPIO->GPIODir |= pLed->ledMaskFail; // turn on the direction bit in case was turned off by some one
153 + if( pLed->ledActiveLowFail )
154 + GPIO->GPIOio &= ~pLed->ledMaskFail;// turn on the led
155 + else
156 + GPIO->GPIOio |= pLed->ledMaskFail; // turn on the led
157 + pLed->ledState = pLed->savedLedState = kLedStateFail;
158 + }
159 +}
160 +
161 +
162 +// turn led off and set the ledState
163 +void ledOffFail(PLED_INFO pLed)
164 +{
165 + if( pLed->ledMaskFail )
166 + {
167 + GPIO->GPIODir |= pLed->ledMaskFail; // turn on the direction bit in case was turned off by some one
168 + if( pLed->ledActiveLowFail )
169 + GPIO->GPIOio |= pLed->ledMaskFail; // turn off the led
170 + else
171 + GPIO->GPIOio &= ~pLed->ledMaskFail;// turn off the led
172 + pLed->ledState = pLed->savedLedState = kLedStateOff;
173 + }
174 +}
175 +
176 +
177 +// toggle the led and return the current ledState
178 +BOARD_LED_STATE ledToggle(PLED_INFO pLed)
179 +{
180 + GPIO->GPIODir |= pLed->ledMask; // turn on the direction bit in case was turned off by some one
181 + if (GPIO->GPIOio & pLed->ledMask)
182 + {
183 + GPIO->GPIOio &= ~(pLed->ledMask);
184 + return( (pLed->ledActiveLow) ? kLedStateOn : kLedStateOff );
185 + }
186 + else
187 + {
188 + GPIO->GPIOio |= pLed->ledMask;
189 + return( (pLed->ledActiveLow) ? kLedStateOff : kLedStateOn );
190 + }
191 +}
192 +
193 +
194 +// led timer. Will return if timer is already on
195 +void ledTimerStart(void)
196 +{
197 + if (gTimerOn)
198 + return;
199 +
200 +#if defined(DEBUG_LED)
201 + printk("led: add_timer\n");
202 +#endif
203 +
204 + init_timer(&gLedTimer);
205 + gLedTimer.function = (void*)ledTimerExpire;
206 + gLedTimer.expires = jiffies + k100ms; // timer expires in ~100ms
207 + add_timer (&gLedTimer);
208 + gTimerOn = TRUE;
209 +}
210 +
211 +
212 +// led timer expire kicks in about ~100ms and perform the led operation according to the ledState and
213 +// restart the timer according to ledState
214 +void ledTimerExpire(void)
215 +{
216 + int i;
217 + PLED_INFO pCurLed;
218 +
219 + gTimerOn = FALSE;
220 +
221 + for (i = 0, pCurLed = gLed; i < gLedCount; i++, pCurLed++)
222 + {
223 +#if defined(DEBUG_LED)
224 + printk("led[%d]: Mask=0x%04x, State = %d, blcd=%d\n", i, pCurLed->ledMask, pCurLed->ledState, pCurLed->blinkCountDown);
225 +#endif
226 + switch (pCurLed->ledState)
227 + {
228 + case kLedStateOn:
229 + case kLedStateOff:
230 + case kLedStateFail:
231 + pCurLed->blinkCountDown = 0; // reset the blink count down
232 + break;
233 +
234 + case kLedStateBlinkOnce:
235 + ledToggle(pCurLed);
236 + pCurLed->blinkCountDown = 0; // reset to 0
237 + pCurLed->ledState = pCurLed->savedLedState;
238 + if (pCurLed->ledState == kLedStateSlowBlinkContinues ||
239 + pCurLed->ledState == kLedStateFastBlinkContinues)
240 + ledTimerStart(); // start timer if in blinkContinues stats
241 + break;
242 +
243 + case kLedStateSlowBlinkContinues:
244 + if (pCurLed->blinkCountDown-- == 0)
245 + {
246 + pCurLed->blinkCountDown = kSlowBlinkCount;
247 + ledToggle(pCurLed);
248 + }
249 + ledTimerStart();
250 + break;
251 +
252 + case kLedStateFastBlinkContinues:
253 + if (pCurLed->blinkCountDown-- == 0)
254 + {
255 + pCurLed->blinkCountDown = kFastBlinkCount;
256 + ledToggle(pCurLed);
257 + }
258 + ledTimerStart();
259 + break;
260 +
261 + default:
262 + printk("Invalid state = %d\n", pCurLed->ledState);
263 + }
264 + }
265 +}
266 +
267 +// initialize the gLedCount and allocate and fill gLed struct
268 +void __init boardLedInit(PLED_MAP_PAIR cLedMapping)
269 +{
270 + PLED_MAP_PAIR p1, p2;
271 + PLED_INFO pCurLed;
272 + int needTimer = FALSE;
273 + int alreadyUsed = 0;
274 +
275 +#if defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
276 + /* Set blink rate for BCM6348/BCM6338 hardware LEDs. */
277 + GPIO->LEDCtrl &= ~LED_INTERVAL_SET_MASK;
278 + GPIO->LEDCtrl |= LED_INTERVAL_SET_80MS;
279 +#endif
280 +
281 + memset( gpVirtLeds, 0x00, sizeof(gpVirtLeds) );
282 + memset( gLedHwFunc, 0x00, sizeof(gLedHwFunc) );
283 + memset( gLedHwFailFunc, 0x00, sizeof(gLedHwFailFunc) );
284 +
285 + gLedCount = 0;
286 +
287 + // Check for multiple LED names and multiple LED GPIO pins that share the
288 + // same physical board LED.
289 + for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
290 + {
291 + alreadyUsed = 0;
292 + for( p2 = cLedMapping; p2 != p1; p2++ )
293 + {
294 + if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
295 + (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
296 + {
297 + alreadyUsed = 1;
298 + break;
299 + }
300 + }
301 +
302 + if( alreadyUsed == 0 )
303 + gLedCount++;
304 + }
305 +
306 + gLed = (PLED_INFO) kmalloc((gLedCount * sizeof(LED_INFO)), GFP_KERNEL);
307 + if( gLed == NULL )
308 + {
309 + printk( "LED memory allocation error.\n" );
310 + return;
311 + }
312 +
313 + memset( gLed, 0x00, gLedCount * sizeof(LED_INFO) );
314 +
315 + // initial the gLed with unique ledMask and initial state. If more than 1 ledNames share the physical led
316 + // (ledMask) the first defined led's ledInitState will be used.
317 + pCurLed = gLed;
318 + for( p1 = cLedMapping; p1->ledName != kLedEnd; p1++ )
319 + {
320 + if( (int) p1->ledName > MAX_VIRT_LEDS )
321 + continue;
322 +
323 + alreadyUsed = 0;
324 + for( p2 = cLedMapping; p2 != p1; p2++ )
325 + {
326 + if( (p1->ledMask && p1->ledMask == p2->ledMask) ||
327 + (p1->ledMaskFail && p1->ledMaskFail == p2->ledMaskFail) )
328 + {
329 + alreadyUsed = 1;
330 + break;
331 + }
332 + }
333 +
334 + if( alreadyUsed == 0 )
335 + {
336 + // Initialize the board LED for the first time.
337 + needTimer = initLedInfo( p1, pCurLed );
338 + gpVirtLeds[(int) p1->ledName] = pCurLed;
339 + pCurLed++;
340 + }
341 + else
342 + {
343 + PLED_INFO pLed;
344 + for( pLed = gLed; pLed != pCurLed; pLed++ )
345 + {
346 + // Find the LED_INFO structure that has already been initialized.
347 + if((pLed->ledMask && pLed->ledMask == p1->ledMask) ||
348 + (pLed->ledMaskFail && pLed->ledMaskFail==p1->ledMaskFail))
349 + {
350 + // The board LED has already been initialized but possibly
351 + // not completely initialized.
352 + if( p1->ledMask )
353 + {
354 + pLed->ledMask = p1->ledMask;
355 + pLed->ledActiveLow = p1->ledActiveLow;
356 + }
357 + if( p1->ledMaskFail )
358 + {
359 + pLed->ledMaskFail = p1->ledMaskFail;
360 + pLed->ledActiveLowFail = p1->ledActiveLowFail;
361 + }
362 + gpVirtLeds[(int) p1->ledName] = pLed;
363 + break;
364 + }
365 + }
366 + }
367 + }
368 +
369 + if (needTimer)
370 + ledTimerStart();
371 +
372 +#if defined(DEBUG_LED)
373 + int i;
374 + for (i=0; i < gLedCount; i++)
375 + printk("initLed: led[%d]: mask=0x%04x, state=%d\n", i,(gLed+i)->ledMask, (gLed+i)->ledState);
376 +#endif
377 +
378 +}
379 +
380 +// Initialize a structure that contains information about a physical board LED
381 +// control. The board LED may contain more than one GPIO pin to control a
382 +// normal condition (green) or a failure condition (red).
383 +int initLedInfo( PLED_MAP_PAIR pCurMap, PLED_INFO pCurLed )
384 +{
385 + int needTimer = FALSE;
386 + pCurLed->ledState = pCurLed->savedLedState = pCurMap->ledInitState;
387 + pCurLed->ledMask = pCurMap->ledMask;
388 + pCurLed->ledActiveLow = pCurMap->ledActiveLow;
389 + pCurLed->ledMaskFail = pCurMap->ledMaskFail;
390 + pCurLed->ledActiveLowFail = pCurMap->ledActiveLowFail;
391 +
392 + switch (pCurLed->ledState)
393 + {
394 + case kLedStateOn:
395 + pCurLed->blinkCountDown = 0; // reset the blink count down
396 + ledOn(pCurLed);
397 + break;
398 + case kLedStateOff:
399 + pCurLed->blinkCountDown = 0; // reset the blink count down
400 + ledOff(pCurLed);
401 + break;
402 + case kLedStateFail:
403 + pCurLed->blinkCountDown = 0; // reset the blink count down
404 + ledOnFail(pCurLed);
405 + break;
406 + case kLedStateBlinkOnce:
407 + pCurLed->blinkCountDown = 1;
408 + needTimer = TRUE;
409 + break;
410 + case kLedStateSlowBlinkContinues:
411 + pCurLed->blinkCountDown = kSlowBlinkCount;
412 + needTimer = TRUE;
413 + break;
414 + case kLedStateFastBlinkContinues:
415 + pCurLed->blinkCountDown = kFastBlinkCount;
416 + needTimer = TRUE;
417 + break;
418 + default:
419 + printk("Invalid state = %d\n", pCurLed->ledState);
420 + }
421 +
422 + return( needTimer );
423 +}
424 +
425 +#if 0 /* BROKEN */
426 +// Determines if there is at least one interface in bridge mode. Bridge mode
427 +// is determined by the cfm convention of naming bridge interfaces nas17
428 +// through nas24.
429 +static int isBridgedProtocol(void)
430 +{
431 + extern int dev_get(const char *name);
432 + const int firstBridgeId = 17;
433 + const int lastBridgeId = 24;
434 + int i;
435 + int ret = FALSE;
436 + char name[16];
437 +
438 + for( i = firstBridgeId; i <= lastBridgeId; i++ )
439 + {
440 + sprintf( name, "nas%d", i );
441 +
442 + if( dev_get(name) )
443 + {
444 + ret = TRUE;
445 + break;
446 + }
447 + }
448 +
449 + return(ret);
450 +}
451 +#endif
452 +
453 +// led ctrl. Maps the ledName to the corresponding ledInfoPtr and perform the led operation
454 +void boardLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
455 +{
456 + PLED_INFO ledInfoPtr;
457 +
458 + // do the mapping from virtual to physical led
459 + if( (int) ledName < MAX_VIRT_LEDS )
460 + ledInfoPtr = gpVirtLeds[(int) ledName];
461 + else
462 + ledInfoPtr = NULL;
463 +
464 + if (ledInfoPtr == NULL)
465 + return;
466 +
467 + if( ledState != kLedStateFail && gLedHwFunc[(int) ledName] )
468 + {
469 + (*gLedHwFunc[(int) ledName]) (ledName, ledState);
470 + ledOffFail(ledInfoPtr);
471 + return;
472 + }
473 + else
474 + if( ledState == kLedStateFail && gLedHwFailFunc[(int) ledName] )
475 + {
476 + (*gLedHwFailFunc[(int) ledName]) (ledName, ledState);
477 + ledOff(ledInfoPtr);
478 + return;
479 + }
480 +
481 +#if 0 /* BROKEN */
482 + // Do not blink the WAN Data LED if at least one interface is in bridge mode.
483 + if(gLedOffInBridgeMode == 1 && (ledName == kLedWanData || ledName == kLedPPP))
484 + {
485 + static int BridgedProtocol = -1;
486 +
487 + if( BridgedProtocol == -1 )
488 + BridgedProtocol = isBridgedProtocol();
489 +
490 + if( BridgedProtocol == TRUE )
491 + return;
492 + }
493 +#endif
494 +
495 + // If the state is kLedStateFail and there is not a failure LED defined
496 + // in the board parameters, change the state to kLedStateFastBlinkContinues.
497 + if( ledState == kLedStateFail && ledInfoPtr->ledMaskFail == 0 )
498 + ledState = kLedStateFastBlinkContinues;
499 +
500 + switch (ledState)
501 + {
502 + case kLedStateOn:
503 + // First, turn off the complimentary (failure) LED GPIO.
504 + if( ledInfoPtr->ledMaskFail )
505 + ledOffFail(ledInfoPtr);
506 + else
507 + if( gLedHwFailFunc[(int) ledName] )
508 + (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
509 +
510 + // Next, turn on the specified LED GPIO.
511 + ledOn(ledInfoPtr);
512 + break;
513 +
514 + case kLedStateOff:
515 + // First, turn off the complimentary (failure) LED GPIO.
516 + if( ledInfoPtr->ledMaskFail )
517 + ledOffFail(ledInfoPtr);
518 + else
519 + if( gLedHwFailFunc[(int) ledName] )
520 + (*gLedHwFailFunc[(int) ledName]) (ledName, kLedStateOff);
521 +
522 + // Next, turn off the specified LED GPIO.
523 + ledOff(ledInfoPtr);
524 + break;
525 +
526 + case kLedStateFail:
527 + // First, turn off the complimentary (normal) LED GPIO.
528 + if( ledInfoPtr->ledMask )
529 + ledOff(ledInfoPtr);
530 + else
531 + if( gLedHwFunc[(int) ledName] )
532 + (*gLedHwFunc[(int) ledName]) (ledName, kLedStateOff);
533 +
534 + // Next, turn on (red) the specified LED GPIO.
535 + ledOnFail(ledInfoPtr);
536 + break;
537 +
538 + case kLedStateBlinkOnce:
539 + // skip blinkOnce if it is already in Slow/Fast blink continues state
540 + if (ledInfoPtr->savedLedState == kLedStateSlowBlinkContinues ||
541 + ledInfoPtr->savedLedState == kLedStateFastBlinkContinues)
542 + ;
543 + else
544 + {
545 + if (ledInfoPtr->blinkCountDown == 0) // skip the call if it is 1
546 + {
547 + ledToggle(ledInfoPtr);
548 + ledInfoPtr->blinkCountDown = 1; // it will be reset to 0 when timer expires
549 + ledInfoPtr->ledState = kLedStateBlinkOnce;
550 + ledTimerStart();
551 + }
552 + }
553 + break;
554 +
555 + case kLedStateSlowBlinkContinues:
556 + ledInfoPtr->blinkCountDown = kSlowBlinkCount;
557 + ledInfoPtr->ledState = kLedStateSlowBlinkContinues;
558 + ledInfoPtr->savedLedState = kLedStateSlowBlinkContinues;
559 + ledTimerStart();
560 + break;
561 +
562 + case kLedStateFastBlinkContinues:
563 + ledInfoPtr->blinkCountDown = kFastBlinkCount;
564 + ledInfoPtr->ledState = kLedStateFastBlinkContinues;
565 + ledInfoPtr->savedLedState = kLedStateFastBlinkContinues;
566 + ledTimerStart();
567 + break;
568 +
569 + default:
570 + printk("Invalid led state\n");
571 + }
572 +}
573 +
574 +// This function is called for an LED that is controlled by hardware.
575 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME ledName,
576 + HANDLE_LED_FUNC ledHwFunc, int ledFailType )
577 +{
578 + if( (int) ledName < MAX_VIRT_LEDS )
579 + {
580 + if( ledFailType == 1 )
581 + gLedHwFailFunc[(int) ledName] = ledHwFunc;
582 + else
583 + gLedHwFunc[(int) ledName] = ledHwFunc;
584 + }
585 +}
586 +
587 diff -urN linux.old/arch/mips/bcm963xx/board.c linux.dev/arch/mips/bcm963xx/board.c
588 --- linux.old/arch/mips/bcm963xx/board.c 1970-01-01 01:00:00.000000000 +0100
589 +++ linux.dev/arch/mips/bcm963xx/board.c 2006-08-27 21:02:04.000000000 +0200
590 @@ -0,0 +1,559 @@
591 +/*
592 +<:copyright-gpl
593 + Copyright 2002 Broadcom Corp. All Rights Reserved.
594 +
595 + This program is free software; you can distribute it and/or modify it
596 + under the terms of the GNU General Public License (Version 2) as
597 + published by the Free Software Foundation.
598 +
599 + This program is distributed in the hope it will be useful, but WITHOUT
600 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
601 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
602 + for more details.
603 +
604 + You should have received a copy of the GNU General Public License along
605 + with this program; if not, write to the Free Software Foundation, Inc.,
606 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
607 +:>
608 +*/
609 +
610 +/* Includes. */
611 +#include <linux/version.h>
612 +#include <linux/init.h>
613 +#include <linux/fs.h>
614 +#include <linux/interrupt.h>
615 +#include <linux/capability.h>
616 +#include <linux/slab.h>
617 +#include <linux/errno.h>
618 +#include <linux/module.h>
619 +#include <linux/pagemap.h>
620 +#include <asm/uaccess.h>
621 +#include <linux/wait.h>
622 +#include <linux/poll.h>
623 +#include <linux/sched.h>
624 +#include <linux/list.h>
625 +#include <linux/if.h>
626 +#include <linux/spinlock.h>
627 +
628 +#include <bcm_map_part.h>
629 +#include <board.h>
630 +#include <bcmTag.h>
631 +#include "boardparms.h"
632 +#include "bcm_intr.h"
633 +#include "board.h"
634 +#include "bcm_map_part.h"
635 +
636 +static DEFINE_SPINLOCK(board_lock);
637 +
638 +/* Typedefs. */
639 +#if defined (NON_CONSECUTIVE_MAC)
640 +// used to be the last octet. Now changed to the first 5 bits of the the forth octet
641 +// to reduced the duplicated MAC addresses.
642 +#define CHANGED_OCTET 3
643 +#define SHIFT_BITS 3
644 +#else
645 +#define CHANGED_OCTET 1
646 +#define SHIFT_BITS 0
647 +#endif
648 +
649 +typedef struct
650 +{
651 + unsigned long ulId;
652 + char chInUse;
653 + char chReserved[3];
654 +} MAC_ADDR_INFO, *PMAC_ADDR_INFO;
655 +
656 +typedef struct
657 +{
658 + unsigned long ulSdramSize;
659 + unsigned long ulPsiSize;
660 + unsigned long ulNumMacAddrs;
661 + unsigned long ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
662 + MAC_ADDR_INFO MacAddrs[1];
663 +} NVRAM_INFO, *PNVRAM_INFO;
664 +
665 +typedef struct
666 +{
667 + unsigned long eventmask;
668 +} BOARD_IOC, *PBOARD_IOC;
669 +
670 +
671 +/*Dyinggasp callback*/
672 +typedef void (*cb_dgasp_t)(void *arg);
673 +typedef struct _CB_DGASP__LIST
674 +{
675 + struct list_head list;
676 + char name[IFNAMSIZ];
677 + cb_dgasp_t cb_dgasp_fn;
678 + void *context;
679 +}CB_DGASP_LIST , *PCB_DGASP_LIST;
680 +
681 +
682 +static LED_MAP_PAIR LedMapping[] =
683 +{ // led name Initial state physical pin (ledMask)
684 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
685 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
686 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
687 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
688 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
689 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
690 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
691 + {kLedEnd, kLedStateOff, 0, 0, 0, 0},
692 + {kLedEnd, kLedStateOff, 0, 0, 0, 0} // NOTE: kLedEnd has to be at the end.
693 +};
694 +
695 +/* Externs. */
696 +extern struct file fastcall *fget_light(unsigned int fd, int *fput_needed);
697 +extern unsigned int nr_free_pages (void);
698 +extern const char *get_system_type(void);
699 +extern void kerSysFlashInit(void);
700 +extern unsigned long get_nvram_start_addr(void);
701 +extern unsigned long get_scratch_pad_start_addr(void);
702 +extern unsigned long getMemorySize(void);
703 +extern void __init boardLedInit(PLED_MAP_PAIR);
704 +extern void boardLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
705 +extern void kerSysLedRegisterHandler( BOARD_LED_NAME ledName,
706 + HANDLE_LED_FUNC ledHwFunc, int ledFailType );
707 +
708 +/* Prototypes. */
709 +void __init InitNvramInfo( void );
710 +
711 +/* DyingGasp function prototype */
712 +static void __init kerSysDyingGaspMapIntr(void);
713 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs);
714 +static void __init kerSysInitDyingGaspHandler( void );
715 +static void __exit kerSysDeinitDyingGaspHandler( void );
716 +/* -DyingGasp function prototype - */
717 +
718 +static PNVRAM_INFO g_pNvramInfo = NULL;
719 +static int g_ledInitialized = 0;
720 +static CB_DGASP_LIST *g_cb_dgasp_list_head = NULL;
721 +
722 +static int g_wakeup_monitor = 0;
723 +static struct file *g_monitor_file = NULL;
724 +static struct task_struct *g_monitor_task = NULL;
725 +static unsigned int (*g_orig_fop_poll)
726 + (struct file *, struct poll_table_struct *) = NULL;
727 +
728 +void kerSysMipsSoftReset(void)
729 +{
730 + if (PERF->RevID == 0x634800A1) {
731 + typedef void (*FNPTR) (void);
732 + FNPTR bootaddr = (FNPTR) FLASH_BASE;
733 + int i;
734 +
735 + /* Disable interrupts. */
736 + //cli();
737 + spin_lock_irq(&board_lock);
738 +
739 + /* Reset all blocks. */
740 + PERF->BlockSoftReset &= ~BSR_ALL_BLOCKS;
741 + for( i = 0; i < 1000000; i++ )
742 + ;
743 + PERF->BlockSoftReset |= BSR_ALL_BLOCKS;
744 + /* Jump to the power on address. */
745 + (*bootaddr) ();
746 + }
747 + else
748 + PERF->pll_control |= SOFT_RESET; // soft reset mips
749 +}
750 +
751 +
752 +int kerSysGetMacAddress( unsigned char *pucaMacAddr, unsigned long ulId )
753 +{
754 + int nRet = 0;
755 + PMAC_ADDR_INFO pMai = NULL;
756 + PMAC_ADDR_INFO pMaiFreeNoId = NULL;
757 + PMAC_ADDR_INFO pMaiFreeId = NULL;
758 + unsigned long i = 0, ulIdxNoId = 0, ulIdxId = 0, shiftedIdx = 0;
759 +
760 + /* CMO -- Fix le problème avec les adresses mac que l'on n'arrive pas
761 + * * à relire plusieurs fois */
762 + /* inv_xde */
763 +#if 0
764 + if (boot_loader_type == BOOT_CFE)
765 + memcpy( pucaMacAddr, g_pNvramInfo->ucaBaseMacAddr,
766 + NVRAM_MAC_ADDRESS_LEN );
767 + else {
768 +#endif
769 + pucaMacAddr[0] = 0x00;
770 + pucaMacAddr[1] = 0x07;
771 + pucaMacAddr[2] = 0x3A;
772 + pucaMacAddr[3] = 0xFF;
773 + pucaMacAddr[4] = 0xFF;
774 + pucaMacAddr[5] = 0xFF;
775 +#if 0
776 + }
777 +#endif
778 +
779 + return nRet;
780 +} /* kerSysGetMacAddr */
781 +
782 +int kerSysReleaseMacAddress( unsigned char *pucaMacAddr )
783 +{
784 + int nRet = -EINVAL;
785 + unsigned long ulIdx = 0;
786 + int idx = (pucaMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET] -
787 + g_pNvramInfo->ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN - CHANGED_OCTET]);
788 +
789 + // if overflow 255 (negitive), add 256 to have the correct index
790 + if (idx < 0)
791 + idx += 256;
792 + ulIdx = (unsigned long) (idx >> SHIFT_BITS);
793 +
794 + if( ulIdx < g_pNvramInfo->ulNumMacAddrs )
795 + {
796 + PMAC_ADDR_INFO pMai = &g_pNvramInfo->MacAddrs[ulIdx];
797 + if( pMai->chInUse == 1 )
798 + {
799 + pMai->chInUse = 0;
800 + nRet = 0;
801 + }
802 + }
803 +
804 + return( nRet );
805 +} /* kerSysReleaseMacAddr */
806 +
807 +int kerSysGetSdramSize( void )
808 +{
809 + if (boot_loader_type == BOOT_CFE) {
810 + return( (int) g_pNvramInfo->ulSdramSize );
811 + }
812 + else {
813 + printk("kerSysGetSdramSize : 0x%08X\n", (int)getMemorySize() + 0x00040000);
814 + return((int)getMemorySize() + 0x00040000);
815 + }
816 +} /* kerSysGetSdramSize */
817 +
818 +
819 +void kerSysLedCtrl(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState)
820 +{
821 + if (g_ledInitialized)
822 + boardLedCtrl(ledName, ledState);
823 +}
824 +
825 +unsigned int kerSysMonitorPollHook( struct file *f, struct poll_table_struct *t)
826 +{
827 + int mask = (*g_orig_fop_poll) (f, t);
828 +
829 + if( g_wakeup_monitor == 1 && g_monitor_file == f )
830 + {
831 + /* If g_wakeup_monitor is non-0, the user mode application needs to
832 + * return from a blocking select function. Return POLLPRI which will
833 + * cause the select to return with the exception descriptor set.
834 + */
835 + mask |= POLLPRI;
836 + g_wakeup_monitor = 0;
837 + }
838 +
839 + return( mask );
840 +}
841 +
842 +/* Put the user mode application that monitors link state on a run queue. */
843 +void kerSysWakeupMonitorTask( void )
844 +{
845 + g_wakeup_monitor = 1;
846 + if( g_monitor_task )
847 + wake_up_process( g_monitor_task );
848 +}
849 +
850 +//<<JUNHON, 2004/09/15, get reset button status , tim hou , 05/04/12
851 +int kerSysGetResetHold(void)
852 +{
853 + unsigned short gpio;
854 +
855 + if( BpGetPressAndHoldResetGpio( &gpio ) == BP_SUCCESS )
856 + {
857 + unsigned long gpio_mask = GPIO_NUM_TO_MASK(gpio);
858 + volatile unsigned long *gpio_reg = &GPIO->GPIOio;
859 +
860 + if( (gpio & ~BP_ACTIVE_MASK) >= 32 )
861 + {
862 + gpio_mask = GPIO_NUM_TO_MASK_HIGH(gpio);
863 + gpio_reg = &GPIO->GPIOio_high;
864 + }
865 + //printk("gpio=%04x,gpio_mask=%04x,gpio_reg=%04x\n",gpio,gpio_mask,*gpio_reg);
866 + if(*gpio_reg & gpio_mask) //press down
867 + return RESET_BUTTON_UP;
868 + }
869 + return RESET_BUTTON_PRESSDOWN;
870 +}
871 +//<<JUNHON, 2004/09/15
872 +
873 +/***************************************************************************
874 + * Dying gasp ISR and functions.
875 + ***************************************************************************/
876 +#define KERSYS_DBG printk
877 +
878 +#if defined(CONFIG_BCM96345)
879 +#define CYCLE_PER_US 70
880 +#elif defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)
881 +/* The BCM6348 cycles per microsecond is really variable since the BCM6348
882 + * MIPS speed can vary depending on the PLL settings. However, an appoximate
883 + * value of 120 will still work OK for the test being done.
884 + */
885 +#define CYCLE_PER_US 120
886 +#endif
887 +#define DG_GLITCH_TO (100*CYCLE_PER_US)
888 +
889 +static void __init kerSysDyingGaspMapIntr()
890 +{
891 + unsigned long ulIntr;
892 +
893 +#if defined(CONFIG_BCM96348) || defined(_BCM96348_) || defined(CONFIG_BCM96338) || defined(_BCM96338_)
894 + if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
895 + BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, INTERRUPT_ID_DG);
896 + BcmHalInterruptEnable( INTERRUPT_ID_DG );
897 + }
898 +#elif defined(CONFIG_BCM96345) || defined(_BCM96345_)
899 + if( BpGetAdslDyingGaspExtIntr( &ulIntr ) == BP_SUCCESS ) {
900 + ulIntr += INTERRUPT_ID_EXTERNAL_0;
901 + BcmHalMapInterrupt((FN_HANDLER)kerSysDyingGaspIsr, 0, ulIntr);
902 + BcmHalInterruptEnable( ulIntr );
903 + }
904 +#endif
905 +
906 +}
907 +
908 +void kerSysSetWdTimer(ulong timeUs)
909 +{
910 + TIMER->WatchDogDefCount = timeUs * (FPERIPH/1000000);
911 + TIMER->WatchDogCtl = 0xFF00;
912 + TIMER->WatchDogCtl = 0x00FF;
913 +}
914 +
915 +ulong kerSysGetCycleCount(void)
916 +{
917 + ulong cnt;
918 +#ifdef _WIN32_WCE
919 + cnt = 0;
920 +#else
921 + __asm volatile("mfc0 %0, $9":"=d"(cnt));
922 +#endif
923 + return(cnt);
924 +}
925 +
926 +static Bool kerSysDyingGaspCheckPowerLoss(void)
927 +{
928 + ulong clk0;
929 + ulong ulIntr;
930 +
931 + ulIntr = 0;
932 + clk0 = kerSysGetCycleCount();
933 +
934 + UART->Data = 'D';
935 + UART->Data = '%';
936 + UART->Data = 'G';
937 +
938 +#if defined(CONFIG_BCM96345)
939 + BpGetAdslDyingGaspExtIntr( &ulIntr );
940 +
941 + do {
942 + ulong clk1;
943 +
944 + clk1 = kerSysGetCycleCount(); /* time cleared */
945 + /* wait a little to get new reading */
946 + while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
947 + ;
948 + } while ((0 == (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT)))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
949 +
950 + if (PERF->ExtIrqCfg & (1 << (ulIntr + EI_STATUS_SHFT))) { /* power glitch */
951 + BcmHalInterruptEnable( ulIntr + INTERRUPT_ID_EXTERNAL_0);
952 + KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
953 + return 0;
954 + }
955 +#elif (defined(CONFIG_BCM96348) || defined(CONFIG_BCM96338)) && !defined(VXWORKS)
956 + do {
957 + ulong clk1;
958 +
959 + clk1 = kerSysGetCycleCount(); /* time cleared */
960 + /* wait a little to get new reading */
961 + while ((kerSysGetCycleCount()-clk1) < CYCLE_PER_US*2)
962 + ;
963 + } while ((PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET))) && ((kerSysGetCycleCount() - clk0) < DG_GLITCH_TO));
964 +
965 + if (!(PERF->IrqStatus & (1 << (INTERRUPT_ID_DG - INTERNAL_ISR_TABLE_OFFSET)))) {
966 + BcmHalInterruptEnable( INTERRUPT_ID_DG );
967 + KERSYS_DBG(" - Power glitch detected. Duration: %ld us\n", (kerSysGetCycleCount() - clk0)/CYCLE_PER_US);
968 + return 0;
969 + }
970 +#endif
971 + return 1;
972 +}
973 +
974 +static void kerSysDyingGaspShutdown( void )
975 +{
976 + kerSysSetWdTimer(1000000);
977 +#if defined(CONFIG_BCM96345)
978 + PERF->blkEnables &= ~(EMAC_CLK_EN | USB_CLK_EN | CPU_CLK_EN);
979 +#elif defined(CONFIG_BCM96348)
980 + PERF->blkEnables &= ~(EMAC_CLK_EN | USBS_CLK_EN | USBH_CLK_EN | SAR_CLK_EN);
981 +#endif
982 +}
983 +
984 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
985 +static irqreturn_t kerSysDyingGaspIsr(int irq, void * dev_id, struct pt_regs * regs)
986 +#else
987 +static unsigned int kerSysDyingGaspIsr(void)
988 +#endif
989 +{
990 + struct list_head *pos;
991 + CB_DGASP_LIST *tmp, *dsl = NULL;
992 +
993 + if (kerSysDyingGaspCheckPowerLoss()) {
994 +
995 + /* first to turn off everything other than dsl */
996 + list_for_each(pos, &g_cb_dgasp_list_head->list) {
997 + tmp = list_entry(pos, CB_DGASP_LIST, list);
998 + if(strncmp(tmp->name, "dsl", 3)) {
999 + (tmp->cb_dgasp_fn)(tmp->context);
1000 + }else {
1001 + dsl = tmp;
1002 + }
1003 + }
1004 +
1005 + /* now send dgasp */
1006 + if(dsl)
1007 + (dsl->cb_dgasp_fn)(dsl->context);
1008 +
1009 + /* reset and shutdown system */
1010 + kerSysDyingGaspShutdown();
1011 + }
1012 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
1013 +return( IRQ_HANDLED );
1014 +#else
1015 + return( 1 );
1016 +#endif
1017 +}
1018 +
1019 +static void __init kerSysInitDyingGaspHandler( void )
1020 +{
1021 + CB_DGASP_LIST *new_node;
1022 +
1023 + if( g_cb_dgasp_list_head != NULL) {
1024 + printk("Error: kerSysInitDyingGaspHandler: list head is not null\n");
1025 + return;
1026 + }
1027 + new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
1028 + memset(new_node, 0x00, sizeof(CB_DGASP_LIST));
1029 + INIT_LIST_HEAD(&new_node->list);
1030 + g_cb_dgasp_list_head = new_node;
1031 +
1032 +} /* kerSysInitDyingGaspHandler */
1033 +
1034 +static void __exit kerSysDeinitDyingGaspHandler( void )
1035 +{
1036 + struct list_head *pos;
1037 + CB_DGASP_LIST *tmp;
1038 +
1039 + if(g_cb_dgasp_list_head == NULL)
1040 + return;
1041 +
1042 + list_for_each(pos, &g_cb_dgasp_list_head->list) {
1043 + tmp = list_entry(pos, CB_DGASP_LIST, list);
1044 + list_del(pos);
1045 + kfree(tmp);
1046 + }
1047 +
1048 + kfree(g_cb_dgasp_list_head);
1049 + g_cb_dgasp_list_head = NULL;
1050 +
1051 +} /* kerSysDeinitDyingGaspHandler */
1052 +
1053 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context)
1054 +{
1055 + CB_DGASP_LIST *new_node;
1056 +
1057 + if( g_cb_dgasp_list_head == NULL) {
1058 + printk("Error: kerSysRegisterDyingGaspHandler: list head is null\n");
1059 + return;
1060 + }
1061 +
1062 + if( devname == NULL || cbfn == NULL ) {
1063 + printk("Error: kerSysRegisterDyingGaspHandler: register info not enough (%s,%x,%x)\n", devname, (unsigned int)cbfn, (unsigned int)context);
1064 + return;
1065 + }
1066 +
1067 + new_node= (CB_DGASP_LIST *)kmalloc(sizeof(CB_DGASP_LIST), GFP_KERNEL);
1068 + memset(new_node, 0x00, sizeof(CB_DGASP_LIST));
1069 + INIT_LIST_HEAD(&new_node->list);
1070 + strncpy(new_node->name, devname, IFNAMSIZ);
1071 + new_node->cb_dgasp_fn = (cb_dgasp_t)cbfn;
1072 + new_node->context = context;
1073 + list_add(&new_node->list, &g_cb_dgasp_list_head->list);
1074 +
1075 + printk("dgasp: kerSysRegisterDyingGaspHandler: %s registered \n", devname);
1076 +
1077 +} /* kerSysRegisterDyingGaspHandler */
1078 +
1079 +void kerSysDeregisterDyingGaspHandler(char *devname)
1080 +{
1081 + struct list_head *pos;
1082 + CB_DGASP_LIST *tmp;
1083 +
1084 + if(g_cb_dgasp_list_head == NULL) {
1085 + printk("Error: kerSysDeregisterDyingGaspHandler: list head is null\n");
1086 + return;
1087 + }
1088 +
1089 + if(devname == NULL) {
1090 + printk("Error: kerSysDeregisterDyingGaspHandler: devname is null\n");
1091 + return;
1092 + }
1093 +
1094 + printk("kerSysDeregisterDyingGaspHandler: %s is deregistering\n", devname);
1095 +
1096 + list_for_each(pos, &g_cb_dgasp_list_head->list) {
1097 + tmp = list_entry(pos, CB_DGASP_LIST, list);
1098 + if(!strcmp(tmp->name, devname)) {
1099 + list_del(pos);
1100 + kfree(tmp);
1101 + printk("kerSysDeregisterDyingGaspHandler: %s is deregistered\n", devname);
1102 + return;
1103 + }
1104 + }
1105 + printk("kerSysDeregisterDyingGaspHandler: %s not (de)registered\n", devname);
1106 +
1107 +} /* kerSysDeregisterDyingGaspHandler */
1108 +
1109 +//EXPORT_SYMBOL(kerSysNvRamGet);
1110 +EXPORT_SYMBOL(kerSysGetMacAddress);
1111 +EXPORT_SYMBOL(kerSysReleaseMacAddress);
1112 +EXPORT_SYMBOL(kerSysGetSdramSize);
1113 +EXPORT_SYMBOL(kerSysLedCtrl);
1114 +EXPORT_SYMBOL(kerSysGetResetHold);
1115 +EXPORT_SYMBOL(kerSysLedRegisterHwHandler);
1116 +EXPORT_SYMBOL(BpGetBoardIds);
1117 +EXPORT_SYMBOL(BpGetSdramSize);
1118 +EXPORT_SYMBOL(BpGetPsiSize);
1119 +EXPORT_SYMBOL(BpGetEthernetMacInfo);
1120 +EXPORT_SYMBOL(BpGetRj11InnerOuterPairGpios);
1121 +EXPORT_SYMBOL(BpGetPressAndHoldResetGpio);
1122 +EXPORT_SYMBOL(BpGetVoipResetGpio);
1123 +EXPORT_SYMBOL(BpGetVoipIntrGpio);
1124 +EXPORT_SYMBOL(BpGetPcmciaResetGpio);
1125 +EXPORT_SYMBOL(BpGetRtsCtsUartGpios);
1126 +EXPORT_SYMBOL(BpGetAdslLedGpio);
1127 +EXPORT_SYMBOL(BpGetAdslFailLedGpio);
1128 +EXPORT_SYMBOL(BpGetWirelessLedGpio);
1129 +EXPORT_SYMBOL(BpGetUsbLedGpio);
1130 +EXPORT_SYMBOL(BpGetHpnaLedGpio);
1131 +EXPORT_SYMBOL(BpGetWanDataLedGpio);
1132 +EXPORT_SYMBOL(BpGetPppLedGpio);
1133 +EXPORT_SYMBOL(BpGetPppFailLedGpio);
1134 +EXPORT_SYMBOL(BpGetVoipLedGpio);
1135 +EXPORT_SYMBOL(BpGetWirelessExtIntr);
1136 +EXPORT_SYMBOL(BpGetAdslDyingGaspExtIntr);
1137 +EXPORT_SYMBOL(BpGetVoipExtIntr);
1138 +EXPORT_SYMBOL(BpGetHpnaExtIntr);
1139 +EXPORT_SYMBOL(BpGetHpnaChipSelect);
1140 +EXPORT_SYMBOL(BpGetVoipChipSelect);
1141 +EXPORT_SYMBOL(BpGetWirelessSesBtnGpio);
1142 +EXPORT_SYMBOL(BpGetWirelessSesExtIntr);
1143 +EXPORT_SYMBOL(BpGetWirelessSesLedGpio);
1144 +EXPORT_SYMBOL(kerSysRegisterDyingGaspHandler);
1145 +EXPORT_SYMBOL(kerSysDeregisterDyingGaspHandler);
1146 +EXPORT_SYMBOL(kerSysGetCycleCount);
1147 +EXPORT_SYMBOL(kerSysSetWdTimer);
1148 +EXPORT_SYMBOL(kerSysWakeupMonitorTask);
1149 +
1150 diff -urN linux.old/arch/mips/bcm963xx/boardparms.c linux.dev/arch/mips/bcm963xx/boardparms.c
1151 --- linux.old/arch/mips/bcm963xx/boardparms.c 1970-01-01 01:00:00.000000000 +0100
1152 +++ linux.dev/arch/mips/bcm963xx/boardparms.c 2006-08-25 00:39:38.000000000 +0200
1153 @@ -0,0 +1,2391 @@
1154 +/*
1155 +<:copyright-gpl
1156 +
1157 + Copyright 2003 Broadcom Corp. All Rights Reserved.
1158 +
1159 + This program is free software; you can distribute it and/or modify it
1160 + under the terms of the GNU General Public License (Version 2) as
1161 + published by the Free Software Foundation.
1162 +
1163 + This program is distributed in the hope it will be useful, but WITHOUT
1164 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1165 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1166 + for more details.
1167 +
1168 + You should have received a copy of the GNU General Public License along
1169 + with this program; if not, write to the Free Software Foundation, Inc.,
1170 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
1171 +
1172 +:>
1173 +*/
1174 +/**************************************************************************
1175 + * File Name : boardparms.c
1176 + *
1177 + * Description: This file contains the implementation for the BCM63xx board
1178 + * parameter access functions.
1179 + *
1180 + * Updates : 07/14/2003 Created.
1181 + ***************************************************************************/
1182 +
1183 +/* Includes. */
1184 +#include "boardparms.h"
1185 +
1186 +/* Defines. */
1187 +
1188 +/* Default psi size in K bytes */
1189 +#define BP_PSI_DEFAULT_SIZE 24
1190 +
1191 +/* Typedefs */
1192 +typedef struct boardparameters
1193 +{
1194 + char szBoardId[BP_BOARD_ID_LEN]; /* board id string */
1195 + ETHERNET_MAC_INFO EnetMacInfos[BP_MAX_ENET_MACS];
1196 + VOIP_DSP_INFO VoIPDspInfo[BP_MAX_VOIP_DSP];
1197 + unsigned short usSdramSize; /* SDRAM size and type */
1198 + unsigned short usPsiSize; /* persistent storage in K bytes */
1199 + unsigned short usGpioRj11InnerPair; /* GPIO pin or not defined */
1200 + unsigned short usGpioRj11OuterPair; /* GPIO pin or not defined */
1201 + unsigned short usGpioPressAndHoldReset; /* GPIO pin or not defined */
1202 + unsigned short usGpioPcmciaReset; /* GPIO pin or not defined */
1203 + unsigned short usGpioUartRts; /* GPIO pin or not defined */
1204 + unsigned short usGpioUartCts; /* GPIO pin or not defined */
1205 + unsigned short usGpioLedAdsl; /* GPIO pin or not defined */
1206 + unsigned short usGpioLedAdslFail; /* GPIO pin or not defined */
1207 + unsigned short usGpioLedWireless; /* GPIO pin or not defined */
1208 + unsigned short usGpioLedUsb; /* GPIO pin or not defined */
1209 + unsigned short usGpioLedHpna; /* GPIO pin or not defined */
1210 + unsigned short usGpioLedWanData; /* GPIO pin or not defined */
1211 + unsigned short usGpioLedPpp; /* GPIO pin or not defined */
1212 + unsigned short usGpioLedPppFail; /* GPIO pin or not defined */
1213 + unsigned short usGpioLedBlPowerOn; /* GPIO pin or not defined */
1214 + unsigned short usGpioLedBlAlarm; /* GPIO pin or not defined */
1215 + unsigned short usGpioLedBlResetCfg; /* GPIO pin or not defined */
1216 + unsigned short usGpioLedBlStop; /* GPIO pin or not defined */
1217 + unsigned short usExtIntrWireless; /* ext intr or not defined */
1218 + unsigned short usExtIntrAdslDyingGasp; /* ext intr or not defined */
1219 + unsigned short usExtIntrHpna; /* ext intr or not defined */
1220 + unsigned short usCsHpna; /* chip select not defined */
1221 + unsigned short usAntInUseWireless; /* antenna in use or not defined */
1222 + unsigned short usGpioSesBtnWireless; /* GPIO pin or not defined */
1223 + unsigned short usExtIntrSesBtnWireless; /* ext intr or not defined */
1224 + unsigned short usGpioLedSesWireless; /* GPIO pin or not defined */
1225 +} BOARD_PARAMETERS, *PBOARD_PARAMETERS;
1226 +
1227 +/* Variables */
1228 +#if defined(_BCM96338_) || defined(CONFIG_BCM96338)
1229 +static BOARD_PARAMETERS g_bcm96338sv =
1230 +{
1231 + "96338SV", /* szBoardId */
1232 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1233 + 0x01, /* ucPhyAddress */
1234 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1235 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1236 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1237 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1238 + BP_NOT_DEFINED, /* usGpioPhyReset */
1239 + 0x01, /* numSwitchPorts */
1240 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1241 + BP_NOT_DEFINED}, /* usReverseMii */
1242 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1243 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1244 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1245 + BP_MEMORY_16MB_1_CHIP, /* usSdramSize */
1246 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1247 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1248 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1249 + BP_NOT_DEFINED, /* usGpioPressAndHoldReset */
1250 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1251 + BP_NOT_DEFINED, /* usGpioUartRts */
1252 + BP_NOT_DEFINED, /* usGpioUartCts */
1253 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1254 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1255 + BP_NOT_DEFINED, /* usGpioLedWireless */
1256 + BP_NOT_DEFINED, /* usGpioLedUsb */
1257 + BP_NOT_DEFINED, /* usGpioLedHpna */
1258 + BP_NOT_DEFINED, /* usGpioLedWanData */
1259 + BP_NOT_DEFINED, /* usGpioLedPpp */
1260 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1261 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1262 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1263 + BP_NOT_DEFINED, /* usGpioLedBlResetCfg */
1264 + BP_NOT_DEFINED, /* usGpioLedBlStop */
1265 + BP_NOT_DEFINED, /* usExtIntrWireless */
1266 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1267 + BP_NOT_DEFINED, /* usExtIntrHpna */
1268 + BP_NOT_DEFINED, /* usCsHpna */
1269 + BP_NOT_DEFINED, /* usAntInUseWireless */
1270 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1271 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1272 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1273 +};
1274 +static BOARD_PARAMETERS g_bcm96338l2m8m =
1275 +{
1276 + "96338L-2M-8M", /* szBoardId */
1277 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1278 + 0x01, /* ucPhyAddress */
1279 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1280 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1281 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1282 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1283 + BP_NOT_DEFINED, /* usGpioPhyReset */
1284 + 0x01, /* numSwitchPorts */
1285 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1286 + BP_NOT_DEFINED}, /* usReverseMii */
1287 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1288 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1289 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1290 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1291 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1292 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1293 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1294 + BP_NOT_DEFINED, /* usGpioPressAndHoldReset */
1295 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1296 + BP_NOT_DEFINED, /* usGpioUartRts */
1297 + BP_NOT_DEFINED, /* usGpioUartCts */
1298 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1299 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1300 + BP_NOT_DEFINED, /* usGpioLedWireless */
1301 + BP_NOT_DEFINED, /* usGpioLedUsb */
1302 + BP_NOT_DEFINED, /* usGpioLedHpna */
1303 + BP_GPIO_3_AL, /* usGpioLedWanData */
1304 + BP_GPIO_3_AL, /* usGpioLedPpp */
1305 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1306 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1307 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1308 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1309 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1310 + BP_NOT_DEFINED, /* usExtIntrWireless */
1311 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1312 + BP_NOT_DEFINED, /* usExtIntrHpna */
1313 + BP_NOT_DEFINED, /* usCsHpna */
1314 + BP_NOT_DEFINED, /* usAntInUseWireless */
1315 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1316 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1317 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1318 +};
1319 +static PBOARD_PARAMETERS g_BoardParms[] =
1320 + {&g_bcm96338sv, &g_bcm96338l2m8m, 0};
1321 +#endif
1322 +
1323 +#if defined(_BCM96345_) || defined(CONFIG_BCM96345)
1324 +static BOARD_PARAMETERS g_bcm96345r =
1325 +{
1326 + "96345R", /* szBoardId */
1327 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1328 + 0x01, /* ucPhyAddress */
1329 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1330 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1331 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1332 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1333 + BP_NOT_DEFINED, /* usGpioPhyReset */
1334 + 0x01, /* numSwitchPorts */
1335 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1336 + BP_NOT_DEFINED}, /* usReverseMii */
1337 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1338 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1339 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1340 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1341 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1342 + BP_GPIO_11_AH, /* usGpioRj11InnerPair */
1343 + BP_GPIO_12_AH, /* usGpioRj11OuterPair */
1344 + BP_GPIO_13_AH, /* usGpioPressAndHoldReset */
1345 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1346 + BP_NOT_DEFINED, /* usGpioUartRts */
1347 + BP_NOT_DEFINED, /* usGpioUartCts */
1348 + BP_GPIO_8_AH, /* usGpioLedAdsl */
1349 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1350 + BP_NOT_DEFINED, /* usGpioLedWireless */
1351 + BP_NOT_DEFINED, /* usGpioLedUsb */
1352 + BP_NOT_DEFINED, /* usGpioLedHpna */
1353 + BP_GPIO_8_AH, /* usGpioLedWanData */
1354 + BP_GPIO_9_AH, /* usGpioLedPpp */
1355 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1356 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1357 + BP_GPIO_10_AH, /* usGpioLedBlAlarm */
1358 + BP_GPIO_9_AH, /* usGpioLedBlResetCfg */
1359 + BP_GPIO_8_AH, /* usGpioLedBlStop */
1360 + BP_NOT_DEFINED, /* usExtIntrWireless */
1361 + BP_EXT_INTR_0, /* usExtIntrAdslDyingGasp */
1362 + BP_NOT_DEFINED, /* usExtIntrHpna */
1363 + BP_NOT_DEFINED, /* usCsHpna */
1364 + BP_NOT_DEFINED, /* usAntInUseWireless */
1365 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1366 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1367 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1368 +};
1369 +
1370 +static BOARD_PARAMETERS g_bcm96345gw2 =
1371 +{
1372 + /* A hardware jumper determines whether GPIO 13 is used for Press and Hold
1373 + * Reset or RTS.
1374 + */
1375 + "96345GW2", /* szBoardId */
1376 + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1377 + 0x00, /* ucPhyAddress */
1378 + BP_GPIO_0_AH, /* usGpioPhySpiSck */
1379 + BP_GPIO_4_AH, /* usGpioPhySpiSs */
1380 + BP_GPIO_12_AH, /* usGpioPhySpiMosi */
1381 + BP_GPIO_11_AH, /* usGpioPhySpiMiso */
1382 + BP_NOT_DEFINED, /* usGpioPhyReset */
1383 + 0x04, /* numSwitchPorts */
1384 + BP_ENET_CONFIG_GPIO, /* usConfigType */
1385 + BP_ENET_REVERSE_MII}, /* usReverseMii */
1386 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1387 + {{BP_VOIP_DSP, /* ucDspType */
1388 + 0x00, /* ucDspAddress */
1389 + BP_EXT_INTR_1, /* usExtIntrVoip */
1390 + BP_GPIO_6_AH, /* usGpioVoipReset */
1391 + BP_GPIO_15_AH, /* usGpioVoipIntr */
1392 + BP_NOT_DEFINED, /* usGpioLedVoip */
1393 + BP_CS_2}, /* usCsVoip */
1394 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1395 + BP_MEMORY_16MB_1_CHIP, /* usSdramSize */
1396 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1397 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1398 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1399 + BP_GPIO_13_AH, /* usGpioPressAndHoldReset */
1400 + BP_GPIO_2_AH, /* usGpioPcmciaReset */
1401 + BP_GPIO_13_AH, /* usGpioUartRts */
1402 + BP_GPIO_9_AH, /* usGpioUartCts */
1403 + BP_GPIO_8_AH, /* usGpioLedAdsl */
1404 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1405 + BP_NOT_DEFINED, /* usGpioLedWireless */
1406 + BP_GPIO_7_AH, /* usGpioLedUsb */
1407 + BP_NOT_DEFINED, /* usGpioLedHpna */
1408 + BP_GPIO_8_AH, /* usGpioLedWanData */
1409 + BP_NOT_DEFINED, /* usGpioLedPpp */
1410 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1411 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1412 + BP_GPIO_10_AH, /* usGpioLedBlAlarm */
1413 + BP_GPIO_7_AH, /* usGpioLedBlResetCfg */
1414 + BP_GPIO_8_AH, /* usGpioLedBlStop */
1415 + BP_EXT_INTR_2, /* usExtIntrWireless */
1416 + BP_EXT_INTR_0, /* usExtIntrAdslDyingGasp */
1417 + BP_NOT_DEFINED, /* usExtIntrHpna */
1418 + BP_NOT_DEFINED, /* usCsHpna */
1419 + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */
1420 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1421 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1422 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1423 +};
1424 +
1425 +static BOARD_PARAMETERS g_bcm96345gw =
1426 +{
1427 + "96345GW", /* szBoardId */
1428 + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1429 + 0x00, /* ucPhyAddress */
1430 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1431 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1432 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1433 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1434 + BP_NOT_DEFINED, /* usGpioPhyReset */
1435 + 0x04, /* numSwitchPorts */
1436 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1437 + BP_ENET_NO_REVERSE_MII}, /* usReverseMii */
1438 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1439 + {{BP_VOIP_DSP, /* ucDspType */
1440 + 0x00, /* ucDspAddress */
1441 + BP_EXT_INTR_1, /* usExtIntrVoip */
1442 + BP_GPIO_6_AH, /* usGpioVoipReset */
1443 + BP_GPIO_15_AH, /* usGpioVoipIntr */
1444 + BP_NOT_DEFINED, /* usGpioLedVoip */
1445 + BP_CS_2}, /* usCsVoip */
1446 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1447 + BP_MEMORY_16MB_1_CHIP, /* usSdramSize */
1448 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1449 + BP_GPIO_11_AH, /* usGpioRj11InnerPair */
1450 + BP_GPIO_1_AH, /* usGpioRj11OuterPair */
1451 + BP_GPIO_13_AH, /* usGpioPressAndHoldReset */
1452 + BP_GPIO_2_AH, /* usGpioPcmciaReset */
1453 + BP_NOT_DEFINED, /* usGpioUartRts */
1454 + BP_NOT_DEFINED, /* usGpioUartCts */
1455 + BP_GPIO_8_AH, /* usGpioLedAdsl */
1456 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1457 + BP_GPIO_10_AH, /* usGpioLedWireless */
1458 + BP_GPIO_7_AH, /* usGpioLedUsb */
1459 + BP_NOT_DEFINED, /* usGpioLedHpna */
1460 + BP_GPIO_8_AH, /* usGpioLedWanData */
1461 + BP_NOT_DEFINED, /* usGpioLedPpp */
1462 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1463 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1464 + BP_GPIO_9_AH, /* usGpioLedBlAlarm */
1465 + BP_GPIO_10_AH, /* usGpioLedBlResetCfg */
1466 + BP_GPIO_8_AH, /* usGpioLedBlStop */
1467 + BP_EXT_INTR_2, /* usExtIntrWireless */
1468 + BP_EXT_INTR_0, /* usExtIntrAdslDyingGasp */
1469 + BP_EXT_INTR_3, /* usExtIntrHpna */
1470 + BP_CS_1, /* usCsHpna */
1471 + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */
1472 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1473 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1474 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1475 +};
1476 +
1477 +static BOARD_PARAMETERS g_bcm96335r =
1478 +{
1479 + "96335R", /* szBoardId */
1480 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1481 + 0x01, /* ucPhyAddress */
1482 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1483 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1484 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1485 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1486 + BP_NOT_DEFINED, /* usGpioPhyReset */
1487 + 0x01, /* numSwitchPorts */
1488 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1489 + BP_NOT_DEFINED}, /* usReverseMii */
1490 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1491 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1492 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1493 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1494 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1495 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1496 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1497 + BP_GPIO_14_AH, /* usGpioPressAndHoldReset */
1498 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1499 + BP_NOT_DEFINED, /* usGpioUartRts */
1500 + BP_NOT_DEFINED, /* usGpioUartCts */
1501 + BP_GPIO_9_AH, /* usGpioLedAdsl */
1502 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1503 + BP_NOT_DEFINED, /* usGpioLedWireless */
1504 + BP_NOT_DEFINED, /* usGpioLedUsb */
1505 + BP_NOT_DEFINED, /* usGpioLedHpna */
1506 + BP_GPIO_9_AH, /* usGpioLedWanData */
1507 + BP_GPIO_8_AH, /* usGpioLedPpp */
1508 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1509 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1510 + BP_GPIO_10_AH, /* usGpioLedBlAlarm */
1511 + BP_GPIO_8_AH, /* usGpioLedBlResetCfg */
1512 + BP_GPIO_9_AH, /* usGpioLedBlStop */
1513 + BP_NOT_DEFINED, /* usExtIntrWireless */
1514 + BP_NOT_DEFINED, /* usExtIntrAdslDyingGasp */
1515 + BP_NOT_DEFINED, /* usExtIntrHpna */
1516 + BP_NOT_DEFINED, /* usCsHpna */
1517 + BP_NOT_DEFINED, /* usAntInUseWireless */
1518 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1519 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1520 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1521 +};
1522 +
1523 +static BOARD_PARAMETERS g_bcm96345r0 =
1524 +{
1525 + "96345R0", /* szBoardId */
1526 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1527 + 0x01, /* ucPhyAddress */
1528 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1529 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1530 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1531 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1532 + BP_NOT_DEFINED, /* usGpioPhyReset */
1533 + 0x01, /* numSwitchPorts */
1534 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1535 + BP_NOT_DEFINED}, /* usReverseMii */
1536 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1537 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1538 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1539 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1540 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1541 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1542 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1543 + BP_NOT_DEFINED, /* usGpioPressAndHoldReset */
1544 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1545 + BP_NOT_DEFINED, /* usGpioUartRts */
1546 + BP_NOT_DEFINED, /* usGpioUartCts */
1547 + BP_GPIO_8_AH, /* usGpioLedAdsl */
1548 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1549 + BP_NOT_DEFINED, /* usGpioLedWireless */
1550 + BP_NOT_DEFINED, /* usGpioLedUsb */
1551 + BP_NOT_DEFINED, /* usGpioLedHpna */
1552 + BP_GPIO_9_AH, /* usGpioLedWanData */
1553 + BP_GPIO_9_AH, /* usGpioLedPpp */
1554 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1555 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1556 + BP_GPIO_9_AH, /* usGpioLedBlAlarm */
1557 + BP_GPIO_8_AH, /* usGpioLedBlResetCfg */
1558 + BP_GPIO_8_AH, /* usGpioLedBlStop */
1559 + BP_NOT_DEFINED, /* usExtIntrWireless */
1560 + BP_NOT_DEFINED, /* usExtIntrAdslDyingGasp */
1561 + BP_NOT_DEFINED, /* usExtIntrHpna */
1562 + BP_NOT_DEFINED, /* usCsHpna */
1563 + BP_NOT_DEFINED, /* usAntInUseWireless */
1564 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1565 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1566 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1567 +};
1568 +
1569 +static BOARD_PARAMETERS g_bcm96345rs =
1570 +{
1571 + "96345RS", /* szBoardId */
1572 + {{BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1573 + 0x00, /* ucPhyAddress */
1574 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1575 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1576 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1577 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1578 + BP_NOT_DEFINED, /* usGpioPhyReset */
1579 + 0x01, /* numSwitchPorts */
1580 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1581 + BP_ENET_NO_REVERSE_MII}, /* usReverseMii */
1582 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1583 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1584 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1585 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1586 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1587 + BP_GPIO_11_AH, /* usGpioRj11InnerPair */
1588 + BP_GPIO_12_AH, /* usGpioRj11OuterPair */
1589 + BP_GPIO_13_AH, /* usGpioPressAndHoldReset */
1590 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1591 + BP_NOT_DEFINED, /* usGpioUartRts */
1592 + BP_NOT_DEFINED, /* usGpioUartCts */
1593 + BP_GPIO_8_AH, /* usGpioLedAdsl */
1594 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1595 + BP_NOT_DEFINED, /* usGpioLedWireless */
1596 + BP_NOT_DEFINED, /* usGpioLedUsb */
1597 + BP_NOT_DEFINED, /* usGpioLedHpna */
1598 + BP_GPIO_8_AH, /* usGpioLedWanData */
1599 + BP_GPIO_9_AH, /* usGpioLedPpp */
1600 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1601 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1602 + BP_GPIO_10_AH, /* usGpioLedBlAlarm */
1603 + BP_GPIO_9_AH, /* usGpioLedBlResetCfg */
1604 + BP_GPIO_8_AH, /* usGpioLedBlStop */
1605 + BP_NOT_DEFINED, /* usExtIntrWireless */
1606 + BP_EXT_INTR_0, /* usExtIntrAdslDyingGasp */
1607 + BP_NOT_DEFINED, /* usExtIntrHpna */
1608 + BP_NOT_DEFINED, /* usCsHpna */
1609 + BP_NOT_DEFINED, /* usAntInUseWireless */
1610 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1611 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1612 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1613 +};
1614 +
1615 +static PBOARD_PARAMETERS g_BoardParms[] =
1616 + {&g_bcm96345r, &g_bcm96345gw2, &g_bcm96345gw, &g_bcm96335r, &g_bcm96345r0,
1617 + &g_bcm96345rs, 0};
1618 +#endif
1619 +
1620 +#if defined(_BCM96348_) || defined(CONFIG_BCM96348)
1621 +
1622 +static BOARD_PARAMETERS g_bcm96348r =
1623 +{
1624 + "96348R", /* szBoardId */
1625 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1626 + 0x01, /* ucPhyAddress */
1627 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1628 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1629 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1630 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1631 + BP_NOT_DEFINED, /* usGpioPhyReset */
1632 + 0x01, /* numSwitchPorts */
1633 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1634 + BP_NOT_DEFINED}, /* usReverseMii */
1635 + {BP_ENET_NO_PHY}}, /* ucPhyType */
1636 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1637 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1638 + BP_MEMORY_8MB_1_CHIP, /* usSdramSize */
1639 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1640 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1641 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1642 + BP_GPIO_7_AH, /* usGpioPressAndHoldReset */
1643 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1644 + BP_NOT_DEFINED, /* usGpioUartRts */
1645 + BP_NOT_DEFINED, /* usGpioUartCts */
1646 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1647 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1648 + BP_NOT_DEFINED, /* usGpioLedWireless */
1649 + BP_NOT_DEFINED, /* usGpioLedUsb */
1650 + BP_NOT_DEFINED, /* usGpioLedHpna */
1651 + BP_GPIO_3_AL, /* usGpioLedWanData */
1652 + BP_GPIO_3_AL, /* usGpioLedPpp */
1653 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1654 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1655 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1656 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1657 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1658 + BP_NOT_DEFINED, /* usExtIntrWireless */
1659 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1660 + BP_NOT_DEFINED, /* usExtIntrHpna */
1661 + BP_NOT_DEFINED, /* usCsHpna */
1662 + BP_NOT_DEFINED, /* usAntInUseWireless */
1663 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1664 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1665 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1666 +};
1667 +
1668 +static BOARD_PARAMETERS g_bcm96348lv =
1669 +{
1670 + "96348LV", /* szBoardId */
1671 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1672 + 0x01, /* ucPhyAddress */
1673 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1674 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1675 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1676 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1677 + BP_NOT_DEFINED, /* usGpioPhyReset */
1678 + 0x01, /* numSwitchPorts */
1679 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1680 + BP_NOT_DEFINED}, /* usReverseMii */
1681 + {BP_ENET_EXTERNAL_PHY, /* ucPhyType */
1682 + 0x02, /* ucPhyAddress */
1683 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1684 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1685 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1686 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1687 + BP_GPIO_5_AL, /* usGpioPhyReset */
1688 + 0x01, /* numSwitchPorts */
1689 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1690 + BP_NOT_DEFINED}}, /* usReverseMii */
1691 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1692 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1693 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
1694 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1695 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1696 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1697 + BP_GPIO_7_AH, /* usGpioPressAndHoldReset */
1698 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1699 + BP_NOT_DEFINED, /* usGpioUartRts */
1700 + BP_NOT_DEFINED, /* usGpioUartCts */
1701 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1702 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1703 + BP_NOT_DEFINED, /* usGpioLedWireless */
1704 + BP_NOT_DEFINED, /* usGpioLedUsb */
1705 + BP_NOT_DEFINED, /* usGpioLedHpna */
1706 + BP_GPIO_3_AL, /* usGpioLedWanData */
1707 + BP_GPIO_3_AL, /* usGpioLedPpp */
1708 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1709 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1710 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1711 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1712 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1713 + BP_NOT_DEFINED, /* usExtIntrWireless */
1714 + BP_NOT_DEFINED, /* usExtIntrAdslDyingGasp */
1715 + BP_NOT_DEFINED, /* usExtIntrHpna */
1716 + BP_NOT_DEFINED, /* usCsHpna */
1717 + BP_NOT_DEFINED, /* usAntInUseWireless */
1718 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1719 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1720 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1721 +};
1722 +
1723 +static BOARD_PARAMETERS g_bcm96348gw =
1724 +{
1725 + "96348GW", /* szBoardId */
1726 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1727 + 0x01, /* ucPhyAddress */
1728 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1729 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1730 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1731 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1732 + BP_NOT_DEFINED, /* usGpioPhyReset */
1733 + 0x01, /* numSwitchPorts */
1734 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1735 + BP_NOT_DEFINED}, /* usReverseMii */
1736 + {BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1737 + 0x00, /* ucPhyAddress */
1738 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1739 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1740 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1741 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1742 + BP_NOT_DEFINED, /* usGpioPhyReset */
1743 + 0x03, /* numSwitchPorts */
1744 + BP_ENET_CONFIG_SPI_SSB_0, /* usConfigType */
1745 + BP_ENET_REVERSE_MII}}, /* usReverseMii */
1746 + {{BP_VOIP_DSP, /* ucDspType */
1747 + 0x00, /* ucDspAddress */
1748 + BP_EXT_INTR_2, /* usExtIntrVoip */
1749 + BP_GPIO_6_AH, /* usGpioVoipReset */
1750 + BP_GPIO_34_AH, /* usGpioVoipIntr */
1751 + BP_NOT_DEFINED, /* usGpioLedVoip */
1752 + BP_CS_2}, /* usCsVoip */
1753 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1754 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
1755 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1756 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1757 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1758 + BP_GPIO_33_AL, /* usGpioPressAndHoldReset */
1759 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1760 + BP_NOT_DEFINED, /* usGpioUartRts */
1761 + BP_NOT_DEFINED, /* usGpioUartCts */
1762 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1763 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1764 + BP_NOT_DEFINED, /* usGpioLedWireless */
1765 + BP_NOT_DEFINED, /* usGpioLedUsb */
1766 + BP_NOT_DEFINED, /* usGpioLedHpna */
1767 + BP_GPIO_3_AL, /* usGpioLedWanData */
1768 + BP_GPIO_3_AL, /* usGpioLedPpp */
1769 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1770 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1771 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1772 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1773 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1774 + BP_NOT_DEFINED, /* usExtIntrWireless */
1775 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1776 + BP_NOT_DEFINED, /* usExtIntrHpna */
1777 + BP_NOT_DEFINED, /* usCsHpna */
1778 + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */
1779 + BP_NOT_DEFINED, /* BP_GPIO_35_AH, */ /* usGpioSesBtnWireless */
1780 + BP_NOT_DEFINED, /* BP_EXT_INTR_3, */ /* usExtIntrSesBtnWireless */
1781 + BP_NOT_DEFINED /* BP_GPIO_0_AL */ /* usGpioLedSesWireless */
1782 +};
1783 +
1784 +
1785 +static BOARD_PARAMETERS g_bcm96348gw_10 =
1786 +{
1787 + "96348GW-10", /* szBoardId */
1788 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1789 + 0x01, /* ucPhyAddress */
1790 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1791 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1792 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1793 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1794 + BP_NOT_DEFINED, /* usGpioPhyReset */
1795 + 0x01, /* numSwitchPorts */
1796 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1797 + BP_NOT_DEFINED}, /* usReverseMii */
1798 + {BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1799 + 0x00, /* ucPhyAddress */
1800 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1801 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1802 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1803 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1804 + BP_NOT_DEFINED, /* usGpioPhyReset */
1805 + 0x03, /* numSwitchPorts */
1806 + BP_ENET_CONFIG_SPI_SSB_1, /* usConfigType */
1807 + BP_ENET_REVERSE_MII}}, /* usReverseMii */
1808 + {{BP_VOIP_DSP, /* ucDspType */
1809 + 0x00, /* ucDspAddress */
1810 + BP_EXT_INTR_2, /* usExtIntrVoip */
1811 + BP_GPIO_6_AH, /* usGpioVoipReset */
1812 + BP_GPIO_34_AH, /* usGpioVoipIntr */
1813 + BP_NOT_DEFINED, /* usGpioLedVoip */
1814 + BP_CS_2}, /* usCsVoip */
1815 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1816 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
1817 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1818 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1819 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1820 + BP_GPIO_33_AL, /* usGpioPressAndHoldReset */
1821 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1822 + BP_NOT_DEFINED, /* usGpioUartRts */
1823 + BP_NOT_DEFINED, /* usGpioUartCts */
1824 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1825 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1826 + BP_NOT_DEFINED, /* usGpioLedWireless */
1827 + BP_NOT_DEFINED, /* usGpioLedUsb */
1828 + BP_NOT_DEFINED, /* usGpioLedHpna */
1829 + BP_GPIO_3_AL, /* usGpioLedWanData */
1830 + BP_GPIO_3_AL, /* usGpioLedPpp */
1831 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1832 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1833 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1834 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1835 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1836 + BP_NOT_DEFINED, /* usExtIntrWireless */
1837 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1838 + BP_NOT_DEFINED, /* usExtIntrHpna */
1839 + BP_NOT_DEFINED, /* usCsHpna */
1840 + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */
1841 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1842 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1843 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1844 +};
1845 +
1846 +static BOARD_PARAMETERS g_bcm96348gw_11 =
1847 +{
1848 + "96348GW-11", /* szBoardId */
1849 + {{BP_ENET_NO_PHY}, /* ucPhyType */
1850 + {BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1851 + 0x00, /* ucPhyAddress */
1852 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1853 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1854 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1855 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1856 + BP_NOT_DEFINED, /* usGpioPhyReset */
1857 + 0x04, /* numSwitchPorts */
1858 + BP_ENET_CONFIG_SPI_SSB_1, /* usConfigType */
1859 + BP_ENET_REVERSE_MII}}, /* usReverseMii */
1860 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1861 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1862 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
1863 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1864 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1865 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1866 + BP_GPIO_33_AL, /* usGpioPressAndHoldReset */
1867 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1868 + BP_NOT_DEFINED, /* usGpioUartRts */
1869 + BP_NOT_DEFINED, /* usGpioUartCts */
1870 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1871 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1872 + BP_NOT_DEFINED, /* usGpioLedWireless */
1873 + BP_NOT_DEFINED, /* usGpioLedUsb */
1874 + BP_NOT_DEFINED, /* usGpioLedHpna */
1875 + BP_GPIO_3_AL, /* usGpioLedWanData */
1876 + BP_GPIO_3_AL, /* usGpioLedPpp */
1877 + BP_GPIO_4_AL, /* usGpioLedPppFail */
1878 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
1879 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1880 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
1881 + BP_GPIO_1_AL, /* usGpioLedBlStop */
1882 + BP_NOT_DEFINED, /* usExtIntrWireless */
1883 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1884 + BP_NOT_DEFINED, /* usExtIntrHpna */
1885 + BP_NOT_DEFINED, /* usCsHpna */
1886 + BP_NOT_DEFINED, /* usAntInUseWireless */
1887 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1888 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1889 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1890 +};
1891 +
1892 +static BOARD_PARAMETERS g_bcm96348sv =
1893 +{
1894 + "96348SV", /* szBoardId */
1895 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1896 + 0x01, /* ucPhyAddress */
1897 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1898 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1899 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1900 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1901 + BP_NOT_DEFINED, /* usGpioPhyReset */
1902 + 0x01, /* numSwitchPorts */
1903 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1904 + BP_NOT_DEFINED}, /* usReverseMii */
1905 + {BP_ENET_EXTERNAL_PHY, /* ucPhyType */
1906 + 0x1f, /* ucPhyAddress */
1907 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1908 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1909 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1910 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1911 + BP_NOT_DEFINED, /* usGpioPhyReset */
1912 + 0x01, /* numSwitchPorts */
1913 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1914 + BP_NOT_DEFINED}}, /* usReverseMii */
1915 + {{BP_VOIP_NO_DSP}, /* ucDspType */
1916 + {BP_VOIP_NO_DSP}}, /* ucDspType */
1917 + BP_MEMORY_32MB_2_CHIP, /* usSdramSize */
1918 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1919 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1920 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1921 + BP_NOT_DEFINED, /* usGpioPressAndHoldReset */
1922 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1923 + BP_NOT_DEFINED, /* usGpioUartRts */
1924 + BP_NOT_DEFINED, /* usGpioUartCts */
1925 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1926 + BP_NOT_DEFINED, /* usGpioLedAdslFail */
1927 + BP_NOT_DEFINED, /* usGpioLedWireless */
1928 + BP_NOT_DEFINED, /* usGpioLedUsb */
1929 + BP_NOT_DEFINED, /* usGpioLedHpna */
1930 + BP_NOT_DEFINED, /* usGpioLedWanData */
1931 + BP_NOT_DEFINED, /* usGpioLedPpp */
1932 + BP_NOT_DEFINED, /* usGpioLedPppFail */
1933 + BP_NOT_DEFINED, /* usGpioLedBlPowerOn */
1934 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
1935 + BP_NOT_DEFINED, /* usGpioLedBlResetCfg */
1936 + BP_NOT_DEFINED, /* usGpioLedBlStop */
1937 + BP_NOT_DEFINED, /* usExtIntrWireless */
1938 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
1939 + BP_NOT_DEFINED, /* usExtIntrHpna */
1940 + BP_NOT_DEFINED, /* usCsHpna */
1941 + BP_NOT_DEFINED, /* usAntInUseWireless */
1942 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
1943 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
1944 + BP_NOT_DEFINED /* usGpioLedSesWireless */
1945 +};
1946 +
1947 +
1948 +static BOARD_PARAMETERS g_bcm96348gw_dualDsp =
1949 +{
1950 + "96348GW-DualDSP", /* szBoardId */
1951 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
1952 + 0x01, /* ucPhyAddress */
1953 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1954 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1955 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1956 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1957 + BP_NOT_DEFINED, /* usGpioPhyReset */
1958 + 0x01, /* numSwitchPorts */
1959 + BP_ENET_CONFIG_MDIO, /* usConfigType */
1960 + BP_NOT_DEFINED}, /* usReverseMii */
1961 + {BP_ENET_EXTERNAL_SWITCH, /* ucPhyType */
1962 + 0x00, /* ucPhyAddress */
1963 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
1964 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
1965 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
1966 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
1967 + BP_NOT_DEFINED, /* usGpioPhyReset */
1968 + 0x03, /* numSwitchPorts */
1969 + BP_ENET_CONFIG_SPI_SSB_1, /* usConfigType */
1970 + BP_ENET_REVERSE_MII}}, /* usReverseMii */
1971 + {{BP_VOIP_DSP, /* ucDspType */
1972 + 0x00, /* ucDspAddress */
1973 + BP_EXT_INTR_2, /* usExtIntrVoip */
1974 + BP_UNEQUIPPED, /* usGpioVoipReset */
1975 + BP_GPIO_34_AH, /* usGpioVoipIntr */
1976 + BP_NOT_DEFINED, /* usGpioLedVoip */
1977 + BP_CS_2}, /* usCsVoip */
1978 + {BP_VOIP_DSP, /* ucDspType */
1979 + 0x01, /* ucDspAddress */
1980 + BP_EXT_INTR_3, /* usExtIntrVoip */
1981 + BP_UNEQUIPPED , /* usGpioVoipReset */
1982 + BP_GPIO_35_AH, /* usGpioVoipIntr */
1983 + BP_NOT_DEFINED, /* usGpioLedVoip */
1984 + BP_CS_3}}, /* usCsVoip */
1985 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
1986 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
1987 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
1988 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
1989 + BP_GPIO_33_AL, /* usGpioPressAndHoldReset */
1990 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
1991 + BP_NOT_DEFINED, /* usGpioUartRts */
1992 + BP_NOT_DEFINED, /* usGpioUartCts */
1993 + BP_NOT_DEFINED, /* usGpioLedAdsl */
1994 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
1995 + BP_NOT_DEFINED, /* usGpioLedWireless */
1996 + BP_NOT_DEFINED, /* usGpioLedUsb */
1997 + BP_NOT_DEFINED, /* usGpioLedHpna */
1998 + BP_GPIO_3_AL, /* usGpioLedWanData */
1999 + BP_GPIO_3_AL, /* usGpioLedPpp */
2000 + BP_GPIO_4_AL, /* usGpioLedPppFail */
2001 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
2002 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
2003 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
2004 + BP_GPIO_1_AL, /* usGpioLedBlStop */
2005 + BP_NOT_DEFINED, /* usExtIntrWireless */
2006 + BP_HW_DEFINED, /* usExtIntrAdslDyingGasp */
2007 + BP_NOT_DEFINED, /* usExtIntrHpna */
2008 + BP_NOT_DEFINED, /* usCsHpna */
2009 + BP_WLAN_ANT_MAIN, /* usAntInUseWireless */
2010 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
2011 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
2012 + BP_NOT_DEFINED /* usGpioLedSesWireless */
2013 +};
2014 +
2015 +
2016 +static BOARD_PARAMETERS g_bcmCustom_01 =
2017 +{
2018 + "BCMCUST_01", /* szBoardId */
2019 + {{BP_ENET_INTERNAL_PHY, /* ucPhyType */
2020 + 0x01, /* ucPhyAddress */
2021 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
2022 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
2023 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
2024 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
2025 + BP_NOT_DEFINED, /* usGpioPhyReset */
2026 + 0x01, /* numSwitchPorts */
2027 + BP_ENET_CONFIG_MDIO, /* usConfigType */
2028 + BP_NOT_DEFINED}, /* usReverseMii */
2029 + {BP_ENET_NO_PHY, /* ucPhyType */
2030 + 0x00, /* ucPhyAddress */
2031 + BP_NOT_DEFINED, /* usGpioPhySpiSck */
2032 + BP_NOT_DEFINED, /* usGpioPhySpiSs */
2033 + BP_NOT_DEFINED, /* usGpioPhySpiMosi */
2034 + BP_NOT_DEFINED, /* usGpioPhySpiMiso */
2035 + BP_NOT_DEFINED, /* usGpioPhyReset */
2036 + 0x01, /* numSwitchPorts */
2037 + BP_ENET_CONFIG_SPI_SSB_1, /* usConfigType */
2038 + BP_ENET_REVERSE_MII}}, /* usReverseMii */
2039 + {{BP_VOIP_DSP, /* ucDspType */
2040 + 0x00, /* ucDspAddress */
2041 + BP_EXT_INTR_2, /* usExtIntrVoip */
2042 + BP_GPIO_36_AH, /* usGpioVoipReset */
2043 + BP_GPIO_34_AL, /* usGpioVoipIntr */
2044 + BP_NOT_DEFINED, /* usGpioLedVoip */
2045 + BP_CS_2}, /* usCsVoip */
2046 + {BP_VOIP_NO_DSP}}, /* ucDspType */
2047 + BP_MEMORY_16MB_2_CHIP, /* usSdramSize */
2048 + BP_PSI_DEFAULT_SIZE, /* usPsiSize */
2049 + BP_NOT_DEFINED, /* usGpioRj11InnerPair */
2050 + BP_NOT_DEFINED, /* usGpioRj11OuterPair */
2051 + BP_GPIO_33_AL, /* usGpioPressAndHoldReset */
2052 + BP_NOT_DEFINED, /* usGpioPcmciaReset */
2053 + BP_NOT_DEFINED, /* usGpioUartRts */
2054 + BP_NOT_DEFINED, /* usGpioUartCts */
2055 + BP_NOT_DEFINED, /* usGpioLedAdsl */
2056 + BP_GPIO_2_AL, /* usGpioLedAdslFail */
2057 + BP_NOT_DEFINED, /* usGpioLedWireless */
2058 + BP_NOT_DEFINED, /* usGpioLedUsb */
2059 + BP_NOT_DEFINED, /* usGpioLedHpna */
2060 + BP_GPIO_3_AL, /* usGpioLedWanData */
2061 + BP_GPIO_3_AL, /* usGpioLedPpp */
2062 + BP_GPIO_4_AL, /* usGpioLedPppFail */
2063 + BP_GPIO_0_AL, /* usGpioLedBlPowerOn */
2064 + BP_NOT_DEFINED, /* usGpioLedBlAlarm */
2065 + BP_GPIO_3_AL, /* usGpioLedBlResetCfg */
2066 + BP_GPIO_1_AL, /* usGpioLedBlStop */
2067 + BP_NOT_DEFINED, /* usExtIntrWireless */
2068 + BP_NOT_DEFINED, /* usExtIntrAdslDyingGasp */
2069 + BP_NOT_DEFINED, /* usExtIntrHpna */
2070 + BP_NOT_DEFINED, /* usCsHpna */
2071 + BP_NOT_DEFINED, /* usAntInUseWireless */
2072 + BP_NOT_DEFINED, /* usGpioSesBtnWireless */
2073 + BP_NOT_DEFINED, /* usExtIntrSesBtnWireless */
2074 + BP_NOT_DEFINED /* usGpioLedSesWireless */
2075 +};
2076 +
2077 +static PBOARD_PARAMETERS g_BoardParms[] =
2078 + {&g_bcm96348r, &g_bcm96348lv, &g_bcm96348gw, &g_bcm96348gw_10,
2079 + &g_bcm96348gw_11, &g_bcm96348sv, &g_bcm96348gw_dualDsp,
2080 + &g_bcmCustom_01, 0};
2081 +#endif
2082 +
2083 +static PBOARD_PARAMETERS g_pCurrentBp = 0;
2084 +
2085 +/**************************************************************************
2086 + * Name : bpstrcmp
2087 + *
2088 + * Description: String compare for this file so it does not depend on an OS.
2089 + * (Linux kernel and CFE share this source file.)
2090 + *
2091 + * Parameters : [IN] dest - destination string
2092 + * [IN] src - source string
2093 + *
2094 + * Returns : -1 - dest < src, 1 - dest > src, 0 dest == src
2095 + ***************************************************************************/
2096 +static int bpstrcmp(const char *dest,const char *src);
2097 +static int bpstrcmp(const char *dest,const char *src)
2098 +{
2099 + while (*src && *dest)
2100 + {
2101 + if (*dest < *src) return -1;
2102 + if (*dest > *src) return 1;
2103 + dest++;
2104 + src++;
2105 + }
2106 +
2107 + if (*dest && !*src) return 1;
2108 + if (!*dest && *src) return -1;
2109 + return 0;
2110 +} /* bpstrcmp */
2111 +
2112 +/**************************************************************************
2113 + * Name : BpGetVoipDspConfig
2114 + *
2115 + * Description: Gets the DSP configuration from the board parameter
2116 + * structure for a given DSP index.
2117 + *
2118 + * Parameters : [IN] dspNum - DSP index (number)
2119 + *
2120 + * Returns : Pointer to DSP configuration block if found/valid, NULL
2121 + * otherwise.
2122 + ***************************************************************************/
2123 +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum );
2124 +VOIP_DSP_INFO *BpGetVoipDspConfig( unsigned char dspNum )
2125 +{
2126 + VOIP_DSP_INFO *pDspConfig = 0;
2127 + int i;
2128 +
2129 + if( g_pCurrentBp )
2130 + {
2131 + for( i = 0 ; i < BP_MAX_VOIP_DSP ; i++ )
2132 + {
2133 + if( g_pCurrentBp->VoIPDspInfo[i].ucDspType != BP_VOIP_NO_DSP &&
2134 + g_pCurrentBp->VoIPDspInfo[i].ucDspAddress == dspNum )
2135 + {
2136 + pDspConfig = &g_pCurrentBp->VoIPDspInfo[i];
2137 + break;
2138 + }
2139 + }
2140 + }
2141 +
2142 + return pDspConfig;
2143 +}
2144 +
2145 +
2146 +/**************************************************************************
2147 + * Name : BpSetBoardId
2148 + *
2149 + * Description: This function find the BOARD_PARAMETERS structure for the
2150 + * specified board id string and assigns it to a global, static
2151 + * variable.
2152 + *
2153 + * Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM.
2154 + *
2155 + * Returns : BP_SUCCESS - Success, value is returned.
2156 + * BP_BOARD_ID_NOT_FOUND - Error, board id input string does not
2157 + * have a board parameters configuration record.
2158 + ***************************************************************************/
2159 +int BpSetBoardId( char *pszBoardId )
2160 +{
2161 + int nRet = BP_BOARD_ID_NOT_FOUND;
2162 + PBOARD_PARAMETERS *ppBp;
2163 +
2164 + for( ppBp = g_BoardParms; *ppBp; ppBp++ )
2165 + {
2166 + if( !bpstrcmp((*ppBp)->szBoardId, pszBoardId) )
2167 + {
2168 + g_pCurrentBp = *ppBp;
2169 + nRet = BP_SUCCESS;
2170 + break;
2171 + }
2172 + }
2173 +
2174 + return( nRet );
2175 +} /* BpSetBoardId */
2176 +
2177 +/**************************************************************************
2178 + * Name : BpGetBoardIds
2179 + *
2180 + * Description: This function returns all of the supported board id strings.
2181 + *
2182 + * Parameters : [OUT] pszBoardIds - Address of a buffer that the board id
2183 + * strings are returned in. Each id starts at BP_BOARD_ID_LEN
2184 + * boundary.
2185 + * [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that
2186 + * were allocated in pszBoardIds.
2187 + *
2188 + * Returns : Number of board id strings returned.
2189 + ***************************************************************************/
2190 +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize )
2191 +{
2192 + PBOARD_PARAMETERS *ppBp;
2193 + int i;
2194 + char *src;
2195 + char *dest;
2196 +
2197 + for( i = 0, ppBp = g_BoardParms; *ppBp && nBoardIdsSize;
2198 + i++, ppBp++, nBoardIdsSize--, pszBoardIds += BP_BOARD_ID_LEN )
2199 + {
2200 + dest = pszBoardIds;
2201 + src = (*ppBp)->szBoardId;
2202 + while( *src )
2203 + *dest++ = *src++;
2204 + *dest = '\0';
2205 + }
2206 +
2207 + return( i );
2208 +} /* BpGetBoardIds */
2209 +
2210 +/**************************************************************************
2211 + * Name : BpGetEthernetMacInfo
2212 + *
2213 + * Description: This function returns all of the supported board id strings.
2214 + *
2215 + * Parameters : [OUT] pEnetInfos - Address of an array of ETHERNET_MAC_INFO
2216 + * buffers.
2217 + * [IN] nNumEnetInfos - Number of ETHERNET_MAC_INFO elements that
2218 + * are pointed to by pEnetInfos.
2219 + *
2220 + * Returns : BP_SUCCESS - Success, value is returned.
2221 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2222 + ***************************************************************************/
2223 +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos )
2224 +{
2225 + int i, nRet;
2226 +
2227 + if( g_pCurrentBp )
2228 + {
2229 + for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ )
2230 + {
2231 + if( i < BP_MAX_ENET_MACS )
2232 + {
2233 + unsigned char *src = (unsigned char *)
2234 + &g_pCurrentBp->EnetMacInfos[i];
2235 + unsigned char *dest = (unsigned char *) pEnetInfos;
2236 + int len = sizeof(ETHERNET_MAC_INFO);
2237 + while( len-- )
2238 + *dest++ = *src++;
2239 + }
2240 + else
2241 + pEnetInfos->ucPhyType = BP_ENET_NO_PHY;
2242 + }
2243 +
2244 + nRet = BP_SUCCESS;
2245 + }
2246 + else
2247 + {
2248 + for( i = 0; i < nNumEnetInfos; i++, pEnetInfos++ )
2249 + pEnetInfos->ucPhyType = BP_ENET_NO_PHY;
2250 +
2251 + nRet = BP_BOARD_ID_NOT_SET;
2252 + }
2253 +
2254 + return( nRet );
2255 +} /* BpGetEthernetMacInfo */
2256 +
2257 +/**************************************************************************
2258 + * Name : BpGetSdramSize
2259 + *
2260 + * Description: This function returns a constant that describees the board's
2261 + * SDRAM type and size.
2262 + *
2263 + * Parameters : [OUT] pulSdramSize - Address of short word that the SDRAM size
2264 + * is returned in.
2265 + *
2266 + * Returns : BP_SUCCESS - Success, value is returned.
2267 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2268 + ***************************************************************************/
2269 +int BpGetSdramSize( unsigned long *pulSdramSize )
2270 +{
2271 + int nRet;
2272 +
2273 + if( g_pCurrentBp )
2274 + {
2275 + *pulSdramSize = g_pCurrentBp->usSdramSize;
2276 + nRet = BP_SUCCESS;
2277 + }
2278 + else
2279 + {
2280 + *pulSdramSize = BP_NOT_DEFINED;
2281 + nRet = BP_BOARD_ID_NOT_SET;
2282 + }
2283 +
2284 + return( nRet );
2285 +} /* BpGetSdramSize */
2286 +
2287 +/**************************************************************************
2288 + * Name : BpGetPsiSize
2289 + *
2290 + * Description: This function returns the persistent storage size in K bytes.
2291 + *
2292 + * Parameters : [OUT] pulPsiSize - Address of short word that the persistent
2293 + * storage size is returned in.
2294 + *
2295 + * Returns : BP_SUCCESS - Success, value is returned.
2296 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2297 + ***************************************************************************/
2298 +int BpGetPsiSize( unsigned long *pulPsiSize )
2299 +{
2300 + int nRet;
2301 +
2302 + if( g_pCurrentBp )
2303 + {
2304 + *pulPsiSize = g_pCurrentBp->usPsiSize;
2305 + nRet = BP_SUCCESS;
2306 + }
2307 + else
2308 + {
2309 + *pulPsiSize = BP_NOT_DEFINED;
2310 + nRet = BP_BOARD_ID_NOT_SET;
2311 + }
2312 +
2313 + return( nRet );
2314 +} /* BpGetPsiSize */
2315 +
2316 +/**************************************************************************
2317 + * Name : BpGetRj11InnerOuterPairGpios
2318 + *
2319 + * Description: This function returns the GPIO pin assignments for changing
2320 + * between the RJ11 inner pair and RJ11 outer pair.
2321 + *
2322 + * Parameters : [OUT] pusInner - Address of short word that the RJ11 inner pair
2323 + * GPIO pin is returned in.
2324 + * [OUT] pusOuter - Address of short word that the RJ11 outer pair
2325 + * GPIO pin is returned in.
2326 + *
2327 + * Returns : BP_SUCCESS - Success, values are returned.
2328 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2329 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2330 + * for the board.
2331 + ***************************************************************************/
2332 +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner,
2333 + unsigned short *pusOuter )
2334 +{
2335 + int nRet;
2336 +
2337 + if( g_pCurrentBp )
2338 + {
2339 + *pusInner = g_pCurrentBp->usGpioRj11InnerPair;
2340 + *pusOuter = g_pCurrentBp->usGpioRj11OuterPair;
2341 +
2342 + if( g_pCurrentBp->usGpioRj11InnerPair != BP_NOT_DEFINED &&
2343 + g_pCurrentBp->usGpioRj11OuterPair != BP_NOT_DEFINED )
2344 + {
2345 + nRet = BP_SUCCESS;
2346 + }
2347 + else
2348 + {
2349 + nRet = BP_VALUE_NOT_DEFINED;
2350 + }
2351 + }
2352 + else
2353 + {
2354 + *pusInner = *pusOuter = BP_NOT_DEFINED;
2355 + nRet = BP_BOARD_ID_NOT_SET;
2356 + }
2357 +
2358 + return( nRet );
2359 +} /* BpGetRj11InnerOuterPairGpios */
2360 +
2361 +/**************************************************************************
2362 + * Name : BpGetPressAndHoldResetGpio
2363 + *
2364 + * Description: This function returns the GPIO pin assignment for the press
2365 + * and hold reset button.
2366 + *
2367 + * Parameters : [OUT] pusValue - Address of short word that the press and hold
2368 + * reset button GPIO pin is returned in.
2369 + *
2370 + * Returns : BP_SUCCESS - Success, value is returned.
2371 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2372 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2373 + * for the board.
2374 + ***************************************************************************/
2375 +int BpGetPressAndHoldResetGpio( unsigned short *pusValue )
2376 +{
2377 + int nRet;
2378 +
2379 + if( g_pCurrentBp )
2380 + {
2381 + *pusValue = g_pCurrentBp->usGpioPressAndHoldReset;
2382 +
2383 + if( g_pCurrentBp->usGpioPressAndHoldReset != BP_NOT_DEFINED )
2384 + {
2385 + nRet = BP_SUCCESS;
2386 + }
2387 + else
2388 + {
2389 + nRet = BP_VALUE_NOT_DEFINED;
2390 + }
2391 + }
2392 + else
2393 + {
2394 + *pusValue = BP_NOT_DEFINED;
2395 + nRet = BP_BOARD_ID_NOT_SET;
2396 + }
2397 +
2398 + return( nRet );
2399 +} /* BpGetPressAndHoldResetGpio */
2400 +
2401 +/**************************************************************************
2402 + * Name : BpGetVoipResetGpio
2403 + *
2404 + * Description: This function returns the GPIO pin assignment for the VOIP
2405 + * Reset operation.
2406 + *
2407 + * Parameters : [OUT] pusValue - Address of short word that the VOIP reset
2408 + * GPIO pin is returned in.
2409 + * [IN] dspNum - Address of the DSP to query.
2410 + *
2411 + * Returns : BP_SUCCESS - Success, value is returned.
2412 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2413 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2414 + * for the board.
2415 + ***************************************************************************/
2416 +int BpGetVoipResetGpio( unsigned char dspNum, unsigned short *pusValue )
2417 +{
2418 + int nRet;
2419 +
2420 + if( g_pCurrentBp )
2421 + {
2422 + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
2423 +
2424 + if( pDspInfo )
2425 + {
2426 + *pusValue = pDspInfo->usGpioVoipReset;
2427 +
2428 + if( *pusValue != BP_NOT_DEFINED ||
2429 + *pusValue == BP_UNEQUIPPED )
2430 + {
2431 + nRet = BP_SUCCESS;
2432 + }
2433 + else
2434 + {
2435 + nRet = BP_VALUE_NOT_DEFINED;
2436 + }
2437 + }
2438 + else
2439 + {
2440 + *pusValue = BP_NOT_DEFINED;
2441 + nRet = BP_BOARD_ID_NOT_FOUND;
2442 + }
2443 + }
2444 + else
2445 + {
2446 + *pusValue = BP_NOT_DEFINED;
2447 + nRet = BP_BOARD_ID_NOT_SET;
2448 + }
2449 +
2450 + return( nRet );
2451 +} /* BpGetVoipResetGpio */
2452 +
2453 +/**************************************************************************
2454 + * Name : BpGetVoipIntrGpio
2455 + *
2456 + * Description: This function returns the GPIO pin assignment for VoIP interrupt.
2457 + *
2458 + * Parameters : [OUT] pusValue - Address of short word that the VOIP interrupt
2459 + * GPIO pin is returned in.
2460 + * [IN] dspNum - Address of the DSP to query.
2461 + *
2462 + * Returns : BP_SUCCESS - Success, value is returned.
2463 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2464 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2465 + * for the board.
2466 + ***************************************************************************/
2467 +int BpGetVoipIntrGpio( unsigned char dspNum, unsigned short *pusValue )
2468 +{
2469 + int nRet;
2470 +
2471 + if( g_pCurrentBp )
2472 + {
2473 + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
2474 +
2475 + if( pDspInfo )
2476 + {
2477 + *pusValue = pDspInfo->usGpioVoipIntr;
2478 +
2479 + if( *pusValue != BP_NOT_DEFINED )
2480 + {
2481 + nRet = BP_SUCCESS;
2482 + }
2483 + else
2484 + {
2485 + nRet = BP_VALUE_NOT_DEFINED;
2486 + }
2487 + }
2488 + else
2489 + {
2490 + *pusValue = BP_NOT_DEFINED;
2491 + nRet = BP_BOARD_ID_NOT_FOUND;
2492 + }
2493 + }
2494 + else
2495 + {
2496 + *pusValue = BP_NOT_DEFINED;
2497 + nRet = BP_BOARD_ID_NOT_SET;
2498 + }
2499 +
2500 + return( nRet );
2501 +} /* BpGetVoipIntrGpio */
2502 +
2503 +/**************************************************************************
2504 + * Name : BpGetPcmciaResetGpio
2505 + *
2506 + * Description: This function returns the GPIO pin assignment for the PCMCIA
2507 + * Reset operation.
2508 + *
2509 + * Parameters : [OUT] pusValue - Address of short word that the PCMCIA reset
2510 + * GPIO pin is returned in.
2511 + *
2512 + * Returns : BP_SUCCESS - Success, value is returned.
2513 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2514 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2515 + * for the board.
2516 + ***************************************************************************/
2517 +int BpGetPcmciaResetGpio( unsigned short *pusValue )
2518 +{
2519 + int nRet;
2520 +
2521 + if( g_pCurrentBp )
2522 + {
2523 + *pusValue = g_pCurrentBp->usGpioPcmciaReset;
2524 +
2525 + if( g_pCurrentBp->usGpioPcmciaReset != BP_NOT_DEFINED )
2526 + {
2527 + nRet = BP_SUCCESS;
2528 + }
2529 + else
2530 + {
2531 + nRet = BP_VALUE_NOT_DEFINED;
2532 + }
2533 + }
2534 + else
2535 + {
2536 + *pusValue = BP_NOT_DEFINED;
2537 + nRet = BP_BOARD_ID_NOT_SET;
2538 + }
2539 +
2540 + return( nRet );
2541 +} /* BpGetPcmciaResetGpio */
2542 +
2543 +/**************************************************************************
2544 + * Name : BpGetUartRtsCtsGpios
2545 + *
2546 + * Description: This function returns the GPIO pin assignments for RTS and CTS
2547 + * UART signals.
2548 + *
2549 + * Parameters : [OUT] pusRts - Address of short word that the UART RTS GPIO
2550 + * pin is returned in.
2551 + * [OUT] pusCts - Address of short word that the UART CTS GPIO
2552 + * pin is returned in.
2553 + *
2554 + * Returns : BP_SUCCESS - Success, values are returned.
2555 + * BP_BOARD_ID_NOT_SET - Error, board id input string does not
2556 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2557 + * for the board.
2558 + ***************************************************************************/
2559 +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts )
2560 +{
2561 + int nRet;
2562 +
2563 + if( g_pCurrentBp )
2564 + {
2565 + *pusRts = g_pCurrentBp->usGpioUartRts;
2566 + *pusCts = g_pCurrentBp->usGpioUartCts;
2567 +
2568 + if( g_pCurrentBp->usGpioUartRts != BP_NOT_DEFINED &&
2569 + g_pCurrentBp->usGpioUartCts != BP_NOT_DEFINED )
2570 + {
2571 + nRet = BP_SUCCESS;
2572 + }
2573 + else
2574 + {
2575 + nRet = BP_VALUE_NOT_DEFINED;
2576 + }
2577 + }
2578 + else
2579 + {
2580 + *pusRts = *pusCts = BP_NOT_DEFINED;
2581 + nRet = BP_BOARD_ID_NOT_SET;
2582 + }
2583 +
2584 + return( nRet );
2585 +} /* BpGetUartRtsCtsGpios */
2586 +
2587 +/**************************************************************************
2588 + * Name : BpGetAdslLedGpio
2589 + *
2590 + * Description: This function returns the GPIO pin assignment for the ADSL
2591 + * LED.
2592 + *
2593 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
2594 + * GPIO pin is returned in.
2595 + *
2596 + * Returns : BP_SUCCESS - Success, value is returned.
2597 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2598 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2599 + * for the board.
2600 + ***************************************************************************/
2601 +int BpGetAdslLedGpio( unsigned short *pusValue )
2602 +{
2603 + int nRet;
2604 +
2605 + if( g_pCurrentBp )
2606 + {
2607 + *pusValue = g_pCurrentBp->usGpioLedAdsl;
2608 +
2609 + if( g_pCurrentBp->usGpioLedAdsl != BP_NOT_DEFINED )
2610 + {
2611 + nRet = BP_SUCCESS;
2612 + }
2613 + else
2614 + {
2615 + nRet = BP_VALUE_NOT_DEFINED;
2616 + }
2617 + }
2618 + else
2619 + {
2620 + *pusValue = BP_NOT_DEFINED;
2621 + nRet = BP_BOARD_ID_NOT_SET;
2622 + }
2623 +
2624 + return( nRet );
2625 +} /* BpGetAdslLedGpio */
2626 +
2627 +/**************************************************************************
2628 + * Name : BpGetAdslFailLedGpio
2629 + *
2630 + * Description: This function returns the GPIO pin assignment for the ADSL
2631 + * LED that is used when there is a DSL connection failure.
2632 + *
2633 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
2634 + * GPIO pin is returned in.
2635 + *
2636 + * Returns : BP_SUCCESS - Success, value is returned.
2637 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2638 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2639 + * for the board.
2640 + ***************************************************************************/
2641 +int BpGetAdslFailLedGpio( unsigned short *pusValue )
2642 +{
2643 + int nRet;
2644 +
2645 + if( g_pCurrentBp )
2646 + {
2647 + *pusValue = g_pCurrentBp->usGpioLedAdslFail;
2648 +
2649 + if( g_pCurrentBp->usGpioLedAdslFail != BP_NOT_DEFINED )
2650 + {
2651 + nRet = BP_SUCCESS;
2652 + }
2653 + else
2654 + {
2655 + nRet = BP_VALUE_NOT_DEFINED;
2656 + }
2657 + }
2658 + else
2659 + {
2660 + *pusValue = BP_NOT_DEFINED;
2661 + nRet = BP_BOARD_ID_NOT_SET;
2662 + }
2663 +
2664 + return( nRet );
2665 +} /* BpGetAdslFailLedGpio */
2666 +
2667 +/**************************************************************************
2668 + * Name : BpGetWirelessLedGpio
2669 + *
2670 + * Description: This function returns the GPIO pin assignment for the Wireless
2671 + * LED.
2672 + *
2673 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
2674 + * GPIO pin is returned in.
2675 + *
2676 + * Returns : BP_SUCCESS - Success, value is returned.
2677 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2678 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2679 + * for the board.
2680 + ***************************************************************************/
2681 +int BpGetWirelessLedGpio( unsigned short *pusValue )
2682 +{
2683 + int nRet;
2684 +
2685 + if( g_pCurrentBp )
2686 + {
2687 + *pusValue = g_pCurrentBp->usGpioLedWireless;
2688 +
2689 + if( g_pCurrentBp->usGpioLedWireless != BP_NOT_DEFINED )
2690 + {
2691 + nRet = BP_SUCCESS;
2692 + }
2693 + else
2694 + {
2695 + nRet = BP_VALUE_NOT_DEFINED;
2696 + }
2697 + }
2698 + else
2699 + {
2700 + *pusValue = BP_NOT_DEFINED;
2701 + nRet = BP_BOARD_ID_NOT_SET;
2702 + }
2703 +
2704 + return( nRet );
2705 +} /* BpGetWirelessLedGpio */
2706 +
2707 +/**************************************************************************
2708 + * Name : BpGetWirelessAntInUse
2709 + *
2710 + * Description: This function returns the antennas in use for wireless
2711 + *
2712 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Antenna
2713 + * is in use.
2714 + *
2715 + * Returns : BP_SUCCESS - Success, value is returned.
2716 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2717 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2718 + * for the board.
2719 + ***************************************************************************/
2720 +int BpGetWirelessAntInUse( unsigned short *pusValue )
2721 +{
2722 + int nRet;
2723 +
2724 + if( g_pCurrentBp )
2725 + {
2726 + *pusValue = g_pCurrentBp->usAntInUseWireless;
2727 +
2728 + if( g_pCurrentBp->usAntInUseWireless != BP_NOT_DEFINED )
2729 + {
2730 + nRet = BP_SUCCESS;
2731 + }
2732 + else
2733 + {
2734 + nRet = BP_VALUE_NOT_DEFINED;
2735 + }
2736 + }
2737 + else
2738 + {
2739 + *pusValue = BP_NOT_DEFINED;
2740 + nRet = BP_BOARD_ID_NOT_SET;
2741 + }
2742 +
2743 + return( nRet );
2744 +} /* BpGetWirelessAntInUse */
2745 +
2746 +/**************************************************************************
2747 + * Name : BpGetWirelessSesBtnGpio
2748 + *
2749 + * Description: This function returns the GPIO pin assignment for the Wireless
2750 + * Ses Button.
2751 + *
2752 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
2753 + * GPIO pin is returned in.
2754 + *
2755 + * Returns : BP_SUCCESS - Success, value is returned.
2756 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2757 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2758 + * for the board.
2759 + ***************************************************************************/
2760 +int BpGetWirelessSesBtnGpio( unsigned short *pusValue )
2761 +{
2762 + int nRet;
2763 +
2764 + if( g_pCurrentBp )
2765 + {
2766 + *pusValue = g_pCurrentBp->usGpioSesBtnWireless;
2767 +
2768 + if( g_pCurrentBp->usGpioSesBtnWireless != BP_NOT_DEFINED )
2769 + {
2770 + nRet = BP_SUCCESS;
2771 + }
2772 + else
2773 + {
2774 + nRet = BP_VALUE_NOT_DEFINED;
2775 + }
2776 + }
2777 + else
2778 + {
2779 + *pusValue = BP_NOT_DEFINED;
2780 + nRet = BP_BOARD_ID_NOT_SET;
2781 + }
2782 +
2783 + return( nRet );
2784 +} /* BpGetWirelessSesBtnGpio */
2785 +
2786 +/**************************************************************************
2787 + * Name : BpGetWirelessSesExtIntr
2788 + *
2789 + * Description: This function returns the external interrupt number for the
2790 + * Wireless Ses Button.
2791 + *
2792 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
2793 + * external interrup is returned in.
2794 + *
2795 + * Returns : BP_SUCCESS - Success, value is returned.
2796 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2797 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2798 + * for the board.
2799 + ***************************************************************************/
2800 +int BpGetWirelessSesExtIntr( unsigned short *pusValue )
2801 +{
2802 + int nRet;
2803 +
2804 + if( g_pCurrentBp )
2805 + {
2806 + *pusValue = g_pCurrentBp->usExtIntrSesBtnWireless;
2807 +
2808 + if( g_pCurrentBp->usExtIntrSesBtnWireless != BP_NOT_DEFINED )
2809 + {
2810 + nRet = BP_SUCCESS;
2811 + }
2812 + else
2813 + {
2814 + nRet = BP_VALUE_NOT_DEFINED;
2815 + }
2816 + }
2817 + else
2818 + {
2819 + *pusValue = BP_NOT_DEFINED;
2820 + nRet = BP_BOARD_ID_NOT_SET;
2821 + }
2822 +
2823 + return( nRet );
2824 +
2825 +} /* BpGetWirelessSesExtIntr */
2826 +
2827 +/**************************************************************************
2828 + * Name : BpGetWirelessSesLedGpio
2829 + *
2830 + * Description: This function returns the GPIO pin assignment for the Wireless
2831 + * Ses Led.
2832 + *
2833 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
2834 + * Led GPIO pin is returned in.
2835 + *
2836 + * Returns : BP_SUCCESS - Success, value is returned.
2837 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2838 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2839 + * for the board.
2840 + ***************************************************************************/
2841 +int BpGetWirelessSesLedGpio( unsigned short *pusValue )
2842 +{
2843 + int nRet;
2844 +
2845 + if( g_pCurrentBp )
2846 + {
2847 + *pusValue = g_pCurrentBp->usGpioLedSesWireless;
2848 +
2849 + if( g_pCurrentBp->usGpioLedSesWireless != BP_NOT_DEFINED )
2850 + {
2851 + nRet = BP_SUCCESS;
2852 + }
2853 + else
2854 + {
2855 + nRet = BP_VALUE_NOT_DEFINED;
2856 + }
2857 + }
2858 + else
2859 + {
2860 + *pusValue = BP_NOT_DEFINED;
2861 + nRet = BP_BOARD_ID_NOT_SET;
2862 + }
2863 +
2864 + return( nRet );
2865 +
2866 +} /* BpGetWirelessSesLedGpio */
2867 +
2868 +/**************************************************************************
2869 + * Name : BpGetUsbLedGpio
2870 + *
2871 + * Description: This function returns the GPIO pin assignment for the USB
2872 + * LED.
2873 + *
2874 + * Parameters : [OUT] pusValue - Address of short word that the USB LED
2875 + * GPIO pin is returned in.
2876 + *
2877 + * Returns : BP_SUCCESS - Success, value is returned.
2878 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2879 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2880 + * for the board.
2881 + ***************************************************************************/
2882 +int BpGetUsbLedGpio( unsigned short *pusValue )
2883 +{
2884 + int nRet;
2885 +
2886 + if( g_pCurrentBp )
2887 + {
2888 + *pusValue = g_pCurrentBp->usGpioLedUsb;
2889 +
2890 + if( g_pCurrentBp->usGpioLedUsb != BP_NOT_DEFINED )
2891 + {
2892 + nRet = BP_SUCCESS;
2893 + }
2894 + else
2895 + {
2896 + nRet = BP_VALUE_NOT_DEFINED;
2897 + }
2898 + }
2899 + else
2900 + {
2901 + *pusValue = BP_NOT_DEFINED;
2902 + nRet = BP_BOARD_ID_NOT_SET;
2903 + }
2904 +
2905 + return( nRet );
2906 +} /* BpGetUsbLedGpio */
2907 +
2908 +/**************************************************************************
2909 + * Name : BpGetHpnaLedGpio
2910 + *
2911 + * Description: This function returns the GPIO pin assignment for the HPNA
2912 + * LED.
2913 + *
2914 + * Parameters : [OUT] pusValue - Address of short word that the HPNA LED
2915 + * GPIO pin is returned in.
2916 + *
2917 + * Returns : BP_SUCCESS - Success, value is returned.
2918 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2919 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2920 + * for the board.
2921 + ***************************************************************************/
2922 +int BpGetHpnaLedGpio( unsigned short *pusValue )
2923 +{
2924 + int nRet;
2925 +
2926 + if( g_pCurrentBp )
2927 + {
2928 + *pusValue = g_pCurrentBp->usGpioLedHpna;
2929 +
2930 + if( g_pCurrentBp->usGpioLedHpna != BP_NOT_DEFINED )
2931 + {
2932 + nRet = BP_SUCCESS;
2933 + }
2934 + else
2935 + {
2936 + nRet = BP_VALUE_NOT_DEFINED;
2937 + }
2938 + }
2939 + else
2940 + {
2941 + *pusValue = BP_NOT_DEFINED;
2942 + nRet = BP_BOARD_ID_NOT_SET;
2943 + }
2944 +
2945 + return( nRet );
2946 +} /* BpGetHpnaLedGpio */
2947 +
2948 +/**************************************************************************
2949 + * Name : BpGetWanDataLedGpio
2950 + *
2951 + * Description: This function returns the GPIO pin assignment for the WAN Data
2952 + * LED.
2953 + *
2954 + * Parameters : [OUT] pusValue - Address of short word that the WAN Data LED
2955 + * GPIO pin is returned in.
2956 + *
2957 + * Returns : BP_SUCCESS - Success, value is returned.
2958 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2959 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
2960 + * for the board.
2961 + ***************************************************************************/
2962 +int BpGetWanDataLedGpio( unsigned short *pusValue )
2963 +{
2964 + int nRet;
2965 +
2966 + if( g_pCurrentBp )
2967 + {
2968 + *pusValue = g_pCurrentBp->usGpioLedWanData;
2969 +
2970 + if( g_pCurrentBp->usGpioLedWanData != BP_NOT_DEFINED )
2971 + {
2972 + nRet = BP_SUCCESS;
2973 + }
2974 + else
2975 + {
2976 + nRet = BP_VALUE_NOT_DEFINED;
2977 + }
2978 + }
2979 + else
2980 + {
2981 + *pusValue = BP_NOT_DEFINED;
2982 + nRet = BP_BOARD_ID_NOT_SET;
2983 + }
2984 +
2985 + return( nRet );
2986 +} /* BpGetWanDataLedGpio */
2987 +
2988 +/**************************************************************************
2989 + * Name : BpGetPppLedGpio
2990 + *
2991 + * Description: This function returns the GPIO pin assignment for the PPP
2992 + * LED.
2993 + *
2994 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
2995 + * GPIO pin is returned in.
2996 + *
2997 + * Returns : BP_SUCCESS - Success, value is returned.
2998 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
2999 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3000 + * for the board.
3001 + ***************************************************************************/
3002 +int BpGetPppLedGpio( unsigned short *pusValue )
3003 +{
3004 + int nRet;
3005 +
3006 + if( g_pCurrentBp )
3007 + {
3008 + *pusValue = g_pCurrentBp->usGpioLedPpp;
3009 +
3010 + if( g_pCurrentBp->usGpioLedPpp != BP_NOT_DEFINED )
3011 + {
3012 + nRet = BP_SUCCESS;
3013 + }
3014 + else
3015 + {
3016 + nRet = BP_VALUE_NOT_DEFINED;
3017 + }
3018 + }
3019 + else
3020 + {
3021 + *pusValue = BP_NOT_DEFINED;
3022 + nRet = BP_BOARD_ID_NOT_SET;
3023 + }
3024 +
3025 + return( nRet );
3026 +} /* BpGetPppLedGpio */
3027 +
3028 +/**************************************************************************
3029 + * Name : BpGetPppFailLedGpio
3030 + *
3031 + * Description: This function returns the GPIO pin assignment for the PPP
3032 + * LED that is used when there is a PPP connection failure.
3033 + *
3034 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
3035 + * GPIO pin is returned in.
3036 + *
3037 + * Returns : BP_SUCCESS - Success, value is returned.
3038 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3039 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3040 + * for the board.
3041 + ***************************************************************************/
3042 +int BpGetPppFailLedGpio( unsigned short *pusValue )
3043 +{
3044 + int nRet;
3045 +
3046 + if( g_pCurrentBp )
3047 + {
3048 + *pusValue = g_pCurrentBp->usGpioLedPppFail;
3049 +
3050 + if( g_pCurrentBp->usGpioLedPppFail != BP_NOT_DEFINED )
3051 + {
3052 + nRet = BP_SUCCESS;
3053 + }
3054 + else
3055 + {
3056 + nRet = BP_VALUE_NOT_DEFINED;
3057 + }
3058 + }
3059 + else
3060 + {
3061 + *pusValue = BP_NOT_DEFINED;
3062 + nRet = BP_BOARD_ID_NOT_SET;
3063 + }
3064 +
3065 + return( nRet );
3066 +} /* BpGetPppFailLedGpio */
3067 +
3068 +/**************************************************************************
3069 + * Name : BpGetBootloaderPowerOnLedGpio
3070 + *
3071 + * Description: This function returns the GPIO pin assignment for the power
3072 + * on LED that is set by the bootloader.
3073 + *
3074 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
3075 + * GPIO pin is returned in.
3076 + *
3077 + * Returns : BP_SUCCESS - Success, value is returned.
3078 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3079 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3080 + * for the board.
3081 + ***************************************************************************/
3082 +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue )
3083 +{
3084 + int nRet;
3085 +
3086 + if( g_pCurrentBp )
3087 + {
3088 + *pusValue = g_pCurrentBp->usGpioLedBlPowerOn;
3089 +
3090 + if( g_pCurrentBp->usGpioLedBlPowerOn != BP_NOT_DEFINED )
3091 + {
3092 + nRet = BP_SUCCESS;
3093 + }
3094 + else
3095 + {
3096 + nRet = BP_VALUE_NOT_DEFINED;
3097 + }
3098 + }
3099 + else
3100 + {
3101 + *pusValue = BP_NOT_DEFINED;
3102 + nRet = BP_BOARD_ID_NOT_SET;
3103 + }
3104 +
3105 + return( nRet );
3106 +} /* BpGetBootloaderPowerOn */
3107 +
3108 +/**************************************************************************
3109 + * Name : BpGetBootloaderAlarmLedGpio
3110 + *
3111 + * Description: This function returns the GPIO pin assignment for the alarm
3112 + * LED that is set by the bootloader.
3113 + *
3114 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
3115 + * GPIO pin is returned in.
3116 + *
3117 + * Returns : BP_SUCCESS - Success, value is returned.
3118 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3119 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3120 + * for the board.
3121 + ***************************************************************************/
3122 +int BpGetBootloaderAlarmLedGpio( unsigned short *pusValue )
3123 +{
3124 + int nRet;
3125 +
3126 + if( g_pCurrentBp )
3127 + {
3128 + *pusValue = g_pCurrentBp->usGpioLedBlAlarm;
3129 +
3130 + if( g_pCurrentBp->usGpioLedBlAlarm != BP_NOT_DEFINED )
3131 + {
3132 + nRet = BP_SUCCESS;
3133 + }
3134 + else
3135 + {
3136 + nRet = BP_VALUE_NOT_DEFINED;
3137 + }
3138 + }
3139 + else
3140 + {
3141 + *pusValue = BP_NOT_DEFINED;
3142 + nRet = BP_BOARD_ID_NOT_SET;
3143 + }
3144 +
3145 + return( nRet );
3146 +} /* BpGetBootloaderAlarmLedGpio */
3147 +
3148 +/**************************************************************************
3149 + * Name : BpGetBootloaderResetCfgLedGpio
3150 + *
3151 + * Description: This function returns the GPIO pin assignment for the reset
3152 + * configuration LED that is set by the bootloader.
3153 + *
3154 + * Parameters : [OUT] pusValue - Address of short word that the reset
3155 + * configuration LED GPIO pin is returned in.
3156 + *
3157 + * Returns : BP_SUCCESS - Success, value is returned.
3158 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3159 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3160 + * for the board.
3161 + ***************************************************************************/
3162 +int BpGetBootloaderResetCfgLedGpio( unsigned short *pusValue )
3163 +{
3164 + int nRet;
3165 +
3166 + if( g_pCurrentBp )
3167 + {
3168 + *pusValue = g_pCurrentBp->usGpioLedBlResetCfg;
3169 +
3170 + if( g_pCurrentBp->usGpioLedBlResetCfg != BP_NOT_DEFINED )
3171 + {
3172 + nRet = BP_SUCCESS;
3173 + }
3174 + else
3175 + {
3176 + nRet = BP_VALUE_NOT_DEFINED;
3177 + }
3178 + }
3179 + else
3180 + {
3181 + *pusValue = BP_NOT_DEFINED;
3182 + nRet = BP_BOARD_ID_NOT_SET;
3183 + }
3184 +
3185 + return( nRet );
3186 +} /* BpGetBootloaderResetCfgLedGpio */
3187 +
3188 +/**************************************************************************
3189 + * Name : BpGetBootloaderStopLedGpio
3190 + *
3191 + * Description: This function returns the GPIO pin assignment for the break
3192 + * into bootloader LED that is set by the bootloader.
3193 + *
3194 + * Parameters : [OUT] pusValue - Address of short word that the break into
3195 + * bootloader LED GPIO pin is returned in.
3196 + *
3197 + * Returns : BP_SUCCESS - Success, value is returned.
3198 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3199 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3200 + * for the board.
3201 + ***************************************************************************/
3202 +int BpGetBootloaderStopLedGpio( unsigned short *pusValue )
3203 +{
3204 + int nRet;
3205 +
3206 + if( g_pCurrentBp )
3207 + {
3208 + *pusValue = g_pCurrentBp->usGpioLedBlStop;
3209 +
3210 + if( g_pCurrentBp->usGpioLedBlStop != BP_NOT_DEFINED )
3211 + {
3212 + nRet = BP_SUCCESS;
3213 + }
3214 + else
3215 + {
3216 + nRet = BP_VALUE_NOT_DEFINED;
3217 + }
3218 + }
3219 + else
3220 + {
3221 + *pusValue = BP_NOT_DEFINED;
3222 + nRet = BP_BOARD_ID_NOT_SET;
3223 + }
3224 +
3225 + return( nRet );
3226 +} /* BpGetBootloaderStopLedGpio */
3227 +
3228 +/**************************************************************************
3229 + * Name : BpGetVoipLedGpio
3230 + *
3231 + * Description: This function returns the GPIO pin assignment for the VOIP
3232 + * LED.
3233 + *
3234 + * Parameters : [OUT] pusValue - Address of short word that the VOIP LED
3235 + * GPIO pin is returned in.
3236 + *
3237 + * Returns : BP_SUCCESS - Success, value is returned.
3238 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3239 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3240 + * for the board.
3241 + *
3242 + * Note : The VoIP structure would allow for having one LED per DSP
3243 + * however, the board initialization function assumes only one
3244 + * LED per functionality (ie one LED for VoIP). Therefore in
3245 + * order to keep this tidy and simple we do not make usage of the
3246 + * one-LED-per-DSP function. Instead, we assume that the LED for
3247 + * VoIP is unique and associated with DSP 0 (always present on
3248 + * any VoIP platform). If changing this to a LED-per-DSP function
3249 + * then one need to update the board initialization driver in
3250 + * bcmdrivers\opensource\char\board\bcm963xx\impl1
3251 + ***************************************************************************/
3252 +int BpGetVoipLedGpio( unsigned short *pusValue )
3253 +{
3254 + int nRet;
3255 +
3256 + if( g_pCurrentBp )
3257 + {
3258 + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( 0 );
3259 +
3260 + if( pDspInfo )
3261 + {
3262 + *pusValue = pDspInfo->usGpioLedVoip;
3263 +
3264 + if( *pusValue != BP_NOT_DEFINED )
3265 + {
3266 + nRet = BP_SUCCESS;
3267 + }
3268 + else
3269 + {
3270 + nRet = BP_VALUE_NOT_DEFINED;
3271 + }
3272 + }
3273 + else
3274 + {
3275 + *pusValue = BP_NOT_DEFINED;
3276 + nRet = BP_BOARD_ID_NOT_FOUND;
3277 + }
3278 + }
3279 + else
3280 + {
3281 + *pusValue = BP_NOT_DEFINED;
3282 + nRet = BP_BOARD_ID_NOT_SET;
3283 + }
3284 +
3285 + return( nRet );
3286 +} /* BpGetVoipLedGpio */
3287 +
3288 +/**************************************************************************
3289 + * Name : BpGetWirelessExtIntr
3290 + *
3291 + * Description: This function returns the Wireless external interrupt number.
3292 + *
3293 + * Parameters : [OUT] pulValue - Address of short word that the wireless
3294 + * external interrupt number is returned in.
3295 + *
3296 + * Returns : BP_SUCCESS - Success, value is returned.
3297 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3298 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3299 + * for the board.
3300 + ***************************************************************************/
3301 +int BpGetWirelessExtIntr( unsigned long *pulValue )
3302 +{
3303 + int nRet;
3304 +
3305 + if( g_pCurrentBp )
3306 + {
3307 + *pulValue = g_pCurrentBp->usExtIntrWireless;
3308 +
3309 + if( g_pCurrentBp->usExtIntrWireless != BP_NOT_DEFINED )
3310 + {
3311 + nRet = BP_SUCCESS;
3312 + }
3313 + else
3314 + {
3315 + nRet = BP_VALUE_NOT_DEFINED;
3316 + }
3317 + }
3318 + else
3319 + {
3320 + *pulValue = BP_NOT_DEFINED;
3321 + nRet = BP_BOARD_ID_NOT_SET;
3322 + }
3323 +
3324 + return( nRet );
3325 +} /* BpGetWirelessExtIntr */
3326 +
3327 +/**************************************************************************
3328 + * Name : BpGetAdslDyingGaspExtIntr
3329 + *
3330 + * Description: This function returns the ADSL Dying Gasp external interrupt
3331 + * number.
3332 + *
3333 + * Parameters : [OUT] pulValue - Address of short word that the ADSL Dying Gasp
3334 + * external interrupt number is returned in.
3335 + *
3336 + * Returns : BP_SUCCESS - Success, value is returned.
3337 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3338 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3339 + * for the board.
3340 + ***************************************************************************/
3341 +int BpGetAdslDyingGaspExtIntr( unsigned long *pulValue )
3342 +{
3343 + int nRet;
3344 +
3345 + if( g_pCurrentBp )
3346 + {
3347 + *pulValue = g_pCurrentBp->usExtIntrAdslDyingGasp;
3348 +
3349 + if( g_pCurrentBp->usExtIntrAdslDyingGasp != BP_NOT_DEFINED )
3350 + {
3351 + nRet = BP_SUCCESS;
3352 + }
3353 + else
3354 + {
3355 + nRet = BP_VALUE_NOT_DEFINED;
3356 + }
3357 + }
3358 + else
3359 + {
3360 + *pulValue = BP_NOT_DEFINED;
3361 + nRet = BP_BOARD_ID_NOT_SET;
3362 + }
3363 +
3364 + return( nRet );
3365 +} /* BpGetAdslDyingGaspExtIntr */
3366 +
3367 +/**************************************************************************
3368 + * Name : BpGetVoipExtIntr
3369 + *
3370 + * Description: This function returns the VOIP external interrupt number.
3371 + *
3372 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
3373 + * external interrupt number is returned in.
3374 + * [IN] dspNum - Address of the DSP to query.
3375 + *
3376 + * Returns : BP_SUCCESS - Success, value is returned.
3377 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3378 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3379 + * for the board.
3380 + ***************************************************************************/
3381 +int BpGetVoipExtIntr( unsigned char dspNum, unsigned long *pulValue )
3382 +{
3383 + int nRet;
3384 +
3385 + if( g_pCurrentBp )
3386 + {
3387 + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
3388 +
3389 + if( pDspInfo )
3390 + {
3391 + *pulValue = pDspInfo->usExtIntrVoip;
3392 +
3393 + if( *pulValue != BP_NOT_DEFINED )
3394 + {
3395 + nRet = BP_SUCCESS;
3396 + }
3397 + else
3398 + {
3399 + nRet = BP_VALUE_NOT_DEFINED;
3400 + }
3401 + }
3402 + else
3403 + {
3404 + *pulValue = BP_NOT_DEFINED;
3405 + nRet = BP_BOARD_ID_NOT_FOUND;
3406 + }
3407 + }
3408 + else
3409 + {
3410 + *pulValue = BP_NOT_DEFINED;
3411 + nRet = BP_BOARD_ID_NOT_SET;
3412 + }
3413 +
3414 + return( nRet );
3415 +} /* BpGetVoipExtIntr */
3416 +
3417 +/**************************************************************************
3418 + * Name : BpGetHpnaExtIntr
3419 + *
3420 + * Description: This function returns the HPNA external interrupt number.
3421 + *
3422 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
3423 + * external interrupt number is returned in.
3424 + *
3425 + * Returns : BP_SUCCESS - Success, value is returned.
3426 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3427 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3428 + * for the board.
3429 + ***************************************************************************/
3430 +int BpGetHpnaExtIntr( unsigned long *pulValue )
3431 +{
3432 + int nRet;
3433 +
3434 + if( g_pCurrentBp )
3435 + {
3436 + *pulValue = g_pCurrentBp->usExtIntrHpna;
3437 +
3438 + if( g_pCurrentBp->usExtIntrHpna != BP_NOT_DEFINED )
3439 + {
3440 + nRet = BP_SUCCESS;
3441 + }
3442 + else
3443 + {
3444 + nRet = BP_VALUE_NOT_DEFINED;
3445 + }
3446 + }
3447 + else
3448 + {
3449 + *pulValue = BP_NOT_DEFINED;
3450 + nRet = BP_BOARD_ID_NOT_SET;
3451 + }
3452 +
3453 + return( nRet );
3454 +} /* BpGetHpnaExtIntr */
3455 +
3456 +/**************************************************************************
3457 + * Name : BpGetHpnaChipSelect
3458 + *
3459 + * Description: This function returns the HPNA chip select number.
3460 + *
3461 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
3462 + * chip select number is returned in.
3463 + *
3464 + * Returns : BP_SUCCESS - Success, value is returned.
3465 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3466 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3467 + * for the board.
3468 + ***************************************************************************/
3469 +int BpGetHpnaChipSelect( unsigned long *pulValue )
3470 +{
3471 + int nRet;
3472 +
3473 + if( g_pCurrentBp )
3474 + {
3475 + *pulValue = g_pCurrentBp->usCsHpna;
3476 +
3477 + if( g_pCurrentBp->usCsHpna != BP_NOT_DEFINED )
3478 + {
3479 + nRet = BP_SUCCESS;
3480 + }
3481 + else
3482 + {
3483 + nRet = BP_VALUE_NOT_DEFINED;
3484 + }
3485 + }
3486 + else
3487 + {
3488 + *pulValue = BP_NOT_DEFINED;
3489 + nRet = BP_BOARD_ID_NOT_SET;
3490 + }
3491 +
3492 + return( nRet );
3493 +} /* BpGetHpnaChipSelect */
3494 +
3495 +/**************************************************************************
3496 + * Name : BpGetVoipChipSelect
3497 + *
3498 + * Description: This function returns the VOIP chip select number.
3499 + *
3500 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
3501 + * chip select number is returned in.
3502 + * [IN] dspNum - Address of the DSP to query.
3503 + *
3504 + * Returns : BP_SUCCESS - Success, value is returned.
3505 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3506 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3507 + * for the board.
3508 + ***************************************************************************/
3509 +int BpGetVoipChipSelect( unsigned char dspNum, unsigned long *pulValue )
3510 +{
3511 + int nRet;
3512 +
3513 + if( g_pCurrentBp )
3514 + {
3515 + VOIP_DSP_INFO *pDspInfo = BpGetVoipDspConfig( dspNum );
3516 +
3517 + if( pDspInfo )
3518 + {
3519 + *pulValue = pDspInfo->usCsVoip;
3520 +
3521 + if( *pulValue != BP_NOT_DEFINED )
3522 + {
3523 + nRet = BP_SUCCESS;
3524 + }
3525 + else
3526 + {
3527 + nRet = BP_VALUE_NOT_DEFINED;
3528 + }
3529 + }
3530 + else
3531 + {
3532 + *pulValue = BP_NOT_DEFINED;
3533 + nRet = BP_BOARD_ID_NOT_FOUND;
3534 + }
3535 + }
3536 + else
3537 + {
3538 + *pulValue = BP_NOT_DEFINED;
3539 + nRet = BP_BOARD_ID_NOT_SET;
3540 + }
3541 +
3542 + return( nRet );
3543 +} /* BpGetVoipChipSelect */
3544 +
3545 diff -urN linux.old/arch/mips/bcm963xx/boardparms.h linux.dev/arch/mips/bcm963xx/boardparms.h
3546 --- linux.old/arch/mips/bcm963xx/boardparms.h 1970-01-01 01:00:00.000000000 +0100
3547 +++ linux.dev/arch/mips/bcm963xx/boardparms.h 2006-08-25 00:39:38.000000000 +0200
3548 @@ -0,0 +1,758 @@
3549 +/*
3550 +<:copyright-gpl
3551 +
3552 + Copyright 2003 Broadcom Corp. All Rights Reserved.
3553 +
3554 + This program is free software; you can distribute it and/or modify it
3555 + under the terms of the GNU General Public License (Version 2) as
3556 + published by the Free Software Foundation.
3557 +
3558 + This program is distributed in the hope it will be useful, but WITHOUT
3559 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3560 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3561 + for more details.
3562 +
3563 + You should have received a copy of the GNU General Public License along
3564 + with this program; if not, write to the Free Software Foundation, Inc.,
3565 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
3566 +
3567 +:>
3568 +*/
3569 +/**************************************************************************
3570 + * File Name : boardparms.h
3571 + *
3572 + * Description: This file contains definitions and function prototypes for
3573 + * the BCM63xx board parameter access functions.
3574 + *
3575 + * Updates : 07/14/2003 Created.
3576 + ***************************************************************************/
3577 +
3578 +#if !defined(_BOARDPARMS_H)
3579 +#define _BOARDPARMS_H
3580 +
3581 +/* Return codes. */
3582 +#define BP_SUCCESS 0
3583 +#define BP_BOARD_ID_NOT_FOUND 1
3584 +#define BP_VALUE_NOT_DEFINED 2
3585 +#define BP_BOARD_ID_NOT_SET 3
3586 +
3587 +/* Values for BpGetSdramSize. */
3588 +#define BP_MEMORY_8MB_1_CHIP 0
3589 +#define BP_MEMORY_16MB_1_CHIP 1
3590 +#define BP_MEMORY_32MB_1_CHIP 2
3591 +#define BP_MEMORY_64MB_2_CHIP 3
3592 +#define BP_MEMORY_32MB_2_CHIP 4
3593 +#define BP_MEMORY_16MB_2_CHIP 5
3594 +
3595 +/* Values for EthernetMacInfo PhyType. */
3596 +#define BP_ENET_NO_PHY 0
3597 +#define BP_ENET_INTERNAL_PHY 1
3598 +#define BP_ENET_EXTERNAL_PHY 2
3599 +#define BP_ENET_EXTERNAL_SWITCH 3
3600 +
3601 +/* Values for EthernetMacInfo Configuration type. */
3602 +#define BP_ENET_CONFIG_MDIO 0 /* Internal PHY, External PHY, Switch+(no GPIO, no SPI, no MDIO Pseudo phy */
3603 +#define BP_ENET_CONFIG_GPIO 1 /* Bcm96345GW board + Bcm5325M/E */
3604 +#define BP_ENET_CONFIG_MDIO_PSEUDO_PHY 2 /* Bcm96348GW board + Bcm5325E */
3605 +#define BP_ENET_CONFIG_SPI_SSB_0 3 /* Bcm96348GW board + Bcm5325M/E */
3606 +#define BP_ENET_CONFIG_SPI_SSB_1 4 /* Bcm96348GW board + Bcm5325M/E */
3607 +#define BP_ENET_CONFIG_SPI_SSB_2 5 /* Bcm96348GW board + Bcm5325M/E */
3608 +#define BP_ENET_CONFIG_SPI_SSB_3 6 /* Bcm96348GW board + Bcm5325M/E */
3609 +
3610 +/* Values for EthernetMacInfo Reverse MII. */
3611 +#define BP_ENET_NO_REVERSE_MII 0
3612 +#define BP_ENET_REVERSE_MII 1
3613 +
3614 +/* Values for VoIPDSPInfo DSPType. */
3615 +#define BP_VOIP_NO_DSP 0
3616 +#define BP_VOIP_DSP 1
3617 +
3618 +
3619 +/* Values for GPIO pin assignments (AH = Active High, AL = Active Low). */
3620 +#define BP_ACTIVE_MASK 0x8000
3621 +#define BP_ACTIVE_HIGH 0x0000
3622 +#define BP_ACTIVE_LOW 0x8000
3623 +#define BP_GPIO_0_AH (0 | BP_ACTIVE_HIGH)
3624 +#define BP_GPIO_0_AL (0 | BP_ACTIVE_LOW)
3625 +#define BP_GPIO_1_AH (1 | BP_ACTIVE_HIGH)
3626 +#define BP_GPIO_1_AL (1 | BP_ACTIVE_LOW)
3627 +#define BP_GPIO_2_AH (2 | BP_ACTIVE_HIGH)
3628 +#define BP_GPIO_2_AL (2 | BP_ACTIVE_LOW)
3629 +#define BP_GPIO_3_AH (3 | BP_ACTIVE_HIGH)
3630 +#define BP_GPIO_3_AL (3 | BP_ACTIVE_LOW)
3631 +#define BP_GPIO_4_AH (4 | BP_ACTIVE_HIGH)
3632 +#define BP_GPIO_4_AL (4 | BP_ACTIVE_LOW)
3633 +#define BP_GPIO_5_AH (5 | BP_ACTIVE_HIGH)
3634 +#define BP_GPIO_5_AL (5 | BP_ACTIVE_LOW)
3635 +#define BP_GPIO_6_AH (6 | BP_ACTIVE_HIGH)
3636 +#define BP_GPIO_6_AL (6 | BP_ACTIVE_LOW)
3637 +#define BP_GPIO_7_AH (7 | BP_ACTIVE_HIGH)
3638 +#define BP_GPIO_7_AL (7 | BP_ACTIVE_LOW)
3639 +#define BP_GPIO_8_AH (8 | BP_ACTIVE_HIGH)
3640 +#define BP_GPIO_8_AL (8 | BP_ACTIVE_LOW)
3641 +#define BP_GPIO_9_AH (9 | BP_ACTIVE_HIGH)
3642 +#define BP_GPIO_9_AL (9 | BP_ACTIVE_LOW)
3643 +#define BP_GPIO_10_AH (10 | BP_ACTIVE_HIGH)
3644 +#define BP_GPIO_10_AL (10 | BP_ACTIVE_LOW)
3645 +#define BP_GPIO_11_AH (11 | BP_ACTIVE_HIGH)
3646 +#define BP_GPIO_11_AL (11 | BP_ACTIVE_LOW)
3647 +#define BP_GPIO_12_AH (12 | BP_ACTIVE_HIGH)
3648 +#define BP_GPIO_12_AL (12 | BP_ACTIVE_LOW)
3649 +#define BP_GPIO_13_AH (13 | BP_ACTIVE_HIGH)
3650 +#define BP_GPIO_13_AL (13 | BP_ACTIVE_LOW)
3651 +#define BP_GPIO_14_AH (14 | BP_ACTIVE_HIGH)
3652 +#define BP_GPIO_14_AL (14 | BP_ACTIVE_LOW)
3653 +#define BP_GPIO_15_AH (15 | BP_ACTIVE_HIGH)
3654 +#define BP_GPIO_15_AL (15 | BP_ACTIVE_LOW)
3655 +#define BP_GPIO_16_AH (16 | BP_ACTIVE_HIGH)
3656 +#define BP_GPIO_16_AL (16 | BP_ACTIVE_LOW)
3657 +#define BP_GPIO_17_AH (17 | BP_ACTIVE_HIGH)
3658 +#define BP_GPIO_17_AL (17 | BP_ACTIVE_LOW)
3659 +#define BP_GPIO_18_AH (18 | BP_ACTIVE_HIGH)
3660 +#define BP_GPIO_18_AL (18 | BP_ACTIVE_LOW)
3661 +#define BP_GPIO_19_AH (19 | BP_ACTIVE_HIGH)
3662 +#define BP_GPIO_19_AL (19 | BP_ACTIVE_LOW)
3663 +#define BP_GPIO_20_AH (20 | BP_ACTIVE_HIGH)
3664 +#define BP_GPIO_20_AL (20 | BP_ACTIVE_LOW)
3665 +#define BP_GPIO_21_AH (21 | BP_ACTIVE_HIGH)
3666 +#define BP_GPIO_21_AL (21 | BP_ACTIVE_LOW)
3667 +#define BP_GPIO_22_AH (22 | BP_ACTIVE_HIGH)
3668 +#define BP_GPIO_22_AL (22 | BP_ACTIVE_LOW)
3669 +#define BP_GPIO_23_AH (23 | BP_ACTIVE_HIGH)
3670 +#define BP_GPIO_23_AL (23 | BP_ACTIVE_LOW)
3671 +#define BP_GPIO_24_AH (24 | BP_ACTIVE_HIGH)
3672 +#define BP_GPIO_24_AL (24 | BP_ACTIVE_LOW)
3673 +#define BP_GPIO_25_AH (25 | BP_ACTIVE_HIGH)
3674 +#define BP_GPIO_25_AL (25 | BP_ACTIVE_LOW)
3675 +#define BP_GPIO_26_AH (26 | BP_ACTIVE_HIGH)
3676 +#define BP_GPIO_26_AL (26 | BP_ACTIVE_LOW)
3677 +#define BP_GPIO_27_AH (27 | BP_ACTIVE_HIGH)
3678 +#define BP_GPIO_27_AL (27 | BP_ACTIVE_LOW)
3679 +#define BP_GPIO_28_AH (28 | BP_ACTIVE_HIGH)
3680 +#define BP_GPIO_28_AL (28 | BP_ACTIVE_LOW)
3681 +#define BP_GPIO_29_AH (29 | BP_ACTIVE_HIGH)
3682 +#define BP_GPIO_29_AL (29 | BP_ACTIVE_LOW)
3683 +#define BP_GPIO_30_AH (30 | BP_ACTIVE_HIGH)
3684 +#define BP_GPIO_30_AL (30 | BP_ACTIVE_LOW)
3685 +#define BP_GPIO_31_AH (31 | BP_ACTIVE_HIGH)
3686 +#define BP_GPIO_31_AL (31 | BP_ACTIVE_LOW)
3687 +#define BP_GPIO_32_AH (32 | BP_ACTIVE_HIGH)
3688 +#define BP_GPIO_32_AL (32 | BP_ACTIVE_LOW)
3689 +#define BP_GPIO_33_AH (33 | BP_ACTIVE_HIGH)
3690 +#define BP_GPIO_33_AL (33 | BP_ACTIVE_LOW)
3691 +#define BP_GPIO_34_AH (34 | BP_ACTIVE_HIGH)
3692 +#define BP_GPIO_34_AL (34 | BP_ACTIVE_LOW)
3693 +#define BP_GPIO_35_AH (35 | BP_ACTIVE_HIGH)
3694 +#define BP_GPIO_35_AL (35 | BP_ACTIVE_LOW)
3695 +#define BP_GPIO_36_AH (36 | BP_ACTIVE_HIGH)
3696 +#define BP_GPIO_36_AL (36 | BP_ACTIVE_LOW)
3697 +
3698 +/* Values for external interrupt assignments. */
3699 +#define BP_EXT_INTR_0 0
3700 +#define BP_EXT_INTR_1 1
3701 +#define BP_EXT_INTR_2 2
3702 +#define BP_EXT_INTR_3 3
3703 +
3704 +/* Values for chip select assignments. */
3705 +#define BP_CS_0 0
3706 +#define BP_CS_1 1
3707 +#define BP_CS_2 2
3708 +#define BP_CS_3 3
3709 +
3710 +/* Value for GPIO and external interrupt fields that are not used. */
3711 +#define BP_NOT_DEFINED 0xffff
3712 +#define BP_HW_DEFINED 0xfff0
3713 +#define BP_UNEQUIPPED 0xfff1
3714 +
3715 +/* Maximum size of the board id string. */
3716 +#define BP_BOARD_ID_LEN 16
3717 +
3718 +/* Maximum number of Ethernet MACs. */
3719 +#define BP_MAX_ENET_MACS 2
3720 +
3721 +/* Maximum number of VoIP DSPs. */
3722 +#define BP_MAX_VOIP_DSP 2
3723 +
3724 +/* Wireless Antenna Settings. */
3725 +#define BP_WLAN_ANT_MAIN 0
3726 +#define BP_WLAN_ANT_AUX 1
3727 +#define BP_WLAN_ANT_BOTH 3
3728 +
3729 +#if !defined(__ASSEMBLER__)
3730 +
3731 +/* Information about an Ethernet MAC. If ucPhyType is BP_ENET_NO_PHY,
3732 + * then the other fields are not valid.
3733 + */
3734 +typedef struct EthernetMacInfo
3735 +{
3736 + unsigned char ucPhyType; /* BP_ENET_xxx */
3737 + unsigned char ucPhyAddress; /* 0 to 31 */
3738 + unsigned short usGpioPhySpiSck; /* GPIO pin or not defined */
3739 + unsigned short usGpioPhySpiSs; /* GPIO pin or not defined */
3740 + unsigned short usGpioPhySpiMosi; /* GPIO pin or not defined */
3741 + unsigned short usGpioPhySpiMiso; /* GPIO pin or not defined */
3742 + unsigned short usGpioPhyReset; /* GPIO pin or not defined (96348LV) */
3743 + unsigned short numSwitchPorts; /* Number of PHY ports */
3744 + unsigned short usConfigType; /* Configuration type */
3745 + unsigned short usReverseMii; /* Reverse MII */
3746 +} ETHERNET_MAC_INFO, *PETHERNET_MAC_INFO;
3747 +
3748 +
3749 +/* Information about VoIP DSPs. If ucDspType is BP_VOIP_NO_DSP,
3750 + * then the other fields are not valid.
3751 + */
3752 +typedef struct VoIPDspInfo
3753 +{
3754 + unsigned char ucDspType;
3755 + unsigned char ucDspAddress;
3756 + unsigned short usExtIntrVoip;
3757 + unsigned short usGpioVoipReset;
3758 + unsigned short usGpioVoipIntr;
3759 + unsigned short usGpioLedVoip;
3760 + unsigned short usCsVoip;
3761 +
3762 +} VOIP_DSP_INFO;
3763 +
3764 +
3765 +/**************************************************************************
3766 + * Name : BpSetBoardId
3767 + *
3768 + * Description: This function find the BOARD_PARAMETERS structure for the
3769 + * specified board id string and assigns it to a global, static
3770 + * variable.
3771 + *
3772 + * Parameters : [IN] pszBoardId - Board id string that is saved into NVRAM.
3773 + *
3774 + * Returns : BP_SUCCESS - Success, value is returned.
3775 + * BP_BOARD_ID_NOT_FOUND - Error, board id input string does not
3776 + * have a board parameters configuration record.
3777 + ***************************************************************************/
3778 +int BpSetBoardId( char *pszBoardId );
3779 +
3780 +/**************************************************************************
3781 + * Name : BpGetBoardIds
3782 + *
3783 + * Description: This function returns all of the supported board id strings.
3784 + *
3785 + * Parameters : [OUT] pszBoardIds - Address of a buffer that the board id
3786 + * strings are returned in. Each id starts at BP_BOARD_ID_LEN
3787 + * boundary.
3788 + * [IN] nBoardIdsSize - Number of BP_BOARD_ID_LEN elements that
3789 + * were allocated in pszBoardIds.
3790 + *
3791 + * Returns : Number of board id strings returned.
3792 + ***************************************************************************/
3793 +int BpGetBoardIds( char *pszBoardIds, int nBoardIdsSize );
3794 +
3795 +/**************************************************************************
3796 + * Name : BpGetEthernetMacInfo
3797 + *
3798 + * Description: This function returns all of the supported board id strings.
3799 + *
3800 + * Parameters : [OUT] pEnetInfos - Address of an array of ETHERNET_MAC_INFO
3801 + * buffers.
3802 + * [IN] nNumEnetInfos - Number of ETHERNET_MAC_INFO elements that
3803 + * are pointed to by pEnetInfos.
3804 + *
3805 + * Returns : BP_SUCCESS - Success, value is returned.
3806 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3807 + ***************************************************************************/
3808 +int BpGetEthernetMacInfo( PETHERNET_MAC_INFO pEnetInfos, int nNumEnetInfos );
3809 +
3810 +/**************************************************************************
3811 + * Name : BpGetSdramSize
3812 + *
3813 + * Description: This function returns a constant that describees the board's
3814 + * SDRAM type and size.
3815 + *
3816 + * Parameters : [OUT] pulSdramSize - Address of short word that the SDRAM size
3817 + * is returned in.
3818 + *
3819 + * Returns : BP_SUCCESS - Success, value is returned.
3820 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3821 + ***************************************************************************/
3822 +int BpGetSdramSize( unsigned long *pulSdramSize );
3823 +
3824 +/**************************************************************************
3825 + * Name : BpGetPsiSize
3826 + *
3827 + * Description: This function returns the persistent storage size in K bytes.
3828 + *
3829 + * Parameters : [OUT] pulPsiSize - Address of short word that the persistent
3830 + * storage size is returned in.
3831 + *
3832 + * Returns : BP_SUCCESS - Success, value is returned.
3833 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3834 + ***************************************************************************/
3835 +int BpGetPsiSize( unsigned long *pulPsiSize );
3836 +
3837 +/**************************************************************************
3838 + * Name : BpGetRj11InnerOuterPairGpios
3839 + *
3840 + * Description: This function returns the GPIO pin assignments for changing
3841 + * between the RJ11 inner pair and RJ11 outer pair.
3842 + *
3843 + * Parameters : [OUT] pusInner - Address of short word that the RJ11 inner pair
3844 + * GPIO pin is returned in.
3845 + * [OUT] pusOuter - Address of short word that the RJ11 outer pair
3846 + * GPIO pin is returned in.
3847 + *
3848 + * Returns : BP_SUCCESS - Success, values are returned.
3849 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3850 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3851 + * for the board.
3852 + ***************************************************************************/
3853 +int BpGetRj11InnerOuterPairGpios( unsigned short *pusInner,
3854 + unsigned short *pusOuter );
3855 +
3856 +/**************************************************************************
3857 + * Name : BpGetPressAndHoldResetGpio
3858 + *
3859 + * Description: This function returns the GPIO pin assignment for the press
3860 + * and hold reset button.
3861 + *
3862 + * Parameters : [OUT] pusValue - Address of short word that the press and hold
3863 + * reset button GPIO pin is returned in.
3864 + *
3865 + * Returns : BP_SUCCESS - Success, value is returned.
3866 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3867 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3868 + * for the board.
3869 + ***************************************************************************/
3870 +int BpGetPressAndHoldResetGpio( unsigned short *pusValue );
3871 +
3872 +/**************************************************************************
3873 + * Name : BpGetVoipResetGpio
3874 + *
3875 + * Description: This function returns the GPIO pin assignment for the VOIP
3876 + * Reset operation.
3877 + *
3878 + * Parameters : [OUT] pusValue - Address of short word that the VOIP reset
3879 + * GPIO pin is returned in.
3880 + * [IN] dspNum - Address of the DSP to query.
3881 + *
3882 + * Returns : BP_SUCCESS - Success, value is returned.
3883 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3884 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3885 + * for the board.
3886 + ***************************************************************************/
3887 +int BpGetVoipResetGpio( unsigned char dspNum, unsigned short *pusValue );
3888 +
3889 +/**************************************************************************
3890 + * Name : BpGetVoipIntrGpio
3891 + *
3892 + * Description: This function returns the GPIO pin assignment for VoIP interrupt.
3893 + *
3894 + * Parameters : [OUT] pusValue - Address of short word that the VOIP interrupt
3895 + * GPIO pin is returned in.
3896 + * [IN] dspNum - Address of the DSP to query.
3897 + *
3898 + * Returns : BP_SUCCESS - Success, value is returned.
3899 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3900 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3901 + * for the board.
3902 + ***************************************************************************/
3903 +int BpGetVoipIntrGpio( unsigned char dspNum, unsigned short *pusValue );
3904 +
3905 +/**************************************************************************
3906 + * Name : BpGetPcmciaResetGpio
3907 + *
3908 + * Description: This function returns the GPIO pin assignment for the PCMCIA
3909 + * Reset operation.
3910 + *
3911 + * Parameters : [OUT] pusValue - Address of short word that the PCMCIA reset
3912 + * GPIO pin is returned in.
3913 + *
3914 + * Returns : BP_SUCCESS - Success, value is returned.
3915 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3916 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3917 + * for the board.
3918 + ***************************************************************************/
3919 +int BpGetPcmciaResetGpio( unsigned short *pusValue );
3920 +
3921 +/**************************************************************************
3922 + * Name : BpGetUartRtsCtsGpios
3923 + *
3924 + * Description: This function returns the GPIO pin assignments for RTS and CTS
3925 + * UART signals.
3926 + *
3927 + * Parameters : [OUT] pusRts - Address of short word that the UART RTS GPIO
3928 + * pin is returned in.
3929 + * [OUT] pusCts - Address of short word that the UART CTS GPIO
3930 + * pin is returned in.
3931 + *
3932 + * Returns : BP_SUCCESS - Success, values are returned.
3933 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3934 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3935 + * for the board.
3936 + ***************************************************************************/
3937 +int BpGetRtsCtsUartGpios( unsigned short *pusRts, unsigned short *pusCts );
3938 +
3939 +/**************************************************************************
3940 + * Name : BpGetAdslLedGpio
3941 + *
3942 + * Description: This function returns the GPIO pin assignment for the ADSL
3943 + * LED.
3944 + *
3945 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
3946 + * GPIO pin is returned in.
3947 + *
3948 + * Returns : BP_SUCCESS - Success, value is returned.
3949 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3950 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3951 + * for the board.
3952 + ***************************************************************************/
3953 +int BpGetAdslLedGpio( unsigned short *pusValue );
3954 +
3955 +/**************************************************************************
3956 + * Name : BpGetAdslFailLedGpio
3957 + *
3958 + * Description: This function returns the GPIO pin assignment for the ADSL
3959 + * LED that is used when there is a DSL connection failure.
3960 + *
3961 + * Parameters : [OUT] pusValue - Address of short word that the ADSL LED
3962 + * GPIO pin is returned in.
3963 + *
3964 + * Returns : BP_SUCCESS - Success, value is returned.
3965 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3966 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3967 + * for the board.
3968 + ***************************************************************************/
3969 +int BpGetAdslFailLedGpio( unsigned short *pusValue );
3970 +
3971 +/**************************************************************************
3972 + * Name : BpGetWirelessLedGpio
3973 + *
3974 + * Description: This function returns the GPIO pin assignment for the Wireless
3975 + * LED.
3976 + *
3977 + * Parameters : [OUT] pusValue - Address of short word that the Wireless LED
3978 + * GPIO pin is returned in.
3979 + *
3980 + * Returns : BP_SUCCESS - Success, value is returned.
3981 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3982 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3983 + * for the board.
3984 + ***************************************************************************/
3985 +int BpGetWirelessLedGpio( unsigned short *pusValue );
3986 +
3987 +/**************************************************************************
3988 + * Name : BpGetWirelessAntInUse
3989 + *
3990 + * Description: This function returns the antennas in use for wireless
3991 + *
3992 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Antenna
3993 + * is in use.
3994 + *
3995 + * Returns : BP_SUCCESS - Success, value is returned.
3996 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
3997 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
3998 + * for the board.
3999 + ***************************************************************************/
4000 +int BpGetWirelessAntInUse( unsigned short *pusValue );
4001 +
4002 +/**************************************************************************
4003 + * Name : BpGetWirelessSesBtnGpio
4004 + *
4005 + * Description: This function returns the GPIO pin assignment for the Wireless
4006 + * Ses Button.
4007 + *
4008 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
4009 + * Button GPIO pin is returned in.
4010 + *
4011 + * Returns : BP_SUCCESS - Success, value is returned.
4012 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4013 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4014 + * for the board.
4015 + ***************************************************************************/
4016 +int BpGetWirelessSesBtnGpio( unsigned short *pusValue );
4017 +
4018 +/**************************************************************************
4019 + * Name : BpGetWirelessSesExtIntr
4020 + *
4021 + * Description: This function returns the external interrupt number for the
4022 + * Wireless Ses Button.
4023 + *
4024 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
4025 + * external interrup is returned in.
4026 + *
4027 + * Returns : BP_SUCCESS - Success, value is returned.
4028 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4029 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4030 + * for the board.
4031 + ***************************************************************************/
4032 +int BpGetWirelessSesExtIntr( unsigned short *pusValue );
4033 +
4034 +/**************************************************************************
4035 + * Name : BpGetWirelessSesLedGpio
4036 + *
4037 + * Description: This function returns the GPIO pin assignment for the Wireless
4038 + * Ses Led.
4039 + *
4040 + * Parameters : [OUT] pusValue - Address of short word that the Wireless Ses
4041 + * Led GPIO pin is returned in.
4042 + *
4043 + * Returns : BP_SUCCESS - Success, value is returned.
4044 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4045 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4046 + * for the board.
4047 + ***************************************************************************/
4048 +int BpGetWirelessSesLedGpio( unsigned short *pusValue );
4049 +
4050 +/**************************************************************************
4051 + * Name : BpGetUsbLedGpio
4052 + *
4053 + * Description: This function returns the GPIO pin assignment for the USB
4054 + * LED.
4055 + *
4056 + * Parameters : [OUT] pusValue - Address of short word that the USB LED
4057 + * GPIO pin is returned in.
4058 + *
4059 + * Returns : BP_SUCCESS - Success, value is returned.
4060 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4061 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4062 + * for the board.
4063 + ***************************************************************************/
4064 +int BpGetUsbLedGpio( unsigned short *pusValue );
4065 +
4066 +/**************************************************************************
4067 + * Name : BpGetHpnaLedGpio
4068 + *
4069 + * Description: This function returns the GPIO pin assignment for the HPNA
4070 + * LED.
4071 + *
4072 + * Parameters : [OUT] pusValue - Address of short word that the HPNA LED
4073 + * GPIO pin is returned in.
4074 + *
4075 + * Returns : BP_SUCCESS - Success, value is returned.
4076 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4077 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4078 + * for the board.
4079 + ***************************************************************************/
4080 +int BpGetHpnaLedGpio( unsigned short *pusValue );
4081 +
4082 +/**************************************************************************
4083 + * Name : BpGetWanDataLedGpio
4084 + *
4085 + * Description: This function returns the GPIO pin assignment for the WAN Data
4086 + * LED.
4087 + *
4088 + * Parameters : [OUT] pusValue - Address of short word that the WAN Data LED
4089 + * GPIO pin is returned in.
4090 + *
4091 + * Returns : BP_SUCCESS - Success, value is returned.
4092 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4093 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4094 + * for the board.
4095 + ***************************************************************************/
4096 +int BpGetWanDataLedGpio( unsigned short *pusValue );
4097 +
4098 +/**************************************************************************
4099 + * Name : BpGetPppLedGpio
4100 + *
4101 + * Description: This function returns the GPIO pin assignment for the PPP
4102 + * LED.
4103 + *
4104 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
4105 + * GPIO pin is returned in.
4106 + *
4107 + * Returns : BP_SUCCESS - Success, value is returned.
4108 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4109 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4110 + * for the board.
4111 + ***************************************************************************/
4112 +int BpGetPppLedGpio( unsigned short *pusValue );
4113 +
4114 +/**************************************************************************
4115 + * Name : BpGetPppFailLedGpio
4116 + *
4117 + * Description: This function returns the GPIO pin assignment for the PPP
4118 + * LED that is used when there is a PPP connection failure.
4119 + *
4120 + * Parameters : [OUT] pusValue - Address of short word that the PPP LED
4121 + * GPIO pin is returned in.
4122 + *
4123 + * Returns : BP_SUCCESS - Success, value is returned.
4124 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4125 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4126 + * for the board.
4127 + ***************************************************************************/
4128 +int BpGetPppFailLedGpio( unsigned short *pusValue );
4129 +
4130 +/**************************************************************************
4131 + * Name : BpGetVoipLedGpio
4132 + *
4133 + * Description: This function returns the GPIO pin assignment for the VOIP
4134 + * LED.
4135 + *
4136 + * Parameters : [OUT] pusValue - Address of short word that the VOIP LED
4137 + * GPIO pin is returned in.
4138 + *
4139 + * Returns : BP_SUCCESS - Success, value is returned.
4140 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4141 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4142 + * for the board.
4143 + ***************************************************************************/
4144 +int BpGetVoipLedGpio( unsigned short *pusValue );
4145 +
4146 +/**************************************************************************
4147 + * Name : BpGetBootloaderPowerOnLedGpio
4148 + *
4149 + * Description: This function returns the GPIO pin assignment for the power
4150 + * on LED that is set by the bootloader.
4151 + *
4152 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
4153 + * GPIO pin is returned in.
4154 + *
4155 + * Returns : BP_SUCCESS - Success, value is returned.
4156 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4157 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4158 + * for the board.
4159 + ***************************************************************************/
4160 +int BpGetBootloaderPowerOnLedGpio( unsigned short *pusValue );
4161 +
4162 +/**************************************************************************
4163 + * Name : BpGetBootloaderAlarmLedGpio
4164 + *
4165 + * Description: This function returns the GPIO pin assignment for the alarm
4166 + * LED that is set by the bootloader.
4167 + *
4168 + * Parameters : [OUT] pusValue - Address of short word that the alarm LED
4169 + * GPIO pin is returned in.
4170 + *
4171 + * Returns : BP_SUCCESS - Success, value is returned.
4172 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4173 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4174 + * for the board.
4175 + ***************************************************************************/
4176 +int BpGetBootloaderAlarmLedGpio( unsigned short *pusValue );
4177 +
4178 +/**************************************************************************
4179 + * Name : BpGetBootloaderResetCfgLedGpio
4180 + *
4181 + * Description: This function returns the GPIO pin assignment for the reset
4182 + * configuration LED that is set by the bootloader.
4183 + *
4184 + * Parameters : [OUT] pusValue - Address of short word that the reset
4185 + * configuration LED GPIO pin is returned in.
4186 + *
4187 + * Returns : BP_SUCCESS - Success, value is returned.
4188 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4189 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4190 + * for the board.
4191 + ***************************************************************************/
4192 +int BpGetBootloaderResetCfgLedGpio( unsigned short *pusValue );
4193 +
4194 +/**************************************************************************
4195 + * Name : BpGetBootloaderStopLedGpio
4196 + *
4197 + * Description: This function returns the GPIO pin assignment for the break
4198 + * into bootloader LED that is set by the bootloader.
4199 + *
4200 + * Parameters : [OUT] pusValue - Address of short word that the break into
4201 + * bootloader LED GPIO pin is returned in.
4202 + *
4203 + * Returns : BP_SUCCESS - Success, value is returned.
4204 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4205 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4206 + * for the board.
4207 + ***************************************************************************/
4208 +int BpGetBootloaderStopLedGpio( unsigned short *pusValue );
4209 +
4210 +/**************************************************************************
4211 + * Name : BpGetWirelessExtIntr
4212 + *
4213 + * Description: This function returns the Wireless external interrupt number.
4214 + *
4215 + * Parameters : [OUT] pulValue - Address of short word that the wireless
4216 + * external interrupt number is returned in.
4217 + *
4218 + * Returns : BP_SUCCESS - Success, value is returned.
4219 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4220 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4221 + * for the board.
4222 + ***************************************************************************/
4223 +int BpGetWirelessExtIntr( unsigned long *pulValue );
4224 +
4225 +/**************************************************************************
4226 + * Name : BpGetAdslDyingGaspExtIntr
4227 + *
4228 + * Description: This function returns the ADSL Dying Gasp external interrupt
4229 + * number.
4230 + *
4231 + * Parameters : [OUT] pulValue - Address of short word that the ADSL Dying Gasp
4232 + * external interrupt number is returned in.
4233 + *
4234 + * Returns : BP_SUCCESS - Success, value is returned.
4235 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4236 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4237 + * for the board.
4238 + ***************************************************************************/
4239 +int BpGetAdslDyingGaspExtIntr( unsigned long *pulValue );
4240 +
4241 +/**************************************************************************
4242 + * Name : BpGetVoipExtIntr
4243 + *
4244 + * Description: This function returns the VOIP external interrupt number.
4245 + *
4246 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
4247 + * external interrupt number is returned in.
4248 + * [IN] dspNum - Address of the DSP to query.
4249 + *
4250 + * Returns : BP_SUCCESS - Success, value is returned.
4251 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4252 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4253 + * for the board.
4254 + ***************************************************************************/
4255 +int BpGetVoipExtIntr( unsigned char dspNum, unsigned long *pulValue );
4256 +
4257 +/**************************************************************************
4258 + * Name : BpGetHpnaExtIntr
4259 + *
4260 + * Description: This function returns the HPNA external interrupt number.
4261 + *
4262 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
4263 + * external interrupt number is returned in.
4264 + *
4265 + * Returns : BP_SUCCESS - Success, value is returned.
4266 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4267 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4268 + * for the board.
4269 + ***************************************************************************/
4270 +int BpGetHpnaExtIntr( unsigned long *pulValue );
4271 +
4272 +/**************************************************************************
4273 + * Name : BpGetHpnaChipSelect
4274 + *
4275 + * Description: This function returns the HPNA chip select number.
4276 + *
4277 + * Parameters : [OUT] pulValue - Address of short word that the HPNA
4278 + * chip select number is returned in.
4279 + *
4280 + * Returns : BP_SUCCESS - Success, value is returned.
4281 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4282 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4283 + * for the board.
4284 + ***************************************************************************/
4285 +int BpGetHpnaChipSelect( unsigned long *pulValue );
4286 +
4287 +/**************************************************************************
4288 + * Name : BpGetVoipChipSelect
4289 + *
4290 + * Description: This function returns the VOIP chip select number.
4291 + *
4292 + * Parameters : [OUT] pulValue - Address of short word that the VOIP
4293 + * chip select number is returned in.
4294 + * [IN] dspNum - Address of the DSP to query.
4295 + *
4296 + * Returns : BP_SUCCESS - Success, value is returned.
4297 + * BP_BOARD_ID_NOT_SET - Error, BpSetBoardId has not been called.
4298 + * BP_VALUE_NOT_DEFINED - At least one return value is not defined
4299 + * for the board.
4300 + ***************************************************************************/
4301 +int BpGetVoipChipSelect( unsigned char dspNum, unsigned long *pulValue );
4302 +
4303 +#endif /* __ASSEMBLER__ */
4304 +
4305 +#endif /* _BOARDPARMS_H */
4306 +
4307 diff -urN linux.old/arch/mips/bcm963xx/include/6338_intr.h linux.dev/arch/mips/bcm963xx/include/6338_intr.h
4308 --- linux.old/arch/mips/bcm963xx/include/6338_intr.h 1970-01-01 01:00:00.000000000 +0100
4309 +++ linux.dev/arch/mips/bcm963xx/include/6338_intr.h 2006-08-25 00:39:38.000000000 +0200
4310 @@ -0,0 +1,64 @@
4311 +/*
4312 +<:copyright-gpl
4313 + Copyright 2003 Broadcom Corp. All Rights Reserved.
4314 +
4315 + This program is free software; you can distribute it and/or modify it
4316 + under the terms of the GNU General Public License (Version 2) as
4317 + published by the Free Software Foundation.
4318 +
4319 + This program is distributed in the hope it will be useful, but WITHOUT
4320 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4321 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4322 + for more details.
4323 +
4324 + You should have received a copy of the GNU General Public License along
4325 + with this program; if not, write to the Free Software Foundation, Inc.,
4326 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4327 +:>
4328 +*/
4329 +
4330 +#ifndef __6338_INTR_H
4331 +#define __6338_INTR_H
4332 +
4333 +/*=====================================================================*/
4334 +/* BCM6338 External Interrupt Level Assignments */
4335 +/*=====================================================================*/
4336 +#define INTERRUPT_ID_EXTERNAL_0 3
4337 +#define INTERRUPT_ID_EXTERNAL_1 4
4338 +#define INTERRUPT_ID_EXTERNAL_2 5
4339 +#define INTERRUPT_ID_EXTERNAL_3 6
4340 +
4341 +/*=====================================================================*/
4342 +/* BCM6338 Timer Interrupt Level Assignments */
4343 +/*=====================================================================*/
4344 +#define MIPS_TIMER_INT 7
4345 +
4346 +/*=====================================================================*/
4347 +/* Peripheral ISR Table Offset */
4348 +/*=====================================================================*/
4349 +#define INTERNAL_ISR_TABLE_OFFSET 8
4350 +
4351 +/*=====================================================================*/
4352 +/* Logical Peripheral Interrupt IDs */
4353 +/*=====================================================================*/
4354 +
4355 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
4356 +#define INTERRUPT_ID_SPI (INTERNAL_ISR_TABLE_OFFSET + 1)
4357 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
4358 +#define INTERRUPT_ID_DG (INTERNAL_ISR_TABLE_OFFSET + 4)
4359 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 5)
4360 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 6)
4361 +#define INTERRUPT_ID_USBS (INTERNAL_ISR_TABLE_OFFSET + 7)
4362 +#define INTERRUPT_ID_EMAC1 (INTERNAL_ISR_TABLE_OFFSET + 8)
4363 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 9)
4364 +#define INTERRUPT_ID_SDRAM (INTERNAL_ISR_TABLE_OFFSET + 10)
4365 +#define INTERRUPT_ID_USB_CNTL_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 11)
4366 +#define INTERRUPT_ID_USB_CNTL_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 12)
4367 +#define INTERRUPT_ID_USB_BULK_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 13)
4368 +#define INTERRUPT_ID_USB_BULK_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 14)
4369 +#define INTERRUPT_ID_EMAC1_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 15)
4370 +#define INTERRUPT_ID_EMAC1_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 16)
4371 +#define INTERRUPT_ID_SDIO (INTERNAL_ISR_TABLE_OFFSET + 17)
4372 +
4373 +#endif /* __BCM6338_H */
4374 +
4375 diff -urN linux.old/arch/mips/bcm963xx/include/6338_map_part.h linux.dev/arch/mips/bcm963xx/include/6338_map_part.h
4376 --- linux.old/arch/mips/bcm963xx/include/6338_map_part.h 1970-01-01 01:00:00.000000000 +0100
4377 +++ linux.dev/arch/mips/bcm963xx/include/6338_map_part.h 2006-08-25 00:39:38.000000000 +0200
4378 @@ -0,0 +1,334 @@
4379 +/*
4380 +<:copyright-gpl
4381 + Copyright 2004 Broadcom Corp. All Rights Reserved.
4382 +
4383 + This program is free software; you can distribute it and/or modify it
4384 + under the terms of the GNU General Public License (Version 2) as
4385 + published by the Free Software Foundation.
4386 +
4387 + This program is distributed in the hope it will be useful, but WITHOUT
4388 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4389 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4390 + for more details.
4391 +
4392 + You should have received a copy of the GNU General Public License along
4393 + with this program; if not, write to the Free Software Foundation, Inc.,
4394 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4395 +:>
4396 +*/
4397 +
4398 +#ifndef __BCM6338_MAP_H
4399 +#define __BCM6338_MAP_H
4400 +
4401 +#include "bcmtypes.h"
4402 +
4403 +#define PERF_BASE 0xfffe0000
4404 +#define TIMR_BASE 0xfffe0200
4405 +#define UART_BASE 0xfffe0300
4406 +#define GPIO_BASE 0xfffe0400
4407 +#define SPI_BASE 0xfffe0c00
4408 +
4409 +typedef struct PerfControl {
4410 + uint32 RevID;
4411 + uint16 testControl;
4412 + uint16 blkEnables;
4413 +#define EMAC_CLK_EN 0x0010
4414 +#define USBS_CLK_EN 0x0010
4415 +#define SAR_CLK_EN 0x0020
4416 +
4417 +#define SPI_CLK_EN 0x0200
4418 +
4419 + uint32 pll_control;
4420 +#define SOFT_RESET 0x00000001
4421 +
4422 + uint32 IrqMask;
4423 + uint32 IrqStatus;
4424 +
4425 + uint32 ExtIrqCfg;
4426 +#define EI_SENSE_SHFT 0
4427 +#define EI_STATUS_SHFT 5
4428 +#define EI_CLEAR_SHFT 10
4429 +#define EI_MASK_SHFT 15
4430 +#define EI_INSENS_SHFT 20
4431 +#define EI_LEVEL_SHFT 25
4432 +
4433 + uint32 unused[4]; /* (18) */
4434 + uint32 BlockSoftReset; /* (28) */
4435 +#define BSR_SPI 0x00000001
4436 +#define BSR_EMAC 0x00000004
4437 +#define BSR_USBH 0x00000008
4438 +#define BSR_USBS 0x00000010
4439 +#define BSR_ADSL 0x00000020
4440 +#define BSR_DMAMEM 0x00000040
4441 +#define BSR_SAR 0x00000080
4442 +#define BSR_ACLC 0x00000100
4443 +#define BSR_ADSL_MIPS_PLL 0x00000400
4444 +#define BSR_ALL_BLOCKS \
4445 + (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
4446 + BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL)
4447 +} PerfControl;
4448 +
4449 +#define PERF ((volatile PerfControl * const) PERF_BASE)
4450 +
4451 +
4452 +typedef struct Timer {
4453 + uint16 unused0;
4454 + byte TimerMask;
4455 +#define TIMER0EN 0x01
4456 +#define TIMER1EN 0x02
4457 +#define TIMER2EN 0x04
4458 + byte TimerInts;
4459 +#define TIMER0 0x01
4460 +#define TIMER1 0x02
4461 +#define TIMER2 0x04
4462 +#define WATCHDOG 0x08
4463 + uint32 TimerCtl0;
4464 + uint32 TimerCtl1;
4465 + uint32 TimerCtl2;
4466 +#define TIMERENABLE 0x80000000
4467 +#define RSTCNTCLR 0x40000000
4468 + uint32 TimerCnt0;
4469 + uint32 TimerCnt1;
4470 + uint32 TimerCnt2;
4471 + uint32 WatchDogDefCount;
4472 +
4473 + /* Write 0xff00 0x00ff to Start timer
4474 + * Write 0xee00 0x00ee to Stop and re-load default count
4475 + * Read from this register returns current watch dog count
4476 + */
4477 + uint32 WatchDogCtl;
4478 +
4479 + /* Number of 40-MHz ticks for WD Reset pulse to last */
4480 + uint32 WDResetCount;
4481 +} Timer;
4482 +
4483 +#define TIMER ((volatile Timer * const) TIMR_BASE)
4484 +typedef struct UartChannel {
4485 + byte unused0;
4486 + byte control;
4487 +#define BRGEN 0x80 /* Control register bit defs */
4488 +#define TXEN 0x40
4489 +#define RXEN 0x20
4490 +#define LOOPBK 0x10
4491 +#define TXPARITYEN 0x08
4492 +#define TXPARITYEVEN 0x04
4493 +#define RXPARITYEN 0x02
4494 +#define RXPARITYEVEN 0x01
4495 +
4496 + byte config;
4497 +#define XMITBREAK 0x40
4498 +#define BITS5SYM 0x00
4499 +#define BITS6SYM 0x10
4500 +#define BITS7SYM 0x20
4501 +#define BITS8SYM 0x30
4502 +#define ONESTOP 0x07
4503 +#define TWOSTOP 0x0f
4504 + /* 4-LSBS represent STOP bits/char
4505 + * in 1/8 bit-time intervals. Zero
4506 + * represents 1/8 stop bit interval.
4507 + * Fifteen represents 2 stop bits.
4508 + */
4509 + byte fifoctl;
4510 +#define RSTTXFIFOS 0x80
4511 +#define RSTRXFIFOS 0x40
4512 + /* 5-bit TimeoutCnt is in low bits of this register.
4513 + * This count represents the number of characters
4514 + * idle times before setting receive Irq when below threshold
4515 + */
4516 + uint32 baudword;
4517 + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
4518 + */
4519 +
4520 + byte txf_levl; /* Read-only fifo depth */
4521 + byte rxf_levl; /* Read-only fifo depth */
4522 + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are
4523 + * RxThreshold. Irq can be asserted
4524 + * when rx fifo> thresh, txfifo<thresh
4525 + */
4526 + byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
4527 + * if these bits are also enabled to GPIO_o
4528 + */
4529 +#define DTREN 0x01
4530 +#define RTSEN 0x02
4531 +
4532 + byte unused1;
4533 + byte DeltaIPEdgeNoSense; /* Low 4-bits, set corr bit to 1 to
4534 + * detect irq on rising AND falling
4535 + * edges for corresponding GPIO_i
4536 + * if enabled (edge insensitive)
4537 + */
4538 + byte DeltaIPConfig_Mask; /* Upper 4 bits: 1 for posedge sense
4539 + * 0 for negedge sense if
4540 + * not configured for edge
4541 + * insensitive (see above)
4542 + * Lower 4 bits: Mask to enable change
4543 + * detection IRQ for corresponding
4544 + * GPIO_i
4545 + */
4546 + byte DeltaIP_SyncIP; /* Upper 4 bits show which bits
4547 + * have changed (may set IRQ).
4548 + * read automatically clears bit
4549 + * Lower 4 bits are actual status
4550 + */
4551 +
4552 + uint16 intMask; /* Same Bit defs for Mask and status */
4553 + uint16 intStatus;
4554 +#define DELTAIP 0x0001
4555 +#define TXUNDERR 0x0002
4556 +#define TXOVFERR 0x0004
4557 +#define TXFIFOTHOLD 0x0008
4558 +#define TXREADLATCH 0x0010
4559 +#define TXFIFOEMT 0x0020
4560 +#define RXUNDERR 0x0040
4561 +#define RXOVFERR 0x0080
4562 +#define RXTIMEOUT 0x0100
4563 +#define RXFIFOFULL 0x0200
4564 +#define RXFIFOTHOLD 0x0400
4565 +#define RXFIFONE 0x0800
4566 +#define RXFRAMERR 0x1000
4567 +#define RXPARERR 0x2000
4568 +#define RXBRK 0x4000
4569 +
4570 + uint16 unused2;
4571 + uint16 Data; /* Write to TX, Read from RX */
4572 + /* bits 11:8 are BRK,PAR,FRM errors */
4573 +
4574 + uint32 unused3;
4575 + uint32 unused4;
4576 +} Uart;
4577 +
4578 +#define UART ((volatile Uart * const) UART_BASE)
4579 +
4580 +typedef struct GpioControl {
4581 + uint32 unused0;
4582 + uint32 GPIODir; /* bits 7:0 */
4583 + uint32 unused1;
4584 + uint32 GPIOio; /* bits 7:0 */
4585 + uint32 LEDCtrl;
4586 +#define LED3_STROBE 0x08000000
4587 +#define LED2_STROBE 0x04000000
4588 +#define LED1_STROBE 0x02000000
4589 +#define LED0_STROBE 0x01000000
4590 +#define LED_TEST 0x00010000
4591 +#define LED3_DISABLE_LINK_ACT 0x00008000
4592 +#define LED2_DISABLE_LINK_ACT 0x00004000
4593 +#define LED1_DISABLE_LINK_ACT 0x00002000
4594 +#define LED0_DISABLE_LINK_ACT 0x00001000
4595 +#define LED_INTERVAL_SET_MASK 0x00000f00
4596 +#define LED_INTERVAL_SET_320MS 0x00000500
4597 +#define LED_INTERVAL_SET_160MS 0x00000400
4598 +#define LED_INTERVAL_SET_80MS 0x00000300
4599 +#define LED_INTERVAL_SET_40MS 0x00000200
4600 +#define LED_INTERVAL_SET_20MS 0x00000100
4601 +#define LED3_ON 0x00000080
4602 +#define LED2_ON 0x00000040
4603 +#define LED1_ON 0x00000020
4604 +#define LED0_ON 0x00000010
4605 +#define LED3_ENABLE 0x00000008
4606 +#define LED2_ENABLE 0x00000004
4607 +#define LED1_ENABLE 0x00000002
4608 +#define LED0_ENABLE 0x00000001
4609 + uint32 SpiSlaveCfg;
4610 +#define SPI_SLAVE_RESET 0x00010000
4611 +#define SPI_RESTRICT 0x00000400
4612 +#define SPI_DELAY_DISABLE 0x00000200
4613 +#define SPI_PROBE_MUX_SEL_MASK 0x000001e0
4614 +#define SPI_SER_ADDR_CFG_MASK 0x0000000c
4615 +#define SPI_MODE 0x00000001
4616 + uint32 vRegConfig;
4617 +} GpioControl;
4618 +
4619 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
4620 +
4621 +/* Number to mask conversion macro used for GPIODir and GPIOio */
4622 +#define GPIO_NUM_MAX_BITS_MASK 0x0f
4623 +#define GPIO_NUM_TO_MASK(X) (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
4624 +
4625 +/*
4626 +** Spi Controller
4627 +*/
4628 +
4629 +typedef struct SpiControl {
4630 + uint16 spiCmd; /* (0x0): SPI command */
4631 +#define SPI_CMD_START_IMMEDIATE 3
4632 +
4633 +#define SPI_CMD_COMMAND_SHIFT 0
4634 +#define SPI_CMD_DEVICE_ID_SHIFT 4
4635 +#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8
4636 +
4637 + byte spiIntStatus; /* (0x2): SPI interrupt status */
4638 + byte spiMaskIntStatus; /* (0x3): SPI masked interrupt status */
4639 +
4640 + byte spiIntMask; /* (0x4): SPI interrupt mask */
4641 +#define SPI_INTR_CMD_DONE 0x01
4642 +#define SPI_INTR_CLEAR_ALL 0x1f
4643 +
4644 + byte spiStatus; /* (0x5): SPI status */
4645 +
4646 + byte spiClkCfg; /* (0x6): SPI clock configuration */
4647 +
4648 + byte spiFillByte; /* (0x7): SPI fill byte */
4649 +
4650 + byte unused0;
4651 + byte spiMsgTail; /* (0x9): msgtail */
4652 + byte unused1;
4653 + byte spiRxTail; /* (0xB): rxtail */
4654 +
4655 + uint32 unused2[13]; /* (0x0c - 0x3c) reserved */
4656 +
4657 + byte spiMsgCtl; /* (0x40) control byte */
4658 +#define HALF_DUPLEX_W 1
4659 +#define HALF_DUPLEX_R 2
4660 +#define SPI_MSG_TYPE_SHIFT 6
4661 +#define SPI_BYTE_CNT_SHIFT 0
4662 + byte spiMsgData[63]; /* (0x41 - 0x7f) msg data */
4663 + byte spiRxDataFifo[64]; /* (0x80 - 0xbf) rx data */
4664 + byte unused3[64]; /* (0xc0 - 0xff) reserved */
4665 +} SpiControl;
4666 +
4667 +#define SPI ((volatile SpiControl * const) SPI_BASE)
4668 +
4669 +/*
4670 +** External Bus Interface
4671 +*/
4672 +typedef struct EbiChipSelect {
4673 + uint32 base; /* base address in upper 24 bits */
4674 +#define EBI_SIZE_8K 0
4675 +#define EBI_SIZE_16K 1
4676 +#define EBI_SIZE_32K 2
4677 +#define EBI_SIZE_64K 3
4678 +#define EBI_SIZE_128K 4
4679 +#define EBI_SIZE_256K 5
4680 +#define EBI_SIZE_512K 6
4681 +#define EBI_SIZE_1M 7
4682 +#define EBI_SIZE_2M 8
4683 +#define EBI_SIZE_4M 9
4684 +#define EBI_SIZE_8M 10
4685 +#define EBI_SIZE_16M 11
4686 +#define EBI_SIZE_32M 12
4687 +#define EBI_SIZE_64M 13
4688 +#define EBI_SIZE_128M 14
4689 +#define EBI_SIZE_256M 15
4690 + uint32 config;
4691 +#define EBI_ENABLE 0x00000001 /* .. enable this range */
4692 +#define EBI_WAIT_STATES 0x0000000e /* .. mask for wait states */
4693 +#define EBI_WTST_SHIFT 1 /* .. for shifting wait states */
4694 +#define EBI_WORD_WIDE 0x00000010 /* .. 16-bit peripheral, else 8 */
4695 +#define EBI_WREN 0x00000020 /* enable posted writes */
4696 +#define EBI_POLARITY 0x00000040 /* .. set to invert something,
4697 + ** don't know what yet */
4698 +#define EBI_TS_TA_MODE 0x00000080 /* .. use TS/TA mode */
4699 +#define EBI_TS_SEL 0x00000100 /* .. drive tsize, not bs_b */
4700 +#define EBI_FIFO 0x00000200 /* .. use fifo */
4701 +#define EBI_RE 0x00000400 /* .. Reverse Endian */
4702 +} EbiChipSelect;
4703 +
4704 +typedef struct MpiRegisters {
4705 + EbiChipSelect cs[1]; /* size chip select configuration */
4706 +} MpiRegisters;
4707 +
4708 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
4709 +
4710 +
4711 +#endif
4712 +
4713 diff -urN linux.old/arch/mips/bcm963xx/include/6345_intr.h linux.dev/arch/mips/bcm963xx/include/6345_intr.h
4714 --- linux.old/arch/mips/bcm963xx/include/6345_intr.h 1970-01-01 01:00:00.000000000 +0100
4715 +++ linux.dev/arch/mips/bcm963xx/include/6345_intr.h 2006-08-25 00:39:38.000000000 +0200
4716 @@ -0,0 +1,72 @@
4717 +/*
4718 +<:copyright-gpl
4719 + Copyright 2002 Broadcom Corp. All Rights Reserved.
4720 +
4721 + This program is free software; you can distribute it and/or modify it
4722 + under the terms of the GNU General Public License (Version 2) as
4723 + published by the Free Software Foundation.
4724 +
4725 + This program is distributed in the hope it will be useful, but WITHOUT
4726 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4727 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4728 + for more details.
4729 +
4730 + You should have received a copy of the GNU General Public License along
4731 + with this program; if not, write to the Free Software Foundation, Inc.,
4732 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4733 +:>
4734 +*/
4735 +
4736 +#ifndef __6345_INTR_H
4737 +#define __6345_INTR_H
4738 +
4739 +
4740 +/*=====================================================================*/
4741 +/* BCM6345 External Interrupt Level Assignments */
4742 +/*=====================================================================*/
4743 +#define INTERRUPT_ID_EXTERNAL_0 3
4744 +#define INTERRUPT_ID_EXTERNAL_1 4
4745 +#define INTERRUPT_ID_EXTERNAL_2 5
4746 +#define INTERRUPT_ID_EXTERNAL_3 6
4747 +
4748 +/*=====================================================================*/
4749 +/* BCM6345 Timer Interrupt Level Assignments */
4750 +/*=====================================================================*/
4751 +#define MIPS_TIMER_INT 7
4752 +
4753 +/*=====================================================================*/
4754 +/* Peripheral ISR Table Offset */
4755 +/*=====================================================================*/
4756 +#define INTERNAL_ISR_TABLE_OFFSET 8
4757 +#define DMA_ISR_TABLE_OFFSET (INTERNAL_ISR_TABLE_OFFSET + 13)
4758 +
4759 +/*=====================================================================*/
4760 +/* Logical Peripheral Interrupt IDs */
4761 +/*=====================================================================*/
4762 +
4763 +/* Internal peripheral interrupt IDs */
4764 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
4765 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
4766 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 3)
4767 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 4)
4768 +#define INTERRUPT_ID_USB (INTERNAL_ISR_TABLE_OFFSET + 5)
4769 +#define INTERRUPT_ID_EMAC (INTERNAL_ISR_TABLE_OFFSET + 8)
4770 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 12)
4771 +
4772 +/* DMA channel interrupt IDs */
4773 +#define INTERRUPT_ID_EMAC_RX_CHAN (DMA_ISR_TABLE_OFFSET + EMAC_RX_CHAN)
4774 +#define INTERRUPT_ID_EMAC_TX_CHAN (DMA_ISR_TABLE_OFFSET + EMAC_TX_CHAN)
4775 +#define INTERRUPT_ID_EBI_RX_CHAN (DMA_ISR_TABLE_OFFSET + EBI_RX_CHAN)
4776 +#define INTERRUPT_ID_EBI_TX_CHAN (DMA_ISR_TABLE_OFFSET + EBI_TX_CHAN)
4777 +#define INTERRUPT_ID_RESERVED_RX_CHAN (DMA_ISR_TABLE_OFFSET + RESERVED_RX_CHAN)
4778 +#define INTERRUPT_ID_RESERVED_TX_CHAN (DMA_ISR_TABLE_OFFSET + RESERVED_TX_CHAN)
4779 +#define INTERRUPT_ID_USB_BULK_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_BULK_RX_CHAN)
4780 +#define INTERRUPT_ID_USB_BULK_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_BULK_TX_CHAN)
4781 +#define INTERRUPT_ID_USB_CNTL_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_CNTL_RX_CHAN)
4782 +#define INTERRUPT_ID_USB_CNTL_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_CNTL_TX_CHAN)
4783 +#define INTERRUPT_ID_USB_ISO_RX_CHAN (DMA_ISR_TABLE_OFFSET + USB_ISO_RX_CHAN)
4784 +#define INTERRUPT_ID_USB_ISO_TX_CHAN (DMA_ISR_TABLE_OFFSET + USB_ISO_TX_CHAN)
4785 +
4786 +
4787 +#endif /* __BCM6345_H */
4788 +
4789 diff -urN linux.old/arch/mips/bcm963xx/include/6345_map_part.h linux.dev/arch/mips/bcm963xx/include/6345_map_part.h
4790 --- linux.old/arch/mips/bcm963xx/include/6345_map_part.h 1970-01-01 01:00:00.000000000 +0100
4791 +++ linux.dev/arch/mips/bcm963xx/include/6345_map_part.h 2006-08-25 00:39:38.000000000 +0200
4792 @@ -0,0 +1,163 @@
4793 +/*
4794 +<:copyright-gpl
4795 + Copyright 2002 Broadcom Corp. All Rights Reserved.
4796 +
4797 + This program is free software; you can distribute it and/or modify it
4798 + under the terms of the GNU General Public License (Version 2) as
4799 + published by the Free Software Foundation.
4800 +
4801 + This program is distributed in the hope it will be useful, but WITHOUT
4802 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4803 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4804 + for more details.
4805 +
4806 + You should have received a copy of the GNU General Public License along
4807 + with this program; if not, write to the Free Software Foundation, Inc.,
4808 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4809 +:>
4810 +*/
4811 +
4812 +#ifndef __BCM6345_MAP_H
4813 +#define __BCM6345_MAP_H
4814 +
4815 +
4816 +#include "bcmtypes.h"
4817 +#include "6345_intr.h"
4818 +
4819 +typedef struct IntControl {
4820 + uint32 RevID;
4821 + uint16 testControl;
4822 + uint16 blkEnables;
4823 +#define USB_CLK_EN 0x0100
4824 +#define EMAC_CLK_EN 0x0080
4825 +#define UART_CLK_EN 0x0008
4826 +#define CPU_CLK_EN 0x0001
4827 +
4828 + uint32 pll_control;
4829 +#define SOFT_RESET 0x00000001
4830 +
4831 + uint32 IrqMask;
4832 + uint32 IrqStatus;
4833 +
4834 + uint32 ExtIrqCfg;
4835 +#define EI_SENSE_SHFT 0
4836 +#define EI_STATUS_SHFT 4
4837 +#define EI_CLEAR_SHFT 8
4838 +#define EI_MASK_SHFT 12
4839 +#define EI_INSENS_SHFT 16
4840 +#define EI_LEVEL_SHFT 20
4841 +} IntControl;
4842 +
4843 +#define INTC_BASE 0xfffe0000
4844 +#define PERF ((volatile IntControl * const) INTC_BASE)
4845 +
4846 +#define TIMR_BASE 0xfffe0200
4847 +typedef struct Timer {
4848 + uint16 unused0;
4849 + byte TimerMask;
4850 +#define TIMER0EN 0x01
4851 +#define TIMER1EN 0x02
4852 +#define TIMER2EN 0x04
4853 + byte TimerInts;
4854 +#define TIMER0 0x01
4855 +#define TIMER1 0x02
4856 +#define TIMER2 0x04
4857 +#define WATCHDOG 0x08
4858 + uint32 TimerCtl0;
4859 + uint32 TimerCtl1;
4860 + uint32 TimerCtl2;
4861 +#define TIMERENABLE 0x80000000
4862 +#define RSTCNTCLR 0x40000000
4863 + uint32 TimerCnt0;
4864 + uint32 TimerCnt1;
4865 + uint32 TimerCnt2;
4866 + uint32 WatchDogDefCount;
4867 +
4868 + /* Write 0xff00 0x00ff to Start timer
4869 + * Write 0xee00 0x00ee to Stop and re-load default count
4870 + * Read from this register returns current watch dog count
4871 + */
4872 + uint32 WatchDogCtl;
4873 +
4874 + /* Number of 40-MHz ticks for WD Reset pulse to last */
4875 + uint32 WDResetCount;
4876 +} Timer;
4877 +
4878 +#define TIMER ((volatile Timer * const) TIMR_BASE)
4879 +
4880 +typedef struct UartChannel {
4881 + byte unused0;
4882 + byte control;
4883 +#define BRGEN 0x80 /* Control register bit defs */
4884 +#define TXEN 0x40
4885 +#define RXEN 0x20
4886 +#define TXPARITYEN 0x08
4887 +#define TXPARITYEVEN 0x04
4888 +#define RXPARITYEN 0x02
4889 +#define RXPARITYEVEN 0x01
4890 + byte config;
4891 +#define BITS5SYM 0x00
4892 +#define BITS6SYM 0x10
4893 +#define BITS7SYM 0x20
4894 +#define BITS8SYM 0x30
4895 +#define XMITBREAK 0x40
4896 +#define ONESTOP 0x07
4897 +#define TWOSTOP 0x0f
4898 +
4899 + byte fifoctl;
4900 +#define RSTTXFIFOS 0x80
4901 +#define RSTRXFIFOS 0x40
4902 + uint32 baudword;
4903 +
4904 + byte txf_levl;
4905 + byte rxf_levl;
4906 + byte fifocfg;
4907 + byte prog_out;
4908 +
4909 + byte unused1;
4910 + byte DeltaIPEdgeNoSense;
4911 + byte DeltaIPConfig_Mask;
4912 + byte DeltaIP_SyncIP;
4913 + uint16 intMask;
4914 + uint16 intStatus;
4915 +#define TXUNDERR 0x0002
4916 +#define TXOVFERR 0x0004
4917 +#define TXFIFOEMT 0x0020
4918 +#define RXOVFERR 0x0080
4919 +#define RXFIFONE 0x0800
4920 +#define RXFRAMERR 0x1000
4921 +#define RXPARERR 0x2000
4922 +#define RXBRK 0x4000
4923 +
4924 + uint16 unused2;
4925 + uint16 Data;
4926 + uint32 unused3;
4927 + uint32 unused4;
4928 +} Uart;
4929 +
4930 +#define UART_BASE 0xfffe0300
4931 +#define UART ((volatile Uart * const) UART_BASE)
4932 +
4933 +typedef struct GpioControl {
4934 + uint16 unused0;
4935 + byte unused1;
4936 + byte TBusSel;
4937 +
4938 + uint16 unused2;
4939 + uint16 GPIODir;
4940 + byte unused3;
4941 + byte Leds;
4942 + uint16 GPIOio;
4943 +
4944 + uint32 UartCtl;
4945 +} GpioControl;
4946 +
4947 +#define GPIO_BASE 0xfffe0400
4948 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
4949 +
4950 +#define GPIO_NUM_MAX_BITS_MASK 0x0f
4951 +#define GPIO_NUM_TO_MASK(X) (1 << ((X) & GPIO_NUM_MAX_BITS_MASK))
4952 +
4953 +
4954 +#endif
4955 +
4956 diff -urN linux.old/arch/mips/bcm963xx/include/6348_intr.h linux.dev/arch/mips/bcm963xx/include/6348_intr.h
4957 --- linux.old/arch/mips/bcm963xx/include/6348_intr.h 1970-01-01 01:00:00.000000000 +0100
4958 +++ linux.dev/arch/mips/bcm963xx/include/6348_intr.h 2006-08-25 00:39:38.000000000 +0200
4959 @@ -0,0 +1,74 @@
4960 +/*
4961 +<:copyright-gpl
4962 + Copyright 2003 Broadcom Corp. All Rights Reserved.
4963 +
4964 + This program is free software; you can distribute it and/or modify it
4965 + under the terms of the GNU General Public License (Version 2) as
4966 + published by the Free Software Foundation.
4967 +
4968 + This program is distributed in the hope it will be useful, but WITHOUT
4969 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4970 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4971 + for more details.
4972 +
4973 + You should have received a copy of the GNU General Public License along
4974 + with this program; if not, write to the Free Software Foundation, Inc.,
4975 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
4976 +:>
4977 +*/
4978 +
4979 +#ifndef __6348_INTR_H
4980 +#define __6348_INTR_H
4981 +
4982 +
4983 +/*=====================================================================*/
4984 +/* BCM6348 External Interrupt Level Assignments */
4985 +/*=====================================================================*/
4986 +#define INTERRUPT_ID_EXTERNAL_0 3
4987 +#define INTERRUPT_ID_EXTERNAL_1 4
4988 +#define INTERRUPT_ID_EXTERNAL_2 5
4989 +#define INTERRUPT_ID_EXTERNAL_3 6
4990 +
4991 +/*=====================================================================*/
4992 +/* BCM6348 Timer Interrupt Level Assignments */
4993 +/*=====================================================================*/
4994 +#define MIPS_TIMER_INT 7
4995 +
4996 +/*=====================================================================*/
4997 +/* Peripheral ISR Table Offset */
4998 +/*=====================================================================*/
4999 +#define INTERNAL_ISR_TABLE_OFFSET 8
5000 +
5001 +/*=====================================================================*/
5002 +/* Logical Peripheral Interrupt IDs */
5003 +/*=====================================================================*/
5004 +
5005 +#define INTERRUPT_ID_TIMER (INTERNAL_ISR_TABLE_OFFSET + 0)
5006 +#define INTERRUPT_ID_SPI (INTERNAL_ISR_TABLE_OFFSET + 1)
5007 +#define INTERRUPT_ID_UART (INTERNAL_ISR_TABLE_OFFSET + 2)
5008 +#define INTERRUPT_ID_ADSL (INTERNAL_ISR_TABLE_OFFSET + 4)
5009 +#define INTERRUPT_ID_ATM (INTERNAL_ISR_TABLE_OFFSET + 5)
5010 +#define INTERRUPT_ID_USBS (INTERNAL_ISR_TABLE_OFFSET + 6)
5011 +#define INTERRUPT_ID_EMAC2 (INTERNAL_ISR_TABLE_OFFSET + 7)
5012 +#define INTERRUPT_ID_EMAC1 (INTERNAL_ISR_TABLE_OFFSET + 8)
5013 +#define INTERRUPT_ID_EPHY (INTERNAL_ISR_TABLE_OFFSET + 9)
5014 +#define INTERRUPT_ID_M2M (INTERNAL_ISR_TABLE_OFFSET + 10)
5015 +#define INTERRUPT_ID_ACLC (INTERNAL_ISR_TABLE_OFFSET + 11)
5016 +#define INTERRUPT_ID_USBH (INTERNAL_ISR_TABLE_OFFSET + 12)
5017 +#define INTERRUPT_ID_SDRAM (INTERNAL_ISR_TABLE_OFFSET + 13)
5018 +#define INTERRUPT_ID_USB_CNTL_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 14)
5019 +#define INTERRUPT_ID_USB_CNTL_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 15)
5020 +#define INTERRUPT_ID_USB_BULK_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 16)
5021 +#define INTERRUPT_ID_USB_BULK_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 17)
5022 +#define INTERRUPT_ID_USB_ISO_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 18)
5023 +#define INTERRUPT_ID_USB_ISO_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 19)
5024 +#define INTERRUPT_ID_EMAC1_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 20)
5025 +#define INTERRUPT_ID_EMAC1_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 21)
5026 +#define INTERRUPT_ID_EMAC2_RX_DMA (INTERNAL_ISR_TABLE_OFFSET + 22)
5027 +#define INTERRUPT_ID_EMAC2_TX_DMA (INTERNAL_ISR_TABLE_OFFSET + 23)
5028 +#define INTERRUPT_ID_MPI (INTERNAL_ISR_TABLE_OFFSET + 24)
5029 +#define INTERRUPT_ID_DG (INTERNAL_ISR_TABLE_OFFSET + 25)
5030 +
5031 +
5032 +#endif /* __BCM6348_H */
5033 +
5034 diff -urN linux.old/arch/mips/bcm963xx/include/6348_map_part.h linux.dev/arch/mips/bcm963xx/include/6348_map_part.h
5035 --- linux.old/arch/mips/bcm963xx/include/6348_map_part.h 1970-01-01 01:00:00.000000000 +0100
5036 +++ linux.dev/arch/mips/bcm963xx/include/6348_map_part.h 2006-08-25 00:39:38.000000000 +0200
5037 @@ -0,0 +1,500 @@
5038 +/*
5039 +<:copyright-gpl
5040 + Copyright 2002 Broadcom Corp. All Rights Reserved.
5041 +
5042 + This program is free software; you can distribute it and/or modify it
5043 + under the terms of the GNU General Public License (Version 2) as
5044 + published by the Free Software Foundation.
5045 +
5046 + This program is distributed in the hope it will be useful, but WITHOUT
5047 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5048 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5049 + for more details.
5050 +
5051 + You should have received a copy of the GNU General Public License along
5052 + with this program; if not, write to the Free Software Foundation, Inc.,
5053 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5054 +:>
5055 +*/
5056 +
5057 +#ifndef __BCM6348_MAP_H
5058 +#define __BCM6348_MAP_H
5059 +
5060 +#include "bcmtypes.h"
5061 +
5062 +#define PERF_BASE 0xfffe0000
5063 +#define TIMR_BASE 0xfffe0200
5064 +#define UART_BASE 0xfffe0300
5065 +#define GPIO_BASE 0xfffe0400
5066 +#define MPI_BASE 0xfffe2000 /* MPI control registers */
5067 +#define USB_HOST_BASE 0xfffe1b00 /* USB host registers */
5068 +#define USB_HOST_NON_OHCI 0xfffe1c00 /* USB host non-OHCI registers */
5069 +
5070 +typedef struct PerfControl {
5071 + uint32 RevID;
5072 + uint16 testControl;
5073 + uint16 blkEnables;
5074 +#define EMAC_CLK_EN 0x0010
5075 +#define SAR_CLK_EN 0x0020
5076 +#define USBS_CLK_EN 0x0040
5077 +#define USBH_CLK_EN 0x0100
5078 +
5079 + uint32 pll_control;
5080 +#define SOFT_RESET 0x00000001
5081 +
5082 + uint32 IrqMask;
5083 + uint32 IrqStatus;
5084 +
5085 + uint32 ExtIrqCfg;
5086 +#define EI_SENSE_SHFT 0
5087 +#define EI_STATUS_SHFT 5
5088 +#define EI_CLEAR_SHFT 10
5089 +#define EI_MASK_SHFT 15
5090 +#define EI_INSENS_SHFT 20
5091 +#define EI_LEVEL_SHFT 25
5092 +
5093 + uint32 unused[4]; /* (18) */
5094 + uint32 BlockSoftReset; /* (28) */
5095 +#define BSR_SPI 0x00000001
5096 +#define BSR_EMAC 0x00000004
5097 +#define BSR_USBH 0x00000008
5098 +#define BSR_USBS 0x00000010
5099 +#define BSR_ADSL 0x00000020
5100 +#define BSR_DMAMEM 0x00000040
5101 +#define BSR_SAR 0x00000080
5102 +#define BSR_ACLC 0x00000100
5103 +#define BSR_ADSL_MIPS_PLL 0x00000400
5104 +#define BSR_ALL_BLOCKS \
5105 + (BSR_SPI | BSR_EMAC | BSR_USBH | BSR_USBS | BSR_ADSL | BSR_DMAMEM | \
5106 + BSR_SAR | BSR_ACLC | BSR_ADSL_MIPS_PLL)
5107 + uint32 unused2[2]; /* (2c) */
5108 + uint32 PllStrap; /* (34) */
5109 +#define PLL_N1_SHFT 20
5110 +#define PLL_N1_MASK (7<<PLL_N1_SHFT)
5111 +#define PLL_N2_SHFT 15
5112 +#define PLL_N2_MASK (0x1f<<PLL_N2_SHFT)
5113 +#define PLL_M1_REF_SHFT 12
5114 +#define PLL_M1_REF_MASK (7<<PLL_M1_REF_SHFT)
5115 +#define PLL_M2_REF_SHFT 9
5116 +#define PLL_M2_REF_MASK (7<<PLL_M2_REF_SHFT)
5117 +#define PLL_M1_CPU_SHFT 6
5118 +#define PLL_M1_CPU_MASK (7<<PLL_M1_CPU_SHFT)
5119 +#define PLL_M1_BUS_SHFT 3
5120 +#define PLL_M1_BUS_MASK (7<<PLL_M1_BUS_SHFT)
5121 +#define PLL_M2_BUS_SHFT 0
5122 +#define PLL_M2_BUS_MASK (7<<PLL_M2_BUS_SHFT)
5123 +} PerfControl;
5124 +
5125 +#define PERF ((volatile PerfControl * const) PERF_BASE)
5126 +
5127 +typedef struct Timer {
5128 + uint16 unused0;
5129 + byte TimerMask;
5130 +#define TIMER0EN 0x01
5131 +#define TIMER1EN 0x02
5132 +#define TIMER2EN 0x04
5133 + byte TimerInts;
5134 +#define TIMER0 0x01
5135 +#define TIMER1 0x02
5136 +#define TIMER2 0x04
5137 +#define WATCHDOG 0x08
5138 + uint32 TimerCtl0;
5139 + uint32 TimerCtl1;
5140 + uint32 TimerCtl2;
5141 +#define TIMERENABLE 0x80000000
5142 +#define RSTCNTCLR 0x40000000
5143 + uint32 TimerCnt0;
5144 + uint32 TimerCnt1;
5145 + uint32 TimerCnt2;
5146 + uint32 WatchDogDefCount;
5147 +
5148 + /* Write 0xff00 0x00ff to Start timer
5149 + * Write 0xee00 0x00ee to Stop and re-load default count
5150 + * Read from this register returns current watch dog count
5151 + */
5152 + uint32 WatchDogCtl;
5153 +
5154 + /* Number of 40-MHz ticks for WD Reset pulse to last */
5155 + uint32 WDResetCount;
5156 +} Timer;
5157 +
5158 +#define TIMER ((volatile Timer * const) TIMR_BASE)
5159 +
5160 +typedef struct UartChannel {
5161 + byte unused0;
5162 + byte control;
5163 +#define BRGEN 0x80 /* Control register bit defs */
5164 +#define TXEN 0x40
5165 +#define RXEN 0x20
5166 +#define LOOPBK 0x10
5167 +#define TXPARITYEN 0x08
5168 +#define TXPARITYEVEN 0x04
5169 +#define RXPARITYEN 0x02
5170 +#define RXPARITYEVEN 0x01
5171 +
5172 + byte config;
5173 +#define XMITBREAK 0x40
5174 +#define BITS5SYM 0x00
5175 +#define BITS6SYM 0x10
5176 +#define BITS7SYM 0x20
5177 +#define BITS8SYM 0x30
5178 +#define ONESTOP 0x07
5179 +#define TWOSTOP 0x0f
5180 + /* 4-LSBS represent STOP bits/char
5181 + * in 1/8 bit-time intervals. Zero
5182 + * represents 1/8 stop bit interval.
5183 + * Fifteen represents 2 stop bits.
5184 + */
5185 + byte fifoctl;
5186 +#define RSTTXFIFOS 0x80
5187 +#define RSTRXFIFOS 0x40
5188 + /* 5-bit TimeoutCnt is in low bits of this register.
5189 + * This count represents the number of characters
5190 + * idle times before setting receive Irq when below threshold
5191 + */
5192 + uint32 baudword;
5193 + /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate
5194 + */
5195 +
5196 + byte txf_levl; /* Read-only fifo depth */
5197 + byte rxf_levl; /* Read-only fifo depth */
5198 + byte fifocfg; /* Upper 4-bits are TxThresh, Lower are
5199 + * RxThreshold. Irq can be asserted
5200 + * when rx fifo> thresh, txfifo<thresh
5201 + */
5202 + byte prog_out; /* Set value of DTR (Bit0), RTS (Bit1)
5203 + * if these bits are also enabled to GPIO_o
5204 + */
5205 +#define DTREN 0x01
5206 +#define RTSEN 0x02
5207 +
5208 + byte unused1;
5209 + byte DeltaIPEdgeNoSense; /* Low 4-bits, set corr bit to 1 to
5210 + * detect irq on rising AND falling
5211 + * edges for corresponding GPIO_i
5212 + * if enabled (edge insensitive)
5213 + */
5214 + byte DeltaIPConfig_Mask; /* Upper 4 bits: 1 for posedge sense
5215 + * 0 for negedge sense if
5216 + * not configured for edge
5217 + * insensitive (see above)
5218 + * Lower 4 bits: Mask to enable change
5219 + * detection IRQ for corresponding
5220 + * GPIO_i
5221 + */
5222 + byte DeltaIP_SyncIP; /* Upper 4 bits show which bits
5223 + * have changed (may set IRQ).
5224 + * read automatically clears bit
5225 + * Lower 4 bits are actual status
5226 + */
5227 +
5228 + uint16 intMask; /* Same Bit defs for Mask and status */
5229 + uint16 intStatus;
5230 +#define DELTAIP 0x0001
5231 +#define TXUNDERR 0x0002
5232 +#define TXOVFERR 0x0004
5233 +#define TXFIFOTHOLD 0x0008
5234 +#define TXREADLATCH 0x0010
5235 +#define TXFIFOEMT 0x0020
5236 +#define RXUNDERR 0x0040
5237 +#define RXOVFERR 0x0080
5238 +#define RXTIMEOUT 0x0100
5239 +#define RXFIFOFULL 0x0200
5240 +#define RXFIFOTHOLD 0x0400
5241 +#define RXFIFONE 0x0800
5242 +#define RXFRAMERR 0x1000
5243 +#define RXPARERR 0x2000
5244 +#define RXBRK 0x4000
5245 +
5246 + uint16 unused2;
5247 + uint16 Data; /* Write to TX, Read from RX */
5248 + /* bits 11:8 are BRK,PAR,FRM errors */
5249 +
5250 + uint32 unused3;
5251 + uint32 unused4;
5252 +} Uart;
5253 +
5254 +#define UART ((volatile Uart * const) UART_BASE)
5255 +
5256 +typedef struct GpioControl {
5257 + uint32 GPIODir_high; /* bits 36:32 */
5258 + uint32 GPIODir; /* bits 31:00 */
5259 + uint32 GPIOio_high; /* bits 36:32 */
5260 + uint32 GPIOio; /* bits 31:00 */
5261 + uint32 LEDCtrl;
5262 +#define LED3_STROBE 0x08000000
5263 +#define LED2_STROBE 0x04000000
5264 +#define LED1_STROBE 0x02000000
5265 +#define LED0_STROBE 0x01000000
5266 +#define LED_TEST 0x00010000
5267 +#define LED3_DISABLE_LINK_ACT 0x00008000
5268 +#define LED2_DISABLE_LINK_ACT 0x00004000
5269 +#define LED1_DISABLE_LINK_ACT 0x00002000
5270 +#define LED0_DISABLE_LINK_ACT 0x00001000
5271 +#define LED_INTERVAL_SET_MASK 0x00000f00
5272 +#define LED_INTERVAL_SET_320MS 0x00000500
5273 +#define LED_INTERVAL_SET_160MS 0x00000400
5274 +#define LED_INTERVAL_SET_80MS 0x00000300
5275 +#define LED_INTERVAL_SET_40MS 0x00000200
5276 +#define LED_INTERVAL_SET_20MS 0x00000100
5277 +#define LED3_ON 0x00000080
5278 +#define LED2_ON 0x00000040
5279 +#define LED1_ON 0x00000020
5280 +#define LED0_ON 0x00000010
5281 +#define LED3_ENABLE 0x00000008
5282 +#define LED2_ENABLE 0x00000004
5283 +#define LED1_ENABLE 0x00000002
5284 +#define LED0_ENABLE 0x00000001
5285 + uint32 SpiSlaveCfg;
5286 +#define SPI_SLAVE_RESET 0x00010000
5287 +#define SPI_RESTRICT 0x00000400
5288 +#define SPI_DELAY_DISABLE 0x00000200
5289 +#define SPI_PROBE_MUX_SEL_MASK 0x000001e0
5290 +#define SPI_SER_ADDR_CFG_MASK 0x0000000c
5291 +#define SPI_MODE 0x00000001
5292 + uint32 GPIOMode;
5293 +#define GROUP4_DIAG 0x00090000
5294 +#define GROUP4_UTOPIA 0x00080000
5295 +#define GROUP4_LEGACY_LED 0x00030000
5296 +#define GROUP4_MII_SNOOP 0x00020000
5297 +#define GROUP4_EXT_EPHY 0x00010000
5298 +#define GROUP3_DIAG 0x00009000
5299 +#define GROUP3_UTOPIA 0x00008000
5300 +#define GROUP3_EXT_MII 0x00007000
5301 +#define GROUP2_DIAG 0x00000900
5302 +#define GROUP2_PCI 0x00000500
5303 +#define GROUP1_DIAG 0x00000090
5304 +#define GROUP1_UTOPIA 0x00000080
5305 +#define GROUP1_SPI_UART 0x00000060
5306 +#define GROUP1_SPI_MASTER 0x00000060
5307 +#define GROUP1_MII_PCCARD 0x00000040
5308 +#define GROUP1_MII_SNOOP 0x00000020
5309 +#define GROUP1_EXT_EPHY 0x00000010
5310 +#define GROUP0_DIAG 0x00000009
5311 +#define GROUP0_EXT_MII 0x00000007
5312 +
5313 +} GpioControl;
5314 +
5315 +#define GPIO ((volatile GpioControl * const) GPIO_BASE)
5316 +
5317 +/* Number to mask conversion macro used for GPIODir and GPIOio */
5318 +#define GPIO_NUM_TOTAL_BITS_MASK 0x3f
5319 +#define GPIO_NUM_MAX_BITS_MASK 0x1f
5320 +#define GPIO_NUM_TO_MASK(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) < 32) ? (1 << ((X) & GPIO_NUM_MAX_BITS_MASK)) : (0) )
5321 +
5322 +/* Number to mask conversion macro used for GPIODir_high and GPIOio_high */
5323 +#define GPIO_NUM_MAX_BITS_MASK_HIGH 0x07
5324 +#define GPIO_NUM_TO_MASK_HIGH(X) ( (((X) & GPIO_NUM_TOTAL_BITS_MASK) >= 32) ? (1 << ((X-32) & GPIO_NUM_MAX_BITS_MASK_HIGH)) : (0) )
5325 +
5326 +
5327 +/*
5328 +** External Bus Interface
5329 +*/
5330 +typedef struct EbiChipSelect {
5331 + uint32 base; /* base address in upper 24 bits */
5332 +#define EBI_SIZE_8K 0
5333 +#define EBI_SIZE_16K 1
5334 +#define EBI_SIZE_32K 2
5335 +#define EBI_SIZE_64K 3
5336 +#define EBI_SIZE_128K 4
5337 +#define EBI_SIZE_256K 5
5338 +#define EBI_SIZE_512K 6
5339 +#define EBI_SIZE_1M 7
5340 +#define EBI_SIZE_2M 8
5341 +#define EBI_SIZE_4M 9
5342 +#define EBI_SIZE_8M 10
5343 +#define EBI_SIZE_16M 11
5344 +#define EBI_SIZE_32M 12
5345 +#define EBI_SIZE_64M 13
5346 +#define EBI_SIZE_128M 14
5347 +#define EBI_SIZE_256M 15
5348 + uint32 config;
5349 +#define EBI_ENABLE 0x00000001 /* .. enable this range */
5350 +#define EBI_WAIT_STATES 0x0000000e /* .. mask for wait states */
5351 +#define EBI_WTST_SHIFT 1 /* .. for shifting wait states */
5352 +#define EBI_WORD_WIDE 0x00000010 /* .. 16-bit peripheral, else 8 */
5353 +#define EBI_WREN 0x00000020 /* enable posted writes */
5354 +#define EBI_POLARITY 0x00000040 /* .. set to invert something,
5355 + ** don't know what yet */
5356 +#define EBI_TS_TA_MODE 0x00000080 /* .. use TS/TA mode */
5357 +#define EBI_TS_SEL 0x00000100 /* .. drive tsize, not bs_b */
5358 +#define EBI_FIFO 0x00000200 /* .. use fifo */
5359 +#define EBI_RE 0x00000400 /* .. Reverse Endian */
5360 +} EbiChipSelect;
5361 +
5362 +typedef struct MpiRegisters {
5363 + EbiChipSelect cs[7]; /* size chip select configuration */
5364 +#define EBI_CS0_BASE 0
5365 +#define EBI_CS1_BASE 1
5366 +#define EBI_CS2_BASE 2
5367 +#define EBI_CS3_BASE 3
5368 +#define PCMCIA_COMMON_BASE 4
5369 +#define PCMCIA_ATTRIBUTE_BASE 5
5370 +#define PCMCIA_IO_BASE 6
5371 + uint32 unused0[2]; /* reserved */
5372 + uint32 ebi_control; /* ebi control */
5373 + uint32 unused1[4]; /* reserved */
5374 +#define EBI_ACCESS_TIMEOUT 0x000007FF
5375 + uint32 pcmcia_cntl1; /* pcmcia control 1 */
5376 +#define PCCARD_CARD_RESET 0x00040000
5377 +#define CARDBUS_ENABLE 0x00008000
5378 +#define PCMCIA_ENABLE 0x00004000
5379 +#define PCMCIA_GPIO_ENABLE 0x00002000
5380 +#define CARDBUS_IDSEL 0x00001F00
5381 +#define VS2_OEN 0x00000080
5382 +#define VS1_OEN 0x00000040
5383 +#define VS2_OUT 0x00000020
5384 +#define VS1_OUT 0x00000010
5385 +#define VS2_IN 0x00000008
5386 +#define VS1_IN 0x00000004
5387 +#define CD2_IN 0x00000002
5388 +#define CD1_IN 0x00000001
5389 +#define VS_MASK 0x0000000C
5390 +#define CD_MASK 0x00000003
5391 + uint32 unused2; /* reserved */
5392 + uint32 pcmcia_cntl2; /* pcmcia control 2 */
5393 +#define PCMCIA_BYTESWAP_DIS 0x00000002
5394 +#define PCMCIA_HALFWORD_EN 0x00000001
5395 +#define RW_ACTIVE_CNT_BIT 2
5396 +#define INACTIVE_CNT_BIT 8
5397 +#define CE_SETUP_CNT_BIT 16
5398 +#define CE_HOLD_CNT_BIT 24
5399 + uint32 unused3[40]; /* reserved */
5400 +
5401 + uint32 sp0range; /* PCI to internal system bus address space */
5402 + uint32 sp0remap;
5403 + uint32 sp0cfg;
5404 + uint32 sp1range;
5405 + uint32 sp1remap;
5406 + uint32 sp1cfg;
5407 +
5408 + uint32 EndianCfg;
5409 +
5410 + uint32 l2pcfgctl; /* internal system bus to PCI IO/Cfg control */
5411 +#define DIR_CFG_SEL 0x80000000 /* change from PCI I/O access to PCI config access */
5412 +#define DIR_CFG_USEREG 0x40000000 /* use this register info for PCI configuration access */
5413 +#define DEVICE_NUMBER 0x00007C00 /* device number for the PCI configuration access */
5414 +#define FUNC_NUMBER 0x00000300 /* function number for the PCI configuration access */
5415 +#define REG_NUMBER 0x000000FC /* register number for the PCI configuration access */
5416 +#define CONFIG_TYPE 0x00000003 /* configuration type for the PCI configuration access */
5417 +
5418 + uint32 l2pmrange1; /* internal system bus to PCI memory space */
5419 +#define PCI_SIZE_64K 0xFFFF0000
5420 +#define PCI_SIZE_128K 0xFFFE0000
5421 +#define PCI_SIZE_256K 0xFFFC0000
5422 +#define PCI_SIZE_512K 0xFFF80000
5423 +#define PCI_SIZE_1M 0xFFF00000
5424 +#define PCI_SIZE_2M 0xFFE00000
5425 +#define PCI_SIZE_4M 0xFFC00000
5426 +#define PCI_SIZE_8M 0xFF800000
5427 +#define PCI_SIZE_16M 0xFF000000
5428 +#define PCI_SIZE_32M 0xFE000000
5429 + uint32 l2pmbase1; /* kseg0 or kseg1 address & 0x1FFFFFFF */
5430 + uint32 l2pmremap1;
5431 +#define CARDBUS_MEM 0x00000004
5432 +#define MEM_WINDOW_EN 0x00000001
5433 + uint32 l2pmrange2;
5434 + uint32 l2pmbase2;
5435 + uint32 l2pmremap2;
5436 + uint32 l2piorange; /* internal system bus to PCI I/O space */
5437 + uint32 l2piobase;
5438 + uint32 l2pioremap;
5439 +
5440 + uint32 pcimodesel;
5441 +#define PCI2_INT_BUS_RD_PREFECH 0x000000F0
5442 +#define PCI_BAR2_NOSWAP 0x00000002 /* BAR at offset 0x20 */
5443 +#define PCI_BAR1_NOSWAP 0x00000001 /* BAR at affset 0x1c */
5444 +
5445 + uint32 pciintstat; /* PCI interrupt mask/status */
5446 +#define MAILBOX1_SENT 0x08
5447 +#define MAILBOX0_SENT 0x04
5448 +#define MAILBOX1_MSG_RCV 0x02
5449 +#define MAILBOX0_MSG_RCV 0x01
5450 + uint32 locbuscntrl; /* internal system bus control */
5451 +#define DIR_U2P_NOSWAP 0x00000002
5452 +#define EN_PCI_GPIO 0x00000001
5453 + uint32 locintstat; /* internal system bus interrupt mask/status */
5454 +#define CSERR 0x0200
5455 +#define SERR 0x0100
5456 +#define EXT_PCI_INT 0x0080
5457 +#define DIR_FAILED 0x0040
5458 +#define DIR_COMPLETE 0x0020
5459 +#define PCI_CFG 0x0010
5460 + uint32 unused5[7];
5461 +
5462 + uint32 mailbox0;
5463 + uint32 mailbox1;
5464 +
5465 + uint32 pcicfgcntrl; /* internal system bus PCI configuration control */
5466 +#define PCI_CFG_REG_WRITE_EN 0x00000080
5467 +#define PCI_CFG_ADDR 0x0000003C
5468 + uint32 pcicfgdata; /* internal system bus PCI configuration data */
5469 +
5470 + uint32 locch2ctl; /* PCI to interrnal system bus DMA (downstream) local control */
5471 +#define MPI_DMA_HALT 0x00000008 /* idle after finish current memory burst */
5472 +#define MPI_DMA_PKT_HALT 0x00000004 /* idle after an EOP flag is detected */
5473 +#define MPI_DMA_STALL 0x00000002 /* idle after an EOP flag is detected */
5474 +#define MPI_DMA_ENABLE 0x00000001 /* set to enable channel */
5475 + uint32 locch2intStat;
5476 +#define MPI_DMA_NO_DESC 0x00000004 /* no valid descriptors */
5477 +#define MPI_DMA_DONE 0x00000002 /* packet xfer complete */
5478 +#define MPI_DMA_BUFF_DONE 0x00000001 /* buffer done */
5479 + uint32 locch2intMask;
5480 + uint32 unused6;
5481 + uint32 locch2descaddr;
5482 + uint32 locch2status1;
5483 +#define LOCAL_DESC_STATE 0xE0000000
5484 +#define PCI_DESC_STATE 0x1C000000
5485 +#define BYTE_DONE 0x03FFC000
5486 +#define RING_ADDR 0x00003FFF
5487 + uint32 locch2status2;
5488 +#define BUFPTR_OFFSET 0x1FFF0000
5489 +#define PCI_MASTER_STATE 0x000000C0
5490 +#define LOC_MASTER_STATE 0x00000038
5491 +#define CONTROL_STATE 0x00000007
5492 + uint32 unused7;
5493 +
5494 + uint32 locch1Ctl; /*internal system bus to PCI DMA (upstream) local control */
5495 +#define DMA_U2P_LE 0x00000200 /* local bus is little endian */
5496 +#define DMA_U2P_NOSWAP 0x00000100 /* lccal bus is little endian but no data swapped */
5497 + uint32 locch1intstat;
5498 + uint32 locch1intmask;
5499 + uint32 unused8;
5500 + uint32 locch1descaddr;
5501 + uint32 locch1status1;
5502 + uint32 locch1status2;
5503 + uint32 unused9;
5504 +
5505 + uint32 pcich1ctl; /* internal system bus to PCI DMA PCI control */
5506 + uint32 pcich1intstat;
5507 + uint32 pcich1intmask;
5508 + uint32 pcich1descaddr;
5509 + uint32 pcich1status1;
5510 + uint32 pcich1status2;
5511 +
5512 + uint32 pcich2Ctl; /* PCI to internal system bus DMA PCI control */
5513 + uint32 pcich2intstat;
5514 + uint32 pcich2intmask;
5515 + uint32 pcich2descaddr;
5516 + uint32 pcich2status1;
5517 + uint32 pcich2status2;
5518 +
5519 + uint32 perm_id; /* permanent device and vendor id */
5520 + uint32 perm_rev; /* permanent revision id */
5521 +} MpiRegisters;
5522 +
5523 +#define MPI ((volatile MpiRegisters * const) MPI_BASE)
5524 +
5525 +/* PCI configuration address space start offset 0x40 */
5526 +#define BRCM_PCI_CONFIG_TIMER 0x40
5527 +#define BRCM_PCI_CONFIG_TIMER_RETRY_MASK 0x0000FF00
5528 +#define BRCM_PCI_CONFIG_TIMER_TRDY_MASK 0x000000FF
5529 +
5530 +/* USB host non-Open HCI register, USB_HOST_NON_OHCI, bit definitions. */
5531 +#define NON_OHCI_ENABLE_PORT1 0x00000001 /* Use USB port 1 for host, not dev */
5532 +#define NON_OHCI_BYTE_SWAP 0x00000008 /* Swap USB host registers */
5533 +
5534 +#define USBH_NON_OHCI ((volatile unsigned long * const) USB_HOST_NON_OHCI)
5535 +
5536 +#endif
5537 +
5538 diff -urN linux.old/arch/mips/bcm963xx/include/bcm_intr.h linux.dev/arch/mips/bcm963xx/include/bcm_intr.h
5539 --- linux.old/arch/mips/bcm963xx/include/bcm_intr.h 1970-01-01 01:00:00.000000000 +0100
5540 +++ linux.dev/arch/mips/bcm963xx/include/bcm_intr.h 2006-08-25 00:39:38.000000000 +0200
5541 @@ -0,0 +1,59 @@
5542 +/*
5543 +<:copyright-gpl
5544 + Copyright 2003 Broadcom Corp. All Rights Reserved.
5545 +
5546 + This program is free software; you can distribute it and/or modify it
5547 + under the terms of the GNU General Public License (Version 2) as
5548 + published by the Free Software Foundation.
5549 +
5550 + This program is distributed in the hope it will be useful, but WITHOUT
5551 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5552 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5553 + for more details.
5554 +
5555 + You should have received a copy of the GNU General Public License along
5556 + with this program; if not, write to the Free Software Foundation, Inc.,
5557 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5558 +:>
5559 +*/
5560 +
5561 +#ifndef __BCM_INTR_H
5562 +#define __BCM_INTR_H
5563 +
5564 +#ifdef __cplusplus
5565 + extern "C" {
5566 +#endif
5567 +
5568 +#if defined(CONFIG_BCM96338)
5569 +#include <6338_intr.h>
5570 +#endif
5571 +#if defined(CONFIG_BCM96345)
5572 +#include <6345_intr.h>
5573 +#endif
5574 +#if defined(CONFIG_BCM96348)
5575 +#include <6348_intr.h>
5576 +#endif
5577 +
5578 +/* defines */
5579 +struct pt_regs;
5580 +typedef int (*FN_HANDLER) (int, void *, struct pt_regs *);
5581 +
5582 +/* prototypes */
5583 +extern void enable_brcm_irq(unsigned int irq);
5584 +extern void disable_brcm_irq(unsigned int irq);
5585 +extern int request_external_irq(unsigned int irq,
5586 + FN_HANDLER handler, unsigned long irqflags,
5587 + const char * devname, void *dev_id);
5588 +extern unsigned int BcmHalMapInterrupt(FN_HANDLER isr, unsigned int param,
5589 + unsigned int interruptId);
5590 +extern void dump_intr_regs(void);
5591 +
5592 +/* compatibility definitions */
5593 +#define BcmHalInterruptEnable(irq) enable_brcm_irq( irq )
5594 +#define BcmHalInterruptDisable(irq) disable_brcm_irq( irq )
5595 +
5596 +#ifdef __cplusplus
5597 + }
5598 +#endif
5599 +
5600 +#endif
5601 diff -urN linux.old/arch/mips/bcm963xx/include/bcm_map_part.h linux.dev/arch/mips/bcm963xx/include/bcm_map_part.h
5602 --- linux.old/arch/mips/bcm963xx/include/bcm_map_part.h 1970-01-01 01:00:00.000000000 +0100
5603 +++ linux.dev/arch/mips/bcm963xx/include/bcm_map_part.h 2006-08-25 00:39:38.000000000 +0200
5604 @@ -0,0 +1,34 @@
5605 +/*
5606 +<:copyright-gpl
5607 + Copyright 2004 Broadcom Corp. All Rights Reserved.
5608 +
5609 + This program is free software; you can distribute it and/or modify it
5610 + under the terms of the GNU General Public License (Version 2) as
5611 + published by the Free Software Foundation.
5612 +
5613 + This program is distributed in the hope it will be useful, but WITHOUT
5614 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5615 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5616 + for more details.
5617 +
5618 + You should have received a copy of the GNU General Public License along
5619 + with this program; if not, write to the Free Software Foundation, Inc.,
5620 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5621 +:>
5622 +*/
5623 +
5624 +#ifndef __BCM_MAP_PART_H
5625 +#define __BCM_MAP_PART_H
5626 +
5627 +#if defined(CONFIG_BCM96338)
5628 +#include <6338_map_part.h>
5629 +#endif
5630 +#if defined(CONFIG_BCM96345)
5631 +#include <6345_map_part.h>
5632 +#endif
5633 +#if defined(CONFIG_BCM96348)
5634 +#include <6348_map_part.h>
5635 +#endif
5636 +
5637 +#endif
5638 +
5639 diff -urN linux.old/arch/mips/bcm963xx/include/bcmpci.h linux.dev/arch/mips/bcm963xx/include/bcmpci.h
5640 --- linux.old/arch/mips/bcm963xx/include/bcmpci.h 1970-01-01 01:00:00.000000000 +0100
5641 +++ linux.dev/arch/mips/bcm963xx/include/bcmpci.h 2006-08-25 00:39:38.000000000 +0200
5642 @@ -0,0 +1,87 @@
5643 +/*
5644 +<:copyright-gpl
5645 + Copyright 2004 Broadcom Corp. All Rights Reserved.
5646 +
5647 + This program is free software; you can distribute it and/or modify it
5648 + under the terms of the GNU General Public License (Version 2) as
5649 + published by the Free Software Foundation.
5650 +
5651 + This program is distributed in the hope it will be useful, but WITHOUT
5652 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5653 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5654 + for more details.
5655 +
5656 + You should have received a copy of the GNU General Public License along
5657 + with this program; if not, write to the Free Software Foundation, Inc.,
5658 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5659 +:>
5660 +*/
5661 +
5662 +//
5663 +// bcmpci.h - bcm96348 PCI, Cardbus, and PCMCIA definition
5664 +//
5665 +#ifndef BCMPCI_H
5666 +#define BCMPCI_H
5667 +
5668 +/* Memory window in internal system bus address space */
5669 +#define BCM_PCI_MEM_BASE 0x08000000
5670 +/* IO window in internal system bus address space */
5671 +#define BCM_PCI_IO_BASE 0x0C000000
5672 +
5673 +#define BCM_PCI_ADDR_MASK 0x1fffffff
5674 +
5675 +/* Memory window size (range) */
5676 +#define BCM_PCI_MEM_SIZE_16MB 0x01000000
5677 +/* IO window size (range) */
5678 +#define BCM_PCI_IO_SIZE_64KB 0x00010000
5679 +
5680 +/* PCI Configuration and I/O space acesss */
5681 +#define BCM_PCI_CFG(d, f, o) ( (d << 11) | (f << 8) | (o/4 << 2) )
5682 +
5683 +/* fake USB PCI slot */
5684 +#define USB_HOST_SLOT 9
5685 +#define USB_BAR0_MEM_SIZE 0x0800
5686 +
5687 +#define BCM_HOST_MEM_SPACE1 0x10000000
5688 +#define BCM_HOST_MEM_SPACE2 0x00000000
5689 +
5690 +/*
5691 + * EBI bus clock is 33MHz and share with PCI bus
5692 + * each clock cycle is 30ns.
5693 + */
5694 +/* attribute memory access wait cnt for 4306 */
5695 +#define PCMCIA_ATTR_CE_HOLD 3 // data hold time 70ns
5696 +#define PCMCIA_ATTR_CE_SETUP 3 // data setup time 50ns
5697 +#define PCMCIA_ATTR_INACTIVE 6 // time between read/write cycles 180ns. For the total cycle time 600ns (cnt1+cnt2+cnt3+cnt4)
5698 +#define PCMCIA_ATTR_ACTIVE 10 // OE/WE pulse width 300ns
5699 +
5700 +/* common memory access wait cnt for 4306 */
5701 +#define PCMCIA_MEM_CE_HOLD 1 // data hold time 30ns
5702 +#define PCMCIA_MEM_CE_SETUP 1 // data setup time 30ns
5703 +#define PCMCIA_MEM_INACTIVE 2 // time between read/write cycles 40ns. For the total cycle time 250ns (cnt1+cnt2+cnt3+cnt4)
5704 +#define PCMCIA_MEM_ACTIVE 5 // OE/WE pulse width 150ns
5705 +
5706 +#define PCCARD_VCC_MASK 0x00070000 // Mask Reset also
5707 +#define PCCARD_VCC_33V 0x00010000
5708 +#define PCCARD_VCC_50V 0x00020000
5709 +
5710 +typedef enum {
5711 + MPI_CARDTYPE_NONE, // No Card in slot
5712 + MPI_CARDTYPE_PCMCIA, // 16-bit PCMCIA card in slot
5713 + MPI_CARDTYPE_CARDBUS, // 32-bit CardBus card in slot
5714 +} CardType;
5715 +
5716 +#define CARDBUS_SLOT 0 // Slot 0 is default for CardBus
5717 +
5718 +#define pcmciaAttrOffset 0x00200000
5719 +#define pcmciaMemOffset 0x00000000
5720 +// Needs to be right above PCI I/O space. Give 0x8000 (32K) to PCMCIA.
5721 +#define pcmciaIoOffset (BCM_PCI_IO_BASE + 0x80000)
5722 +// Base Address is that mapped into the MPI ChipSelect registers.
5723 +// UBUS bridge MemoryWindow 0 outputs a 0x00 for the base.
5724 +#define pcmciaBase 0xbf000000
5725 +#define pcmciaAttr (pcmciaAttrOffset | pcmciaBase)
5726 +#define pcmciaMem (pcmciaMemOffset | pcmciaBase)
5727 +#define pcmciaIo (pcmciaIoOffset | pcmciaBase)
5728 +
5729 +#endif
5730 diff -urN linux.old/arch/mips/bcm963xx/include/bcmTag.h linux.dev/arch/mips/bcm963xx/include/bcmTag.h
5731 --- linux.old/arch/mips/bcm963xx/include/bcmTag.h 1970-01-01 01:00:00.000000000 +0100
5732 +++ linux.dev/arch/mips/bcm963xx/include/bcmTag.h 2006-08-25 00:39:38.000000000 +0200
5733 @@ -0,0 +1,153 @@
5734 +/*
5735 +<:copyright-gpl
5736 + Copyright 2002 Broadcom Corp. All Rights Reserved.
5737 +
5738 + This program is free software; you can distribute it and/or modify it
5739 + under the terms of the GNU General Public License (Version 2) as
5740 + published by the Free Software Foundation.
5741 +
5742 + This program is distributed in the hope it will be useful, but WITHOUT
5743 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5744 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5745 + for more details.
5746 +
5747 + You should have received a copy of the GNU General Public License along
5748 + with this program; if not, write to the Free Software Foundation, Inc.,
5749 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5750 +:>
5751 +*/
5752 +//**************************************************************************************
5753 +// File Name : bcmTag.h
5754 +//
5755 +// Description: add tag with validation system to the firmware image file to be uploaded
5756 +// via http
5757 +//
5758 +// Created : 02/28/2002 seanl
5759 +//**************************************************************************************
5760 +
5761 +#ifndef _BCMTAG_H_
5762 +#define _BCMTAG_H_
5763 +
5764 +
5765 +#define BCM_SIG_1 "Broadcom Corporation"
5766 +#define BCM_SIG_2 "ver. 2.0" // was "firmware version 2.0" now it is split 6 char out for chip id.
5767 +
5768 +#define BCM_TAG_VER "6"
5769 +#define BCM_TAG_VER_LAST "26"
5770 +
5771 +// file tag (head) structure all is in clear text except validationTokens (crc, md5, sha1, etc). Total: 128 unsigned chars
5772 +#define TAG_LEN 256
5773 +#define TAG_VER_LEN 4
5774 +#define SIG_LEN 20
5775 +#define SIG_LEN_2 14 // Original second SIG = 20 is now devided into 14 for SIG_LEN_2 and 6 for CHIP_ID
5776 +#define CHIP_ID_LEN 6
5777 +#define IMAGE_LEN 10
5778 +#define ADDRESS_LEN 12
5779 +#define FLAG_LEN 2
5780 +#define TOKEN_LEN 20
5781 +#define BOARD_ID_LEN 16
5782 +#define RESERVED_LEN (TAG_LEN - TAG_VER_LEN - SIG_LEN - SIG_LEN_2 - CHIP_ID_LEN - BOARD_ID_LEN - \
5783 + (4*IMAGE_LEN) - (3*ADDRESS_LEN) - (3*FLAG_LEN) - (2*TOKEN_LEN))
5784 +
5785 +
5786 +// TAG for downloadable image (kernel plus file system)
5787 +typedef struct _FILE_TAG
5788 +{
5789 + unsigned char tagVersion[TAG_VER_LEN]; // tag version. Will be 2 here.
5790 + unsigned char signiture_1[SIG_LEN]; // text line for company info
5791 + unsigned char signiture_2[SIG_LEN_2]; // additional info (can be version number)
5792 + unsigned char chipId[CHIP_ID_LEN]; // chip id
5793 + unsigned char boardId[BOARD_ID_LEN]; // board id
5794 + unsigned char bigEndian[FLAG_LEN]; // if = 1 - big, = 0 - little endia of the host
5795 + unsigned char totalImageLen[IMAGE_LEN]; // the sum of all the following length
5796 + unsigned char cfeAddress[ADDRESS_LEN]; // if non zero, cfe starting address
5797 + unsigned char cfeLen[IMAGE_LEN]; // if non zero, cfe size in clear ASCII text.
5798 + unsigned char rootfsAddress[ADDRESS_LEN]; // if non zero, filesystem starting address
5799 + unsigned char rootfsLen[IMAGE_LEN]; // if non zero, filesystem size in clear ASCII text.
5800 + unsigned char kernelAddress[ADDRESS_LEN]; // if non zero, kernel starting address
5801 + unsigned char kernelLen[IMAGE_LEN]; // if non zero, kernel size in clear ASCII text.
5802 + unsigned char dualImage[FLAG_LEN]; // if 1, dual image
5803 + unsigned char inactiveLen[FLAG_LEN]; // if 1, the image is INACTIVE; if 0, active
5804 + unsigned char reserved[RESERVED_LEN]; // reserved for later use
5805 + unsigned char imageValidationToken[TOKEN_LEN];// image validation token - can be crc, md5, sha; for
5806 + // now will be 4 unsigned char crc
5807 + unsigned char tagValidationToken[TOKEN_LEN]; // validation token for tag(from signiture_1 to end of // mageValidationToken)
5808 +} FILE_TAG, *PFILE_TAG;
5809 +
5810 +#define CRC32_INIT_VALUE 0xffffffff /* Initial CRC32 checksum value */
5811 +#define CRC_LEN 4
5812 +
5813 +// only included if for bcmTag.exe program
5814 +#ifdef BCMTAG_EXE_USE
5815 +
5816 +static unsigned long Crc32_table[256] = {
5817 + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
5818 + 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
5819 + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
5820 + 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
5821 + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
5822 + 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
5823 + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
5824 + 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
5825 + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
5826 + 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
5827 + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
5828 + 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
5829 + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
5830 + 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
5831 + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
5832 + 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
5833 + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
5834 + 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
5835 + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
5836 + 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
5837 + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
5838 + 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
5839 + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
5840 + 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
5841 + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
5842 + 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
5843 + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
5844 + 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
5845 + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
5846 + 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
5847 + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
5848 + 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
5849 + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
5850 + 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
5851 + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
5852 + 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
5853 + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
5854 + 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
5855 + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
5856 + 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
5857 + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
5858 + 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
5859 + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
5860 + 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
5861 + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
5862 + 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
5863 + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
5864 + 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
5865 + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
5866 + 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
5867 + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
5868 + 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
5869 + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
5870 + 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
5871 + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
5872 + 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
5873 + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
5874 + 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
5875 + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
5876 + 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
5877 + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
5878 + 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
5879 + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
5880 + 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
5881 +};
5882 +#endif // BCMTAG_USE
5883 +
5884 +
5885 +#endif // _BCMTAG_H_
5886 +
5887 diff -urN linux.old/arch/mips/bcm963xx/include/bcmtypes.h linux.dev/arch/mips/bcm963xx/include/bcmtypes.h
5888 --- linux.old/arch/mips/bcm963xx/include/bcmtypes.h 1970-01-01 01:00:00.000000000 +0100
5889 +++ linux.dev/arch/mips/bcm963xx/include/bcmtypes.h 2006-08-25 00:39:38.000000000 +0200
5890 @@ -0,0 +1,163 @@
5891 +/*
5892 +<:copyright-gpl
5893 + Copyright 2002 Broadcom Corp. All Rights Reserved.
5894 +
5895 + This program is free software; you can distribute it and/or modify it
5896 + under the terms of the GNU General Public License (Version 2) as
5897 + published by the Free Software Foundation.
5898 +
5899 + This program is distributed in the hope it will be useful, but WITHOUT
5900 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5901 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5902 + for more details.
5903 +
5904 + You should have received a copy of the GNU General Public License along
5905 + with this program; if not, write to the Free Software Foundation, Inc.,
5906 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
5907 +:>
5908 +*/
5909 +
5910 +//
5911 +// bcmtypes.h - misc useful typedefs
5912 +//
5913 +#ifndef BCMTYPES_H
5914 +#define BCMTYPES_H
5915 +
5916 +// These are also defined in typedefs.h in the application area, so I need to
5917 +// protect against re-definition.
5918 +
5919 +#ifndef _TYPEDEFS_H_
5920 +typedef unsigned char uint8;
5921 +typedef unsigned short uint16;
5922 +typedef unsigned long uint32;
5923 +typedef signed char int8;
5924 +typedef signed short int16;
5925 +typedef signed long int32;
5926 +#if !defined(__cplusplus)
5927 +typedef int bool;
5928 +#endif
5929 +#endif
5930 +
5931 +typedef unsigned char byte;
5932 +// typedef unsigned long sem_t;
5933 +
5934 +typedef unsigned long HANDLE,*PULONG,DWORD,*PDWORD;
5935 +typedef signed long LONG,*PLONG;
5936 +
5937 +typedef unsigned int *PUINT;
5938 +typedef signed int INT;
5939 +
5940 +typedef unsigned short *PUSHORT;
5941 +typedef signed short SHORT,*PSHORT;
5942 +typedef unsigned short WORD,*PWORD;
5943 +
5944 +typedef unsigned char *PUCHAR;
5945 +typedef signed char *PCHAR;
5946 +
5947 +typedef void *PVOID;
5948 +
5949 +typedef unsigned char BOOLEAN, *PBOOL, *PBOOLEAN;
5950 +
5951 +typedef unsigned char BYTE,*PBYTE;
5952 +
5953 +//#ifndef __GNUC__
5954 +//The following has been defined in Vxworks internally: vxTypesOld.h
5955 +//redefine under vxworks will cause error
5956 +typedef signed int *PINT;
5957 +
5958 +typedef signed char INT8;
5959 +typedef signed short INT16;
5960 +typedef signed long INT32;
5961 +
5962 +typedef unsigned char UINT8;
5963 +typedef unsigned short UINT16;
5964 +typedef unsigned long UINT32;
5965 +
5966 +typedef unsigned char UCHAR;
5967 +typedef unsigned short USHORT;
5968 +typedef unsigned int UINT;
5969 +typedef unsigned long ULONG;
5970 +
5971 +typedef void VOID;
5972 +typedef unsigned char BOOL;
5973 +
5974 +//#endif /* __GNUC__ */
5975 +
5976 +
5977 +// These are also defined in typedefs.h in the application area, so I need to
5978 +// protect against re-definition.
5979 +#ifndef TYPEDEFS_H
5980 +
5981 +// Maximum and minimum values for a signed 16 bit integer.
5982 +#define MAX_INT16 32767
5983 +#define MIN_INT16 -32768
5984 +
5985 +// Useful for true/false return values. This uses the
5986 +// Taligent notation (k for constant).
5987 +typedef enum
5988 +{
5989 + kFalse = 0,
5990 + kTrue = 1
5991 +} Bool;
5992 +
5993 +#endif
5994 +
5995 +/* macros to protect against unaligned accesses */
5996 +
5997 +#if 0
5998 +/* first arg is an address, second is a value */
5999 +#define PUT16( a, d ) { \
6000 + *((byte *)a) = (byte)((d)>>8); \
6001 + *(((byte *)a)+1) = (byte)(d); \
6002 +}
6003 +
6004 +#define PUT32( a, d ) { \
6005 + *((byte *)a) = (byte)((d)>>24); \
6006 + *(((byte *)a)+1) = (byte)((d)>>16); \
6007 + *(((byte *)a)+2) = (byte)((d)>>8); \
6008 + *(((byte *)a)+3) = (byte)(d); \
6009 +}
6010 +
6011 +/* first arg is an address, returns a value */
6012 +#define GET16( a ) ( \
6013 + (*((byte *)a) << 8) | \
6014 + (*(((byte *)a)+1)) \
6015 +)
6016 +
6017 +#define GET32( a ) ( \
6018 + (*((byte *)a) << 24) | \
6019 + (*(((byte *)a)+1) << 16) | \
6020 + (*(((byte *)a)+2) << 8) | \
6021 + (*(((byte *)a)+3)) \
6022 +)
6023 +#endif
6024 +
6025 +#ifndef YES
6026 +#define YES 1
6027 +#endif
6028 +
6029 +#ifndef NO
6030 +#define NO 0
6031 +#endif
6032 +
6033 +#ifndef IN
6034 +#define IN
6035 +#endif
6036 +
6037 +#ifndef OUT
6038 +#define OUT
6039 +#endif
6040 +
6041 +#ifndef TRUE
6042 +#define TRUE 1
6043 +#endif
6044 +
6045 +#ifndef FALSE
6046 +#define FALSE 0
6047 +#endif
6048 +
6049 +#define READ32(addr) (*(volatile UINT32 *)((ULONG)&addr))
6050 +#define READ16(addr) (*(volatile UINT16 *)((ULONG)&addr))
6051 +#define READ8(addr) (*(volatile UINT8 *)((ULONG)&addr))
6052 +
6053 +#endif
6054 diff -urN linux.old/arch/mips/bcm963xx/include/board.h linux.dev/arch/mips/bcm963xx/include/board.h
6055 --- linux.old/arch/mips/bcm963xx/include/board.h 1970-01-01 01:00:00.000000000 +0100
6056 +++ linux.dev/arch/mips/bcm963xx/include/board.h 2006-08-25 01:52:34.000000000 +0200
6057 @@ -0,0 +1,373 @@
6058 +/*
6059 +<:copyright-gpl
6060 + Copyright 2002 Broadcom Corp. All Rights Reserved.
6061 +
6062 + This program is free software; you can distribute it and/or modify it
6063 + under the terms of the GNU General Public License (Version 2) as
6064 + published by the Free Software Foundation.
6065 +
6066 + This program is distributed in the hope it will be useful, but WITHOUT
6067 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6068 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6069 + for more details.
6070 +
6071 + You should have received a copy of the GNU General Public License along
6072 + with this program; if not, write to the Free Software Foundation, Inc.,
6073 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
6074 +:>
6075 +*/
6076 +/***********************************************************************/
6077 +/* */
6078 +/* MODULE: board.h */
6079 +/* DATE: 97/02/18 */
6080 +/* PURPOSE: Board specific information. This module should include */
6081 +/* all base device addresses and board specific macros. */
6082 +/* */
6083 +/***********************************************************************/
6084 +#ifndef _BOARD_H
6085 +#define _BOARD_H
6086 +
6087 +/*****************************************************************************/
6088 +/* Misc board definitions */
6089 +/*****************************************************************************/
6090 +
6091 +#define DYING_GASP_API
6092 +
6093 +/*****************************************************************************/
6094 +/* Physical Memory Map */
6095 +/*****************************************************************************/
6096 +
6097 +#define PHYS_DRAM_BASE 0x00000000 /* Dynamic RAM Base */
6098 +#define PHYS_FLASH_BASE 0x1FC00000 /* Flash Memory */
6099 +
6100 +/*****************************************************************************/
6101 +/* Note that the addresses above are physical addresses and that programs */
6102 +/* have to use converted addresses defined below: */
6103 +/*****************************************************************************/
6104 +#define DRAM_BASE (0x80000000 | PHYS_DRAM_BASE) /* cached DRAM */
6105 +#define DRAM_BASE_NOCACHE (0xA0000000 | PHYS_DRAM_BASE) /* uncached DRAM */
6106 +#define FLASH_BASE (0xA0000000 | PHYS_FLASH_BASE) /* uncached Flash */
6107 +
6108 +/*****************************************************************************/
6109 +/* Select the PLL value to get the desired CPU clock frequency. */
6110 +/* */
6111 +/* */
6112 +/*****************************************************************************/
6113 +#define FPERIPH 50000000
6114 +
6115 +#define ONEK 1024
6116 +#define BLK64K (64*ONEK)
6117 +#define FLASH45_BLKS_BOOT_ROM 1
6118 +#define FLASH45_LENGTH_BOOT_ROM (FLASH45_BLKS_BOOT_ROM * BLK64K)
6119 +#define FLASH_RESERVED_AT_END (64*ONEK) /*reserved for PSI, scratch pad*/
6120 +
6121 +/*****************************************************************************/
6122 +/* Note that the addresses above are physical addresses and that programs */
6123 +/* have to use converted addresses defined below: */
6124 +/*****************************************************************************/
6125 +#define DRAM_BASE (0x80000000 | PHYS_DRAM_BASE) /* cached DRAM */
6126 +#define DRAM_BASE_NOCACHE (0xA0000000 | PHYS_DRAM_BASE) /* uncached DRAM */
6127 +#define FLASH_BASE (0xA0000000 | PHYS_FLASH_BASE) /* uncached Flash */
6128 +
6129 +/*****************************************************************************/
6130 +/* Select the PLL value to get the desired CPU clock frequency. */
6131 +/* */
6132 +/* */
6133 +/*****************************************************************************/
6134 +#define FPERIPH 50000000
6135 +
6136 +#define SDRAM_TYPE_ADDRESS_OFFSET 16
6137 +#define NVRAM_DATA_OFFSET 0x0580
6138 +#define NVRAM_DATA_ID 0x0f1e2d3c
6139 +#define BOARD_SDRAM_TYPE *(unsigned long *) \
6140 + (FLASH_BASE + SDRAM_TYPE_ADDRESS_OFFSET)
6141 +
6142 +#define ONEK 1024
6143 +#define BLK64K (64*ONEK)
6144 +
6145 +// nvram and psi flash definitions for 45
6146 +#define FLASH45_LENGTH_NVRAM ONEK // 1k nvram
6147 +#define NVRAM_PSI_DEFAULT 24 // default psi in K byes
6148 +
6149 +/*****************************************************************************/
6150 +/* NVRAM Offset and definition */
6151 +/*****************************************************************************/
6152 +
6153 +#define NVRAM_VERSION_NUMBER 2
6154 +#define NVRAM_VERSION_NUMBER_ADDRESS 0
6155 +
6156 +#define NVRAM_BOOTLINE_LEN 256
6157 +#define NVRAM_BOARD_ID_STRING_LEN 16
6158 +#define NVRAM_MAC_ADDRESS_LEN 6
6159 +#define NVRAM_MAC_COUNT_MAX 32
6160 +
6161 +/*****************************************************************************/
6162 +/* Misc Offsets */
6163 +/*****************************************************************************/
6164 +
6165 +#define CFE_VERSION_OFFSET 0x0570
6166 +#define CFE_VERSION_MARK_SIZE 5
6167 +#define CFE_VERSION_SIZE 5
6168 +
6169 +typedef struct
6170 +{
6171 + unsigned long ulVersion;
6172 + char szBootline[NVRAM_BOOTLINE_LEN];
6173 + char szBoardId[NVRAM_BOARD_ID_STRING_LEN];
6174 + unsigned long ulReserved1[2];
6175 + unsigned long ulNumMacAddrs;
6176 + unsigned char ucaBaseMacAddr[NVRAM_MAC_ADDRESS_LEN];
6177 + char chReserved[2];
6178 + unsigned long ulCheckSum;
6179 +} NVRAM_DATA, *PNVRAM_DATA;
6180 +
6181 +
6182 +/*****************************************************************************/
6183 +/* board ioctl calls for flash, led and some other utilities */
6184 +/*****************************************************************************/
6185 +
6186 +
6187 +/* Defines. for board driver */
6188 +#define BOARD_IOCTL_MAGIC 'B'
6189 +#define BOARD_DRV_MAJOR 206
6190 +
6191 +#define MAC_ADDRESS_ANY (unsigned long) -1
6192 +
6193 +#define BOARD_IOCTL_FLASH_INIT \
6194 + _IOWR(BOARD_IOCTL_MAGIC, 0, BOARD_IOCTL_PARMS)
6195 +
6196 +#define BOARD_IOCTL_FLASH_WRITE \
6197 + _IOWR(BOARD_IOCTL_MAGIC, 1, BOARD_IOCTL_PARMS)
6198 +
6199 +#define BOARD_IOCTL_FLASH_READ \
6200 + _IOWR(BOARD_IOCTL_MAGIC, 2, BOARD_IOCTL_PARMS)
6201 +
6202 +#define BOARD_IOCTL_GET_NR_PAGES \
6203 + _IOWR(BOARD_IOCTL_MAGIC, 3, BOARD_IOCTL_PARMS)
6204 +
6205 +#define BOARD_IOCTL_DUMP_ADDR \
6206 + _IOWR(BOARD_IOCTL_MAGIC, 4, BOARD_IOCTL_PARMS)
6207 +
6208 +#define BOARD_IOCTL_SET_MEMORY \
6209 + _IOWR(BOARD_IOCTL_MAGIC, 5, BOARD_IOCTL_PARMS)
6210 +
6211 +#define BOARD_IOCTL_MIPS_SOFT_RESET \
6212 + _IOWR(BOARD_IOCTL_MAGIC, 6, BOARD_IOCTL_PARMS)
6213 +
6214 +#define BOARD_IOCTL_LED_CTRL \
6215 + _IOWR(BOARD_IOCTL_MAGIC, 7, BOARD_IOCTL_PARMS)
6216 +
6217 +#define BOARD_IOCTL_GET_ID \
6218 + _IOWR(BOARD_IOCTL_MAGIC, 8, BOARD_IOCTL_PARMS)
6219 +
6220 +#define BOARD_IOCTL_GET_MAC_ADDRESS \
6221 + _IOWR(BOARD_IOCTL_MAGIC, 9, BOARD_IOCTL_PARMS)
6222 +
6223 +#define BOARD_IOCTL_RELEASE_MAC_ADDRESS \
6224 + _IOWR(BOARD_IOCTL_MAGIC, 10, BOARD_IOCTL_PARMS)
6225 +
6226 +#define BOARD_IOCTL_GET_PSI_SIZE \
6227 + _IOWR(BOARD_IOCTL_MAGIC, 11, BOARD_IOCTL_PARMS)
6228 +
6229 +#define BOARD_IOCTL_GET_SDRAM_SIZE \
6230 + _IOWR(BOARD_IOCTL_MAGIC, 12, BOARD_IOCTL_PARMS)
6231 +
6232 +#define BOARD_IOCTL_SET_MONITOR_FD \
6233 + _IOWR(BOARD_IOCTL_MAGIC, 13, BOARD_IOCTL_PARMS)
6234 +
6235 +#define BOARD_IOCTL_WAKEUP_MONITOR_TASK \
6236 + _IOWR(BOARD_IOCTL_MAGIC, 14, BOARD_IOCTL_PARMS)
6237 +
6238 +#define BOARD_IOCTL_GET_BOOTLINE \
6239 + _IOWR(BOARD_IOCTL_MAGIC, 15, BOARD_IOCTL_PARMS)
6240 +
6241 +#define BOARD_IOCTL_SET_BOOTLINE \
6242 + _IOWR(BOARD_IOCTL_MAGIC, 16, BOARD_IOCTL_PARMS)
6243 +
6244 +#define BOARD_IOCTL_GET_BASE_MAC_ADDRESS \
6245 + _IOWR(BOARD_IOCTL_MAGIC, 17, BOARD_IOCTL_PARMS)
6246 +
6247 +#define BOARD_IOCTL_GET_CHIP_ID \
6248 + _IOWR(BOARD_IOCTL_MAGIC, 18, BOARD_IOCTL_PARMS)
6249 +
6250 +#define BOARD_IOCTL_GET_NUM_ENET \
6251 + _IOWR(BOARD_IOCTL_MAGIC, 19, BOARD_IOCTL_PARMS)
6252 +
6253 +#define BOARD_IOCTL_GET_CFE_VER \
6254 + _IOWR(BOARD_IOCTL_MAGIC, 20, BOARD_IOCTL_PARMS)
6255 +
6256 +#define BOARD_IOCTL_GET_ENET_CFG \
6257 + _IOWR(BOARD_IOCTL_MAGIC, 21, BOARD_IOCTL_PARMS)
6258 +
6259 +#define BOARD_IOCTL_GET_WLAN_ANT_INUSE \
6260 + _IOWR(BOARD_IOCTL_MAGIC, 22, BOARD_IOCTL_PARMS)
6261 +
6262 +#define BOARD_IOCTL_SET_TRIGGER_EVENT \
6263 + _IOWR(BOARD_IOCTL_MAGIC, 23, BOARD_IOCTL_PARMS)
6264 +
6265 +#define BOARD_IOCTL_GET_TRIGGER_EVENT \
6266 + _IOWR(BOARD_IOCTL_MAGIC, 24, BOARD_IOCTL_PARMS)
6267 +
6268 +#define BOARD_IOCTL_UNSET_TRIGGER_EVENT \
6269 + _IOWR(BOARD_IOCTL_MAGIC, 25, BOARD_IOCTL_PARMS)
6270 +
6271 +#define BOARD_IOCTL_SET_SES_LED \
6272 + _IOWR(BOARD_IOCTL_MAGIC, 26, BOARD_IOCTL_PARMS)
6273 +
6274 +//<<JUNHON, 2004/09/15, get reset button status , tim hou , 05/04/12
6275 +#define RESET_BUTTON_UP 1
6276 +#define RESET_BUTTON_PRESSDOWN 0
6277 +#define BOARD_IOCTL_GET_RESETHOLD \
6278 + _IOWR(BOARD_IOCTL_MAGIC, 27, BOARD_IOCTL_PARMS)
6279 +//>>JUNHON, 2004/09/15
6280 +
6281 +// for the action in BOARD_IOCTL_PARMS for flash operation
6282 +typedef enum
6283 +{
6284 + PERSISTENT,
6285 + NVRAM,
6286 + BCM_IMAGE_CFE,
6287 + BCM_IMAGE_FS,
6288 + BCM_IMAGE_KERNEL,
6289 + BCM_IMAGE_WHOLE,
6290 + SCRATCH_PAD,
6291 + FLASH_SIZE,
6292 +} BOARD_IOCTL_ACTION;
6293 +
6294 +
6295 +typedef struct boardIoctParms
6296 +{
6297 + char *string;
6298 + char *buf;
6299 + int strLen;
6300 + int offset;
6301 + BOARD_IOCTL_ACTION action; /* flash read/write: nvram, persistent, bcm image */
6302 + int result;
6303 +} BOARD_IOCTL_PARMS;
6304 +
6305 +
6306 +// LED defines
6307 +typedef enum
6308 +{
6309 + kLedAdsl,
6310 + kLedWireless,
6311 + kLedUsb,
6312 + kLedHpna,
6313 + kLedWanData,
6314 + kLedPPP,
6315 + kLedVoip,
6316 + kLedSes,
6317 + kLedLan,
6318 + kLedSelfTest,
6319 + kLedEnd, // NOTE: Insert the new led name before this one. Alway stay at the end.
6320 +} BOARD_LED_NAME;
6321 +
6322 +typedef enum
6323 +{
6324 + kLedStateOff, /* turn led off */
6325 + kLedStateOn, /* turn led on */
6326 + kLedStateFail, /* turn led on red */
6327 + kLedStateBlinkOnce, /* blink once, ~100ms and ignore the same call during the 100ms period */
6328 + kLedStateSlowBlinkContinues, /* slow blink continues at ~600ms interval */
6329 + kLedStateFastBlinkContinues, /* fast blink continues at ~200ms interval */
6330 +} BOARD_LED_STATE;
6331 +
6332 +
6333 +// virtual and physical map pair defined in board.c
6334 +typedef struct ledmappair
6335 +{
6336 + BOARD_LED_NAME ledName; // virtual led name
6337 + BOARD_LED_STATE ledInitState; // initial led state when the board boots.
6338 + unsigned short ledMask; // physical GPIO pin mask
6339 + unsigned short ledActiveLow; // reset bit to turn on LED
6340 + unsigned short ledMaskFail; // physical GPIO pin mask for state failure
6341 + unsigned short ledActiveLowFail;// reset bit to turn on LED
6342 +} LED_MAP_PAIR, *PLED_MAP_PAIR;
6343 +
6344 +typedef void (*HANDLE_LED_FUNC)(BOARD_LED_NAME ledName, BOARD_LED_STATE ledState);
6345 +
6346 +/* Flash storage address information that is determined by the flash driver. */
6347 +typedef struct flashaddrinfo
6348 +{
6349 + int flash_persistent_start_blk;
6350 + int flash_persistent_number_blk;
6351 + int flash_persistent_length;
6352 + unsigned long flash_persistent_blk_offset;
6353 + int flash_scratch_pad_start_blk; // start before psi (SP_BUF_LEN)
6354 + int flash_scratch_pad_number_blk;
6355 + int flash_scratch_pad_length;
6356 + unsigned long flash_scratch_pad_blk_offset;
6357 + int flash_nvram_start_blk;
6358 + int flash_nvram_number_blk;
6359 + int flash_nvram_length;
6360 + unsigned long flash_nvram_blk_offset;
6361 +} FLASH_ADDR_INFO, *PFLASH_ADDR_INFO;
6362 +
6363 +// scratch pad defines
6364 +/* SP - Persisten Scratch Pad format:
6365 + sp header : 32 bytes
6366 + tokenId-1 : 8 bytes
6367 + tokenId-1 len : 4 bytes
6368 + tokenId-1 data
6369 + ....
6370 + tokenId-n : 8 bytes
6371 + tokenId-n len : 4 bytes
6372 + tokenId-n data
6373 +*/
6374 +
6375 +#define MAGIC_NUM_LEN 8
6376 +#define MAGIC_NUMBER "gOGoBrCm"
6377 +#define TOKEN_NAME_LEN 16
6378 +#define SP_VERSION 1
6379 +#define SP_MAX_LEN 8 * 1024 // 8k buf before psi
6380 +#define SP_RESERVERD 16
6381 +
6382 +typedef struct _SP_HEADER
6383 +{
6384 + char SPMagicNum[MAGIC_NUM_LEN]; // 8 bytes of magic number
6385 + int SPVersion; // version number
6386 + int SPUsedLen; // used sp len
6387 + char SPReserved[SP_RESERVERD]; // reservied, total 32 bytes
6388 +} SP_HEADER, *PSP_HEADER;
6389 +
6390 +typedef struct _TOKEN_DEF
6391 +{
6392 + char tokenName[TOKEN_NAME_LEN];
6393 + int tokenLen;
6394 +} SP_TOKEN, *PSP_TOKEN;
6395 +
6396 +
6397 +/*****************************************************************************/
6398 +/* Function Prototypes */
6399 +/*****************************************************************************/
6400 +#if !defined(__ASM_ASM_H)
6401 +void dumpaddr( unsigned char *pAddr, int nLen );
6402 +
6403 +int kerSysNvRamGet(char *string, int strLen, int offset);
6404 +int kerSysNvRamSet(char *string, int strLen, int offset);
6405 +int kerSysPersistentGet(char *string, int strLen, int offset);
6406 +int kerSysPersistentSet(char *string, int strLen, int offset);
6407 +int kerSysScratchPadGet(char *tokName, char *tokBuf, int tokLen);
6408 +int kerSysScratchPadSet(char *tokName, char *tokBuf, int tokLen);
6409 +int kerSysBcmImageSet( int flash_start_addr, char *string, int size);
6410 +int kerSysGetMacAddress( unsigned char *pucaAddr, unsigned long ulId );
6411 +int kerSysReleaseMacAddress( unsigned char *pucaAddr );
6412 +int kerSysGetSdramSize( void );
6413 +void kerSysGetBootline(char *string, int strLen);
6414 +void kerSysSetBootline(char *string, int strLen);
6415 +void kerSysMipsSoftReset(void);
6416 +void kerSysLedCtrl(BOARD_LED_NAME, BOARD_LED_STATE);
6417 +void kerSysLedRegisterHwHandler( BOARD_LED_NAME, HANDLE_LED_FUNC, int );
6418 +int kerSysFlashSizeGet(void);
6419 +void kerSysRegisterDyingGaspHandler(char *devname, void *cbfn, void *context);
6420 +void kerSysDeregisterDyingGaspHandler(char *devname);
6421 +void kerSysWakeupMonitorTask( void );
6422 +#endif
6423 +
6424 +#define BOOT_CFE 0
6425 +#define BOOT_REDBOOT 1
6426 +
6427 +extern int boot_loader_type;
6428 +
6429 +#endif /* _BOARD_H */
6430 +
6431 diff -urN linux.old/arch/mips/bcm963xx/int-handler.S linux.dev/arch/mips/bcm963xx/int-handler.S
6432 --- linux.old/arch/mips/bcm963xx/int-handler.S 1970-01-01 01:00:00.000000000 +0100
6433 +++ linux.dev/arch/mips/bcm963xx/int-handler.S 2006-08-25 02:13:33.000000000 +0200
6434 @@ -0,0 +1,59 @@
6435 +/*
6436 +<:copyright-gpl
6437 + Copyright 2002 Broadcom Corp. All Rights Reserved.
6438 +
6439 + This program is free software; you can distribute it and/or modify it
6440 + under the terms of the GNU General Public License (Version 2) as
6441 + published by the Free Software Foundation.
6442 +
6443 + This program is distributed in the hope it will be useful, but WITHOUT
6444 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6445 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6446 + for more details.
6447 +
6448 + You should have received a copy of the GNU General Public License along
6449 + with this program; if not, write to the Free Software Foundation, Inc.,
6450 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
6451 +:>
6452 +*/
6453 +/*
6454 + * Generic interrupt handler for Broadcom MIPS boards
6455 + */
6456 +
6457 +#include <linux/config.h>
6458 +
6459 +#include <asm/asm.h>
6460 +#include <asm/mipsregs.h>
6461 +#include <asm/regdef.h>
6462 +#include <asm/stackframe.h>
6463 +
6464 +/*
6465 + * MIPS IRQ Source
6466 + * -------- ------
6467 + * 0 Software (ignored)
6468 + * 1 Software (ignored)
6469 + * 2 Combined hardware interrupt (hw0)
6470 + * 3 Hardware
6471 + * 4 Hardware
6472 + * 5 Hardware
6473 + * 6 Hardware
6474 + * 7 R4k timer
6475 + */
6476 +
6477 + .text
6478 + .set noreorder
6479 + .set noat
6480 + .align 5
6481 + NESTED(brcmIRQ, PT_SIZE, sp)
6482 + SAVE_ALL
6483 + CLI
6484 + .set noreorder
6485 + .set at
6486 +
6487 + jal plat_irq_dispatch
6488 + move a0, sp
6489 +
6490 + j ret_from_irq
6491 + nop
6492 +
6493 + END(brcmIRQ)
6494 diff -urN linux.old/arch/mips/bcm963xx/irq.c linux.dev/arch/mips/bcm963xx/irq.c
6495 --- linux.old/arch/mips/bcm963xx/irq.c 1970-01-01 01:00:00.000000000 +0100
6496 +++ linux.dev/arch/mips/bcm963xx/irq.c 2006-08-25 03:54:34.000000000 +0200
6497 @@ -0,0 +1,256 @@
6498 +/*
6499 +<:copyright-gpl
6500 + Copyright 2002 Broadcom Corp. All Rights Reserved.
6501 +
6502 + This program is free software; you can distribute it and/or modify it
6503 + under the terms of the GNU General Public License (Version 2) as
6504 + published by the Free Software Foundation.
6505 +
6506 + This program is distributed in the hope it will be useful, but WITHOUT
6507 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6508 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6509 + for more details.
6510 +
6511 + You should have received a copy of the GNU General Public License along
6512 + with this program; if not, write to the Free Software Foundation, Inc.,
6513 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
6514 +:>
6515 +*/
6516 +/*
6517 + * Interrupt control functions for Broadcom 963xx MIPS boards
6518 + */
6519 +
6520 +#include <asm/atomic.h>
6521 +
6522 +#include <linux/delay.h>
6523 +#include <linux/init.h>
6524 +#include <linux/ioport.h>
6525 +#include <linux/irq.h>
6526 +#include <linux/interrupt.h>
6527 +#include <linux/kernel.h>
6528 +#include <linux/slab.h>
6529 +#include <linux/module.h>
6530 +
6531 +#include <asm/irq.h>
6532 +#include <asm/mipsregs.h>
6533 +#include <asm/addrspace.h>
6534 +#include <asm/signal.h>
6535 +#include <bcm_map_part.h>
6536 +#include <bcm_intr.h>
6537 +
6538 +static void irq_dispatch_int(struct pt_regs *regs)
6539 +{
6540 + unsigned int pendingIrqs;
6541 + static unsigned int irqBit;
6542 + static unsigned int isrNumber = 31;
6543 +
6544 + pendingIrqs = PERF->IrqStatus & PERF->IrqMask;
6545 + if (!pendingIrqs) {
6546 + return;
6547 + }
6548 +
6549 + while (1) {
6550 + irqBit <<= 1;
6551 + isrNumber++;
6552 + if (isrNumber == 32) {
6553 + isrNumber = 0;
6554 + irqBit = 0x1;
6555 + }
6556 + if (pendingIrqs & irqBit) {
6557 + PERF->IrqMask &= ~irqBit; // mask
6558 + do_IRQ(isrNumber + INTERNAL_ISR_TABLE_OFFSET, regs);
6559 + break;
6560 + }
6561 + }
6562 +}
6563 +
6564 +static void irq_dispatch_ext(uint32 irq, struct pt_regs *regs)
6565 +{
6566 + if (!(PERF->ExtIrqCfg & (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT)))) {
6567 + printk("**** Ext IRQ mask. Should not dispatch ****\n");
6568 + }
6569 + /* disable and clear interrupt in the controller */
6570 + PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT));
6571 + PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
6572 + do_IRQ(irq, regs);
6573 +}
6574 +
6575 +
6576 +extern void brcm_timer_interrupt(struct pt_regs *regs);
6577 +
6578 +asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
6579 +{
6580 + u32 cause;
6581 + while((cause = (read_c0_cause()& CAUSEF_IP))) {
6582 + if (cause & CAUSEF_IP7)
6583 + brcm_timer_interrupt(regs);
6584 + else if (cause & CAUSEF_IP2)
6585 + irq_dispatch_int(regs);
6586 + else if (cause & CAUSEF_IP3)
6587 + irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_0, regs);
6588 + else if (cause & CAUSEF_IP4)
6589 + irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_1, regs);
6590 + else if (cause & CAUSEF_IP5)
6591 + irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_2, regs);
6592 + else if (cause & CAUSEF_IP6)
6593 + irq_dispatch_ext(INTERRUPT_ID_EXTERNAL_3, regs);
6594 + local_irq_disable();
6595 + }
6596 +}
6597 +
6598 +
6599 +void enable_brcm_irq(unsigned int irq)
6600 +{
6601 + unsigned long flags;
6602 +
6603 + local_irq_save(flags);
6604 + if( irq >= INTERNAL_ISR_TABLE_OFFSET ) {
6605 + PERF->IrqMask |= (1 << (irq - INTERNAL_ISR_TABLE_OFFSET));
6606 + }
6607 + else if (irq >= INTERRUPT_ID_EXTERNAL_0 && irq <= INTERRUPT_ID_EXTERNAL_3) {
6608 + /* enable and clear interrupt in the controller */
6609 + PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT));
6610 + PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
6611 + }
6612 + local_irq_restore(flags);
6613 +}
6614 +
6615 +void disable_brcm_irq(unsigned int irq)
6616 +{
6617 + unsigned long flags;
6618 +
6619 + local_irq_save(flags);
6620 + if( irq >= INTERNAL_ISR_TABLE_OFFSET ) {
6621 + PERF->IrqMask &= ~(1 << (irq - INTERNAL_ISR_TABLE_OFFSET));
6622 + }
6623 + else if (irq >= INTERRUPT_ID_EXTERNAL_0 && irq <= INTERRUPT_ID_EXTERNAL_3) {
6624 + /* disable interrupt in the controller */
6625 + PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT));
6626 + }
6627 + local_irq_restore(flags);
6628 +}
6629 +
6630 +void ack_brcm_irq(unsigned int irq)
6631 +{
6632 + /* Already done in brcm_irq_dispatch */
6633 +}
6634 +
6635 +unsigned int startup_brcm_irq(unsigned int irq)
6636 +{
6637 + enable_brcm_irq(irq);
6638 +
6639 + return 0; /* never anything pending */
6640 +}
6641 +
6642 +unsigned int startup_brcm_none(unsigned int irq)
6643 +{
6644 + return 0;
6645 +}
6646 +
6647 +void end_brcm_irq(unsigned int irq)
6648 +{
6649 + if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
6650 + enable_brcm_irq(irq);
6651 +}
6652 +
6653 +void end_brcm_none(unsigned int irq)
6654 +{
6655 +}
6656 +
6657 +static struct hw_interrupt_type brcm_irq_type = {
6658 + .typename = "MIPS",
6659 + .startup = startup_brcm_irq,
6660 + .shutdown = disable_brcm_irq,
6661 + .enable = enable_brcm_irq,
6662 + .disable = disable_brcm_irq,
6663 + .ack = ack_brcm_irq,
6664 + .end = end_brcm_irq,
6665 + .set_affinity = NULL
6666 +};
6667 +
6668 +static struct hw_interrupt_type brcm_irq_no_end_type = {
6669 + .typename = "MIPS",
6670 + .startup = startup_brcm_none,
6671 + .shutdown = disable_brcm_irq,
6672 + .enable = enable_brcm_irq,
6673 + .disable = disable_brcm_irq,
6674 + .ack = ack_brcm_irq,
6675 + .end = end_brcm_none,
6676 + .set_affinity = NULL
6677 +};
6678 +
6679 +void __init arch_init_irq(void)
6680 +{
6681 + int i;
6682 +
6683 + clear_c0_status(ST0_BEV);
6684 + change_c0_status(ST0_IM, (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4));
6685 +
6686 + for (i = 0; i < NR_IRQS; i++) {
6687 + irq_desc[i].status = IRQ_DISABLED;
6688 + irq_desc[i].action = 0;
6689 + irq_desc[i].depth = 1;
6690 + irq_desc[i].handler = &brcm_irq_type;
6691 + }
6692 +}
6693 +
6694 +int request_external_irq(unsigned int irq,
6695 + FN_HANDLER handler,
6696 + unsigned long irqflags,
6697 + const char * devname,
6698 + void *dev_id)
6699 +{
6700 + unsigned long flags;
6701 +
6702 + local_irq_save(flags);
6703 +
6704 + PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_CLEAR_SHFT)); // Clear
6705 + PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_MASK_SHFT)); // Mask
6706 + PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_INSENS_SHFT)); // Edge insesnsitive
6707 + PERF->ExtIrqCfg |= (1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_LEVEL_SHFT)); // Level triggered
6708 + PERF->ExtIrqCfg &= ~(1 << (irq - INTERRUPT_ID_EXTERNAL_0 + EI_SENSE_SHFT)); // Low level
6709 +
6710 + local_irq_restore(flags);
6711 +
6712 + return( request_irq(irq, handler, irqflags, devname, dev_id) );
6713 +}
6714 +
6715 +/* VxWorks compatibility function(s). */
6716 +
6717 +unsigned int BcmHalMapInterrupt(FN_HANDLER pfunc, unsigned int param,
6718 + unsigned int interruptId)
6719 +{
6720 + int nRet = -1;
6721 + char *devname;
6722 +
6723 + devname = kmalloc(16, GFP_KERNEL);
6724 + if (devname)
6725 + sprintf( devname, "brcm_%d", interruptId );
6726 +
6727 + /* Set the IRQ description to not automatically enable the interrupt at
6728 + * the end of an ISR. The driver that handles the interrupt must
6729 + * explicitly call BcmHalInterruptEnable or enable_brcm_irq. This behavior
6730 + * is consistent with interrupt handling on VxWorks.
6731 + */
6732 + irq_desc[interruptId].handler = &brcm_irq_no_end_type;
6733 +
6734 + if( interruptId >= INTERNAL_ISR_TABLE_OFFSET )
6735 + {
6736 + nRet = request_irq( interruptId, pfunc, SA_SAMPLE_RANDOM | SA_INTERRUPT,
6737 + devname, (void *) param );
6738 + }
6739 + else if (interruptId >= INTERRUPT_ID_EXTERNAL_0 && interruptId <= INTERRUPT_ID_EXTERNAL_3)
6740 + {
6741 + nRet = request_external_irq( interruptId, pfunc, SA_SAMPLE_RANDOM | SA_INTERRUPT,
6742 + devname, (void *) param );
6743 + }
6744 +
6745 + return( nRet );
6746 +}
6747 +
6748 +
6749 +EXPORT_SYMBOL(enable_brcm_irq);
6750 +EXPORT_SYMBOL(disable_brcm_irq);
6751 +EXPORT_SYMBOL(request_external_irq);
6752 +EXPORT_SYMBOL(BcmHalMapInterrupt);
6753 +
6754 diff -urN linux.old/arch/mips/bcm963xx/Kconfig linux.dev/arch/mips/bcm963xx/Kconfig
6755 --- linux.old/arch/mips/bcm963xx/Kconfig 1970-01-01 01:00:00.000000000 +0100
6756 +++ linux.dev/arch/mips/bcm963xx/Kconfig 2006-08-25 01:22:39.000000000 +0200
6757 @@ -0,0 +1,138 @@
6758 +# Kernel and Driver configuration for Broadcom Commengine ADSL board
6759 +choice
6760 + prompt "Broadcom Commengine ADSL board"
6761 + depends on MIPS_BRCM
6762 + default BCM96345
6763 + help
6764 + Select different Broadcom ADSL board
6765 +
6766 +config BCM96338
6767 + bool "96338 ADSL board"
6768 + select DMA_NONCOHERENT
6769 + select HW_HAS_PCI
6770 +
6771 +config BCM96345
6772 + bool "96345 ADSL board"
6773 + select DMA_NONCOHERENT
6774 + select HW_HAS_PCI
6775 +
6776 +config BCM96348
6777 + bool "96348 ADSL board"
6778 + select DMA_NONCOHERENT
6779 + select HW_HAS_PCI
6780 +
6781 +endchoice
6782 +
6783 +config BCM_BOARD
6784 + bool "Support for Broadcom Board"
6785 + depends on BCM96338 || BCM96345 || BCM96348
6786 +
6787 +config BCM_SERIAL
6788 + bool "Support for Serial Port"
6789 + depends on BCM96338 || BCM96345 || BCM96348
6790 +
6791 +config BCM_ENET
6792 + tristate "Support for Ethernet"
6793 + depends on BCM96338 || BCM96345 || BCM96348
6794 +
6795 +config BCM_USB
6796 + tristate "Support for USB"
6797 + depends on BCM96338 || BCM96345 || BCM96348
6798 +
6799 +config BCM_WLAN
6800 + tristate "Support for Wireless"
6801 + depends on BCM96338 || BCM96345 || BCM96348
6802 +
6803 +config BCM_PCI
6804 + bool "Support for PCI"
6805 + depends on BCM96338 || BCM96345 || BCM96348
6806 + select PCI
6807 +
6808 +config BCM_ATMAPI
6809 + tristate "Support for ATM"
6810 + depends on BCM96338 || BCM96345 || BCM96348
6811 +
6812 +config BCM_ATMTEST
6813 + tristate "Support for ATM Diagnostic"
6814 + depends on BCM96338 || BCM96345 || BCM96348
6815 +
6816 +config BCM_ADSL
6817 + tristate "Support for ADSL"
6818 + depends on BCM96338 || BCM96345 || BCM96348
6819 +
6820 +config BCM_ENDPOINT
6821 + tristate "Support for VOICE"
6822 + depends on BCM96338 || BCM96345 || BCM96348
6823 +
6824 +config BCM_PROCFS
6825 + tristate "Support for PROCFS"
6826 + depends on BCM96338 || BCM96345 || BCM96348
6827 +
6828 +config BCM_VDSL
6829 + tristate "Support for VDSL"
6830 + depends on BCM96338 || BCM96345 || BCM96348
6831 +
6832 +config BCM_SECURITY
6833 + tristate "Support for SECURITY"
6834 + depends on BCM96338 || BCM96345 || BCM96348
6835 +
6836 +config BCM_HPNA
6837 + tristate "Support for HPNA"
6838 + depends on BCM96338 || BCM96345 || BCM96348
6839 +
6840 +config BCM_BOARD_IMPL
6841 + int "Implementation index for ADSL Board"
6842 + depends on BCM96338 || BCM96345 || BCM96348
6843 +
6844 +config BCM_SERIAL_IMPL
6845 + int "Implementation index for Serial"
6846 + depends on BCM96338 || BCM96345 || BCM96348
6847 +
6848 +config BCM_ENET_IMPL
6849 + int "Implementation index for Ethernet"
6850 + depends on BCM96338 || BCM96345 || BCM96348
6851 +
6852 +config BCM_USB_IMPL
6853 + int "Implementation index for USB"
6854 + depends on BCM96338 || BCM96345 || BCM96348
6855 +
6856 +config BCM_WLAN_IMPL
6857 + int "Implementation index for WIRELESS"
6858 + depends on BCM96338 || BCM96345 || BCM96348
6859 +
6860 +config BCM_ATMAPI_IMPL
6861 + int "Implementation index for ATM"
6862 + depends on BCM96338 || BCM96345 || BCM96348
6863 +
6864 +config BCM_ATMTEST_IMPL
6865 + int "Implementation index for ATM Diagnostic"
6866 + depends on BCM96338 || BCM96345 || BCM96348
6867 +
6868 +config BCM_BLAA_IMPL
6869 + int "Implementation index for BLAA"
6870 + depends on BCM96338 || BCM96345 || BCM96348
6871 +
6872 +config BCM_ADSL_IMPL
6873 + int "Implementation index for ADSL"
6874 + depends on BCM96338 || BCM96345 || BCM96348
6875 +
6876 +config BCM_ENDPOINT_IMPL
6877 + int "Implementation index for VOICE"
6878 + depends on BCM96338 || BCM96345 || BCM96348
6879 +
6880 +config BCM_PROCFS_IMPL
6881 + int "Implementation index for PROCFS"
6882 + depends on BCM96338 || BCM96345 || BCM96348
6883 +
6884 +config BCM_VDSL_IMPL
6885 + int "Implementation index for VDSL"
6886 + depends on BCM96338 || BCM96345 || BCM96348
6887 +
6888 +config BCM_SECURITY_IMPL
6889 + int "Implementation index for SECURITY"
6890 + depends on BCM96338 || BCM96345 || BCM96348
6891 +
6892 +config BCM_HPNA_IMPL
6893 + int "Implementation index for HPNA"
6894 + depends on BCM96338 || BCM96345 || BCM96348
6895 +
6896 diff -urN linux.old/arch/mips/bcm963xx/Makefile linux.dev/arch/mips/bcm963xx/Makefile
6897 --- linux.old/arch/mips/bcm963xx/Makefile 1970-01-01 01:00:00.000000000 +0100
6898 +++ linux.dev/arch/mips/bcm963xx/Makefile 2006-08-25 02:04:27.000000000 +0200
6899 @@ -0,0 +1,23 @@
6900 +#
6901 +# Makefile for generic Broadcom MIPS boards
6902 +#
6903 +# Copyright (C) 2004 Broadcom Corporation
6904 +#
6905 +obj-y := irq.o prom.o setup.o time.o ser_init.o bcm63xx_led.o board.o boardparms.o int-handler.o
6906 +
6907 +SRCBASE := $(TOPDIR)
6908 +EXTRA_CFLAGS += -I$(SRCBASE)/include
6909 +#EXTRA_CFLAGS += -I$(INC_ADSLDRV_PATH) -DDBG
6910 +EXTRA_CFLAGS += -I$(INC_ADSLDRV_PATH)
6911 +
6912 +
6913 +ifeq "$(ADSL)" "ANNEX_B"
6914 +EXTRA_CFLAGS += -DADSL_ANNEXB
6915 +endif
6916 +ifeq "$(ADSL)" "SADSL"
6917 +EXTRA_CFLAGS += -DADSL_SADSL
6918 +endif
6919 +ifeq "$(ADSL)" "ANNEX_C"
6920 +EXTRA_CFLAGS += -DADSL_ANNEXC
6921 +endif
6922 +
6923 diff -urN linux.old/arch/mips/bcm963xx/prom.c linux.dev/arch/mips/bcm963xx/prom.c
6924 --- linux.old/arch/mips/bcm963xx/prom.c 1970-01-01 01:00:00.000000000 +0100
6925 +++ linux.dev/arch/mips/bcm963xx/prom.c 2006-08-27 21:02:04.000000000 +0200
6926 @@ -0,0 +1,130 @@
6927 +/*
6928 +<:copyright-gpl
6929 + Copyright 2004 Broadcom Corp. All Rights Reserved.
6930 +
6931 + This program is free software; you can distribute it and/or modify it
6932 + under the terms of the GNU General Public License (Version 2) as
6933 + published by the Free Software Foundation.
6934 +
6935 + This program is distributed in the hope it will be useful, but WITHOUT
6936 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6937 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6938 + for more details.
6939 +
6940 + You should have received a copy of the GNU General Public License along
6941 + with this program; if not, write to the Free Software Foundation, Inc.,
6942 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
6943 +:>
6944 +*/
6945 +/*
6946 + * prom.c: PROM library initialization code.
6947 + *
6948 + */
6949 +#include <linux/init.h>
6950 +#include <linux/mm.h>
6951 +#include <linux/sched.h>
6952 +#include <linux/bootmem.h>
6953 +#include <linux/blkdev.h>
6954 +#include <asm/addrspace.h>
6955 +#include <asm/bootinfo.h>
6956 +#include <asm/cpu.h>
6957 +#include <asm/time.h>
6958 +
6959 +#include <bcm_map_part.h>
6960 +#include <board.h>
6961 +#include "boardparms.h"
6962 +#include "softdsl/AdslCoreDefs.h"
6963 +
6964 +
6965 +//char arcs_cmdline[CL_SIZE] __initdata = {0};
6966 +/* inv_xde */
6967 +int boot_loader_type;
6968 +
6969 +extern int do_syslog(int, char *, int);
6970 +extern void serial_init(void);
6971 +extern void __init InitNvramInfo( void );
6972 +extern void kerSysFlashInit( void );
6973 +extern unsigned long get_nvram_start_addr(void);
6974 +void __init create_root_nfs_cmdline( char *cmdline );
6975 +
6976 +#define MACH_BCM MACH_BCM96348
6977 +
6978 +const char *get_system_type(void)
6979 +{
6980 + /*PNVRAM_DATA pNvramData = (PNVRAM_DATA) get_nvram_start_addr();
6981 +
6982 + return( pNvramData->szBoardId );*/
6983 + return "brcm63xx";
6984 +}
6985 +
6986 +unsigned long getMemorySize(void)
6987 +{
6988 + unsigned long ulSdramType = BOARD_SDRAM_TYPE;
6989 +
6990 + unsigned long ulSdramSize;
6991 +
6992 + switch( ulSdramType )
6993 + {
6994 + case BP_MEMORY_16MB_1_CHIP:
6995 + case BP_MEMORY_16MB_2_CHIP:
6996 + ulSdramSize = 16 * 1024 * 1024;
6997 + break;
6998 + case BP_MEMORY_32MB_1_CHIP:
6999 + case BP_MEMORY_32MB_2_CHIP:
7000 + ulSdramSize = 32 * 1024 * 1024;
7001 + break;
7002 + case BP_MEMORY_64MB_2_CHIP:
7003 + ulSdramSize = 64 * 1024 * 1024;
7004 + break;
7005 + default:
7006 + ulSdramSize = 8 * 1024 * 1024;
7007 + break;
7008 + }
7009 + if (boot_loader_type == BOOT_CFE)
7010 + return ulSdramSize;
7011 + else
7012 + // assume that there is one contiguous memory map
7013 + return boot_mem_map.map[0].size;
7014 +}
7015 +
7016 +/* --------------------------------------------------------------------------
7017 + Name: prom_init
7018 + -------------------------------------------------------------------------- */
7019 +void __init prom_init(void)
7020 +{
7021 + extern ulong r4k_interval;
7022 +
7023 + serial_init();
7024 +
7025 + /* Need to fixup boot loader detection code
7026 + * whithout changing prom_init prototype
7027 + */
7028 +
7029 + do_syslog(8, NULL, 8);
7030 +
7031 + printk( "%s prom init\n", get_system_type() );
7032 +
7033 + PERF->IrqMask = 0;
7034 +
7035 + arcs_cmdline[0] = '\0';
7036 +
7037 + if (boot_loader_type == BOOT_CFE)
7038 + add_memory_region(0, (getMemorySize() - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
7039 + else
7040 + add_memory_region(0, (0x01000000 - ADSL_SDRAM_IMAGE_SIZE), BOOT_MEM_RAM);
7041 +
7042 + mips_machgroup = MACH_GROUP_BRCM;
7043 + mips_machtype = MACH_BCM;
7044 +
7045 + BpSetBoardId("96348GW-10");
7046 +}
7047 +
7048 +/* --------------------------------------------------------------------------
7049 + Name: prom_free_prom_memory
7050 +Abstract:
7051 + -------------------------------------------------------------------------- */
7052 +void __init prom_free_prom_memory(void)
7053 +{
7054 +
7055 +}
7056 +
7057 diff -urN linux.old/arch/mips/bcm963xx/ser_init.c linux.dev/arch/mips/bcm963xx/ser_init.c
7058 --- linux.old/arch/mips/bcm963xx/ser_init.c 1970-01-01 01:00:00.000000000 +0100
7059 +++ linux.dev/arch/mips/bcm963xx/ser_init.c 2006-08-25 00:39:38.000000000 +0200
7060 @@ -0,0 +1,180 @@
7061 +/*
7062 +<:copyright-gpl
7063 + Copyright 2004 Broadcom Corp. All Rights Reserved.
7064 +
7065 + This program is free software; you can distribute it and/or modify it
7066 + under the terms of the GNU General Public License (Version 2) as
7067 + published by the Free Software Foundation.
7068 +
7069 + This program is distributed in the hope it will be useful, but WITHOUT
7070 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7071 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7072 + for more details.
7073 +
7074 + You should have received a copy of the GNU General Public License along
7075 + with this program; if not, write to the Free Software Foundation, Inc.,
7076 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
7077 +:>
7078 +*/
7079 +/*
7080 + * Broadcom bcm63xx serial port initialization, also prepare for printk
7081 + * by registering with console_init
7082 + *
7083 + */
7084 +
7085 +#include <linux/config.h>
7086 +#include <linux/init.h>
7087 +#include <linux/interrupt.h>
7088 +#include <linux/kernel.h>
7089 +#include <linux/types.h>
7090 +#include <linux/console.h>
7091 +#include <linux/sched.h>
7092 +
7093 +#include <asm/addrspace.h>
7094 +#include <asm/irq.h>
7095 +#include <asm/reboot.h>
7096 +#include <asm/gdb-stub.h>
7097 +#include <asm/mc146818rtc.h>
7098 +
7099 +#include <bcm_map_part.h>
7100 +#include <board.h>
7101 +
7102 +#define SER63XX_DEFAULT_BAUD 115200
7103 +#define BD_BCM63XX_TIMER_CLOCK_INPUT (FPERIPH)
7104 +#define stUart ((volatile Uart * const) UART_BASE)
7105 +
7106 +// Transmit interrupts
7107 +#define TXINT (TXFIFOEMT | TXUNDERR | TXOVFERR)
7108 +// Receive interrupts
7109 +#define RXINT (RXFIFONE | RXOVFERR)
7110 +
7111 +/* --------------------------------------------------------------------------
7112 + Name: serial_init
7113 + Purpose: Initalize the UART
7114 +-------------------------------------------------------------------------- */
7115 +void __init serial_init(void)
7116 +{
7117 + UINT32 tmpVal = SER63XX_DEFAULT_BAUD;
7118 + ULONG clockFreqHz;
7119 +
7120 +#if defined(CONFIG_BCM96345)
7121 + // Make sure clock is ticking
7122 + PERF->blkEnables |= UART_CLK_EN;
7123 +#endif
7124 +
7125 + /* Dissable channel's receiver and transmitter. */
7126 + stUart->control &= ~(BRGEN|TXEN|RXEN);
7127 +
7128 + /*--------------------------------------------------------------------*/
7129 + /* Write the table value to the clock select register. */
7130 + /* DPullen - this is the equation to use: */
7131 + /* value = clockFreqHz / baud / 32-1; */
7132 + /* (snmod) Actually you should also take into account any necessary */
7133 + /* rounding. Divide by 16, look at lsb, if 0, divide by 2 */
7134 + /* and subtract 1. If 1, just divide by 2 */
7135 + /*--------------------------------------------------------------------*/
7136 + clockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
7137 + tmpVal = (clockFreqHz / tmpVal) / 16;
7138 + if( tmpVal & 0x01 )
7139 + tmpVal /= 2; //Rounding up, so sub is already accounted for
7140 + else
7141 + tmpVal = (tmpVal / 2) - 1; // Rounding down so we must sub 1
7142 + stUart->baudword = tmpVal;
7143 +
7144 + /* Finally, re-enable the transmitter and receiver. */
7145 + stUart->control |= (BRGEN|TXEN|RXEN);
7146 +
7147 + stUart->config = (BITS8SYM | ONESTOP);
7148 + // Set the FIFO interrupt depth ... stUart->fifocfg = 0xAA;
7149 + stUart->fifoctl = RSTTXFIFOS | RSTRXFIFOS;
7150 + stUart->intMask = 0;
7151 + stUart->intMask = RXINT | TXINT;
7152 +}
7153 +
7154 +
7155 +/* prom_putc()
7156 + * Output a character to the UART
7157 + */
7158 +void prom_putc(char c)
7159 +{
7160 + /* Wait for Tx uffer to empty */
7161 + while (! (READ16(stUart->intStatus) & TXFIFOEMT));
7162 + /* Send character */
7163 + stUart->Data = c;
7164 +}
7165 +
7166 +/* prom_puts()
7167 + * Write a string to the UART
7168 + */
7169 +void prom_puts(const char *s)
7170 +{
7171 + while (*s) {
7172 + if (*s == '\n') {
7173 + prom_putc('\r');
7174 + }
7175 + prom_putc(*s++);
7176 + }
7177 +}
7178 +
7179 +
7180 +/* prom_getc_nowait()
7181 + * Returns a character from the UART
7182 + * Returns -1 if no characters available or corrupted
7183 + */
7184 +int prom_getc_nowait(void)
7185 +{
7186 + uint16 uStatus;
7187 + int cData = -1;
7188 +
7189 + uStatus = READ16(stUart->intStatus);
7190 +
7191 + if (uStatus & RXFIFONE) { /* Do we have a character? */
7192 + cData = READ16(stUart->Data) & 0xff; /* Read character */
7193 + if (uStatus & (RXFRAMERR | RXPARERR)) { /* If we got an error, throw it away */
7194 + cData = -1;
7195 + }
7196 + }
7197 +
7198 + return cData;
7199 +}
7200 +
7201 +/* prom_getc()
7202 + * Returns a charcter from the serial port
7203 + * Will block until it receives a valid character
7204 +*/
7205 +char prom_getc(void)
7206 +{
7207 + int cData = -1;
7208 +
7209 + /* Loop until we get a valid character */
7210 + while(cData == -1) {
7211 + cData = prom_getc_nowait();
7212 + }
7213 + return (char) cData;
7214 +}
7215 +
7216 +/* prom_testc()
7217 + * Returns 0 if no characters available
7218 + */
7219 +int prom_testc(void)
7220 +{
7221 + uint16 uStatus;
7222 +
7223 + uStatus = READ16(stUart->intStatus);
7224 +
7225 + return (uStatus & RXFIFONE);
7226 +}
7227 +
7228 +#if defined (CONFIG_REMOTE_DEBUG)
7229 +/* Prevent other code from writing to the serial port */
7230 +void _putc(char c) { }
7231 +void _puts(const char *ptr) { }
7232 +#else
7233 +/* Low level outputs call prom routines */
7234 +void _putc(char c) {
7235 + prom_putc(c);
7236 +}
7237 +void _puts(const char *ptr) {
7238 + prom_puts(ptr);
7239 +}
7240 +#endif
7241 diff -urN linux.old/arch/mips/bcm963xx/setup.c linux.dev/arch/mips/bcm963xx/setup.c
7242 --- linux.old/arch/mips/bcm963xx/setup.c 1970-01-01 01:00:00.000000000 +0100
7243 +++ linux.dev/arch/mips/bcm963xx/setup.c 2006-08-25 02:26:58.000000000 +0200
7244 @@ -0,0 +1,525 @@
7245 +/*
7246 +<:copyright-gpl
7247 + Copyright 2002 Broadcom Corp. All Rights Reserved.
7248 +
7249 + This program is free software; you can distribute it and/or modify it
7250 + under the terms of the GNU General Public License (Version 2) as
7251 + published by the Free Software Foundation.
7252 +
7253 + This program is distributed in the hope it will be useful, but WITHOUT
7254 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7255 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7256 + for more details.
7257 +
7258 + You should have received a copy of the GNU General Public License along
7259 + with this program; if not, write to the Free Software Foundation, Inc.,
7260 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
7261 +:>
7262 +*/
7263 +/*
7264 + * Generic setup routines for Broadcom 963xx MIPS boards
7265 + */
7266 +
7267 +#include <linux/config.h>
7268 +#include <linux/init.h>
7269 +#include <linux/interrupt.h>
7270 +#include <linux/kernel.h>
7271 +#include <linux/kdev_t.h>
7272 +#include <linux/types.h>
7273 +#include <linux/console.h>
7274 +#include <linux/sched.h>
7275 +#include <linux/mm.h>
7276 +#include <linux/slab.h>
7277 +#include <linux/module.h>
7278 +#include <linux/pm.h>
7279 +
7280 +#include <asm/addrspace.h>
7281 +#include <asm/bcache.h>
7282 +#include <asm/irq.h>
7283 +#include <asm/time.h>
7284 +#include <asm/reboot.h>
7285 +#include <asm/gdb-stub.h>
7286 +
7287 +extern void brcm_time_init(void);
7288 +extern void brcm_timer_setup(struct irqaction *irq);
7289 +extern unsigned long getMemorySize(void);
7290 +
7291 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
7292 +#include <linux/pci.h>
7293 +#include <linux/delay.h>
7294 +#include <bcm_map_part.h>
7295 +#include <bcmpci.h>
7296 +
7297 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
7298 +#endif
7299 +
7300 +/* This function should be in a board specific directory. For now,
7301 + * assume that all boards that include this file use a Broadcom chip
7302 + * with a soft reset bit in the PLL control register.
7303 + */
7304 +static void brcm_machine_restart(char *command)
7305 +{
7306 + const unsigned long ulSoftReset = 0x00000001;
7307 + unsigned long *pulPllCtrl = (unsigned long *) 0xfffe0008;
7308 + *pulPllCtrl |= ulSoftReset;
7309 +}
7310 +
7311 +static void brcm_machine_halt(void)
7312 +{
7313 + printk("System halted\n");
7314 + while (1);
7315 +}
7316 +
7317 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
7318 +
7319 +static void mpi_SetLocalPciConfigReg(uint32 reg, uint32 value)
7320 +{
7321 + /* write index then value */
7322 + mpi->pcicfgcntrl = PCI_CFG_REG_WRITE_EN + reg;;
7323 + mpi->pcicfgdata = value;
7324 +}
7325 +
7326 +static uint32 mpi_GetLocalPciConfigReg(uint32 reg)
7327 +{
7328 + /* write index then get value */
7329 + mpi->pcicfgcntrl = PCI_CFG_REG_WRITE_EN + reg;;
7330 + return mpi->pcicfgdata;
7331 +}
7332 +
7333 +/*
7334 + * mpi_ResetPcCard: Set/Reset the PcCard
7335 + */
7336 +static void mpi_ResetPcCard(int cardtype, BOOL bReset)
7337 +{
7338 + if (cardtype == MPI_CARDTYPE_NONE) {
7339 + return;
7340 + }
7341 +
7342 + if (cardtype == MPI_CARDTYPE_CARDBUS) {
7343 + bReset = ! bReset;
7344 + }
7345 +
7346 + if (bReset) {
7347 + mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & ~PCCARD_CARD_RESET);
7348 + } else {
7349 + mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 | PCCARD_CARD_RESET);
7350 + }
7351 +}
7352 +
7353 +/*
7354 + * mpi_ConfigCs: Configure an MPI/EBI chip select
7355 + */
7356 +static void mpi_ConfigCs(uint32 cs, uint32 base, uint32 size, uint32 flags)
7357 +{
7358 + mpi->cs[cs].base = ((base & 0x1FFFFFFF) | size);
7359 + mpi->cs[cs].config = flags;
7360 +}
7361 +
7362 +/*
7363 + * mpi_InitPcmciaSpace
7364 + */
7365 +static void mpi_InitPcmciaSpace(void)
7366 +{
7367 + // ChipSelect 4 controls PCMCIA Memory accesses
7368 + mpi_ConfigCs(PCMCIA_COMMON_BASE, pcmciaMem, EBI_SIZE_1M, (EBI_WORD_WIDE|EBI_ENABLE));
7369 + // ChipSelect 5 controls PCMCIA Attribute accesses
7370 + mpi_ConfigCs(PCMCIA_ATTRIBUTE_BASE, pcmciaAttr, EBI_SIZE_1M, (EBI_WORD_WIDE|EBI_ENABLE));
7371 + // ChipSelect 6 controls PCMCIA I/O accesses
7372 + mpi_ConfigCs(PCMCIA_IO_BASE, pcmciaIo, EBI_SIZE_64K, (EBI_WORD_WIDE|EBI_ENABLE));
7373 +
7374 + mpi->pcmcia_cntl2 = ((PCMCIA_ATTR_ACTIVE << RW_ACTIVE_CNT_BIT) |
7375 + (PCMCIA_ATTR_INACTIVE << INACTIVE_CNT_BIT) |
7376 + (PCMCIA_ATTR_CE_SETUP << CE_SETUP_CNT_BIT) |
7377 + (PCMCIA_ATTR_CE_HOLD << CE_HOLD_CNT_BIT));
7378 +
7379 + mpi->pcmcia_cntl2 |= (PCMCIA_HALFWORD_EN | PCMCIA_BYTESWAP_DIS);
7380 +}
7381 +
7382 +/*
7383 + * cardtype_vcc_detect: PC Card's card detect and voltage sense connection
7384 + *
7385 + * CD1#/ CD2#/ VS1#/ VS2#/ Card Initial Vcc
7386 + * CCD1# CCD2# CVS1 CVS2 Type
7387 + *
7388 + * GND GND open open 16-bit 5 vdc
7389 + *
7390 + * GND GND GND open 16-bit 3.3 vdc
7391 + *
7392 + * GND GND open GND 16-bit x.x vdc
7393 + *
7394 + * GND GND GND GND 16-bit 3.3 & x.x vdc
7395 + *
7396 + *====================================================================
7397 + *
7398 + * CVS1 GND CCD1# open CardBus 3.3 vdc
7399 + *
7400 + * GND CVS2 open CCD2# CardBus x.x vdc
7401 + *
7402 + * GND CVS1 CCD2# open CardBus y.y vdc
7403 + *
7404 + * GND CVS2 GND CCD2# CardBus 3.3 & x.x vdc
7405 + *
7406 + * CVS2 GND open CCD1# CardBus x.x & y.y vdc
7407 + *
7408 + * GND CVS1 CCD2# open CardBus 3.3, x.x & y.y vdc
7409 + *
7410 + */
7411 +static int cardtype_vcc_detect(void)
7412 +{
7413 + uint32 data32;
7414 + int cardtype;
7415 +
7416 + cardtype = MPI_CARDTYPE_NONE;
7417 + mpi->pcmcia_cntl1 = 0x0000A000; // Turn on the output enables and drive
7418 + // the CVS pins to 0.
7419 + data32 = mpi->pcmcia_cntl1;
7420 + switch (data32 & 0x00000003) // Test CD1# and CD2#, see if card is plugged in.
7421 + {
7422 + case 0x00000003: // No Card is in the slot.
7423 + printk("mpi: No Card is in the PCMCIA slot\n");
7424 + break;
7425 +
7426 + case 0x00000002: // Partial insertion, No CD2#.
7427 + printk("mpi: Card in the PCMCIA slot partial insertion, no CD2 signal\n");
7428 + break;
7429 +
7430 + case 0x00000001: // Partial insertion, No CD1#.
7431 + printk("mpi: Card in the PCMCIA slot partial insertion, no CD1 signal\n");
7432 + break;
7433 +
7434 + case 0x00000000:
7435 + mpi->pcmcia_cntl1 = 0x0000A0C0; // Turn off the CVS output enables and
7436 + // float the CVS pins.
7437 + mdelay(1);
7438 + data32 = mpi->pcmcia_cntl1;
7439 + // Read the Register.
7440 + switch (data32 & 0x0000000C) // See what is on the CVS pins.
7441 + {
7442 + case 0x00000000: // CVS1 and CVS2 are tied to ground, only 1 option.
7443 + printk("mpi: Detected 3.3 & x.x 16-bit PCMCIA card\n");
7444 + cardtype = MPI_CARDTYPE_PCMCIA;
7445 + break;
7446 +
7447 + case 0x00000004: // CVS1 is open or tied to CCD1/CCD2 and CVS2 is tied to ground.
7448 + // 2 valid voltage options.
7449 + switch (data32 & 0x00000003) // Test the values of CCD1 and CCD2.
7450 + {
7451 + case 0x00000003: // CCD1 and CCD2 are tied to 1 of the CVS pins.
7452 + // This is not a valid combination.
7453 + printk("mpi: Unknown card plugged into slot\n");
7454 + break;
7455 +
7456 + case 0x00000002: // CCD2 is tied to either CVS1 or CVS2.
7457 + mpi->pcmcia_cntl1 = 0x0000A080; // Drive CVS1 to a 0.
7458 + mdelay(1);
7459 + data32 = mpi->pcmcia_cntl1;
7460 + if (data32 & 0x00000002) { // CCD2 is tied to CVS2, not valid.
7461 + printk("mpi: Unknown card plugged into slot\n");
7462 + } else { // CCD2 is tied to CVS1.
7463 + printk("mpi: Detected 3.3, x.x and y.y Cardbus card\n");
7464 + cardtype = MPI_CARDTYPE_CARDBUS;
7465 + }
7466 + break;
7467 +
7468 + case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
7469 + // This is not a valid combination.
7470 + printk("mpi: Unknown card plugged into slot\n");
7471 + break;
7472 +
7473 + case 0x00000000: // CCD1 and CCD2 are tied to ground.
7474 + printk("mpi: Detected x.x vdc 16-bit PCMCIA card\n");
7475 + cardtype = MPI_CARDTYPE_PCMCIA;
7476 + break;
7477 + }
7478 + break;
7479 +
7480 + case 0x00000008: // CVS2 is open or tied to CCD1/CCD2 and CVS1 is tied to ground.
7481 + // 2 valid voltage options.
7482 + switch (data32 & 0x00000003) // Test the values of CCD1 and CCD2.
7483 + {
7484 + case 0x00000003: // CCD1 and CCD2 are tied to 1 of the CVS pins.
7485 + // This is not a valid combination.
7486 + printk("mpi: Unknown card plugged into slot\n");
7487 + break;
7488 +
7489 + case 0x00000002: // CCD2 is tied to either CVS1 or CVS2.
7490 + mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
7491 + mdelay(1);
7492 + data32 = mpi->pcmcia_cntl1;
7493 + if (data32 & 0x00000002) { // CCD2 is tied to CVS1, not valid.
7494 + printk("mpi: Unknown card plugged into slot\n");
7495 + } else {// CCD2 is tied to CVS2.
7496 + printk("mpi: Detected 3.3 and x.x Cardbus card\n");
7497 + cardtype = MPI_CARDTYPE_CARDBUS;
7498 + }
7499 + break;
7500 +
7501 + case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
7502 + // This is not a valid combination.
7503 + printk("mpi: Unknown card plugged into slot\n");
7504 + break;
7505 +
7506 + case 0x00000000: // CCD1 and CCD2 are tied to ground.
7507 + cardtype = MPI_CARDTYPE_PCMCIA;
7508 + printk("mpi: Detected 3.3 vdc 16-bit PCMCIA card\n");
7509 + break;
7510 + }
7511 + break;
7512 +
7513 + case 0x0000000C: // CVS1 and CVS2 are open or tied to CCD1/CCD2.
7514 + // 5 valid voltage options.
7515 +
7516 + switch (data32 & 0x00000003) // Test the values of CCD1 and CCD2.
7517 + {
7518 + case 0x00000003: // CCD1 and CCD2 are tied to 1 of the CVS pins.
7519 + // This is not a valid combination.
7520 + printk("mpi: Unknown card plugged into slot\n");
7521 + break;
7522 +
7523 + case 0x00000002: // CCD2 is tied to either CVS1 or CVS2.
7524 + // CCD1 is tied to ground.
7525 + mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
7526 + mdelay(1);
7527 + data32 = mpi->pcmcia_cntl1;
7528 + if (data32 & 0x00000002) { // CCD2 is tied to CVS1.
7529 + printk("mpi: Detected y.y vdc Cardbus card\n");
7530 + } else { // CCD2 is tied to CVS2.
7531 + printk("mpi: Detected x.x vdc Cardbus card\n");
7532 + }
7533 + cardtype = MPI_CARDTYPE_CARDBUS;
7534 + break;
7535 +
7536 + case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
7537 + // CCD2 is tied to ground.
7538 +
7539 + mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
7540 + mdelay(1);
7541 + data32 = mpi->pcmcia_cntl1;
7542 + if (data32 & 0x00000001) {// CCD1 is tied to CVS1.
7543 + printk("mpi: Detected 3.3 vdc Cardbus card\n");
7544 + } else { // CCD1 is tied to CVS2.
7545 + printk("mpi: Detected x.x and y.y Cardbus card\n");
7546 + }
7547 + cardtype = MPI_CARDTYPE_CARDBUS;
7548 + break;
7549 +
7550 + case 0x00000000: // CCD1 and CCD2 are tied to ground.
7551 + cardtype = MPI_CARDTYPE_PCMCIA;
7552 + printk("mpi: Detected 5 vdc 16-bit PCMCIA card\n");
7553 + break;
7554 + }
7555 + break;
7556 +
7557 + default:
7558 + printk("mpi: Unknown card plugged into slot\n");
7559 + break;
7560 +
7561 + }
7562 + }
7563 + return cardtype;
7564 +}
7565 +
7566 +/*
7567 + * mpi_DetectPcCard: Detect the plugged in PC-Card
7568 + * Return: < 0 => Unknown card detected
7569 + * 0 => No card detected
7570 + * 1 => 16-bit card detected
7571 + * 2 => 32-bit CardBus card detected
7572 + */
7573 +static int mpi_DetectPcCard(void)
7574 +{
7575 + int cardtype;
7576 +
7577 + cardtype = cardtype_vcc_detect();
7578 + switch(cardtype) {
7579 + case MPI_CARDTYPE_PCMCIA:
7580 + mpi->pcmcia_cntl1 &= ~0x0000e000; // disable enable bits
7581 + //mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & ~PCCARD_CARD_RESET);
7582 + mpi->pcmcia_cntl1 |= (PCMCIA_ENABLE | PCMCIA_GPIO_ENABLE);
7583 + mpi_InitPcmciaSpace();
7584 + mpi_ResetPcCard(cardtype, FALSE);
7585 + // Hold card in reset for 10ms
7586 + mdelay(10);
7587 + mpi_ResetPcCard(cardtype, TRUE);
7588 + // Let card come out of reset
7589 + mdelay(100);
7590 + break;
7591 + case MPI_CARDTYPE_CARDBUS:
7592 + // 8 => CardBus Enable
7593 + // 1 => PCI Slot Number
7594 + // C => Float VS1 & VS2
7595 + mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & 0xFFFF0000) |
7596 + CARDBUS_ENABLE |
7597 + (CARDBUS_SLOT << 8)|
7598 + VS2_OEN |
7599 + VS1_OEN;
7600 + /* access to this memory window will be to/from CardBus */
7601 + mpi->l2pmremap1 |= CARDBUS_MEM;
7602 +
7603 + // Need to reset the Cardbus Card. There's no CardManager to do this,
7604 + // and we need to be ready for PCI configuration.
7605 + mpi_ResetPcCard(cardtype, FALSE);
7606 + // Hold card in reset for 10ms
7607 + mdelay(10);
7608 + mpi_ResetPcCard(cardtype, TRUE);
7609 + // Let card come out of reset
7610 + mdelay(100);
7611 + break;
7612 + default:
7613 + break;
7614 + }
7615 + return cardtype;
7616 +}
7617 +
7618 +static int mpi_init(void)
7619 +{
7620 + unsigned long data;
7621 + unsigned int chipid;
7622 + unsigned int chiprev;
7623 + unsigned int sdramsize;
7624 +
7625 + chipid = (PERF->RevID & 0xFFFF0000) >> 16;
7626 + chiprev = (PERF->RevID & 0xFF);
7627 + sdramsize = getMemorySize();
7628 + /*
7629 + * Init the pci interface
7630 + */
7631 + data = GPIO->GPIOMode; // GPIO mode register
7632 + data |= GROUP2_PCI | GROUP1_MII_PCCARD; // PCI internal arbiter + Cardbus
7633 + GPIO->GPIOMode = data; // PCI internal arbiter
7634 +
7635 + /*
7636 + * In the BCM6348 CardBus support is defaulted to Slot 0
7637 + * because there is no external IDSEL for CardBus. To disable
7638 + * the CardBus and allow a standard PCI card in Slot 0
7639 + * set the cbus_idsel field to 0x1f.
7640 + */
7641 + /*
7642 + uData = mpi->pcmcia_cntl1;
7643 + uData |= CARDBUS_IDSEL;
7644 + mpi->pcmcia_cntl1 = uData;
7645 + */
7646 + // Setup PCI I/O Window range. Give 64K to PCI I/O
7647 + mpi->l2piorange = ~(BCM_PCI_IO_SIZE_64KB-1);
7648 + // UBUS to PCI I/O base address
7649 + mpi->l2piobase = BCM_PCI_IO_BASE & BCM_PCI_ADDR_MASK;
7650 + // UBUS to PCI I/O Window remap
7651 + mpi->l2pioremap = (BCM_PCI_IO_BASE | MEM_WINDOW_EN);
7652 +
7653 + // enable PCI related GPIO pins and data swap between system and PCI bus
7654 + mpi->locbuscntrl = (EN_PCI_GPIO | DIR_U2P_NOSWAP);
7655 +
7656 + /* Enable 6348 BusMaster and Memory access mode */
7657 + data = mpi_GetLocalPciConfigReg(PCI_COMMAND);
7658 + data |= (PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
7659 + mpi_SetLocalPciConfigReg(PCI_COMMAND, data);
7660 +
7661 + /* Configure two 16 MByte PCI to System memory regions. */
7662 + /* These memory regions are used when PCI device is a bus master */
7663 + /* Accesses to the SDRAM from PCI bus will be "byte swapped" for this region */
7664 + mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_3, BCM_HOST_MEM_SPACE1);
7665 + mpi->sp0remap = 0x0;
7666 +
7667 + /* Accesses to the SDRAM from PCI bus will not be "byte swapped" for this region */
7668 + mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_4, BCM_HOST_MEM_SPACE2);
7669 + mpi->sp1remap = 0x0;
7670 + mpi->pcimodesel |= (PCI_BAR2_NOSWAP | 0x40);
7671 +
7672 + if ((chipid == 0x6348) && (chiprev == 0xb0)) {
7673 + mpi->sp0range = ~(sdramsize-1);
7674 + mpi->sp1range = ~(sdramsize-1);
7675 + }
7676 + /*
7677 + * Change 6348 PCI Cfg Reg. offset 0x40 to PCI memory read retry count infinity
7678 + * by set 0 in bit 8~15. This resolve read Bcm4306 srom return 0xffff in
7679 + * first read.
7680 + */
7681 + data = mpi_GetLocalPciConfigReg(BRCM_PCI_CONFIG_TIMER);
7682 + data &= ~BRCM_PCI_CONFIG_TIMER_RETRY_MASK;
7683 + data |= 0x00000080;
7684 + mpi_SetLocalPciConfigReg(BRCM_PCI_CONFIG_TIMER, data);
7685 +
7686 + /* enable pci interrupt */
7687 + mpi->locintstat |= (EXT_PCI_INT << 16);
7688 +
7689 + mpi_DetectPcCard();
7690 +
7691 + ioport_resource.start = BCM_PCI_IO_BASE;
7692 + ioport_resource.end = BCM_PCI_IO_BASE + BCM_PCI_IO_SIZE_64KB;
7693 +
7694 +#if defined(CONFIG_USB)
7695 + PERF->blkEnables |= USBH_CLK_EN;
7696 + mdelay(100);
7697 + *USBH_NON_OHCI = NON_OHCI_BYTE_SWAP;
7698 +#endif
7699 +
7700 + return 0;
7701 +}
7702 +#endif
7703 +
7704 +static int __init brcm63xx_setup(void)
7705 +{
7706 + extern int panic_timeout;
7707 +
7708 + _machine_restart = brcm_machine_restart;
7709 + _machine_halt = brcm_machine_halt;
7710 + pm_power_off = brcm_machine_halt;
7711 +
7712 + board_time_init = brcm_time_init;
7713 + board_timer_setup = brcm_timer_setup;
7714 +
7715 + panic_timeout = 5;
7716 +
7717 +#if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
7718 + /* mpi initialization */
7719 + mpi_init();
7720 +#endif
7721 + return 0;
7722 +}
7723 +
7724 +void plat_setup(void)
7725 +{
7726 + brcm63xx_setup();
7727 +}
7728 +
7729 +/***************************************************************************
7730 + * C++ New and delete operator functions
7731 + ***************************************************************************/
7732 +
7733 +/* void *operator new(unsigned int sz) */
7734 +void *_Znwj(unsigned int sz)
7735 +{
7736 + return( kmalloc(sz, GFP_KERNEL) );
7737 +}
7738 +
7739 +/* void *operator new[](unsigned int sz)*/
7740 +void *_Znaj(unsigned int sz)
7741 +{
7742 + return( kmalloc(sz, GFP_KERNEL) );
7743 +}
7744 +
7745 +/* placement new operator */
7746 +/* void *operator new (unsigned int size, void *ptr) */
7747 +void *ZnwjPv(unsigned int size, void *ptr)
7748 +{
7749 + return ptr;
7750 +}
7751 +
7752 +/* void operator delete(void *m) */
7753 +void _ZdlPv(void *m)
7754 +{
7755 + kfree(m);
7756 +}
7757 +
7758 +/* void operator delete[](void *m) */
7759 +void _ZdaPv(void *m)
7760 +{
7761 + kfree(m);
7762 +}
7763 +
7764 +EXPORT_SYMBOL(_Znwj);
7765 +EXPORT_SYMBOL(_Znaj);
7766 +EXPORT_SYMBOL(ZnwjPv);
7767 +EXPORT_SYMBOL(_ZdlPv);
7768 +EXPORT_SYMBOL(_ZdaPv);
7769 +
7770 diff -urN linux.old/arch/mips/bcm963xx/softdsl/AdslCoreDefs.h linux.dev/arch/mips/bcm963xx/softdsl/AdslCoreDefs.h
7771 --- linux.old/arch/mips/bcm963xx/softdsl/AdslCoreDefs.h 1970-01-01 01:00:00.000000000 +0100
7772 +++ linux.dev/arch/mips/bcm963xx/softdsl/AdslCoreDefs.h 2006-08-25 00:39:38.000000000 +0200
7773 @@ -0,0 +1,2 @@
7774 +#define ADSL_SDRAM_IMAGE_SIZE (384*1024)
7775 +
7776 diff -urN linux.old/arch/mips/bcm963xx/time.c linux.dev/arch/mips/bcm963xx/time.c
7777 --- linux.old/arch/mips/bcm963xx/time.c 1970-01-01 01:00:00.000000000 +0100
7778 +++ linux.dev/arch/mips/bcm963xx/time.c 2006-08-25 03:58:22.000000000 +0200
7779 @@ -0,0 +1,114 @@
7780 +/*
7781 +<:copyright-gpl
7782 + Copyright 2004 Broadcom Corp. All Rights Reserved.
7783 +
7784 + This program is free software; you can distribute it and/or modify it
7785 + under the terms of the GNU General Public License (Version 2) as
7786 + published by the Free Software Foundation.
7787 +
7788 + This program is distributed in the hope it will be useful, but WITHOUT
7789 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7790 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7791 + for more details.
7792 +
7793 + You should have received a copy of the GNU General Public License along
7794 + with this program; if not, write to the Free Software Foundation, Inc.,
7795 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
7796 +:>
7797 +*/
7798 +/*
7799 + * Setup time for Broadcom 963xx MIPS boards
7800 + */
7801 +
7802 +#include <linux/config.h>
7803 +#include <linux/init.h>
7804 +#include <linux/kernel_stat.h>
7805 +#include <linux/sched.h>
7806 +#include <linux/spinlock.h>
7807 +#include <linux/interrupt.h>
7808 +#include <linux/module.h>
7809 +#include <linux/time.h>
7810 +#include <linux/timex.h>
7811 +
7812 +#include <asm/mipsregs.h>
7813 +#include <asm/ptrace.h>
7814 +#include <asm/div64.h>
7815 +#include <asm/time.h>
7816 +
7817 +#include <bcm_map_part.h>
7818 +#include <bcm_intr.h>
7819 +
7820 +static unsigned long r4k_offset; /* Amount to increment compare reg each time */
7821 +static unsigned long r4k_cur; /* What counter should be at next timer irq */
7822 +
7823 +/* *********************************************************************
7824 + * calculateCpuSpeed()
7825 + * Calculate the BCM6348 CPU speed by reading the PLL strap register
7826 + * and applying the following formula:
7827 + * cpu_clk = (.25 * 64MHz freq) * (N1 + 1) * (N2 + 2) / (M1_CPU + 1)
7828 + * Input parameters:
7829 + * none
7830 + * Return value:
7831 + * none
7832 + ********************************************************************* */
7833 +
7834 +static inline unsigned long __init calculateCpuSpeed(void)
7835 +{
7836 + UINT32 pllStrap = PERF->PllStrap;
7837 + int n1 = (pllStrap & PLL_N1_MASK) >> PLL_N1_SHFT;
7838 + int n2 = (pllStrap & PLL_N2_MASK) >> PLL_N2_SHFT;
7839 + int m1cpu = (pllStrap & PLL_M1_CPU_MASK) >> PLL_M1_CPU_SHFT;
7840 +
7841 + return (16 * (n1 + 1) * (n2 + 2) / (m1cpu + 1)) * 1000000;
7842 +}
7843 +
7844 +
7845 +static inline unsigned long __init cal_r4koff(void)
7846 +{
7847 + mips_hpt_frequency = calculateCpuSpeed() / 2;
7848 + return (mips_hpt_frequency / HZ);
7849 +}
7850 +
7851 +
7852 +/*
7853 + * There are a lot of conceptually broken versions of the MIPS timer interrupt
7854 + * handler floating around. This one is rather different, but the algorithm
7855 + * is provably more robust.
7856 + */
7857 +irqreturn_t brcm_timer_interrupt(struct pt_regs *regs)
7858 +{
7859 + int irq = MIPS_TIMER_INT;
7860 +
7861 + irq_enter();
7862 + kstat_this_cpu.irqs[irq]++;
7863 +
7864 + timer_interrupt(irq, NULL, regs);
7865 + irq_exit();
7866 + return IRQ_HANDLED;
7867 +}
7868 +
7869 +
7870 +void __init brcm_time_init(void)
7871 +{
7872 + unsigned int est_freq, flags;
7873 + local_irq_save(flags);
7874 +
7875 + printk("calculating r4koff... ");
7876 + r4k_offset = cal_r4koff();
7877 + printk("%08lx(%d)\n", r4k_offset, (int)r4k_offset);
7878 +
7879 + est_freq = 2 * r4k_offset * HZ;
7880 + est_freq += 5000; /* round */
7881 + est_freq -= est_freq % 10000;
7882 + printk("CPU frequency %d.%02d MHz\n", est_freq / 1000000,
7883 + (est_freq % 1000000) * 100 / 1000000);
7884 + local_irq_restore(flags);
7885 +}
7886 +
7887 +
7888 +void __init brcm_timer_setup(struct irqaction *irq)
7889 +{
7890 + r4k_cur = (read_c0_count() + r4k_offset);
7891 + write_c0_compare(r4k_cur);
7892 + set_c0_status(IE_IRQ5);
7893 +}
7894 diff -urN linux.old/arch/mips/Kconfig linux.dev/arch/mips/Kconfig
7895 --- linux.old/arch/mips/Kconfig 2006-08-25 00:43:39.000000000 +0200
7896 +++ linux.dev/arch/mips/Kconfig 2006-08-25 01:57:46.000000000 +0200
7897 @@ -12,6 +12,15 @@
7898 prompt "System type"
7899 default SGI_IP22
7900
7901 +config MIPS_BRCM
7902 + bool "Support for the Broadcom boards"
7903 + select SYS_SUPPORTS_32BIT_KERNEL
7904 + select SYS_SUPPORTS_BIG_ENDIAN
7905 + select SYS_HAS_CPU_MIPS32_R1
7906 + select IRQ_CPU
7907 + help
7908 + This is a fmaily of boards based on the Broadcom MIPS32
7909 +
7910 config MIPS_MTX1
7911 bool "4G Systems MTX-1 board"
7912 select DMA_NONCOHERENT
7913 @@ -780,6 +789,7 @@
7914
7915 endchoice
7916
7917 +source "arch/mips/bcm963xx/Kconfig"
7918 source "arch/mips/ddb5xxx/Kconfig"
7919 source "arch/mips/gt64120/ev64120/Kconfig"
7920 source "arch/mips/jazz/Kconfig"
7921 diff -urN linux.old/arch/mips/kernel/cpu-probe.c linux.dev/arch/mips/kernel/cpu-probe.c
7922 --- linux.old/arch/mips/kernel/cpu-probe.c 2006-08-25 00:43:39.000000000 +0200
7923 +++ linux.dev/arch/mips/kernel/cpu-probe.c 2006-08-25 00:39:38.000000000 +0200
7924 @@ -568,6 +568,25 @@
7925 return;
7926 }
7927
7928 +static inline void cpu_probe_broadcom(struct cpuinfo_mips *c)
7929 +{
7930 + decode_configs(c);
7931 + switch (c->processor_id & 0xff00) {
7932 + case PRID_IMP_BCM6338:
7933 + c->cputype = CPU_BCM6338;
7934 + break;
7935 + case PRID_IMP_BCM6345:
7936 + c->cputype = CPU_BCM6345;
7937 + break;
7938 + case PRID_IMP_BCM6348:
7939 + c->cputype = CPU_BCM6348;
7940 + break;
7941 + default:
7942 + c->cputype = CPU_UNKNOWN;
7943 + break;
7944 + }
7945 +}
7946 +
7947 static inline void cpu_probe_mips(struct cpuinfo_mips *c)
7948 {
7949 decode_configs(c);
7950 @@ -704,6 +723,9 @@
7951 case PRID_COMP_LEGACY:
7952 cpu_probe_legacy(c);
7953 break;
7954 + case PRID_COMP_BROADCOM:
7955 + cpu_probe_broadcom(c);
7956 + break;
7957 case PRID_COMP_MIPS:
7958 cpu_probe_mips(c);
7959 break;
7960 diff -urN linux.old/arch/mips/kernel/proc.c linux.dev/arch/mips/kernel/proc.c
7961 --- linux.old/arch/mips/kernel/proc.c 2006-08-25 00:43:39.000000000 +0200
7962 +++ linux.dev/arch/mips/kernel/proc.c 2006-08-25 00:39:38.000000000 +0200
7963 @@ -85,6 +85,9 @@
7964 [CPU_VR4181A] = "NEC VR4181A",
7965 [CPU_SR71000] = "Sandcraft SR71000",
7966 [CPU_PR4450] = "Philips PR4450",
7967 + [CPU_BCM6338] = "BCM6338",
7968 + [CPU_BCM6345] = "BCM6345",
7969 + [CPU_BCM6348] = "BCM6348",
7970 };
7971
7972
7973 diff -urN linux.old/arch/mips/Makefile linux.dev/arch/mips/Makefile
7974 --- linux.old/arch/mips/Makefile 2006-08-25 00:43:39.000000000 +0200
7975 +++ linux.dev/arch/mips/Makefile 2006-08-25 15:39:54.000000000 +0200
7976 @@ -145,6 +145,15 @@
7977 #
7978
7979 #
7980 +# Broadcom board
7981 +#
7982 +core-$(CONFIG_MIPS_BRCM) += arch/mips/bcm963xx/
7983 +cflags-$(CONFIG_MIPS_BRCM) += -Iinclude/asm-mips/mach-bcm963xx
7984 +cflags-$(CONFIG_MIPS_BRCM) += -Iarch/mips/bcm963xx/include
7985 +load-$(CONFIG_MIPS_BRCM) += 0xffffffff80010000
7986 +
7987 +
7988 +#
7989 # Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
7990 #
7991 core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
7992 diff -urN linux.old/arch/mips/mm/c-r4k.c linux.dev/arch/mips/mm/c-r4k.c
7993 --- linux.old/arch/mips/mm/c-r4k.c 2006-08-25 00:43:39.000000000 +0200
7994 +++ linux.dev/arch/mips/mm/c-r4k.c 2006-08-25 00:39:38.000000000 +0200
7995 @@ -914,6 +914,13 @@
7996 if (!(config & MIPS_CONF_M))
7997 panic("Don't know how to probe P-caches on this cpu.");
7998
7999 + if (c->cputype == CPU_BCM6338 || c->cputype == CPU_BCM6345 || c->cputype == CPU_BCM6348)
8000 + {
8001 + printk("brcm mips: enabling icache and dcache...\n");
8002 + /* Enable caches */
8003 + write_c0_diag(read_c0_diag() | 0xC0000000);
8004 + }
8005 +
8006 /*
8007 * So we seem to be a MIPS32 or MIPS64 CPU
8008 * So let's probe the I-cache ...
8009 diff -urN linux.old/arch/mips/mm/tlbex.c linux.dev/arch/mips/mm/tlbex.c
8010 --- linux.old/arch/mips/mm/tlbex.c 2006-08-25 00:43:39.000000000 +0200
8011 +++ linux.dev/arch/mips/mm/tlbex.c 2006-08-25 00:39:38.000000000 +0200
8012 @@ -882,6 +882,9 @@
8013 case CPU_4KSC:
8014 case CPU_20KC:
8015 case CPU_25KF:
8016 + case CPU_BCM6338:
8017 + case CPU_BCM6345:
8018 + case CPU_BCM6348:
8019 tlbw(p);
8020 break;
8021
8022 diff -urN linux.old/arch/mips/pci/fixup-bcm96348.c linux.dev/arch/mips/pci/fixup-bcm96348.c
8023 --- linux.old/arch/mips/pci/fixup-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
8024 +++ linux.dev/arch/mips/pci/fixup-bcm96348.c 2006-08-25 00:39:38.000000000 +0200
8025 @@ -0,0 +1,85 @@
8026 +/*
8027 +<:copyright-gpl
8028 + Copyright 2002 Broadcom Corp. All Rights Reserved.
8029 +
8030 + This program is free software; you can distribute it and/or modify it
8031 + under the terms of the GNU General Public License (Version 2) as
8032 + published by the Free Software Foundation.
8033 +
8034 + This program is distributed in the hope it will be useful, but WITHOUT
8035 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8036 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8037 + for more details.
8038 +
8039 + You should have received a copy of the GNU General Public License along
8040 + with this program; if not, write to the Free Software Foundation, Inc.,
8041 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
8042 +:>
8043 +*/
8044 +#include <linux/init.h>
8045 +#include <linux/types.h>
8046 +#include <linux/pci.h>
8047 +
8048 +#include <bcmpci.h>
8049 +#include <bcm_intr.h>
8050 +#include <bcm_map_part.h>
8051 +
8052 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
8053 +
8054 +static char irq_tab_bcm96348[] __initdata = {
8055 + [0] = INTERRUPT_ID_MPI,
8056 + [1] = INTERRUPT_ID_MPI,
8057 +#if defined(CONFIG_USB)
8058 + [USB_HOST_SLOT] = INTERRUPT_ID_USBH
8059 +#endif
8060 +};
8061 +
8062 +int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
8063 +{
8064 + return irq_tab_bcm96348[slot];
8065 +}
8066 +
8067 +static void bcm96348_fixup(struct pci_dev *dev)
8068 +{
8069 + uint32 memaddr;
8070 + uint32 size;
8071 +
8072 + memaddr = pci_resource_start(dev, 0);
8073 + size = pci_resource_len(dev, 0);
8074 +
8075 + switch (PCI_SLOT(dev->devfn)) {
8076 + case 0:
8077 + // UBUS to PCI address range
8078 + // Memory Window 1. Mask determines which bits are decoded.
8079 + mpi->l2pmrange1 = ~(size-1);
8080 + // UBUS to PCI Memory base address. This is akin to the ChipSelect base
8081 + // register.
8082 + mpi->l2pmbase1 = memaddr & BCM_PCI_ADDR_MASK;
8083 + // UBUS to PCI Remap Address. Replaces the masked address bits in the
8084 + // range register with this setting.
8085 + // Also, enable direct I/O and direct Memory accesses
8086 + mpi->l2pmremap1 = (memaddr | MEM_WINDOW_EN);
8087 + break;
8088 +
8089 + case 1:
8090 + // Memory Window 2
8091 + mpi->l2pmrange2 = ~(size-1);
8092 + // UBUS to PCI Memory base address.
8093 + mpi->l2pmbase2 = memaddr & BCM_PCI_ADDR_MASK;
8094 + // UBUS to PCI Remap Address
8095 + mpi->l2pmremap2 = (memaddr | MEM_WINDOW_EN);
8096 + break;
8097 +
8098 +#if defined(CONFIG_USB)
8099 + case USB_HOST_SLOT:
8100 + dev->resource[0].start = USB_HOST_BASE;
8101 + dev->resource[0].end = USB_HOST_BASE+USB_BAR0_MEM_SIZE-1;
8102 + break;
8103 +#endif
8104 + }
8105 +}
8106 +
8107 +struct pci_fixup pcibios_fixups[] = {
8108 + { PCI_FIXUP_FINAL, PCI_ANY_ID, PCI_ANY_ID, bcm96348_fixup },
8109 + {0}
8110 +};
8111 diff -urN linux.old/arch/mips/pci/Makefile linux.dev/arch/mips/pci/Makefile
8112 --- linux.old/arch/mips/pci/Makefile 2006-08-25 00:43:29.000000000 +0200
8113 +++ linux.dev/arch/mips/pci/Makefile 2006-08-25 00:39:38.000000000 +0200
8114 @@ -18,6 +18,7 @@
8115 obj-$(CONFIG_MIPS_TX3927) += ops-tx3927.o
8116 obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
8117 obj-$(CONFIG_NEC_CMBVR4133) += fixup-vr4133.o
8118 +obj-$(CONFIG_BCM_PCI) += fixup-bcm96348.o pci-bcm96348.o ops-bcm96348.o
8119
8120 #
8121 # These are still pretty much in the old state, watch, go blind.
8122 diff -urN linux.old/arch/mips/pci/ops-bcm96348.c linux.dev/arch/mips/pci/ops-bcm96348.c
8123 --- linux.old/arch/mips/pci/ops-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
8124 +++ linux.dev/arch/mips/pci/ops-bcm96348.c 2006-08-25 00:39:38.000000000 +0200
8125 @@ -0,0 +1,276 @@
8126 +/*
8127 +<:copyright-gpl
8128 + Copyright 2002 Broadcom Corp. All Rights Reserved.
8129 +
8130 + This program is free software; you can distribute it and/or modify it
8131 + under the terms of the GNU General Public License (Version 2) as
8132 + published by the Free Software Foundation.
8133 +
8134 + This program is distributed in the hope it will be useful, but WITHOUT
8135 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8136 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8137 + for more details.
8138 +
8139 + You should have received a copy of the GNU General Public License along
8140 + with this program; if not, write to the Free Software Foundation, Inc.,
8141 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
8142 +:>
8143 +*/
8144 +#include <linux/types.h>
8145 +#include <linux/pci.h>
8146 +#include <linux/kernel.h>
8147 +#include <linux/init.h>
8148 +#include <asm/addrspace.h>
8149 +
8150 +#include <bcm_intr.h>
8151 +#include <bcm_map_part.h>
8152 +#include <bcmpci.h>
8153 +
8154 +#include <linux/delay.h>
8155 +
8156 +#if defined(CONFIG_USB)
8157 +#if 0
8158 +#define DPRINT(x...) printk(x)
8159 +#else
8160 +#define DPRINT(x...)
8161 +#endif
8162 +
8163 +static int
8164 +pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size);
8165 +static int
8166 +pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size);
8167 +
8168 +static bool usb_mem_size_rd = FALSE;
8169 +static uint32 usb_mem_base = 0;
8170 +static uint32 usb_cfg_space_cmd_reg = 0;
8171 +#endif
8172 +static bool pci_mem_size_rd = FALSE;
8173 +
8174 +static volatile MpiRegisters * mpi = (MpiRegisters *)(MPI_BASE);
8175 +
8176 +static void mpi_SetupPciConfigAccess(uint32 addr)
8177 +{
8178 + mpi->l2pcfgctl = (DIR_CFG_SEL | DIR_CFG_USEREG | addr) & ~CONFIG_TYPE;
8179 +}
8180 +
8181 +static void mpi_ClearPciConfigAccess(void)
8182 +{
8183 + mpi->l2pcfgctl = 0x00000000;
8184 +}
8185 +
8186 +#if defined(CONFIG_USB)
8187 +/* --------------------------------------------------------------------------
8188 + Name: pci63xx_int_write
8189 +Abstract: PCI Config write on internal device(s)
8190 + -------------------------------------------------------------------------- */
8191 +static int
8192 +pci63xx_int_write(unsigned int devfn, int where, u32 * value, int size)
8193 +{
8194 + if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
8195 + return PCIBIOS_SUCCESSFUL;
8196 + }
8197 +
8198 + switch (size) {
8199 + case 1:
8200 + DPRINT("W => Slot: %d Where: %2X Len: %d Data: %02X\n",
8201 + PCI_SLOT(devfn), where, size, *value);
8202 + break;
8203 + case 2:
8204 + DPRINT("W => Slot: %d Where: %2X Len: %d Data: %04X\n",
8205 + PCI_SLOT(devfn), where, size, *value);
8206 + switch (where) {
8207 + case PCI_COMMAND:
8208 + usb_cfg_space_cmd_reg = *value;
8209 + break;
8210 + default:
8211 + break;
8212 + }
8213 + break;
8214 + case 4:
8215 + DPRINT("W => Slot: %d Where: %2X Len: %d Data: %08lX\n",
8216 + PCI_SLOT(devfn), where, size, *value);
8217 + switch (where) {
8218 + case PCI_BASE_ADDRESS_0:
8219 + if (*value == 0xffffffff) {
8220 + usb_mem_size_rd = TRUE;
8221 + } else {
8222 + usb_mem_base = *value;
8223 + }
8224 + break;
8225 + default:
8226 + break;
8227 + }
8228 + break;
8229 + default:
8230 + break;
8231 + }
8232 +
8233 + return PCIBIOS_SUCCESSFUL;
8234 +}
8235 +
8236 +/* --------------------------------------------------------------------------
8237 + Name: pci63xx_int_read
8238 +Abstract: PCI Config read on internal device(s)
8239 + -------------------------------------------------------------------------- */
8240 +static int
8241 +pci63xx_int_read(unsigned int devfn, int where, u32 * value, int size)
8242 +{
8243 + uint32 retValue = 0xFFFFFFFF;
8244 +
8245 + if (PCI_SLOT(devfn) != USB_HOST_SLOT) {
8246 + return PCIBIOS_SUCCESSFUL;
8247 + }
8248 +
8249 + // For now, this is specific to the USB Host controller. We can
8250 + // make it more general if we have to...
8251 + // Emulate PCI Config accesses
8252 + switch (where) {
8253 + case PCI_VENDOR_ID:
8254 + case PCI_DEVICE_ID:
8255 + retValue = PCI_VENDOR_ID_BROADCOM | 0x63000000;
8256 + break;
8257 + case PCI_COMMAND:
8258 + case PCI_STATUS:
8259 + retValue = (0x0006 << 16) | usb_cfg_space_cmd_reg;
8260 + break;
8261 + case PCI_CLASS_REVISION:
8262 + case PCI_CLASS_DEVICE:
8263 + retValue = (PCI_CLASS_SERIAL_USB << 16) | (0x10 << 8) | 0x01;
8264 + break;
8265 + case PCI_BASE_ADDRESS_0:
8266 + if (usb_mem_size_rd) {
8267 + retValue = USB_BAR0_MEM_SIZE;
8268 + } else {
8269 + if (usb_mem_base != 0)
8270 + retValue = usb_mem_base;
8271 + else
8272 + retValue = USB_HOST_BASE;
8273 + }
8274 + usb_mem_size_rd = FALSE;
8275 + break;
8276 + case PCI_CACHE_LINE_SIZE:
8277 + case PCI_LATENCY_TIMER:
8278 + retValue = 0;
8279 + break;
8280 + case PCI_HEADER_TYPE:
8281 + retValue = PCI_HEADER_TYPE_NORMAL;
8282 + break;
8283 + case PCI_SUBSYSTEM_VENDOR_ID:
8284 + retValue = PCI_VENDOR_ID_BROADCOM;
8285 + break;
8286 + case PCI_SUBSYSTEM_ID:
8287 + retValue = 0x6300;
8288 + break;
8289 + case PCI_INTERRUPT_LINE:
8290 + retValue = INTERRUPT_ID_USBH;
8291 + break;
8292 + default:
8293 + break;
8294 + }
8295 +
8296 + switch (size) {
8297 + case 1:
8298 + *value = (retValue >> ((where & 3) << 3)) & 0xff;
8299 + DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %02X\n",
8300 + PCI_SLOT(devfn), where, size, *value);
8301 + break;
8302 + case 2:
8303 + *value = (retValue >> ((where & 3) << 3)) & 0xffff;
8304 + DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %04X\n",
8305 + PCI_SLOT(devfn), where, size, *value);
8306 + break;
8307 + case 4:
8308 + *value = retValue;
8309 + DPRINT("R <= Slot: %d Where: %2X Len: %d Data: %08lX\n",
8310 + PCI_SLOT(devfn), where, size, *value);
8311 + break;
8312 + default:
8313 + break;
8314 + }
8315 +
8316 + return PCIBIOS_SUCCESSFUL;
8317 +}
8318 +#endif
8319 +
8320 +static int bcm96348_pcibios_read(struct pci_bus *bus, unsigned int devfn,
8321 + int where, int size, u32 * val)
8322 +{
8323 + volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
8324 + uint32 data;
8325 +
8326 +#if defined(CONFIG_USB)
8327 + if (PCI_SLOT(devfn) == USB_HOST_SLOT)
8328 + return pci63xx_int_read(devfn, where, val, size);
8329 +#endif
8330 +
8331 + mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
8332 + data = *(uint32 *)ioBase;
8333 + switch(size) {
8334 + case 1:
8335 + *val = (data >> ((where & 3) << 3)) & 0xff;
8336 + break;
8337 + case 2:
8338 + *val = (data >> ((where & 3) << 3)) & 0xffff;
8339 + break;
8340 + case 4:
8341 + *val = data;
8342 + /* Special case for reading PCI device range */
8343 + if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
8344 + if (pci_mem_size_rd) {
8345 + /* bcm6348 PCI memory window minimum size is 64K */
8346 + *val &= PCI_SIZE_64K;
8347 + }
8348 + }
8349 + break;
8350 + default:
8351 + break;
8352 + }
8353 + pci_mem_size_rd = FALSE;
8354 + mpi_ClearPciConfigAccess();
8355 +
8356 + return PCIBIOS_SUCCESSFUL;
8357 +}
8358 +
8359 +static int bcm96348_pcibios_write(struct pci_bus *bus, unsigned int devfn,
8360 + int where, int size, u32 val)
8361 +{
8362 + volatile unsigned char *ioBase = (unsigned char *)(mpi->l2piobase | KSEG1);
8363 + uint32 data;
8364 +
8365 +#if defined(CONFIG_USB)
8366 + if (PCI_SLOT(devfn) == USB_HOST_SLOT)
8367 + return pci63xx_int_write(devfn, where, &val, size);
8368 +#endif
8369 + mpi_SetupPciConfigAccess(BCM_PCI_CFG(PCI_SLOT(devfn), PCI_FUNC(devfn), where));
8370 + data = *(uint32 *)ioBase;
8371 + switch(size) {
8372 + case 1:
8373 + data = (data & ~(0xff << ((where & 3) << 3))) |
8374 + (val << ((where & 3) << 3));
8375 + break;
8376 + case 2:
8377 + data = (data & ~(0xffff << ((where & 3) << 3))) |
8378 + (val << ((where & 3) << 3));
8379 + break;
8380 + case 4:
8381 + data = val;
8382 + /* Special case for reading PCI device range */
8383 + if ((where >= PCI_BASE_ADDRESS_0) && (where <= PCI_BASE_ADDRESS_5)) {
8384 + if (val == 0xffffffff)
8385 + pci_mem_size_rd = TRUE;
8386 + }
8387 + break;
8388 + default:
8389 + break;
8390 + }
8391 + *(uint32 *)ioBase = data;
8392 + udelay(500);
8393 + mpi_ClearPciConfigAccess();
8394 +
8395 + return PCIBIOS_SUCCESSFUL;
8396 +}
8397 +
8398 +struct pci_ops bcm96348_pci_ops = {
8399 + .read = bcm96348_pcibios_read,
8400 + .write = bcm96348_pcibios_write
8401 +};
8402 diff -urN linux.old/arch/mips/pci/pci-bcm96348.c linux.dev/arch/mips/pci/pci-bcm96348.c
8403 --- linux.old/arch/mips/pci/pci-bcm96348.c 1970-01-01 01:00:00.000000000 +0100
8404 +++ linux.dev/arch/mips/pci/pci-bcm96348.c 2006-08-25 00:39:38.000000000 +0200
8405 @@ -0,0 +1,54 @@
8406 +/*
8407 +<:copyright-gpl
8408 + Copyright 2002 Broadcom Corp. All Rights Reserved.
8409 +
8410 + This program is free software; you can distribute it and/or modify it
8411 + under the terms of the GNU General Public License (Version 2) as
8412 + published by the Free Software Foundation.
8413 +
8414 + This program is distributed in the hope it will be useful, but WITHOUT
8415 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8416 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8417 + for more details.
8418 +
8419 + You should have received a copy of the GNU General Public License along
8420 + with this program; if not, write to the Free Software Foundation, Inc.,
8421 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
8422 +:>
8423 +*/
8424 +#include <linux/types.h>
8425 +#include <linux/pci.h>
8426 +#include <linux/kernel.h>
8427 +#include <linux/init.h>
8428 +
8429 +#include <asm/pci_channel.h>
8430 +#include <bcmpci.h>
8431 +
8432 +static struct resource bcm_pci_io_resource = {
8433 + .name = "bcm96348 pci IO space",
8434 + .start = BCM_PCI_IO_BASE,
8435 + .end = BCM_PCI_IO_BASE + BCM_PCI_IO_SIZE_64KB - 1,
8436 + .flags = IORESOURCE_IO
8437 +};
8438 +
8439 +static struct resource bcm_pci_mem_resource = {
8440 + .name = "bcm96348 pci memory space",
8441 + .start = BCM_PCI_MEM_BASE,
8442 + .end = BCM_PCI_MEM_BASE + BCM_PCI_MEM_SIZE_16MB - 1,
8443 + .flags = IORESOURCE_MEM
8444 +};
8445 +
8446 +extern struct pci_ops bcm96348_pci_ops;
8447 +
8448 +struct pci_controller bcm96348_controller = {
8449 + .pci_ops = &bcm96348_pci_ops,
8450 + .io_resource = &bcm_pci_io_resource,
8451 + .mem_resource = &bcm_pci_mem_resource,
8452 +};
8453 +
8454 +static void bcm96348_pci_init(void)
8455 +{
8456 + register_pci_controller(&bcm96348_controller);
8457 +}
8458 +
8459 +arch_initcall(bcm96348_pci_init);
8460 diff -urN linux.old/drivers/serial/bcm63xx_cons.c linux.dev/drivers/serial/bcm63xx_cons.c
8461 --- linux.old/drivers/serial/bcm63xx_cons.c 1970-01-01 01:00:00.000000000 +0100
8462 +++ linux.dev/drivers/serial/bcm63xx_cons.c 2006-08-25 15:37:34.000000000 +0200
8463 @@ -0,0 +1,1049 @@
8464 +/*
8465 +<:copyright-gpl
8466 + Copyright 2002 Broadcom Corp. All Rights Reserved.
8467 +
8468 + This program is free software; you can distribute it and/or modify it
8469 + under the terms of the GNU General Public License (Version 2) as
8470 + published by the Free Software Foundation.
8471 +
8472 + This program is distributed in the hope it will be useful, but WITHOUT
8473 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8474 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8475 + for more details.
8476 +
8477 + You should have received a copy of the GNU General Public License along
8478 + with this program; if not, write to the Free Software Foundation, Inc.,
8479 + 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
8480 +:>
8481 +*/
8482 +
8483 +/* Description: Serial port driver for the BCM963XX. */
8484 +
8485 +#define CARDNAME "bcm963xx_serial driver"
8486 +#define VERSION "2.0"
8487 +#define VER_STR CARDNAME " v" VERSION "\n"
8488 +
8489 +
8490 +#include <linux/kernel.h>
8491 +#include <linux/module.h>
8492 +#include <linux/version.h>
8493 +#include <linux/init.h>
8494 +#include <linux/slab.h>
8495 +#include <linux/interrupt.h>
8496 +#include <linux/spinlock.h>
8497 +
8498 +/* for definition of struct console */
8499 +#include <linux/console.h>
8500 +#include <linux/tty.h>
8501 +#include <linux/tty_flip.h>
8502 +#include <linux/serial.h>
8503 +#include <linux/serialP.h>
8504 +#include <asm/uaccess.h>
8505 +
8506 +#include <bcmtypes.h>
8507 +#include <board.h>
8508 +#include <bcm_map_part.h>
8509 +#include <bcm_intr.h>
8510 +
8511 +static DEFINE_SPINLOCK(bcm963xx_serial_lock);
8512 +
8513 +extern void _putc(char);
8514 +extern void _puts(const char *);
8515 +
8516 +typedef struct bcm_serial {
8517 + volatile Uart * port;
8518 + int type;
8519 + int flags;
8520 + int irq;
8521 + int baud_base;
8522 + int blocked_open;
8523 + unsigned short close_delay;
8524 + unsigned short closing_wait;
8525 + unsigned short line; /* port/line number */
8526 + unsigned short cflags; /* line configuration flag */
8527 + unsigned short x_char; /* xon/xoff character */
8528 + unsigned short read_status_mask; /* mask for read condition */
8529 + unsigned short ignore_status_mask; /* mask for ignore condition */
8530 + unsigned long event; /* mask used in BH */
8531 + int xmit_head; /* Position of the head */
8532 + int xmit_tail; /* Position of the tail */
8533 + int xmit_cnt; /* Count of the chars in the buffer */
8534 + int count; /* indicates how many times it has been opened */
8535 + int magic;
8536 +
8537 + struct async_icount icount; /* keep track of things ... */
8538 + struct tty_struct *tty; /* tty associated */
8539 + struct termios normal_termios;
8540 +
8541 + wait_queue_head_t open_wait;
8542 + wait_queue_head_t close_wait;
8543 +
8544 + long session; /* Session of opening process */
8545 + long pgrp; /* pgrp of opening process */
8546 +
8547 + unsigned char is_initialized;
8548 +} Context;
8549 +
8550 +
8551 +/*---------------------------------------------------------------------*/
8552 +/* Define bits in the Interrupt Enable register */
8553 +/*---------------------------------------------------------------------*/
8554 +/* Enable receive interrupt */
8555 +#define RXINT (RXFIFONE|RXOVFERR)
8556 +
8557 +/* Enable transmit interrupt */
8558 +#define TXINT (TXFIFOEMT|TXUNDERR|TXOVFERR)
8559 +
8560 +/* Enable receiver line status interrupt */
8561 +#define LSINT (RXBRK|RXPARERR|RXFRAMERR)
8562 +
8563 +#define BCM_NUM_UARTS 1
8564 +
8565 +#define BD_BCM63XX_TIMER_CLOCK_INPUT (FPERIPH)
8566 +
8567 +
8568 +static struct bcm_serial multi[BCM_NUM_UARTS];
8569 +static struct bcm_serial *lines[BCM_NUM_UARTS];
8570 +static struct tty_driver *serial_driver;
8571 +static struct termios *serial_termios[BCM_NUM_UARTS];
8572 +static struct termios *serial_termios_locked[BCM_NUM_UARTS];
8573 +
8574 +
8575 +static void bcm_stop (struct tty_struct *tty);
8576 +static void bcm_start (struct tty_struct *tty);
8577 +static inline void receive_chars (struct bcm_serial * info);
8578 +static int startup (struct bcm_serial *info);
8579 +static void shutdown (struct bcm_serial * info);
8580 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag );
8581 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty);
8582 +static int bcm63xx_cons_write (struct tty_struct *tty,
8583 + const unsigned char *buf, int count);
8584 +static int bcm63xx_cons_write_room (struct tty_struct *tty);
8585 +static int bcm_chars_in_buffer (struct tty_struct *tty);
8586 +static void bcm_flush_buffer (struct tty_struct *tty);
8587 +static void bcm_throttle (struct tty_struct *tty);
8588 +static void bcm_unthrottle (struct tty_struct *tty);
8589 +static void bcm_send_xchar (struct tty_struct *tty, char ch);
8590 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo);
8591 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info);
8592 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value);
8593 +static void send_break (struct bcm_serial *info, int duration);
8594 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
8595 + unsigned int cmd, unsigned long arg);
8596 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios);
8597 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp);
8598 +static void bcm_hangup (struct tty_struct *tty);
8599 +static int block_til_ready (struct tty_struct *tty, struct file *filp, struct bcm_serial *info);
8600 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp);
8601 +static int __init bcm63xx_serialinit(void);
8602 +
8603 +
8604 +/*
8605 + * ------------------------------------------------------------
8606 + * rs_stop () and rs_start ()
8607 + *
8608 + * These routines are called before setting or resetting
8609 + * tty->stopped. They enable or disable transmitter interrupts,
8610 + * as necessary.
8611 + * ------------------------------------------------------------
8612 + */
8613 +static void bcm_stop (struct tty_struct *tty)
8614 +{
8615 +}
8616 +
8617 +static void bcm_start (struct tty_struct *tty)
8618 +{
8619 + _puts(CARDNAME " Start\n");
8620 +}
8621 +
8622 +/*
8623 + * ------------------------------------------------------------
8624 + * receive_char ()
8625 + *
8626 + * This routine deals with inputs from any lines.
8627 + * ------------------------------------------------------------
8628 + */
8629 +static inline void receive_chars (struct bcm_serial * info)
8630 +{
8631 + struct tty_struct *tty = 0;
8632 + struct async_icount * icount;
8633 + int ignore = 0;
8634 + unsigned short status, tmp;
8635 + UCHAR ch = 0;
8636 + while ((status = info->port->intStatus) & RXINT)
8637 + {
8638 + char flag_char = TTY_NORMAL;
8639 +
8640 + if (status & RXFIFONE)
8641 + ch = info->port->Data; // Read the character
8642 + tty = info->tty; /* now tty points to the proper dev */
8643 + icount = &info->icount;
8644 + if (! tty)
8645 + break;
8646 + if (!tty_buffer_request_room(tty, 1))
8647 + break;
8648 + icount->rx++;
8649 + if (status & RXBRK)
8650 + {
8651 + flag_char = TTY_BREAK;
8652 + icount->brk++;
8653 + }
8654 + // keep track of the statistics
8655 + if (status & (RXFRAMERR | RXPARERR | RXOVFERR))
8656 + {
8657 + if (status & RXPARERR) /* parity error */
8658 + icount->parity++;
8659 + else
8660 + if (status & RXFRAMERR) /* frame error */
8661 + icount->frame++;
8662 + if (status & RXOVFERR)
8663 + {
8664 + // Overflow. Reset the RX FIFO
8665 + info->port->fifoctl |= RSTRXFIFOS;
8666 + icount->overrun++;
8667 + }
8668 + // check to see if we should ignore the character
8669 + // and mask off conditions that should be ignored
8670 + if (status & info->ignore_status_mask)
8671 + {
8672 + if (++ignore > 100 )
8673 + break;
8674 + goto ignore_char;
8675 + }
8676 + // Mask off the error conditions we want to ignore
8677 + tmp = status & info->read_status_mask;
8678 + if (tmp & RXPARERR)
8679 + {
8680 + flag_char = TTY_PARITY;
8681 + }
8682 + else
8683 + if (tmp & RXFRAMERR)
8684 + {
8685 + flag_char = TTY_FRAME;
8686 + }
8687 + if (tmp & RXOVFERR)
8688 + {
8689 + tty_insert_flip_char(tty, ch, flag_char);
8690 + ch = 0;
8691 + flag_char = TTY_OVERRUN;
8692 + if (!tty_buffer_request_room(tty, 1))
8693 + break;
8694 + }
8695 + }
8696 + tty_insert_flip_char(tty, ch, flag_char);
8697 + }
8698 +ignore_char:;
8699 + tty_flip_buffer_push(tty);
8700 + tty_schedule_flip(tty);
8701 +
8702 +}
8703 +
8704 +
8705 +/*
8706 + * ------------------------------------------------------------
8707 + * bcm_interrupt ()
8708 + *
8709 + * this is the main interrupt routine for the chip.
8710 + * It deals with the multiple ports.
8711 + * ------------------------------------------------------------
8712 + */
8713 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
8714 +static irqreturn_t bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
8715 +#else
8716 +static void bcm_interrupt (int irq, void * dev, struct pt_regs * regs)
8717 +#endif
8718 +{
8719 + struct bcm_serial * info = lines[0];
8720 + UINT16 intStat;
8721 +
8722 + /* get pending interrupt flags from UART */
8723 +
8724 + /* Mask with only the serial interrupts that are enabled */
8725 + intStat = info->port->intStatus & info->port->intMask;
8726 + while (intStat)
8727 + {
8728 + if (intStat & RXINT)
8729 + receive_chars (info);
8730 + else
8731 + if (intStat & TXINT)
8732 + info->port->intStatus = TXINT;
8733 + else /* don't know what it was, so let's mask it */
8734 + info->port->intMask &= ~intStat;
8735 +
8736 + intStat = info->port->intStatus & info->port->intMask;
8737 + }
8738 +
8739 + // Clear the interrupt
8740 + BcmHalInterruptEnable (INTERRUPT_ID_UART);
8741 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
8742 + return IRQ_HANDLED;
8743 +#endif
8744 +}
8745 +
8746 +/*
8747 + * -------------------------------------------------------------------
8748 + * startup ()
8749 + *
8750 + * various initialization tasks
8751 + * -------------------------------------------------------------------
8752 + */
8753 +static int startup (struct bcm_serial *info)
8754 +{
8755 + // Port is already started...
8756 + return 0;
8757 +}
8758 +
8759 +/*
8760 + * -------------------------------------------------------------------
8761 + * shutdown ()
8762 + *
8763 + * This routine will shutdown a serial port; interrupts are disabled, and
8764 + * DTR is dropped if the hangup on close termio flag is on.
8765 + * -------------------------------------------------------------------
8766 + */
8767 +static void shutdown (struct bcm_serial * info)
8768 +{
8769 + unsigned long flags;
8770 + if (!info->is_initialized)
8771 + return;
8772 +
8773 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
8774 +
8775 + info->port->control &= ~(BRGEN|TXEN|RXEN);
8776 + if (info->tty)
8777 + set_bit (TTY_IO_ERROR, &info->tty->flags);
8778 + info->is_initialized = 0;
8779 +
8780 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
8781 +}
8782 +/*
8783 + * -------------------------------------------------------------------
8784 + * change_speed ()
8785 + *
8786 + * Set the baud rate, character size, parity and stop bits.
8787 + * -------------------------------------------------------------------
8788 + */
8789 +static void change_speed( volatile Uart *pUart, tcflag_t cFlag )
8790 +{
8791 + unsigned long ulFlags, ulBaud, ulClockFreqHz, ulTmp;
8792 +
8793 + spin_lock_irqsave(&bcm963xx_serial_lock, ulFlags);
8794 + switch( cFlag & (CBAUD | CBAUDEX) )
8795 + {
8796 + case B115200:
8797 + ulBaud = 115200;
8798 + break;
8799 + case B57600:
8800 + ulBaud = 57600;
8801 + break;
8802 + case B38400:
8803 + ulBaud = 38400;
8804 + break;
8805 + case B19200:
8806 + ulBaud = 19200;
8807 + break;
8808 + case B9600:
8809 + ulBaud = 9600;
8810 + break;
8811 + case B4800:
8812 + ulBaud = 4800;
8813 + break;
8814 + case B2400:
8815 + ulBaud = 2400;
8816 + break;
8817 + case B1800:
8818 + ulBaud = 1800;
8819 + break;
8820 + case B1200:
8821 + ulBaud = 1200;
8822 + break;
8823 + case B600:
8824 + ulBaud = 600;
8825 + break;
8826 + case B300:
8827 + ulBaud = 300;
8828 + break;
8829 + case B200:
8830 + ulBaud = 200;
8831 + break;
8832 + case B150:
8833 + ulBaud = 150;
8834 + break;
8835 + case B134:
8836 + ulBaud = 134;
8837 + break;
8838 + case B110:
8839 + ulBaud = 110;
8840 + break;
8841 + case B75:
8842 + ulBaud = 75;
8843 + break;
8844 + case B50:
8845 + ulBaud = 50;
8846 + break;
8847 + default:
8848 + ulBaud = 115200;
8849 + break;
8850 + }
8851 +
8852 + /* Calculate buad rate. */
8853 + ulClockFreqHz = BD_BCM63XX_TIMER_CLOCK_INPUT;
8854 + ulTmp = (ulClockFreqHz / ulBaud) / 16;
8855 + if( ulTmp & 0x01 )
8856 + ulTmp /= 2; /* Rounding up, so sub is already accounted for */
8857 + else
8858 + ulTmp = (ulTmp / 2) - 1; /* Rounding down so we must sub 1 */
8859 + pUart->baudword = ulTmp;
8860 +
8861 + /* Set character size, stop bits and parity. */
8862 + switch( cFlag & CSIZE )
8863 + {
8864 + case CS5:
8865 + ulTmp = BITS5SYM; /* select transmit 5 bit data size */
8866 + break;
8867 + case CS6:
8868 + ulTmp = BITS6SYM; /* select transmit 6 bit data size */
8869 + break;
8870 + case CS7:
8871 + ulTmp = BITS7SYM; /* select transmit 7 bit data size */
8872 + break;
8873 + default:
8874 + ulTmp = BITS8SYM; /* select transmit 8 bit data size */
8875 + break;
8876 + }
8877 + if( cFlag & CSTOPB )
8878 + ulTmp |= TWOSTOP; /* select 2 stop bits */
8879 + else
8880 + ulTmp |= ONESTOP; /* select one stop bit */
8881 +
8882 + /* Write these values into the config reg. */
8883 + pUart->config = ulTmp;
8884 + pUart->control &= ~(RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN);
8885 + switch( cFlag & (PARENB | PARODD) )
8886 + {
8887 + case PARENB|PARODD:
8888 + pUart->control |= RXPARITYEN | TXPARITYEN;
8889 + break;
8890 + case PARENB:
8891 + pUart->control |= RXPARITYEN | TXPARITYEN | RXPARITYEVEN | TXPARITYEVEN;
8892 + break;
8893 + default:
8894 + pUart->control |= 0;
8895 + break;
8896 + }
8897 +
8898 + /* Reset and flush uart */
8899 + pUart->fifoctl = RSTTXFIFOS | RSTRXFIFOS;
8900 + spin_unlock_irqrestore(&bcm963xx_serial_lock, ulFlags);
8901 +}
8902 +
8903 +
8904 +/*
8905 + * -------------------------------------------------------------------
8906 + * bcm_flush_char ()
8907 + *
8908 + * Nothing to flush. Polled I/O is used.
8909 + * -------------------------------------------------------------------
8910 + */
8911 +static void bcm63xx_cons_flush_chars (struct tty_struct *tty)
8912 +{
8913 +}
8914 +
8915 +
8916 +/*
8917 + * -------------------------------------------------------------------
8918 + * bcm63xx_cons_write ()
8919 + *
8920 + * Main output routine using polled I/O.
8921 + * -------------------------------------------------------------------
8922 + */
8923 +static int bcm63xx_cons_write (struct tty_struct *tty,
8924 + const unsigned char *buf, int count)
8925 +{
8926 + int c;
8927 +
8928 + for (c = 0; c < count; c++)
8929 + _putc(buf[c]);
8930 + return count;
8931 +}
8932 +
8933 +/*
8934 + * -------------------------------------------------------------------
8935 + * bcm63xx_cons_write_room ()
8936 + *
8937 + * Compute the amount of space available for writing.
8938 + * -------------------------------------------------------------------
8939 + */
8940 +static int bcm63xx_cons_write_room (struct tty_struct *tty)
8941 +{
8942 + /* Pick a number. Any number. Polled I/O is used. */
8943 + return 1024;
8944 +}
8945 +
8946 +/*
8947 + * -------------------------------------------------------------------
8948 + * bcm_chars_in_buffer ()
8949 + *
8950 + * compute the amount of char left to be transmitted
8951 + * -------------------------------------------------------------------
8952 + */
8953 +static int bcm_chars_in_buffer (struct tty_struct *tty)
8954 +{
8955 + return 0;
8956 +}
8957 +
8958 +/*
8959 + * -------------------------------------------------------------------
8960 + * bcm_flush_buffer ()
8961 + *
8962 + * Empty the output buffer
8963 + * -------------------------------------------------------------------
8964 + */
8965 +static void bcm_flush_buffer (struct tty_struct *tty)
8966 +{
8967 + tty_wakeup(tty);
8968 +}
8969 +
8970 +/*
8971 + * ------------------------------------------------------------
8972 + * bcm_throttle () and bcm_unthrottle ()
8973 + *
8974 + * This routine is called by the upper-layer tty layer to signal that
8975 + * incoming characters should be throttled (or not).
8976 + * ------------------------------------------------------------
8977 + */
8978 +static void bcm_throttle (struct tty_struct *tty)
8979 +{
8980 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
8981 + if (I_IXOFF(tty))
8982 + info->x_char = STOP_CHAR(tty);
8983 +}
8984 +
8985 +static void bcm_unthrottle (struct tty_struct *tty)
8986 +{
8987 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
8988 + if (I_IXOFF(tty))
8989 + {
8990 + if (info->x_char)
8991 + info->x_char = 0;
8992 + else
8993 + info->x_char = START_CHAR(tty);
8994 + }
8995 +}
8996 +
8997 +static void bcm_send_xchar (struct tty_struct *tty, char ch)
8998 +{
8999 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
9000 + info->x_char = ch;
9001 + if (ch)
9002 + bcm_start (info->tty);
9003 +}
9004 +
9005 +/*
9006 + * ------------------------------------------------------------
9007 + * rs_ioctl () and friends
9008 + * ------------------------------------------------------------
9009 + */
9010 +static int get_serial_info(struct bcm_serial *info, struct serial_struct *retinfo)
9011 +{
9012 + struct serial_struct tmp;
9013 +
9014 + if (!retinfo)
9015 + return -EFAULT;
9016 +
9017 + memset (&tmp, 0, sizeof(tmp));
9018 + tmp.type = info->type;
9019 + tmp.line = info->line;
9020 + tmp.port = (int) info->port;
9021 + tmp.irq = info->irq;
9022 + tmp.flags = 0;
9023 + tmp.baud_base = info->baud_base;
9024 + tmp.close_delay = info->close_delay;
9025 + tmp.closing_wait = info->closing_wait;
9026 +
9027 + return copy_to_user (retinfo, &tmp, sizeof(*retinfo));
9028 +}
9029 +
9030 +static int set_serial_info (struct bcm_serial *info, struct serial_struct *new_info)
9031 +{
9032 + struct serial_struct new_serial;
9033 + struct bcm_serial old_info;
9034 + int retval = 0;
9035 +
9036 + if (!new_info)
9037 + return -EFAULT;
9038 +
9039 + copy_from_user (&new_serial, new_info, sizeof(new_serial));
9040 + old_info = *info;
9041 +
9042 + if (!capable(CAP_SYS_ADMIN))
9043 + return -EPERM;
9044 +
9045 +
9046 + if (info->count > 1)
9047 + return -EBUSY;
9048 +
9049 + /* OK, past this point, all the error checking has been done.
9050 + * At this point, we start making changes.....
9051 + */
9052 + info->baud_base = new_serial.baud_base;
9053 + info->type = new_serial.type;
9054 + info->close_delay = new_serial.close_delay;
9055 + info->closing_wait = new_serial.closing_wait;
9056 + retval = startup (info);
9057 + return retval;
9058 +}
9059 +
9060 +/*
9061 + * get_lsr_info - get line status register info
9062 + *
9063 + * Purpose: Let user call ioctl() to get info when the UART physically
9064 + * is emptied. On bus types like RS485, the transmitter must
9065 + * release the bus after transmitting. This must be done when
9066 + * the transmit shift register is empty, not be done when the
9067 + * transmit holding register is empty. This functionality
9068 + * allows an RS485 driver to be written in user space.
9069 + */
9070 +static int get_lsr_info (struct bcm_serial *info, unsigned int *value)
9071 +{
9072 + return( 0 );
9073 +}
9074 +
9075 +/*
9076 + * This routine sends a break character out the serial port.
9077 + */
9078 +static void send_break (struct bcm_serial *info, int duration)
9079 +{
9080 + unsigned long flags;
9081 +
9082 + if (!info->port)
9083 + return;
9084 +
9085 + current->state = TASK_INTERRUPTIBLE;
9086 +
9087 + /*save_flags (flags);
9088 + cli();*/
9089 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
9090 +
9091 + info->port->control |= XMITBREAK;
9092 + schedule_timeout(duration);
9093 + info->port->control &= ~XMITBREAK;
9094 +
9095 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
9096 + //restore_flags (flags);
9097 +}
9098 +
9099 +static int bcm_ioctl (struct tty_struct * tty, struct file * file,
9100 + unsigned int cmd, unsigned long arg)
9101 +{
9102 + int error;
9103 + struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
9104 + int retval;
9105 +
9106 + if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
9107 + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) &&
9108 + (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT))
9109 + {
9110 + if (tty->flags & (1 << TTY_IO_ERROR))
9111 + return -EIO;
9112 + }
9113 + switch (cmd)
9114 + {
9115 +
9116 + case TCSBRK: /* SVID version: non-zero arg --> no break */
9117 + retval = tty_check_change (tty);
9118 + if (retval)
9119 + return retval;
9120 + tty_wait_until_sent (tty, 0);
9121 + if (!arg)
9122 + send_break (info, HZ/4); /* 1/4 second */
9123 + return 0;
9124 +
9125 + case TCSBRKP: /* support for POSIX tcsendbreak() */
9126 + retval = tty_check_change (tty);
9127 + if (retval)
9128 + return retval;
9129 + tty_wait_until_sent (tty, 0);
9130 + send_break (info, arg ? arg*(HZ/10) : HZ/4);
9131 + return 0;
9132 +
9133 + case TIOCGSOFTCAR:
9134 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(long));
9135 + if (!error)
9136 + return -EFAULT;
9137 + else
9138 + {
9139 + put_user (C_CLOCAL(tty) ? 1 : 0, (unsigned long *)arg);
9140 + return 0;
9141 + }
9142 +
9143 + case TIOCSSOFTCAR:
9144 + error = get_user (arg, (unsigned long *)arg);
9145 + if (error)
9146 + return error;
9147 + tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
9148 + return 0;
9149 +
9150 + case TIOCGSERIAL:
9151 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(struct serial_struct));
9152 + if (!error)
9153 + return -EFAULT;
9154 + else
9155 + return get_serial_info (info, (struct serial_struct *)arg);
9156 +
9157 + case TIOCSSERIAL:
9158 + return set_serial_info (info, (struct serial_struct *) arg);
9159 +
9160 + case TIOCSERGETLSR: /* Get line status register */
9161 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(unsigned int));
9162 + if (!error)
9163 + return -EFAULT;
9164 + else
9165 + return get_lsr_info (info, (unsigned int *)arg);
9166 +
9167 + case TIOCSERGSTRUCT:
9168 + error = access_ok (VERIFY_WRITE, (void *)arg, sizeof(struct bcm_serial));
9169 + if (!error)
9170 + return -EFAULT;
9171 + else
9172 + {
9173 + copy_to_user((struct bcm_serial *)arg, info, sizeof(struct bcm_serial));
9174 + return 0;
9175 + }
9176 +
9177 + default:
9178 + return -ENOIOCTLCMD;
9179 + }
9180 + return 0;
9181 +}
9182 +
9183 +static void bcm_set_termios (struct tty_struct *tty, struct termios *old_termios)
9184 +{
9185 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
9186 +
9187 + if( tty->termios->c_cflag != old_termios->c_cflag )
9188 + change_speed (info->port, tty->termios->c_cflag);
9189 +}
9190 +
9191 +/*
9192 + * ------------------------------------------------------------
9193 + * bcm63xx_cons_close()
9194 + *
9195 + * This routine is called when the serial port gets closed. First, we
9196 + * wait for the last remaining data to be sent. Then, we turn off
9197 + * the transmit enable and receive enable flags.
9198 + * ------------------------------------------------------------
9199 + */
9200 +static void bcm63xx_cons_close (struct tty_struct *tty, struct file *filp)
9201 +{
9202 + struct bcm_serial * info = (struct bcm_serial *)tty->driver_data;
9203 + unsigned long flags;
9204 +
9205 + if (!info)
9206 + return;
9207 +
9208 + /*save_flags (flags);
9209 + cli();*/
9210 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
9211 +
9212 + if (tty_hung_up_p (filp))
9213 + {
9214 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
9215 + //restore_flags (flags);
9216 + return;
9217 + }
9218 +
9219 + if ((tty->count == 1) && (info->count != 1))
9220 + {
9221 +
9222 + /* Uh, oh. tty->count is 1, which means that the tty
9223 + * structure will be freed. Info->count should always
9224 + * be one in these conditions. If it's greater than
9225 + * one, we've got real problems, since it means the
9226 + * serial port won't be shutdown.
9227 + */
9228 + printk("bcm63xx_cons_close: bad serial port count; tty->count is 1, "
9229 + "info->count is %d\n", info->count);
9230 + info->count = 1;
9231 + }
9232 +
9233 + if (--info->count < 0)
9234 + {
9235 + printk("ds_close: bad serial port count for ttys%d: %d\n",
9236 + info->line, info->count);
9237 + info->count = 0;
9238 + }
9239 +
9240 + if (info->count)
9241 + {
9242 + //restore_flags (flags);
9243 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
9244 + return;
9245 + }
9246 +
9247 + /* Now we wait for the transmit buffer to clear; and we notify
9248 + * the line discipline to only process XON/XOFF characters.
9249 + */
9250 + tty->closing = 1;
9251 +
9252 + /* At this point we stop accepting input. To do this, we
9253 + * disable the receive line status interrupts.
9254 + */
9255 + shutdown (info);
9256 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
9257 + if (tty->driver->flush_buffer)
9258 + tty->driver->flush_buffer (tty);
9259 +#else
9260 + if (tty->driver.flush_buffer)
9261 + tty->driver.flush_buffer (tty);
9262 +#endif
9263 + if (tty->ldisc.flush_buffer)
9264 + tty->ldisc.flush_buffer (tty);
9265 +
9266 + tty->closing = 0;
9267 + info->event = 0;
9268 + info->tty = 0;
9269 + if (tty->ldisc.num != tty_ldisc_get(N_TTY)->num)
9270 + {
9271 + if (tty->ldisc.close)
9272 + (tty->ldisc.close)(tty);
9273 + tty->ldisc = *tty_ldisc_get(N_TTY);
9274 + tty->termios->c_line = N_TTY;
9275 + if (tty->ldisc.open)
9276 + (tty->ldisc.open)(tty);
9277 + }
9278 + if (info->blocked_open)
9279 + {
9280 + if (info->close_delay)
9281 + {
9282 + current->state = TASK_INTERRUPTIBLE;
9283 + schedule_timeout(info->close_delay);
9284 + }
9285 + wake_up_interruptible (&info->open_wait);
9286 + }
9287 + wake_up_interruptible (&info->close_wait);
9288 +
9289 + //restore_flags (flags);
9290 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
9291 +}
9292 +
9293 +/*
9294 + * bcm_hangup () --- called by tty_hangup() when a hangup is signaled.
9295 + */
9296 +static void bcm_hangup (struct tty_struct *tty)
9297 +{
9298 +
9299 + struct bcm_serial *info = (struct bcm_serial *)tty->driver_data;
9300 +
9301 + shutdown (info);
9302 + info->event = 0;
9303 + info->count = 0;
9304 + info->tty = 0;
9305 + wake_up_interruptible (&info->open_wait);
9306 +}
9307 +
9308 +/*
9309 + * ------------------------------------------------------------
9310 + * rs_open() and friends
9311 + * ------------------------------------------------------------
9312 + */
9313 +static int block_til_ready (struct tty_struct *tty, struct file *filp,
9314 + struct bcm_serial *info)
9315 +{
9316 + return 0;
9317 +}
9318 +
9319 +/*
9320 + * This routine is called whenever a serial port is opened. It
9321 + * enables interrupts for a serial port. It also performs the
9322 + * serial-specific initialization for the tty structure.
9323 + */
9324 +static int bcm63xx_cons_open (struct tty_struct * tty, struct file * filp)
9325 +{
9326 + struct bcm_serial *info;
9327 + int retval, line;
9328 +
9329 + // Make sure we're only opening on of the ports we support
9330 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
9331 + line = MINOR(tty->driver->cdev.dev) - tty->driver->minor_start;
9332 +#else
9333 + line = MINOR(tty->device) - tty->driver.minor_start;
9334 +#endif
9335 +
9336 + if ((line < 0) || (line >= BCM_NUM_UARTS))
9337 + return -ENODEV;
9338 +
9339 + info = lines[line];
9340 +
9341 + tty->low_latency=1;
9342 + info->port->intMask = 0; /* Clear any pending interrupts */
9343 + info->port->intMask = RXINT; /* Enable RX */
9344 +
9345 + info->count++;
9346 + tty->driver_data = info;
9347 + info->tty = tty;
9348 + BcmHalInterruptEnable (INTERRUPT_ID_UART);
9349 +
9350 + // Start up serial port
9351 + retval = startup (info);
9352 + if (retval)
9353 + return retval;
9354 +
9355 + retval = block_til_ready (tty, filp, info);
9356 + if (retval)
9357 + return retval;
9358 +
9359 +
9360 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
9361 + info->pgrp = process_group(current);
9362 + info->session = current->signal->session;
9363 +#else
9364 + info->session = current->session;
9365 + info->pgrp = current->pgrp;
9366 +#endif
9367 +
9368 + return 0;
9369 +}
9370 +
9371 +
9372 +static struct tty_operations rs_ops = {
9373 + .open = bcm63xx_cons_open,
9374 + .close = bcm63xx_cons_close,
9375 + .write = bcm63xx_cons_write,
9376 + .flush_chars = bcm63xx_cons_flush_chars,
9377 + .write_room = bcm63xx_cons_write_room,
9378 + .chars_in_buffer = bcm_chars_in_buffer,
9379 + .flush_buffer = bcm_flush_buffer,
9380 + .ioctl = bcm_ioctl,
9381 + .throttle = bcm_throttle,
9382 + .unthrottle = bcm_unthrottle,
9383 + .send_xchar = bcm_send_xchar,
9384 + .set_termios = bcm_set_termios,
9385 + .stop = bcm_stop,
9386 + .start = bcm_start,
9387 + .hangup = bcm_hangup,
9388 +};
9389 +
9390 +/* --------------------------------------------------------------------------
9391 + Name: bcm63xx_serialinit
9392 + Purpose: Initialize our BCM63xx serial driver
9393 +-------------------------------------------------------------------------- */
9394 +static int __init bcm63xx_serialinit(void)
9395 +{
9396 + int i, flags;
9397 + struct bcm_serial * info;
9398 +
9399 + // Print the driver version information
9400 + printk(VER_STR);
9401 + serial_driver = alloc_tty_driver(BCM_NUM_UARTS);
9402 + if (!serial_driver)
9403 + return -ENOMEM;
9404 +
9405 + serial_driver->owner = THIS_MODULE;
9406 + serial_driver->devfs_name = "tts/";
9407 +// serial_driver.magic = TTY_DRIVER_MAGIC;
9408 + serial_driver->name = "ttyS";
9409 + serial_driver->major = TTY_MAJOR;
9410 + serial_driver->minor_start = 64;
9411 +// serial_driver.num = BCM_NUM_UARTS;
9412 + serial_driver->type = TTY_DRIVER_TYPE_SERIAL;
9413 + serial_driver->subtype = SERIAL_TYPE_NORMAL;
9414 + serial_driver->init_termios = tty_std_termios;
9415 + serial_driver->init_termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL;
9416 + serial_driver->flags = TTY_DRIVER_REAL_RAW;
9417 +
9418 + serial_driver->termios = serial_termios;
9419 + serial_driver->termios_locked = serial_termios_locked;
9420 +
9421 + tty_set_operations(serial_driver, &rs_ops);
9422 +
9423 + if (tty_register_driver (serial_driver))
9424 + panic("Couldn't register serial driver\n");
9425 +
9426 + //save_flags(flags); cli();
9427 + spin_lock_irqsave(&bcm963xx_serial_lock, flags);
9428 +
9429 + for (i = 0; i < BCM_NUM_UARTS; i++)
9430 + {
9431 + info = &multi[i];
9432 + lines[i] = info;
9433 + info->magic = SERIAL_MAGIC;
9434 + info->port = (Uart *) ((char *)UART_BASE + (i * 0x20));
9435 + info->tty = 0;
9436 + info->irq = (2 - i) + 8;
9437 + info->line = i;
9438 + info->close_delay = 50;
9439 + info->closing_wait = 3000;
9440 + info->x_char = 0;
9441 + info->event = 0;
9442 + info->count = 0;
9443 + info->blocked_open = 0;
9444 + info->normal_termios = serial_driver->init_termios;
9445 + init_waitqueue_head(&info->open_wait);
9446 + init_waitqueue_head(&info->close_wait);
9447 +
9448 + /* If we are pointing to address zero then punt - not correctly
9449 + * set up in setup.c to handle this.
9450 + */
9451 + if (! info->port)
9452 + return 0;
9453 + BcmHalMapInterrupt(bcm_interrupt, 0, INTERRUPT_ID_UART);
9454 + }
9455 +
9456 + /* order matters here... the trick is that flags
9457 + * is updated... in request_irq - to immediatedly obliterate
9458 + * it is unwise.
9459 + */
9460 + spin_unlock_irqrestore(&bcm963xx_serial_lock, flags);
9461 + return 0;
9462 +}
9463 +
9464 +module_init(bcm63xx_serialinit);
9465 +
9466 +/* --------------------------------------------------------------------------
9467 + Name: bcm_console_print
9468 + Purpose: bcm_console_print is registered for printk.
9469 + The console_lock must be held when we get here.
9470 +-------------------------------------------------------------------------- */
9471 +static void bcm_console_print (struct console * cons, const char * str,
9472 + unsigned int count)
9473 +{
9474 + unsigned int i;
9475 + //_puts(str);
9476 + for(i=0; i<count; i++, str++)
9477 + {
9478 + _putc(*str);
9479 + if (*str == 10)
9480 + {
9481 + _putc(13);
9482 + }
9483 + }
9484 +}
9485 +
9486 +static struct tty_driver * bcm_console_device(struct console * c, int *index)
9487 +{
9488 + *index = c->index;
9489 + return serial_driver;
9490 +}
9491 +
9492 +static int __init bcm_console_setup(struct console * co, char * options)
9493 +{
9494 + return 0;
9495 +}
9496 +
9497 +static struct console bcm_sercons = {
9498 + .name = "ttyS",
9499 + .write = bcm_console_print,
9500 + .device = bcm_console_device,
9501 + .setup = bcm_console_setup,
9502 + .flags = CON_PRINTBUFFER,
9503 + .index = -1,
9504 +};
9505 +
9506 +static int __init bcm63xx_console_init(void)
9507 +{
9508 + register_console(&bcm_sercons);
9509 + return 0;
9510 +}
9511 +
9512 +console_initcall(bcm63xx_console_init);
9513 diff -urN linux.old/drivers/serial/Makefile linux.dev/drivers/serial/Makefile
9514 --- linux.old/drivers/serial/Makefile 2006-06-18 03:49:35.000000000 +0200
9515 +++ linux.dev/drivers/serial/Makefile 2006-08-25 15:38:44.000000000 +0200
9516 @@ -55,3 +55,4 @@
9517 obj-$(CONFIG_SERIAL_SGI_IOC4) += ioc4_serial.o
9518 obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o
9519 obj-$(CONFIG_SERIAL_AT91) += at91_serial.o
9520 +obj-$(CONFIG_BCM_SERIAL) += bcm63xx_cons.o
9521 diff -urN linux.old/include/asm-mips/bootinfo.h linux.dev/include/asm-mips/bootinfo.h
9522 --- linux.old/include/asm-mips/bootinfo.h 2006-08-25 00:43:22.000000000 +0200
9523 +++ linux.dev/include/asm-mips/bootinfo.h 2006-08-25 00:39:38.000000000 +0200
9524 @@ -218,6 +218,14 @@
9525 #define MACH_GROUP_TITAN 22 /* PMC-Sierra Titan */
9526 #define MACH_TITAN_YOSEMITE 1 /* PMC-Sierra Yosemite */
9527
9528 +/*
9529 + * Valid machtype for group BRCM
9530 + */
9531 +#define MACH_GROUP_BRCM 23 /* Broadcom boards */
9532 +#define MACH_BCM96338 0
9533 +#define MACH_BCM96345 1
9534 +#define MACH_BCM96348 2
9535 +
9536 #define CL_SIZE COMMAND_LINE_SIZE
9537
9538 const char *get_system_type(void);
9539 diff -urN linux.old/include/asm-mips/cpu.h linux.dev/include/asm-mips/cpu.h
9540 --- linux.old/include/asm-mips/cpu.h 2006-08-25 00:43:22.000000000 +0200
9541 +++ linux.dev/include/asm-mips/cpu.h 2006-08-25 00:39:38.000000000 +0200
9542 @@ -103,6 +103,13 @@
9543
9544 #define PRID_IMP_SR71000 0x0400
9545
9546 +/* These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
9547 + */
9548 +
9549 +#define PRID_IMP_BCM6338 0x9000
9550 +#define PRID_IMP_BCM6345 0x8000
9551 +#define PRID_IMP_BCM6348 0x9100
9552 +
9553 /*
9554 * Definitions for 7:0 on legacy processors
9555 */
9556 @@ -200,7 +207,10 @@
9557 #define CPU_SB1A 62
9558 #define CPU_74K 63
9559 #define CPU_R14000 64
9560 -#define CPU_LAST 64
9561 +#define CPU_BCM6338 65
9562 +#define CPU_BCM6345 66
9563 +#define CPU_BCM6348 67
9564 +#define CPU_LAST 67
9565
9566 /*
9567 * ISA Level encodings
9568 diff -urN linux.old/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h linux.dev/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h
9569 --- linux.old/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h 1970-01-01 01:00:00.000000000 +0100
9570 +++ linux.dev/include/asm-mips/mach-bcm963xx/cpu-feature-overrides.h 2006-08-25 11:27:40.000000000 +0200
9571 @@ -0,0 +1,36 @@
9572 +#ifndef __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
9573 +#define __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H
9574 +
9575 +#define cpu_has_tlb 1
9576 +#define cpu_has_4kex 4
9577 +#define cpu_has_4ktlb 8
9578 +#define cpu_has_fpu 0
9579 +#define cpu_has_32fpr 0
9580 +#define cpu_has_counter 0x40
9581 +#define cpu_has_watch 0
9582 +#define cpu_has_mips16 0
9583 +#define cpu_has_divec 0x200
9584 +#define cpu_has_vce 0
9585 +#define cpu_has_cache_cdex_p 0
9586 +#define cpu_has_cache_cdex_s 0
9587 +#define cpu_has_prefetch 0x40000
9588 +#define cpu_has_mcheck 0x2000
9589 +#define cpu_has_ejtag 0x4000
9590 +#define cpu_has_llsc 0x10000
9591 +#define cpu_has_vtag_icache 0
9592 +#define cpu_has_dc_aliases 0
9593 +#define cpu_has_ic_fills_f_dc 0
9594 +
9595 +#define cpu_has_nofpuex 0
9596 +#define cpu_has_64bits 0
9597 +#define cpu_has_64bit_zero_reg 0
9598 +#define cpu_has_64bit_gp_regs 0
9599 +#define cpu_has_64bit_addresses 0
9600 +
9601 +#define cpu_has_subset_pcaches 0
9602 +
9603 +#define cpu_dcache_line_size() 16
9604 +#define cpu_icache_line_size() 16
9605 +#define cpu_scache_line_size() 0
9606 +
9607 +#endif /* __ASM_MACH_BCM963XX_CPU_FEATURE_OVERRIDES_H */
9608 diff -urN linux.old/include/asm-mips/mach-generic/param.h linux.dev/include/asm-mips/mach-generic/param.h
9609 --- linux.old/include/asm-mips/mach-generic/param.h 2006-08-25 00:43:22.000000000 +0200
9610 +++ linux.dev/include/asm-mips/mach-generic/param.h 2006-08-25 00:39:38.000000000 +0200
9611 @@ -8,6 +8,6 @@
9612 #ifndef __ASM_MACH_GENERIC_PARAM_H
9613 #define __ASM_MACH_GENERIC_PARAM_H
9614
9615 -#define HZ 1000 /* Internal kernel timer frequency */
9616 +#define HZ 200 /* Internal kernel timer frequency */
9617
9618 #endif /* __ASM_MACH_GENERIC_PARAM_H */
9619 diff -urN linux.old/include/asm-mips/module.h linux.dev/include/asm-mips/module.h
9620 --- linux.old/include/asm-mips/module.h 2006-08-25 00:43:22.000000000 +0200
9621 +++ linux.dev/include/asm-mips/module.h 2006-08-25 00:39:38.000000000 +0200
9622 @@ -113,6 +113,12 @@
9623 #define MODULE_PROC_FAMILY "RM9000 "
9624 #elif defined CONFIG_CPU_SB1
9625 #define MODULE_PROC_FAMILY "SB1 "
9626 +#elif defined CONFIG_CPU_BCM6338
9627 +#define MODULE_PROC_FAMILY "BCM6338 "
9628 +#elif defined CONFIG_CPU_BCM6345
9629 +#define MODULE_PROC_FAMILY "BCM6345 "
9630 +#elif defined CONFIG_CPU_BCM6348
9631 +#define MODULE_PROC_FAMILY "BCM6348 "
9632 #else
9633 #error MODULE_PROC_FAMILY undefined for your processor configuration
9634 #endif
9635
This page took 0.453255 seconds and 5 git commands to generate.