Revision: 1233
http://hackndev.svn.sourceforge.net/hackndev/?rev=1233&view=rev
Author: marex_z71
Date: 2007-08-10 19:00:54 -0700 (Fri, 10 Aug 2007)
Log Message:
-----------
PalmLD: slightly improved pcmcia driver
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c 2007-08-06 10:14:03 UTC (rev 1232)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c 2007-08-11 02:00:54 UTC (rev 1233)
@@ -12,30 +12,38 @@
#include <asm/hardware.h>
#include <../drivers/pcmcia/soc_common.h>
#include <asm/arch/pxa-regs.h>
+#include <asm/arch/palmld-gpio.h>
#include <asm/irq.h>
-#define GET_GPIO(gpio) \
- (GPLR(gpio) & GPIO_bit(gpio))
-#define SET_GPIO(gpio, setp) \
-do { \
-if (setp) \
- GPSR(gpio) = GPIO_bit(gpio); \
-else \
- GPCR(gpio) = GPIO_bit(gpio); \
-} while (0)
+#define DRV_NAME "palmld_pcmcia"
+/* Debuging macro */
+#define PALMLD_PCMCIA_DEBUG
+
+#ifdef PALMLD_PCMCIA_DEBUG
+#define palmld_pcmcia_dbg(format, args...) \
+ printk(KERN_INFO DRV_NAME": " format, ## args)
+#else
+#define palmld_pcmcia_dbg(format, args...) do {} while (0)
+#endif
+
+/* GPIO defines */
+#define PALMLD_PCMCIA_IRQ 38
+#define PALMLD_PCMCIA_POWER 36
+#define PALMLD_PCMCIA_RESET 81
+
static int palmld_pcmcia_hw_init (struct soc_pcmcia_socket *skt)
{
- set_irq_type(38, IRQT_FALLING);
- skt->irq = IRQ_GPIO(38);
+ set_irq_type(PALMLD_PCMCIA_IRQ, IRQT_FALLING);
+ skt->irq = IRQ_GPIO(PALMLD_PCMCIA_IRQ);
- printk("pcmcia_hw_init %d\n", skt->nr);
+ palmld_pcmcia_dbg("%s:%i, Socket:%d\n", __FUNCTION__, __LINE__, skt->nr);
return 0;
}
static void palmld_pcmcia_hw_shutdown (struct soc_pcmcia_socket *skt)
{
-
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
}
@@ -43,7 +51,7 @@
palmld_pcmcia_socket_state (struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
state->detect = 1; /* always inserted */
- state->ready = GET_GPIO(38) ? 1 : 0;
+ state->ready = GET_GPIO(PALMLD_PCMCIA_IRQ) ? 1 : 0;
state->bvd1 = 1;
state->bvd2 = 1;
state->wrprot = 1;
@@ -52,7 +60,7 @@
/*
state->detect = GET_AXIMX5_GPIO (PCMCIA_DETECT_N) ? 0 : 1;
- state->ready = mq_base->get_GPIO (mq_base, 2) ? 1 : 0;
+ state->ready = mq_base->get_GPIO (mq_base, 2) ? 1 : 0;
state->bvd1 = GET_AXIMX5_GPIO (PCMCIA_BVD1) ? 1 : 0;
state->bvd2 = GET_AXIMX5_GPIO (PCMCIA_BVD2) ? 1 : 0;
state->wrprot = 0;
@@ -64,34 +72,29 @@
*/
}
-
-
static int
palmld_pcmcia_configure_socket (struct soc_pcmcia_socket *skt, const socket_state_t *state)
{
- printk ("palmld_pcmcia_config_skt: Reset:%d Vcc:%d\n", (state->flags & SS_RESET) ? 1 : 0,
- state->Vcc);
+ palmld_pcmcia_dbg("%s:%i Reset:%d Vcc:%d\n", __FUNCTION__, __LINE__,
+ (state->flags & SS_RESET) ? 1 : 0, state->Vcc);
/* GPIO 36 appears to control power to the chip */
- SET_GPIO(36, 1);
+ SET_GPIO(PALMLD_PCMCIA_POWER, 1);
/* GPIO 81 appears to be reset */
- SET_GPIO(81, (state->flags & SS_RESET) ? 1 : 0);
+ SET_GPIO(PALMLD_PCMCIA_RESET, (state->flags & SS_RESET) ? 1 : 0);
return 0;
}
static void palmld_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
{
- printk("palmld_pcmcia_socket_init\n");
-
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
}
-
-
static void palmld_pcmcia_socket_suspend (struct soc_pcmcia_socket *skt)
{
- printk("palmld_pcmcia_socket_suspend\n");
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
}
static struct pcmcia_low_level palmld_pcmcia_ops = {
@@ -118,6 +121,7 @@
static void palmld_pcmcia_release (struct device * dev)
{
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
}
@@ -132,15 +136,18 @@
static int __init palmld_pcmcia_init(void)
{
- printk ("pcmcia_init\n");
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
- if(!machine_is_xscale_palmld()) return -ENODEV;
+ if(!machine_is_xscale_palmld())
+ return -ENODEV;
return platform_device_register (&palmld_pcmcia_device);
}
static void __exit palmld_pcmcia_exit(void)
{
+ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__);
+
platform_device_unregister (&palmld_pcmcia_device);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|