summaryrefslogtreecommitdiff
path: root/arch/arm/mach-exynos
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2014-06-04 15:08:23 +0200
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:59:43 +0900
commit555f4df039515b4ff57b63dbdf1aae6e06722d9b (patch)
treec953b3c6a2f50d782e8ccfb3583c2de1f34a9488 /arch/arm/mach-exynos
parent761ac987c8b0d6ff8fc00aaf6112077995fe929b (diff)
downloadlinux-3.10-555f4df039515b4ff57b63dbdf1aae6e06722d9b.tar.gz
linux-3.10-555f4df039515b4ff57b63dbdf1aae6e06722d9b.tar.bz2
linux-3.10-555f4df039515b4ff57b63dbdf1aae6e06722d9b.zip
ARM: Exynos: fix reboot hang on Odroid X2/U2/U3 with eMMC memory
Odroid X/X2/U2/U3 require special handling of SD4_nRESET_OUT line for eMMC memory to perform complete reboot. This patch adds code for performing such reset. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-id: I0dd05288da3d5e661772914cc853a1267609fc6d
Diffstat (limited to 'arch/arm/mach-exynos')
-rw-r--r--arch/arm/mach-exynos/Makefile1
-rw-r--r--arch/arm/mach-exynos/odroid-reboot.c96
2 files changed, 97 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 0b539ea1bda..9f6844cf498 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o
obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o
obj-$(CONFIG_ARCH_EXYNOS4) += sec-reboot.o
+obj-$(CONFIG_ARCH_EXYNOS4) += odroid-reboot.o
# device support
diff --git a/arch/arm/mach-exynos/odroid-reboot.c b/arch/arm/mach-exynos/odroid-reboot.c
new file mode 100644
index 00000000000..a81a5cb863a
--- /dev/null
+++ b/arch/arm/mach-exynos/odroid-reboot.c
@@ -0,0 +1,96 @@
+#include <linux/delay.h>
+#include <linux/pm.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+#include <asm/cacheflush.h>
+#include <asm/system.h>
+#include <mach/regs-pmu.h>
+#include <linux/gpio.h>
+#include "common.h"
+#include <linux/extcon.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+
+struct odroid_reboot_platform_data {
+ struct device *dev;
+ int power_gpio;
+};
+
+static struct odroid_reboot_platform_data *g_pdata;
+
+static void odroid_reboot(char str, const char *cmd)
+{
+ local_irq_disable();
+
+ writel(0x12345678, S5P_INFORM2); /* Don't enter lpm mode */
+ writel(0x0, S5P_INFORM4); /* Reset reboot count */
+
+ gpio_set_value(g_pdata->power_gpio, 0);
+ mdelay(150);
+ gpio_set_value(g_pdata->power_gpio, 1);
+
+ flush_cache_all();
+ outer_flush_all();
+
+ exynos4_restart(0, 0);
+
+ pr_emerg("%s: waiting for reboot\n", __func__);
+ while (1)
+ ;
+}
+
+static struct odroid_reboot_platform_data *odroid_reboot_parse_dt(struct device *dev)
+{
+ struct device_node *np = dev->of_node;
+ struct odroid_reboot_platform_data *pdata;
+
+ pdata = devm_kzalloc(dev, sizeof(struct odroid_reboot_platform_data),
+ GFP_KERNEL);
+ if (!pdata)
+ return NULL;
+
+ pdata->power_gpio = of_get_named_gpio(np, "reset-gpio", 0);
+ if (!gpio_is_valid(pdata->power_gpio)) {
+ dev_err(dev, "invalied power-gpio\n");
+ return NULL;
+ }
+ devm_gpio_request(dev, pdata->power_gpio, "reset-gpio");
+
+ return pdata;
+}
+
+static int odroid_reboot_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+
+ if (pdev->dev.of_node)
+ g_pdata = odroid_reboot_parse_dt(dev);
+
+ if (!g_pdata) {
+ dev_err(&pdev->dev, "failed to get platform data\n");
+ return -EINVAL;
+ }
+
+ g_pdata->dev = &pdev->dev;
+
+ /* Set machine specific functions */
+ arm_pm_restart = odroid_reboot;
+
+ return 0;
+}
+
+static struct of_device_id odroid_reboot_of_match[] = {
+ { .compatible = "hardkernel,odroid-reboot", },
+ { },
+};
+
+static struct platform_driver odroid_reboot_driver = {
+ .probe = odroid_reboot_probe,
+ .driver = {
+ .name = "odroid-reboot",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(odroid_reboot_of_match),
+ }
+};
+
+module_platform_driver(odroid_reboot_driver);