rk30xx_machdep.c revision 259365
1256949Sganbold/*-
2256949Sganbold * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@gmail.com>
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: stable/10/sys/arm/rockchip/rk30xx_machdep.c 259365 2013-12-14 00:16:08Z 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
52256949Sganbold/* Start of address space used for bootstrap map */
53256949Sganbold#define DEVMAP_BOOTSTRAP_MAP_START	0xF0000000
54256949Sganbold
55256949Sganboldvm_offset_t
56256949Sganboldinitarm_lastaddr(void)
57256949Sganbold{
58256949Sganbold
59259335Sian	return (DEVMAP_BOOTSTRAP_MAP_START);
60256949Sganbold}
61256949Sganbold
62256949Sganboldvoid
63259365Sianinitarm_early_init(void)
64259365Sian{
65259365Sian
66259365Sian}
67259365Sian
68259365Sianvoid
69256949Sganboldinitarm_gpio_init(void)
70256949Sganbold{
71256949Sganbold}
72256949Sganbold
73256949Sganboldvoid
74256949Sganboldinitarm_late_init(void)
75256949Sganbold{
76256949Sganbold
77256949Sganbold	/* Enable cache */
78256949Sganbold	cpufunc_control(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE,
79256949Sganbold	    CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE);
80256949Sganbold}
81256949Sganbold
82256949Sganbold#define FDT_DEVMAP_MAX		(1 + 2 + 1 + 1)
83259364Sianstatic struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = {
84256949Sganbold	{ 0, 0, 0, 0, 0, }
85256949Sganbold};
86256949Sganbold
87256949Sganbold/*
88256949Sganbold * Construct pmap_devmap[] with DT-derived config data.
89256949Sganbold */
90256949Sganboldint
91259365Sianinitarm_devmap_init(void)
92256949Sganbold{
93256949Sganbold	int i = 0;
94256949Sganbold
95256949Sganbold	fdt_devmap[i].pd_va = 0xF0000000;
96256949Sganbold	fdt_devmap[i].pd_pa = 0x20000000;
97256949Sganbold	fdt_devmap[i].pd_size = 0x100000;
98256949Sganbold	fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
99256949Sganbold	fdt_devmap[i].pd_cache = PTE_DEVICE;
100256949Sganbold	i++;
101256949Sganbold
102259364Sian	arm_devmap_register_table(&fdt_devmap[0]);
103259364Sian
104256949Sganbold	return (0);
105256949Sganbold}
106256949Sganbold
107256949Sganboldstruct arm32_dma_range *
108256949Sganboldbus_dma_get_range(void)
109256949Sganbold{
110256949Sganbold
111256949Sganbold	return (NULL);
112256949Sganbold}
113256949Sganbold
114256949Sganboldint
115256949Sganboldbus_dma_get_range_nb(void)
116256949Sganbold{
117256949Sganbold
118256949Sganbold	return (0);
119256949Sganbold}
120256949Sganbold
121256949Sganboldvoid
122256949Sganboldcpu_reset()
123256949Sganbold{
124256949Sganbold
125256949Sganbold	printf("No cpu_reset implementation!\n");
126256949Sganbold	while (1);
127256949Sganbold}
128