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.

How to rebuilld UARTdriver?

Hi,

 

I'm currently using a beaglebaord Xm Rev C with the android 2.3.4 devkit 2.1 image that I've successfully built. I would like to make changes on the UART driver (rowboat-android/kernel/drivers/serial/omap-serial.c) to add management of some GPIO. 

 

I'm new to linux so please be indulgent ^^.

The uart driver is built with the kernel but as I am in devellopement, I don't want to rebuild all the kernel for debug the driver, so my question is:

How can I rebuild only the file omap-serial.c as module to after load it manualy?

Can you show me a little makefile to just build this file as module?

Thanks by advance.

Steve.

  • Ok so I've built the omap-serial as module but I have a warning:

     

    WARNING: "uart_console_device" [~/rowboat-android/kernel/drivers/serial/omap-serial.ko] undefined!

    When I try to load the module I have this error: 

    insmod omap-serial.ko

    omap_serial: Unknown symbol uart_console_device 

    In fact the struct uart_console_device is defined in drivers/serial/serial_core.c.

    Here it is my makefile:

     #

    # Makefile

    #

    obj-m := omap-serial.o 

    all:  

    make -C ~/rowboat-android/kernel ARCH=arm CROSS_COMPILE=arm-eabi- M=$(PWD) modules 

    clean:

    make -C ~/rowboat-android/kernel ARCH=arm CROSS_COMPILE=arm-eabi- M=$(PWD) clean

     

    How can I do to build it right?

     

     

  • Can you explain a little more about why you need to control GPIO from within the UART driver? I am not sure I fully understand the goal.

  • To be honest, most people are using the UART for the Linux console and so typically it is built into the kernel and never as a module. The warning you have is because there is an external dependancy on the function "uart_console_device()" that you are missing. I took a quick look but did not see an easy way to build this as a module due to external dependencies.

    By the way, what are you using for the console when you are trying to insmod the driver? If you are using the UART interface and the UART driver is built into the kernel then this would not work as the kernel is already using the UART.

    Jon

     

  • Hi Jon,

    Yes in fact I need to have acces to modem I/O status like DTR, DCD, DSR, RI through the ioctl function. I don't have found that these signals are wired to physical pin on the OMAP processor, so I would like to patch the omap-serial to manage GPIO  in get_mctrl and set_mctrl function.

     

    When I'm trying to insmod the driver I use the UART_3 which is connected to the RS232 connector on the Beagleboard. My goal is to use UART_2 and few GPIO present on the expansion header with my patched omap-serial module. I think I also will have to make some change in the omap_serial_init to use my patched driver only for UART_2 and in the mux config for select GPIO.

     

    Do you have any idea on how can I build this module with the dependency?

    Steve.

  • Hi Steve,

    Thanks for the info, this make sense.

    Could you try undefining CONFIG_SERIAL_CORE_CONSOLE in the kernel config?

    Cheers
    Jon

  • Hi, 

    After trying to insmod my patched omap-serial without success I've decided to compile the kernel.

    It is faster than I thought because it doesn't rebuild all files.

    Now I have other questions, I've had a gpio_request in the serial_omap_probe function, it works but do you think it is the best place to do it?

    The omap_serial driver is used for all beagleboard's UART, but I would like to add my gpio only for one UART. Do you have any idea on how to do this?

    I had thought to add a test condition on uart->num in the omap_serial_init_port function in mach-omap2/serial.c to initialize my gpio, but I'm not sure it's the right way to do so.

    BR,

    Steve.

  • Hi Steve,

    Personally, I would request the gpios in the board file for the beagle and then pass them to the serial driver as part of the platform data. You would need to add some fields to the "omap_uart_port_info" structure to pass these but that should not be a problem. The gpios used would be board specific and so I think that the board file is best. Then in the serial driver if the new elements you add to the structure are null then the driver should just ignore them and only use them for the uart port where they are specified. Hope that makes sense.

    Jon