154359Sroberto/*-
254359Sroberto * Copyright (c) 2012 Ganbold Tsagaankhuu <ganbold@freebsd.org>
354359Sroberto * All rights reserved.
454359Sroberto *
554359Sroberto * This code is derived from software written for Brini by Mark Brinicombe
654359Sroberto *
754359Sroberto * Redistribution and use in source and binary forms, with or without
882498Sroberto * modification, are permitted provided that the following conditions
982498Sroberto * are met:
1082498Sroberto * 1. Redistributions of source code must retain the above copyright
1182498Sroberto *    notice, this list of conditions and the following disclaimer.
1254359Sroberto * 2. Redistributions in binary form must reproduce the above copyright
1354359Sroberto *    notice, this list of conditions and the following disclaimer in the
14106163Sroberto *    documentation and/or other materials provided with the distribution.
15106163Sroberto *
16106163Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1782498Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1882498Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1982498Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2054359Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2154359Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2254359Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2354359Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2454359Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2554359Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2654359Sroberto * SUCH DAMAGE.
2754359Sroberto *
2854359Sroberto * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
2954359Sroberto */
3054359Sroberto
3154359Sroberto#include "opt_ddb.h"
3254359Sroberto#include "opt_platform.h"
3354359Sroberto
3454359Sroberto#include <sys/cdefs.h>
3554359Sroberto__FBSDID("$FreeBSD$");
3654359Sroberto
3754359Sroberto#define _ARM32_BUS_DMA_PRIVATE
3854359Sroberto#include <sys/param.h>
3954359Sroberto#include <sys/systm.h>
4054359Sroberto#include <sys/bus.h>
4154359Sroberto
4254359Sroberto#include <vm/vm.h>
4354359Sroberto#include <vm/pmap.h>
4454359Sroberto
4554359Sroberto#include <machine/bus.h>
4654359Sroberto#include <machine/devmap.h>
4754359Sroberto#include <machine/machdep.h>
4882498Sroberto
49132451Sroberto#include <dev/fdt/fdt_common.h>
5054359Sroberto
51132451Sroberto#include <arm/allwinner/a10_wdog.h>
52132451Sroberto
5354359Srobertovm_offset_t
5454359Srobertoinitarm_lastaddr(void)
5554359Sroberto{
5654359Sroberto
5754359Sroberto	return (arm_devmap_lastaddr());
5854359Sroberto}
5954359Sroberto
6054359Srobertovoid
6154359Srobertoinitarm_early_init(void)
6254359Sroberto{
6354359Sroberto}
6454359Sroberto
6554359Srobertovoid
6654359Srobertoinitarm_gpio_init(void)
6754359Sroberto{
6854359Sroberto}
6954359Sroberto
7054359Srobertovoid
7154359Srobertoinitarm_late_init(void)
7254359Sroberto{
7354359Sroberto}
7454359Sroberto
7554359Sroberto/*
7654359Sroberto * Set up static device mappings.
7754359Sroberto *
7854359Sroberto * This covers all the on-chip device with 1MB section mappings, which is good
7954359Sroberto * for performance (uses fewer TLB entries for device access).
8054359Sroberto *
8154359Sroberto * XXX It also covers a block of SRAM and some GPU (mali400) stuff that maybe
82132451Sroberto * shouldn't be device-mapped.  The original code mapped a 4MB block, but
83132451Sroberto * perhaps a 1MB block would be more appropriate.
84132451Sroberto */
85132451Srobertoint
86132451Srobertoinitarm_devmap_init(void)
87132451Sroberto{
88132451Sroberto
89132451Sroberto	arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */
90132451Sroberto
91132451Sroberto	return (0);
9254359Sroberto}
9354359Sroberto
94132451Srobertostruct arm32_dma_range *
95132451Srobertobus_dma_get_range(void)
96132451Sroberto{
97132451Sroberto	return (NULL);
98132451Sroberto}
99132451Sroberto
100132451Srobertoint
101132451Srobertobus_dma_get_range_nb(void)
102132451Sroberto{
103132451Sroberto	return (0);
104132451Sroberto}
105132451Sroberto
106132451Srobertovoid
107132451Srobertocpu_reset()
108132451Sroberto{
109132451Sroberto	a10wd_watchdog_reset();
110132451Sroberto	printf("Reset failed!\n");
111132451Sroberto	while (1);
112132451Sroberto}
113132451Sroberto