Log:
        HXD8: add hxd8 GSM/GPS platform device drivers.

Index: linux-2.6.21/arch/arm/common/Makefile
===================================================================
--- linux-2.6.21.orig/arch/arm/common/Makefile	2007-05-21 13:11:12.000000000 +0800
+++ linux-2.6.21/arch/arm/common/Makefile	2007-05-21 14:51:43.000000000 +0800
@@ -18,3 +18,4 @@
 obj-$(CONFIG_ARCH_IXP2000)	+= uengine.o
 obj-$(CONFIG_ARCH_IXP23XX)	+= uengine.o
 obj-$(CONFIG_MACH_NEO1973_GTA01)+= gta01_pm_gsm.o gta01_pm_gps.o gta01_pm_bt.o
+obj-$(CONFIG_MACH_HXD8)+= hxd8_pm_gsm.o hxd8_pm_gps.o
Index: linux-2.6.21/arch/arm/common/hxd8_pm_gps.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.21/arch/arm/common/hxd8_pm_gps.c	2007-05-21 14:53:50.000000000 +0800
@@ -0,0 +1,100 @@
+/*
+ * GPS Power Management code for the FIC HXD8 Navigator
+ *
+ * (C) 2007 by OpenMoko Inc.
+ * Author: Alec Tsai<[EMAIL PROTECTED]>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This file refers to gta01_pm_gps.c.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+
+#include <asm/hardware.h>
+#include <asm/arch/regs-gpio.h>
+
+#define UARTPORT	"/dev/ttySAC1"
+
+static int __init hxd8_pm_gps_probe(struct platform_device *pdev)
+{
+	printk("hxd8_pm_gps probing \n");
+
+	/* Initialize GPS Module. */
+	/* GPC0 High*/
+	s3c2410_gpio_cfgpin(S3C2410_GPC0, 0x01);
+	s3c2410_gpio_setpin(S3C2410_GPC0, 1);
+
+	/* GPC4 High*/
+	s3c2410_gpio_cfgpin(S3C2410_GPC4, 0x01);
+	s3c2410_gpio_setpin(S3C2410_GPC4, 1);
+
+	return 0;
+}
+
+static int hxd8_pm_gps_remove(struct platform_device *pdev)
+{
+	/* GPC0 Input in default. */
+	s3c2410_gpio_cfgpin(S3C2410_GPC0, 0x00);
+
+	/* GPC4 Input in default. */
+	s3c2410_gpio_cfgpin(S3C2410_GPC4, 0x00);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int hxd8_pm_gps_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	/* GPC0 Low*/
+	s3c2410_gpio_cfgpin(S3C2410_GPC0, 0x01);
+	s3c2410_gpio_setpin(S3C2410_GPC0, 0);
+	return 0;
+}
+
+static int hxd8_pm_gps_resume(struct platform_device *pdev)
+{
+	/* GPC0 High*/
+	s3c2410_gpio_cfgpin(S3C2410_GPC0, 0x01);
+	s3c2410_gpio_setpin(S3C2410_GPC0, 1);
+	return 0;
+}
+#else
+#define hxd8_pm_gps_suspend		NULL
+#define hxd8_pm_gps_resume		NULL
+#endif
+
+static struct platform_driver hxd8_pm_gps_driver = {
+	.probe		= hxd8_pm_gps_probe,
+	.remove		= hxd8_pm_gps_remove,
+	.suspend	= hxd8_pm_gps_suspend,
+	.resume		= hxd8_pm_gps_resume,
+	.driver		= {
+		.name		= "hxd8-pm-gps",
+	},
+};
+
+static int __devinit hxd8_pm_gps_init(void)
+{
+	return platform_driver_register(&hxd8_pm_gps_driver);
+}
+
+static void hxd8_pm_gps_exit(void)
+{
+	platform_driver_unregister(&hxd8_pm_gps_driver);
+}
+
+module_init(hxd8_pm_gps_init);
+module_exit(hxd8_pm_gps_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alec Tsai<[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("FIC HXD8 GPS Power Management");
+
Index: linux-2.6.21/arch/arm/common/hxd8_pm_gsm.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.21/arch/arm/common/hxd8_pm_gsm.c	2007-05-21 14:52:32.000000000 +0800
@@ -0,0 +1,107 @@
+/*
+ * GSM/GPRS Management code for the HXD8
+ *
+ * (C) 2007 by OpenMoko Inc.
+ * Author: Matt Hsu <[EMAIL PROTECTED]>
+ * All rights reserved.
+ *
+ * This platfrom driver is based on arch/arm/common/gta01_pm_gsm.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/hardware.h>
+#include <asm/arch-s3c2440/hxd8.h>
+
+#define  INITIAL_DELAY 			888
+
+#ifdef CONFIG_PM
+static int hxd8_gsm_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	/* set Modem CTS/RST/TXD/RXD pin as output to reduce power consumption */
+	s3c2410_gpio_setpin(S3C2410_GPH0, S3C2410_GPH0_OUTP);
+	s3c2410_gpio_setpin(S3C2410_GPH1, S3C2410_GPH1_OUTP);
+	s3c2410_gpio_setpin(S3C2410_GPH2, S3C2410_GPH2_OUTP);
+	s3c2410_gpio_setpin(S3C2410_GPH3, S3C2410_GPH3_OUTP);
+
+	/* set TXD/RXD */
+	s3c2410_gpio_setpin(S3C2410_GPH4, S3C2410_GPH4_OUTP);
+	s3c2410_gpio_setpin(S3C2410_GPH5, S3C2410_GPH5_OUTP);
+
+	return 0;
+}
+
+static int hxd8_gsm_resume(struct platform_device *pdev)
+{
+	/* restore previous config */
+	s3c2410_gpio_setpin(S3C2410_GPH0, S3C2410_GPH0_nCTS0);
+	s3c2410_gpio_setpin(S3C2410_GPH1, S3C2410_GPH1_nRTS0);
+	s3c2410_gpio_setpin(S3C2410_GPH2, S3C2410_GPH2_TXD0);
+	s3c2410_gpio_setpin(S3C2410_GPH3, S3C2410_GPH3_RXD0);
+
+	s3c2410_gpio_setpin(S3C2410_GPH4, S3C2410_GPH4_TXD1);
+	s3c2410_gpio_setpin(S3C2410_GPH5, S3C2410_GPH5_RXD1);
+	return 0;
+}
+#else
+#define hxd8_gsm_suspend NULL
+#define hxd8_gsm_resume	NULL
+#endif
+
+static int __init hxd8_gsm_probe(struct platform_device *pdev)
+{
+	dev_info(&pdev->dev, "hxd8_gsm_probing \n");
+	s3c2410_gpio_cfgpin(HXD8_GPIO_nGSM_EN, S3C2410_GPB7_OUTP);
+	s3c2410_gpio_setpin(HXD8_GPIO_nGSM_EN, 1);
+
+	/* wait for GSM module internal initialization */
+	mdelay(INITIAL_DELAY);
+	s3c2410_gpio_setpin(HXD8_GPIO_nGSM_EN, 0);
+
+	return 0;
+}
+
+static int hxd8_gsm_remove(struct platform_device *pdev)
+{
+	dev_info(&pdev->dev, "hxd8 gsm removing \n");
+	return 0;
+}
+
+
+static struct platform_driver hxd8_gsm_driver = {
+	.probe		= hxd8_gsm_probe,
+	.remove		= hxd8_gsm_remove,
+	.suspend	= hxd8_gsm_suspend,
+	.resume		= hxd8_gsm_resume,
+	.driver		= {
+		.name		= "hxd8-pm-gsm",
+	},
+};
+
+
+static int __devinit hxd8_gsm_init(void)
+{
+	return platform_driver_register(&hxd8_gsm_driver);
+}
+
+static void hxd8_gsm_exit(void)
+{
+	platform_driver_unregister(&hxd8_gsm_driver);
+}
+
+module_init(hxd8_gsm_init);
+module_exit(hxd8_gsm_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Matt Hsu <[EMAIL PROTECTED]>");
+MODULE_DESCRIPTION("FIC HXD8 GSM/GPRS Management");
Index: linux-2.6.21/arch/arm/mach-s3c2440/mach-hxd8.c
===================================================================
--- linux-2.6.21.orig/arch/arm/mach-s3c2440/mach-hxd8.c	2007-05-21 13:14:39.000000000 +0800
+++ linux-2.6.21/arch/arm/mach-s3c2440/mach-hxd8.c	2007-05-21 14:53:01.000000000 +0800
@@ -295,7 +295,11 @@
 };
 
 static struct platform_device hxd8_pm_gsm_dev = {
-	.name		= "gta01-pm-gsm",
+	.name		= "hxd8-pm-gsm",
+};
+
+static struct platform_device hxd8_pm_gps_dev = {
+	.name       = "hxd8-pm-gps",
 };
 
 static void gta01_udc_command(enum s3c2410_udc_cmd_e cmd)
@@ -382,6 +386,7 @@
 
 	//platform_device_register(&gta01_button_dev);
 	platform_device_register(&hxd8_pm_gsm_dev);
+	platform_device_register(&hxd8_pm_gps_dev);
 
 	platform_device_register(&hxd8_pmu_dev);
 
Index: linux-2.6.21/include/asm-arm/arch-s3c2440/hxd8.h
===================================================================
--- linux-2.6.21.orig/include/asm-arm/arch-s3c2440/hxd8.h	2007-05-21 13:39:02.000000000 +0800
+++ linux-2.6.21/include/asm-arm/arch-s3c2440/hxd8.h	2007-05-21 13:39:59.000000000 +0800
@@ -10,6 +10,7 @@
 #define HXD8_GPIO_BACKLIGHT	S3C2410_GPB0
 #define HXD8_GPIO_USB_PULLUP	S3C2410_GPB9
 #define HXD8_GPIO_PCF50606	S3C2410_GPF6
+#define HXD8_GPIO_nGSM_EN 	S3C2410_GPB7
 
 #define HXD8_IRQ_PCF50606	IRQ_EINT6
 

Reply via email to