[ARM] 5145/1: PXA2xx: provide api to control IrDA pins state
authorDmitry Baryshkov <dbaryshkov@gmail.com>
Wed, 2 Jul 2008 12:53:45 +0000 (13:53 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 9 Jul 2008 19:56:28 +0000 (20:56 +0100)
Provide a set of functions to control state of pins dedicated to IrDA.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-pxa/Makefile
arch/arm/mach-pxa/pxa2xx.c [new file with mode: 0644]
include/asm-arm/arch-pxa/irda.h

index 02cbc3c..c4dfbe8 100644 (file)
@@ -13,8 +13,8 @@ obj-$(CONFIG_PXA_SSP)         += ssp.o
 obj-$(CONFIG_PXA_PWM)          += pwm.o
 
 # SoC-specific code
-obj-$(CONFIG_PXA25x)           += mfp-pxa2xx.o pxa25x.o
-obj-$(CONFIG_PXA27x)           += mfp-pxa2xx.o pxa27x.o
+obj-$(CONFIG_PXA25x)           += mfp-pxa2xx.o pxa2xx.o pxa25x.o
+obj-$(CONFIG_PXA27x)           += mfp-pxa2xx.o pxa2xx.o pxa27x.o
 obj-$(CONFIG_PXA3xx)           += mfp-pxa3xx.o pxa3xx.o smemc.o
 obj-$(CONFIG_CPU_PXA300)       += pxa300.o
 obj-$(CONFIG_CPU_PXA320)       += pxa320.o
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
new file mode 100644 (file)
index 0000000..d4f6415
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * linux/arch/arm/mach-pxa/pxa2xx.c
+ *
+ * code specific to pxa2xx
+ *
+ * Copyright (C) 2008 Dmitry Baryshkov
+ *
+ * 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/kernel.h>
+#include <linux/device.h>
+
+#include <asm/arch/mfp-pxa2xx.h>
+#include <asm/arch/mfp-pxa25x.h>
+#include <asm/arch/irda.h>
+
+static unsigned long pxa2xx_mfp_fir[] = {
+       GPIO46_FICP_RXD,
+       GPIO47_FICP_TXD,
+};
+
+static unsigned long pxa2xx_mfp_sir[] = {
+       GPIO46_STUART_RXD,
+       GPIO47_STUART_TXD,
+};
+
+static unsigned long pxa2xx_mfp_off[] = {
+       GPIO46_GPIO | MFP_LPM_DRIVE_LOW,
+       GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
+};
+
+void pxa2xx_transceiver_mode(struct device *dev, int mode)
+{
+       if (mode & IR_OFF) {
+               pxa2xx_mfp_config(pxa2xx_mfp_off, ARRAY_SIZE(pxa2xx_mfp_off));
+       } else if (mode & IR_SIRMODE) {
+               pxa2xx_mfp_config(pxa2xx_mfp_sir, ARRAY_SIZE(pxa2xx_mfp_sir));
+       } else if (mode & IR_FIRMODE) {
+               pxa2xx_mfp_config(pxa2xx_mfp_fir, ARRAY_SIZE(pxa2xx_mfp_fir));
+       } else
+               BUG();
+}
index 99f4f42..0a50c3c 100644 (file)
@@ -16,4 +16,8 @@ struct pxaficp_platform_data {
 
 extern void pxa_set_ficp_info(struct pxaficp_platform_data *info);
 
+#if defined(CONFIG_PXA25x) || defined(CONFIG_PXA27x)
+void pxa2xx_transceiver_mode(struct device *dev, int mode);
+#endif
+
 #endif