mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ahci: add generic driver
@ 2013-02-11 17:01 Jean-Christophe PLAGNIOL-VILLARD
  2013-02-11 17:02 ` [PATCH 2/2] ahci: handle COMINIT received during spin-up Jean-Christophe PLAGNIOL-VILLARD
  2013-02-12  8:06 ` [PATCH 1/2] ahci: add generic driver Sascha Hauer
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-11 17:01 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/ata/Kconfig        |    4 ++++
 drivers/ata/Makefile       |    2 ++
 drivers/ata/ahci-generic.c |   47 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+)
 create mode 100644 drivers/ata/ahci-generic.c

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index ff6528a..41dc811 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -37,6 +37,10 @@ config DISK_AHCI
 	select DISK_ATA
 	select DISK_DRIVE
 
+config DISK_AHCI_GENERIC
+	depends on DISK_AHCI
+	bool "AHCI generic support"
+
 config DISK_AHCI_IMX
 	depends on DISK_AHCI
 	bool "i.MX AHCI support"
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index c444c4d..802bd61 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -4,8 +4,10 @@ obj-$(CONFIG_DISK_BIOS) += disk_bios_drive.o
 obj-$(CONFIG_DISK_IDE_SFF) += ide-sff.o
 obj-$(CONFIG_DISK_ATA) += disk_ata_drive.o
 obj-$(CONFIG_DISK_AHCI) += ahci.o
+obj-$(CONFIG_DISK_AHCI_GENERIC) += ahci-generic.o
 obj-$(CONFIG_DISK_AHCI_IMX) += sata-imx.o
 
+
 # interface types
 
 obj-$(CONFIG_DISK_INTF_PLATFORM_IDE) += intf_platform_ide.o
diff --git a/drivers/ata/ahci-generic.c b/drivers/ata/ahci-generic.c
new file mode 100644
index 0000000..4077627
--- /dev/null
+++ b/drivers/ata/ahci-generic.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
+ *
+ * GPLv2 only
+ */
+
+#include <common.h>
+#include <ata_drive.h>
+#include <io.h>
+#include <driver.h>
+#include <init.h>
+#include <malloc.h>
+#include "ahci.h"
+
+static int ahci_probe(struct device_d *dev)
+{
+	struct ahci_device *ahci;
+	int ret;
+
+	ahci = xzalloc(sizeof(*ahci));
+
+	ahci->mmio_base = dev_request_mem_region(dev, 0);
+
+	ahci->dev = dev;
+	dev->priv = ahci;
+	ret = ahci_add_host(ahci);
+	if (ret)
+		goto err_free;
+
+	return 0;
+
+err_free:
+	free(ahci);
+
+	return ret;
+}
+
+static struct driver_d ahci_driver = {
+	.name	= "ahci",
+	.probe	= ahci_probe,
+};
+
+static int ahci_init(void)
+{
+	return platform_driver_register(&ahci_driver);
+}
+device_initcall(ahci_init);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] ahci: handle COMINIT received during spin-up
  2013-02-11 17:01 [PATCH 1/2] ahci: add generic driver Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-11 17:02 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-12  8:06 ` [PATCH 1/2] ahci: add generic driver Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-11 17:02 UTC (permalink / raw)
  To: barebox; +Cc: Rob Herring

From: Rob Herring <rob.herring@calxeda.com>

Some Intel SSDs can send a COMINIT after the initial COMRESET. This causes
the link to go down and we need to re-initialize the link.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/ata/ahci.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 14de3c5..3aff3f3 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -385,14 +385,21 @@ static int ahci_init_port(struct ahci_port *ahci_port)
 	ahci_port_info(ahci_port, "Spinning up device...\n");
 
 	ret = wait_on_timeout(WAIT_SPINUP,
-			(readl(port_mmio + PORT_TFDATA) &
-			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0);
+			((readl(port_mmio + PORT_TFDATA) &
+			 (ATA_STATUS_BUSY | ATA_STATUS_DRQ)) == 0)
+			|| !((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1));
 	if (ret) {
 		ahci_port_info(ahci_port, "timeout.\n");
 		ret = -ENODEV;
 		goto err_init;
 	}
 
+	if ((readl(port_mmio + PORT_SCR_STAT) & 0xf) == 1) {
+		ahci_port_info(ahci_port, "down.\n");
+		ret = -ENODEV;
+		goto err_init;
+	}
+
 	ahci_port_info(ahci_port, "ok.\n");
 
 	val = ahci_port_read(ahci_port, PORT_SCR_ERR);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] ahci: add generic driver
  2013-02-11 17:01 [PATCH 1/2] ahci: add generic driver Jean-Christophe PLAGNIOL-VILLARD
  2013-02-11 17:02 ` [PATCH 2/2] ahci: handle COMINIT received during spin-up Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-12  8:06 ` Sascha Hauer
  2013-02-13  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2013-02-12  8:06 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Mon, Feb 11, 2013 at 06:01:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Applied, thanks

Sascha

> ---
>  drivers/ata/Kconfig        |    4 ++++
>  drivers/ata/Makefile       |    2 ++
>  drivers/ata/ahci-generic.c |   47 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 53 insertions(+)
>  create mode 100644 drivers/ata/ahci-generic.c
> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index ff6528a..41dc811 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -37,6 +37,10 @@ config DISK_AHCI
>  	select DISK_ATA
>  	select DISK_DRIVE
>  
> +config DISK_AHCI_GENERIC
> +	depends on DISK_AHCI
> +	bool "AHCI generic support"
> +
>  config DISK_AHCI_IMX
>  	depends on DISK_AHCI
>  	bool "i.MX AHCI support"
> diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
> index c444c4d..802bd61 100644
> --- a/drivers/ata/Makefile
> +++ b/drivers/ata/Makefile
> @@ -4,8 +4,10 @@ obj-$(CONFIG_DISK_BIOS) += disk_bios_drive.o
>  obj-$(CONFIG_DISK_IDE_SFF) += ide-sff.o
>  obj-$(CONFIG_DISK_ATA) += disk_ata_drive.o
>  obj-$(CONFIG_DISK_AHCI) += ahci.o
> +obj-$(CONFIG_DISK_AHCI_GENERIC) += ahci-generic.o
>  obj-$(CONFIG_DISK_AHCI_IMX) += sata-imx.o
>  
> +
>  # interface types
>  
>  obj-$(CONFIG_DISK_INTF_PLATFORM_IDE) += intf_platform_ide.o
> diff --git a/drivers/ata/ahci-generic.c b/drivers/ata/ahci-generic.c
> new file mode 100644
> index 0000000..4077627
> --- /dev/null
> +++ b/drivers/ata/ahci-generic.c
> @@ -0,0 +1,47 @@
> +/*
> + * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
> + *
> + * GPLv2 only
> + */
> +
> +#include <common.h>
> +#include <ata_drive.h>
> +#include <io.h>
> +#include <driver.h>
> +#include <init.h>
> +#include <malloc.h>
> +#include "ahci.h"
> +
> +static int ahci_probe(struct device_d *dev)
> +{
> +	struct ahci_device *ahci;
> +	int ret;
> +
> +	ahci = xzalloc(sizeof(*ahci));
> +
> +	ahci->mmio_base = dev_request_mem_region(dev, 0);
> +
> +	ahci->dev = dev;
> +	dev->priv = ahci;
> +	ret = ahci_add_host(ahci);
> +	if (ret)
> +		goto err_free;
> +
> +	return 0;
> +
> +err_free:
> +	free(ahci);
> +
> +	return ret;
> +}
> +
> +static struct driver_d ahci_driver = {
> +	.name	= "ahci",
> +	.probe	= ahci_probe,
> +};
> +
> +static int ahci_init(void)
> +{
> +	return platform_driver_register(&ahci_driver);
> +}
> +device_initcall(ahci_init);
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] ahci: add generic driver
  2013-02-12  8:06 ` [PATCH 1/2] ahci: add generic driver Sascha Hauer
@ 2013-02-13  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
  2013-02-13 17:09     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-02-13  9:29 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 09:06 Tue 12 Feb     , Sascha Hauer wrote:
> On Mon, Feb 11, 2013 at 06:01:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

drop the ahci-generic we already have it in ahci.c

did not see it before

I update the dt support too

Best Regards,
J.
> 
> Applied, thanks
> 
> Sascha
> 
> > ---
> >  drivers/ata/Kconfig        |    4 ++++
> >  drivers/ata/Makefile       |    2 ++
> >  drivers/ata/ahci-generic.c |   47 ++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 53 insertions(+)
> >  create mode 100644 drivers/ata/ahci-generic.c
> > 
> > diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> > index ff6528a..41dc811 100644
> > --- a/drivers/ata/Kconfig
> > +++ b/drivers/ata/Kconfig
> > @@ -37,6 +37,10 @@ config DISK_AHCI
> >  	select DISK_ATA
> >  	select DISK_DRIVE
> >  
> > +config DISK_AHCI_GENERIC
> > +	depends on DISK_AHCI
> > +	bool "AHCI generic support"
> > +
> >  config DISK_AHCI_IMX
> >  	depends on DISK_AHCI
> >  	bool "i.MX AHCI support"
> > diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
> > index c444c4d..802bd61 100644
> > --- a/drivers/ata/Makefile
> > +++ b/drivers/ata/Makefile
> > @@ -4,8 +4,10 @@ obj-$(CONFIG_DISK_BIOS) += disk_bios_drive.o
> >  obj-$(CONFIG_DISK_IDE_SFF) += ide-sff.o
> >  obj-$(CONFIG_DISK_ATA) += disk_ata_drive.o
> >  obj-$(CONFIG_DISK_AHCI) += ahci.o
> > +obj-$(CONFIG_DISK_AHCI_GENERIC) += ahci-generic.o
> >  obj-$(CONFIG_DISK_AHCI_IMX) += sata-imx.o
> >  
> > +
> >  # interface types
> >  
> >  obj-$(CONFIG_DISK_INTF_PLATFORM_IDE) += intf_platform_ide.o
> > diff --git a/drivers/ata/ahci-generic.c b/drivers/ata/ahci-generic.c
> > new file mode 100644
> > index 0000000..4077627
> > --- /dev/null
> > +++ b/drivers/ata/ahci-generic.c
> > @@ -0,0 +1,47 @@
> > +/*
> > + * Copyright (C) 2009 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
> > + *
> > + * GPLv2 only
> > + */
> > +
> > +#include <common.h>
> > +#include <ata_drive.h>
> > +#include <io.h>
> > +#include <driver.h>
> > +#include <init.h>
> > +#include <malloc.h>
> > +#include "ahci.h"
> > +
> > +static int ahci_probe(struct device_d *dev)
> > +{
> > +	struct ahci_device *ahci;
> > +	int ret;
> > +
> > +	ahci = xzalloc(sizeof(*ahci));
> > +
> > +	ahci->mmio_base = dev_request_mem_region(dev, 0);
> > +
> > +	ahci->dev = dev;
> > +	dev->priv = ahci;
> > +	ret = ahci_add_host(ahci);
> > +	if (ret)
> > +		goto err_free;
> > +
> > +	return 0;
> > +
> > +err_free:
> > +	free(ahci);
> > +
> > +	return ret;
> > +}
> > +
> > +static struct driver_d ahci_driver = {
> > +	.name	= "ahci",
> > +	.probe	= ahci_probe,
> > +};
> > +
> > +static int ahci_init(void)
> > +{
> > +	return platform_driver_register(&ahci_driver);
> > +}
> > +device_initcall(ahci_init);
> > -- 
> > 1.7.10.4
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/2] ahci: add generic driver
  2013-02-13  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-02-13 17:09     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-02-13 17:09 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Feb 13, 2013 at 10:29:21AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:06 Tue 12 Feb     , Sascha Hauer wrote:
> > On Mon, Feb 11, 2013 at 06:01:59PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> 
> drop the ahci-generic we already have it in ahci.c
> 
> did not see it before

Me neither :)

Dropped it.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-02-13 17:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11 17:01 [PATCH 1/2] ahci: add generic driver Jean-Christophe PLAGNIOL-VILLARD
2013-02-11 17:02 ` [PATCH 2/2] ahci: handle COMINIT received during spin-up Jean-Christophe PLAGNIOL-VILLARD
2013-02-12  8:06 ` [PATCH 1/2] ahci: add generic driver Sascha Hauer
2013-02-13  9:29   ` Jean-Christophe PLAGNIOL-VILLARD
2013-02-13 17:09     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox