devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaedon Shin <jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>,
	Florian Fainelli
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Jaedon Shin <jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 02/10] ata: ahch_brcmstb: add data for port offset
Date: Fri, 23 Oct 2015 10:44:15 +0900	[thread overview]
Message-ID: <1445564663-66824-3-git-send-email-jaedon.shin@gmail.com> (raw)
In-Reply-To: <1445564663-66824-1-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Add data of device node for port offset.

Signed-off-by: Jaedon Shin <jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/ata/ahci_brcmstb.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/ata/ahci_brcmstb.c b/drivers/ata/ahci_brcmstb.c
index 14b7305d2ba0..8cf6f7d4798f 100644
--- a/drivers/ata/ahci_brcmstb.c
+++ b/drivers/ata/ahci_brcmstb.c
@@ -72,6 +72,7 @@
 struct brcm_ahci_priv {
 	struct device *dev;
 	void __iomem *top_ctrl;
+	u32 port_offset;
 	u32 port_mask;
 };
 
@@ -110,7 +111,7 @@ static inline void brcm_sata_writereg(u32 val, void __iomem *addr)
 static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)
 {
 	void __iomem *phyctrl = priv->top_ctrl + SATA_TOP_CTRL_PHY_CTRL +
-				(port * SATA_TOP_CTRL_PHY_OFFS);
+				(port * priv->port_offset);
 	void __iomem *p;
 	u32 reg;
 
@@ -139,7 +140,7 @@ static void brcm_sata_phy_enable(struct brcm_ahci_priv *priv, int port)
 static void brcm_sata_phy_disable(struct brcm_ahci_priv *priv, int port)
 {
 	void __iomem *phyctrl = priv->top_ctrl + SATA_TOP_CTRL_PHY_CTRL +
-				(port * SATA_TOP_CTRL_PHY_OFFS);
+				(port * priv->port_offset);
 	void __iomem *p;
 	u32 reg;
 
@@ -234,6 +235,13 @@ static int brcm_ahci_resume(struct device *dev)
 }
 #endif
 
+static const struct of_device_id ahci_of_match[] = {
+	{.compatible = "brcm,bcm7445-ahci",
+			.data = (void *)SATA_TOP_CTRL_PHY_OFFS},
+	{},
+};
+MODULE_DEVICE_TABLE(of, ahci_of_match);
+
 static struct scsi_host_template ahci_platform_sht = {
 	AHCI_SHT(DRV_NAME),
 };
@@ -241,6 +249,7 @@ static struct scsi_host_template ahci_platform_sht = {
 static int brcm_ahci_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	const struct of_device_id *of_id = NULL;
 	struct brcm_ahci_priv *priv;
 	struct ahci_host_priv *hpriv;
 	struct resource *res;
@@ -256,6 +265,12 @@ static int brcm_ahci_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->top_ctrl))
 		return PTR_ERR(priv->top_ctrl);
 
+	of_id = of_match_node(ahci_of_match, dev->of_node);
+	if (!of_id)
+		return -EINVAL;
+
+	priv->port_offset = (u32)of_id->data;
+
 	brcm_sata_init(priv);
 
 	priv->port_mask = brcm_ahci_get_portmask(pdev, priv);
@@ -299,12 +314,6 @@ static int brcm_ahci_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id ahci_of_match[] = {
-	{.compatible = "brcm,bcm7445-ahci"},
-	{},
-};
-MODULE_DEVICE_TABLE(of, ahci_of_match);
-
 static SIMPLE_DEV_PM_OPS(ahci_brcm_pm_ops, brcm_ahci_suspend, brcm_ahci_resume);
 
 static struct platform_driver brcm_ahci_driver = {
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-10-23  1:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23  1:44 [PATCH 00/10] add support SATA for BMIPS_GENERIC Jaedon Shin
2015-10-23  1:44 ` [PATCH 01/10] ata: ahci_brcmstb: make the driver buildable on BMIPS_GENERIC Jaedon Shin
2015-10-23  4:52   ` Florian Fainelli
2015-10-23 21:26   ` Brian Norris
     [not found] ` <1445564663-66824-1-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-23  1:44   ` Jaedon Shin [this message]
2015-10-23  4:54     ` [PATCH 02/10] ata: ahch_brcmstb: add data for port offset Florian Fainelli
2015-10-23 21:28     ` Brian Norris
2015-10-23  1:44   ` [PATCH 06/10] phy: phy_brcmstb_sata: add data for phy offset Jaedon Shin
2015-10-23  5:04     ` Florian Fainelli
2015-10-23 21:09     ` Brian Norris
2015-10-23  1:44 ` [PATCH 03/10] ata: ahci_brcmstb: add support 40nm platforms Jaedon Shin
2015-10-23  5:01   ` Florian Fainelli
2015-10-23 21:25   ` Brian Norris
     [not found]     ` <20151023212558.GS13239-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-10-24  4:50       ` Jaedon Shin
2015-10-26 17:47         ` Brian Norris
2015-10-23  1:44 ` [PATCH 04/10] phy: phy_brcmstb_sata: make the driver buildable on BMIPS_GENERIC Jaedon Shin
     [not found]   ` <1445564663-66824-5-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-23  5:01     ` Florian Fainelli
2015-10-23 14:47   ` Kishon Vijay Abraham I
2015-10-23 21:10   ` Brian Norris
2015-10-23  1:44 ` [PATCH 05/10] phy: phy_brcmstb_sata: remove unused definitions Jaedon Shin
2015-10-23  5:02   ` Florian Fainelli
2015-10-23 20:40   ` Brian Norris
2015-10-23  1:44 ` [PATCH 07/10] phy: phy_brcmstb_sata: add support 40nm platforms Jaedon Shin
     [not found]   ` <1445564663-66824-8-git-send-email-jaedon.shin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-10-23  5:06     ` Florian Fainelli
2015-10-23 21:09   ` Brian Norris
2015-10-23  1:44 ` [PATCH 08/10] MIPS: BMIPS: brcmstb: add SATA nodes for bcm7346 Jaedon Shin
2015-10-23  1:44 ` [PATCH 09/10] MIPS: BMIPS: brcmstb: add SATA nodes for bcm7360 Jaedon Shin
2015-10-23  1:44 ` [PATCH 10/10] MIPS: BMIPS: brcmstb: add SATA nodes for bcm7362 Jaedon Shin
2015-10-23  3:58 ` [PATCH 00/10] add support SATA for BMIPS_GENERIC Tejun Heo
2015-10-23  4:51   ` Florian Fainelli
2015-10-23 20:35     ` Brian Norris
     [not found]       ` <20151023203511.GN13239-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-10-23 21:30         ` Kevin Cernekee
2015-10-24  4:51     ` Jaedon Shin
2015-10-24 20:43       ` Florian Fainelli
2015-10-27 10:21 ` Ralf Baechle

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=1445564663-66824-3-git-send-email-jaedon.shin@gmail.com \
    --to=jaedon.shin-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).