@@ -1220,14 +1220,17 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,{structdevice_node*np;unsignedinti;-constu32*sysclk;+constu32*qe_sysclk=0,*soc_sysclk=0;np=of_find_node_by_type(NULL,"qe");-if(!np)-return-ENODEV;+if(np)+qe_sysclk=of_get_property(np,"bus-frequency",NULL);++np=of_find_node_by_type(NULL,"soc");+if(np)+soc_sysclk=of_get_property(np,"bus-frequency",NULL);
Why not just:
np = of_find_node_by_type(NULL, "qe");
+ if (!np)
+ np = of_find_node_by_type(NULL, "soc");
if (!np)
return -ENODEV;
The other changes aren't needed that way.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Peter Korsgaard <jacmet@sunsite.dk> Date: 2007-10-03 16:05:00
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Hi,
Grant> Why not just:
Grant> np = of_find_node_by_type(NULL, "qe");
Grant> + if (!np)
Grant> + np = of_find_node_by_type(NULL, "soc");
Grant> if (!np)
Grant> return -ENODEV;
My first iteration did it like that, but then you don't get a -ENODEV
if the node is missing (and you'll end up using the wrong clock) and
it doesn't support processors with SPI on and off QE (if that
exists/will ever exist).
--
Bye, Peter Korsgaard
From: Grant Likely <hidden> Date: 2007-10-03 18:17:46
On 10/3/07, Peter Korsgaard [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Hi,
Grant> Why not just:
Grant> np = of_find_node_by_type(NULL, "qe");
Grant> + if (!np)
Grant> + np = of_find_node_by_type(NULL, "soc");
Grant> if (!np)
Grant> return -ENODEV;
My first iteration did it like that, but then you don't get a -ENODEV
if the node is missing (and you'll end up using the wrong clock) and
it doesn't support processors with SPI on and off QE (if that
exists/will ever exist).
Okay, but you should at least be able confine your determination of
which sysclk value to use to one part of the function. Otherwise, it
looks good.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
From: Kumar Gala <hidden> Date: 2007-10-03 22:11:02
On Oct 3, 2007, at 1:17 PM, Grant Likely wrote:
On 10/3/07, Peter Korsgaard [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
quoted
"Grant" == Grant Likely [off-list ref] writes:
Hi,
Grant> Why not just:
Grant> np = of_find_node_by_type(NULL, "qe");
Grant> + if (!np)
Grant> + np = of_find_node_by_type(NULL, "soc");
Grant> if (!np)
Grant> return -ENODEV;
My first iteration did it like that, but then you don't get a -ENODEV
if the node is missing (and you'll end up using the wrong clock) and
it doesn't support processors with SPI on and off QE (if that
exists/will ever exist).
Okay, but you should at least be able confine your determination of
which sysclk value to use to one part of the function. Otherwise, it
looks good.
Peter, can you respin this w/Grant's modification. I've grabbed the
other patches and applied them. waiting on this one.
- k
From: Peter Korsgaard <jacmet@sunsite.dk> Date: 2007-10-06 20:06:52
quoted
quoted
quoted
quoted
"Kumar" == Kumar Gala [off-list ref] writes:
Kumar> On Oct 3, 2007, at 11:01 PM, Stephen Rothwell wrote:
>> On Wed, 03 Oct 2007 17:43:50 +0200 Peter Korsgaard
>> [off-list ref] wrote:
>>>
>>> @@ -1220,14 +1220,17 @@ int __init fsl_spi_init(struct
>>> spi_board_info *board_infos,
>>> {
>>> struct device_node *np;
>>> unsigned int i;
>>> - const u32 *sysclk;
>>> + const u32 *qe_sysclk = 0, *soc_sysclk = 0;
>>
>> Please use NULL when referring to pointers.
Kumar> Peter, any chance of getting a respin. I'd like this to go
Kumar> into 2.6.24.
Certainly. Sorry for the delay, I have been offline for 2 days
building my house ..
---
fsl_spi_init: Support non-QE processors
On non-QE processors (mpc831x/mpc834x) the SPI clock is the SoC clock.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
---
arch/powerpc/sysdev/fsl_soc.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
@@ -1222,8 +1222,12 @@ int __init fsl_spi_init(struct spi_board_info *board_infos,unsignedinti;constu32*sysclk;+/* SPI controller is either clocked from QE or SoC clock */np=of_find_node_by_type(NULL,"qe");if(!np)+np=of_find_node_by_type(NULL,"soc");++if(!np)return-ENODEV;sysclk=of_get_property(np,"bus-frequency",NULL);
Kumar> Peter, any chance of getting a respin. I'd like this to go
Kumar> into 2.6.24.
Certainly. Sorry for the delay, I have been offline for 2 days
building my house ..
applied.
No problem, sounds like fun.
If you get a chance can you test my for-2.6.24 board to make SPI is
functional as you expect.
thanks
- k