FDT-ize "delay" by having fdt_machdep provide the delay() function and

move the implementations into the platform code.
This commit is contained in:
jmcneill 2017-06-02 00:16:27 +00:00
parent b7a940d982
commit 2a1124ac80
5 changed files with 27 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: arm_fdtvar.h,v 1.3 2017/05/30 22:00:25 jmcneill Exp $ */
/* $NetBSD: arm_fdtvar.h,v 1.4 2017/06/02 00:16:27 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
@ -42,6 +42,7 @@ struct arm_platform {
void (*early_putchar)(char);
void (*device_register)(device_t, void *);
void (*reset)(void);
void (*delay)(u_int);
};
struct arm_platform_info {

View File

@ -1,4 +1,4 @@
/* $NetBSD: tegra_platform.c,v 1.4 2017/05/30 22:55:26 jmcneill Exp $ */
/* $NetBSD: tegra_platform.c,v 1.5 2017/06/02 00:16:27 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared D. McNeill <jmcneill@invisible.ca>
@ -33,7 +33,7 @@
#include "ukbd.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.4 2017/05/30 22:55:26 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: tegra_platform.c,v 1.5 2017/06/02 00:16:27 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -182,6 +182,12 @@ tegra_platform_reset(void)
tegra_pmc_reset();
}
static void
tegra_platform_delay(u_int us)
{
tegra_timer_delay(us);
}
static const struct arm_platform tegra_platform = {
.devmap = tegra_platform_devmap,
.bootstrap = tegra_platform_bootstrap,
@ -189,6 +195,7 @@ static const struct arm_platform tegra_platform = {
.early_putchar = tegra_platform_early_putchar,
.device_register = tegra_platform_device_register,
.reset = tegra_platform_reset,
.delay = tegra_platform_delay,
};
ARM_PLATFORM(tegra124, "nvidia,tegra124", &tegra_platform);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tegra_timer.c,v 1.6 2017/05/25 23:54:45 jmcneill Exp $ */
/* $NetBSD: tegra_timer.c,v 1.7 2017/06/02 00:16:27 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tegra_timer.c,v 1.6 2017/05/25 23:54:45 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: tegra_timer.c,v 1.7 2017/06/02 00:16:27 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -161,7 +161,7 @@ tegra_timer_wdt_tickle(struct sysmon_wdog *smw)
}
void
delay(u_int us)
tegra_timer_delay(u_int us)
{
static bool timerus_configured = false;
bus_space_tag_t bst = &armv7_generic_bs_tag;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tegra_var.h,v 1.37 2017/05/28 00:40:20 jmcneill Exp $ */
/* $NetBSD: tegra_var.h,v 1.38 2017/06/02 00:16:27 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@ -85,6 +85,8 @@ void tegra_pmc_hdmi_enable(void);
uint32_t tegra_fuse_read(u_int);
void tegra_timer_delay(u_int);
void tegra_xusbpad_sata_enable(void);
void tegra_xusbpad_xhci_enable(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdt_machdep.c,v 1.2 2017/05/30 22:55:27 jmcneill Exp $ */
/* $NetBSD: fdt_machdep.c,v 1.3 2017/06/02 00:16:28 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.2 2017/05/30 22:55:27 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.3 2017/06/02 00:16:28 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@ -284,6 +284,14 @@ consinit(void)
initialized = true;
}
void
delay(u_int us)
{
const struct arm_platform *plat = arm_fdt_platform();
plat->delay(us);
}
static void
fdt_device_register(device_t self, void *aux)
{