Skip to content

Commit

Permalink
serial, mpc8xx: Take parameter RAM relocation into account
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
chleroy committed May 5, 2023
1 parent 14e64c1 commit 388cb1a
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions drivers/serial/serial_mpc8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ 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;

/* initialize pointers to SMC */

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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 388cb1a

Please sign in to comment.