board-8064: sata: Register platform device for SATA AHCI controller
Add support for registering SATA AHCI controller as platform device.
Change-Id: I494e63393144831cb35199afc98e07e8f1e843c1
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064.h b/arch/arm/mach-msm/board-8064.h
index 5d6f988..2bc0981 100644
--- a/arch/arm/mach-msm/board-8064.h
+++ b/arch/arm/mach-msm/board-8064.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -16,6 +16,7 @@
#include <linux/regulator/msm-gpio-regulator.h>
#include <linux/mfd/pm8xxx/pm8921.h>
#include <linux/mfd/pm8xxx/pm8821.h>
+#include <linux/ahci_platform.h>
#include <mach/msm_memtypes.h>
#include <mach/irqs.h>
#include <mach/rpm-regulator.h>
@@ -80,6 +81,7 @@
struct mmc_platform_data *plat);
void apq8064_init_mmc(void);
+int __init apq8064_add_ahci(struct ahci_platform_data *platd);
void apq8064_init_gpiomux(void);
void apq8064_init_pmic(void);
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index fd5fc81..dcd90d0 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -20,6 +20,7 @@
#include <linux/dma-mapping.h>
#include <linux/coresight.h>
#include <linux/avtimer.h>
+#include <linux/ahci_platform.h>
#include <mach/irqs-8064.h>
#include <mach/board.h>
#include <mach/msm_iomap.h>
@@ -1777,6 +1778,48 @@
return platform_device_register(pdev);
}
+#define MSM_SATA_AHCI_BASE 0x29000000
+#define MSM_SATA_AHCI_REGS_SZ 0x17C
+
+static struct resource resources_ahci[] = {
+ {
+ .name = "ahci_mem",
+ .flags = IORESOURCE_MEM,
+ .start = MSM_SATA_AHCI_BASE,
+ .end = MSM_SATA_AHCI_BASE + MSM_SATA_AHCI_REGS_SZ - 1,
+ },
+ {
+ .name = "ahci_irq",
+ .flags = IORESOURCE_IRQ,
+ .start = SATA_CONTROLLER_IRQ,
+ .end = SATA_CONTROLLER_IRQ,
+ },
+};
+
+static u64 ahci_dma_mask = DMA_BIT_MASK(32);
+static struct platform_device apq8064_device_ahci = {
+ .name = "ahci",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(resources_ahci),
+ .resource = resources_ahci,
+ .dev = {
+ .dma_mask = &ahci_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ },
+};
+
+int __init apq8064_add_ahci(struct ahci_platform_data *platd)
+{
+ struct platform_device *pdev;
+
+ if (!platd)
+ return -EINVAL;
+
+ pdev = &apq8064_device_ahci;
+ pdev->dev.platform_data = platd;
+ return platform_device_register(pdev);
+}
+
static struct resource resources_sps[] = {
{
.name = "pipe_mem",