1256949Sganbold/*-
2266337Sian * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@freebsd.org>
3256949Sganbold * All rights reserved.
4256949Sganbold *
5256949Sganbold * This code is derived from software written for Brini by Mark Brinicombe
6256949Sganbold *
7256949Sganbold * Redistribution and use in source and binary forms, with or without
8256949Sganbold * modification, are permitted provided that the following conditions
9256949Sganbold * are met:
10256949Sganbold * 1. Redistributions of source code must retain the above copyright
11256949Sganbold *    notice, this list of conditions and the following disclaimer.
12256949Sganbold * 2. Redistributions in binary form must reproduce the above copyright
13256949Sganbold *    notice, this list of conditions and the following disclaimer in the
14256949Sganbold *    documentation and/or other materials provided with the distribution.
15256949Sganbold *
16256949Sganbold * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17256949Sganbold * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18256949Sganbold * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19256949Sganbold * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20256949Sganbold * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21256949Sganbold * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22256949Sganbold * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23256949Sganbold * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24256949Sganbold * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25256949Sganbold * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26256949Sganbold * SUCH DAMAGE.
27256949Sganbold *
28256949Sganbold * from: FreeBSD: //depot/projects/arm/src/sys/arm/ti/ti_machdep.c
29256949Sganbold */
30256949Sganbold
31256949Sganbold#include "opt_ddb.h"
32256949Sganbold#include "opt_platform.h"
33256949Sganbold
34256949Sganbold#include <sys/cdefs.h>
35256949Sganbold__FBSDID("$FreeBSD: releng/10.3/sys/arm/rockchip/rk30xx_machdep.c 266397 2014-05-18 13:05:07Z ian $");
36256949Sganbold
37256949Sganbold#define _ARM32_BUS_DMA_PRIVATE
38256949Sganbold#include <sys/param.h>
39256949Sganbold#include <sys/systm.h>
40256949Sganbold#include <sys/bus.h>
41256949Sganbold
42256949Sganbold#include <vm/vm.h>
43256949Sganbold#include <vm/pmap.h>
44256949Sganbold
45256949Sganbold#include <machine/armreg.h>
46256949Sganbold#include <machine/bus.h>
47259364Sian#include <machine/devmap.h>
48256949Sganbold#include <machine/machdep.h>
49256949Sganbold
50256949Sganbold#include <dev/fdt/fdt_common.h>
51256949Sganbold
52256949Sganboldvm_offset_t
53256949Sganboldinitarm_lastaddr(void)
54256949Sganbold{
55256949Sganbold
56266381Sian	return (arm_devmap_lastaddr());
57256949Sganbold}
58256949Sganbold
59256949Sganboldvoid
60259365Sianinitarm_early_init(void)
61259365Sian{
62259365Sian
63259365Sian}
64259365Sian
65259365Sianvoid
66256949Sganboldinitarm_gpio_init(void)
67256949Sganbold{
68256949Sganbold}
69256949Sganbold
70256949Sganboldvoid
71256949Sganboldinitarm_late_init(void)
72256949Sganbold{
73256949Sganbold
74256949Sganbold	/* Enable cache */
75256949Sganbold	cpufunc_control(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE,
76256949Sganbold	    CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE);
77256949Sganbold}
78256949Sganbold
79256949Sganbold/*
80266381Sian * Set up static device mappings.
81256949Sganbold */
82256949Sganboldint
83259365Sianinitarm_devmap_init(void)
84256949Sganbold{
85256949Sganbold
86266397Sian	arm_devmap_add_entry(0x10000000, 0x00200000);
87266381Sian	arm_devmap_add_entry(0x20000000, 0x00100000);
88259364Sian
89256949Sganbold	return (0);
90256949Sganbold}
91256949Sganbold
92256949Sganboldstruct arm32_dma_range *
93256949Sganboldbus_dma_get_range(void)
94256949Sganbold{
95256949Sganbold
96256949Sganbold	return (NULL);
97256949Sganbold}
98256949Sganbold
99256949Sganboldint
100256949Sganboldbus_dma_get_range_nb(void)
101256949Sganbold{
102256949Sganbold
103256949Sganbold	return (0);
104256949Sganbold}
105256949Sganbold
106256949Sganboldvoid
107256949Sganboldcpu_reset()
108256949Sganbold{
109256949Sganbold
110256949Sganbold	printf("No cpu_reset implementation!\n");
111256949Sganbold	while (1);
112256949Sganbold}
113