Port-hpcsh archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

HD6446x driver



Hi! Valeriy and uch-san and all,


I knew UART of HD64461 did not work on PERSONA recently.  This trouble
will be corrected by me.

Moreover, IrDA of HPC can be communicated by 115200bps by using only
the interchangeability part of com of FIR.  I was convinced that it was
possible to correspond by hd64461uart and some initializations as a
result of doing an easy test with PERSONA.

Moreover, because I look alike HD64461 and HD64465 very much, it proposes
to merge these.
# hd64461if + hd64465if => shc (SH companion)
Do you have a big problem in merging these?  Also more better name?

Thanks,
--
kiyohara

? compile/LOVERS
? conf/LOVERS
? conf/LOVERS.diff
Index: conf/GENERIC
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcsh/conf/GENERIC,v
retrieving revision 1.87
diff -u -r1.87 GENERIC
--- conf/GENERIC        5 Dec 2009 20:11:14 -0000       1.87
+++ conf/GENERIC        27 Apr 2010 03:07:39 -0000
@@ -252,6 +252,7 @@
 # HITACHI PERSONA (HPW-50PAD, HPQ-650PA)
 #
 com0           at hd64461if?
+options        COM_REGMAP
 
 psh3pwr*       at adc?                 # PERSONA SH3 battery, on/off, etc
 
Index: dev/hd64461/hd64461.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcsh/dev/hd64461/hd64461.c,v
retrieving revision 1.22
diff -u -r1.22 hd64461.c
--- dev/hd64461/hd64461.c       5 Apr 2009 00:56:20 -0000       1.22
+++ dev/hd64461/hd64461.c       27 Apr 2010 03:07:40 -0000
@@ -110,9 +110,7 @@
 
        /* no drivers for FIR and AFE */
        stbcr |= HD64461_SYSSTBCR_SIRST
-               | HD64461_SYSSTBCR_SAFEST
-               | HD64461_SYSSTBCR_SAFECKE_IST
-               | HD64461_SYSSTBCR_SAFECKE_OST;
+               | HD64461_SYSSTBCR_SAFEST;
 
        hd64461_reg_write_2(HD64461_SYSSTBCR_REG16, stbcr);
 
Index: dev/hd64461/hd64461uart.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hpcsh/dev/hd64461/hd64461uart.c,v
retrieving revision 1.22
diff -u -r1.22 hd64461uart.c
--- dev/hd64461/hd64461uart.c   28 Apr 2008 20:23:22 -0000      1.22
+++ dev/hd64461/hd64461uart.c   27 Apr 2010 03:07:40 -0000
@@ -81,9 +81,6 @@
     hd64461uart_match, hd64461uart_attach, NULL, NULL);
 
 STATIC void hd64461uart_init(void);
-STATIC uint8_t hd64461uart_read_1(void *, bus_space_handle_t, bus_size_t);
-STATIC void hd64461uart_write_1(void *, bus_space_handle_t, bus_size_t,
-    uint8_t);
 
 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
 #ifndef COMCN_SPEED
@@ -107,11 +104,18 @@
 void
 hd64461uartcninit(struct consdev *cp)
 {
+       struct com_regs regs;
+       int i;
 
        hd64461uart_init();
 
-       comcnattach(hd64461uart_chip.io_tag, 0x0, COMCN_SPEED, COM_FREQ,
-           COM_TYPE_NORMAL, CONMODE);
+       memset(&regs, 0, sizeof(regs));
+       regs.cr_iot = hd64461uart_chip.io_tag;
+       regs.cr_iobase = 0x00000000;
+       regs.cr_nports = COM_NPORTS;
+       for (i = 0; i < __arraycount(regs.cr_map); i++)
+               regs.cr_map[i] = com_std_map[i] << 1;
+       comcnattach1(&regs, COMCN_SPEED, COM_FREQ, COM_TYPE_NORMAL, CONMODE);
 
        hd64461uart_chip.console = 1;
 }
@@ -120,22 +124,30 @@
 int
 hd64461uart_kgdb_init(void)
 {
+       struct com_regs regs;
+       int i;
 
        if (strcmp(kgdb_devname, "hd64461uart") != 0)
-               return (1);
+               return 1;
 
        if (hd64461uart_chip.console)
-               return (1);     /* can't share with console */
+               return 1;       /* can't share with console */
 
        hd64461uart_init();
 
-       if (com_kgdb_attach(hd64461uart_chip.io_tag, 0x0, kgdb_rate,
-           COM_FREQ, COM_TYPE_NORMAL, CONMODE) != 0) {
+       memset(&regs, 0, sizeof(regs));
+       regs.cr_iot = hd64461uart_chip.io_tag;
+       regs.cr_iobase = 0x00000000;
+       regs.cr_nports = COM_NPORTS;
+       for (i = 0; i < __arraycount(regs.cr_map); i++)
+               regs.cr_map[i] = com_std_map[i] << 1;
+       if (com_kgdb_attach1(&regs,
+           kgdb_rate, COM_FREQ, COM_TYPE_NORMAL, CONMODE) != 0) {
                printf("%s: KGDB console open failed.\n", __func__);
-               return (1);
+               return 1;
        }
 
-       return (0);
+       return 0;
 }
 #endif /* KGDB */
 
@@ -144,7 +156,7 @@
 {
        struct hd64461_attach_args *ha = aux;
 
-       return (ha->ha_module_id == HD64461_MODULE_UART);
+       return ha->ha_module_id == HD64461_MODULE_UART;
 }
 
 STATIC void
@@ -155,6 +167,7 @@
        struct com_softc *csc = &sc->sc_com;
        uint16_t r16;
        bus_space_handle_t ioh;
+       int i;
 
        csc->sc_dev = self;
        sc->sc_chip = &hd64461uart_chip;
@@ -167,6 +180,8 @@
        bus_space_map(sc->sc_chip->io_tag, 0, 8, 0, &ioh);
        csc->sc_frequency = COM_FREQ;
        COM_INIT_REGS(csc->sc_regs, sc->sc_chip->io_tag, ioh, 0);
+       for (i = 0; i < __arraycount(csc->sc_regs.cr_map); i++)
+               csc->sc_regs.cr_map[i] <<= 1;
 
        /* switch port to UART */
 
@@ -188,7 +203,7 @@
        com_attach_subr(csc);
 
        hd6446x_intr_establish(HD64461_INTC_UART, IST_LEVEL, IPL_TTY,
-           comintr, self);
+           comintr, csc);
 }
 
 STATIC void
@@ -201,23 +216,4 @@
        hd64461uart_chip.io_tag = bus_space_create(
                &hd64461uart_chip.__tag_body, "HD64461 UART I/O",
                HD64461_UART_REGBASE, 0); /* no extent */
-
-       /* override bus_space_read_1, bus_space_write_1 */
-       hd64461uart_chip.io_tag->hbs_r_1 = hd64461uart_read_1;
-       hd64461uart_chip.io_tag->hbs_w_1 = hd64461uart_write_1;
-}
-
-STATIC uint8_t
-hd64461uart_read_1(void *t, bus_space_handle_t h, bus_size_t ofs)
-{
-
-       return *(volatile uint8_t *)(h + (ofs << 1));
-}
-
-STATIC void
-hd64461uart_write_1(void *t, bus_space_handle_t h, bus_size_t ofs,
-    uint8_t val)
-{
-
-       *(volatile uint8_t *)(h + (ofs << 1)) = val;
 }


Home | Main Index | Thread Index | Old Index