public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] pci: mx6: Implement reset callback
Date: Mon, 3 Feb 2014 19:17:26 +0100	[thread overview]
Message-ID: <201402031917.26507.marex@denx.de> (raw)
In-Reply-To: <52EF83D4.7010708@denx.de>

On Monday, February 03, 2014 at 12:56:04 PM, Stefano Babic wrote:
> Hi Marek,
> 
> sorry for late answer.
> 
> On 28/01/2014 20:32, Marek Vasut wrote:
> > On Tuesday, January 28, 2014 at 04:06:12 PM, Stefano Babic wrote:
> >> Hi Marek,
> >> 
> >> On 24/01/2014 16:25, Marek Vasut wrote:
> >>> Add a callback so that a board can implement it's own specific routine
> >>> to toggle the port's nRESET line.
> >>> 
> >>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>> Cc: Stefano Babic <sbabic@denx.de>
> >>> ---
> >>> 
> >>>  drivers/pci/pcie_imx.c | 12 +++++++++---
> >>>  1 file changed, 9 insertions(+), 3 deletions(-)
> >>> 
> >>> diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
> >>> index 0a74867..b554075 100644
> >>> --- a/drivers/pci/pcie_imx.c
> >>> +++ b/drivers/pci/pcie_imx.c
> >>> @@ -450,6 +450,13 @@ static int imx6_pcie_init_phy(void)
> >>> 
> >>>  	return 0;
> >>>  
> >>>  }
> >>> 
> >>> +__weak int imx6_pcie_toggle_reset(void)
> >>> +{
> >>> +	/* This function ought to be overridden ! */
> >>> +	puts("WARNING: Make sure the PCIe nRESET line is connected!\n");
> >>> +	return 0;
> >>> +}
> >>> +
> >> 
> >> Just to know: I assume that the nRESET is implemented with a GPIO.
> > 
> > Yes, that's how it is on all designs I saw thus far (but see below).
> > 
> >> I am
> >> expecting then in the board files a diffusion of imx6_pcie_toggle_reset,
> >> where the oinly difference is the number of GPIO.
> > 
> > The problem is, there are boards with no nRESET connected to the slot.
> 
> Any reference to the Sabrelite is, of course, purely coincidental. But
> this is a hardware bug on a specific board and we should not adjust all
> boards according to the broken one.

Well ... SL and N6X both. For all I care, we can have #define 
MX6_PCIE_RESET_GPIO and if that's not defined, puke out this warning. And 
ultimatelly let this function be overriden anyway in case people used some GPIO 
expander or whatnot. So the change to this would be:

__weak int imx6_pcie_toggle_reset(void)
{
#ifdef CONFIG_MX6_PCIE_RESET_GPIO
 gpio_set...
 mdelay();
 gpio_set...
 mdelay();
#else
 puts("Oh yeah, broken design :-(\n");
#endif
}

This should effectivelly give you all the flexibility, what do you say?

> What do you think to check the validity of the GPIO ? For example,
> setting the GPIO to -1 for sabrelite and printing the message if the
> GPIO is negative or not defined ?
> 
> > These
> > boards are broken, thus will print the warning message.
> 
> Right - but there is nothing we can do it. The hardware must be fixed.

CCing Troy, Eric, Tim, surely this will make their day ;-)

Best regards,
Marek Vasut

  reply	other threads:[~2014-02-03 18:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 15:25 [U-Boot] [PATCH] pci: mx6: Implement reset callback Marek Vasut
2014-01-28 15:06 ` Stefano Babic
2014-01-28 19:32   ` Marek Vasut
2014-02-03 11:56     ` Stefano Babic
2014-02-03 18:17       ` Marek Vasut [this message]
2014-02-03 18:40         ` Eric Nelson
2014-02-03 19:33           ` Marek Vasut
2014-02-03 19:57             ` Eric Nelson
2014-02-03 20:16               ` Marek Vasut
2014-02-03 20:54                 ` Eric Nelson
2014-02-03 23:34                   ` Marek Vasut
2014-02-04  0:57                     ` Eric Nelson
2014-02-04 11:25                       ` Marek Vasut
2014-02-03 20:12         ` Stefano Babic
2014-01-31  5:33 ` Tim Harvey

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=201402031917.26507.marex@denx.de \
    --to=marex@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox