linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ppc/sata-fsl: orphan config value: CONFIG_MPC8315_DS
@ 2012-05-17 17:08 Anthony Foiani
  2012-05-21  6:31 ` Li Yang-R58472
  0 siblings, 1 reply; 27+ messages in thread
From: Anthony Foiani @ 2012-05-17 17:08 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Robert P. J. Day, Jeff Garzik, ashish kalra, Adrian Bunk


Greetings.

I was occasionally running into problems at boot time on an
MPC8315-based board (derived from the MPC831xRDB, apparently), using
SATA to talk to an SSD.  My vendor suggested that I enable
CONFIG_MPC8315_DS.

That symbol is only found once in the entire kernel codebase:

  $ git checkout v3.4-rc7
  HEAD is now at 36be505... Linux 3.4-rc7

  $ git grep -nH CONFIG_MPC8315_DS
  drivers/ata/sata_fsl.c:729:#ifdef CONFIG_MPC8315_DS

There is no kconfig support for it at all.

It was added in 2007; further, this is the only commit in the entire
git history that contains this string:

   commit e7eac96e8f0e57a6e9f94943557bc2b23be31471
   Author: ashish kalra <ashish.kalra@freescale.com>
   Date:   Wed Oct 31 19:28:02 2007 +0800

       ata/sata_fsl: Move MPC8315DS link speed limit workaround to specific ifdef
       
       Signed-off-by: ashish kalra <ashish.kalra@freescale.com>
       Signed-off-by: Li Yang <leoli@freescale.com>
       Signed-off-by: Jeff Garzik <jeff@garzik.org>

   diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
   index 5892472..e076e1f 100644
   --- a/drivers/ata/sata_fsl.c
   +++ b/drivers/ata/sata_fsl.c
   @@ -652,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
           VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
           VPRINTK("CHBA  = 0x%x\n", ioread32(hcr_base + CHBA));
    
   +#ifdef CONFIG_MPC8315_DS
           /*
            * Workaround for 8315DS board 3gbps link-up issue,
            * currently limit SATA port to GEN1 speed
   @@ -664,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
           sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
           dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
                           temp);
   +#endif
    
           return 0;
    }

This otherwise-unsupported variable was noted by Robert Day in 2008;
Adrian Bunk suggested a patch, but the Freescale folks said that it
was for a not-yet-mainlined board, so the patch was dropped:

   http://marc.info/?l=linux-ide&m=121783965216004&w=2

As Robert notied again in 2010, it still wasn't mainlined:

   http://marc.info/?l=linux-ide&m=121783965216004&w=2

And, obviously, it still isn't today.

Can the Freescale people tell us exactly what we should be testing to
determine when to enforce this restriction?  A config variable that
points to a non-existent board doesn't seem much help.

Thanks,
Tony

^ permalink raw reply	[flat|nested] 27+ messages in thread
* Re: ppc/sata-fsl: orphan config value: CONFIG_MPC8315_DS
@ 2013-08-23 19:25 Scott Wood
  2013-08-23 23:41 ` Anthony Foiani
  2013-08-27 10:51 ` Xie Shaohui-B21989
  0 siblings, 2 replies; 27+ messages in thread
From: Scott Wood @ 2013-08-23 19:25 UTC (permalink / raw)
  To: Anthony Foiani
  Cc: Shaohui.Xie, Robert P.J.Day, linuxppc-dev@lists.ozlabs.org,
	Li Yang-R58472, Adrian Bunk

Bcc: 
Subject: Re: ppc/sata-fsl: orphan config value: CONFIG_MPC8315_DS
Reply-To: 
In-Reply-To: <g7gj9smnc.fsf@dworkin.scrye.com>

On Wed, May 08, 2013 at 06:04:39AM -0600, Anthony Foiani wrote:
> Anthony Foiani <tkil@scrye.com> writes:
> > Maybe I need to call ata_set_sata_spd as well.  Can I do that before
> > discovery, or should it be a part of the port_start callback?  And
> > if the latter, shouldn't it be handled within the ata core, instead
> > of expecting each host driver to do that call?
> 
> My final version calls sata_set_spd from within the hard reset
> callback for the fsl sata driver.
> 
> If there's a better place to put it, please let me know.
> 
> With this patch (and an appropriate entry in the device tree), the
> machine comes up and reports:
> 
>   # cd /sys/devices/e0000000.immr/e0019000.sata
> 
>   # find * -name '*_spd*' -print | xargs grep .
>   ata2/link2/ata_link/link2/sata_spd:1.5 Gbps
>   ata2/link2/ata_link/link2/hw_sata_spd_limit:1.5 Gbps
>   ata2/link2/ata_link/link2/sata_spd_limit:1.5 Gbps
> 
> Which is what I needed to see.
> 
> Thanks for the hints!
> 
> Best regards,
> Anthony Foiani
> 
> ---
> >From 357c96b4f31b457eca0b96147c749c21d0f4f086 Mon Sep 17 00:00:00 2001
> From: Anthony Foiani <anthony.foiani@gmail.com>
> Date: Wed, 8 May 2013 05:24:20 -0600
> Subject: [PATCH] sata: fsl: allow device tree to limit sata speed.
> 
> There used to be an "orphan" config symbol (CONFIG_MPC8315_DS) that
> would artificially limit SATA speed to generation 1 (1.5Gbps).
> 
> Since that config symbol got lost whenever any sort of configuration
> was done, we instead extract the limitation from the device tree,
> using a new name "sata-spd-limit".
> 
> Signed-off-by: Anthony Foiani <anthony.foiani@gmail.com>
> ---
>  .../devicetree/bindings/powerpc/fsl/board.txt      | 23 ++++++++++++++++++
>  drivers/ata/sata_fsl.c                             | 28 +++++++++++-----------
>  2 files changed, 37 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/powerpc/fsl/board.txt b/Documentation/devicetree/bindings/powerpc/fsl/board.txt
> index 380914e..9c9fed4 100644
> --- a/Documentation/devicetree/bindings/powerpc/fsl/board.txt
> +++ b/Documentation/devicetree/bindings/powerpc/fsl/board.txt
> @@ -67,3 +67,26 @@ Example:
>  			gpio-controller;
>  		};
>  	};
> +
> +* Maximum SATA Generation workaround
> +
> +Some boards advertise SATA speeds that they cannot actually achieve.
> +Previously, this was dealt with via the orphaned config symbol
> +CONFIG_MPC8315_DS.  We now have a device tree property
> +"sata-spd-limit" to control this.  It should live within the "sata"
> +block.
> +
> +Example:
> +
> +		sata@18000 {
> +			compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
> +			reg = <0x18000 0x1000>;
> +			cell-index = <1>;
> +			interrupts = <44 0x8>;
> +			interrupt-parent = <&ipic>;
> +			sata-spd-limit = <1>;
> +		};
>
> +By default, there is no limitation; if a value is given, it indicates
> +the maximum "generation" that should be negotiated.  Gen 1 is 1.5Gbps,
> +Gen 2 is 3.0Gbps.

This should go in Documentation/devicetree/bindings/ata/fsl-sata.txt.

As for the property name, I'd prefer "fsl,sata-speed-limit" or
"fsl,sata-max-generation".  Shaohui, do the driver bits look OK?

This patch should go via the linux-scsi list (note that Tejun Heo is now
the SATA maintainer).

-Scott

> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
> index d6577b9..9e3f3ec 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -726,20 +726,6 @@ static int sata_fsl_port_start(struct ata_port *ap)
>  	VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
>  	VPRINTK("CHBA  = 0x%x\n", ioread32(hcr_base + CHBA));
>  
> -#ifdef CONFIG_MPC8315_DS
> -	/*
> -	 * Workaround for 8315DS board 3gbps link-up issue,
> -	 * currently limit SATA port to GEN1 speed
> -	 */
> -	sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
> -	temp &= ~(0xF << 4);
> -	temp |= (0x1 << 4);
> -	sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp);
> -
> -	sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
> -	dev_warn(dev, "scr_control, speed limited to %x\n", temp);
> -#endif
> -
>  	return 0;
>  }
>  
> @@ -836,6 +822,11 @@ try_offline_again:
>  	 */
>  	ata_msleep(ap, 1);
>  
> +	/* if the device tree forces a speed limit, set it here. */
> +	ata_link_info(link, "setting speed (in hard reset)\n");
> +	DPRINTK("setting spd_limit\n");
> +	sata_set_spd(link);
> +
>  	/*
>  	 * Now, bring the host controller online again, this can take time
>  	 * as PHY reset and communication establishment, 1st D2H FIS and
> @@ -1444,6 +1435,15 @@ static int sata_fsl_probe(struct platform_device *ofdev)
>  		goto error_exit_with_cleanup;
>  	}
>  
> +	/* record speed limit if requested by device tree */
> +	if (!of_property_read_u32(ofdev->dev.of_node, "sata-spd-limit",
> +				  &temp)) {
> +		int i;
> +		for (i = 0; i < SATA_FSL_MAX_PORTS; ++i)
> +			host->ports[i]->link.hw_sata_spd_limit = temp;
> +		dev_warn(&ofdev->dev, "speed limit set to gen %u\n", temp);
> +	}
> +
>  	/* host->iomap is not used currently */
>  	host->private_data = host_priv;
>  

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

end of thread, other threads:[~2013-08-27 10:51 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17 17:08 ppc/sata-fsl: orphan config value: CONFIG_MPC8315_DS Anthony Foiani
2012-05-21  6:31 ` Li Yang-R58472
2012-05-26  6:53   ` Anthony Foiani
2012-05-29 18:02     ` Scott Wood
2012-05-29 22:07       ` Anthony Foiani
2012-05-29 22:57         ` Scott Wood
2012-05-30 10:59           ` Li Yang
2012-05-30 20:07             ` Anthony Foiani
2012-05-30 20:14           ` Anthony Foiani
2012-05-30 20:20             ` Scott Wood
2012-05-30 20:52               ` Anthony Foiani
2013-04-30  6:41             ` Anthony Foiani
2013-04-30 18:15               ` Scott Wood
2013-05-01  0:34                 ` Anthony Foiani
2013-05-01  0:42                   ` Scott Wood
2013-05-01  2:06                     ` Anthony Foiani
2013-05-01 18:05                       ` Scott Wood
2013-05-01 23:35                         ` Anthony Foiani
2013-05-02  0:13                           ` Scott Wood
2013-04-30 21:35               ` Jeff Garzik
2013-05-02  6:37                 ` Anthony Foiani
2013-05-08 12:04                   ` Anthony Foiani
  -- strict thread matches above, loose matches on Subject: below --
2013-08-23 19:25 Scott Wood
2013-08-23 23:41 ` Anthony Foiani
2013-08-23 23:47   ` Scott Wood
2013-08-24  8:03     ` Anthony Foiani
2013-08-27 10:51 ` Xie Shaohui-B21989

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).