This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3352: External uart in GPMC not work

Part Number: AM3352


Tool/software: Linux

Hello,

Our custom board wants to use GPMC to connect to external UART chip(EXAR XR16C850). But when we execute command: echo 123 > /dev/ttyS1, command hangs for a while( Ctrl+C can return to command prompt) and sometimes show message like “serial8250: too much work for irq42”. Also there is not any output form COM port.

We use Processor SDK v02.00.02.11(Kernel 4.1). CS0 is used for UART chip and the address PIN starts from A6 as following schematic:

Device Tree:

 nandflash_pins_default: nandflash_pins_default {

	pinctrl-single,pins = <
		0xa0 (PIN_INPUT_PULLUP | MUX_MODE1) /* lcd_data0.gpmc_a0 */
		0x58 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_a6.gpmc_a6 */
		0x5c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_a7.gpmc_a7 */
		0x60 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_a8.gpmc_a8 */
		0x64 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_a9.gpmc_a9 */

		0x0 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad0.gpmc_ad0 */
		0x4 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad1.gpmc_ad1 */
		0x8 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad2.gpmc_ad2 */
		0xc (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad3.gpmc_ad3 */
		0x10 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad4.gpmc_ad4 */
		0x14 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad5.gpmc_ad5 */
		0x18 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad6.gpmc_ad6 */
		0x1c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad7.gpmc_ad7 */

		0x20 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad8.gpmc_ad8 */
		0x24 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad9.gpmc_ad9 */
		0x28 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad10.gpmc_ad10 */
		0x2c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad11.gpmc_ad11 */
		0x30 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad12.gpmc_ad12 */
		0x34 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad13.gpmc_ad13 */
		0x38 (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad14.gpmc_ad14 */
		0x3c (PIN_INPUT_PULLUP | MUX_MODE0)	/* gpmc_ad15.gpmc_ad15 */

		0x7c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_csn0.gpmc_csn0  */
		0x80 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_csn1.gpmc_csn1  */
		0x84 (PIN_OUTPUT | MUX_MODE1)		/* gpmc_csn2.gpmc_be1n */
		0x90 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_advn_ale.gpmc_advn_ale */
		0x94 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_oen_ren.gpmc_oen_ren */
		0x98 (PIN_OUTPUT | MUX_MODE0)		/* gpmc_wen.gpmc_wen */
		0x9c (PIN_OUTPUT | MUX_MODE0)		/* gpmc_be0n_cle.gpmc_be0n_cle */
	>;
};

/* XR16C850 irq GPIOs. */
ext_uart_pins: ext_uart_pins {
	pinctrl-single,pins = <
		0x120 0x27	/* mii1_txd2.gpio0_17, INPUT | MODE7 COM1 irq */
	>;
};

&gpmc {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&nandflash_pins_default &ext_uart_pins>;

	ranges = <0 0 0x01000000 0x1000000>; /* EXAR0: ChipSelect: 0, offset: 0, address: 0x01000000, length:16MB(0x1000000) */

	uart@0,0 {/* chip select: 0, offset: 0 */
		compatible = "ns16850";
		reg = <0 0 0x200>;      /* CS0, offset: 0x100, IO size: 0x200 */
		reg-shift = <6>; 
		reg-io-width = <1>; 
		interrupt-parent = <&gpio0>;
		interrupts = <17 IRQ_TYPE_EDGE_RISING>;  /* GPIO 0_17, active high */
		clock-frequency = <14745600>; /* uartclk */
		bank-width = <1>; /* 8 bit device */

		/* read timing */
		gpmc,cs-on-ns = <0>;// gpmc_t->cs_on
		gpmc,adv-on-ns = <0>; /* t.adv_on = t.cs_on; */
		gpmc,adv-rd-off-ns = <1>; /* gpmc_t->adv_rd_off */
		gpmc,oe-on-ns = <2>;/* t.adv_rd_off + 1 */
		gpmc,oe-off-ns = <8>; /* t.oe_on + 6 */
		gpmc,cs-rd-off-ns = <9>; /* t.oe_off + 1 */
		gpmc,access-ns = <9>; /* t.cs_rd_off */
		gpmc,rd-cycle-ns = <10>; /* t.access + 1 */
		/* write timing */
		gpmc,adv-wr-off-ns = <1>; /* t.adv_wr_off */
		gpmc,we-on-ns = <2>; /* t.adv_wr_off + 1 */
		gpmc,we-off-ns = <8>; /* t.we_on + 6 */
		gpmc,cs-wr-off-ns = <9>; /* t.we_off + 1 */
		gpmc,wr-cycle-ns = <9>; /* t.cs_wr_off */
	};
};

Kernel boot message: 

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 4.1.18-gbbe8cfc (adv@adv-machine) (gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05) ) #1 PREEMPT Fri Jun 2 15:15:42 CST 2017
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: TI AM335x EVM
[    0.000000] cma: Reserved 24 MiB at 0x8d000000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (neon )
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 64960
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=PARTUUID=00000000-02 rw rootfstype=ext4 rootwait
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Memory: 226036K/262144K available (6023K kernel code, 228K rwdata, 2016K rodata, 260K init, 229K bss, 11532K reserved, 24576K cma-reserved, 0K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc07e202c   (8041 kB)
[    0.000000]       .init : 0xc07e3000 - 0xc0824000   ( 260 kB)
[    0.000000]       .data : 0xc0824000 - 0xc085d3e0   ( 229 kB)
[    0.000000]        .bss : 0xc0860000 - 0xc08997c8   ( 230 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  Additional per-CPU info printed with stalls.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000016] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000040] clocksource timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000054] OMAP clocksource: timer1 at 24000000 Hz
[    0.000264] Console: colour dummy device 80x30
[    0.000294] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.000303] This ensures that you still see kernel messages. Please
[    0.000310] update your kernel commandline.
[    0.000331] Calibrating delay loop... 597.60 BogoMIPS (lpj=2988032)
[    0.119041] pid_max: default: 32768 minimum: 301
[    0.119157] Security Framework initialized
[    0.119219] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.119233] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.120034] Initializing cgroup subsys blkio
[    0.120064] Initializing cgroup subsys memory
[    0.120112] Initializing cgroup subsys devices
[    0.120131] Initializing cgroup subsys freezer
[    0.120148] Initializing cgroup subsys perf_event
[    0.120181] CPU: Testing write buffer coherency: ok
[    0.120605] Setting up static identity map for 0x80008200 - 0x80008270
[    0.122377] devtmpfs: initialized
[    0.134190] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.150471] omap_hwmod: debugss: _wait_target_disable failed
[    0.207424] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.210114] pinctrl core: initialized pinctrl subsystem
[    0.211683] NET: Registered protocol family 16
[    0.214456] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.239041] cpuidle: using governor ladder
[    0.269032] cpuidle: using governor menu
[    0.274125] OMAP GPIO hardware version 0.1
[    0.282450] omap-gpmc 50000000.gpmc: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/nandflash_pins_default, deferring probe
[    0.284604] No ATAGs?
[    0.284633] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.331677] edma 49000000.edma: TI EDMA DMA engine driver
[    0.335945] SCSI subsystem initialized
[    0.336554] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[    0.336726] pps_core: LinuxPPS API ver. 1 registered
[    0.336737] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.336779] PTP clock support registered
[    0.337355] omap-mailbox 480c8000.mailbox: no available mbox devices found
[    0.338511] Switched to clocksource timer1
[    0.352553] NET: Registered protocol family 2
[    0.353568] TCP established hash table entries: 2048 (order: 1, 8192 bytes)
[    0.353613] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.353651] TCP: Hash tables configured (established 2048 bind 2048)
[    0.353739] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.353765] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.353958] NET: Registered protocol family 1
[    0.354395] RPC: Registered named UNIX socket transport module.
[    0.354412] RPC: Registered udp transport module.
[    0.354420] RPC: Registered tcp transport module.
[    0.354429] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.357533] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.357642] audit: initializing netlink subsys (disabled)
[    0.357713] audit: type=2000 audit(0.330:1): initialized
[    0.367680] VFS: Disk quotas dquot_6.6.0
[    0.367955] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.370872] NFS: Registering the id_resolver key type
[    0.370952] Key type id_resolver registered
[    0.370963] Key type id_legacy registered
[    0.371055] jffs2: version 2.2. (NAND) (SUMMARY)  c 2001-2006 Red Hat, Inc.
[    0.373267] NET: Registered protocol family 38
[    0.373352] io scheduler noop registered
[    0.373370] io scheduler deadline registered
[    0.373437] io scheduler cfq registered (default)
[    0.374560] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
[    0.377836] Serial: 8250/16550 driver, 10 ports, IRQ sharing disabled
[    0.382731] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 156, base_baud = 3000000) is a 8250
[    0.986282] console [ttyS0] enabled
[    0.990242]  serial8250_register_8250_port: mapbase:44e09000, membase:fffffffff9e09000, irq=156
[    1.000454] [drm] Initialized drm 1.1.0 20060810
[    1.018885] brd: module loaded
[    1.028366] loop: module loaded
[    1.032741] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.098582] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    1.104731] davinci_mdio 4a101000.mdio: detected phy mask fffffff5
[    1.112778] libphy: 4a101000.mdio: probed
[    1.116832] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver TI TLK10X 10/100 Mbps PHY
[    1.126558] davinci_mdio 4a101000.mdio: phy[3]: device 4a101000.mdio:03, driver TI TLK10X 10/100 Mbps PHY
[    1.137035] cpsw 4a100000.ethernet: Detected MACID = 00:d0:c9:cc:00:02
[    1.144936] cpsw 4a100000.ethernet: cpsw: Detected MACID = 00:00:00:00:cc:00
[    1.153799] mousedev: PS/2 mouse device common for all mice
[    1.159621] i2c /dev entries driver
[    1.164601] omap_hsmmc 48060000.mmc: Got CD GPIO
[    1.209279] ledtrig-cpu: registered to indicate activity on CPUs
[    1.219760] oprofile: no performance counters
[    1.224290] oprofile: using timer interrupt.
[    1.229160] Initializing XFRM netlink socket
[    1.233559] NET: Registered protocol family 17
[    1.238133] NET: Registered protocol family 15
[    1.242847] Key type dns_resolver registered
[    1.248604] omap_voltage_late_init: Voltage driver support not added
[    1.257604] cpufreq: ondemand governor failed, too long transition latency of HW, fallback to performance governor
[    1.268629] ThumbEE CPU extension supported.
[    1.272950] Registering SWP/SWPB emulation handler
[    1.280875] omap-gpmc 50000000.gpmc: GPMC revision 6.0
[    1.286064] gpmc_mem_init: disabling cs 0 mapped at 0x0-0x1000000
[    1.292664] omap-gpmc 50000000.gpmc: gpmc process child: uart
[    1.298990] omap-gpmc 50000000.gpmc: gpmc child name: /ocp/gpmc@50000000/uart@0,0
[    1.306984] omap-gpmc 50000000.gpmc: gpmc cs in reg: 0
[    1.312769] omap-gpmc 50000000.gpmc: gpmc cs bank-width: 2
[    1.336139] 1000000.uart: ttyS1 at MMIO 0x1000000 (irq = 42, base_baud = 921600) is a XR16850
[    1.345488] serial8250_register_8250_port: mapbase:1000000, membase:ffffffffd0988000, irq=42
[    1.356355] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    1.362086] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.370653] hctosys: unable to open rtc device (rtc0)
[    1.380184] wlan-en-regulator: disabling
[    1.384341] mmc0: new high speed SDHC card at address aaaa
[    1.391164] Waiting for root device PARTUUID=00000000-02...
[    1.397441] mmcblk0: mmc0:aaaa SL08G 7.40 GiB
[    1.403775]  mmcblk0: p1 p2
[    1.956527] EXT4-fs (mmcblk0p2): recovery complete
[    1.962992] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.971229] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.980357] devtmpfs: mounted
[    1.983824] Freeing unused kernel memory: 260K (c07e3000 - c0824000)
INIT: version 2.88 booting
Error opening /dev/fb0: No such file or directory
Starting udev
[    2.680795] udevd[75]: starting version 182
[    3.097194] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    3.200513] omap_rtc 44e3e000.rtc: rtc core: registered 44e3e000.rtc as rtc0
[    3.346247] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
[    3.408096] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
bootlogd: cannot allocate pseudo tty: No such file or directory
[    4.030540] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
[    4.059750] PM: am33xx_prepare_push_sram_idle: Unable to get sram pool for ocmcram
[    4.261721] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
[    4.314718] random: dd urandom read with 43 bits of entropy available

udevadm settle - timeout of 3 seconds reached, the event queue contains:
  /sys/devices/platform/ocp/48060000.mmc/mmc_host/mmc0/mmc0:aaaa/block/mmcblk0/mmcblk0p1 (728)
  /sys/devices/platform/ocp/48060000.mmc/mmc_host/mmc0/mmc0:aaaa/block/mmcblk0/mmcblk0p2 (729)
  /sys/devices/virtual/block/ram3 (881)
  /sys/devices/virtual/block/ram4 (882)
  /sys/devices/virtual/block/ram5 (883)
  /sys/devices/virtual/block/ram7 (885)
  /sys/devices/virtual/block/ram8 (886)
  /sys/devices/virtual/block/ram9 (887)
[    6.721977] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Thu Mar  9 08:54:17 UTC 2017
INIT: Entering runlevel: 5
Configuring network interfaces... [    7.764827] net eth0: initializing cpsw version 1.12 (0)
[    7.848903] net eth0: phy found : id is : 0x2000a211
udhcpc (v1.23.1) started
Sending discover...
[    9.849181] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
Sending discover...
Sending select for 192.168.100.50...
Lease of 192.168.100.50 obtained, lease time 600
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFADDR: No such device
done.
Starting telnet daemon.
Starting watchdog: [   12.466805] NET: Registered protocol family 10
[  OK  ]
Starting syslogd/klogd: done
Starting thttpd.
Starting crond: OK
Enabling thermal zones...
/etc/rc5.d/S98thermal-zone-init: line 7: /sys/class/thermal/thermal_zone*/mode: No such file or directory

 _____                    _____           _         _
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
              |___|                    |___|

Arago Project http://arago-project.org am335xevm /dev/ttyO0

Arago 2016.03 am335xevm /dev/ttyO0

am335xevm login:

 Thank you.