18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2009-2010, 2012 Freescale Semiconductor, Inc
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * QorIQ based Cache Controller Memory Mapped Registers
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Author: Vivek Mahajan <vivek.mahajan@freescale.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __FSL_85XX_CACHE_CTLR_H__
118c2ecf20Sopenharmony_ci#define __FSL_85XX_CACHE_CTLR_H__
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define L2CR_L2FI		0x40000000	/* L2 flash invalidate */
148c2ecf20Sopenharmony_ci#define L2CR_L2IO		0x00200000	/* L2 instruction only */
158c2ecf20Sopenharmony_ci#define L2CR_SRAM_ZERO		0x00000000	/* L2SRAM zero size */
168c2ecf20Sopenharmony_ci#define L2CR_SRAM_FULL		0x00010000	/* L2SRAM full size */
178c2ecf20Sopenharmony_ci#define L2CR_SRAM_HALF		0x00020000	/* L2SRAM half size */
188c2ecf20Sopenharmony_ci#define L2CR_SRAM_TWO_HALFS	0x00030000	/* L2SRAM two half sizes */
198c2ecf20Sopenharmony_ci#define L2CR_SRAM_QUART		0x00040000	/* L2SRAM one quarter size */
208c2ecf20Sopenharmony_ci#define L2CR_SRAM_TWO_QUARTS	0x00050000	/* L2SRAM two quarter size */
218c2ecf20Sopenharmony_ci#define L2CR_SRAM_EIGHTH	0x00060000	/* L2SRAM one eighth size */
228c2ecf20Sopenharmony_ci#define L2CR_SRAM_TWO_EIGHTH	0x00070000	/* L2SRAM two eighth size */
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define L2SRAM_OPTIMAL_SZ_SHIFT	0x00000003	/* Optimum size for L2SRAM */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define L2SRAM_BAR_MSK_LO18	0xFFFFC000	/* Lower 18 bits */
278c2ecf20Sopenharmony_ci#define L2SRAM_BARE_MSK_HI4	0x0000000F	/* Upper 4 bits */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cienum cache_sram_lock_ways {
308c2ecf20Sopenharmony_ci	LOCK_WAYS_ZERO,
318c2ecf20Sopenharmony_ci	LOCK_WAYS_EIGHTH,
328c2ecf20Sopenharmony_ci	LOCK_WAYS_TWO_EIGHTH,
338c2ecf20Sopenharmony_ci	LOCK_WAYS_HALF = 4,
348c2ecf20Sopenharmony_ci	LOCK_WAYS_FULL = 8,
358c2ecf20Sopenharmony_ci};
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct mpc85xx_l2ctlr {
388c2ecf20Sopenharmony_ci	u32	ctl;		/* 0x000 - L2 control */
398c2ecf20Sopenharmony_ci	u8	res1[0xC];
408c2ecf20Sopenharmony_ci	u32	ewar0;		/* 0x010 - External write address 0 */
418c2ecf20Sopenharmony_ci	u32	ewarea0;	/* 0x014 - External write address extended 0 */
428c2ecf20Sopenharmony_ci	u32	ewcr0;		/* 0x018 - External write ctrl */
438c2ecf20Sopenharmony_ci	u8	res2[4];
448c2ecf20Sopenharmony_ci	u32	ewar1;		/* 0x020 - External write address 1 */
458c2ecf20Sopenharmony_ci	u32	ewarea1;	/* 0x024 - External write address extended 1 */
468c2ecf20Sopenharmony_ci	u32	ewcr1;		/* 0x028 - External write ctrl 1 */
478c2ecf20Sopenharmony_ci	u8	res3[4];
488c2ecf20Sopenharmony_ci	u32	ewar2;		/* 0x030 - External write address 2 */
498c2ecf20Sopenharmony_ci	u32	ewarea2;	/* 0x034 - External write address extended 2 */
508c2ecf20Sopenharmony_ci	u32	ewcr2;		/* 0x038 - External write ctrl 2 */
518c2ecf20Sopenharmony_ci	u8	res4[4];
528c2ecf20Sopenharmony_ci	u32	ewar3;		/* 0x040 - External write address 3 */
538c2ecf20Sopenharmony_ci	u32	ewarea3;	/* 0x044 - External write address extended 3 */
548c2ecf20Sopenharmony_ci	u32	ewcr3;		/* 0x048 - External write ctrl 3 */
558c2ecf20Sopenharmony_ci	u8	res5[0xB4];
568c2ecf20Sopenharmony_ci	u32	srbar0;		/* 0x100 - SRAM base address 0 */
578c2ecf20Sopenharmony_ci	u32	srbarea0;	/* 0x104 - SRAM base addr reg ext address 0 */
588c2ecf20Sopenharmony_ci	u32	srbar1;		/* 0x108 - SRAM base address 1 */
598c2ecf20Sopenharmony_ci	u32	srbarea1;	/* 0x10C - SRAM base addr reg ext address 1 */
608c2ecf20Sopenharmony_ci	u8	res6[0xCF0];
618c2ecf20Sopenharmony_ci	u32	errinjhi;	/* 0xE00 - Error injection mask high */
628c2ecf20Sopenharmony_ci	u32	errinjlo;	/* 0xE04 - Error injection mask low */
638c2ecf20Sopenharmony_ci	u32	errinjctl;	/* 0xE08 - Error injection tag/ecc control */
648c2ecf20Sopenharmony_ci	u8	res7[0x14];
658c2ecf20Sopenharmony_ci	u32	captdatahi;	/* 0xE20 - Error data high capture */
668c2ecf20Sopenharmony_ci	u32	captdatalo;	/* 0xE24 - Error data low capture */
678c2ecf20Sopenharmony_ci	u32	captecc;	/* 0xE28 - Error syndrome */
688c2ecf20Sopenharmony_ci	u8	res8[0x14];
698c2ecf20Sopenharmony_ci	u32	errdet;		/* 0xE40 - Error detect */
708c2ecf20Sopenharmony_ci	u32	errdis;		/* 0xE44 - Error disable */
718c2ecf20Sopenharmony_ci	u32	errinten;	/* 0xE48 - Error interrupt enable */
728c2ecf20Sopenharmony_ci	u32	errattr;	/* 0xE4c - Error attribute capture */
738c2ecf20Sopenharmony_ci	u32	erradrrl;	/* 0xE50 - Error address capture low */
748c2ecf20Sopenharmony_ci	u32	erradrrh;	/* 0xE54 - Error address capture high */
758c2ecf20Sopenharmony_ci	u32	errctl;		/* 0xE58 - Error control */
768c2ecf20Sopenharmony_ci	u8	res9[0x1A4];
778c2ecf20Sopenharmony_ci};
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cistruct sram_parameters {
808c2ecf20Sopenharmony_ci	unsigned int sram_size;
818c2ecf20Sopenharmony_ci	phys_addr_t sram_offset;
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciextern int instantiate_cache_sram(struct platform_device *dev,
858c2ecf20Sopenharmony_ci		struct sram_parameters sram_params);
868c2ecf20Sopenharmony_ciextern void remove_cache_sram(struct platform_device *dev);
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci#endif /* __FSL_85XX_CACHE_CTLR_H__ */
89