162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/* Renesas Ethernet Switch device driver
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2022 Renesas Electronics Corporation
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef __RSWITCH_H__
862306a36Sopenharmony_ci#define __RSWITCH_H__
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include <linux/platform_device.h>
1162306a36Sopenharmony_ci#include "rcar_gen4_ptp.h"
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define RSWITCH_MAX_NUM_QUEUES	128
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define RSWITCH_NUM_PORTS	3
1662306a36Sopenharmony_ci#define rswitch_for_each_enabled_port(priv, i)		\
1762306a36Sopenharmony_ci	for (i = 0; i < RSWITCH_NUM_PORTS; i++)		\
1862306a36Sopenharmony_ci		if (priv->rdev[i]->disabled)		\
1962306a36Sopenharmony_ci			continue;			\
2062306a36Sopenharmony_ci		else
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define rswitch_for_each_enabled_port_continue_reverse(priv, i)	\
2362306a36Sopenharmony_ci	for (i--; i >= 0; i--)					\
2462306a36Sopenharmony_ci		if (priv->rdev[i]->disabled)			\
2562306a36Sopenharmony_ci			continue;				\
2662306a36Sopenharmony_ci		else
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define TX_RING_SIZE		1024
2962306a36Sopenharmony_ci#define RX_RING_SIZE		1024
3062306a36Sopenharmony_ci#define TS_RING_SIZE		(TX_RING_SIZE * RSWITCH_NUM_PORTS)
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define PKT_BUF_SZ		1584
3362306a36Sopenharmony_ci#define RSWITCH_ALIGN		128
3462306a36Sopenharmony_ci#define RSWITCH_MAX_CTAG_PCP	7
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci#define RSWITCH_TIMEOUT_US	100000
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define RSWITCH_TOP_OFFSET	0x00008000
3962306a36Sopenharmony_ci#define RSWITCH_COMA_OFFSET	0x00009000
4062306a36Sopenharmony_ci#define RSWITCH_ETHA_OFFSET	0x0000a000	/* with RMAC */
4162306a36Sopenharmony_ci#define RSWITCH_ETHA_SIZE	0x00002000	/* with RMAC */
4262306a36Sopenharmony_ci#define RSWITCH_GWCA0_OFFSET	0x00010000
4362306a36Sopenharmony_ci#define RSWITCH_GWCA1_OFFSET	0x00012000
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci/* TODO: hardcoded ETHA/GWCA settings for now */
4662306a36Sopenharmony_ci#define GWCA_IRQ_RESOURCE_NAME	"gwca0_rxtx%d"
4762306a36Sopenharmony_ci#define GWCA_IRQ_NAME		"rswitch: gwca0_rxtx%d"
4862306a36Sopenharmony_ci#define GWCA_NUM_IRQS		8
4962306a36Sopenharmony_ci#define GWCA_INDEX		0
5062306a36Sopenharmony_ci#define AGENT_INDEX_GWCA	3
5162306a36Sopenharmony_ci#define GWCA_IPV_NUM		0
5262306a36Sopenharmony_ci#define GWRO			RSWITCH_GWCA0_OFFSET
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define GWCA_TS_IRQ_RESOURCE_NAME	"gwca0_rxts0"
5562306a36Sopenharmony_ci#define GWCA_TS_IRQ_NAME		"rswitch: gwca0_rxts0"
5662306a36Sopenharmony_ci#define GWCA_TS_IRQ_BIT			BIT(0)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define FWRO	0
5962306a36Sopenharmony_ci#define TPRO	RSWITCH_TOP_OFFSET
6062306a36Sopenharmony_ci#define CARO	RSWITCH_COMA_OFFSET
6162306a36Sopenharmony_ci#define TARO	0
6262306a36Sopenharmony_ci#define RMRO	0x1000
6362306a36Sopenharmony_cienum rswitch_reg {
6462306a36Sopenharmony_ci	FWGC		= FWRO + 0x0000,
6562306a36Sopenharmony_ci	FWTTC0		= FWRO + 0x0010,
6662306a36Sopenharmony_ci	FWTTC1		= FWRO + 0x0014,
6762306a36Sopenharmony_ci	FWLBMC		= FWRO + 0x0018,
6862306a36Sopenharmony_ci	FWCEPTC		= FWRO + 0x0020,
6962306a36Sopenharmony_ci	FWCEPRC0	= FWRO + 0x0024,
7062306a36Sopenharmony_ci	FWCEPRC1	= FWRO + 0x0028,
7162306a36Sopenharmony_ci	FWCEPRC2	= FWRO + 0x002c,
7262306a36Sopenharmony_ci	FWCLPTC		= FWRO + 0x0030,
7362306a36Sopenharmony_ci	FWCLPRC		= FWRO + 0x0034,
7462306a36Sopenharmony_ci	FWCMPTC		= FWRO + 0x0040,
7562306a36Sopenharmony_ci	FWEMPTC		= FWRO + 0x0044,
7662306a36Sopenharmony_ci	FWSDMPTC	= FWRO + 0x0050,
7762306a36Sopenharmony_ci	FWSDMPVC	= FWRO + 0x0054,
7862306a36Sopenharmony_ci	FWLBWMC0	= FWRO + 0x0080,
7962306a36Sopenharmony_ci	FWPC00		= FWRO + 0x0100,
8062306a36Sopenharmony_ci	FWPC10		= FWRO + 0x0104,
8162306a36Sopenharmony_ci	FWPC20		= FWRO + 0x0108,
8262306a36Sopenharmony_ci	FWCTGC00	= FWRO + 0x0400,
8362306a36Sopenharmony_ci	FWCTGC10	= FWRO + 0x0404,
8462306a36Sopenharmony_ci	FWCTTC00	= FWRO + 0x0408,
8562306a36Sopenharmony_ci	FWCTTC10	= FWRO + 0x040c,
8662306a36Sopenharmony_ci	FWCTTC200	= FWRO + 0x0410,
8762306a36Sopenharmony_ci	FWCTSC00	= FWRO + 0x0420,
8862306a36Sopenharmony_ci	FWCTSC10	= FWRO + 0x0424,
8962306a36Sopenharmony_ci	FWCTSC20	= FWRO + 0x0428,
9062306a36Sopenharmony_ci	FWCTSC30	= FWRO + 0x042c,
9162306a36Sopenharmony_ci	FWCTSC40	= FWRO + 0x0430,
9262306a36Sopenharmony_ci	FWTWBFC0	= FWRO + 0x1000,
9362306a36Sopenharmony_ci	FWTWBFVC0	= FWRO + 0x1004,
9462306a36Sopenharmony_ci	FWTHBFC0	= FWRO + 0x1400,
9562306a36Sopenharmony_ci	FWTHBFV0C0	= FWRO + 0x1404,
9662306a36Sopenharmony_ci	FWTHBFV1C0	= FWRO + 0x1408,
9762306a36Sopenharmony_ci	FWFOBFC0	= FWRO + 0x1800,
9862306a36Sopenharmony_ci	FWFOBFV0C0	= FWRO + 0x1804,
9962306a36Sopenharmony_ci	FWFOBFV1C0	= FWRO + 0x1808,
10062306a36Sopenharmony_ci	FWRFC0		= FWRO + 0x1c00,
10162306a36Sopenharmony_ci	FWRFVC0		= FWRO + 0x1c04,
10262306a36Sopenharmony_ci	FWCFC0		= FWRO + 0x2000,
10362306a36Sopenharmony_ci	FWCFMC00	= FWRO + 0x2004,
10462306a36Sopenharmony_ci	FWIP4SC		= FWRO + 0x4008,
10562306a36Sopenharmony_ci	FWIP6SC		= FWRO + 0x4018,
10662306a36Sopenharmony_ci	FWIP6OC		= FWRO + 0x401c,
10762306a36Sopenharmony_ci	FWL2SC		= FWRO + 0x4020,
10862306a36Sopenharmony_ci	FWSFHEC		= FWRO + 0x4030,
10962306a36Sopenharmony_ci	FWSHCR0		= FWRO + 0x4040,
11062306a36Sopenharmony_ci	FWSHCR1		= FWRO + 0x4044,
11162306a36Sopenharmony_ci	FWSHCR2		= FWRO + 0x4048,
11262306a36Sopenharmony_ci	FWSHCR3		= FWRO + 0x404c,
11362306a36Sopenharmony_ci	FWSHCR4		= FWRO + 0x4050,
11462306a36Sopenharmony_ci	FWSHCR5		= FWRO + 0x4054,
11562306a36Sopenharmony_ci	FWSHCR6		= FWRO + 0x4058,
11662306a36Sopenharmony_ci	FWSHCR7		= FWRO + 0x405c,
11762306a36Sopenharmony_ci	FWSHCR8		= FWRO + 0x4060,
11862306a36Sopenharmony_ci	FWSHCR9		= FWRO + 0x4064,
11962306a36Sopenharmony_ci	FWSHCR10	= FWRO + 0x4068,
12062306a36Sopenharmony_ci	FWSHCR11	= FWRO + 0x406c,
12162306a36Sopenharmony_ci	FWSHCR12	= FWRO + 0x4070,
12262306a36Sopenharmony_ci	FWSHCR13	= FWRO + 0x4074,
12362306a36Sopenharmony_ci	FWSHCRR		= FWRO + 0x4078,
12462306a36Sopenharmony_ci	FWLTHHEC	= FWRO + 0x4090,
12562306a36Sopenharmony_ci	FWLTHHC		= FWRO + 0x4094,
12662306a36Sopenharmony_ci	FWLTHTL0	= FWRO + 0x40a0,
12762306a36Sopenharmony_ci	FWLTHTL1	= FWRO + 0x40a4,
12862306a36Sopenharmony_ci	FWLTHTL2	= FWRO + 0x40a8,
12962306a36Sopenharmony_ci	FWLTHTL3	= FWRO + 0x40ac,
13062306a36Sopenharmony_ci	FWLTHTL4	= FWRO + 0x40b0,
13162306a36Sopenharmony_ci	FWLTHTL5	= FWRO + 0x40b4,
13262306a36Sopenharmony_ci	FWLTHTL6	= FWRO + 0x40b8,
13362306a36Sopenharmony_ci	FWLTHTL7	= FWRO + 0x40bc,
13462306a36Sopenharmony_ci	FWLTHTL80	= FWRO + 0x40c0,
13562306a36Sopenharmony_ci	FWLTHTL9	= FWRO + 0x40d0,
13662306a36Sopenharmony_ci	FWLTHTLR	= FWRO + 0x40d4,
13762306a36Sopenharmony_ci	FWLTHTIM	= FWRO + 0x40e0,
13862306a36Sopenharmony_ci	FWLTHTEM	= FWRO + 0x40e4,
13962306a36Sopenharmony_ci	FWLTHTS0	= FWRO + 0x4100,
14062306a36Sopenharmony_ci	FWLTHTS1	= FWRO + 0x4104,
14162306a36Sopenharmony_ci	FWLTHTS2	= FWRO + 0x4108,
14262306a36Sopenharmony_ci	FWLTHTS3	= FWRO + 0x410c,
14362306a36Sopenharmony_ci	FWLTHTS4	= FWRO + 0x4110,
14462306a36Sopenharmony_ci	FWLTHTSR0	= FWRO + 0x4120,
14562306a36Sopenharmony_ci	FWLTHTSR1	= FWRO + 0x4124,
14662306a36Sopenharmony_ci	FWLTHTSR2	= FWRO + 0x4128,
14762306a36Sopenharmony_ci	FWLTHTSR3	= FWRO + 0x412c,
14862306a36Sopenharmony_ci	FWLTHTSR40	= FWRO + 0x4130,
14962306a36Sopenharmony_ci	FWLTHTSR5	= FWRO + 0x4140,
15062306a36Sopenharmony_ci	FWLTHTR		= FWRO + 0x4150,
15162306a36Sopenharmony_ci	FWLTHTRR0	= FWRO + 0x4154,
15262306a36Sopenharmony_ci	FWLTHTRR1	= FWRO + 0x4158,
15362306a36Sopenharmony_ci	FWLTHTRR2	= FWRO + 0x415c,
15462306a36Sopenharmony_ci	FWLTHTRR3	= FWRO + 0x4160,
15562306a36Sopenharmony_ci	FWLTHTRR4	= FWRO + 0x4164,
15662306a36Sopenharmony_ci	FWLTHTRR5	= FWRO + 0x4168,
15762306a36Sopenharmony_ci	FWLTHTRR6	= FWRO + 0x416c,
15862306a36Sopenharmony_ci	FWLTHTRR7	= FWRO + 0x4170,
15962306a36Sopenharmony_ci	FWLTHTRR8	= FWRO + 0x4174,
16062306a36Sopenharmony_ci	FWLTHTRR9	= FWRO + 0x4180,
16162306a36Sopenharmony_ci	FWLTHTRR10	= FWRO + 0x4190,
16262306a36Sopenharmony_ci	FWIPHEC		= FWRO + 0x4214,
16362306a36Sopenharmony_ci	FWIPHC		= FWRO + 0x4218,
16462306a36Sopenharmony_ci	FWIPTL0		= FWRO + 0x4220,
16562306a36Sopenharmony_ci	FWIPTL1		= FWRO + 0x4224,
16662306a36Sopenharmony_ci	FWIPTL2		= FWRO + 0x4228,
16762306a36Sopenharmony_ci	FWIPTL3		= FWRO + 0x422c,
16862306a36Sopenharmony_ci	FWIPTL4		= FWRO + 0x4230,
16962306a36Sopenharmony_ci	FWIPTL5		= FWRO + 0x4234,
17062306a36Sopenharmony_ci	FWIPTL6		= FWRO + 0x4238,
17162306a36Sopenharmony_ci	FWIPTL7		= FWRO + 0x4240,
17262306a36Sopenharmony_ci	FWIPTL8		= FWRO + 0x4250,
17362306a36Sopenharmony_ci	FWIPTLR		= FWRO + 0x4254,
17462306a36Sopenharmony_ci	FWIPTIM		= FWRO + 0x4260,
17562306a36Sopenharmony_ci	FWIPTEM		= FWRO + 0x4264,
17662306a36Sopenharmony_ci	FWIPTS0		= FWRO + 0x4270,
17762306a36Sopenharmony_ci	FWIPTS1		= FWRO + 0x4274,
17862306a36Sopenharmony_ci	FWIPTS2		= FWRO + 0x4278,
17962306a36Sopenharmony_ci	FWIPTS3		= FWRO + 0x427c,
18062306a36Sopenharmony_ci	FWIPTS4		= FWRO + 0x4280,
18162306a36Sopenharmony_ci	FWIPTSR0	= FWRO + 0x4284,
18262306a36Sopenharmony_ci	FWIPTSR1	= FWRO + 0x4288,
18362306a36Sopenharmony_ci	FWIPTSR2	= FWRO + 0x428c,
18462306a36Sopenharmony_ci	FWIPTSR3	= FWRO + 0x4290,
18562306a36Sopenharmony_ci	FWIPTSR4	= FWRO + 0x42a0,
18662306a36Sopenharmony_ci	FWIPTR		= FWRO + 0x42b0,
18762306a36Sopenharmony_ci	FWIPTRR0	= FWRO + 0x42b4,
18862306a36Sopenharmony_ci	FWIPTRR1	= FWRO + 0x42b8,
18962306a36Sopenharmony_ci	FWIPTRR2	= FWRO + 0x42bc,
19062306a36Sopenharmony_ci	FWIPTRR3	= FWRO + 0x42c0,
19162306a36Sopenharmony_ci	FWIPTRR4	= FWRO + 0x42c4,
19262306a36Sopenharmony_ci	FWIPTRR5	= FWRO + 0x42c8,
19362306a36Sopenharmony_ci	FWIPTRR6	= FWRO + 0x42cc,
19462306a36Sopenharmony_ci	FWIPTRR7	= FWRO + 0x42d0,
19562306a36Sopenharmony_ci	FWIPTRR8	= FWRO + 0x42e0,
19662306a36Sopenharmony_ci	FWIPTRR9	= FWRO + 0x42f0,
19762306a36Sopenharmony_ci	FWIPHLEC	= FWRO + 0x4300,
19862306a36Sopenharmony_ci	FWIPAGUSPC	= FWRO + 0x4500,
19962306a36Sopenharmony_ci	FWIPAGC		= FWRO + 0x4504,
20062306a36Sopenharmony_ci	FWIPAGM0	= FWRO + 0x4510,
20162306a36Sopenharmony_ci	FWIPAGM1	= FWRO + 0x4514,
20262306a36Sopenharmony_ci	FWIPAGM2	= FWRO + 0x4518,
20362306a36Sopenharmony_ci	FWIPAGM3	= FWRO + 0x451c,
20462306a36Sopenharmony_ci	FWIPAGM4	= FWRO + 0x4520,
20562306a36Sopenharmony_ci	FWMACHEC	= FWRO + 0x4620,
20662306a36Sopenharmony_ci	FWMACHC		= FWRO + 0x4624,
20762306a36Sopenharmony_ci	FWMACTL0	= FWRO + 0x4630,
20862306a36Sopenharmony_ci	FWMACTL1	= FWRO + 0x4634,
20962306a36Sopenharmony_ci	FWMACTL2	= FWRO + 0x4638,
21062306a36Sopenharmony_ci	FWMACTL3	= FWRO + 0x463c,
21162306a36Sopenharmony_ci	FWMACTL4	= FWRO + 0x4640,
21262306a36Sopenharmony_ci	FWMACTL5	= FWRO + 0x4650,
21362306a36Sopenharmony_ci	FWMACTLR	= FWRO + 0x4654,
21462306a36Sopenharmony_ci	FWMACTIM	= FWRO + 0x4660,
21562306a36Sopenharmony_ci	FWMACTEM	= FWRO + 0x4664,
21662306a36Sopenharmony_ci	FWMACTS0	= FWRO + 0x4670,
21762306a36Sopenharmony_ci	FWMACTS1	= FWRO + 0x4674,
21862306a36Sopenharmony_ci	FWMACTSR0	= FWRO + 0x4678,
21962306a36Sopenharmony_ci	FWMACTSR1	= FWRO + 0x467c,
22062306a36Sopenharmony_ci	FWMACTSR2	= FWRO + 0x4680,
22162306a36Sopenharmony_ci	FWMACTSR3	= FWRO + 0x4690,
22262306a36Sopenharmony_ci	FWMACTR		= FWRO + 0x46a0,
22362306a36Sopenharmony_ci	FWMACTRR0	= FWRO + 0x46a4,
22462306a36Sopenharmony_ci	FWMACTRR1	= FWRO + 0x46a8,
22562306a36Sopenharmony_ci	FWMACTRR2	= FWRO + 0x46ac,
22662306a36Sopenharmony_ci	FWMACTRR3	= FWRO + 0x46b0,
22762306a36Sopenharmony_ci	FWMACTRR4	= FWRO + 0x46b4,
22862306a36Sopenharmony_ci	FWMACTRR5	= FWRO + 0x46c0,
22962306a36Sopenharmony_ci	FWMACTRR6	= FWRO + 0x46d0,
23062306a36Sopenharmony_ci	FWMACHLEC	= FWRO + 0x4700,
23162306a36Sopenharmony_ci	FWMACAGUSPC	= FWRO + 0x4880,
23262306a36Sopenharmony_ci	FWMACAGC	= FWRO + 0x4884,
23362306a36Sopenharmony_ci	FWMACAGM0	= FWRO + 0x4888,
23462306a36Sopenharmony_ci	FWMACAGM1	= FWRO + 0x488c,
23562306a36Sopenharmony_ci	FWVLANTEC	= FWRO + 0x4900,
23662306a36Sopenharmony_ci	FWVLANTL0	= FWRO + 0x4910,
23762306a36Sopenharmony_ci	FWVLANTL1	= FWRO + 0x4914,
23862306a36Sopenharmony_ci	FWVLANTL2	= FWRO + 0x4918,
23962306a36Sopenharmony_ci	FWVLANTL3	= FWRO + 0x4920,
24062306a36Sopenharmony_ci	FWVLANTL4	= FWRO + 0x4930,
24162306a36Sopenharmony_ci	FWVLANTLR	= FWRO + 0x4934,
24262306a36Sopenharmony_ci	FWVLANTIM	= FWRO + 0x4940,
24362306a36Sopenharmony_ci	FWVLANTEM	= FWRO + 0x4944,
24462306a36Sopenharmony_ci	FWVLANTS	= FWRO + 0x4950,
24562306a36Sopenharmony_ci	FWVLANTSR0	= FWRO + 0x4954,
24662306a36Sopenharmony_ci	FWVLANTSR1	= FWRO + 0x4958,
24762306a36Sopenharmony_ci	FWVLANTSR2	= FWRO + 0x4960,
24862306a36Sopenharmony_ci	FWVLANTSR3	= FWRO + 0x4970,
24962306a36Sopenharmony_ci	FWPBFC0		= FWRO + 0x4a00,
25062306a36Sopenharmony_ci	FWPBFCSDC00	= FWRO + 0x4a04,
25162306a36Sopenharmony_ci	FWL23URL0	= FWRO + 0x4e00,
25262306a36Sopenharmony_ci	FWL23URL1	= FWRO + 0x4e04,
25362306a36Sopenharmony_ci	FWL23URL2	= FWRO + 0x4e08,
25462306a36Sopenharmony_ci	FWL23URL3	= FWRO + 0x4e0c,
25562306a36Sopenharmony_ci	FWL23URLR	= FWRO + 0x4e10,
25662306a36Sopenharmony_ci	FWL23UTIM	= FWRO + 0x4e20,
25762306a36Sopenharmony_ci	FWL23URR	= FWRO + 0x4e30,
25862306a36Sopenharmony_ci	FWL23URRR0	= FWRO + 0x4e34,
25962306a36Sopenharmony_ci	FWL23URRR1	= FWRO + 0x4e38,
26062306a36Sopenharmony_ci	FWL23URRR2	= FWRO + 0x4e3c,
26162306a36Sopenharmony_ci	FWL23URRR3	= FWRO + 0x4e40,
26262306a36Sopenharmony_ci	FWL23URMC0	= FWRO + 0x4f00,
26362306a36Sopenharmony_ci	FWPMFGC0	= FWRO + 0x5000,
26462306a36Sopenharmony_ci	FWPGFC0		= FWRO + 0x5100,
26562306a36Sopenharmony_ci	FWPGFIGSC0	= FWRO + 0x5104,
26662306a36Sopenharmony_ci	FWPGFENC0	= FWRO + 0x5108,
26762306a36Sopenharmony_ci	FWPGFENM0	= FWRO + 0x510c,
26862306a36Sopenharmony_ci	FWPGFCSTC00	= FWRO + 0x5110,
26962306a36Sopenharmony_ci	FWPGFCSTC10	= FWRO + 0x5114,
27062306a36Sopenharmony_ci	FWPGFCSTM00	= FWRO + 0x5118,
27162306a36Sopenharmony_ci	FWPGFCSTM10	= FWRO + 0x511c,
27262306a36Sopenharmony_ci	FWPGFCTC0	= FWRO + 0x5120,
27362306a36Sopenharmony_ci	FWPGFCTM0	= FWRO + 0x5124,
27462306a36Sopenharmony_ci	FWPGFHCC0	= FWRO + 0x5128,
27562306a36Sopenharmony_ci	FWPGFSM0	= FWRO + 0x512c,
27662306a36Sopenharmony_ci	FWPGFGC0	= FWRO + 0x5130,
27762306a36Sopenharmony_ci	FWPGFGL0	= FWRO + 0x5500,
27862306a36Sopenharmony_ci	FWPGFGL1	= FWRO + 0x5504,
27962306a36Sopenharmony_ci	FWPGFGLR	= FWRO + 0x5518,
28062306a36Sopenharmony_ci	FWPGFGR		= FWRO + 0x5510,
28162306a36Sopenharmony_ci	FWPGFGRR0	= FWRO + 0x5514,
28262306a36Sopenharmony_ci	FWPGFGRR1	= FWRO + 0x5518,
28362306a36Sopenharmony_ci	FWPGFRIM	= FWRO + 0x5520,
28462306a36Sopenharmony_ci	FWPMTRFC0	= FWRO + 0x5600,
28562306a36Sopenharmony_ci	FWPMTRCBSC0	= FWRO + 0x5604,
28662306a36Sopenharmony_ci	FWPMTRC0RC0	= FWRO + 0x5608,
28762306a36Sopenharmony_ci	FWPMTREBSC0	= FWRO + 0x560c,
28862306a36Sopenharmony_ci	FWPMTREIRC0	= FWRO + 0x5610,
28962306a36Sopenharmony_ci	FWPMTRFM0	= FWRO + 0x5614,
29062306a36Sopenharmony_ci	FWFTL0		= FWRO + 0x6000,
29162306a36Sopenharmony_ci	FWFTL1		= FWRO + 0x6004,
29262306a36Sopenharmony_ci	FWFTLR		= FWRO + 0x6008,
29362306a36Sopenharmony_ci	FWFTOC		= FWRO + 0x6010,
29462306a36Sopenharmony_ci	FWFTOPC		= FWRO + 0x6014,
29562306a36Sopenharmony_ci	FWFTIM		= FWRO + 0x6020,
29662306a36Sopenharmony_ci	FWFTR		= FWRO + 0x6030,
29762306a36Sopenharmony_ci	FWFTRR0		= FWRO + 0x6034,
29862306a36Sopenharmony_ci	FWFTRR1		= FWRO + 0x6038,
29962306a36Sopenharmony_ci	FWFTRR2		= FWRO + 0x603c,
30062306a36Sopenharmony_ci	FWSEQNGC0	= FWRO + 0x6100,
30162306a36Sopenharmony_ci	FWSEQNGM0	= FWRO + 0x6104,
30262306a36Sopenharmony_ci	FWSEQNRC	= FWRO + 0x6200,
30362306a36Sopenharmony_ci	FWCTFDCN0	= FWRO + 0x6300,
30462306a36Sopenharmony_ci	FWLTHFDCN0	= FWRO + 0x6304,
30562306a36Sopenharmony_ci	FWIPFDCN0	= FWRO + 0x6308,
30662306a36Sopenharmony_ci	FWLTWFDCN0	= FWRO + 0x630c,
30762306a36Sopenharmony_ci	FWPBFDCN0	= FWRO + 0x6310,
30862306a36Sopenharmony_ci	FWMHLCN0	= FWRO + 0x6314,
30962306a36Sopenharmony_ci	FWIHLCN0	= FWRO + 0x6318,
31062306a36Sopenharmony_ci	FWICRDCN0	= FWRO + 0x6500,
31162306a36Sopenharmony_ci	FWWMRDCN0	= FWRO + 0x6504,
31262306a36Sopenharmony_ci	FWCTRDCN0	= FWRO + 0x6508,
31362306a36Sopenharmony_ci	FWLTHRDCN0	= FWRO + 0x650c,
31462306a36Sopenharmony_ci	FWIPRDCN0	= FWRO + 0x6510,
31562306a36Sopenharmony_ci	FWLTWRDCN0	= FWRO + 0x6514,
31662306a36Sopenharmony_ci	FWPBRDCN0	= FWRO + 0x6518,
31762306a36Sopenharmony_ci	FWPMFDCN0	= FWRO + 0x6700,
31862306a36Sopenharmony_ci	FWPGFDCN0	= FWRO + 0x6780,
31962306a36Sopenharmony_ci	FWPMGDCN0	= FWRO + 0x6800,
32062306a36Sopenharmony_ci	FWPMYDCN0	= FWRO + 0x6804,
32162306a36Sopenharmony_ci	FWPMRDCN0	= FWRO + 0x6808,
32262306a36Sopenharmony_ci	FWFRPPCN0	= FWRO + 0x6a00,
32362306a36Sopenharmony_ci	FWFRDPCN0	= FWRO + 0x6a04,
32462306a36Sopenharmony_ci	FWEIS00		= FWRO + 0x7900,
32562306a36Sopenharmony_ci	FWEIE00		= FWRO + 0x7904,
32662306a36Sopenharmony_ci	FWEID00		= FWRO + 0x7908,
32762306a36Sopenharmony_ci	FWEIS1		= FWRO + 0x7a00,
32862306a36Sopenharmony_ci	FWEIE1		= FWRO + 0x7a04,
32962306a36Sopenharmony_ci	FWEID1		= FWRO + 0x7a08,
33062306a36Sopenharmony_ci	FWEIS2		= FWRO + 0x7a10,
33162306a36Sopenharmony_ci	FWEIE2		= FWRO + 0x7a14,
33262306a36Sopenharmony_ci	FWEID2		= FWRO + 0x7a18,
33362306a36Sopenharmony_ci	FWEIS3		= FWRO + 0x7a20,
33462306a36Sopenharmony_ci	FWEIE3		= FWRO + 0x7a24,
33562306a36Sopenharmony_ci	FWEID3		= FWRO + 0x7a28,
33662306a36Sopenharmony_ci	FWEIS4		= FWRO + 0x7a30,
33762306a36Sopenharmony_ci	FWEIE4		= FWRO + 0x7a34,
33862306a36Sopenharmony_ci	FWEID4		= FWRO + 0x7a38,
33962306a36Sopenharmony_ci	FWEIS5		= FWRO + 0x7a40,
34062306a36Sopenharmony_ci	FWEIE5		= FWRO + 0x7a44,
34162306a36Sopenharmony_ci	FWEID5		= FWRO + 0x7a48,
34262306a36Sopenharmony_ci	FWEIS60		= FWRO + 0x7a50,
34362306a36Sopenharmony_ci	FWEIE60		= FWRO + 0x7a54,
34462306a36Sopenharmony_ci	FWEID60		= FWRO + 0x7a58,
34562306a36Sopenharmony_ci	FWEIS61		= FWRO + 0x7a60,
34662306a36Sopenharmony_ci	FWEIE61		= FWRO + 0x7a64,
34762306a36Sopenharmony_ci	FWEID61		= FWRO + 0x7a68,
34862306a36Sopenharmony_ci	FWEIS62		= FWRO + 0x7a70,
34962306a36Sopenharmony_ci	FWEIE62		= FWRO + 0x7a74,
35062306a36Sopenharmony_ci	FWEID62		= FWRO + 0x7a78,
35162306a36Sopenharmony_ci	FWEIS63		= FWRO + 0x7a80,
35262306a36Sopenharmony_ci	FWEIE63		= FWRO + 0x7a84,
35362306a36Sopenharmony_ci	FWEID63		= FWRO + 0x7a88,
35462306a36Sopenharmony_ci	FWEIS70		= FWRO + 0x7a90,
35562306a36Sopenharmony_ci	FWEIE70		= FWRO + 0x7A94,
35662306a36Sopenharmony_ci	FWEID70		= FWRO + 0x7a98,
35762306a36Sopenharmony_ci	FWEIS71		= FWRO + 0x7aa0,
35862306a36Sopenharmony_ci	FWEIE71		= FWRO + 0x7aa4,
35962306a36Sopenharmony_ci	FWEID71		= FWRO + 0x7aa8,
36062306a36Sopenharmony_ci	FWEIS72		= FWRO + 0x7ab0,
36162306a36Sopenharmony_ci	FWEIE72		= FWRO + 0x7ab4,
36262306a36Sopenharmony_ci	FWEID72		= FWRO + 0x7ab8,
36362306a36Sopenharmony_ci	FWEIS73		= FWRO + 0x7ac0,
36462306a36Sopenharmony_ci	FWEIE73		= FWRO + 0x7ac4,
36562306a36Sopenharmony_ci	FWEID73		= FWRO + 0x7ac8,
36662306a36Sopenharmony_ci	FWEIS80		= FWRO + 0x7ad0,
36762306a36Sopenharmony_ci	FWEIE80		= FWRO + 0x7ad4,
36862306a36Sopenharmony_ci	FWEID80		= FWRO + 0x7ad8,
36962306a36Sopenharmony_ci	FWEIS81		= FWRO + 0x7ae0,
37062306a36Sopenharmony_ci	FWEIE81		= FWRO + 0x7ae4,
37162306a36Sopenharmony_ci	FWEID81		= FWRO + 0x7ae8,
37262306a36Sopenharmony_ci	FWEIS82		= FWRO + 0x7af0,
37362306a36Sopenharmony_ci	FWEIE82		= FWRO + 0x7af4,
37462306a36Sopenharmony_ci	FWEID82		= FWRO + 0x7af8,
37562306a36Sopenharmony_ci	FWEIS83		= FWRO + 0x7b00,
37662306a36Sopenharmony_ci	FWEIE83		= FWRO + 0x7b04,
37762306a36Sopenharmony_ci	FWEID83		= FWRO + 0x7b08,
37862306a36Sopenharmony_ci	FWMIS0		= FWRO + 0x7c00,
37962306a36Sopenharmony_ci	FWMIE0		= FWRO + 0x7c04,
38062306a36Sopenharmony_ci	FWMID0		= FWRO + 0x7c08,
38162306a36Sopenharmony_ci	FWSCR0		= FWRO + 0x7d00,
38262306a36Sopenharmony_ci	FWSCR1		= FWRO + 0x7d04,
38362306a36Sopenharmony_ci	FWSCR2		= FWRO + 0x7d08,
38462306a36Sopenharmony_ci	FWSCR3		= FWRO + 0x7d0c,
38562306a36Sopenharmony_ci	FWSCR4		= FWRO + 0x7d10,
38662306a36Sopenharmony_ci	FWSCR5		= FWRO + 0x7d14,
38762306a36Sopenharmony_ci	FWSCR6		= FWRO + 0x7d18,
38862306a36Sopenharmony_ci	FWSCR7		= FWRO + 0x7d1c,
38962306a36Sopenharmony_ci	FWSCR8		= FWRO + 0x7d20,
39062306a36Sopenharmony_ci	FWSCR9		= FWRO + 0x7d24,
39162306a36Sopenharmony_ci	FWSCR10		= FWRO + 0x7d28,
39262306a36Sopenharmony_ci	FWSCR11		= FWRO + 0x7d2c,
39362306a36Sopenharmony_ci	FWSCR12		= FWRO + 0x7d30,
39462306a36Sopenharmony_ci	FWSCR13		= FWRO + 0x7d34,
39562306a36Sopenharmony_ci	FWSCR14		= FWRO + 0x7d38,
39662306a36Sopenharmony_ci	FWSCR15		= FWRO + 0x7d3c,
39762306a36Sopenharmony_ci	FWSCR16		= FWRO + 0x7d40,
39862306a36Sopenharmony_ci	FWSCR17		= FWRO + 0x7d44,
39962306a36Sopenharmony_ci	FWSCR18		= FWRO + 0x7d48,
40062306a36Sopenharmony_ci	FWSCR19		= FWRO + 0x7d4c,
40162306a36Sopenharmony_ci	FWSCR20		= FWRO + 0x7d50,
40262306a36Sopenharmony_ci	FWSCR21		= FWRO + 0x7d54,
40362306a36Sopenharmony_ci	FWSCR22		= FWRO + 0x7d58,
40462306a36Sopenharmony_ci	FWSCR23		= FWRO + 0x7d5c,
40562306a36Sopenharmony_ci	FWSCR24		= FWRO + 0x7d60,
40662306a36Sopenharmony_ci	FWSCR25		= FWRO + 0x7d64,
40762306a36Sopenharmony_ci	FWSCR26		= FWRO + 0x7d68,
40862306a36Sopenharmony_ci	FWSCR27		= FWRO + 0x7d6c,
40962306a36Sopenharmony_ci	FWSCR28		= FWRO + 0x7d70,
41062306a36Sopenharmony_ci	FWSCR29		= FWRO + 0x7d74,
41162306a36Sopenharmony_ci	FWSCR30		= FWRO + 0x7d78,
41262306a36Sopenharmony_ci	FWSCR31		= FWRO + 0x7d7c,
41362306a36Sopenharmony_ci	FWSCR32		= FWRO + 0x7d80,
41462306a36Sopenharmony_ci	FWSCR33		= FWRO + 0x7d84,
41562306a36Sopenharmony_ci	FWSCR34		= FWRO + 0x7d88,
41662306a36Sopenharmony_ci	FWSCR35		= FWRO + 0x7d8c,
41762306a36Sopenharmony_ci	FWSCR36		= FWRO + 0x7d90,
41862306a36Sopenharmony_ci	FWSCR37		= FWRO + 0x7d94,
41962306a36Sopenharmony_ci	FWSCR38		= FWRO + 0x7d98,
42062306a36Sopenharmony_ci	FWSCR39		= FWRO + 0x7d9c,
42162306a36Sopenharmony_ci	FWSCR40		= FWRO + 0x7da0,
42262306a36Sopenharmony_ci	FWSCR41		= FWRO + 0x7da4,
42362306a36Sopenharmony_ci	FWSCR42		= FWRO + 0x7da8,
42462306a36Sopenharmony_ci	FWSCR43		= FWRO + 0x7dac,
42562306a36Sopenharmony_ci	FWSCR44		= FWRO + 0x7db0,
42662306a36Sopenharmony_ci	FWSCR45		= FWRO + 0x7db4,
42762306a36Sopenharmony_ci	FWSCR46		= FWRO + 0x7db8,
42862306a36Sopenharmony_ci
42962306a36Sopenharmony_ci	TPEMIMC0	= TPRO + 0x0000,
43062306a36Sopenharmony_ci	TPEMIMC1	= TPRO + 0x0004,
43162306a36Sopenharmony_ci	TPEMIMC2	= TPRO + 0x0008,
43262306a36Sopenharmony_ci	TPEMIMC3	= TPRO + 0x000c,
43362306a36Sopenharmony_ci	TPEMIMC4	= TPRO + 0x0010,
43462306a36Sopenharmony_ci	TPEMIMC5	= TPRO + 0x0014,
43562306a36Sopenharmony_ci	TPEMIMC60	= TPRO + 0x0080,
43662306a36Sopenharmony_ci	TPEMIMC70	= TPRO + 0x0100,
43762306a36Sopenharmony_ci	TSIM		= TPRO + 0x0700,
43862306a36Sopenharmony_ci	TFIM		= TPRO + 0x0704,
43962306a36Sopenharmony_ci	TCIM		= TPRO + 0x0708,
44062306a36Sopenharmony_ci	TGIM0		= TPRO + 0x0710,
44162306a36Sopenharmony_ci	TGIM1		= TPRO + 0x0714,
44262306a36Sopenharmony_ci	TEIM0		= TPRO + 0x0720,
44362306a36Sopenharmony_ci	TEIM1		= TPRO + 0x0724,
44462306a36Sopenharmony_ci	TEIM2		= TPRO + 0x0728,
44562306a36Sopenharmony_ci
44662306a36Sopenharmony_ci	RIPV		= CARO + 0x0000,
44762306a36Sopenharmony_ci	RRC		= CARO + 0x0004,
44862306a36Sopenharmony_ci	RCEC		= CARO + 0x0008,
44962306a36Sopenharmony_ci	RCDC		= CARO + 0x000c,
45062306a36Sopenharmony_ci	RSSIS		= CARO + 0x0010,
45162306a36Sopenharmony_ci	RSSIE		= CARO + 0x0014,
45262306a36Sopenharmony_ci	RSSID		= CARO + 0x0018,
45362306a36Sopenharmony_ci	CABPIBWMC	= CARO + 0x0020,
45462306a36Sopenharmony_ci	CABPWMLC	= CARO + 0x0040,
45562306a36Sopenharmony_ci	CABPPFLC0	= CARO + 0x0050,
45662306a36Sopenharmony_ci	CABPPWMLC0	= CARO + 0x0060,
45762306a36Sopenharmony_ci	CABPPPFLC00	= CARO + 0x00a0,
45862306a36Sopenharmony_ci	CABPULC		= CARO + 0x0100,
45962306a36Sopenharmony_ci	CABPIRM		= CARO + 0x0140,
46062306a36Sopenharmony_ci	CABPPCM		= CARO + 0x0144,
46162306a36Sopenharmony_ci	CABPLCM		= CARO + 0x0148,
46262306a36Sopenharmony_ci	CABPCPM		= CARO + 0x0180,
46362306a36Sopenharmony_ci	CABPMCPM	= CARO + 0x0200,
46462306a36Sopenharmony_ci	CARDNM		= CARO + 0x0280,
46562306a36Sopenharmony_ci	CARDMNM		= CARO + 0x0284,
46662306a36Sopenharmony_ci	CARDCN		= CARO + 0x0290,
46762306a36Sopenharmony_ci	CAEIS0		= CARO + 0x0300,
46862306a36Sopenharmony_ci	CAEIE0		= CARO + 0x0304,
46962306a36Sopenharmony_ci	CAEID0		= CARO + 0x0308,
47062306a36Sopenharmony_ci	CAEIS1		= CARO + 0x0310,
47162306a36Sopenharmony_ci	CAEIE1		= CARO + 0x0314,
47262306a36Sopenharmony_ci	CAEID1		= CARO + 0x0318,
47362306a36Sopenharmony_ci	CAMIS0		= CARO + 0x0340,
47462306a36Sopenharmony_ci	CAMIE0		= CARO + 0x0344,
47562306a36Sopenharmony_ci	CAMID0		= CARO + 0x0348,
47662306a36Sopenharmony_ci	CAMIS1		= CARO + 0x0350,
47762306a36Sopenharmony_ci	CAMIE1		= CARO + 0x0354,
47862306a36Sopenharmony_ci	CAMID1		= CARO + 0x0358,
47962306a36Sopenharmony_ci	CASCR		= CARO + 0x0380,
48062306a36Sopenharmony_ci
48162306a36Sopenharmony_ci	EAMC		= TARO + 0x0000,
48262306a36Sopenharmony_ci	EAMS		= TARO + 0x0004,
48362306a36Sopenharmony_ci	EAIRC		= TARO + 0x0010,
48462306a36Sopenharmony_ci	EATDQSC		= TARO + 0x0014,
48562306a36Sopenharmony_ci	EATDQC		= TARO + 0x0018,
48662306a36Sopenharmony_ci	EATDQAC		= TARO + 0x001c,
48762306a36Sopenharmony_ci	EATPEC		= TARO + 0x0020,
48862306a36Sopenharmony_ci	EATMFSC0	= TARO + 0x0040,
48962306a36Sopenharmony_ci	EATDQDC0	= TARO + 0x0060,
49062306a36Sopenharmony_ci	EATDQM0		= TARO + 0x0080,
49162306a36Sopenharmony_ci	EATDQMLM0	= TARO + 0x00a0,
49262306a36Sopenharmony_ci	EACTQC		= TARO + 0x0100,
49362306a36Sopenharmony_ci	EACTDQDC	= TARO + 0x0104,
49462306a36Sopenharmony_ci	EACTDQM		= TARO + 0x0108,
49562306a36Sopenharmony_ci	EACTDQMLM	= TARO + 0x010c,
49662306a36Sopenharmony_ci	EAVCC		= TARO + 0x0130,
49762306a36Sopenharmony_ci	EAVTC		= TARO + 0x0134,
49862306a36Sopenharmony_ci	EATTFC		= TARO + 0x0138,
49962306a36Sopenharmony_ci	EACAEC		= TARO + 0x0200,
50062306a36Sopenharmony_ci	EACC		= TARO + 0x0204,
50162306a36Sopenharmony_ci	EACAIVC0	= TARO + 0x0220,
50262306a36Sopenharmony_ci	EACAULC0	= TARO + 0x0240,
50362306a36Sopenharmony_ci	EACOEM		= TARO + 0x0260,
50462306a36Sopenharmony_ci	EACOIVM0	= TARO + 0x0280,
50562306a36Sopenharmony_ci	EACOULM0	= TARO + 0x02a0,
50662306a36Sopenharmony_ci	EACGSM		= TARO + 0x02c0,
50762306a36Sopenharmony_ci	EATASC		= TARO + 0x0300,
50862306a36Sopenharmony_ci	EATASENC0	= TARO + 0x0320,
50962306a36Sopenharmony_ci	EATASCTENC	= TARO + 0x0340,
51062306a36Sopenharmony_ci	EATASENM0	= TARO + 0x0360,
51162306a36Sopenharmony_ci	EATASCTENM	= TARO + 0x0380,
51262306a36Sopenharmony_ci	EATASCSTC0	= TARO + 0x03a0,
51362306a36Sopenharmony_ci	EATASCSTC1	= TARO + 0x03a4,
51462306a36Sopenharmony_ci	EATASCSTM0	= TARO + 0x03a8,
51562306a36Sopenharmony_ci	EATASCSTM1	= TARO + 0x03ac,
51662306a36Sopenharmony_ci	EATASCTC	= TARO + 0x03b0,
51762306a36Sopenharmony_ci	EATASCTM	= TARO + 0x03b4,
51862306a36Sopenharmony_ci	EATASGL0	= TARO + 0x03c0,
51962306a36Sopenharmony_ci	EATASGL1	= TARO + 0x03c4,
52062306a36Sopenharmony_ci	EATASGLR	= TARO + 0x03c8,
52162306a36Sopenharmony_ci	EATASGR		= TARO + 0x03d0,
52262306a36Sopenharmony_ci	EATASGRR	= TARO + 0x03d4,
52362306a36Sopenharmony_ci	EATASHCC	= TARO + 0x03e0,
52462306a36Sopenharmony_ci	EATASRIRM	= TARO + 0x03e4,
52562306a36Sopenharmony_ci	EATASSM		= TARO + 0x03e8,
52662306a36Sopenharmony_ci	EAUSMFSECN	= TARO + 0x0400,
52762306a36Sopenharmony_ci	EATFECN		= TARO + 0x0404,
52862306a36Sopenharmony_ci	EAFSECN		= TARO + 0x0408,
52962306a36Sopenharmony_ci	EADQOECN	= TARO + 0x040c,
53062306a36Sopenharmony_ci	EADQSECN	= TARO + 0x0410,
53162306a36Sopenharmony_ci	EACKSECN	= TARO + 0x0414,
53262306a36Sopenharmony_ci	EAEIS0		= TARO + 0x0500,
53362306a36Sopenharmony_ci	EAEIE0		= TARO + 0x0504,
53462306a36Sopenharmony_ci	EAEID0		= TARO + 0x0508,
53562306a36Sopenharmony_ci	EAEIS1		= TARO + 0x0510,
53662306a36Sopenharmony_ci	EAEIE1		= TARO + 0x0514,
53762306a36Sopenharmony_ci	EAEID1		= TARO + 0x0518,
53862306a36Sopenharmony_ci	EAEIS2		= TARO + 0x0520,
53962306a36Sopenharmony_ci	EAEIE2		= TARO + 0x0524,
54062306a36Sopenharmony_ci	EAEID2		= TARO + 0x0528,
54162306a36Sopenharmony_ci	EASCR		= TARO + 0x0580,
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci	MPSM		= RMRO + 0x0000,
54462306a36Sopenharmony_ci	MPIC		= RMRO + 0x0004,
54562306a36Sopenharmony_ci	MPIM		= RMRO + 0x0008,
54662306a36Sopenharmony_ci	MIOC		= RMRO + 0x0010,
54762306a36Sopenharmony_ci	MIOM		= RMRO + 0x0014,
54862306a36Sopenharmony_ci	MXMS		= RMRO + 0x0018,
54962306a36Sopenharmony_ci	MTFFC		= RMRO + 0x0020,
55062306a36Sopenharmony_ci	MTPFC		= RMRO + 0x0024,
55162306a36Sopenharmony_ci	MTPFC2		= RMRO + 0x0028,
55262306a36Sopenharmony_ci	MTPFC30		= RMRO + 0x0030,
55362306a36Sopenharmony_ci	MTATC0		= RMRO + 0x0050,
55462306a36Sopenharmony_ci	MTIM		= RMRO + 0x0060,
55562306a36Sopenharmony_ci	MRGC		= RMRO + 0x0080,
55662306a36Sopenharmony_ci	MRMAC0		= RMRO + 0x0084,
55762306a36Sopenharmony_ci	MRMAC1		= RMRO + 0x0088,
55862306a36Sopenharmony_ci	MRAFC		= RMRO + 0x008c,
55962306a36Sopenharmony_ci	MRSCE		= RMRO + 0x0090,
56062306a36Sopenharmony_ci	MRSCP		= RMRO + 0x0094,
56162306a36Sopenharmony_ci	MRSCC		= RMRO + 0x0098,
56262306a36Sopenharmony_ci	MRFSCE		= RMRO + 0x009c,
56362306a36Sopenharmony_ci	MRFSCP		= RMRO + 0x00a0,
56462306a36Sopenharmony_ci	MTRC		= RMRO + 0x00a4,
56562306a36Sopenharmony_ci	MRIM		= RMRO + 0x00a8,
56662306a36Sopenharmony_ci	MRPFM		= RMRO + 0x00ac,
56762306a36Sopenharmony_ci	MPFC0		= RMRO + 0x0100,
56862306a36Sopenharmony_ci	MLVC		= RMRO + 0x0180,
56962306a36Sopenharmony_ci	MEEEC		= RMRO + 0x0184,
57062306a36Sopenharmony_ci	MLBC		= RMRO + 0x0188,
57162306a36Sopenharmony_ci	MXGMIIC		= RMRO + 0x0190,
57262306a36Sopenharmony_ci	MPCH		= RMRO + 0x0194,
57362306a36Sopenharmony_ci	MANC		= RMRO + 0x0198,
57462306a36Sopenharmony_ci	MANM		= RMRO + 0x019c,
57562306a36Sopenharmony_ci	MPLCA1		= RMRO + 0x01a0,
57662306a36Sopenharmony_ci	MPLCA2		= RMRO + 0x01a4,
57762306a36Sopenharmony_ci	MPLCA3		= RMRO + 0x01a8,
57862306a36Sopenharmony_ci	MPLCA4		= RMRO + 0x01ac,
57962306a36Sopenharmony_ci	MPLCAM		= RMRO + 0x01b0,
58062306a36Sopenharmony_ci	MHDC1		= RMRO + 0x01c0,
58162306a36Sopenharmony_ci	MHDC2		= RMRO + 0x01c4,
58262306a36Sopenharmony_ci	MEIS		= RMRO + 0x0200,
58362306a36Sopenharmony_ci	MEIE		= RMRO + 0x0204,
58462306a36Sopenharmony_ci	MEID		= RMRO + 0x0208,
58562306a36Sopenharmony_ci	MMIS0		= RMRO + 0x0210,
58662306a36Sopenharmony_ci	MMIE0		= RMRO + 0x0214,
58762306a36Sopenharmony_ci	MMID0		= RMRO + 0x0218,
58862306a36Sopenharmony_ci	MMIS1		= RMRO + 0x0220,
58962306a36Sopenharmony_ci	MMIE1		= RMRO + 0x0224,
59062306a36Sopenharmony_ci	MMID1		= RMRO + 0x0228,
59162306a36Sopenharmony_ci	MMIS2		= RMRO + 0x0230,
59262306a36Sopenharmony_ci	MMIE2		= RMRO + 0x0234,
59362306a36Sopenharmony_ci	MMID2		= RMRO + 0x0238,
59462306a36Sopenharmony_ci	MMPFTCT		= RMRO + 0x0300,
59562306a36Sopenharmony_ci	MAPFTCT		= RMRO + 0x0304,
59662306a36Sopenharmony_ci	MPFRCT		= RMRO + 0x0308,
59762306a36Sopenharmony_ci	MFCICT		= RMRO + 0x030c,
59862306a36Sopenharmony_ci	MEEECT		= RMRO + 0x0310,
59962306a36Sopenharmony_ci	MMPCFTCT0	= RMRO + 0x0320,
60062306a36Sopenharmony_ci	MAPCFTCT0	= RMRO + 0x0330,
60162306a36Sopenharmony_ci	MPCFRCT0	= RMRO + 0x0340,
60262306a36Sopenharmony_ci	MHDCC		= RMRO + 0x0350,
60362306a36Sopenharmony_ci	MROVFC		= RMRO + 0x0354,
60462306a36Sopenharmony_ci	MRHCRCEC	= RMRO + 0x0358,
60562306a36Sopenharmony_ci	MRXBCE		= RMRO + 0x0400,
60662306a36Sopenharmony_ci	MRXBCP		= RMRO + 0x0404,
60762306a36Sopenharmony_ci	MRGFCE		= RMRO + 0x0408,
60862306a36Sopenharmony_ci	MRGFCP		= RMRO + 0x040c,
60962306a36Sopenharmony_ci	MRBFC		= RMRO + 0x0410,
61062306a36Sopenharmony_ci	MRMFC		= RMRO + 0x0414,
61162306a36Sopenharmony_ci	MRUFC		= RMRO + 0x0418,
61262306a36Sopenharmony_ci	MRPEFC		= RMRO + 0x041c,
61362306a36Sopenharmony_ci	MRNEFC		= RMRO + 0x0420,
61462306a36Sopenharmony_ci	MRFMEFC		= RMRO + 0x0424,
61562306a36Sopenharmony_ci	MRFFMEFC	= RMRO + 0x0428,
61662306a36Sopenharmony_ci	MRCFCEFC	= RMRO + 0x042c,
61762306a36Sopenharmony_ci	MRFCEFC		= RMRO + 0x0430,
61862306a36Sopenharmony_ci	MRRCFEFC	= RMRO + 0x0434,
61962306a36Sopenharmony_ci	MRUEFC		= RMRO + 0x043c,
62062306a36Sopenharmony_ci	MROEFC		= RMRO + 0x0440,
62162306a36Sopenharmony_ci	MRBOEC		= RMRO + 0x0444,
62262306a36Sopenharmony_ci	MTXBCE		= RMRO + 0x0500,
62362306a36Sopenharmony_ci	MTXBCP		= RMRO + 0x0504,
62462306a36Sopenharmony_ci	MTGFCE		= RMRO + 0x0508,
62562306a36Sopenharmony_ci	MTGFCP		= RMRO + 0x050c,
62662306a36Sopenharmony_ci	MTBFC		= RMRO + 0x0510,
62762306a36Sopenharmony_ci	MTMFC		= RMRO + 0x0514,
62862306a36Sopenharmony_ci	MTUFC		= RMRO + 0x0518,
62962306a36Sopenharmony_ci	MTEFC		= RMRO + 0x051c,
63062306a36Sopenharmony_ci
63162306a36Sopenharmony_ci	GWMC		= GWRO + 0x0000,
63262306a36Sopenharmony_ci	GWMS		= GWRO + 0x0004,
63362306a36Sopenharmony_ci	GWIRC		= GWRO + 0x0010,
63462306a36Sopenharmony_ci	GWRDQSC		= GWRO + 0x0014,
63562306a36Sopenharmony_ci	GWRDQC		= GWRO + 0x0018,
63662306a36Sopenharmony_ci	GWRDQAC		= GWRO + 0x001c,
63762306a36Sopenharmony_ci	GWRGC		= GWRO + 0x0020,
63862306a36Sopenharmony_ci	GWRMFSC0	= GWRO + 0x0040,
63962306a36Sopenharmony_ci	GWRDQDC0	= GWRO + 0x0060,
64062306a36Sopenharmony_ci	GWRDQM0		= GWRO + 0x0080,
64162306a36Sopenharmony_ci	GWRDQMLM0	= GWRO + 0x00a0,
64262306a36Sopenharmony_ci	GWMTIRM		= GWRO + 0x0100,
64362306a36Sopenharmony_ci	GWMSTLS		= GWRO + 0x0104,
64462306a36Sopenharmony_ci	GWMSTLR		= GWRO + 0x0108,
64562306a36Sopenharmony_ci	GWMSTSS		= GWRO + 0x010c,
64662306a36Sopenharmony_ci	GWMSTSR		= GWRO + 0x0110,
64762306a36Sopenharmony_ci	GWMAC0		= GWRO + 0x0120,
64862306a36Sopenharmony_ci	GWMAC1		= GWRO + 0x0124,
64962306a36Sopenharmony_ci	GWVCC		= GWRO + 0x0130,
65062306a36Sopenharmony_ci	GWVTC		= GWRO + 0x0134,
65162306a36Sopenharmony_ci	GWTTFC		= GWRO + 0x0138,
65262306a36Sopenharmony_ci	GWTDCAC00	= GWRO + 0x0140,
65362306a36Sopenharmony_ci	GWTDCAC10	= GWRO + 0x0144,
65462306a36Sopenharmony_ci	GWTSDCC0	= GWRO + 0x0160,
65562306a36Sopenharmony_ci	GWTNM		= GWRO + 0x0180,
65662306a36Sopenharmony_ci	GWTMNM		= GWRO + 0x0184,
65762306a36Sopenharmony_ci	GWAC		= GWRO + 0x0190,
65862306a36Sopenharmony_ci	GWDCBAC0	= GWRO + 0x0194,
65962306a36Sopenharmony_ci	GWDCBAC1	= GWRO + 0x0198,
66062306a36Sopenharmony_ci	GWIICBSC	= GWRO + 0x019c,
66162306a36Sopenharmony_ci	GWMDNC		= GWRO + 0x01a0,
66262306a36Sopenharmony_ci	GWTRC0		= GWRO + 0x0200,
66362306a36Sopenharmony_ci	GWTPC0		= GWRO + 0x0300,
66462306a36Sopenharmony_ci	GWARIRM		= GWRO + 0x0380,
66562306a36Sopenharmony_ci	GWDCC0		= GWRO + 0x0400,
66662306a36Sopenharmony_ci	GWAARSS		= GWRO + 0x0800,
66762306a36Sopenharmony_ci	GWAARSR0	= GWRO + 0x0804,
66862306a36Sopenharmony_ci	GWAARSR1	= GWRO + 0x0808,
66962306a36Sopenharmony_ci	GWIDAUAS0	= GWRO + 0x0840,
67062306a36Sopenharmony_ci	GWIDASM0	= GWRO + 0x0880,
67162306a36Sopenharmony_ci	GWIDASAM00	= GWRO + 0x0900,
67262306a36Sopenharmony_ci	GWIDASAM10	= GWRO + 0x0904,
67362306a36Sopenharmony_ci	GWIDACAM00	= GWRO + 0x0980,
67462306a36Sopenharmony_ci	GWIDACAM10	= GWRO + 0x0984,
67562306a36Sopenharmony_ci	GWGRLC		= GWRO + 0x0a00,
67662306a36Sopenharmony_ci	GWGRLULC	= GWRO + 0x0a04,
67762306a36Sopenharmony_ci	GWRLIVC0	= GWRO + 0x0a80,
67862306a36Sopenharmony_ci	GWRLULC0	= GWRO + 0x0a84,
67962306a36Sopenharmony_ci	GWIDPC		= GWRO + 0x0b00,
68062306a36Sopenharmony_ci	GWIDC0		= GWRO + 0x0c00,
68162306a36Sopenharmony_ci	GWDIS0		= GWRO + 0x1100,
68262306a36Sopenharmony_ci	GWDIE0		= GWRO + 0x1104,
68362306a36Sopenharmony_ci	GWDID0		= GWRO + 0x1108,
68462306a36Sopenharmony_ci	GWTSDIS		= GWRO + 0x1180,
68562306a36Sopenharmony_ci	GWTSDIE		= GWRO + 0x1184,
68662306a36Sopenharmony_ci	GWTSDID		= GWRO + 0x1188,
68762306a36Sopenharmony_ci	GWEIS0		= GWRO + 0x1190,
68862306a36Sopenharmony_ci	GWEIE0		= GWRO + 0x1194,
68962306a36Sopenharmony_ci	GWEID0		= GWRO + 0x1198,
69062306a36Sopenharmony_ci	GWEIS1		= GWRO + 0x11a0,
69162306a36Sopenharmony_ci	GWEIE1		= GWRO + 0x11a4,
69262306a36Sopenharmony_ci	GWEID1		= GWRO + 0x11a8,
69362306a36Sopenharmony_ci	GWEIS20		= GWRO + 0x1200,
69462306a36Sopenharmony_ci	GWEIE20		= GWRO + 0x1204,
69562306a36Sopenharmony_ci	GWEID20		= GWRO + 0x1208,
69662306a36Sopenharmony_ci	GWEIS3		= GWRO + 0x1280,
69762306a36Sopenharmony_ci	GWEIE3		= GWRO + 0x1284,
69862306a36Sopenharmony_ci	GWEID3		= GWRO + 0x1288,
69962306a36Sopenharmony_ci	GWEIS4		= GWRO + 0x1290,
70062306a36Sopenharmony_ci	GWEIE4		= GWRO + 0x1294,
70162306a36Sopenharmony_ci	GWEID4		= GWRO + 0x1298,
70262306a36Sopenharmony_ci	GWEIS5		= GWRO + 0x12a0,
70362306a36Sopenharmony_ci	GWEIE5		= GWRO + 0x12a4,
70462306a36Sopenharmony_ci	GWEID5		= GWRO + 0x12a8,
70562306a36Sopenharmony_ci	GWSCR0		= GWRO + 0x1800,
70662306a36Sopenharmony_ci	GWSCR1		= GWRO + 0x1900,
70762306a36Sopenharmony_ci};
70862306a36Sopenharmony_ci
70962306a36Sopenharmony_ci/* ETHA/RMAC */
71062306a36Sopenharmony_cienum rswitch_etha_mode {
71162306a36Sopenharmony_ci	EAMC_OPC_RESET,
71262306a36Sopenharmony_ci	EAMC_OPC_DISABLE,
71362306a36Sopenharmony_ci	EAMC_OPC_CONFIG,
71462306a36Sopenharmony_ci	EAMC_OPC_OPERATION,
71562306a36Sopenharmony_ci};
71662306a36Sopenharmony_ci
71762306a36Sopenharmony_ci#define EAMS_OPS_MASK		EAMC_OPC_OPERATION
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ci#define EAVCC_VEM_SC_TAG	(0x3 << 16)
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci#define MPIC_PIS_MII		0x00
72262306a36Sopenharmony_ci#define MPIC_PIS_GMII		0x02
72362306a36Sopenharmony_ci#define MPIC_PIS_XGMII		0x04
72462306a36Sopenharmony_ci#define MPIC_LSC_SHIFT		3
72562306a36Sopenharmony_ci#define MPIC_LSC_100M		(1 << MPIC_LSC_SHIFT)
72662306a36Sopenharmony_ci#define MPIC_LSC_1G		(2 << MPIC_LSC_SHIFT)
72762306a36Sopenharmony_ci#define MPIC_LSC_2_5G		(3 << MPIC_LSC_SHIFT)
72862306a36Sopenharmony_ci
72962306a36Sopenharmony_ci#define MDIO_READ_C45		0x03
73062306a36Sopenharmony_ci#define MDIO_WRITE_C45		0x01
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci#define MPSM_PSME		BIT(0)
73362306a36Sopenharmony_ci#define MPSM_MFF_C45		BIT(2)
73462306a36Sopenharmony_ci#define MPSM_PRD_SHIFT		16
73562306a36Sopenharmony_ci#define MPSM_PRD_MASK		GENMASK(31, MPSM_PRD_SHIFT)
73662306a36Sopenharmony_ci
73762306a36Sopenharmony_ci/* Completion flags */
73862306a36Sopenharmony_ci#define MMIS1_PAACS             BIT(2) /* Address */
73962306a36Sopenharmony_ci#define MMIS1_PWACS             BIT(1) /* Write */
74062306a36Sopenharmony_ci#define MMIS1_PRACS             BIT(0) /* Read */
74162306a36Sopenharmony_ci#define MMIS1_CLEAR_FLAGS       0xf
74262306a36Sopenharmony_ci
74362306a36Sopenharmony_ci#define MPIC_PSMCS_SHIFT	16
74462306a36Sopenharmony_ci#define MPIC_PSMCS_MASK		GENMASK(22, MPIC_PSMCS_SHIFT)
74562306a36Sopenharmony_ci#define MPIC_PSMCS(val)		((val) << MPIC_PSMCS_SHIFT)
74662306a36Sopenharmony_ci
74762306a36Sopenharmony_ci#define MPIC_PSMHT_SHIFT	24
74862306a36Sopenharmony_ci#define MPIC_PSMHT_MASK		GENMASK(26, MPIC_PSMHT_SHIFT)
74962306a36Sopenharmony_ci#define MPIC_PSMHT(val)		((val) << MPIC_PSMHT_SHIFT)
75062306a36Sopenharmony_ci
75162306a36Sopenharmony_ci#define MLVC_PLV		BIT(16)
75262306a36Sopenharmony_ci
75362306a36Sopenharmony_ci/* GWCA */
75462306a36Sopenharmony_cienum rswitch_gwca_mode {
75562306a36Sopenharmony_ci	GWMC_OPC_RESET,
75662306a36Sopenharmony_ci	GWMC_OPC_DISABLE,
75762306a36Sopenharmony_ci	GWMC_OPC_CONFIG,
75862306a36Sopenharmony_ci	GWMC_OPC_OPERATION,
75962306a36Sopenharmony_ci};
76062306a36Sopenharmony_ci
76162306a36Sopenharmony_ci#define GWMS_OPS_MASK		GWMC_OPC_OPERATION
76262306a36Sopenharmony_ci
76362306a36Sopenharmony_ci#define GWMTIRM_MTIOG		BIT(0)
76462306a36Sopenharmony_ci#define GWMTIRM_MTR		BIT(1)
76562306a36Sopenharmony_ci
76662306a36Sopenharmony_ci#define GWVCC_VEM_SC_TAG	(0x3 << 16)
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ci#define GWARIRM_ARIOG		BIT(0)
76962306a36Sopenharmony_ci#define GWARIRM_ARR		BIT(1)
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_ci#define GWDCC_BALR		BIT(24)
77262306a36Sopenharmony_ci#define GWDCC_DCP_MASK		GENMASK(18, 16)
77362306a36Sopenharmony_ci#define GWDCC_DCP(prio)		FIELD_PREP(GWDCC_DCP_MASK, (prio))
77462306a36Sopenharmony_ci#define GWDCC_DQT		BIT(11)
77562306a36Sopenharmony_ci#define GWDCC_ETS		BIT(9)
77662306a36Sopenharmony_ci#define GWDCC_EDE		BIT(8)
77762306a36Sopenharmony_ci
77862306a36Sopenharmony_ci#define GWTRC(queue)		(GWTRC0 + (queue) / 32 * 4)
77962306a36Sopenharmony_ci#define GWTPC_PPPL(ipv)		BIT(ipv)
78062306a36Sopenharmony_ci#define GWDCC_OFFS(queue)	(GWDCC0 + (queue) * 4)
78162306a36Sopenharmony_ci
78262306a36Sopenharmony_ci#define GWDIS(i)		(GWDIS0 + (i) * 0x10)
78362306a36Sopenharmony_ci#define GWDIE(i)		(GWDIE0 + (i) * 0x10)
78462306a36Sopenharmony_ci#define GWDID(i)		(GWDID0 + (i) * 0x10)
78562306a36Sopenharmony_ci
78662306a36Sopenharmony_ci/* COMA */
78762306a36Sopenharmony_ci#define RRC_RR			BIT(0)
78862306a36Sopenharmony_ci#define RRC_RR_CLR		0
78962306a36Sopenharmony_ci#define	RCEC_ACE_DEFAULT	(BIT(0) | BIT(AGENT_INDEX_GWCA))
79062306a36Sopenharmony_ci#define RCEC_RCE		BIT(16)
79162306a36Sopenharmony_ci#define RCDC_RCD		BIT(16)
79262306a36Sopenharmony_ci
79362306a36Sopenharmony_ci#define CABPIRM_BPIOG		BIT(0)
79462306a36Sopenharmony_ci#define CABPIRM_BPR		BIT(1)
79562306a36Sopenharmony_ci
79662306a36Sopenharmony_ci#define CABPPFLC_INIT_VALUE	0x00800080
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci/* MFWD */
79962306a36Sopenharmony_ci#define FWPC0_LTHTA		BIT(0)
80062306a36Sopenharmony_ci#define FWPC0_IP4UE		BIT(3)
80162306a36Sopenharmony_ci#define FWPC0_IP4TE		BIT(4)
80262306a36Sopenharmony_ci#define FWPC0_IP4OE		BIT(5)
80362306a36Sopenharmony_ci#define FWPC0_L2SE		BIT(9)
80462306a36Sopenharmony_ci#define FWPC0_IP4EA		BIT(10)
80562306a36Sopenharmony_ci#define FWPC0_IPDSA		BIT(12)
80662306a36Sopenharmony_ci#define FWPC0_IPHLA		BIT(18)
80762306a36Sopenharmony_ci#define FWPC0_MACSDA		BIT(20)
80862306a36Sopenharmony_ci#define FWPC0_MACHLA		BIT(26)
80962306a36Sopenharmony_ci#define FWPC0_MACHMA		BIT(27)
81062306a36Sopenharmony_ci#define FWPC0_VLANSA		BIT(28)
81162306a36Sopenharmony_ci
81262306a36Sopenharmony_ci#define FWPC0(i)		(FWPC00 + (i) * 0x10)
81362306a36Sopenharmony_ci#define FWPC0_DEFAULT		(FWPC0_LTHTA | FWPC0_IP4UE | FWPC0_IP4TE | \
81462306a36Sopenharmony_ci				 FWPC0_IP4OE | FWPC0_L2SE | FWPC0_IP4EA | \
81562306a36Sopenharmony_ci				 FWPC0_IPDSA | FWPC0_IPHLA | FWPC0_MACSDA | \
81662306a36Sopenharmony_ci				 FWPC0_MACHLA |	FWPC0_MACHMA | FWPC0_VLANSA)
81762306a36Sopenharmony_ci#define FWPC1(i)		(FWPC10 + (i) * 0x10)
81862306a36Sopenharmony_ci#define FWPC1_DDE		BIT(0)
81962306a36Sopenharmony_ci
82062306a36Sopenharmony_ci#define	FWPBFC(i)		(FWPBFC0 + (i) * 0x10)
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ci#define FWPBFCSDC(j, i)         (FWPBFCSDC00 + (i) * 0x10 + (j) * 0x04)
82362306a36Sopenharmony_ci
82462306a36Sopenharmony_ci/* TOP */
82562306a36Sopenharmony_ci#define TPEMIMC7(queue)		(TPEMIMC70 + (queue) * 4)
82662306a36Sopenharmony_ci
82762306a36Sopenharmony_ci/* Descriptors */
82862306a36Sopenharmony_cienum RX_DS_CC_BIT {
82962306a36Sopenharmony_ci	RX_DS	= 0x0fff, /* Data size */
83062306a36Sopenharmony_ci	RX_TR	= 0x1000, /* Truncation indication */
83162306a36Sopenharmony_ci	RX_EI	= 0x2000, /* Error indication */
83262306a36Sopenharmony_ci	RX_PS	= 0xc000, /* Padding selection */
83362306a36Sopenharmony_ci};
83462306a36Sopenharmony_ci
83562306a36Sopenharmony_cienum TX_DS_TAGL_BIT {
83662306a36Sopenharmony_ci	TX_DS	= 0x0fff, /* Data size */
83762306a36Sopenharmony_ci	TX_TAGL	= 0xf000, /* Frame tag LSBs */
83862306a36Sopenharmony_ci};
83962306a36Sopenharmony_ci
84062306a36Sopenharmony_cienum DIE_DT {
84162306a36Sopenharmony_ci	/* Frame data */
84262306a36Sopenharmony_ci	DT_FSINGLE	= 0x80,
84362306a36Sopenharmony_ci	DT_FSTART	= 0x90,
84462306a36Sopenharmony_ci	DT_FMID		= 0xa0,
84562306a36Sopenharmony_ci	DT_FEND		= 0xb0,
84662306a36Sopenharmony_ci
84762306a36Sopenharmony_ci	/* Chain control */
84862306a36Sopenharmony_ci	DT_LEMPTY	= 0xc0,
84962306a36Sopenharmony_ci	DT_EEMPTY	= 0xd0,
85062306a36Sopenharmony_ci	DT_LINKFIX	= 0x00,
85162306a36Sopenharmony_ci	DT_LINK		= 0xe0,
85262306a36Sopenharmony_ci	DT_EOS		= 0xf0,
85362306a36Sopenharmony_ci	/* HW/SW arbitration */
85462306a36Sopenharmony_ci	DT_FEMPTY	= 0x40,
85562306a36Sopenharmony_ci	DT_FEMPTY_IS	= 0x10,
85662306a36Sopenharmony_ci	DT_FEMPTY_IC	= 0x20,
85762306a36Sopenharmony_ci	DT_FEMPTY_ND	= 0x30,
85862306a36Sopenharmony_ci	DT_FEMPTY_START	= 0x50,
85962306a36Sopenharmony_ci	DT_FEMPTY_MID	= 0x60,
86062306a36Sopenharmony_ci	DT_FEMPTY_END	= 0x70,
86162306a36Sopenharmony_ci
86262306a36Sopenharmony_ci	DT_MASK		= 0xf0,
86362306a36Sopenharmony_ci	DIE		= 0x08,	/* Descriptor Interrupt Enable */
86462306a36Sopenharmony_ci};
86562306a36Sopenharmony_ci
86662306a36Sopenharmony_ci/* Both transmission and reception */
86762306a36Sopenharmony_ci#define INFO1_FMT		BIT(2)
86862306a36Sopenharmony_ci#define INFO1_TXC		BIT(3)
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ci/* For transmission */
87162306a36Sopenharmony_ci#define INFO1_TSUN(val)		((u64)(val) << 8ULL)
87262306a36Sopenharmony_ci#define INFO1_IPV(prio)		((u64)(prio) << 28ULL)
87362306a36Sopenharmony_ci#define INFO1_CSD0(index)	((u64)(index) << 32ULL)
87462306a36Sopenharmony_ci#define INFO1_CSD1(index)	((u64)(index) << 40ULL)
87562306a36Sopenharmony_ci#define INFO1_DV(port_vector)	((u64)(port_vector) << 48ULL)
87662306a36Sopenharmony_ci
87762306a36Sopenharmony_ci/* For reception */
87862306a36Sopenharmony_ci#define INFO1_SPN(port)		((u64)(port) << 36ULL)
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci/* For timestamp descriptor in dptrl (Byte 4 to 7) */
88162306a36Sopenharmony_ci#define TS_DESC_TSUN(dptrl)	((dptrl) & GENMASK(7, 0))
88262306a36Sopenharmony_ci#define TS_DESC_SPN(dptrl)	(((dptrl) & GENMASK(10, 8)) >> 8)
88362306a36Sopenharmony_ci#define TS_DESC_DPN(dptrl)	(((dptrl) & GENMASK(17, 16)) >> 16)
88462306a36Sopenharmony_ci#define TS_DESC_TN(dptrl)	((dptrl) & BIT(24))
88562306a36Sopenharmony_ci
88662306a36Sopenharmony_cistruct rswitch_desc {
88762306a36Sopenharmony_ci	__le16 info_ds;	/* Descriptor size */
88862306a36Sopenharmony_ci	u8 die_dt;	/* Descriptor interrupt enable and type */
88962306a36Sopenharmony_ci	__u8  dptrh;	/* Descriptor pointer MSB */
89062306a36Sopenharmony_ci	__le32 dptrl;	/* Descriptor pointer LSW */
89162306a36Sopenharmony_ci} __packed;
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_cistruct rswitch_ts_desc {
89462306a36Sopenharmony_ci	struct rswitch_desc desc;
89562306a36Sopenharmony_ci	__le32 ts_nsec;
89662306a36Sopenharmony_ci	__le32 ts_sec;
89762306a36Sopenharmony_ci} __packed;
89862306a36Sopenharmony_ci
89962306a36Sopenharmony_cistruct rswitch_ext_desc {
90062306a36Sopenharmony_ci	struct rswitch_desc desc;
90162306a36Sopenharmony_ci	__le64 info1;
90262306a36Sopenharmony_ci} __packed;
90362306a36Sopenharmony_ci
90462306a36Sopenharmony_cistruct rswitch_ext_ts_desc {
90562306a36Sopenharmony_ci	struct rswitch_desc desc;
90662306a36Sopenharmony_ci	__le64 info1;
90762306a36Sopenharmony_ci	__le32 ts_nsec;
90862306a36Sopenharmony_ci	__le32 ts_sec;
90962306a36Sopenharmony_ci} __packed;
91062306a36Sopenharmony_ci
91162306a36Sopenharmony_cistruct rswitch_etha {
91262306a36Sopenharmony_ci	int index;
91362306a36Sopenharmony_ci	void __iomem *addr;
91462306a36Sopenharmony_ci	void __iomem *coma_addr;
91562306a36Sopenharmony_ci	bool external_phy;
91662306a36Sopenharmony_ci	struct mii_bus *mii;
91762306a36Sopenharmony_ci	phy_interface_t phy_interface;
91862306a36Sopenharmony_ci	u32 psmcs;
91962306a36Sopenharmony_ci	u8 mac_addr[MAX_ADDR_LEN];
92062306a36Sopenharmony_ci	int link;
92162306a36Sopenharmony_ci	int speed;
92262306a36Sopenharmony_ci
92362306a36Sopenharmony_ci	/* This hardware could not be initialized twice so that marked
92462306a36Sopenharmony_ci	 * this flag to avoid multiple initialization.
92562306a36Sopenharmony_ci	 */
92662306a36Sopenharmony_ci	bool operated;
92762306a36Sopenharmony_ci};
92862306a36Sopenharmony_ci
92962306a36Sopenharmony_ci/* The datasheet said descriptor "chain" and/or "queue". For consistency of
93062306a36Sopenharmony_ci * name, this driver calls "queue".
93162306a36Sopenharmony_ci */
93262306a36Sopenharmony_cistruct rswitch_gwca_queue {
93362306a36Sopenharmony_ci	union {
93462306a36Sopenharmony_ci		struct rswitch_ext_desc *tx_ring;
93562306a36Sopenharmony_ci		struct rswitch_ext_ts_desc *rx_ring;
93662306a36Sopenharmony_ci		struct rswitch_ts_desc *ts_ring;
93762306a36Sopenharmony_ci	};
93862306a36Sopenharmony_ci
93962306a36Sopenharmony_ci	/* Common */
94062306a36Sopenharmony_ci	dma_addr_t ring_dma;
94162306a36Sopenharmony_ci	int ring_size;
94262306a36Sopenharmony_ci	int cur;
94362306a36Sopenharmony_ci	int dirty;
94462306a36Sopenharmony_ci
94562306a36Sopenharmony_ci	/* For [rt]_ring */
94662306a36Sopenharmony_ci	int index;
94762306a36Sopenharmony_ci	bool dir_tx;
94862306a36Sopenharmony_ci	struct sk_buff **skbs;
94962306a36Sopenharmony_ci	struct net_device *ndev;	/* queue to ndev for irq */
95062306a36Sopenharmony_ci};
95162306a36Sopenharmony_ci
95262306a36Sopenharmony_cistruct rswitch_gwca_ts_info {
95362306a36Sopenharmony_ci	struct sk_buff *skb;
95462306a36Sopenharmony_ci	struct list_head list;
95562306a36Sopenharmony_ci
95662306a36Sopenharmony_ci	int port;
95762306a36Sopenharmony_ci	u8 tag;
95862306a36Sopenharmony_ci};
95962306a36Sopenharmony_ci
96062306a36Sopenharmony_ci#define RSWITCH_NUM_IRQ_REGS	(RSWITCH_MAX_NUM_QUEUES / BITS_PER_TYPE(u32))
96162306a36Sopenharmony_cistruct rswitch_gwca {
96262306a36Sopenharmony_ci	int index;
96362306a36Sopenharmony_ci	struct rswitch_desc *linkfix_table;
96462306a36Sopenharmony_ci	dma_addr_t linkfix_table_dma;
96562306a36Sopenharmony_ci	u32 linkfix_table_size;
96662306a36Sopenharmony_ci	struct rswitch_gwca_queue *queues;
96762306a36Sopenharmony_ci	int num_queues;
96862306a36Sopenharmony_ci	struct rswitch_gwca_queue ts_queue;
96962306a36Sopenharmony_ci	struct list_head ts_info_list;
97062306a36Sopenharmony_ci	DECLARE_BITMAP(used, RSWITCH_MAX_NUM_QUEUES);
97162306a36Sopenharmony_ci	u32 tx_irq_bits[RSWITCH_NUM_IRQ_REGS];
97262306a36Sopenharmony_ci	u32 rx_irq_bits[RSWITCH_NUM_IRQ_REGS];
97362306a36Sopenharmony_ci	int speed;
97462306a36Sopenharmony_ci};
97562306a36Sopenharmony_ci
97662306a36Sopenharmony_ci#define NUM_QUEUES_PER_NDEV	2
97762306a36Sopenharmony_cistruct rswitch_device {
97862306a36Sopenharmony_ci	struct rswitch_private *priv;
97962306a36Sopenharmony_ci	struct net_device *ndev;
98062306a36Sopenharmony_ci	struct napi_struct napi;
98162306a36Sopenharmony_ci	void __iomem *addr;
98262306a36Sopenharmony_ci	struct rswitch_gwca_queue *tx_queue;
98362306a36Sopenharmony_ci	struct rswitch_gwca_queue *rx_queue;
98462306a36Sopenharmony_ci	u8 ts_tag;
98562306a36Sopenharmony_ci	bool disabled;
98662306a36Sopenharmony_ci
98762306a36Sopenharmony_ci	int port;
98862306a36Sopenharmony_ci	struct rswitch_etha *etha;
98962306a36Sopenharmony_ci	struct device_node *np_port;
99062306a36Sopenharmony_ci	struct phy *serdes;
99162306a36Sopenharmony_ci};
99262306a36Sopenharmony_ci
99362306a36Sopenharmony_cistruct rswitch_mfwd_mac_table_entry {
99462306a36Sopenharmony_ci	int queue_index;
99562306a36Sopenharmony_ci	unsigned char addr[MAX_ADDR_LEN];
99662306a36Sopenharmony_ci};
99762306a36Sopenharmony_ci
99862306a36Sopenharmony_cistruct rswitch_mfwd {
99962306a36Sopenharmony_ci	struct rswitch_mac_table_entry *mac_table_entries;
100062306a36Sopenharmony_ci	int num_mac_table_entries;
100162306a36Sopenharmony_ci};
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_cistruct rswitch_private {
100462306a36Sopenharmony_ci	struct platform_device *pdev;
100562306a36Sopenharmony_ci	void __iomem *addr;
100662306a36Sopenharmony_ci	struct rcar_gen4_ptp_private *ptp_priv;
100762306a36Sopenharmony_ci
100862306a36Sopenharmony_ci	struct rswitch_device *rdev[RSWITCH_NUM_PORTS];
100962306a36Sopenharmony_ci	DECLARE_BITMAP(opened_ports, RSWITCH_NUM_PORTS);
101062306a36Sopenharmony_ci
101162306a36Sopenharmony_ci	struct rswitch_gwca gwca;
101262306a36Sopenharmony_ci	struct rswitch_etha etha[RSWITCH_NUM_PORTS];
101362306a36Sopenharmony_ci	struct rswitch_mfwd mfwd;
101462306a36Sopenharmony_ci
101562306a36Sopenharmony_ci	spinlock_t lock;	/* lock interrupt registers' control */
101662306a36Sopenharmony_ci	struct clk *clk;
101762306a36Sopenharmony_ci
101862306a36Sopenharmony_ci	bool etha_no_runtime_change;
101962306a36Sopenharmony_ci	bool gwca_halt;
102062306a36Sopenharmony_ci};
102162306a36Sopenharmony_ci
102262306a36Sopenharmony_ci#endif	/* #ifndef __RSWITCH_H__ */
1023