diff options
author | Richard Zhu <r65037@freescale.com> | 2011-07-19 13:45:36 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-07-20 13:14:53 +0800 |
commit | e62b7199f877c18af6f7fd96096c64d9d4da4939 (patch) | |
tree | c43540b5bc0d3ab11b8eec36efcee36a316e5f88 /arch/arm | |
parent | 6cf46ca6b708b7e94a416ed8eaf8faed26f1512f (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/arm')
-rwxr-xr-x | arch/arm/configs/imx5_defconfig | 1 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/Kconfig | 2 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_ard.c | 1 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_evk.c | 1 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_loco.c | 1 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/board-mx53_smd.c | 1 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/devices-imx53.h | 2 | ||||
-rwxr-xr-x | arch/arm/mach-mx5/devices.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-mxc/ahci_sata.c | 110 | ||||
-rwxr-xr-x | arch/arm/plat-mxc/include/mach/ahci_sata.h | 5 |
10 files changed, 129 insertions, 0 deletions
diff --git a/arch/arm/configs/imx5_defconfig b/arch/arm/configs/imx5_defconfig index 6264dd2e553f..0ca2ff235984 100755 --- 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 944ff0a9d1dd..d41b560ac72e 100755 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig @@ -205,6 +205,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. @@ -246,6 +247,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 100755 --- 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 100755 --- 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 100755 --- 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 100755 --- 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 a975dba5c345..cd29666c34e7 100755 --- a/arch/arm/mach-mx5/devices-imx53.h +++ b/arch/arm/mach-mx5/devices-imx53.h @@ -105,3 +105,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 100755 --- 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 100755 --- 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__ */ |