1 /* Implements sys_padconf() for the AM335X and DM37XX. */
3 #include "kernel/kernel.h"
4 #include "arch_proto.h"
6 #include <machine/cpu.h>
7 #include <minix/mmio.h>
8 #include <minix/padconf.h>
9 #include <minix/board.h>
10 #include <minix/com.h>
16 #include "bsp_padconf.h"
23 unsigned int board_filter_value
;
24 unsigned int board_filter_mask
;
27 static struct omap_padconf omap_padconfs
[] = {
29 .base
= PADCONF_DM37XX_REGISTERS_BASE
,
30 .offset
= PADCONF_DM37XX_REGISTERS_OFFSET
,
31 .size
= PADCONF_DM37XX_REGISTERS_SIZE
,
32 .board_filter_value
= BOARD_FILTER_BBXM_VALUE
,
33 .board_filter_mask
= BOARD_FILTER_BBXM_MASK
,
36 .base
= PADCONF_AM335X_REGISTERS_BASE
,
37 .offset
= PADCONF_AM335X_REGISTERS_OFFSET
,
38 .size
= PADCONF_AM335X_REGISTERS_SIZE
,
39 .board_filter_value
= BOARD_FILTER_BB_VALUE
,
40 .board_filter_mask
= BOARD_FILTER_BB_MASK
,
44 /* initialized in init */
45 static struct omap_padconf
*omap_padconf
;
47 static kern_phys_map padconf_phys_map
;
50 bsp_padconf_set(u32_t padconf
, u32_t mask
, u32_t value
)
52 /* check that the value will be inside the padconf memory range */
53 if (padconf
>= (omap_padconf
->size
- omap_padconf
->offset
)) {
54 return EINVAL
; /* outside of valid range */
57 set32(padconf
+ omap_padconf
->base
+ omap_padconf
->offset
, mask
,
64 bsp_padconf_init(void)
68 /* find the correct padconf */
69 for (x
= 0; x
< sizeof(omap_padconfs
) / sizeof(omap_padconfs
[0]); x
++) {
70 if ((omap_padconfs
[x
].board_filter_mask
& machine
.board_id
) ==
71 omap_padconfs
[x
].board_filter_value
) {
72 omap_padconf
= &omap_padconfs
[x
];
78 kern_phys_map_ptr(omap_padconf
->base
, omap_padconf
->size
,
79 VMMF_UNCACHED
| VMMF_WRITE
,
80 &padconf_phys_map
, (vir_bytes
) & omap_padconf
->base
);