Forums » Software Development »
MAX3100 (SPI to UART bridge) driver not working
Added by Zhe Ji over 9 years ago
Hello,
We are trying to compile the driver for MAX3100 and we are unable to get the node /dev/ttyMAX in spite of these changes:
1. Changed baseboard-mityarm335x-devkit-3359.c to the following:
#include <linux/serial_max3100.h>
static __init void baseboard_setup_spi0_devices(void) { setup_pin_mux(spi0_pin_mux); spi_register_board_info(baseboard_spi0_slave_info, ARRAY_SIZE(baseboard_spi0_slave_info)); //baseboard_setup_audio(); //baseboard_setup_ts(); }
static struct spi_board_info baseboard_spi0_slave_info[] = { { .modalias = "spi:max3100", .controller_data = &spi0_ctlr_data, .platform_data = &max3100_plat_data, .irq = IRQ_EINT12, .max_speed_hz = 5*1000*1000, .bus_num = 0, .chip_select = 0, .mode = SPI_MODE_0, },
2. Went into Linux menuconfig and enabled support for MAX3100 chip (device drivers --> character devices --> serial --> MAX3100)
We changed the max3100.c to print some things in the boot log, and its says that the __init max3100_init(void) is being executed and is fine.
But we still can't see the "/dev"ttyMAX" it is supposed to create.
Any suggestions?
Bindu
Replies (3)
RE: MAX3100 (SPI to UART bridge) driver not working - Added by Jonathan Cormier over 9 years ago
The init driver gets called when the driver is added to the kernel. If its built in then this happens early on, if its built as a module then this happens when you insert the module. The probe function gets called when the driver gets tied to a device and thus should be getting called when you run the spi_register... call. If you aren't seeing the probe then that usually indicates your modalias is incorrect.
Looking at the max3100.c file and searching for a name string I get two possible names. "ttyMAX" and "max3100". If I recall correctly using the .driver.name wasn't the correct name for other drivers i've used in the past. So I would start by trying the "ttyMAX" name first. Make sure to check for your print statment in the max3100_probe function to verify if you've gotten the correct name.
static struct uart_driver max3100_uart_driver = { .owner = THIS_MODULE, .driver_name = "ttyMAX", .dev_name = "ttyMAX", .major = MAX3100_MAJOR, .minor = MAX3100_MINOR, .nr = MAX_MAX3100, };
static struct spi_driver max3100_driver = { .driver = { .name = "max3100", .bus = &spi_bus_type, .owner = THIS_MODULE, }, .probe = max3100_probe, .remove = __devexit_p(max3100_remove), .suspend = max3100_suspend, .resume = max3100_resume, };
RE: MAX3100 (SPI to UART bridge) driver not working - Added by Bindu Jagannatha over 9 years ago
Jonathan,
Thank you for the answer; using the following helped with respect to creating the /dev/ttyMAX0:
static struct spi_board_info baseboard_spi0_slave_info[] = { { .modalias = "max3100", .controller_data = &spi0_ctlr_data, .platform_data = &max3100_plat_data, .irq = -1, .max_speed_hz = 5*1000*1000, .bus_num = 1, .chip_select = 1, .mode = SPI_MODE_0, },
However, it goes into kernel oops when I try to test a small program on the port. Is it due to the value of .irq? How does one decide what value that should be (the max3100.c said use IRQ_EINT12, but that doesn't exist).
Bindu
RE: MAX3100 (SPI to UART bridge) driver not working - Added by Jonathan Cormier over 9 years ago
Bindu,
You can look at how the other baseboard_spi0_slave_info have the irq filled in. Its possible that simply not setting the value might be the correct action.