162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * MPC5121 Prototypes and definitions
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef __ASM_POWERPC_MPC5121_H__
762306a36Sopenharmony_ci#define __ASM_POWERPC_MPC5121_H__
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/* MPC512x Reset module registers */
1062306a36Sopenharmony_cistruct mpc512x_reset_module {
1162306a36Sopenharmony_ci	u32	rcwlr;	/* Reset Configuration Word Low Register */
1262306a36Sopenharmony_ci	u32	rcwhr;	/* Reset Configuration Word High Register */
1362306a36Sopenharmony_ci	u32	reserved1;
1462306a36Sopenharmony_ci	u32	reserved2;
1562306a36Sopenharmony_ci	u32	rsr;	/* Reset Status Register */
1662306a36Sopenharmony_ci	u32	rmr;	/* Reset Mode Register */
1762306a36Sopenharmony_ci	u32	rpr;	/* Reset Protection Register */
1862306a36Sopenharmony_ci	u32	rcr;	/* Reset Control Register */
1962306a36Sopenharmony_ci	u32	rcer;	/* Reset Control Enable Register */
2062306a36Sopenharmony_ci};
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/*
2362306a36Sopenharmony_ci * Clock Control Module
2462306a36Sopenharmony_ci */
2562306a36Sopenharmony_cistruct mpc512x_ccm {
2662306a36Sopenharmony_ci	u32	spmr;	/* System PLL Mode Register */
2762306a36Sopenharmony_ci	u32	sccr1;	/* System Clock Control Register 1 */
2862306a36Sopenharmony_ci	u32	sccr2;	/* System Clock Control Register 2 */
2962306a36Sopenharmony_ci	u32	scfr1;	/* System Clock Frequency Register 1 */
3062306a36Sopenharmony_ci	u32	scfr2;	/* System Clock Frequency Register 2 */
3162306a36Sopenharmony_ci	u32	scfr2s;	/* System Clock Frequency Shadow Register 2 */
3262306a36Sopenharmony_ci	u32	bcr;	/* Bread Crumb Register */
3362306a36Sopenharmony_ci	u32	psc_ccr[12];	/* PSC Clock Control Registers */
3462306a36Sopenharmony_ci	u32	spccr;	/* SPDIF Clock Control Register */
3562306a36Sopenharmony_ci	u32	cccr;	/* CFM Clock Control Register */
3662306a36Sopenharmony_ci	u32	dccr;	/* DIU Clock Control Register */
3762306a36Sopenharmony_ci	u32	mscan_ccr[4];	/* MSCAN Clock Control Registers */
3862306a36Sopenharmony_ci	u32	out_ccr[4];	/* OUT CLK Configure Registers */
3962306a36Sopenharmony_ci	u32	rsv0[2];	/* Reserved */
4062306a36Sopenharmony_ci	u32	scfr3;		/* System Clock Frequency Register 3 */
4162306a36Sopenharmony_ci	u32	rsv1[3];	/* Reserved */
4262306a36Sopenharmony_ci	u32	spll_lock_cnt;	/* System PLL Lock Counter */
4362306a36Sopenharmony_ci	u8	res[0x6c];	/* Reserved */
4462306a36Sopenharmony_ci};
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/*
4762306a36Sopenharmony_ci * LPC Module
4862306a36Sopenharmony_ci */
4962306a36Sopenharmony_cistruct mpc512x_lpc {
5062306a36Sopenharmony_ci	u32	cs_cfg[8];	/* CS config */
5162306a36Sopenharmony_ci	u32	cs_ctrl;	/* CS Control Register */
5262306a36Sopenharmony_ci	u32	cs_status;	/* CS Status Register */
5362306a36Sopenharmony_ci	u32	burst_ctrl;	/* CS Burst Control Register */
5462306a36Sopenharmony_ci	u32	deadcycle_ctrl;	/* CS Deadcycle Control Register */
5562306a36Sopenharmony_ci	u32	holdcycle_ctrl;	/* CS Holdcycle Control Register */
5662306a36Sopenharmony_ci	u32	alt;		/* Address Latch Timing Register */
5762306a36Sopenharmony_ci};
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ciint mpc512x_cs_config(unsigned int cs, u32 val);
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/*
6262306a36Sopenharmony_ci * SCLPC Module (LPB FIFO)
6362306a36Sopenharmony_ci */
6462306a36Sopenharmony_cistruct mpc512x_lpbfifo {
6562306a36Sopenharmony_ci	u32	pkt_size;	/* SCLPC Packet Size Register */
6662306a36Sopenharmony_ci	u32	start_addr;	/* SCLPC Start Address Register */
6762306a36Sopenharmony_ci	u32	ctrl;		/* SCLPC Control Register */
6862306a36Sopenharmony_ci	u32	enable;		/* SCLPC Enable Register */
6962306a36Sopenharmony_ci	u32	reserved1;
7062306a36Sopenharmony_ci	u32	status;		/* SCLPC Status Register */
7162306a36Sopenharmony_ci	u32	bytes_done;	/* SCLPC Bytes Done Register */
7262306a36Sopenharmony_ci	u32	emb_sc;		/* EMB Share Counter Register */
7362306a36Sopenharmony_ci	u32	emb_pc;		/* EMB Pause Control Register */
7462306a36Sopenharmony_ci	u32	reserved2[7];
7562306a36Sopenharmony_ci	u32	data_word;	/* LPC RX/TX FIFO Data Word Register */
7662306a36Sopenharmony_ci	u32	fifo_status;	/* LPC RX/TX FIFO Status Register */
7762306a36Sopenharmony_ci	u32	fifo_ctrl;	/* LPC RX/TX FIFO Control Register */
7862306a36Sopenharmony_ci	u32	fifo_alarm;	/* LPC RX/TX FIFO Alarm Register */
7962306a36Sopenharmony_ci};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#define MPC512X_SCLPC_START		(1 << 31)
8262306a36Sopenharmony_ci#define MPC512X_SCLPC_CS(x)		(((x) & 0x7) << 24)
8362306a36Sopenharmony_ci#define MPC512X_SCLPC_FLUSH		(1 << 17)
8462306a36Sopenharmony_ci#define MPC512X_SCLPC_READ		(1 << 16)
8562306a36Sopenharmony_ci#define MPC512X_SCLPC_DAI		(1 << 8)
8662306a36Sopenharmony_ci#define MPC512X_SCLPC_BPT(x)		((x) & 0x3f)
8762306a36Sopenharmony_ci#define MPC512X_SCLPC_RESET		(1 << 24)
8862306a36Sopenharmony_ci#define MPC512X_SCLPC_FIFO_RESET	(1 << 16)
8962306a36Sopenharmony_ci#define MPC512X_SCLPC_ABORT_INT_ENABLE	(1 << 9)
9062306a36Sopenharmony_ci#define MPC512X_SCLPC_NORM_INT_ENABLE	(1 << 8)
9162306a36Sopenharmony_ci#define MPC512X_SCLPC_ENABLE		(1 << 0)
9262306a36Sopenharmony_ci#define MPC512X_SCLPC_SUCCESS		(1 << 24)
9362306a36Sopenharmony_ci#define MPC512X_SCLPC_FIFO_CTRL(x)	(((x) & 0x7) << 24)
9462306a36Sopenharmony_ci#define MPC512X_SCLPC_FIFO_ALARM(x)	((x) & 0x3ff)
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_cienum lpb_dev_portsize {
9762306a36Sopenharmony_ci	LPB_DEV_PORTSIZE_UNDEFINED = 0,
9862306a36Sopenharmony_ci	LPB_DEV_PORTSIZE_1_BYTE = 1,
9962306a36Sopenharmony_ci	LPB_DEV_PORTSIZE_2_BYTES = 2,
10062306a36Sopenharmony_ci	LPB_DEV_PORTSIZE_4_BYTES = 4,
10162306a36Sopenharmony_ci	LPB_DEV_PORTSIZE_8_BYTES = 8
10262306a36Sopenharmony_ci};
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_cienum mpc512x_lpbfifo_req_dir {
10562306a36Sopenharmony_ci	MPC512X_LPBFIFO_REQ_DIR_READ,
10662306a36Sopenharmony_ci	MPC512X_LPBFIFO_REQ_DIR_WRITE
10762306a36Sopenharmony_ci};
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_cistruct mpc512x_lpbfifo_request {
11062306a36Sopenharmony_ci	phys_addr_t dev_phys_addr; /* physical address of some device on LPB */
11162306a36Sopenharmony_ci	void *ram_virt_addr; /* virtual address of some region in RAM */
11262306a36Sopenharmony_ci	u32 size;
11362306a36Sopenharmony_ci	enum lpb_dev_portsize portsize;
11462306a36Sopenharmony_ci	enum mpc512x_lpbfifo_req_dir dir;
11562306a36Sopenharmony_ci	void (*callback)(struct mpc512x_lpbfifo_request *);
11662306a36Sopenharmony_ci};
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciint mpc512x_lpbfifo_submit(struct mpc512x_lpbfifo_request *req);
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci#endif /* __ASM_POWERPC_MPC5121_H__ */
121