Re: [PATCH] ata: ahci: power off unused ports

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff Garzik <jeff@...>
Cc: Mark Lord <liml@...>, Alan Cox <alan@...>, Pavel Machek <pavel@...>, Theodore Tso <tytso@...>, <linux-ide@...>, <linux-kernel@...>
Date: Monday, June 2, 2008 - 1:47 pm

On Mon, 02 Jun 2008 13:45:15 -0400
Jeff Garzik <jeff@garzik.org> wrote:



@@ -5627,6 +5643,14 @@ int ata_host_register(struct ata_host *h

                        /* wait for EH to finish */
                        ata_port_wait_eh(ap);
+                       ata_link_for_each_dev(dev, &ap->link)
+                               if (ata_dev_enabled(dev))
+                                       device_attached++;
+                       if (!device_attached &&
+                           (ap->flags & ATA_FLAG_NO_HOTPLUG)) {
+                               /* no device present, disable port */
+                               ata_port_disable(ap);
+                       }
                } else {

Here you can see that it would be very easy for another driver
to just add code to set the NO_HOTPLUG flag and then this code
will work for them as well, since we power off the phy using
DET which is specified by SATA.

here's that code:
+static void ata_phy_offline(struct ata_link *link)
+{
+       u32 scontrol;
+       int rc;
+
+       /* set DET to 4 */
+       rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
+       if (rc)
+               return;
+       scontrol &= ~0xf;
+       scontrol |= (1 << 2);
+       sata_scr_write(link, SCR_CONTROL, scontrol);
+}

while it's true that I only modified ahci.c to set
the flag, any other driver writer can do that for the
other drivers based on whatever they want to use to
determine whether to set the NO_HOTPLUG flag.

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Thu May 8, 7:10 pm)
Re: [PATCH] ata: ahci: power off unused ports, Theodore Tso, (Mon May 26, 11:08 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Tue May 27, 5:32 pm)
Re: [PATCH] ata: ahci: power off unused ports, Theodore Tso, (Tue May 27, 6:59 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Tue May 27, 7:32 pm)
Re: [PATCH] ata: ahci: power off unused ports, Pavel Machek, (Sat May 31, 4:00 am)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Sun Jun 1, 3:16 pm)
Re: [PATCH] ata: ahci: power off unused ports, Alan Cox, (Mon Jun 2, 3:04 am)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 3:43 am)
Re: [PATCH] ata: ahci: power off unused ports, Mark Lord, (Mon Jun 2, 9:03 am)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Mon Jun 2, 12:57 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 1:44 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 12:07 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Mon Jun 2, 1:00 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 1:45 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Mon Jun 2, 1:47 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 2:15 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Mon Jun 2, 2:16 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 2:38 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Tue Jun 3, 12:49 pm)
Re: [PATCH] ata: ahci: power off unused ports, Ric Wheeler, (Mon Jun 2, 2:30 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 2:40 pm)
Re: [PATCH] ata: ahci: power off unused ports, Matthew Garrett, (Mon Jun 2, 4:00 pm)
Re: [PATCH] ata: ahci: power off unused ports, Ric Wheeler, (Mon Jun 2, 2:49 pm)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 2:52 pm)
Re: [PATCH] ata: ahci: power off unused ports, Greg Freemyer, (Mon Jun 2, 1:07 pm)
Re: [PATCH] ata: ahci: power off unused ports, Alan Cox, (Mon Jun 2, 4:22 am)
Re: [PATCH] ata: ahci: power off unused ports, Jeff Garzik, (Mon Jun 2, 5:48 am)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Mon Jun 2, 12:55 pm)
Re: [PATCH] ata: ahci: power off unused ports, Alan Cox, (Mon Jun 2, 9:54 am)
Re: [PATCH] ata: ahci: power off unused ports, Mark Lord, (Fri May 9, 11:06 am)
Re: [PATCH] ata: ahci: power off unused ports, Matthew Garrett, (Thu May 8, 7:37 pm)
Re: [PATCH] ata: ahci: power off unused ports, Lennart Sorensen, (Fri May 9, 11:58 am)
Re: [PATCH] ata: ahci: power off unused ports, Matthew Garrett, (Fri May 9, 12:06 pm)
Re: [PATCH] ata: ahci: power off unused ports, Lennart Sorensen, (Fri May 9, 12:14 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Fri May 9, 1:14 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Thu May 8, 7:35 pm)
Re: [PATCH] ata: ahci: power off unused ports, Matthew Garrett, (Thu May 8, 8:14 pm)
Re: [PATCH] ata: ahci: power off unused ports, Kristen Carlson Accardi, (Thu May 8, 8:28 pm)