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.

  • Resolved

How to use UART0 as debug console in Linux on OMAP L138

Intellectual 255 points

Replies: 7

Views: 8233

Dear All.

I have got a customized OMAP L138 board.

it use UART0 as debug console(instead of the originall UART2),

UART1 & UART2 (COM1 & COM2) as communication interface with external devices.

Also I have made a customized u-boot (from DaVinci-PSP-SDK-03.20.00.12),

and successfully make use of the UART0 as debug console through some PINMUX effort.

Now when I move on to customize the linux kernel to  use UART0 as default console,I stucked here.

I noticed that in arch/arm/mach-davinci/board-da850-evm.c ,there is some function to init serial device:

    #ifdef CONFIG_SERIAL_8250_CONSOLE
    static int __init da850_evm_console_init(void)
    {
            return add_preferred_console("ttyS", 2, "115200");
    }
    console_initcall(da850_evm_console_init);
    #endif
and I simply changed the "ttyS", "2" for "ttyS","0".

then commented out some code that used to disable UART0 and UART1:

        __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
        __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);

Also I changed the u-boot environment variable "bootargs".

changed console=ttyS2,115200n8 to console=ttyS0,1,115200n8.

But still I was unable to see anyting else atfer the "Starting kernel ..." prompt.

Did I have some misunderstanding between console and serial port(UART) or something else?

If I have to use UART0 as debug console and UART1 and UART2 for other purpose with the Linux source code(from  DaVinci-PSP-SDK-03.20.00.12).

How can I do that with the PSP-SDK?

Could someone point it out for me?

Thanks a lot.

  • Hi William,

    There are additional UART number related changes to be done in arch/arm/mach-davinci/include/mach/uncompress.h function get_uart_base(). With this fixed the "Uncompressing Linux" message should appear.

    Further debug can be done by enabling low level debug (CONFIG_DEBUG_LL). Low level debug relies on code in arch/arm/mach-davinci/include/mach/debug-macro.S to return the UART base address correctly.

    Please note the debugging tips using CONFIG_DEBUG_LL in ARM Linux FAQ page here: http://www.arm.linux.org.uk/mailinglists/faq.php#f6

    Some more tips here: http://processors.wiki.ti.com/index.php/FAQ_for_DaVinci_Linux

    Thanks,

    Sekhar

  • In reply to Sekhar Nori:

    Hi Sekhar,

    I used the linux-03.20.00.08 or linux-03.20.00.12 compiled uImage.It works fine on the Spectrum Digital EVM board.

    I didn't expect so much revision work on the davinci  PSP linux source code.

    My purpose is simply, just to change the default UART2 debug console to UART0, 

    and to make linux running on my customized board, first of all, make everyting outputs to UART0.

    I thought it would involves some replacement of device addresses.Is it overkill to make more changes to more codes?

     

    Since the difference (the arch-specified code) between linux-03.20.00.08 or linux-03.20.00.12 is notable.

    Does it enough or necessary to  revise this two files (arch/arm/mach-davinci/include/mach/{uncompress.h,debug-macro.S})

    to meet my simply requirment.

    Thanks,

    William

     

  • In reply to Sekhar Nori:

    I tried to check on the CONFIG_DEBUG_LL with 'make menuconfig' on linux-03.20.00.12,but I didn't find this config option there.

     So I think maybe this config option is removed from this version.

  • In reply to Sekhar Nori:

    I fixed the UART base address in arch/arm/mach-davinci/include/mach/{uncompress.h,debug-macro.S},and I got the "Uncompressing Linux... done, booting the kernel." message.But I can't get further messages appear on the console,it just hangs here.

    Is there any more works to be done to fix this?

    Thanks,

    William

  • In reply to William Young:

    Hello,

    William Young

    I tried to check on the CONFIG_DEBUG_LL with 'make menuconfig' on linux-03.20.00.12,but I didn't find this config option there.

     So I think maybe this config option is removed from this version.

     

    Here is some information more on the configuration option:

     CONFIG_DEBUG_LL:                                                        
      │                                                                         
      │ Say Y here to include definitions of printascii, printch, printhex      
      │ in the kernel.  This is helpful if you are debugging code that          
      │ executes before the console is initialized.                             
      │                                                                         
      │ Symbol: DEBUG_LL [=n]                                                   
      │ Prompt: Kernel low-level debugging functions                            
      │   Defined at arch/arm/Kconfig.debug:66                                  
      │   Depends on: DEBUG_KERNEL [=y]                                         
      │   Location:                                                             
      │     -> Kernel hacking        

    Please use this along with the patch to printk.c described in ARM Linux FAQ I pointed to earlier to get early debug output.

    Thanks,

    Sekhar

  • In reply to Sekhar Nori:

    Hi,

    Sorry for my careless!

    I did the kernel configuration you mentioned and I got this:

    -------------------------------------------------------------------------------------

    ## Booting kernel from Legacy Image at c0700000 ...
       Image Name:   Linux-2.6.33-rc4
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    1770684 Bytes =  1.7 MB
       Load Address: c0008000
       Entry Point:  c0008000
       Verifying Checksum ... OK
       Loading Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel
    <5>Linux version 2.6.33-rc4 (william@ubuntu) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #2 PREEMPT Wed Aug 11 09:05:03 CST 2010
    CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: DaVinci DA850/OMAP-L138/AM18xx EVM
    Memory policy: ECC disabled, Data cache writeback
    <7>On node 0 totalpages: 8192
    <7>free_area_init_node: node 0, pgdat c037f810, node_mem_map c0397000
    <7>  DMA zone: 64 pages used for memmap
    <7>  DMA zone: 0 pages reserved
    <7>  DMA zone: 8128 pages, LIFO batch:0
    <6>DaVinci da850/omap-l138 variant 0x0
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
    <5>Kernel command line: mem=32M console=ttyS0,115200n8 root=/dev/ram0 rw initrd=0xc1180000,4M ip=off eth=11:22:33:44:55:66
    <6>PID hash table entries: 128 (order: -3, 512 bytes)
    <6>Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
    <6>Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
    <6>Memory: 32MB = 32MB total
    <5>Memory: 24712KB available (3272K code, 222K data, 140K init, 0K highmem)
    <6>SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    <6>Hierarchical RCU implementation.
    <6>NR_IRQS:245
    Console: colour dummy device 80x30
    <6>Calibrating delay loop... <c>149.50 BogoMIPS (lpj=747520)
    Mount-cache hash table entries: 512
    <6>CPU: Testing write buffer coherency: ok
    <6>DaVinci: 144 gpio irqs
    <6>regulator: core version 0.5
    <6>NET: Registered protocol family 16
    bio: create slab <bio-0> at 0
    <5>SCSI subsystem initialized
    <6>usbcore: registered new interface driver usbfs
    <6>usbcore: registered new interface driver hub
    <6>usbcore: registered new device driver usb
    <3>tps6507x 1-0048: Read from reg 0xd failed
    <3>set_machine_constraints: failed to enable VDCDC1
    <3>tps6507x 1-0048: failed to register tps6507x-pmic regulator
    <3>pca953x 1-0020: failed reading register
    <6>i2c-gpio i2c-gpio.1: using pins 20 (SDA) and 21 (SCL)
    <6>Switching to clocksource timer0_1
    <6>musb_hdrc: version 6.0, cppi4.1-dma, host, debug=0
    <6>Waiting for USB PHY clock good...
    <7>DA830 OTG revision 4ea11003, PHY 32972, control 00
    <7>musb_hdrc: ConfigData=0x06 (UTMI-8, dyn FIFOs, SoftConn)
    <7>musb_hdrc: MHDRC RTL version 1.800
    <7>musb_hdrc: setup fifo_mode 2
    <7>musb_hdrc: 8/9 max ep, 3904/4096 memory
    <6>musb_hdrc: USB Host mode controller at fee00000 using DMA, IRQ 58
    <6>musb_hdrc musb_hdrc: MUSB HDRC host driver
    <6>musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 1
    <6>hub 1-0:1.0: USB hub found
    <6>hub 1-0:1.0: 1 port detected
    <7>Registered /proc/driver/musb_hdrc
    <6>NET: Registered protocol family 2
    <6>IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    <6>TCP established hash table entries: 1024 (order: 1, 8192 bytes)
    <6>TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
    <6>TCP: Hash tables configured (established 1024 bind 1024)
    <6>TCP reno registered
    <6>UDP hash table entries: 256 (order: 0, 4096 bytes)
    <6>UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    <6>NET: Registered protocol family 1
    <6>RPC: Registered udp transport module.
    <6>RPC: Registered tcp transport module.
    <6>RPC: Registered tcp NFSv4.1 backchannel transport module.
    <6>Trying to unpack rootfs image as initramfs...
    <6>rootfs image is not initramfs (no cpio magic); looks like an initrd
    <6>Freeing initrd memory: 4096K

    ---------------------------------------------------------------------------------------------

    It stops here.I compare this log message to my evm's,and find that the next line will be "EMAC: MII PHY configured, RMII PHY will not be functional".

    I have an RMII instead of MII on my customized board.So I think maybe RMII is not properly initialized.

    But I have checked on "CONFIG_DA850_UI_RMII=y".Is this means that I still have someting to do with the RMII code?

    Thanks,

    William

     

  • No need to commented out the code

    "   //     __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
        //    __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
    "

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.