From: <mar...@us...> - 2007-08-26 11:13:50
|
Revision: 1273 http://hackndev.svn.sourceforge.net/hackndev/?rev=1273&view=rev Author: marex_z71 Date: 2007-08-25 18:16:28 -0700 (Sat, 25 Aug 2007) Log Message: ----------- PalmLD: improved pcmcia driver Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 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-25 19:48:28 UTC (rev 1272) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pcmcia.c 2007-08-26 01:16:28 UTC (rev 1273) @@ -1,3 +1,27 @@ +/* + * + * Driver for Palm LifeDrive PCMCIA + * + * Copyright (C) 2007 Marek Vasut <mar...@gm...> + * Copyright (C) 2006 Alex Osborne <bob...@gm...> + * + * 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 of the License, 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + #include <linux/module.h> #include <linux/kernel.h> #include <linux/errno.h> @@ -27,18 +51,38 @@ #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 struct pcmcia_irqs palmld_socket_state_irqs[] = { +}; static int palmld_pcmcia_hw_init (struct soc_pcmcia_socket *skt) { - set_irq_type(PALMLD_PCMCIA_IRQ, IRQT_FALLING); - skt->irq = IRQ_GPIO(PALMLD_PCMCIA_IRQ); + GPSR(GPIO48_nPOE_MD) = GPIO_bit(GPIO48_nPOE_MD) | + GPIO_bit(GPIO49_nPWE_MD) | + GPIO_bit(GPIO50_nPIOR_MD) | + GPIO_bit(GPIO51_nPIOW_MD) | + GPIO_bit(GPIO85_nPCE_1_MD) | + GPIO_bit(GPIO54_nPCE_2_MD) | + GPIO_bit(GPIO79_pSKTSEL_MD) | + GPIO_bit(GPIO55_nPREG_MD) | + GPIO_bit(GPIO56_nPWAIT_MD) | + GPIO_bit(GPIO57_nIOIS16_MD); + pxa_gpio_mode(GPIO48_nPOE_MD); + pxa_gpio_mode(GPIO49_nPWE_MD); + pxa_gpio_mode(GPIO50_nPIOR_MD); + pxa_gpio_mode(GPIO51_nPIOW_MD); + pxa_gpio_mode(GPIO85_nPCE_1_MD); + pxa_gpio_mode(GPIO54_nPCE_2_MD); + pxa_gpio_mode(GPIO79_pSKTSEL_MD); + pxa_gpio_mode(GPIO55_nPREG_MD); + pxa_gpio_mode(GPIO56_nPWAIT_MD); + pxa_gpio_mode(GPIO57_nIOIS16_MD); + + skt->irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); + palmld_pcmcia_dbg("%s:%i, Socket:%d\n", __FUNCTION__, __LINE__, skt->nr); - return 0; + return soc_pcmcia_request_irqs(skt, palmld_socket_state_irqs, + ARRAY_SIZE(palmld_socket_state_irqs)); } static void palmld_pcmcia_hw_shutdown (struct soc_pcmcia_socket *skt) @@ -46,30 +90,16 @@ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__); } - static void palmld_pcmcia_socket_state (struct soc_pcmcia_socket *skt, struct pcmcia_state *state) { state->detect = 1; /* always inserted */ - state->ready = GET_GPIO(PALMLD_PCMCIA_IRQ) ? 1 : 0; + state->ready = GET_PALMLD_GPIO(PCMCIA_READY) ? 1 : 0; state->bvd1 = 1; state->bvd2 = 1; - state->wrprot = 1; + state->wrprot = 0; state->vs_3v = 1; state->vs_Xv = 0; - - /* - state->detect = GET_AXIMX5_GPIO (PCMCIA_DETECT_N) ? 0 : 1; - 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; - state->vs_3v = mq_base->get_GPIO (mq_base, 65) ? 1 : 0; - state->vs_Xv = 0; - */ - /*printk ("detect:%d ready:%d vcc:%d bvd1:%d bvd2:%d\n", - state->detect, state->ready, state->vs_3v, state->bvd1, state->bvd2); - */ } static int @@ -78,11 +108,8 @@ 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(PALMLD_PCMCIA_POWER, 1); - - /* GPIO 81 appears to be reset */ - SET_GPIO(PALMLD_PCMCIA_RESET, (state->flags & SS_RESET) ? 1 : 0); + SET_PALMLD_GPIO(PCMCIA_POWER, 1); + SET_PALMLD_GPIO(PCMCIA_RESET, (state->flags & SS_RESET) ? 1 : 0); return 0; } @@ -100,11 +127,9 @@ static struct pcmcia_low_level palmld_pcmcia_ops = { .owner = THIS_MODULE, - /* Setting it this way makes pcmcia-cs - scream about memory-cs (because of - HDD/CF memory in socket 0), but it's - much nicer than make some weird changes - in pxa pcmcia subsystem */ + /* Setting it this way makes pcmcia-cs scream about memory-cs + (because of HDD/CF memory in socket 0), but it's much nicer + than make some weird changes in pxa pcmcia subsystem */ .first = 0, .nr = 2, @@ -124,7 +149,6 @@ palmld_pcmcia_dbg("%s:%i\n", __FUNCTION__, __LINE__); } - static struct platform_device palmld_pcmcia_device = { .name = "pxa2xx-pcmcia", .id = 0, @@ -154,6 +178,6 @@ module_init(palmld_pcmcia_init); module_exit(palmld_pcmcia_exit); -MODULE_AUTHOR ("Alex Osborne <bob...@gm...>"); +MODULE_AUTHOR ("Alex Osborne <bob...@gm...>, Marek Vasut <mar...@gm...>"); MODULE_DESCRIPTION ("PCMCIA support for Palm LifeDrive"); MODULE_LICENSE ("GPL"); Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-08-25 19:48:28 UTC (rev 1272) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-08-26 01:16:28 UTC (rev 1273) @@ -96,6 +96,11 @@ #define GPIO_NR_PALMLD_BT_UART_CTS_MD (GPIO_NR_PALMLD_BT_CTS | GPIO_ALT_FN_1_IN) #define GPIO_NR_PALMLD_BT_UART_RTS_MD (GPIO_NR_PALMLD_BT_RTS | GPIO_ALT_FN_2_OUT) +/* PCMCIA, WiFi */ +#define GPIO_NR_PALMLD_PCMCIA_READY 38 +#define GPIO_NR_PALMLD_PCMCIA_POWER 36 +#define GPIO_NR_PALMLD_PCMCIA_RESET 81 + /* Utility macros */ #define GET_PALMLD_GPIO(gpio) \ (GPLR(GPIO_NR_PALMLD_ ## gpio) & GPIO_bit(GPIO_NR_PALMLD_ ## gpio)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |