mpc85xx: Support P20XX Local Access Window regs

This commit is contained in:
Sebastian Huber 2021-12-21 09:02:01 +01:00 committed by Christian Mauderer
parent 0e2d6b8819
commit 557f2cc97c
2 changed files with 40 additions and 0 deletions

View File

@ -82,6 +82,29 @@ ccsr_write4(uintptr_t addr, uint32_t val)
powerpc_iomb();
}
static int
mpc85xx_is_p20xx(void)
{
uint32_t ver;
int is_p20xx;
ver = SVR_VER(mfspr(SPR_SVR));
switch (ver) {
case SVR_P2010:
case SVR_P2010E:
case SVR_P2020:
case SVR_P2020E:
case SVR_P2041:
case SVR_P2041E:
is_p20xx = 1;
break;
default:
is_p20xx = 0;
}
return (is_p20xx);
}
int
law_getmax(void)
{
@ -100,6 +123,14 @@ law_getmax(void)
case SVR_MPC8548E:
law_max = 10;
break;
case SVR_P2010:
case SVR_P2010E:
case SVR_P2020:
case SVR_P2020E:
case SVR_P2041:
case SVR_P2041E:
law_max = 12;
break;
case SVR_P5020:
case SVR_P5020E:
case SVR_P5021:
@ -124,6 +155,10 @@ law_write(uint32_t n, uint64_t bar, uint32_t sr)
ccsr_write4(OCP85XX_LAWBARL(n), bar);
ccsr_write4(OCP85XX_LAWSR_QORIQ(n), sr);
ccsr_read4(OCP85XX_LAWSR_QORIQ(n));
} else if (mpc85xx_is_p20xx()) {
ccsr_write4(OCP85XX_LAWBAR_P20XX(n), bar >> 12);
ccsr_write4(OCP85XX_LAWAR(n), sr);
ccsr_read4(OCP85XX_LAWAR(n));
} else {
ccsr_write4(OCP85XX_LAWBAR(n), bar >> 12);
ccsr_write4(OCP85XX_LAWSR_85XX(n), sr);
@ -148,6 +183,9 @@ law_read(uint32_t n, uint64_t *bar, uint32_t *sr)
*bar = (uint64_t)ccsr_read4(OCP85XX_LAWBARH(n)) << 32 |
ccsr_read4(OCP85XX_LAWBARL(n));
*sr = ccsr_read4(OCP85XX_LAWSR_QORIQ(n));
} else if (mpc85xx_is_p20xx()) {
*bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR_P20XX(n)) << 12;
*sr = ccsr_read4(OCP85XX_LAWAR(n));
} else {
*bar = (uint64_t)ccsr_read4(OCP85XX_LAWBAR(n)) << 12;
*sr = ccsr_read4(OCP85XX_LAWSR_85XX(n));

View File

@ -79,6 +79,8 @@ extern vm_size_t ccsrbar_size;
#define OCP85XX_LAWSR_85XX(n) (CCSRBAR_VA + 0xc10 + 0x10 * (n))
#define OCP85XX_LAWSR(n) (mpc85xx_is_qoriq() ? OCP85XX_LAWSR_QORIQ(n) : \
OCP85XX_LAWSR_85XX(n))
#define OCP85XX_LAWBAR_P20XX(n) (CCSRBAR_VA + 0xc08 + 0x20 * (n))
#define OCP85XX_LAWAR(n) (CCSRBAR_VA + 0xc10 + 0x20 * (n))
/* Attribute register */
#define OCP85XX_ENA_MASK 0x80000000