[ar71xx] fix GPIO function select bit definitions (based on a patch by Jonas <jmajau...
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1239-fix-hdq-probe.patch.patch
1 From 5be7f629cff94bd67ba7d95c800763a9026708f2 Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Wed, 6 Aug 2008 12:16:38 +0100
4 Subject: [PATCH] fix-hdq-probe.patch
5
6 Signed-off-by: Andy Green <andy@openmoko.com>
7 ---
8 arch/arm/mach-s3c2440/mach-gta02.c | 9 ++++-----
9 drivers/power/gta02_hdq.c | 22 ++++++++++++++++------
10 2 files changed, 20 insertions(+), 11 deletions(-)
11
12 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
13 index be2d901..aeedd42 100644
14 --- a/arch/arm/mach-s3c2440/mach-gta02.c
15 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
16 @@ -38,6 +38,7 @@
17 #include <linux/spi/glamo.h>
18 #include <linux/spi/spi_bitbang.h>
19 #include <linux/mmc/host.h>
20 +#include <linux/version.h>
21
22 #include <linux/mtd/mtd.h>
23 #include <linux/mtd/nand.h>
24 @@ -111,8 +112,7 @@ static int gta02_charger_active_status;
25 */
26 struct fiq_ipc fiq_ipc;
27 EXPORT_SYMBOL(fiq_ipc);
28 -
29 -#define DIVISOR_FROM_US(x) ((x) << 1)
30 +#define DIVISOR_FROM_US(x) ((x) << 3)
31
32 #define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
33
34 @@ -184,9 +184,9 @@ FIQ_HANDLER_ENTRY(256, 512)
35 if (hdq_shifter & 1)
36 hdq_ctr = 50 / HDQ_SAMPLE_PERIOD_US;
37 else
38 - hdq_ctr = 120 / HDQ_SAMPLE_PERIOD_US;
39 + hdq_ctr = 140 / HDQ_SAMPLE_PERIOD_US;
40 /* carefully precompute the other phase length */
41 - hdq_ctr2 = (210 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
42 + hdq_ctr2 = (220 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
43 HDQ_SAMPLE_PERIOD_US;
44 hdq_state = HDQB_ADS_LOW;
45 hdq_shifter >>= 1;
46 @@ -782,7 +782,6 @@ struct platform_device gta02_hdq_device = {
47 };
48 #endif
49
50 -
51 /* NOR Flash */
52
53 #define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
54 diff --git a/drivers/power/gta02_hdq.c b/drivers/power/gta02_hdq.c
55 index 5a79fd6..6c228b4 100644
56 --- a/drivers/power/gta02_hdq.c
57 +++ b/drivers/power/gta02_hdq.c
58 @@ -40,7 +40,7 @@ int gta02hdq_read(int address)
59 mutex_lock(&fiq_ipc.hdq_lock);
60
61 fiq_ipc.hdq_ads = address | HDQ_READ;
62 - fiq_ipc.hdq_request_ctr++;
63 + fiq_ipc.hdq_request_ctr = fiq_ipc.hdq_transaction_ctr + 1;
64 fiq_kick();
65 /*
66 * FIQ takes care of it while we block our calling process
67 @@ -53,9 +53,13 @@ int gta02hdq_read(int address)
68 if (fiq_ipc.hdq_request_ctr != fiq_ipc.hdq_transaction_ctr)
69 continue;
70
71 - if (fiq_ipc.hdq_error)
72 + if (fiq_ipc.hdq_error) {
73 + printk(KERN_ERR "hdq timeout %d, %d / %d\n",
74 + fiq_ipc.hdq_error, fiq_ipc.hdq_request_ctr,
75 + fiq_ipc.hdq_transaction_ctr);
76 goto done; /* didn't see a response in good time */
77 -
78 + }
79 +
80 ret = fiq_ipc.hdq_rx_data;
81 goto done;
82 }
83 @@ -193,12 +197,18 @@ static int __init gta02hdq_probe(struct platform_device *pdev)
84 {
85 struct resource *r = platform_get_resource(pdev, 0, 0);
86
87 - if (!machine_is_neo1973_gta02())
88 + printk(KERN_ERR "gta02hdq driver starting\n");
89 +
90 + if (!machine_is_neo1973_gta02()) {
91 + printk(KERN_ERR "gta02hdq_probe only for GTA02\n");
92 return -EIO;
93 + }
94
95 - if (!r)
96 + if (!r) {
97 + printk(KERN_ERR "gta02hdq_probe missing resource for GPIO\n");
98 return -EINVAL;
99 -
100 + }
101 +
102 platform_set_drvdata(pdev, NULL);
103
104 mutex_init(&fiq_ipc.hdq_lock);
105 --
106 1.5.6.3
107
This page took 0.046608 seconds and 5 git commands to generate.