=================================================================== RCS file: /cvs/funnyos/arch/sam7s64/config.c,v retrieving revision 1.2 retrieving revision 1.4 diff -u -r1.2 -r1.4 --- funnyos/arch/sam7s64/config.c 2007/11/09 16:10:07 1.2 +++ funnyos/arch/sam7s64/config.c 2007/11/13 15:41:35 1.4 @@ -1,9 +1,12 @@ /* - * $Id: config.c,v 1.2 2007/11/09 16:10:07 init Exp $ + * $Id: config.c,v 1.4 2007/11/13 15:41:35 nbrk Exp $ */ #include #include +/* devices' regs that we will touch in config_machineinit() */ +#include + /* * Configuration file for platform (AT91SAM7S64). */ @@ -11,6 +14,7 @@ /* device drivers */ extern struct driver root_dr; extern struct driver cpu_dr; +extern struct driver saapbus_dr; extern void(*putchar)(char); @@ -25,6 +29,7 @@ struct attachinfo config_attachinfo[] = { /* child, parent, pminor, loc, intrno, flags */ { "cpu" , "root", 0, 0, 0, 0 }, + { "saapbus","root", 0, 0, 0, 0 }, { NULL, NULL, 0, 0, 0, 0 } }; @@ -36,6 +41,7 @@ /* name, driverp, ninstances (should be -1) */ { "root", &root_dr, -1 }, { "cpu" , &cpu_dr, -1 }, + { "saapbus" , &saapbus_dr, -1 }, { NULL, NULL, 0 } }; @@ -45,12 +51,23 @@ */ void -config_consinit(void) +config_machineinit(void) { /* - * Configure putchar, so we can printf messages to the console without fcons. + * Initialize critical devices at startup. */ - /* putchar = tauart_early_putc; */ + + /* XXX kill magic */ + + /* enable main oscillator and set 6 Slow Clock cycles to wait for its startup */ + *(uint32_t)(SAPMC_BASE + SAPMC_CKGR_MOR) = (0x0000ff00 & (0x06 << 8)) | 0x00000001; + + /* wait main osc. to stabilize.. */ + while (*(uint32_t)(SAPMC_BASE + SAPMC_PMC_SR) & 0x00000001 ) + ; + + /* TODO set PLL */ +// *(uint32_t)(SAPMC_BASE + SAPMC_PMC_MCKR) = }