summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRichard Zhu <r65037@freescale.com>2011-07-19 13:45:36 +0800
committerRichard Zhu <r65037@freescale.com>2011-07-22 16:30:26 +0800
commitc38d9c72e6915ad0bd2222bfefc80e3053535209 (patch)
treec719dd7c504f89c02c7d87742ffbc45b70c04bd0 /arch
parentbba25cc6940b12814bb7b4fe23ce61c12709f794 (diff)
ENGR00153275-2 mx53 L2638 msl modifications when add ahci temp-monitor
based on the 2.6.38 kernel mainline, refer to linux std hwmon architeture, add the standalone ahci temperature monitor driver on fsl i.mx53 platforms. Signed-off-by: Richard Zhu <r65037@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/configs/imx5_defconfig1
-rw-r--r--arch/arm/mach-mx5/Kconfig2
-rw-r--r--arch/arm/mach-mx5/board-mx53_ard.c1
-rw-r--r--arch/arm/mach-mx5/board-mx53_evk.c1
-rw-r--r--arch/arm/mach-mx5/board-mx53_loco.c1
-rw-r--r--arch/arm/mach-mx5/board-mx53_smd.c1
-rw-r--r--arch/arm/mach-mx5/devices-imx53.h2
-rw-r--r--arch/arm/mach-mx5/devices.c5
-rw-r--r--arch/arm/plat-mxc/ahci_sata.c110
-rw-r--r--arch/arm/plat-mxc/include/mach/ahci_sata.h5
10 files changed, 129 insertions, 0 deletions
diff --git a/arch/arm/configs/imx5_defconfig b/arch/arm/configs/imx5_defconfig
index 6264dd2e553f..0ca2ff235984 100644
--- a/arch/arm/configs/imx5_defconfig
+++ b/arch/arm/configs/imx5_defconfig
@@ -1198,6 +1198,7 @@ CONFIG_SENSORS_MAX17135=y
# CONFIG_SENSORS_LIS3_SPI is not set
# CONFIG_SENSORS_LIS3_I2C is not set
# CONFIG_SENSORS_MC13783_ADC is not set
+CONFIG_SENSORS_IMX_AHCI=y
CONFIG_MXC_MMA8450=y
CONFIG_MXC_MMA8451=y
# CONFIG_THERMAL is not set
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index fc470a0abbf5..054b96161bc0 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -170,6 +170,7 @@ config MACH_MX53_EVK
select IMX_HAVE_PLATFORM_MXC_GPU
select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
select IMX_HAVE_PLATFORM_SPI_IMX
+ select IMX_HAVE_PLATFORM_AHCI
help
Include support for MX53 EVK platform. This includes specific
configurations for the board and its peripherals.
@@ -211,6 +212,7 @@ config MACH_MX53_ARD
select IMX_HAVE_PLATFORM_IMX_UART
select IMX_HAVE_PLATFORM_MXC_GPU
select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
+ select IMX_HAVE_PLATFORM_AHCI
help
Include support for MX53 ARD platform. This includes specific
configurations for the board and its peripherals.
diff --git a/arch/arm/mach-mx5/board-mx53_ard.c b/arch/arm/mach-mx5/board-mx53_ard.c
index 101c11fcea24..7ef675e50369 100644
--- a/arch/arm/mach-mx5/board-mx53_ard.c
+++ b/arch/arm/mach-mx5/board-mx53_ard.c
@@ -248,6 +248,7 @@ static void __init mx53_ard_board_init(void)
imx53_add_imx2_wdt(0, NULL);
imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
imx53_add_sdhci_esdhc_imx(1, &mx53_ard_sd2_data);
+ mxc_register_device(&imx_ahci_device_hwmon, NULL);
weim_cs_config();
mx53_ard_io_init();
diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
index cf785f9bea71..4bc1c0c560e6 100644
--- a/arch/arm/mach-mx5/board-mx53_evk.c
+++ b/arch/arm/mach-mx5/board-mx53_evk.c
@@ -754,6 +754,7 @@ static void __init mx53_evk_board_init(void)
imx53_add_sdhci_esdhc_imx(0, &mx53_evk_sd1_data);
imx53_add_sdhci_esdhc_imx(2, &mx53_evk_sd3_data);
+ mxc_register_device(&imx_ahci_device_hwmon, NULL);
spi_register_board_info(mx53_evk_spi_board_info,
ARRAY_SIZE(mx53_evk_spi_board_info));
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
index 503c999727d2..69061d51e319 100644
--- a/arch/arm/mach-mx5/board-mx53_loco.c
+++ b/arch/arm/mach-mx5/board-mx53_loco.c
@@ -705,6 +705,7 @@ static void __init mx53_loco_board_init(void)
imx53_add_sdhci_esdhc_imx(0, &mx53_loco_sd1_data);
imx53_add_sdhci_esdhc_imx(2, &mx53_loco_sd3_data);
imx53_add_ahci(0, &mx53_loco_sata_data);
+ mxc_register_device(&imx_ahci_device_hwmon, NULL);
imx53_add_iim(&iim_data);
/* USB */
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c
index a9357f094e5d..01b197d35921 100644
--- a/arch/arm/mach-mx5/board-mx53_smd.c
+++ b/arch/arm/mach-mx5/board-mx53_smd.c
@@ -766,6 +766,7 @@ static void __init mx53_smd_board_init(void)
imx53_add_sdhci_esdhc_imx(1, &mx53_smd_sd2_data);
imx53_add_sdhci_esdhc_imx(2, &mx53_smd_sd3_data);
imx53_add_ahci(0, &mx53_smd_sata_data);
+ mxc_register_device(&imx_ahci_device_hwmon, NULL);
mx53_smd_init_usb();
imx53_add_iim(&iim_data);
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h
index 918e78254c9b..06d5099625dd 100644
--- a/arch/arm/mach-mx5/devices-imx53.h
+++ b/arch/arm/mach-mx5/devices-imx53.h
@@ -106,3 +106,5 @@ extern const struct imx_spdif_dai_data imx53_spdif_dai_data __initconst;
#define imx53_add_spdif_dai() imx_add_spdif_dai(&imx53_spdif_dai_data)
#define imx53_add_spdif_audio_device(pdata) imx_add_spdif_audio_device()
+
+extern struct platform_device imx_ahci_device_hwmon;
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 890d311ad0b4..f6f3f68e26a8 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -214,6 +214,11 @@ struct platform_device mxc_usbh2_wakeup_device = {
.resource = usbh2_wakeup_resources,
};
+struct platform_device imx_ahci_device_hwmon = {
+ .name = "imx-ahci-hwmon",
+ .id = -1,
+};
+
static struct mxc_gpio_port mxc_gpio_ports[] = {
{
.chip.label = "gpio-0",
diff --git a/arch/arm/plat-mxc/ahci_sata.c b/arch/arm/plat-mxc/ahci_sata.c
index 9dd607e9dca5..ab4fcf86bc4c 100644
--- a/arch/arm/plat-mxc/ahci_sata.c
+++ b/arch/arm/plat-mxc/ahci_sata.c
@@ -21,8 +21,118 @@
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/kernel.h>
+#include <linux/delay.h>
#include <mach/ahci_sata.h>
+int write_phy_ctl_ack_polling(u32 data, void __iomem *mmio,
+ int max_iterations, u32 exp_val)
+{
+ u32 i, val;
+
+ writel(data, mmio + PORT_PHY_CTL);
+
+ for (i = 0; i < max_iterations + 1; i++) {
+ val = readl(mmio + PORT_PHY_SR);
+ val = (val >> PORT_PHY_STAT_ACK_LOC) & 0x1;
+ if (val == exp_val)
+ return 0;
+ if (i == max_iterations) {
+ printk(KERN_ERR "Wait for CR ACK error!\n");
+ return 1;
+ }
+ usleep_range(100, 200);
+ }
+ return 0;
+}
+
+int sata_phy_cr_addr(u32 addr, void __iomem *mmio)
+{
+ u32 temp_wr_data;
+
+ /* write addr */
+ temp_wr_data = addr;
+ writel(temp_wr_data, mmio + PORT_PHY_CTL);
+
+ /* capture addr */
+ temp_wr_data |= PORT_PHY_CTL_CAP_ADR_LOC;
+
+ /* wait for ack */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 1))
+ return 1;
+
+ /* deassert cap addr */
+ temp_wr_data &= 0xffff;
+
+ /* wait for ack de-assetion */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 0))
+ return 1;
+
+ return 0;
+}
+
+int sata_phy_cr_write(u32 data, void __iomem *mmio)
+{
+ u32 temp_wr_data;
+
+ /* write data */
+ temp_wr_data = data;
+
+ /* capture data */
+ temp_wr_data |= PORT_PHY_CTL_CAP_DAT_LOC;
+
+ /* wait for ack */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 1))
+ return 1;
+
+ /* deassert cap data */
+ temp_wr_data &= 0xffff;
+
+ /* wait for ack de-assetion */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 0))
+ return 1;
+
+ /* assert wr signal */
+ temp_wr_data |= PORT_PHY_CTL_WRITE_LOC;
+
+ /* wait for ack */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 1))
+ return 1;
+
+ /* deassert wr _signal */
+ temp_wr_data = 0x0;
+
+ /* wait for ack de-assetion */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 0))
+ return 1;
+
+ return 0;
+}
+
+int sata_phy_cr_read(u32 *data, void __iomem *mmio)
+{
+ u32 temp_rd_data, temp_wr_data;
+
+ /* assert rd signal */
+ temp_wr_data = PORT_PHY_CTL_READ_LOC;
+
+ /* wait for ack */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 1))
+ return 1;
+
+ /* after got ack return data */
+ temp_rd_data = readl(mmio + PORT_PHY_SR);
+ *data = (temp_rd_data & 0xffff);
+
+ /* deassert rd _signal */
+ temp_wr_data = 0x0 ;
+
+ /* wait for ack de-assetion */
+ if (write_phy_ctl_ack_polling(temp_wr_data, mmio, 100, 0))
+ return 1;
+
+ return 0;
+}
+
/* AHCI module Initialization, if return 0, initialization is successful. */
int sata_init(void __iomem *addr, unsigned long timer1ms)
{
diff --git a/arch/arm/plat-mxc/include/mach/ahci_sata.h b/arch/arm/plat-mxc/include/mach/ahci_sata.h
index 21189954426b..edca22b4fc04 100644
--- a/arch/arm/plat-mxc/include/mach/ahci_sata.h
+++ b/arch/arm/plat-mxc/include/mach/ahci_sata.h
@@ -52,5 +52,10 @@ enum {
SATA_PHY_CR_CLOCK_MPLL_TST = 0x0017,
};
+extern int write_phy_ctl_ack_polling(u32 data, void __iomem *mmio,
+ int max_iterations, u32 exp_val);
+extern int sata_phy_cr_addr(u32 addr, void __iomem *mmio);
+extern int sata_phy_cr_write(u32 data, void __iomem *mmio);
+extern int sata_phy_cr_read(u32 *data, void __iomem *mmio);
extern int sata_init(void __iomem *addr, unsigned long timer1ms);
#endif /* __PLAT_MXC_AHCI_SATA_H__ */