kobo_machdep.c revision 1.6 1 /* $NetBSD: kobo_machdep.c,v 1.6 2019/05/18 08:49:24 skrll Exp $ */
2
3 /*
4 * Copyright (c) 2002, 2003, 2005, 2010 Genetec Corporation.
5 * All rights reserved.
6 * Written by Hiroyuki Bessho for Genetec Corporation.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 *
29 * Machine dependent functions for kernel setup for RAKUTEN Kobo.
30 * Based on iq80310_machhdep.c
31 */
32 /*
33 * Copyright (c) 2001 Wasabi Systems, Inc.
34 * All rights reserved.
35 *
36 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution.
46 * 3. All advertising materials mentioning features or use of this software
47 * must display the following acknowledgement:
48 * This product includes software developed for the NetBSD Project by
49 * Wasabi Systems, Inc.
50 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
51 * or promote products derived from this software without specific prior
52 * written permission.
53 *
54 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE.
65 */
66
67 /*
68 * Copyright (c) 1997,1998 Mark Brinicombe.
69 * Copyright (c) 1997,1998 Causality Limited.
70 * All rights reserved.
71 *
72 * Redistribution and use in source and binary forms, with or without
73 * modification, are permitted provided that the following conditions
74 * are met:
75 * 1. Redistributions of source code must retain the above copyright
76 * notice, this list of conditions and the following disclaimer.
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in the
79 * documentation and/or other materials provided with the distribution.
80 * 3. All advertising materials mentioning features or use of this software
81 * must display the following acknowledgement:
82 * This product includes software developed by Mark Brinicombe
83 * for the NetBSD Project.
84 * 4. The name of the company nor the name of the author may be used to
85 * endorse or promote products derived from this software without specific
86 * prior written permission.
87 *
88 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
89 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
90 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
91 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
92 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
93 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
94 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
95 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
96 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
97 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
98 * SUCH DAMAGE.
99 *
100 * Machine dependent functions for kernel setup for Intel IQ80310 evaluation
101 * boards using RedBoot firmware.
102 */
103
104 #include <sys/cdefs.h>
105 __KERNEL_RCSID(0, "$NetBSD: kobo_machdep.c,v 1.6 2019/05/18 08:49:24 skrll Exp $");
106
107 #include "opt_evbarm_boardtype.h"
108 #include "opt_arm_debug.h"
109 #include "opt_console.h"
110 #include "opt_cputypes.h"
111 #include "opt_ddb.h"
112 #include "opt_kgdb.h"
113 #include "opt_md.h"
114 #include "opt_com.h"
115 #include "imxuart.h"
116 #include "opt_imxuart.h"
117 #include "opt_imx.h"
118 #include "opt_machdep.h"
119
120 #include <sys/param.h>
121 #include <sys/device.h>
122 #include <sys/reboot.h>
123 #include <sys/termios.h>
124 #include <sys/bus.h>
125
126 #include <machine/db_machdep.h>
127 #ifdef KGDB
128 #include <sys/kgdb.h>
129 #endif
130
131 #include <machine/bootconfig.h>
132
133 #include <arm/arm32/machdep.h>
134
135 #include <arm/imx/imx51reg.h>
136 #include <arm/imx/imx51var.h>
137 #include <arm/imx/imxuartreg.h>
138 #include <arm/imx/imxuartvar.h>
139 #include <arm/imx/imx50_iomuxreg.h>
140 #include <arm/imx/imxgpiovar.h>
141
142 #include <evbarm/kobo/kobo.h>
143 #include <evbarm/kobo/kobo_reg.h>
144
145 /* Kernel text starts 1MB in from the bottom of the kernel address space. */
146 #define KERNEL_TEXT_BASE (KERNEL_BASE + 0x00100000)
147
148 BootConfig bootconfig; /* Boot config storage */
149 static char bootargs[MAX_BOOT_STRING];
150 char *boot_args = NULL;
151
152 extern char KERNEL_BASE_phys[];
153
154 /* filled in before cleaning bss. keep in .data */
155 u_int uboot_args[4] __attribute__((__section__(".data")));
156
157 /*
158 * Macros to translate between physical and virtual for a subset of the
159 * kernel address space. *Not* for general use.
160 */
161 #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
162
163 void consinit(void);
164
165 #ifdef KGDB
166 void kgdb_port_init(void);
167 #endif
168
169 static void init_clocks(void);
170 static void setup_ioports(void);
171
172 #ifndef CONSPEED
173 #define CONSPEED B115200 /* What RedBoot uses */
174 #endif
175 #ifndef CONMODE
176 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
177 #endif
178
179 int comcnspeed = CONSPEED;
180 int comcnmode = CONMODE;
181
182 /*
183 * Static device mappings. These peripheral registers are mapped at
184 * fixed virtual addresses very early in initarm() so that we can use
185 * them while booting the kernel, and stay at the same address
186 * throughout whole kernel's life time.
187 *
188 * We use this table twice; once with bootstrap page table, and once
189 * with kernel's page table which we build up in initarm().
190 *
191 * Since we map these registers into the bootstrap page table using
192 * pmap_devmap_bootstrap() which calls pmap_map_chunk(), we map
193 * registers segment-aligned and segment-rounded in order to avoid
194 * using the 2nd page tables.
195 */
196
197 #define _A(a) ((a) & ~L1_S_OFFSET)
198 #define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
199
200 const struct pmap_devmap kobo_devmap[] = {
201 {
202 /* for UART2, IOMUXC */
203 .pd_va = _A(KOBO_IO_VBASE0),
204 .pd_pa = _A(KOBO_IO_PBASE0),
205 .pd_size = _S(L1_S_SIZE * 4),
206 .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
207 .pd_cache = PTE_NOCACHE
208 },
209 {0}
210 };
211
212 #undef _A
213 #undef _S
214
215 #ifndef MEMSTART
216 #define MEMSTART 0x70000000
217 #endif
218 #ifndef MEMSIZE
219 #define MEMSIZE 256
220 #endif
221
222 static void
223 init_clocks(void)
224 {
225 cortex_pmc_ccnt_init();
226 }
227
228 struct iomux_setup {
229 /* iomux registers are 32-bit wide, but upper 16 bits are not
230 * used. */
231 uint16_t reg;
232 uint16_t val;
233 };
234
235 #define IOMUX_M(padname, mux) \
236 IOMUX_DATA(__CONCAT(IOMUXC_SW_MUX_CTL_PAD_,padname), mux)
237
238 #define IOMUX_P(padname, pad) \
239 IOMUX_DATA(__CONCAT(IOMUXC_SW_PAD_CTL_PAD_,padname), pad)
240
241 #define IOMUX_MP(padname, mux, pad) \
242 IOMUX_M(padname, mux), \
243 IOMUX_P(padname, pad)
244
245 #define IOMUX_DATA(offset, value) \
246 { \
247 .reg = (offset), \
248 .val = (value), \
249 }
250
251 const struct iomux_setup iomux_setup_data[] = {
252 #define HYS PAD_CTL_HYS
253 #define ODE PAD_CTL_ODE
254 #define DSEHIGH PAD_CTL_DSE_HIGH
255 #define DSEMID PAD_CTL_DSE_MID
256 #define DSELOW PAD_CTL_DSE_LOW
257 #define DSEMAX PAD_CTL_DSE_MAX
258 #define SRE PAD_CTL_SRE
259 #define KEEPER PAD_CTL_KEEPER
260 #define PULL PAD_CTL_PULL
261 #define PU_22K PAD_CTL_PUS_22K_PU
262 #define PU_47K PAD_CTL_PUS_47K_PU
263 #define PU_100K PAD_CTL_PUS_100K_PU
264 #define PD_100K PAD_CTL_PUS_100K_PD
265 #define HVE PAD_CTL_HVE /* Low output voltage */
266
267 #define ALT0 IOMUX_CONFIG_ALT0
268 #define ALT1 IOMUX_CONFIG_ALT1
269 #define ALT2 IOMUX_CONFIG_ALT2
270 #define ALT3 IOMUX_CONFIG_ALT3
271 #define ALT4 IOMUX_CONFIG_ALT4
272 #define ALT5 IOMUX_CONFIG_ALT5
273 #define ALT6 IOMUX_CONFIG_ALT6
274 #define ALT7 IOMUX_CONFIG_ALT7
275 #define SION IOMUX_CONFIG_SION
276
277 /* I2C1 */
278 IOMUX_MP(I2C1_SCL, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
279 IOMUX_MP(I2C1_SDA, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
280
281 /* I2C2 */
282 IOMUX_MP(I2C2_SCL, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
283 IOMUX_MP(I2C2_SDA, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
284
285 /* I2C3 */
286 IOMUX_MP(I2C3_SCL, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
287 IOMUX_MP(I2C3_SDA, ALT0 | SION, PULL | PU_100K | HYS | ODE | DSEHIGH),
288
289 /* UART2 */
290 IOMUX_MP(UART2_RXD, ALT0, HYS | PULL | DSEHIGH | SRE),
291 IOMUX_MP(UART2_TXD, ALT0, HYS | PULL | DSEHIGH | SRE),
292
293 /* SD1 */
294 IOMUX_MP(SD1_CMD, ALT0, HVE | PU_22K | DSEMAX | SRE),
295 IOMUX_MP(SD1_CLK, ALT0, HVE | PU_22K | DSEMAX | SRE),
296 IOMUX_MP(SD1_D0, ALT0, HVE | PU_22K | DSEMAX | SRE),
297 IOMUX_MP(SD1_D1, ALT0, HVE | PU_22K | DSEMAX | SRE),
298 IOMUX_MP(SD1_D2, ALT0, HVE | PU_22K | DSEMAX | SRE),
299 IOMUX_MP(SD1_D3, ALT0, HVE | PU_22K | DSEMAX | SRE),
300 // IOMUX_MP(SD1_CD, ALT0, HVE | PU_22K | DSEMAX | SRE),
301
302 /* SD2 */
303 IOMUX_MP(SD2_CMD, ALT0, HVE | PU_22K | DSEMAX | SRE),
304 IOMUX_MP(SD2_CLK, ALT0, HVE | PU_22K | DSEMAX | SRE),
305 IOMUX_MP(SD2_D0, ALT0, HVE | PU_22K | DSEMAX | SRE),
306 IOMUX_MP(SD2_D1, ALT0, HVE | PU_22K | DSEMAX | SRE),
307 IOMUX_MP(SD2_D2, ALT0, HVE | PU_22K | DSEMAX | SRE),
308 IOMUX_MP(SD2_D3, ALT0, HVE | PU_22K | DSEMAX | SRE),
309 IOMUX_MP(SD2_CD, ALT0, HVE | PU_22K | DSEMAX | SRE),
310
311 IOMUX_DATA(IOMUXC_ESDHC2_IPP_CARD_DET_SELECT_INPUT, INPUT_DAISY_1),
312
313 /* SD3 */
314 IOMUX_MP(SD3_CMD, ALT0, HVE | PU_22K | DSEMAX | SRE),
315 IOMUX_MP(SD3_CLK, ALT0, HVE | PU_22K | DSEMAX | SRE),
316 IOMUX_MP(SD3_D0, ALT0, HVE | PU_22K | DSEMAX | SRE),
317 IOMUX_MP(SD3_D1, ALT0, HVE | PU_22K | DSEMAX | SRE),
318 IOMUX_MP(SD3_D2, ALT0, HVE | PU_22K | DSEMAX | SRE),
319 IOMUX_MP(SD3_D3, ALT0, HVE | PU_22K | DSEMAX | SRE),
320 // IOMUX_MP(SD3_CD, ALT0, HVE | PU_22K | DSEMAX | SRE),
321
322 /* OTG */
323 IOMUX_M(PWM2, ALT2),
324 // IOMUX_MP(PWM1, ALT2, HYS | KEEPER | DSEHIGH),
325
326 /* EPDC */
327 IOMUX_M(EPDC_D0, ALT0),
328 IOMUX_M(EPDC_D1, ALT0),
329 IOMUX_M(EPDC_D2, ALT0),
330 IOMUX_M(EPDC_D3, ALT0),
331 IOMUX_M(EPDC_D4, ALT0),
332 IOMUX_M(EPDC_D5, ALT0),
333 IOMUX_M(EPDC_D6, ALT0),
334 IOMUX_M(EPDC_D7, ALT0),
335 IOMUX_M(EPDC_GDCLK, ALT0),
336 IOMUX_M(EPDC_GDSP, ALT0),
337 IOMUX_M(EPDC_GDOE, ALT0),
338 IOMUX_M(EPDC_GDRL, ALT0),
339 IOMUX_M(EPDC_SDCLK, ALT0),
340 IOMUX_M(EPDC_SDOE, ALT0),
341 IOMUX_M(EPDC_SDLE, ALT0),
342 IOMUX_M(EPDC_BDR0, ALT0),
343 IOMUX_M(EPDC_BDR1, ALT0),
344 IOMUX_M(EPDC_SDCE0, ALT0),
345
346 IOMUX_M(EPDC_PWRSTAT, ALT1), /* GPIO3[28] */
347 IOMUX_M(EPDC_PWRCTRL0, ALT1), /* GPIO3[29] */
348 IOMUX_M(EPDC_VCOM0, ALT1), /* GPIO4[21] */
349 IOMUX_M(UART4_TXD, ALT1), /* GPIO6[16] */
350 IOMUX_M(UART4_RXD, ALT1), /* GPIO6[17] */
351
352 // IOMUX_M(PWM2, ALT1), /* GPIO6[25] */
353
354 #undef ODE
355 #undef HYS
356 #undef SRE
357 #undef PULL
358 #undef KEEPER
359 #undef PU_22K
360 #undef PU_47K
361 #undef PU_100K
362 #undef PD_100K
363 #undef HVE
364 #undef DSEMAX
365 #undef DSEHIGH
366 #undef DSEMID
367 #undef DSELOW
368
369 #undef ALT0
370 #undef ALT1
371 #undef ALT2
372 #undef ALT3
373 #undef ALT4
374 #undef ALT5
375 #undef ALT6
376 #undef ALT7
377 #undef SION
378 };
379
380 static void
381 setup_ioports(void)
382 {
383 int i;
384 const struct iomux_setup *p;
385
386 for (i=0; i < __arraycount(iomux_setup_data); ++i) {
387 p = iomux_setup_data + i;
388
389 ioreg_write(KOBO_IOMUXC_VBASE + p->reg,
390 p->val);
391 }
392 }
393
394 #ifdef CONSDEVNAME
395 const char consdevname[] = CONSDEVNAME;
396
397 #ifndef CONMODE
398 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
399 #endif
400 #ifndef CONSPEED
401 #define CONSPEED 115200
402 #endif
403
404 int consmode = CONMODE;
405 int consrate = CONSPEED;
406
407 #endif /* CONSDEVNAME */
408
409 #ifndef IMXUART_FREQ
410 #define IMXUART_FREQ 24000000
411 #endif
412
413 /*
414 * u_int initarm(...)
415 *
416 * Initial entry point on startup. This gets called before main() is
417 * entered.
418 * It should be responsible for setting up everything that must be
419 * in place when main is called.
420 * This includes
421 * Taking a copy of the boot configuration structure.
422 * Initialising the physical console so characters can be printed.
423 * Setting up page tables for the kernel
424 */
425 u_int
426 initarm(void *arg)
427 {
428 /*
429 * Heads up ... Setup the CPU / MMU / TLB functions
430 */
431 if (set_cpufuncs()) // starts PMC counter
432 panic("cpu not recognized!");
433
434 extern char ARM_BOOTSTRAP_LxPT[];
435 pmap_devmap_bootstrap((vaddr_t)ARM_BOOTSTRAP_LxPT, kobo_devmap);
436
437 cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
438
439 setup_ioports();
440
441 consinit();
442
443 init_clocks();
444
445 #ifdef KGDB
446 kgdb_port_init();
447 #endif
448
449 /* Talk to the user */
450 printf("\nNetBSD/evbarm (" ___STRING(EVBARM_BOARDTYPE) ") booting ...\n");
451
452 #ifdef BOOT_ARGS
453 char mi_bootargs[] = BOOT_ARGS;
454 parse_mi_bootargs(mi_bootargs);
455 #endif
456 bootargs[0] = '\0';
457
458 #ifdef VERBOSE_INIT_ARM
459 printf("initarm: Configuring system");
460 printf(", CLIDR=%010o CTR=%#x",
461 armreg_clidr_read(), armreg_ctr_read());
462 printf("\n");
463 #endif
464
465 #ifdef VERBOSE_INIT_ARM
466 printf("initarm: Configuring system ...\n");
467 #endif
468 /*
469 * Set up the variables that define the availability of physical
470 * memory.
471 */
472
473 /* Fake bootconfig structure for the benefit of pmap.c. */
474 bootconfig.dramblocks = 1;
475 bootconfig.dram[0].address = MEMSTART;
476 bootconfig.dram[0].pages = (MEMSIZE * 1024 * 1024) / PAGE_SIZE;
477
478 psize_t ram_size = bootconfig.dram[0].pages * PAGE_SIZE;
479
480 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
481 const bool mapallmem_p = true;
482 if (ram_size > (KERNEL_VM_BASE - KERNEL_BASE)) {
483 printf("%s: dropping RAM size from %luMB to %uMB\n",
484 __func__, (unsigned long) (ram_size >> 20),
485 (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
486 ram_size = KERNEL_VM_BASE - KERNEL_BASE;
487 }
488 KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
489 #else
490 const bool mapallmem_p = false;
491 #endif
492
493 arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
494 KERNEL_BASE_PHYS);
495 arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0,
496 kobo_devmap, mapallmem_p);
497
498 #ifdef BOOTHOWTO
499 boothowto |= BOOTHOWTO;
500 #endif
501
502 return initarm_common(KERNEL_VM_BASE, KERNEL_VM_SIZE, NULL, 0);
503 }
504
505 void
506 consinit(void)
507 {
508 static int consinit_called = 0;
509
510 if (consinit_called)
511 return;
512
513 consinit_called = 1;
514
515 #ifdef CONSDEVNAME
516
517 #if NIMXUART > 0
518 imxuart_set_frequency(IMXUART_FREQ, 2);
519 #endif
520
521 #if (NIMXUART > 0) && defined(IMXUARTCONSOLE)
522 if (strcmp(consdevname, "imxuart") == 0) {
523 paddr_t consaddr;
524 #ifdef CONADDR
525 consaddr = CONADDR;
526 #else
527 consaddr = IMX51_UART2_BASE;
528 #endif
529 imxuart_cnattach(&armv7_generic_bs_tag, consaddr, consrate, consmode);
530 return;
531 }
532 #endif
533
534 #endif
535
536 #if (NWSDISPLAY > 0) && defined(IMXEPDCCONSOLE)
537 #if NUKBD > 0
538 ukbd_cnattach();
539 #endif
540 {
541 extern void kobo_cnattach(void);
542 kobo_cnattach();
543 }
544 #endif
545 }
546
547 #ifdef KGDB
548 #ifndef KGDB_DEVNAME
549 #define KGDB_DEVNAME "imxuart"
550 #endif
551 #ifndef KGDB_DEVMODE
552 #define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
553 #endif
554
555 const char kgdb_devname[20] = KGDB_DEVNAME;
556 int kgdb_mode = KGDB_DEVMODE;
557 int kgdb_addr = KGDB_DEVADDR;
558 extern int kgdb_rate; /* defined in kgdb_stub.c */
559
560 void
561 kgdb_port_init(void)
562 {
563 #if (NIMXUART > 0)
564 if (strcmp(kgdb_devname, "imxuart") == 0) {
565 imxuart_kgdb_attach(&armv7_generic_bs_tag, kgdb_addr,
566 kgdb_rate, kgdb_mode);
567 return;
568 }
569
570 #endif
571 }
572 #endif
573