UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

Use UARTLITE for Zynq-based Systems

Observer
Posts: 25
Registered: ‎04-21-2012

Use UARTLITE for Zynq-based Systems

We added a few UARTLITE devices to a custom board based on Zynq.

The board is running Linux 3.0 from the branch xilinx-14.1-build3-trd.

The device tree was updated to include those UARTLITE devices.

Rebooting the board there is no /dev/ttyULx created.

 

So I tried to reconfigure the Linux with "make menuconfig" and found no entry for UARTLITE.

 

Looking at the serial/Kconfig and found the UARTLITE as below:

 

config SERIAL_UARTLITE

    tristate "Xilinx uartlite serial port support"
    depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE
    select SERIAL_CORE
    help
      Say Y here if you want to use the Xilinx uartlite serial controller.

      To compile this driver as a module, choose M here: the
      module will be called uartlite.

I commented out the line "depends on PPC32 || MICROBLAZE || MFD_TIMBERDALE" to make the UARTLITE available in "make menuconfig". Select UARTLITE and recompile the linux to find the following errors:

 

scripts/kconfig/mconf Kconfig
#
# configuration written to .config
#


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

plu@ubuntu:~/proj/gcv/src/linux-xlnx$ less .config
plu@ubuntu:~/proj/gcv/src/linux-xlnx$ make ARCH=arm
scripts/kconfig/conf --silentoldconfig Kconfig
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      init/version.o
  LD      init/built-in.o
  CC      kernel/module.o
  GZIP    kernel/config_data.gz
  IKCFG   kernel/config_data.h
  CC      kernel/configs.o
  LD      kernel/built-in.o
  CC      drivers/tty/serial/amba-pl010.o
  CC      drivers/tty/serial/amba-pl011.o
  CC      drivers/tty/serial/uartlite.o
drivers/tty/serial/uartlite.c: In function 'ulite_receive':
drivers/tty/serial/uartlite.c:79:3: error: implicit declaration of function 'ioread32be' [-Werror=implicit-function-declaration]
drivers/tty/serial/uartlite.c: In function 'ulite_transmit':
drivers/tty/serial/uartlite.c:124:3: error: implicit declaration of function 'iowrite32be' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

make[3]: *** [drivers/tty/serial/uartlite.o] Error 1
make[2]: *** [drivers/tty/serial] Error 2
make[1]: *** [drivers/tty] Error 2
make: *** [drivers] Error 2
plu@ubuntu:~/proj/gcv/src/linux-xlnx$ git branches
git: 'branches' is not a git command. See 'git --help'.
plu@ubuntu:~/proj/gcv/src/linux-xlnx$ git branch
  master
* xilinx-14.1-build3-trd

 

HOW TO ENABLE THE UARTLITE DRIVER?

 

Thanks

Voyager
Posts: 260
Registered: ‎05-09-2008

Re: Use UARTLITE for Zynq-based Systems

Hi pullanlu,

 

you must change all "'ioread32be" and "iowrite32be" on "drivers/tty/serial/uartlite.c"

 

#define xuartlite_readl(offset)           ioread32(offset)
#define xuartlite_writel(val, offset)    iowrite32(val, offset)

 

but from my tests the serial does not work anyway.

 

On the "PL" section of Zync the Kernel drivers it is still quite immature.

 

Same problem with I2C and others device.

 

secureasm

 

Observer
Posts: 25
Registered: ‎04-21-2012

Re: Use UARTLITE for Zynq-based Systems

Hi secureasm,

 

With the changes you described, I was able to compile the uartdriver and see the device modes /dev/ttyULx created.

As you said, the serial interface did not work quite right.

 

We were able to see tx/rx and interrupt lines toggling when accessing the interface. However, the /proc/interrupts does not show increment of corresponding interrupt; and noting was seen from the 'microcom' output.

 

Has anyone successfully added a UARTLITE to Zynq PL?

 

Thanks

 

Pullan

Voyager
Posts: 260
Registered: ‎05-09-2008

Re: Use UARTLITE for Zynq-based Systems

Hi,

 

> Has anyone successfully added a UARTLITE to Zynq PL?

 

No, I tried in many ways but without success, the same applies for I2C and other peripherals.

 

I think this part is still "immature", I hope to be proven wrong ...

 

secureasm

Newbie
Posts: 1
Registered: ‎01-22-2013

Re: Use UARTLITE for Zynq-based Systems

Has anyone successfully added a UARTLITE to Zynq PL?

 

Yes,

It took some configuring of uartlite.c.

 

In ulite_startup(...), change the request_irq flags to:

 

ret = request_irq(port->irq, ulite_isr, IRQF_TRIGGER_RISING, "uartlite", port);

 

Also, add the axi-uartlite driver to __devinitdata :

 

static struct of_device_id ulite_of_match[] __devinitdata = {
{ .compatible = "xlnx,opb-uartlite-1.00.b", },
{ .compatible = "xlnx,xps-uartlite-1.00.a", },
{ .compatible = "xlnx,axi-uartlite-1.02.a", },
{}
};

 

This is what my device tree instantiation looks like:

 

serial@80000000 {
compatible = "xlnx,axi-uartlite-1.02.a";
reg = <0x80000000 0x1000>;
interrupts = < 0 54 4 >;
interrupt-parent = <&gic>;
clock = <50000000>;
};

 

Of course you'll have to change the interrupt, clock, and reg parameters to match your implementation.

 

I have attached my copy of uartlite.c for reference.

 

Jimmy

Explorer
Posts: 111
Registered: ‎06-23-2013

Re: Use UARTLITE for Zynq-based Systems

  It looks like Jimmy's very helpful changes are not yet in linux-xlnx/drivers/tty/serial/uartlite.c


Has anybody got a test application for uartlite to share ?

dogbytes
Explorer
Posts: 111
Registered: ‎06-23-2013

Re: Use UARTLITE for Zynq-based Systems

Got a test application but had to step back, no longer boots to login prompt,

with uartlite entries in the devicetree and xilinx_zynq_defconfig

CONFIG_SERIAL_UARTLITE=y

 

Bitfile was included in the boot.bif -> boot.bin

 

Hangs after,

uartlite 50000000.uartlite: failed to get alias id, errno -19
uartlite 50000000.uartlite: failed to get port-number

 

jimmy's uartlite.c got compile errors so we are using,

git log uartlite.c | more
commit 068160c0befae2e4d1cd98f781161424683339e9
Merge: 2530265 19f949f
Author: Michal Simek <michal.simek@xilinx.com>
Date:   Fri Mar 15 18:39:09 2013 +0100

Planning to add in,    { .compatible = "xlnx,axi-uartlite-1.02.a", },

 

 

dogbytes
Explorer
Posts: 111
Registered: ‎06-23-2013

How to build uartlite.ko ? Re: Use UARTLITE for Zynq-based Systems

If CONFIG_SERIAL_UARTLITE=y

then getting the ulite_probe errors of previous post, so trying to build uartlite.ko as a loadable module

Although drivers/tty/serial/uartlite.o is built, no uartlite.ko is found in linux-xlnx/lib/modules subtree.

What am I missing to build uartlite.ko ?

 

The .config has,

 

CONFIG_MODULES=y


#CONFIG_MODULE_FORCE_LOAD is not set dy20131216 make uartlite.ko
CONFIG_MODULE_FORCE_LOAD=y

CONFIG_SERIAL_UARTLITE=m

 

Our Ubuntu kernel was based on  3.8.0-xilinx-00015-gabc285b for a zc706 based custom board.

dogbytes
Explorer
Posts: 111
Registered: ‎06-23-2013

make ARCH=$ARCH modules Re: How to build uartlite.ko ? Re: Use UARTLITE for Zynq-based Systems

make ARCH=$ARCH modules

 

produced

  LD [M]  drivers/tty/serial/uartlite.ko

Alright then, (insmod, test, code, build) repeat.

Anybody have any tips about uartlite.c for Zynq ?

dogbytes
Explorer
Posts: 111
Registered: ‎06-23-2013

echo "ttyUL0hello" > /dev/ttyUL0 Re: make ARCH=$ARCH modules Re: How to build uartlite.ko ? Re: Use UARTLITE for Zynq-based Systems

Ah, this worked,

echo "ttyUL0hello" > /dev/ttyUL0

dogbytes