Pass boot device to amlogicsdhc and amlogicsdio drivers.

This commit is contained in:
jmcneill 2015-08-08 13:54:05 +00:00
parent 4bd8c591b0
commit 826d810d5a
2 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: amlogic_reg.h,v 1.11 2015/04/25 14:41:33 jmcneill Exp $ */
/* $NetBSD: amlogic_reg.h,v 1.12 2015/08/08 13:54:05 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -87,6 +87,7 @@
#define AMLOGIC_SRAM_OFFSET 0x19000000
#define AMLOGIC_BOOTINFO_OFFSET 0x1901ff00
#define AMLOGIC_CPUCONF_OFFSET 0x1901ff80
#define AMLOGIC_CBUS_CPU_CLK_CNTL_REG 0x419c

View File

@ -1,4 +1,4 @@
/* $NetBSD: amlogic_machdep.c,v 1.20 2015/04/03 18:03:05 jmcneill Exp $ */
/* $NetBSD: amlogic_machdep.c,v 1.21 2015/08/08 13:54:05 jmcneill Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.20 2015/04/03 18:03:05 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.21 2015/08/08 13:54:05 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@ -495,6 +495,16 @@ amlogic_reset(void)
}
}
static uint32_t
amlogic_get_boot_device(void)
{
bus_space_tag_t bst = &armv7_generic_bs_tag;
bus_space_handle_t bsh = amlogic_core_bsh;
bus_size_t off = AMLOGIC_BOOTINFO_OFFSET;
return bus_space_read_4(bst, bsh, off + 4);
}
void
amlogic_device_register(device_t self, void *aux)
{
@ -542,6 +552,12 @@ amlogic_device_register(device_t self, void *aux)
}
}
if (device_is_a(self, "amlogicsdhc") ||
device_is_a(self, "amlogicsdio")) {
prop_dictionary_set_uint32(dict, "boot_id",
amlogic_get_boot_device());
}
#if NGENFB > 0
if (device_is_a(self, "genfb")) {
char *ptr;