Subject: patch pfckbd_callout_hitachi() in pfckbd.c
To: None <uwe@ptc.spbu.ru>
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
List: port-hpcsh
Date: 05/18/2005 14:50:10
----Next_Part(Wed_May_18_14:50:10_2005_732)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi, uwe.


I missed former patch. 
  http://mail-index.netbsd.org/port-hpcsh/2005/01/15/0000.html


fixed.
  1. GPIO (PCCR and PCDR) bits
  2. save and restore PCDR, PDDR, PEDR.


LCD (contrast) driver under test...
50PA{,D} is work. but 200, 30 don't work. X-<
--
kiyohara

----Next_Part(Wed_May_18_14:50:10_2005_732)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pfckbd.diff"

Index: sys/arch/hpcsh/dev/pfckbd.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcsh/dev/pfckbd.c,v
retrieving revision 1.14
diff -u -r1.14 pfckbd.c
--- sys/arch/hpcsh/dev/pfckbd.c	18 Jan 2005 04:09:09 -0000	1.14
+++ sys/arch/hpcsh/dev/pfckbd.c	16 May 2005 03:36:46 -0000
@@ -319,11 +319,11 @@
 void
 pfckbd_callout_hitachi(void *arg)
 {
-#define PFCKBD_HITACHI_PCCR_MASK 0xfffc
+#define PFCKBD_HITACHI_PCCR_MASK 0xfff3
 #define PFCKBD_HITACHI_PDCR_MASK 0x000c
 #define PFCKBD_HITACHI_PECR_MASK 0x30cf
 
-#define PFCKBD_HITACHI_PCDR_SCN_MASK 0xfe
+#define PFCKBD_HITACHI_PCDR_SCN_MASK 0xfd
 #define PFCKBD_HITACHI_PDDR_SCN_MASK 0xf7
 #define PFCKBD_HITACHI_PEDR_SCN_MASK 0xff
 
@@ -364,7 +364,7 @@
 		uint16_t cc, dc, ec; uint8_t c, d, e;
 	} scan[] = {
 		PE(6), PE(3), PE(1), PE(0), PC(7), PC(6), PC(5), PC(4),
-		PC(3), PC(2), PD(1), PC(1)
+		PC(3), PC(2), PD(1), PC(0)
 	};
 
 #undef PC
@@ -373,7 +373,7 @@
 
 	struct pfckbd_core *pc = arg;
 	uint16_t cc, dc, ec;
-	uint8_t data[2];
+	uint8_t data[2], cd, dd, ed;
 	int i;
 
 	if (!pc->pc_enabled)
@@ -384,9 +384,13 @@
 	dc = _reg_read_2(SH7709_PDCR) & ~PFCKBD_HITACHI_PDCR_MASK;
 	ec = _reg_read_2(SH7709_PECR) & ~PFCKBD_HITACHI_PECR_MASK;
 
+	cd = _reg_read_1(SH7709_PCDR);
+	dd = _reg_read_1(SH7709_PDDR);
+	ed = _reg_read_1(SH7709_PEDR);
+
 	for (i = 0; i < 12; i++) {
 		/* disable output to all lines except the one we scan */
-		_reg_write_2(SH7709_PDCR, cc | scan[i].cc);
+		_reg_write_2(SH7709_PCCR, cc | scan[i].cc);
 		_reg_write_2(SH7709_PDCR, dc | scan[i].dc);
 		_reg_write_2(SH7709_PECR, ec | scan[i].ec);
 		delay(5);
@@ -408,9 +412,9 @@
 	}
 
 	/* scan no lines */
-	_reg_write_1(SH7709_PCDR, PFCKBD_HITACHI_PCDR_SCN_MASK);
-	_reg_write_1(SH7709_PDDR, PFCKBD_HITACHI_PDDR_SCN_MASK);
-	_reg_write_1(SH7709_PEDR, PFCKBD_HITACHI_PEDR_SCN_MASK);
+	_reg_write_1(SH7709_PCDR, cd);
+	_reg_write_1(SH7709_PDDR, dd);
+	_reg_write_1(SH7709_PEDR, ed);
 
 	/* enable all scan lines */
 	_reg_write_2(SH7709_PCCR, cc | (0x5555 & PFCKBD_HITACHI_PCCR_MASK));

----Next_Part(Wed_May_18_14:50:10_2005_732)----