All of lore.kernel.org
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] pci: option for configurable delay between pci reset and pci bus scan
Date: Mon, 30 May 2011 09:45:08 +0200	[thread overview]
Message-ID: <m2pqn0pr7f.fsf@ohwell.denx.de> (raw)
In-Reply-To: <20110527184348.2dfb025e@wker> (Anatolij Gustschin's message of "Fri, 27 May 2011 18:43:48 +0200")

Hi Anatolij,

> Hi Detlev,
>
> On Fri, 27 May 2011 17:26:24 +0200
> Detlev Zundel <dzu@denx.de> wrote:
> ...
>> > PCI cards might need some time after reset to respond.
>> > On some boards (mpc5200 or mpc8260 based) the PCI bus reset is
>> > deasserted at pci_board_init() time, so we can not use available
>> > "pcidelay" option for waiting before pci bus scan here. Add an option
>> > to delay bus scan by setting "pci_scan_delay" environment variable.
>> 
>> Hm, I'm not sure I understand the situation, so please correct me.  We
>> have a "pcidelay" variable, which is used to wait before
>> pci_board_init() (I'm not counting the semantically different usage in
>> the esd boards).  This does not fit your need, so you define
>> pci_scan_delay which is used _after_ pci_init_board(), correct?
>
> yes, this is correct.
>
>> If this is correct, then why don't you keep your new delay also in the
>> pci_init() function so that the delays are easily visible on code
>> inspection?  But wait, if this is only needed for this very board, then
>> why don't we put the delay into digsys pci_init_board?  Actually I think
>> this is the best way, as on this board we always need the delay as PCI
>> is not hotplug.
>
> The reason for not keeping new delay in pci_init() is:
> pci_init_board() starts scanning the bus (calls pci_hose_scan()), so
> when pci_init_board() returns, it is too late, the scanning is
> already completed.
>
> digsy's pci_init_board() just calls pci_mpc5xxx_init(), when the latter
> returns, the scanning is completed, too. PCI reset is de-asserted in
> pci_mpc5xxx_init(), so I thought about putting the delay there, but
> similar situation is also on mpc8260 based boards, pci_mpc8250_init()
> de-asserts PCI reset and waits on some boards (on MPC8266ADS 1 sec).
> So the problem is not only digsy specific. The needed time after reset
> before config cycles could be up to 1 sec, depending on the card. The
> pci spec 2.2 allows this.

Ah, thanks for shedding some light on this.  Now I see how you arrived
at the solution you propose.

> I think that it would be good to run arch specific pci init not from
> the pci_board_init(), but from pci_init(). Then we can add delay
> code in the board specific way. This would reduce the code duplication,
> too. Currently we have the same pci_init_board() for many 5200 boards,
> except for mvbc_p and mvsmr boards.

Yes, I have also noticed the massive code duplicatin here.  But as I
obviously didn't even understand the problem I didn't ponder changing
it ;)

>> Apart from that, having two variables "pcidelay" and "pci_scan_delay" we
>> would need good documentation to explain their usage - the names do not
>> help (me) much ;)
>
> Sure. If there is an agreement to solve the problem as proposed in
> the patch, I'll add the documentation in the next patch version.
> Maybe someone have a better idea, lets wait a bit for other comments.
> Actually I don't like the name of the variable, it is somehow
> misleading. Any better name?

Sorry, no idea.  If we are stuck stuck with "pcidelay" (which I think we
are), then it is hard to come up with a differentiating name.  So good
documentation will have to make up for the lack of good names ;)

Cheers
  Detlev

-- 
Old mathematicians never die; they just lose some of their functions.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

  reply	other threads:[~2011-05-30  7:45 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-27 14:08 [U-Boot] [PATCH 0/5] mpc5200: digsy_mtc: update for next Anatolij Gustschin
2011-05-27 14:08 ` [U-Boot] [PATCH 1/5] video: mb862xx: support Coral-PA controller Anatolij Gustschin
2011-07-04 22:32   ` Anatolij Gustschin
2011-05-27 14:08 ` [U-Boot] [PATCH 2/5] pci: option for configurable delay between pci reset and pci bus scan Anatolij Gustschin
2011-05-27 15:26   ` Detlev Zundel
2011-05-27 16:43     ` Anatolij Gustschin
2011-05-30  7:45       ` Detlev Zundel [this message]
2011-05-30 14:10         ` Stefan Roese
2011-10-11 15:16           ` Anatolij Gustschin
2011-10-11 15:18           ` [U-Boot] [PATCH 1/1] pci: move pcidelay code to new location just before PCI " Anatolij Gustschin
2011-10-12  6:58             ` Matthias Fuchs
2011-10-12  8:44             ` [U-Boot] [PATCH v2 " Anatolij Gustschin
2011-10-12  9:42               ` Stefan Roese
2011-10-13 12:50               ` Matthias Fuchs
2011-10-13 13:03                 ` Stefan Roese
2011-10-13 13:08                   ` Matthias Fuchs
2011-10-15 20:16               ` Wolfgang Denk
2011-05-27 14:08 ` [U-Boot] [PATCH 3/5] mpc5200: digsy_mtc: enable pci_scan_delay option Anatolij Gustschin
2011-05-27 15:28   ` Detlev Zundel
2011-10-13 15:19   ` [U-Boot] [PATCH] mpc5200: digsy_mtc: fix detection of Coral-PA Anatolij Gustschin
2011-10-14  8:19     ` Detlev Zundel
2011-10-15 20:19     ` Wolfgang Denk
2011-05-27 14:08 ` [U-Boot] [PATCH 4/5] mpc5200: digsy_mtc: add support for graphic extension board Anatolij Gustschin
2011-05-27 15:33   ` Detlev Zundel
2011-05-27 17:56     ` Anatolij Gustschin
2011-05-30  7:16   ` [U-Boot] [PATCH v2 " Anatolij Gustschin
2011-06-06  9:49     ` Detlev Zundel
2011-07-27 21:26     ` Wolfgang Denk
2011-05-27 14:08 ` [U-Boot] [PATCH 5/5] mpc5200: digsy_mtc: add support for writing 'appreg' value Anatolij Gustschin
2011-05-27 15:36   ` Detlev Zundel
2011-05-27 18:00     ` Anatolij Gustschin
2011-05-30  7:18   ` [U-Boot] [PATCH v2 " Anatolij Gustschin
2011-07-16 20:26     ` [U-Boot] [PATCH] digsy_mtc: move board into vendor dir and add vendor logo Anatolij Gustschin
2011-07-27 21:27       ` Wolfgang Denk
2011-07-27 21:26     ` [U-Boot] [PATCH v2 5/5] mpc5200: digsy_mtc: add support for writing 'appreg' value Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2pqn0pr7f.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.