File: [local] / funnyos / arch / sam7s64 / config.c (download)
Revision 1.4, Tue Nov 13 15:41:35 2007 UTC (16 years, 6 months ago) by nbrk
Branch: MAIN
Changes since 1.3: +18 -4 lines
rename startup initialization hook in config_machineinit();
add code to enable main oscillator via PMC, more to come..
|
/*
* $Id: config.c,v 1.4 2007/11/13 15:41:35 nbrk Exp $
*/
#include <sys/types.h>
#include <sys/device.h>
/* devices' regs that we will touch in config_machineinit() */
#include <arch/sam7s64/dev/sapmcreg.h>
/*
* Configuration file for platform (AT91SAM7S64).
*/
/* device drivers */
extern struct driver root_dr;
extern struct driver cpu_dr;
extern struct driver saapbus_dr;
extern void(*putchar)(char);
void sauart_early_putc(char ch);
/* amount of physical memory, in Bytes */
uint32_t physmem = 16384;
/*
* Where to attach each device.
*/
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 }
};
/*
* Link device names with their drivers.
*/
struct driverinfo config_driverinfo[] = {
/* name, driverp, ninstances (should be -1) */
{ "root", &root_dr, -1 },
{ "cpu" , &cpu_dr, -1 },
{ "saapbus" , &saapbus_dr, -1 },
{ NULL, NULL, 0 }
};
/*
* Machine early-stage initialization hooks.
*/
void
config_machineinit(void)
{
/*
* Initialize critical devices at startup.
*/
/* 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) =
}