Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ea909cb authored by Mika Westerberg's avatar Mika Westerberg Committed by Tejun Heo
Browse files

ahci: Cache host controller version



This allows sysfs nodes to read the cached value directly instead of
powering up possibly runtime suspended controller.

Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 5c6fab9d
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -335,6 +335,7 @@ struct ahci_host_priv {
	void __iomem *		mmio;		/* bus-independent mem map */
	void __iomem *		mmio;		/* bus-independent mem map */
	u32			cap;		/* cap to use */
	u32			cap;		/* cap to use */
	u32			cap2;		/* cap2 to use */
	u32			cap2;		/* cap2 to use */
	u32			version;	/* cached version */
	u32			port_map;	/* port map to use */
	u32			port_map;	/* port map to use */
	u32			saved_cap;	/* saved initial cap */
	u32			saved_cap;	/* saved initial cap */
	u32			saved_cap2;	/* saved initial cap2 */
	u32			saved_cap2;	/* saved initial cap2 */
+3 −4
Original line number Original line Diff line number Diff line
@@ -251,9 +251,8 @@ static ssize_t ahci_show_host_version(struct device *dev,
	struct Scsi_Host *shost = class_to_shost(dev);
	struct Scsi_Host *shost = class_to_shost(dev);
	struct ata_port *ap = ata_shost_to_port(shost);
	struct ata_port *ap = ata_shost_to_port(shost);
	struct ahci_host_priv *hpriv = ap->host->private_data;
	struct ahci_host_priv *hpriv = ap->host->private_data;
	void __iomem *mmio = hpriv->mmio;


	return sprintf(buf, "%x\n", readl(mmio + HOST_VERSION));
	return sprintf(buf, "%x\n", hpriv->version);
}
}


static ssize_t ahci_show_port_cmd(struct device *dev,
static ssize_t ahci_show_port_cmd(struct device *dev,
@@ -509,6 +508,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
	/* record values to use during operation */
	/* record values to use during operation */
	hpriv->cap = cap;
	hpriv->cap = cap;
	hpriv->cap2 = cap2;
	hpriv->cap2 = cap2;
	hpriv->version = readl(mmio + HOST_VERSION);
	hpriv->port_map = port_map;
	hpriv->port_map = port_map;


	if (!hpriv->start_engine)
	if (!hpriv->start_engine)
@@ -2357,11 +2357,10 @@ static void ahci_port_stop(struct ata_port *ap)
void ahci_print_info(struct ata_host *host, const char *scc_s)
void ahci_print_info(struct ata_host *host, const char *scc_s)
{
{
	struct ahci_host_priv *hpriv = host->private_data;
	struct ahci_host_priv *hpriv = host->private_data;
	void __iomem *mmio = hpriv->mmio;
	u32 vers, cap, cap2, impl, speed;
	u32 vers, cap, cap2, impl, speed;
	const char *speed_s;
	const char *speed_s;


	vers = readl(mmio + HOST_VERSION);
	vers = hpriv->version;
	cap = hpriv->cap;
	cap = hpriv->cap;
	cap2 = hpriv->cap2;
	cap2 = hpriv->cap2;
	impl = hpriv->port_map;
	impl = hpriv->port_map;