1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-24 05:11:46 +02:00

[pxa] fix build with latest gpiolib changes

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33605 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2012-10-03 16:12:03 +00:00
parent 8eed7abf41
commit ffee55d944
3 changed files with 44 additions and 37 deletions

View File

@ -75,7 +75,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
obj-$(CONFIG_MACH_INTELMOTE2) += stargate2.o
--- /dev/null
+++ b/arch/arm/mach-pxa/gumstix-verdex.c
@@ -0,0 +1,793 @@
@@ -0,0 +1,794 @@
+/*
+ * linux/arch/arm/mach-pxa/gumstix-verdex.c
+ *
@ -103,6 +103,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+#include <linux/i2c/tsc2007.h>
+#include <linux/i2c/pxa-i2c.h>
+#include <linux/gpio.h>
+#include <linux/gpio-pxa.h>
+
+#include <asm/setup.h>
+#include <asm/memory.h>
@ -371,8 +372,8 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+
+inline void __init gumstix_pcmcia_cpld_clk(void)
+{
+ GPCR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
+ GPSR(GPIO_GUMSTIX_nPOE) = GPIO_bit(GPIO_GUMSTIX_nPOE);
+ gpio_set_value(GPIO_GUMSTIX_nPOE, 0);
+ gpio_set_value(GPIO_GUMSTIX_nPOE, 1);
+}
+
+inline unsigned char __init gumstix_pcmcia_cpld_read_bits(int bits)
@ -381,7 +382,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+ unsigned int shift = 0;
+ while(bits--)
+ {
+ result |= !!(GPLR(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
+ result |= !!(gpio_get_value(GPIO_GUMSTIX_nCD_0) & GPIO_bit(GPIO_GUMSTIX_nCD_0)) << shift;
+ shift ++;
+ gumstix_pcmcia_cpld_clk();
+ }
@ -438,15 +439,15 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+ }
+
+ // Setup the shift register
+ GPSR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
+ GPCR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 1);
+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 0);
+
+ // Tick the clock to program the shift register
+ gumstix_pcmcia_cpld_clk();
+
+ // Now set shift register into read mode
+ GPCR(GPIO_GUMSTIX_nPCE_1) = GPIO_bit(GPIO_GUMSTIX_nPCE_1);
+ GPSR(GPIO_GUMSTIX_nPCE_2) = GPIO_bit(GPIO_GUMSTIX_nPCE_2);
+ gpio_set_value(GPIO_GUMSTIX_nPCE_1, 0);
+ gpio_set_value(GPIO_GUMSTIX_nPCE_2, 1);
+
+ // We can read the bits now -- 0xC2 means "Dual compact flash"
+ if(gumstix_pcmcia_cpld_read_bits(8) != 0xC2)
@ -574,9 +575,9 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+ if(on_or_off) {
+ gpio_direction_input(17);
+ } else {
+ GPCR(17) = GPIO_bit(17);
+ gpio_set_value(17, 0);
+ gpio_direction_output(17, 0);
+ GPCR(17) = GPIO_bit(17);
+ gpio_set_value(17, 0);
+ }
+
+ return;
@ -843,7 +844,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+#ifdef CONFIG_FB_PXA_SHARP_LQ043_PSP
+ /* DISP must be always high while screen is on */
+ gpio_direction_output(GPIO77, 0);
+ GPSR(GPIO77) = GPIO_bit(GPIO77);
+ gpio_set_value(GPIO77, 1);
+#endif
+ verdex_udc_init();
+ verdex_mmc_init();

View File

@ -42,7 +42,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
/* usb state change */
#define GUMSTIX_USB_INTR_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_USB_GPIOn)
@@ -42,48 +54,135 @@ has detected a cable insertion; driven l
@@ -42,48 +54,136 @@ has detected a cable insertion; driven l
* ETH_RST provides a hardware reset line to the ethernet chip
* ETH is the IRQ line in from the ethernet chip to the PXA
*/
@ -66,13 +66,13 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
-#define GPIO_GUMSTIX_ETH1 27
#define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
-#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
+#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
+#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
-
-/* CF reset line */
-#define GPIO8_RESET 8
-
+#define GUMSTIX_ETH0_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH0)
+#define GUMSTIX_ETH1_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_ETH1)
-/* CF slot 0 */
-#define GPIO4_nBVD1 4
-#define GPIO4_nSTSCHG GPIO4_nBVD1
@ -159,6 +159,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+#endif
+
+#define GPIO_GUMSTIX_PRDY_nBSY_0_OLD GPIO109_PRDY_nBSY_0
+#define GUMSTIX_S0_PRDY_nBSY_OLD_IRQ PXA_GPIO_TO_IRQ(GPIO109_PRDY_nBSY_0)
+
+#define GUMSTIX_S0_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nSTSCHG_0)
+#define GUMSTIX_S0_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO_GUMSTIX_nCD_0)
@ -169,6 +170,18 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
-#define GPIO18_nSTSCHG GPIO18_nBVD1
-#define GPIO36_nCD 36
-#define GPIO27_PRDY_nBSY 27
-#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
-#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD)
-#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
-
-/* CF GPIO line modes */
-#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
-#define GPIO8_RESET_MD (GPIO8_RESET | GPIO_OUT)
-#define GPIO11_nCD_MD (GPIO11_nCD | GPIO_IN)
-#define GPIO18_nSTSCHG_MD (GPIO18_nSTSCHG | GPIO_IN)
-#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
-#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
-#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
+#define GPIO18_nBVD1_1 18
+#define GPIO18_nSTSCHG_1 GPIO18_nBVD1_1
+#define GPIO36_nCD_1 36
@ -179,18 +192,10 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+#define GPIO_GUMSTIX_nCD_1 GPIO36_nCD_1
+#define GPIO_GUMSTIX_PRDY_nBSY_1 GPIO27_PRDY_nBSY_1
+
#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG)
#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD)
#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY)
-/* CF GPIO line modes */
-#define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
-#define GPIO8_RESET_MD (GPIO8_RESET | GPIO_OUT)
-#define GPIO11_nCD_MD (GPIO11_nCD | GPIO_IN)
-#define GPIO18_nSTSCHG_MD (GPIO18_nSTSCHG | GPIO_IN)
-#define GPIO26_PRDY_nBSY_MD (GPIO26_PRDY_nBSY | GPIO_IN)
-#define GPIO27_PRDY_nBSY_MD (GPIO27_PRDY_nBSY | GPIO_IN)
-#define GPIO36_nCD_MD (GPIO36_nCD | GPIO_IN)
+#define GUMSTIX_S1_nSTSCHG_IRQ PXA_GPIO_TO_IRQ(GPIO18_nSTSCHG_1)
+#define GUMSTIX_S1_nCD_IRQ PXA_GPIO_TO_IRQ(GPIO36_nCD_1)
+#define GUMSTIX_S1_PRDY_nBSY_IRQ PXA_GPIO_TO_IRQ(GPIO27_PRDY_nBSY_1)
+
+/* CF GPIO line modes - correspond to mfp-pxa2[57]x.h */
+#define GPIO_GUMSTIX_CF_RESET_MD (GPIO_GUMSTIX_CF_RESET | GPIO_OUT)
+#define GPIO_GUMSTIX_CF_OLD_RESET_MD (GPIO_GUMSTIX_CF_OLD_RESET | GPIO_OUT)

View File

@ -38,7 +38,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
obj-$(CONFIG_PCMCIA_XXS1500) += xxs1500_ss.o
--- /dev/null
+++ b/drivers/pcmcia/pxa2xx_gumstix.c
@@ -0,0 +1,194 @@
@@ -0,0 +1,195 @@
+/*
+ * linux/drivers/pcmcia/pxa2xx_gumstix.c
+ *
@ -62,16 +62,14 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+
+#include <linux/gpio-pxa.h>
+
+#include <pcmcia/ss.h>
+
+#include <mach/hardware.h>
+#include <asm/mach-types.h>
+
+#ifdef CONFIG_MACH_GUMSTIX_VERDEX
+#include <mach/pxa27x.h>
+#else
+#include <mach/pxa27x.h>
+#endif
+
+#include <asm/io.h>
+#include <mach/gpio.h>
@ -80,6 +78,9 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+
+#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
+
+#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define GPLR(x) __REG2(0x40E00000, BANK_OFF((x) >> 5))
+
+static struct pcmcia_irqs gumstix_pcmcia_irqs0[] = {
+ { 0, GUMSTIX_S0_nCD_IRQ, "CF0 nCD" },
+ { 0, GUMSTIX_S0_nSTSCHG_IRQ, "CF0 nSTSCHG" },
@ -98,7 +99,7 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+/* Note: The verdex_pcmcia_pin_config is moved to gumstix_verdex.c in order to use mfp_pxa2xx_config
+ for board-specific pin configuration instead of the old deprecated pxa_gpio_mode function. Thus,
+ only the IRQ init is still needed to be done here. */
+ skt->irq = (skt->nr == 0) ? ((net_cf_vx_mode == 0) ? GUMSTIX_S0_PRDY_nBSY_IRQ : GUMSTIX_S0_PRDY_nBSY_OLD_IRQ) : GUMSTIX_S1_PRDY_nBSY_IRQ;
+ skt->socket.pci_irq = (skt->nr == 0) ? ((net_cf_vx_mode == 0) ? GUMSTIX_S0_PRDY_nBSY_IRQ : GUMSTIX_S0_PRDY_nBSY_OLD_IRQ) : GUMSTIX_S1_PRDY_nBSY_IRQ;
+
+ return (skt->nr == 0) ? soc_pcmcia_request_irqs(skt, gumstix_pcmcia_irqs0, ARRAY_SIZE(gumstix_pcmcia_irqs0)) :
+ soc_pcmcia_request_irqs(skt, gumstix_pcmcia_irqs1, ARRAY_SIZE(gumstix_pcmcia_irqs1));
@ -138,9 +139,9 @@ Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
+ prdy_nbsy = GPIO_GUMSTIX_PRDY_nBSY_1;
+ nbvd1 = GPIO_GUMSTIX_nBVD1_1;
+ }
+ state->detect = !(GPLR(cd) & GPIO_bit(cd));
+ state->ready = !!(GPLR(prdy_nbsy) & GPIO_bit(prdy_nbsy));
+ state->bvd1 = !!(GPLR(nbvd1) & GPIO_bit(nbvd1));
+ state->detect = !!gpio_get_value(cd);
+ state->ready = !!gpio_get_value(prdy_nbsy);
+ state->bvd1 = !!gpio_get_value(nbvd1);
+ state->bvd2 = 1;
+ state->vs_3v = 0;
+ state->vs_Xv = 0;