[Armadeus-commitlog] SF.net SVN: armadeus:[1229] trunk/target/linux/modules/gpio
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-04-16 12:27:27
|
Revision: 1229
http://armadeus.svn.sourceforge.net/armadeus/?rev=1229&view=rev
Author: artemys
Date: 2009-04-16 12:27:18 +0000 (Thu, 16 Apr 2009)
Log Message:
-----------
[LINUX] Makes ppdevemu compile on 2.6.29
Modified Paths:
--------------
trunk/target/linux/modules/gpio/core.c
trunk/target/linux/modules/gpio/ppdevemu.c
Added Paths:
-----------
trunk/target/linux/modules/gpio/iomux-mx1.h
Modified: trunk/target/linux/modules/gpio/core.c
===================================================================
--- trunk/target/linux/modules/gpio/core.c 2009-04-16 12:22:24 UTC (rev 1228)
+++ trunk/target/linux/modules/gpio/core.c 2009-04-16 12:27:18 UTC (rev 1229)
@@ -39,24 +39,7 @@
#include <mach/iomux-mx1-mx2.h>
#endif
#ifdef CONFIG_ARCH_IMX /* TO BE REMOVED WHEN MX1 PLATFORM EXIST */
-#define VA_GPIO_BASE IO_ADDRESS(IMX_GPIO_BASE)
-#define MXC_DDIR(x) (0x00 + ((x) << 8))
-#define MXC_OCR1(x) (0x04 + ((x) << 8))
-#define MXC_OCR2(x) (0x08 + ((x) << 8))
-#define MXC_ICONFA1(x) (0x0c + ((x) << 8))
-#define MXC_ICONFA2(x) (0x10 + ((x) << 8))
-#define MXC_ICONFB1(x) (0x14 + ((x) << 8))
-#define MXC_ICONFB2(x) (0x18 + ((x) << 8))
-#define MXC_DR(x) (0x1c + ((x) << 8))
-#define MXC_GIUS(x) (0x20 + ((x) << 8))
-#define MXC_SSR(x) (0x24 + ((x) << 8))
-#define MXC_ICR1(x) (0x28 + ((x) << 8))
-#define MXC_ICR2(x) (0x2c + ((x) << 8))
-#define MXC_IMR(x) (0x30 + ((x) << 8))
-#define MXC_ISR(x) (0x34 + ((x) << 8))
-#define MXC_GPR(x) (0x38 + ((x) << 8))
-#define MXC_SWR(x) (0x3c + ((x) << 8))
-#define MXC_PUEN(x) (0x40 + ((x) << 8))
+#include "iomux-mx1.h"
#endif
#include "core.h" /* for ioctl defs */
Added: trunk/target/linux/modules/gpio/iomux-mx1.h
===================================================================
--- trunk/target/linux/modules/gpio/iomux-mx1.h (rev 0)
+++ trunk/target/linux/modules/gpio/iomux-mx1.h 2009-04-16 12:27:18 UTC (rev 1229)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2006-2008 Julien Boibessot <jul...@ar...>
+ * Armadeus Project / Armadeus Systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __IOMUX_MX1_H__
+#define __IOMUX_MX1_H__
+
+#define VA_GPIO_BASE IO_ADDRESS(IMX_GPIO_BASE)
+#define MXC_DDIR(x) (0x00 + ((x) << 8))
+#define MXC_OCR1(x) (0x04 + ((x) << 8))
+#define MXC_OCR2(x) (0x08 + ((x) << 8))
+#define MXC_ICONFA1(x) (0x0c + ((x) << 8))
+#define MXC_ICONFA2(x) (0x10 + ((x) << 8))
+#define MXC_ICONFB1(x) (0x14 + ((x) << 8))
+#define MXC_ICONFB2(x) (0x18 + ((x) << 8))
+#define MXC_DR(x) (0x1c + ((x) << 8))
+#define MXC_GIUS(x) (0x20 + ((x) << 8))
+#define MXC_SSR(x) (0x24 + ((x) << 8))
+#define MXC_ICR1(x) (0x28 + ((x) << 8))
+#define MXC_ICR2(x) (0x2c + ((x) << 8))
+#define MXC_IMR(x) (0x30 + ((x) << 8))
+#define MXC_ISR(x) (0x34 + ((x) << 8))
+#define MXC_GPR(x) (0x38 + ((x) << 8))
+#define MXC_SWR(x) (0x3c + ((x) << 8))
+#define MXC_PUEN(x) (0x40 + ((x) << 8))
+
+#endif /* __IOMUX_MX1_H__ */
Modified: trunk/target/linux/modules/gpio/ppdevemu.c
===================================================================
--- trunk/target/linux/modules/gpio/ppdevemu.c 2009-04-16 12:22:24 UTC (rev 1228)
+++ trunk/target/linux/modules/gpio/ppdevemu.c 2009-04-16 12:27:18 UTC (rev 1229)
@@ -1,5 +1,5 @@
/*
- * Armadeus Parallel port (ppdev) emulator
+ * Armadeus Parallel port (ppdev) emulation on APF9328 LCD port
*
* Copyright (C) 2006-2009 Julien Boibessot <jul...@ar...>
* Armadeus Project / Armadeus Systems
@@ -28,14 +28,18 @@
#include <linux/moduleparam.h>
/* Pretend we're PPDEV for IOCTL */
#include <linux/ppdev.h>
+#include <asm/io.h>
+#include <mach/hardware.h>
+#ifdef CONFIG_ARCH_IMX /* TO BE REMOVED WHEN MX1 PLATFORM EXIST */
+#include "iomux-mx1.h"
+#endif
-
extern void gpioWriteOnPort( unsigned int, unsigned int );
extern unsigned int gpioReadFromPort( unsigned int );
extern void gpioSetPortDir( unsigned int, unsigned int );
extern unsigned int gpioGetPortDir( unsigned int );
-#define DRIVER_VERSION "v0.1"
+#define DRIVER_VERSION "v0.2"
#define PPDEV_DEVICE_NAME "Armadeus_ppdev"
/* by default, we use dynamic allocation of major numbers */
@@ -79,11 +83,17 @@
*/
static void initialize_port( void )
{
+ u32 temp;
+
/* If not already done by core module */
- GIUS(PORT_D) = GIUS(PORT_D) | PORT_D_31_10_MASK; /* set only portD 31..10 */
- PUEN(PORT_D) = PUEN(PORT_D) | PORT_D_31_10_MASK;
- OCR1(PORT_D) = OCR1(PORT_D) | 0xFFFF0000;
- OCR2(PORT_D) = OCR2(PORT_D) | 0xFFFFFFFF;
+ temp = __raw_readl(VA_GPIO_BASE + MXC_GIUS(PORT_D)) | PORT_D_31_10_MASK; /* set only portD 31..10 */
+ __raw_writel(temp, VA_GPIO_BASE + MXC_GIUS(PORT_D));
+ temp = __raw_readl(VA_GPIO_BASE + MXC_PUEN(PORT_D)) | PORT_D_31_10_MASK; /* set only portD 31..10 */
+ __raw_writel(temp, VA_GPIO_BASE + MXC_PUEN(PORT_D));
+ temp = __raw_readl(VA_GPIO_BASE + MXC_OCR1(PORT_D)) | 0xFFFF0000;
+ __raw_writel(temp, VA_GPIO_BASE + MXC_OCR1(PORT_D));
+ temp = __raw_readl(VA_GPIO_BASE + MXC_OCR2(PORT_D)) | 0xFFFFFFFF;
+ __raw_writel(temp, VA_GPIO_BASE + MXC_OCR2(PORT_D));
}
/* Handles write() done on /dev/ppdevxx */
@@ -146,7 +156,7 @@
return -ERESTARTSYS;
minor = MINOR(inode->i_rdev);
- if( minor > PPDEV_MAX_MINOR ) {
+ if (minor > PPDEV_MAX_MINOR ) {
printk("Minor outside range: %d !\n", minor);
return -EFAULT;
}
@@ -162,13 +172,13 @@
/* Write ctrl infos on assigned ctrl ppdevlines how ??? */
printk("/FROB 0x%x/ ", value);
/* Get value from port and clear bits we will set */
- lShadow = gpioReadFromPort( PORT_D );
+ lShadow = gpioReadFromPort(PORT_D);
/* Control lines are on PortD[14,13,12] */
lShadow &= 0xFFFF8FFF;
/* Control are written on iMX LCD Port control in GPIO mode, ie PortD[14,13,12] */
lShadow |= ((value & 0x0F) << 12);
/* Put it on port */
- gpioWriteOnPort( PORT_D, lShadow );
+ gpioWriteOnPort(PORT_D, lShadow);
printk(" 0x%x /", lShadow);
break;
@@ -186,7 +196,7 @@
break;
/* Get value from port and clear bits we will set */
- lShadow = gpioReadFromPort( PORT_D );
+ lShadow = gpioReadFromPort(PORT_D);
if (port_mode == 4) {
lShadow &= 0xFF000FFF; //0xFFF00FFF;
/* Control (4 highest bits) are written on iMX LCD
@@ -199,7 +209,7 @@
lShadow &= 0xFF807FFF;
lShadow |= ((value & 0xFF) << 15);
}
- gpioWriteOnPort( PORT_D, lShadow );
+ gpioWriteOnPort(PORT_D, lShadow);
/*printk(" 0x%x /", lShadow); */
break;
@@ -207,9 +217,9 @@
if (port_mode == 4) {
/* Data (4 lowest bits) are read from iMX LCD port data
in GPIO mode, ie PortD[18-15] */
- value = (gpioReadFromPort( PORT_D ) >> (15+4)) & 0x0F;
+ value = (gpioReadFromPort(PORT_D) >> (15+4)) & 0x0F;
} else {
- value = (gpioReadFromPort( PORT_D ) >> 15) & 0xFF;
+ value = (gpioReadFromPort(PORT_D) >> 15) & 0xFF;
}
ret = __put_user(value, (unsigned char *)arg);
@@ -220,11 +230,11 @@
ret = __get_user(value, (unsigned char *)arg);
printk("/DIR 0x%x/ ", value);
- if (port_mode == 4)
+ if (port_mode == 4) {
PP_DDIR_MASK = 0xFF807FFF; /* 1111 1111 1111 1000 0111 1111 1111 1111 ?? */
- else
+ } else {
PP_DDIR_MASK = 0xFF807FFF; /* 1111 1111 1000 0000 0111 1111 1111 1111 */
-
+ }
/* linux/ppdev.h define PPDATADIR as "Data line direction: non-zero for input mode."
For ppdevs, the logic is reversed - bit=1 == output
This is _not_ "generic" at all, but very much hard-wired towards being able to use an HD44780 LCD on the GPIO pins
@@ -281,7 +291,7 @@
return result;
}
/* Dynamic Major allocation */
- if( ppdev_major == 0 )
+ if (ppdev_major == 0)
ppdev_major = result;
/* Initialise GPIO port access semaphore */
@@ -303,3 +313,4 @@
MODULE_AUTHOR("JB / NC");
MODULE_DESCRIPTION("Armadeus Parallel Port");
MODULE_LICENSE("GPL");
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|