From: cbouatmailru@gmail.com (Anton Vorontsov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] cns3xxx: Add support for AHCI controllers
Date: Thu, 25 Mar 2010 23:10:58 +0300 [thread overview]
Message-ID: <20100325201058.GD8014@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20100325200851.GA6470@oksana.dev.rtsoft.ru>
CNS3xxx chips have AHCI-compatible SATA controller. This patch adds
the support using generic ahci_platform driver.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
---
Depends on libata-dev tree.
arch/arm/mach-cns3xxx/cns3420vb.c | 1 +
arch/arm/mach-cns3xxx/devices.c | 61 +++++++++++++++++++++++++++++++++++++
arch/arm/mach-cns3xxx/devices.h | 1 +
3 files changed, 63 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index c292945..c7849c3 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -112,6 +112,7 @@ static void __init cns3420_early_serial_setup(void)
*/
static struct platform_device *cns3420_pdevs[] __initdata = {
&cns3420_nor_pdev,
+ &cns3xxx_ahci_pdev,
&cns3xxx_sdhci_pdev,
};
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c
index 549ad0c..bf6044b 100644
--- a/arch/arm/mach-cns3xxx/devices.c
+++ b/arch/arm/mach-cns3xxx/devices.c
@@ -14,14 +14,75 @@
#include <linux/init.h>
#include <linux/compiler.h>
#include <linux/delay.h>
+#include <linux/dma-mapping.h>
#include <linux/device.h>
#include <linux/platform_device.h>
+#include <linux/ahci_platform.h>
#include <linux/mmc/host.h>
#include <linux/sdhci-pltfm.h>
#include "../../../drivers/mmc/host/sdhci.h"
+#include "core.h"
#include "devices.h"
/*
+ * AHCI
+ */
+static int cns3xxx_ahci_init(struct device *dev)
+{
+ u32 tmp;
+
+ tmp = MISC_SATA_POWER_MODE;
+ tmp |= 0x1 << 16; /* Disable SATA PHY 0 from SLUMBER Mode */
+ tmp |= 0x1 << 17; /* Disable SATA PHY 1 from SLUMBER Mode */
+ MISC_SATA_POWER_MODE = tmp;
+
+ /* Enable SATA PHY */
+ cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0);
+ cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1);
+
+ /* Enable SATA Clock */
+ cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_SATA);
+
+ /* De-Asscer SATA Reset */
+ tmp = PM_SOFT_RST_REG;
+ tmp |= 0x1 << PM_SOFT_RST_REG_OFFST_SATA;
+ PM_SOFT_RST_REG = tmp;
+
+ return 0;
+}
+
+static struct ahci_platform_data cns3xxx_ahci_pdata = {
+ .init = cns3xxx_ahci_init,
+};
+
+static struct resource cns3xxx_ahci_resource[] = {
+ [0] = {
+ .start = CNS3XXX_SATA2_BASE,
+ .end = CNS3XXX_SATA2_BASE + CNS3XXX_SATA2_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_CNS3XXX_SATA,
+ .end = IRQ_CNS3XXX_SATA,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static u64 cns3xxx_ahci_dmamask = DMA_BIT_MASK(32);
+
+struct platform_device cns3xxx_ahci_pdev = {
+ .name = "ahci",
+ .id = 0,
+ .resource = cns3xxx_ahci_resource,
+ .num_resources = ARRAY_SIZE(cns3xxx_ahci_resource),
+ .dev = {
+ .dma_mask = &cns3xxx_ahci_dmamask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &cns3xxx_ahci_pdata,
+ },
+};
+
+/*
* SDHCI
*/
static struct resource cns3xxx_sdhci_resources[] = {
diff --git a/arch/arm/mach-cns3xxx/devices.h b/arch/arm/mach-cns3xxx/devices.h
index c5bf5cf..3e6616d 100644
--- a/arch/arm/mach-cns3xxx/devices.h
+++ b/arch/arm/mach-cns3xxx/devices.h
@@ -14,6 +14,7 @@
#ifndef __CNS3XXX_DEVICES_H_
#define __CNS3XXX_DEVICES_H_
+extern struct platform_device cns3xxx_ahci_pdev;
extern struct platform_device cns3xxx_sdhci_pdev;
#endif /* __CNS3XXX_DEVICES_H_ */
--
1.7.0
prev parent reply other threads:[~2010-03-25 20:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 20:08 [PATCH 0/4] Support for Cavium Networks CNS3xxx machines Anton Vorontsov
2010-03-25 20:10 ` [PATCH 1/4] cns3xxx: Add basic support for Cavium Networks CNS3xxx processors Anton Vorontsov
2010-03-25 20:23 ` Russell King - ARM Linux
2010-03-26 13:22 ` Anton Vorontsov
2010-03-26 23:08 ` Russell King - ARM Linux
2010-03-25 22:03 ` Sergei Shtylyov
2010-03-25 20:10 ` [PATCH 2/4] cns3xxx: Add defconfig for CNS3420 validation board Anton Vorontsov
2010-03-25 20:10 ` [PATCH 3/4] cns3xxx: Add support for SDHCI controllers Anton Vorontsov
2010-03-25 20:10 ` Anton Vorontsov [this message]
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=20100325201058.GD8014@oksana.dev.rtsoft.ru \
--to=cbouatmailru@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.