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.

Problem adding driver to kernel

Other Parts Discussed in Thread: AM3517, OMAP-L138

For our design we need additional Irda uarts. Therefor we added a SC16is752 to I2c.

For adding the driver I added in the drivers/serial.kconfig

config SERIAL_SC16IS752
       tristate "SC16IS752 chips"
       depends on I2C && GPIOLIB
       select SERIAL_CORE
       help
         gpio driver for SC16IS752 I2C UARTs.

in drivers/serial/makefile

obj-$(CONFIG_SERIAL_SC16IS752) += sx16is752.o

in drivers/serial/serial_core.h

#define PORT_SC16IS7X2	20	/* SC16IS7x2 SPI UART */
#define PORT_MAX_8250 20 /* max port ID */

and the SC16is752.c file in the drivers/serial folder.

Then in the config of the evm am3517_evm_defconfig added 'CONFIG_SERIAL_SC16IS752=y'

If I now build the kernel I get following message:

  CC      drivers/serial/8250.o
  CC      drivers/serial/8250_early.o
make[3]: *** No rule to make target `drivers/serial/sx16is752.o', needed by `drivers/serial/built-in.o'.  Stop.
make[2]: *** [drivers/serial] Error 2
make[1]: *** [drivers] Error 2
make[1]: Leaving directory `/usr/local/ti-sdk-am3517-evm/board-support/linux-2.6.37-psp04.02.00.07.sdk'
make: *** [linux] Error 2

Question now is are there more configurations to be updated to add this driver?

Regards
Marcel Stumpel





  • Hi Marcel,

    Marcel Stumpel said:

    ....

    obj-$(CONFIG_SERIAL_SC16IS752) += sx16is752.o

    ....

    and the SC16is752.c file in the drivers/serial folder.

    Then in the config of the evm am3517_evm_defconfig added 'CONFIG_SERIAL_SC16IS752=y'

    If I now build the kernel I get following message:

      CC      drivers/serial/8250.o
      CC      drivers/serial/8250_early.o
    make[3]: *** No rule to make target `drivers/serial/sx16is752.o', needed by `drivers/serial/built-in.o'.  Stop.
    make[2]: *** [drivers/serial] Error 2
    make[1]: *** [drivers] Error 2
    make[1]: Leaving directory `/usr/local/ti-sdk-am3517-evm/board-support/linux-2.6.37-psp04.02.00.07.sdk'
    make: *** [linux] Error 2

    Your file name should be match with object name, use either SC16is752.c & SC16is752.o or sx16is752.c & sx16is752.o

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!


  • Hi,

    I am using the chip SC16IS752 with my OMAP-L138 Processor. Please share the 'SC16IS752' driver source code and explain how to integrate this driver with main

    kernel. Please let us know the brief steps.

    Thanks.,

    Francis

  • This is an older post, but I'm answering to add to the answers database for future searches.

    I used the source code from here:

    https://lkml.org/lkml/2011/1/7/177

    and then manually made the changes to the files as described in the patch.

    To get it integrated with the kernel I modified the /drivers/serial/Makefile to include:

    obj-m += sc16is7x2.o

    I wanted it as a loadable module.  You can also edit the Kconfig files to be able to add/change it in the menuconfig.

    Then I added the following to my board file, assuming spi is already setup (I'm using a modified DM8168 evm):

    #include <linux/serial_sc16is7x2.h>
    static struct sc16is7x2_platform_data ti816x_sc16is7x2_data = {
           .uartclk        = 14745600,
           .uart_base      = 0,
           .gpio_base      = 180,
           .label          = "eser",
    };

     

    struct spi_board_info __initdata ti816x_spi_slave_info[] = {
           {
                  .modalias     = "sc16is7x2",       /* driver name */
                  .platform_data       = &ti816x_sc16is7x2_data,
                  .max_speed_hz = 4000000,    /* max speed of SC16IS752 is 4Mbit/s */
                  .bus_num      = 1,          /* only one bus on DM8168 */
                  .chip_select  = 3,          /* SPI_SCS3 */
           },
    };

    Then build and compile the kernel, when the driver is loaded it will automatically export "eser0" and "eser1" to /dev/ where you can use them like standard serial ports.  Also "gpiochip180" is exported to /sys/class/gpio/ which you can use like standard gpio.


    Aaron

  • Hi,

    Thanks for your response. I don't have SPI interface in my processor, i have only I2C interface which i connect this sc16is7x2 through I2C interface I2C to UART. 

    what you have mentioned the platform driver for SPI based, could you please share the I2C based driver and platform driver access.

    Please give your suggestions.

    Thanks,

    Francis

  • Hi Francis,

    Unfortunately I do not have an I2C based driver - I couldn't find one when I was doing my development either...

    I've heard that you can modify some of the io calls in the SPI driver to get it to work for I2C, but I don't know the details of how to do this.

    Best Regards,

    Aaron

  • Hi Aaron,

    Thanks for your response.

    Ok, i will try to convert SPI driver to I2C. Could you share the complete driver code of SPI for "sc16is7x2". please share the working code for modifying this in to I2C based.


    Thanks

  • Hi Francis, 

    I've attached the code for the SPI driver which I got from here: https://lkml.org/lkml/2011/1/7/177

    You will still need to create "serial_sc16is7x2.h" and modify the "serial_core.h" (included with your linux) as described in the link above, and then build it.  I'm sorry but I can't give you any direction on how to modify it for I2C.

    Hope this helps,

    Aaron