Skip to contentSkip to conversation

Linuxppc-embedded Digest, Vol 39, Issue 48

DISCUSSION fabio777 2 participants 3 messages Nov 27, 2007 – Nov 28, 2007 1 message not in the archive

lore
Share & tools
lore

fabio777

author
#1 lore raw
In reply to a message not in the archive

Thanks Ben,

Here it is

static struct fsl_spi_platform_data k_platform_data = {
.initial_spmode = 0,
.bus_num = 1,
.max_chipselect = 1,
/* board specific information */
.activate_cs = k_cs_activate, .deactivate_cs = k_cs_deactivate,
.sysclk = 266,
};

static struct spi_board_info spi_board_info[] __initdata = { {
.modalias = "kplus",
.platform_data = &k_platform_data,
.max_speed_hz = 120000,
.bus_num = 1,
.chip_select = 0,
},
};

struct platform_device k_plus = {
.name = "kplus",
.id = 1,
.dev = {
.platform_data = &k_platform_data,
},
};

platform_device_register(&k_plus);

spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info))

and then calls spi_register_driver(&k_driver);

I can't get the into the *probe functions.

Thanks

Quoted 18 lines
Quoted 3 lines · fabio777 wrote:

Has anyone been using this driver ?

I use it, on ARCH=powerpc, though.

Quoted 4 lines

For legacy reasons I need to keep the ppc=arch however I haven't found out how to get this driver probed at start-up even basing my init on Lublock.

The driver's expecting a platform device with name "mpc83xx_spi" to be registered in board init code. If you post your init code I may be able to help.

regards,
Ben

#2 lore raw

Re: SPI driver for spi_mpc83xx

Fabio,

Note: I've changed the e-mail subject back to the original. In the future, please ensure that it remains intact.

Quoted 7 lines · fabio777 wrote:

Thanks Ben,

Here it is

static struct fsl_spi_platform_data k_platform_data = { .initial_spmode = 0,
.bus_num = 1,

Probably should be bus_num = 0

Quoted 7 lines

.max_chipselect = 1,
/* board specific information */
.activate_cs = k_cs_activate,
.deactivate_cs = k_cs_deactivate,
.sysclk = 266,
};

Quoted 5 lines

static struct spi_board_info spi_board_info[] __initdata = { { .modalias = "kplus",
.platform_data = &k_platform_data,
.max_speed_hz = 120000,
.bus_num = 1,

Again, bus_num probably should be 0

Quoted 7 lines

.chip_select = 0,
},
};

struct platform_device k_plus = {
.name = "kplus",

name should be "mpc83xx_spi". At initialization, the SPI controller driver searches the registered platform devices (models of board hardware) for a match. Without a match, it gives up.

Quoted 8 lines

.id = 1,
.dev = {
.platform_data = &k_platform_data,
},
};

platform_device_register(&k_plus);

Do you add the SPI controller's resources (base address and IRQ?) You'll need to in order for this to work. On my board, I use 'platform_device_register_simple()', passing the name and the two resources, then call 'platform_add_data()', passing in the platform data structure.

Quoted 2 lines

spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info))

Good

Quoted 1 line

and then calls spi_register_driver(&k_driver);

I don't think this last call is needed.

Quoted 4 lines

I can't get the into the *probe functions.
Thanks

regards,
Ben

author
#3 lore raw

Re: SPI driver for spi_mpc83xx

Thanks Ben
works.

Quoted 55 lines · Ben Warren

Fabio,

Note: I've changed the e-mail subject back to the original. In the future, please ensure that it remains intact.

Quoted 7 lines · fabio777 wrote:

Thanks Ben,

Here it is

static struct fsl_spi_platform_data k_platform_data = { .initial_spmode = 0,
.bus_num = 1,

Probably should be bus_num = 0

Quoted 7 lines

.max_chipselect = 1,
/* board specific information */
.activate_cs = k_cs_activate,
.deactivate_cs = k_cs_deactivate,
.sysclk = 266,
};

Quoted 5 lines

static struct spi_board_info spi_board_info[] __initdata = { { .modalias = "kplus",
.platform_data = &k_platform_data,
.max_speed_hz = 120000,
.bus_num = 1,

Again, bus_num probably should be 0

Quoted 7 lines

.chip_select = 0,
},
};

struct platform_device k_plus = {
.name = "kplus",

name should be "mpc83xx_spi". At initialization, the SPI controller driver searches the registered platform devices (models of board hardware) for a match. Without a match, it gives up.

Quoted 8 lines

.id = 1,
.dev = {
.platform_data = &k_platform_data,
},
};

platform_device_register(&k_plus);

Do you add the SPI controller's resources (base address and IRQ?) You'll need to in order for this to work. On my board, I use 'platform_device_register_simple()', passing the name and the two resources, then call 'platform_add_data()', passing in the platform data structure.

Quoted 2 lines

spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info))

Good

Quoted 1 line

and then calls spi_register_driver(&k_driver);

I don't think this last call is needed.

Quoted 4 lines

I can't get the into the *probe functions.
Thanks

regards,
Ben