|
From: <bob...@us...> - 2007-07-22 13:53:06
|
Revision: 1199
http://svn.sourceforge.net/hackndev/?rev=1199&view=rev
Author: bobofdoom
Date: 2007-07-22 06:53:01 -0700 (Sun, 22 Jul 2007)
Log Message:
-----------
PalmT650: Added GSM module management driver.
- Currently can just be used to power on/off the modem. To use
juat echo 1 or 0 into /sys/devices/platform/palmt650-gsm/power_on
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650.c
linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmt650-gpio.h
Added Paths:
-----------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650_gsm.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Kconfig 2007-07-22 10:51:55 UTC (rev 1198)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Kconfig 2007-07-22 13:53:01 UTC (rev 1199)
@@ -1,7 +1,17 @@
menuconfig MACH_XSCALE_PALMTREO650
bool "Palm Treo 650"
select PXA27x
+ select KEYBOARD_PXA27x
help
Say Y here if you intend to run this kernel on a
Palm Treo 650. Currently there is only basic support
for this PDA.
+
+config PALMT650_GSM
+ tristate "Palm Treo 650 GSM baseband processor"
+ depends on MACH_XSCALE_PALMTREO650
+ default y
+ help
+ This module provides support for controlling power to
+ the GSM baseband processor in the Treo 650. Say Y here
+ if you are unsure.
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Makefile 2007-07-22 10:51:55 UTC (rev 1198)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/Makefile 2007-07-22 13:53:01 UTC (rev 1199)
@@ -3,3 +3,4 @@
#
obj-$(CONFIG_MACH_XSCALE_PALMTREO650) += palmt650.o palmt650_pm.o
+obj-$(CONFIG_PALMT650_GSM) += palmt650_gsm.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650.c 2007-07-22 10:51:55 UTC (rev 1198)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650.c 2007-07-22 13:53:01 UTC (rev 1199)
@@ -164,6 +164,17 @@
};
/*********************************************************
+ * GSM Baseband Processor
+ *********************************************************/
+struct platform_device palmt650_gsm = {
+ .name = "palmt650-gsm",
+ .id = -1,
+ .dev = {
+ .platform_data = NULL,
+ },
+};
+
+/*********************************************************
* USB Device Controller
*********************************************************/
@@ -308,6 +319,7 @@
&palmt650_kbd,
&palmt650_backlight,
&palmt650_led,
+ &palmt650_gsm,
};
/*********************************************************
Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650_gsm.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650_gsm.c (rev 0)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmt650/palmt650_gsm.c 2007-07-22 13:53:01 UTC (rev 1199)
@@ -0,0 +1,85 @@
+/*
+ * Palm Treo 650 GSM Management
+ *
+ * Copyright (C) 2007 Alex Osborne
+ *
+ * This code is available under the GNU GPL version 2 or later.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+
+#include <asm/arch/hardware.h>
+#include <asm/arch/palmt650-gpio.h>
+
+static ssize_t gsm_power_on_write(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ unsigned long on = simple_strtoul(buf, NULL, 10);
+ SET_ASIC6_GPIO(GSM_POWER, on);
+ printk("Setting GSM power to %ld\n", on);
+ return count;
+}
+
+static ssize_t gsm_power_on_read(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ printk("GPLR is %d\n", ASIC6_GPLR);
+ if (GET_ASIC6_GPIO(GSM_POWER)) {
+ return strlcpy(buf, "1\n", 3);
+ } else {
+ return strlcpy(buf, "0\n", 3);
+ }
+}
+
+static DEVICE_ATTR(power_on, 0644, gsm_power_on_read, gsm_power_on_write);
+
+static struct attribute *palmt650_gsm_attrs[] = {
+ &dev_attr_power_on.attr,
+ NULL
+};
+
+static struct attribute_group palmt650_gsm_attr_group = {
+ .name = NULL,
+ .attrs = palmt650_gsm_attrs,
+};
+
+static int __init palmt650_gsm_probe(struct platform_device *pdev)
+{
+ return sysfs_create_group(&pdev->dev.kobj, &palmt650_gsm_attr_group);
+}
+
+static int palmt650_gsm_remove(struct platform_device *pdev)
+{
+ sysfs_remove_group(&pdev->dev.kobj, &palmt650_gsm_attr_group);
+ return 0;
+}
+
+static struct platform_driver palmt650_gsm_driver = {
+ .probe = palmt650_gsm_probe,
+ .remove = palmt650_gsm_remove,
+ .suspend = NULL, /* not needed? */
+ .resume = NULL,
+ .driver = {
+ .name = "palmt650-gsm",
+ }
+};
+
+static int __devinit palmt650_gsm_init(void)
+{
+ return platform_driver_register(&palmt650_gsm_driver);
+}
+
+static void palmt650_gsm_exit(void)
+{
+ platform_driver_unregister(&palmt650_gsm_driver);
+}
+
+module_init(palmt650_gsm_init);
+module_exit(palmt650_gsm_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alex Osborne <bob...@gm...>");
+MODULE_DESCRIPTION("Palm Treo 650 GSM management");
Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmt650-gpio.h
===================================================================
--- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmt650-gpio.h 2007-07-22 10:51:55 UTC (rev 1198)
+++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmt650-gpio.h 2007-07-22 13:53:01 UTC (rev 1199)
@@ -17,23 +17,45 @@
#define PALMT650_ASIC6_SIZE (0x00100000)
/* ASIC 6 registers */
+/* Note: the naming and purpose of these registers is just a guess. */
-#define __REG16(x) (*((volatile u16 *)io_p2v(x)))
-#define ASIC6_LED0_TBS __REG16(0x08000080)
-#define ASIC6_LED0_U1 __REG16(0x08000082) /* unknown=0 */
-#define ASIC6_LED0_PERIOD __REG16(0x08000084)
-#define ASIC6_LED0_U2 __REG16(0x08000086) /* unknown=3 */
-#define ASIC6_LED0_DUTY __REG16(0x08000088)
-#define ASIC6_LED0_AUTOSTOP __REG16(0x0800008a)
-#define ASIC6_LED1_TBS __REG16(0x08000090)
-#define ASIC6_LED1_PERIOD __REG16(0x08000094)
-#define ASIC6_LED1_DUTY __REG16(0x08000098)
-#define ASIC6_LED1_AUTOSTOP __REG16(0x0800009a)
-#define ASIC6_LED2_TBS __REG16(0x080000a0)
-#define ASIC6_LED2_PERIOD __REG16(0x080000a4)
-#define ASIC6_LED2_DUTY __REG16(0x080000a8)
-#define ASIC6_LED2_AUTOSTOP __REG16(0x080000aa)
+#define __REG16(x) (*((volatile u16 *)(x)))
+#define __ASIC6_REG(x) __REG16(PALMT650_ASIC6_VIRT + (x))
+#define ASIC6_LED0_TBS __REG(0x80)
+#define ASIC6_LED0_U1 __ASIC6_REG(0x82) /* unknown=0 */
+#define ASIC6_LED0_PERIOD __ASIC6_REG(0x84)
+#define ASIC6_LED0_U2 __ASIC6_REG(0x86) /* unknown=3 */
+#define ASIC6_LED0_DUTY __ASIC6_REG(0x88)
+#define ASIC6_LED0_AUTOSTOP __ASIC6_REG(0x8a)
+#define ASIC6_LED1_TBS __ASIC6_REG(0x90)
+#define ASIC6_LED1_PERIOD __ASIC6_REG(0x94)
+#define ASIC6_LED1_DUTY __ASIC6_REG(0x98)
+#define ASIC6_LED1_AUTOSTOP __ASIC6_REG(0x9a)
+#define ASIC6_LED2_TBS __ASIC6_REG(0xa0)
+#define ASIC6_LED2_PERIOD __ASIC6_REG(0xa4)
+#define ASIC6_LED2_DUTY __ASIC6_REG(0xa8)
+#define ASIC6_LED2_AUTOSTOP __ASIC6_REG(0xaa)
+
+#define ASIC6_GPLR __ASIC6_REG(0x48)
+#define ASIC6_GPLR_GSM_POWER (1<<6)
+/* one of these will be reset the other power, not sure which is which */
+#define ASIC6_GPLR_BT_PW1 (1<<4)
+#define ASIC6_GPLR_BT_PW2 (1<<5)
+
+#define SET_ASIC6_GPIO(gpio, setp) \
+do { \
+if (setp) \
+ ASIC6_GPLR |= ASIC6_GPLR_ ## gpio; \
+else \
+ ASIC6_GPLR &= ~ASIC6_GPLR_ ## gpio; \
+} while (0)
+
+#define GET_ASIC6_GPIO(gpio) \
+ (ASIC6_GPLR & ASIC6_GPLR_ ## gpio)
+
+
+
/* Palm Treo 650 GPIOs */
#define GPIO_NR_PALMT650_POWER_DETECT 0
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|