cleanup
[AROS.git] / arch / arm-native / bus / amba / amba_init.c
blobb0b8a2d588870e551679dcec109e6b007ad6361a
1 /*
2 Copyright © 2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 0
7 #include <aros/debug.h>
9 #include <proto/kernel.h>
11 int ambabus_init()
13 IPTR __arm_periiobase;
14 UBYTE *ptr;
16 if ((__arm_periiobase = KrnGetSystemAttr(KATTR_PeripheralBase)) != NULL)
18 D(bug("[AMBA] %s: Integrated Peripherals -:\n", __PRETTY_FUNCTION__));
19 for (ptr = __arm_periiobase; ptr < (__arm_periiobase + ARM_PERIIOSIZE); ptr += ARM_PRIMECELLPERISIZE)
21 unsigned int perihreg = (*(volatile unsigned int *)(ptr + 0xFF0) & 0xFF) | (*(volatile unsigned int *)(ptr + 0xFF4) & 0xFF) << 8 | (*(volatile unsigned int *)(ptr + 0xFF8) & 0xFF) << 16 | (*(volatile unsigned int *)(ptr + 0xFFC) & 0xFF) << 24;
22 if (perihreg == ARM_PRIMECELLID)
24 perihreg = (*(volatile unsigned int *)(ptr + 0xFE0) & 0xFF) | (*(volatile unsigned int *)(ptr + 0xFE4) & 0xFF) << 8 | (*(volatile unsigned int *)(ptr + 0xFE8) & 0xFF) << 16 | (*(volatile unsigned int *)(ptr + 0xFEC) & 0xFF) << 24;
25 unsigned int manu = (perihreg & (0x7F << 12)) >> 12;
26 unsigned int prod = (perihreg & 0xFFF);
27 unsigned int rev = (perihreg & (0xF << 20)) >> 20;
28 unsigned int config = (perihreg & (0x7F << 24)) >> 24;
29 D(bug("[AMBA] %s: 0x%p: manu %x, prod %x, rev %d, config %d\n", __PRETTY_FUNCTION__, ptr, manu, prod, rev, config));
31 /* else
33 if (perihreg)
35 D(bug("[AMBA] %s: 0x%p: PrimeCellID != %08x\n", __PRETTY_FUNCTION__, ptr, perihreg));
37 }*/
40 return 0;