1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2/* Copyright (C) 2015-2017 Netronome Systems, Inc. */
3
4/*
5 * nfp_xpb.h
6 * Author: Jason McMullan <jason.mcmullan@netronome.com>
7 */
8
9#ifndef NFP6000_XPB_H
10#define NFP6000_XPB_H
11
12/* For use with NFP6000 Databook "XPB Addressing" section
13 */
14#define NFP_XPB_OVERLAY(island)  (((island) & 0x3f) << 24)
15
16#define NFP_XPB_ISLAND(island)   (NFP_XPB_OVERLAY(island) + 0x60000)
17
18#define NFP_XPB_ISLAND_of(offset) (((offset) >> 24) & 0x3F)
19
20/* For use with NFP6000 Databook "XPB Island and Device IDs" chapter
21 */
22#define NFP_XPB_DEVICE(island, slave, device) \
23	(NFP_XPB_OVERLAY(island) | \
24	 (((slave) & 3) << 22) | \
25	 (((device) & 0x3f) << 16))
26
27#endif /* NFP6000_XPB_H */
28