18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _POWERPC_SYSDEV_DART_H
78c2ecf20Sopenharmony_ci#define _POWERPC_SYSDEV_DART_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* Offset from base to control register */
118c2ecf20Sopenharmony_ci#define DART_CNTL	0
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* Offset from base to exception register */
148c2ecf20Sopenharmony_ci#define DART_EXCP_U3	0x10
158c2ecf20Sopenharmony_ci/* Offset from base to TLB tag registers */
168c2ecf20Sopenharmony_ci#define DART_TAGS_U3	0x1000
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* U4 registers */
198c2ecf20Sopenharmony_ci#define DART_BASE_U4	0x10
208c2ecf20Sopenharmony_ci#define DART_SIZE_U4	0x20
218c2ecf20Sopenharmony_ci#define DART_EXCP_U4	0x30
228c2ecf20Sopenharmony_ci#define DART_TAGS_U4	0x1000
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* Control Register fields */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* U3 registers */
278c2ecf20Sopenharmony_ci#define DART_CNTL_U3_BASE_MASK	0xfffff
288c2ecf20Sopenharmony_ci#define DART_CNTL_U3_BASE_SHIFT	12
298c2ecf20Sopenharmony_ci#define DART_CNTL_U3_FLUSHTLB	0x400
308c2ecf20Sopenharmony_ci#define DART_CNTL_U3_ENABLE	0x200
318c2ecf20Sopenharmony_ci#define DART_CNTL_U3_SIZE_MASK	0x1ff
328c2ecf20Sopenharmony_ci#define DART_CNTL_U3_SIZE_SHIFT	0
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* U4 registers */
358c2ecf20Sopenharmony_ci#define DART_BASE_U4_BASE_MASK	0xffffff
368c2ecf20Sopenharmony_ci#define DART_BASE_U4_BASE_SHIFT	0
378c2ecf20Sopenharmony_ci#define DART_CNTL_U4_ENABLE	0x80000000
388c2ecf20Sopenharmony_ci#define DART_CNTL_U4_IONE	0x40000000
398c2ecf20Sopenharmony_ci#define DART_CNTL_U4_FLUSHTLB	0x20000000
408c2ecf20Sopenharmony_ci#define DART_CNTL_U4_IDLE	0x10000000
418c2ecf20Sopenharmony_ci#define DART_CNTL_U4_PAR_EN	0x08000000
428c2ecf20Sopenharmony_ci#define DART_CNTL_U4_IONE_MASK	0x07ffffff
438c2ecf20Sopenharmony_ci#define DART_SIZE_U4_SIZE_MASK	0x1fff
448c2ecf20Sopenharmony_ci#define DART_SIZE_U4_SIZE_SHIFT	0
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define DART_REG(r)	(dart + ((r) >> 2))
478c2ecf20Sopenharmony_ci#define DART_IN(r)	(in_be32(DART_REG(r)))
488c2ecf20Sopenharmony_ci#define DART_OUT(r,v)	(out_be32(DART_REG(r), (v)))
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* size of table in pages */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* DART table fields */
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define DARTMAP_VALID   0x80000000
578c2ecf20Sopenharmony_ci#define DARTMAP_RPNMASK 0x00ffffff
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define DART_PAGE_SHIFT		12
618c2ecf20Sopenharmony_ci#define DART_PAGE_SIZE		(1 << DART_PAGE_SHIFT)
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#endif /* _POWERPC_SYSDEV_DART_H */
65