mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-06 14:23:09 +02:00
108 lines
3.0 KiB
Diff
108 lines
3.0 KiB
Diff
|
From 5be7f629cff94bd67ba7d95c800763a9026708f2 Mon Sep 17 00:00:00 2001
|
||
|
From: Andy Green <andy@openmoko.com>
|
||
|
Date: Wed, 6 Aug 2008 12:16:38 +0100
|
||
|
Subject: [PATCH] fix-hdq-probe.patch
|
||
|
|
||
|
Signed-off-by: Andy Green <andy@openmoko.com>
|
||
|
---
|
||
|
arch/arm/mach-s3c2440/mach-gta02.c | 9 ++++-----
|
||
|
drivers/power/gta02_hdq.c | 22 ++++++++++++++++------
|
||
|
2 files changed, 20 insertions(+), 11 deletions(-)
|
||
|
|
||
|
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
|
||
|
index be2d901..aeedd42 100644
|
||
|
--- a/arch/arm/mach-s3c2440/mach-gta02.c
|
||
|
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
|
||
|
@@ -38,6 +38,7 @@
|
||
|
#include <linux/spi/glamo.h>
|
||
|
#include <linux/spi/spi_bitbang.h>
|
||
|
#include <linux/mmc/host.h>
|
||
|
+#include <linux/version.h>
|
||
|
|
||
|
#include <linux/mtd/mtd.h>
|
||
|
#include <linux/mtd/nand.h>
|
||
|
@@ -111,8 +112,7 @@ static int gta02_charger_active_status;
|
||
|
*/
|
||
|
struct fiq_ipc fiq_ipc;
|
||
|
EXPORT_SYMBOL(fiq_ipc);
|
||
|
-
|
||
|
-#define DIVISOR_FROM_US(x) ((x) << 1)
|
||
|
+#define DIVISOR_FROM_US(x) ((x) << 3)
|
||
|
|
||
|
#define FIQ_DIVISOR_VIBRATOR DIVISOR_FROM_US(100)
|
||
|
|
||
|
@@ -184,9 +184,9 @@ FIQ_HANDLER_ENTRY(256, 512)
|
||
|
if (hdq_shifter & 1)
|
||
|
hdq_ctr = 50 / HDQ_SAMPLE_PERIOD_US;
|
||
|
else
|
||
|
- hdq_ctr = 120 / HDQ_SAMPLE_PERIOD_US;
|
||
|
+ hdq_ctr = 140 / HDQ_SAMPLE_PERIOD_US;
|
||
|
/* carefully precompute the other phase length */
|
||
|
- hdq_ctr2 = (210 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
|
||
|
+ hdq_ctr2 = (220 - (hdq_ctr * HDQ_SAMPLE_PERIOD_US)) /
|
||
|
HDQ_SAMPLE_PERIOD_US;
|
||
|
hdq_state = HDQB_ADS_LOW;
|
||
|
hdq_shifter >>= 1;
|
||
|
@@ -782,7 +782,6 @@ struct platform_device gta02_hdq_device = {
|
||
|
};
|
||
|
#endif
|
||
|
|
||
|
-
|
||
|
/* NOR Flash */
|
||
|
|
||
|
#define GTA02_FLASH_BASE 0x18000000 /* GCS3 */
|
||
|
diff --git a/drivers/power/gta02_hdq.c b/drivers/power/gta02_hdq.c
|
||
|
index 5a79fd6..6c228b4 100644
|
||
|
--- a/drivers/power/gta02_hdq.c
|
||
|
+++ b/drivers/power/gta02_hdq.c
|
||
|
@@ -40,7 +40,7 @@ int gta02hdq_read(int address)
|
||
|
mutex_lock(&fiq_ipc.hdq_lock);
|
||
|
|
||
|
fiq_ipc.hdq_ads = address | HDQ_READ;
|
||
|
- fiq_ipc.hdq_request_ctr++;
|
||
|
+ fiq_ipc.hdq_request_ctr = fiq_ipc.hdq_transaction_ctr + 1;
|
||
|
fiq_kick();
|
||
|
/*
|
||
|
* FIQ takes care of it while we block our calling process
|
||
|
@@ -53,9 +53,13 @@ int gta02hdq_read(int address)
|
||
|
if (fiq_ipc.hdq_request_ctr != fiq_ipc.hdq_transaction_ctr)
|
||
|
continue;
|
||
|
|
||
|
- if (fiq_ipc.hdq_error)
|
||
|
+ if (fiq_ipc.hdq_error) {
|
||
|
+ printk(KERN_ERR "hdq timeout %d, %d / %d\n",
|
||
|
+ fiq_ipc.hdq_error, fiq_ipc.hdq_request_ctr,
|
||
|
+ fiq_ipc.hdq_transaction_ctr);
|
||
|
goto done; /* didn't see a response in good time */
|
||
|
-
|
||
|
+ }
|
||
|
+
|
||
|
ret = fiq_ipc.hdq_rx_data;
|
||
|
goto done;
|
||
|
}
|
||
|
@@ -193,12 +197,18 @@ static int __init gta02hdq_probe(struct platform_device *pdev)
|
||
|
{
|
||
|
struct resource *r = platform_get_resource(pdev, 0, 0);
|
||
|
|
||
|
- if (!machine_is_neo1973_gta02())
|
||
|
+ printk(KERN_ERR "gta02hdq driver starting\n");
|
||
|
+
|
||
|
+ if (!machine_is_neo1973_gta02()) {
|
||
|
+ printk(KERN_ERR "gta02hdq_probe only for GTA02\n");
|
||
|
return -EIO;
|
||
|
+ }
|
||
|
|
||
|
- if (!r)
|
||
|
+ if (!r) {
|
||
|
+ printk(KERN_ERR "gta02hdq_probe missing resource for GPIO\n");
|
||
|
return -EINVAL;
|
||
|
-
|
||
|
+ }
|
||
|
+
|
||
|
platform_set_drvdata(pdev, NULL);
|
||
|
|
||
|
mutex_init(&fiq_ipc.hdq_lock);
|
||
|
--
|
||
|
1.5.6.3
|
||
|
|