* [PATCHv2] ahci_platform: Provide for vendor specific init
@ 2010-06-25 9:21 Jassi Brar
2010-06-25 9:34 ` Anton Vorontsov
2010-07-01 19:30 ` Jeff Garzik
0 siblings, 2 replies; 3+ messages in thread
From: Jassi Brar @ 2010-06-25 9:21 UTC (permalink / raw)
To: linux-ide; +Cc: jgarzik, avorontsov, Jassi Brar
From: Jassi Brar <jassi.brar@samsung.com>
Some AHCI implementations may use Vendor Specific HBA[A0h, FFh]
and/or Port[70h, 7Fh] registers to 'prepare' for initialization.
For that, the platform needs memory mapped address of AHCI registers.
This patch adds the 'mmio' argument and reorders the call to
platform init function.
Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
---
drivers/ata/ahci_platform.c | 25 +++++++++++++++----------
include/linux/ahci_platform.h | 4 +++-
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 5e11b16..68ef6b5 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -54,19 +54,13 @@ static int __init ahci_probe(struct platform_device *pdev)
return -EINVAL;
}
- if (pdata && pdata->init) {
- rc = pdata->init(dev);
- if (rc)
- return rc;
- }
-
if (pdata && pdata->ata_port_info)
pi = *pdata->ata_port_info;
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) {
- rc = -ENOMEM;
- goto err0;
+ dev_err(dev, "can't alloc ahci_host_priv\n");
+ return -ENOMEM;
}
hpriv->flags |= (unsigned long)pi.private_data;
@@ -74,8 +68,19 @@ static int __init ahci_probe(struct platform_device *pdev)
hpriv->mmio = devm_ioremap(dev, mem->start, resource_size(mem));
if (!hpriv->mmio) {
dev_err(dev, "can't map %pR\n", mem);
- rc = -ENOMEM;
- goto err0;
+ return -ENOMEM;
+ }
+
+ /*
+ * Some platforms might need to prepare for mmio region access,
+ * which could be done in the following init call. So, the mmio
+ * region shouldn't be accessed before init (if provided) has
+ * returned successfully.
+ */
+ if (pdata && pdata->init) {
+ rc = pdata->init(dev, hpriv->mmio);
+ if (rc)
+ return rc;
}
ahci_save_initial_config(dev, hpriv,
diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
index f7dd576..be3d9a7 100644
--- a/include/linux/ahci_platform.h
+++ b/include/linux/ahci_platform.h
@@ -15,11 +15,13 @@
#ifndef _AHCI_PLATFORM_H
#define _AHCI_PLATFORM_H
+#include <linux/compiler.h>
+
struct device;
struct ata_port_info;
struct ahci_platform_data {
- int (*init)(struct device *dev);
+ int (*init)(struct device *dev, void __iomem *addr);
void (*exit)(struct device *dev);
const struct ata_port_info *ata_port_info;
unsigned int force_port_map;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCHv2] ahci_platform: Provide for vendor specific init
2010-06-25 9:21 [PATCHv2] ahci_platform: Provide for vendor specific init Jassi Brar
@ 2010-06-25 9:34 ` Anton Vorontsov
2010-07-01 19:30 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2010-06-25 9:34 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-ide, jgarzik, Jassi Brar
On Fri, Jun 25, 2010 at 06:21:19PM +0900, Jassi Brar wrote:
> From: Jassi Brar <jassi.brar@samsung.com>
>
> Some AHCI implementations may use Vendor Specific HBA[A0h, FFh]
> and/or Port[70h, 7Fh] registers to 'prepare' for initialization.
> For that, the platform needs memory mapped address of AHCI registers.
>
> This patch adds the 'mmio' argument and reorders the call to
> platform init function.
>
> Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
> ---
Looks perfect, thanks!
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCHv2] ahci_platform: Provide for vendor specific init
2010-06-25 9:21 [PATCHv2] ahci_platform: Provide for vendor specific init Jassi Brar
2010-06-25 9:34 ` Anton Vorontsov
@ 2010-07-01 19:30 ` Jeff Garzik
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2010-07-01 19:30 UTC (permalink / raw)
To: Jassi Brar; +Cc: linux-ide, avorontsov, Jassi Brar
On 06/25/2010 05:21 AM, Jassi Brar wrote:
> From: Jassi Brar<jassi.brar@samsung.com>
>
> Some AHCI implementations may use Vendor Specific HBA[A0h, FFh]
> and/or Port[70h, 7Fh] registers to 'prepare' for initialization.
> For that, the platform needs memory mapped address of AHCI registers.
>
> This patch adds the 'mmio' argument and reorders the call to
> platform init function.
>
> Signed-off-by: Jassi Brar<jassi.brar@samsung.com>
> ---
> drivers/ata/ahci_platform.c | 25 +++++++++++++++----------
> include/linux/ahci_platform.h | 4 +++-
> 2 files changed, 18 insertions(+), 11 deletions(-)
applied
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-07-01 19:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-25 9:21 [PATCHv2] ahci_platform: Provide for vendor specific init Jassi Brar
2010-06-25 9:34 ` Anton Vorontsov
2010-07-01 19:30 ` Jeff Garzik
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).