Basic input w.r.t SPI device mapping on NVIDIA T30

Hi team ,

Since i am working with driver binding using board-file for first , apologies if any of my question miss any well known info .
I am referring to board-apalis_t30.c « mach-tegra « arm « arch - linux-toradex.git - Linux kernel for Apalis and Colibri modules based on which could team member please help me for :-

  1. As per my little understanding:-

apalis_t30_register_spidev = Create 2 instance of SPIDEV device
apalis_t30_mcp2515_can_init = Create 2 instance of MCP2515 device

[ which will thus call the probe function of respective protocol driver
when their respective driver code calls spi_register_driver ]

If this understanding is correct , then i am unable to appreciate what role does “apalis_t30_spi_init” & "apalis_t30_spi_devices " plays here ?

( what are these 4 instance of platform_device when we already have
2-instance of mcp2515 & 2-instance of spidev as mentioned in point-1 above )

  1. As per my understanding of this board-file logic , i should look & replicate
    apalis_t30_mcp2515_can_init equivalent logic for our spi device

I am basically trying to understand how is the spi device being register here so that i could use this as template for my work. something like :-

static struct tegra_spi_device_controller_data adc7606dev_controller_data = {
	.cs_hold_clk_count	= 1,
	.cs_setup_clk_count	= 1,
	.is_hw_based_cs		= 1,
};

static struct spi_board_info tegra_adc7606spi_devices[] __initdata = {
	{
		.bus_num		= 0,		/* SPI1: Apalis SPI1 */
		.chip_select		= 0,
		.controller_data	= &adc7606dev_controller_data,
		.irq			= 0,
		.max_speed_hz		= 150000000,
		.modalias		= "adc7606dev",
		.mode			= SPI_MODE_0,
		.platform_data		= NULL,
	},

};

/* 
 * In static void __init apalis_t30_init(void) function 
 * Comment apalis_t30_register_spidev  apalis_t30_mcp2515_can_init 
 * Add an line to call apalis_t30_register_adc7606dev
 */
static void __init apalis_t30_register_adc7606dev(void)
{
	spi_register_board_info(tegra_adc7606spi_devices,ARRAY_SIZE(tegra_adc7606spi_devices));
}
  1. As per my little understanding:-

apalis_t30_register_spidev = Create 2 instance of SPIDEV device
apalis_t30_mcp2515_can_init = Create 2 instance of MCP2515 device

[ which will thus call the probe function of respective protocol driver when their respective driver code calls spi_register_driver ]

Yes, exactly.

If this understanding is correct , then i am unable to appreciate what role does “apalis_t30_spi_init” & “apalis_t30_spi_devices” plays here ?

The apalis_t30_spi_init() configures clocking and other controller side settings with them apalis_t30_spi_devices really being the controller aka master side devices.

(what are these 4 instance of platform_device when we already have 2-instance of mcp2515 & 2-instance of spidev as mentioned in point-1 above)

Those are the controller aka master vs. the device aka slave driver side of things really.

  1. As per my understanding of this board-file logic , i should look & replicate apalis_t30_mcp2515_can_init equivalent logic for our spi device

Yes, that sounds about right.

Marcel ,
Thanks a lot for taking time & helping …BIG THANKS !!!