LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Best location for call to spi_register_board_info () on PPC (MPC5200)
@ 2006-12-13 20:59 Henk Stegeman
  2006-12-13 21:08 ` Joakim Tjernlund
  2006-12-13 21:18 ` Ben Warren
  0 siblings, 2 replies; 3+ messages in thread
From: Henk Stegeman @ 2006-12-13 20:59 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 641 bytes --]

I'm working on an SPI procol driver on the MPC52XX.
I spend some time in trying to find the best location for calling
spi_register_board_info () (which basically registers the relations between
protocol drivers and the SPI chip selects).

I wish to call this function from my copy of the
arch/ppc/platforms/Lite5200.c file  since these relations are
board-specific, however I found that placing the call in any of these
functions (eg. lite5200_setup_arch) results in an -ENOMEM from the
spi_register_board_info () call.

Now I'm calling spi_register_board_info () from the spi controller driver
which is soo ugly.

Thanks in advance,

Henk.

[-- Attachment #2: Type: text/html, Size: 688 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Best location for call to spi_register_board_info () on PPC (MPC5200)
  2006-12-13 20:59 Best location for call to spi_register_board_info () on PPC (MPC5200) Henk Stegeman
@ 2006-12-13 21:08 ` Joakim Tjernlund
  2006-12-13 21:18 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Joakim Tjernlund @ 2006-12-13 21:08 UTC (permalink / raw)
  To: 'Henk Stegeman', linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

 


  _____  

From: linuxppc-embedded-bounces+joakim.tjernlund=lumentis.se@ozlabs.org
[mailto:linuxppc-embedded-bounces+joakim.tjernlund=lumentis.se@ozlabs.org] On Behalf Of Henk Stegeman
Sent: den 13 december 2006 21:59
To: linuxppc-embedded@ozlabs.org
Subject: Best location for call to spi_register_board_info () on PPC (MPC5200)


I'm working on an SPI procol driver on the MPC52XX.
I spend some time in trying to find the best location for calling spi_register_board_info () (which basically registers the
relations between protocol drivers and the SPI chip selects). 

I wish to call this function from my copy of the arch/ppc/platforms/Lite5200.c file  since these relations are board-specific,
however I found that placing the call in any of these functions (eg. lite5200_setup_arch) results in an -ENOMEM from the
spi_register_board_info () call. 

Now I'm calling spi_register_board_info () from the spi controller driver which is soo ugly.

Thanks in advance,

Henk.  
 
Try doing it as an arch_initcall() in Lite5200.c, I do that in my custom board port file


[-- Attachment #2: Type: text/html, Size: 2148 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Best location for call to spi_register_board_info () on PPC (MPC5200)
  2006-12-13 20:59 Best location for call to spi_register_board_info () on PPC (MPC5200) Henk Stegeman
  2006-12-13 21:08 ` Joakim Tjernlund
@ 2006-12-13 21:18 ` Ben Warren
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Warren @ 2006-12-13 21:18 UTC (permalink / raw)
  To: Henk Stegeman; +Cc: linuxppc-embedded

Henk,

On Wed, 2006-12-13 at 21:59 +0100, Henk Stegeman wrote:
> I'm working on an SPI procol driver on the MPC52XX.
> I spend some time in trying to find the best location for calling
> spi_register_board_info () (which basically registers the relations
> between protocol drivers and the SPI chip selects). 
> 
> I wish to call this function from my copy of the
> arch/ppc/platforms/Lite5200.c file  since these relations are
> board-specific, however I found that placing the call in any of these
> functions (eg. lite5200_setup_arch) results in an -ENOMEM from the
> spi_register_board_info () call. 
> 
> Now I'm calling spi_register_board_info () from the spi controller
> driver which is soo ugly.
> 
> Thanks in advance,

Here's how I do it, in my board-specific /arch/powerpc/platforms/83xx
file.  Somebody please comment if I'm doing it wrong:

struct spi_board_info qsPrism_spi_devices[2] = 
{
	{
		.modalias = "SPI_SWITCH",
		.bus_num = 0,
		.chip_select = 0,
		.max_speed_hz = 2000000,
	},
	{
		.modalias = "SPI_SWITCH",
		.bus_num = 0,
		.chip_select = 1,
		.max_speed_hz = 2000000,
	},
};

static int __init qsPrism_spi_board_init(void)
{
	return spi_register_board_info(qsPrism_spi_devices, 2);
}

arch_initcall(qsPrism_spi_board_init);

*********************
SPI_SWITCH is my protocol driver.  The 'arch_initcall' adds this to a
list of functions that gets called at init time.  There is a hierarchy
of these registrations that you can research, but 'arch' is somewhere in
the middle, IIRC, and is a point where memory should be available.

regards,
Ben

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-12-13 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-13 20:59 Best location for call to spi_register_board_info () on PPC (MPC5200) Henk Stegeman
2006-12-13 21:08 ` Joakim Tjernlund
2006-12-13 21:18 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox