162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _POWERPC_SYSDEV_DART_H
762306a36Sopenharmony_ci#define _POWERPC_SYSDEV_DART_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/* Offset from base to control register */
1162306a36Sopenharmony_ci#define DART_CNTL	0
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* Offset from base to exception register */
1462306a36Sopenharmony_ci#define DART_EXCP_U3	0x10
1562306a36Sopenharmony_ci/* Offset from base to TLB tag registers */
1662306a36Sopenharmony_ci#define DART_TAGS_U3	0x1000
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* U4 registers */
1962306a36Sopenharmony_ci#define DART_BASE_U4	0x10
2062306a36Sopenharmony_ci#define DART_SIZE_U4	0x20
2162306a36Sopenharmony_ci#define DART_EXCP_U4	0x30
2262306a36Sopenharmony_ci#define DART_TAGS_U4	0x1000
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* Control Register fields */
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* U3 registers */
2762306a36Sopenharmony_ci#define DART_CNTL_U3_BASE_MASK	0xfffff
2862306a36Sopenharmony_ci#define DART_CNTL_U3_BASE_SHIFT	12
2962306a36Sopenharmony_ci#define DART_CNTL_U3_FLUSHTLB	0x400
3062306a36Sopenharmony_ci#define DART_CNTL_U3_ENABLE	0x200
3162306a36Sopenharmony_ci#define DART_CNTL_U3_SIZE_MASK	0x1ff
3262306a36Sopenharmony_ci#define DART_CNTL_U3_SIZE_SHIFT	0
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* U4 registers */
3562306a36Sopenharmony_ci#define DART_BASE_U4_BASE_MASK	0xffffff
3662306a36Sopenharmony_ci#define DART_BASE_U4_BASE_SHIFT	0
3762306a36Sopenharmony_ci#define DART_CNTL_U4_ENABLE	0x80000000
3862306a36Sopenharmony_ci#define DART_CNTL_U4_IONE	0x40000000
3962306a36Sopenharmony_ci#define DART_CNTL_U4_FLUSHTLB	0x20000000
4062306a36Sopenharmony_ci#define DART_CNTL_U4_IDLE	0x10000000
4162306a36Sopenharmony_ci#define DART_CNTL_U4_PAR_EN	0x08000000
4262306a36Sopenharmony_ci#define DART_CNTL_U4_IONE_MASK	0x07ffffff
4362306a36Sopenharmony_ci#define DART_SIZE_U4_SIZE_MASK	0x1fff
4462306a36Sopenharmony_ci#define DART_SIZE_U4_SIZE_SHIFT	0
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define DART_REG(r)	(dart + ((r) >> 2))
4762306a36Sopenharmony_ci#define DART_IN(r)	(in_be32(DART_REG(r)))
4862306a36Sopenharmony_ci#define DART_OUT(r,v)	(out_be32(DART_REG(r), (v)))
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* size of table in pages */
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* DART table fields */
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci#define DARTMAP_VALID   0x80000000
5762306a36Sopenharmony_ci#define DARTMAP_RPNMASK 0x00ffffff
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define DART_PAGE_SHIFT		12
6162306a36Sopenharmony_ci#define DART_PAGE_SIZE		(1 << DART_PAGE_SHIFT)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#endif /* _POWERPC_SYSDEV_DART_H */
65