Skip to content

Commit

Permalink
raumfeld: add DT fixup function for setting /system-revision
Browse files Browse the repository at this point in the history
  • Loading branch information
zonque committed Jun 11, 2018
1 parent 40d24e6 commit 045fdf1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ UART=8250
BINFMT=elf32-littlearm
LOADADDR=0xa0008000
UART_BASE=0x40100000
LIBFDT=y
RELOCATE_DTB=0xa2000000
23 changes: 22 additions & 1 deletion board-raumfeld.c
Original file line number Diff line number Diff line change
@@ -1,51 +1,72 @@
#include "atags.h"
#include "board.h"
#include "dtbs.h"
#include "libfdt.h"
#include "print.h"
#include "register.h"
#include "types.h"

extern u32 _binary_input_zImage_start;
extern u32 _binary_dtbs_bin_start;

static u32 system_rev;
struct board board;

struct raumfeld_board {
u32 machid;
u16 system_rev_upper;
const char *compatible;
void (*fixup_dtb)(const struct board *);
};

static void raumfeld_fixup_dtb_common(const struct board *board)
{
int off;

off = fdt_path_offset(board->dtb, "/");
if (off < 0) {
putstr("Unable to locate /system-revision!\n");
return;
}

fdt_setprop_inplace_u32(board->dtb, off, "system-revision", system_rev & 0xff);
}

static struct raumfeld_board rboards[] = {
/* Controller */
{
.machid = 2413,
.system_rev_upper = 0,
.compatible = "raumfeld,raumfeld-controller-pxa303",
.fixup_dtb = &raumfeld_fixup_dtb_common,
},

/* Connector */
{
.machid = 2414,
.system_rev_upper = 0,
.compatible = "raumfeld,raumfeld-connector-pxa303",
.fixup_dtb = &raumfeld_fixup_dtb_common,
},

/* Speaker */
{
.machid = 2415,
.system_rev_upper = 0,
.compatible = "raumfeld,raumfeld-speaker-s-pxa303",
.fixup_dtb = &raumfeld_fixup_dtb_common,
},
{
.machid = 2415,
.system_rev_upper = 1,
.compatible = "raumfeld,raumfeld-speaker-m-pxa303",
.fixup_dtb = &raumfeld_fixup_dtb_common,
},
{
.machid = 2415,
.system_rev_upper = 2,
.compatible = "raumfeld,raumfeld-speaker-one-pxa303",
.fixup_dtb = &raumfeld_fixup_dtb_common,
},
{ 0, 0, NULL } /* sentinel */
};
Expand Down Expand Up @@ -95,7 +116,6 @@ struct board *match_board(u32 machid, const struct tag *tags)
{
const struct tag *t;
struct raumfeld_board *rboard;
u32 system_rev = 0;

/* walk the atags to determine the system revision */
for_each_tag(t, tags) {
Expand Down Expand Up @@ -124,6 +144,7 @@ struct board *match_board(u32 machid, const struct tag *tags)

board.kernel = &_binary_input_zImage_start;
board.compatible = rboard->compatible;
board.fixup_dtb = rboard->fixup_dtb;
board.dtb = find_dtb(&_binary_dtbs_bin_start, rboard->compatible, &board.dtb_size);

if (board.dtb == NULL) {
Expand Down

0 comments on commit 045fdf1

Please sign in to comment.