Lines Matching +full:cpm +full:- +full:muram

1 // SPDX-License-Identifier: GPL-2.0
3 * CPM serial console support.
113 out_be16(&smc->smcmr, in_be16(&smc->smcmr) & ~3); in smc_disable_port()
119 out_be32(&scc->gsmrl, in_be32(&scc->gsmrl) & ~0x30); in scc_disable_port()
124 out_be16(&smc->smcmr, in_be16(&smc->smcmr) | 3); in smc_enable_port()
130 out_be32(&scc->gsmrl, in_be32(&scc->gsmrl) | 0x30); in scc_enable_port()
138 out_8(&param->rfcr, 0x10); in cpm_serial_open()
139 out_8(&param->tfcr, 0x10); in cpm_serial_open()
140 out_be16(&param->mrblr, 1); in cpm_serial_open()
141 out_be16(&param->maxidl, 0); in cpm_serial_open()
142 out_be16(&param->brkec, 0); in cpm_serial_open()
143 out_be16(&param->brkln, 0); in cpm_serial_open()
144 out_be16(&param->brkcr, 0); in cpm_serial_open()
147 rbdf->addr = (u8 *)rbdf - 1; in cpm_serial_open()
148 rbdf->sc = 0xa000; in cpm_serial_open()
149 rbdf->len = 1; in cpm_serial_open()
152 tbdf->addr = (u8 *)rbdf - 2; in cpm_serial_open()
153 tbdf->sc = 0x2000; in cpm_serial_open()
154 tbdf->len = 1; in cpm_serial_open()
157 out_be16(&param->rbase, cbd_offset); in cpm_serial_open()
158 out_be16(&param->tbase, cbd_offset + sizeof(struct cpm_bd)); in cpm_serial_open()
168 while (tbdf->sc & 0x8000) in cpm_serial_putc()
173 tbdf->addr[0] = c; in cpm_serial_putc()
175 tbdf->sc |= 0x8000; in cpm_serial_putc()
181 return !(rbdf->sc & 0x8000); in cpm_serial_tstc()
192 c = rbdf->addr[0]; in cpm_serial_getc()
194 rbdf->sc |= 0x8000; in cpm_serial_getc()
204 void *parent, *muram; in cpm_console_init() local
208 if (dt_is_compatible(devp, "fsl,cpm1-smc-uart")) { in cpm_console_init()
210 } else if (dt_is_compatible(devp, "fsl,cpm2-scc-uart")) { in cpm_console_init()
212 } else if (dt_is_compatible(devp, "fsl,cpm2-smc-uart")) { in cpm_console_init()
230 if (getprop(devp, "fsl,cpm-command", &cpm_cmd, 4) < 4) in cpm_console_init()
231 return -1; in cpm_console_init()
234 return -1; in cpm_console_init()
245 return -1; in cpm_console_init()
248 return -1; in cpm_console_init()
250 muram = finddevice("/soc/cpm/muram/data"); in cpm_console_init()
251 if (!muram) in cpm_console_init()
252 return -1; in cpm_console_init()
254 /* For bootwrapper-compatible device trees, we assume that the first in cpm_console_init()
255 * entry has at least 128 bytes, and that #address-cells/#data-cells in cpm_console_init()
259 if (dt_get_virtual_reg(muram, &muram_addr, 1) < 1) in cpm_console_init()
260 return -1; in cpm_console_init()
262 if (getprop(muram, "reg", reg, 8) < 8) in cpm_console_init()
263 return -1; in cpm_console_init()
268 /* Store the buffer descriptors at the end of the first muram chunk. in cpm_console_init()
269 * For SMC ports on CPM2-based platforms, relocate the parameter RAM in cpm_console_init()
273 cbd_offset = muram_offset + muram_size - 2 * sizeof(struct cpm_bd); in cpm_console_init()
279 pram_offset = cbd_offset - 64; in cpm_console_init()
284 param = muram_addr - muram_offset + pram_offset; in cpm_console_init()
287 cbd_addr = muram_addr - muram_offset + cbd_offset; in cpm_console_init()
289 scdp->open = cpm_serial_open; in cpm_console_init()
290 scdp->putc = cpm_serial_putc; in cpm_console_init()
291 scdp->getc = cpm_serial_getc; in cpm_console_init()
292 scdp->tstc = cpm_serial_tstc; in cpm_console_init()