Patchwork [07/15] SPEAr1340: Add PCIe auxdata for miphy clock initialization

login
register
mail settings
Submitter Pratyush ANAND
Date Oct. 29, 2012, 7:01 a.m.
Message ID <d35d2da48beb1ca1e476ec861e4f58fe541f4e3c.1351492562.git.pratyush.anand@st.com>
Download mbox | patch
Permalink /patch/194851/
State Not Applicable
Headers show

Comments

Pratyush ANAND - Oct. 29, 2012, 7:01 a.m.
Miphy Clock initialization is very specific to controller and its
instances. Pass this custom function using auxdata.

Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
---
 arch/arm/mach-spear13xx/spear1340.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

Patch

diff --git a/arch/arm/mach-spear13xx/spear1340.c b/arch/arm/mach-spear13xx/spear1340.c
index 223d9ef..194c3ac 100644
--- a/arch/arm/mach-spear13xx/spear1340.c
+++ b/arch/arm/mach-spear13xx/spear1340.c
@@ -29,6 +29,7 @@ 
 #include <asm/mach/arch.h>
 #include <mach/dma.h>
 #include <mach/generic.h>
+#include <mach/pcie.h>
 #include <mach/spdif.h>
 #include <mach/spear.h>
 #include <sound/designware_i2s.h>
@@ -42,6 +43,7 @@ 
 #define SPEAR1340_CAM2_BASE			UL(0xD0400000)
 #define SPEAR1340_CAM3_BASE			UL(0xD0500000)
 #define SPEAR1340_SATA_BASE			UL(0xB1000000)
+#define SPEAR1340_PCIE_BASE			UL(0xB1000000)
 #define SPEAR1340_UART1_BASE			UL(0xB4100000)
 #define SPEAR1340_I2S_PLAY_BASE			UL(0xB2400000)
 #define SPEAR1340_I2S_REC_BASE			UL(0xB2000000)
@@ -358,6 +360,28 @@  static struct ahci_platform_data sata_pdata = {
 	.resume = sata_resume,
 };
 
+static int spear1340_pcie_clk_init(struct pcie_port *pp)
+{
+	writel(SPEAR1340_PCIE_SATA_MIPHY_CFG_PCIE,
+			SPEAR1340_PCIE_MIPHY_CFG);
+	writel(SPEAR1340_PCIE_CFG_VAL, SPEAR1340_PCIE_SATA_CFG);
+
+	return 0;
+}
+
+static int spear1340_pcie_clk_exit(struct pcie_port *pp)
+{
+	writel(0, SPEAR1340_PCIE_SATA_CFG);
+	writel(0, SPEAR1340_PCIE_MIPHY_CFG);
+
+	return 0;
+}
+
+static struct pcie_port_info pcie_pdata = {
+	.clk_init = spear1340_pcie_clk_init,
+	.clk_exit = spear1340_pcie_clk_exit,
+};
+
 /* camera sensor registeration */
 static struct i2c_board_info vs6725_camera_sensor_info = {
 	I2C_BOARD_INFO("vs6725", 0x10),
@@ -609,6 +633,8 @@  static struct of_dev_auxdata spear1340_auxdata_lookup[] __initdata = {
 
 	OF_DEV_AUXDATA("snps,spear-ahci", SPEAR1340_SATA_BASE, NULL,
 			&sata_pdata),
+	OF_DEV_AUXDATA("st,pcie-host", SPEAR1340_PCIE_BASE, NULL,
+			&pcie_pdata),
 	OF_DEV_AUXDATA("arm,pl011", SPEAR1340_UART1_BASE, NULL, &uart1_data),
 	OF_DEV_AUXDATA("st,spear600-gmac", SPEAR13XX_GETH_BASE, NULL,
 			&eth_data),