aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2023-05-03 09:20:15 +0200
committerChristophe Leroy <christophe.leroy@csgroup.eu>2023-05-05 07:26:53 +0200
commit388cb1a10f091e494b837a8666d49866e9c7b1e2 (patch)
tree0fe4b077a0e1070d083f2d4929780760246c2d4c
parent14e64c18019ea5361e260bec2a56620c4fe918a1 (diff)
downloadu-boot-388cb1a10f091e494b837a8666d49866e9c7b1e2.zip
u-boot-388cb1a10f091e494b837a8666d49866e9c7b1e2.tar.gz
u-boot-388cb1a10f091e494b837a8666d49866e9c7b1e2.tar.bz2
serial, mpc8xx: Take parameter RAM relocation into account
Instead of inhibiting parameter RAM relacation, take into account the configured one. It means INIT_TRX command cannot be used and must be done manually as explained in the microcode patch application note. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
-rw-r--r--drivers/serial/serial_mpc8xx.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/serial/serial_mpc8xx.c b/drivers/serial/serial_mpc8xx.c
index beffc34..d82760c 100644
--- a/drivers/serial/serial_mpc8xx.c
+++ b/drivers/serial/serial_mpc8xx.c
@@ -83,6 +83,7 @@ static int serial_mpc8xx_probe(struct udevice *dev)
immap_t __iomem *im = (immap_t __iomem *)CONFIG_SYS_IMMR;
smc_t __iomem *sp;
smc_uart_t __iomem *up;
+ u16 smc_rpbase;
cpm8xx_t __iomem *cp = &(im->im_cpm);
struct serialbuffer __iomem *rtx;
@@ -90,8 +91,10 @@ static int serial_mpc8xx_probe(struct udevice *dev)
sp = cp->cp_smc + SMC_INDEX;
up = (smc_uart_t __iomem *)&cp->cp_dpmem[PROFF_SMC];
- /* Disable relocation */
- out_be16(&up->smc_rpbase, 0);
+
+ smc_rpbase = in_be16(&up->smc_rpbase);
+ if (smc_rpbase)
+ up = (smc_uart_t __iomem *)&cp->cp_dpmem[smc_rpbase];
/* Disable transmitter/receiver. */
clrbits_be16(&sp->smc_smcmr, SMCMR_REN | SMCMR_TEN);
@@ -154,15 +157,12 @@ static int serial_mpc8xx_probe(struct udevice *dev)
out_be16(&up->smc_maxidl, CONFIG_SYS_MAXIDLE);
out_be32(&rtx->rxindex, 0);
- /* Initialize Tx/Rx parameters. */
- while (in_be16(&cp->cp_cpcr) & CPM_CR_FLG) /* wait if cp is busy */
- ;
-
- out_be16(&cp->cp_cpcr,
- mk_cr_cmd(CPM_CR_CH_SMC, CPM_CR_INIT_TRX) | CPM_CR_FLG);
-
- while (in_be16(&cp->cp_cpcr) & CPM_CR_FLG) /* wait if cp is busy */
- ;
+ out_be32(&up->smc_rstate, 0);
+ out_be32(&up->smc_tstate, 0);
+ out_be16(&up->smc_rbptr, CPM_SERIAL_BASE);
+ out_be16(&up->smc_tbptr, CPM_SERIAL_BASE + sizeof(cbd_t));
+ out_be16(&up->smc_brkcr, 1);
+ out_be16(&up->smc_brkec, 0);
/* Enable transmitter/receiver. */
setbits_be16(&sp->smc_smcmr, SMCMR_REN | SMCMR_TEN);