2013-08-28 06:43:45 +02:00
|
|
|
/* Implements sys_padconf() for the AM335X and DM37XX. */
|
2013-07-15 16:28:58 +02:00
|
|
|
|
|
|
|
#include "kernel/kernel.h"
|
2013-08-28 06:43:45 +02:00
|
|
|
#include "arch_proto.h"
|
2013-07-15 16:28:58 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <machine/cpu.h>
|
|
|
|
#include <minix/mmio.h>
|
2013-08-28 06:43:45 +02:00
|
|
|
#include <minix/padconf.h>
|
2013-07-15 16:28:58 +02:00
|
|
|
#include <assert.h>
|
|
|
|
#include <io.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "omap_padconf.h"
|
|
|
|
|
2013-08-28 06:43:45 +02:00
|
|
|
struct omap_padconf
|
|
|
|
{
|
|
|
|
vir_bytes base;
|
|
|
|
vir_bytes offset;
|
|
|
|
vir_bytes size;
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_padconf omap_padconf = {
|
|
|
|
.base = PADCONF_REGISTERS_BASE,
|
|
|
|
.offset = PADCONF_REGISTERS_OFFSET,
|
|
|
|
.size = PADCONF_REGISTERS_SIZE
|
|
|
|
};
|
2013-07-15 16:28:58 +02:00
|
|
|
|
2013-08-28 06:43:45 +02:00
|
|
|
static kern_phys_map padconf_phys_map;
|
2013-07-15 16:28:58 +02:00
|
|
|
|
2013-08-28 06:43:45 +02:00
|
|
|
int
|
|
|
|
arch_padconf_set(u32_t padconf, u32_t mask, u32_t value)
|
2013-07-15 16:28:58 +02:00
|
|
|
{
|
2013-08-28 06:43:45 +02:00
|
|
|
/* check that the value will be inside the padconf memory range */
|
|
|
|
if (padconf >= (PADCONF_REGISTERS_SIZE - PADCONF_REGISTERS_OFFSET)) {
|
|
|
|
return EINVAL; /* outside of valid range */
|
|
|
|
}
|
|
|
|
|
|
|
|
set32(padconf + omap_padconf.base + omap_padconf.offset, mask, value);
|
|
|
|
|
2013-07-15 16:28:58 +02:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-08-28 06:43:45 +02:00
|
|
|
arch_padconf_init(void)
|
2013-07-15 16:28:58 +02:00
|
|
|
{
|
2013-08-28 06:43:45 +02:00
|
|
|
kern_phys_map_ptr(omap_padconf.base, omap_padconf.size,
|
2013-08-26 18:43:16 +02:00
|
|
|
&padconf_phys_map, (vir_bytes) &omap_padconf.base);
|
2013-07-15 16:28:58 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|