linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re:Re: dw-spi driver bus number
@ 2016-08-11  1:13 First Light
       [not found] ` <019c75c3a7b841eba898ca3542f2b5c9-wl3m2YU9F6jCyPUpEMH5pa0bRtRcJeJQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: First Light @ 2016-08-11  1:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Edison Chen, Fang Yingju, Flare


> On Wed, Aug 10, 2016 at 08:50:08AM +0000, First Light wrote:
>
> Please don't top post, reply in line with needed context.  This allows readers
> to readily follow the flow of conversation and understand what you are talking
> about and also helps ensure that everything in the discussion is being
> addressed.

[First Light] Sorry, Mark, My email client is not quite open source style. I'm trying to use this way.
>
> > But I found the dynamically assigned bus number is always -1.?
>
> > I have two spi buses, both get the -1 bus number.
>
> That shouldn't happen, if it does it's a bug - users should never see a negative
> bus number, the core should dynamically assign one if it is given a negative bus
> number.  Can you check what happens in spi_register_master()?  That's
> where the dynamic bus number should be being assigned.
[First Light] I'm using linux-4.4 kernel, and In spi-dw-mmio.c,
I see that:
 LINE74: dws->bus_num = pdev-->id; (dws is struct dw_spi, not struct spi_master)
 LINE107: ret=dw_spi_add_host(&pdev->dev, dws);
spi_register_master is called in dw_spi_add_host.
So dws->bus_num is not dynamically assigned, but just one static value since pdev->id is not inited.
I think you are saying spi_master->bus_num is dynamically inited. Right?

I also see that spi_master->bus_num is inited with dws->bus_number first, and the it finds that this bus_num < 0,
then uses of_alias_get_id or atomic_dec_return(&dyn_bus_id) to get a dynamic one.

Question is: do we need to update dws->bus_num again? It is -1 always.
From /proc/interrupts, I check irq of spi, and the last column is the device name,
unlike other devices, like i2c0, i2c1,..., spi's device name is dw_spi65535,
both of the spi devices I registered have this name. 65535 is -1.
There must be something unmatched.

Thanks
Xiaoguang






This email and any attachments thereto may contain private, confidential, and privileged material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

此电子邮件及附件所包含内容具有机密性,且仅限于接收人使用。未经允 许,禁止第三人阅读、复制或传播该电子邮件中的任何信息。如果您不属于以上电子邮件的目标接收者,请您立即通知发送人并删除原电子邮件及其相关的附件。

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

* Re: Re: dw-spi driver bus number
       [not found] ` <019c75c3a7b841eba898ca3542f2b5c9-wl3m2YU9F6jCyPUpEMH5pa0bRtRcJeJQ@public.gmane.org>
@ 2016-08-11 16:40   ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2016-08-11 16:40 UTC (permalink / raw)
  To: First Light
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA, Edison Chen, Fang Yingju, Flare

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

On Thu, Aug 11, 2016 at 01:13:27AM +0000, First Light wrote:
> > On Wed, Aug 10, 2016 at 08:50:08AM +0000, First Light wrote:

Please fix your mail client to word wrap within paragraphs at something
substantially less than 80 columns.  Doing this makes your messages much
easier to read and reply to.

> > That shouldn't happen, if it does it's a bug - users should never see a negative
> > bus number, the core should dynamically assign one if it is given a negative bus
> > number.  Can you check what happens in spi_register_master()?  That's
> > where the dynamic bus number should be being assigned.

> [First Light] I'm using linux-4.4 kernel, and In spi-dw-mmio.c,
> I see that:
>  LINE74: dws->bus_num = pdev-->id; (dws is struct dw_spi, not struct spi_master)
>  LINE107: ret=dw_spi_add_host(&pdev->dev, dws);
> spi_register_master is called in dw_spi_add_host.
> So dws->bus_num is not dynamically assigned, but just one static value since pdev->id is not inited.

This doesn't matter so long as the default value passed into
spi_register_master() is negative.

> I think you are saying spi_master->bus_num is dynamically inited. Right?

Yes, but by spi_register_master().

> I also see that spi_master->bus_num is inited with dws->bus_number first, and the it finds that this bus_num < 0,
> then uses of_alias_get_id or atomic_dec_return(&dyn_bus_id) to get a dynamic one.

> Question is: do we need to update dws->bus_num again? It is -1 always.

No, just pass that into the core and the core should take care of
things.

> unlike other devices, like i2c0, i2c1,..., spi's device name is dw_spi65535,
> both of the spi devices I registered have this name. 65535 is -1.
> There must be something unmatched.

Please trace through the code and try to see where this is happening,
this doesn't seem to be affecting other users.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2016-08-11 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11  1:13 Re:Re: dw-spi driver bus number First Light
     [not found] ` <019c75c3a7b841eba898ca3542f2b5c9-wl3m2YU9F6jCyPUpEMH5pa0bRtRcJeJQ@public.gmane.org>
2016-08-11 16:40   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).