? arch/zaurus/compile/C700 ? arch/zaurus/compile/C700a ? arch/zaurus/conf/C700 ? arch/zaurus/conf/C700a ? arch/zaurus/dev/c700lcd.c ? arch/zaurus/dev/c700lcdvar.h ? arch/zaurus/dev/w100.c ? arch/zaurus/dev/w100reg.h ? arch/zaurus/dev/w100var.h Index: arch/arm/xscale/pxa2x0_dmac.c =================================================================== RCS file: /cvsroot/src/sys/arch/arm/xscale/pxa2x0_dmac.c,v retrieving revision 1.9 diff -u -p -r1.9 pxa2x0_dmac.c --- arch/arm/xscale/pxa2x0_dmac.c 23 Nov 2011 23:07:29 -0000 1.9 +++ arch/arm/xscale/pxa2x0_dmac.c 2 Jan 2012 10:42:04 -0000 @@ -766,24 +766,39 @@ static inline int dmac_validate_desc(struct dmac_xfer_desc *xd, size_t *psize, bool *misaligned_flag) { + bus_dma_segment_t *dma_segs = xd->xd_dma_segs; + bus_addr_t periph_end; + bus_size_t align; size_t size; - int i; + int i, nsegs = xd->xd_nsegs; /* * Make sure the transfer parameters are acceptable. */ if (xd->xd_addr_hold && - (xd->xd_nsegs != 1 || xd->xd_dma_segs[0].ds_len == 0)) + (nsegs != 1 || dma_segs[0].ds_len == 0)) return (EINVAL); - for (i = 0, size = 0; i < xd->xd_nsegs; i++) { - if (xd->xd_dma_segs[i].ds_addr & 0x7) { + periph_end = CPU_IS_PXA270 ? PXA270_PERIPH_END : PXA250_PERIPH_END; + for (i = 0, size = 0; i < nsegs; i++) { + if (dma_segs[i].ds_addr >= PXA2X0_PERIPH_START && + dma_segs[i].ds_addr + dma_segs[i].ds_len < periph_end) + /* Internal Peripherals. */ + align = 0x03; + else /* Companion-Chip/External Peripherals/External Memory. */ + align = 0x07; + /* + * XXXX: + * Also PXA27x has more constraints by pairs Source/Target. + */ + + if (dma_segs[i].ds_addr & align) { if (!CPU_IS_PXA270) return (EFAULT); *misaligned_flag = true; } - size += xd->xd_dma_segs[i].ds_len; + size += dma_segs[i].ds_len; } *psize = size; Index: arch/zaurus/conf/files.zaurus =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/conf/files.zaurus,v retrieving revision 1.9 diff -u -p -r1.9 files.zaurus --- arch/zaurus/conf/files.zaurus 19 Jun 2011 16:20:09 -0000 1.9 +++ arch/zaurus/conf/files.zaurus 2 Jan 2012 10:42:07 -0000 @@ -75,6 +75,12 @@ file arch/zaurus/dev/zssp.c zssp attach lcd at pxaip with zlcd file arch/zaurus/dev/zlcd.c zlcd +# LCD frame buffer for SL-C7x0 +device c700lcd: wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation +attach c700lcd at pxaip +file arch/zaurus/dev/c700lcd.c c700lcd needs-flag +file arch/zaurus/dev/w100.c c700lcd + # GPIO keyboard device zkbd: wskbddev attach zkbd at pxaip Index: arch/zaurus/dev/scoop.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/scoop.c,v retrieving revision 1.9 diff -u -p -r1.9 scoop.c --- arch/zaurus/dev/scoop.c 19 Jul 2011 15:11:49 -0000 1.9 +++ arch/zaurus/dev/scoop.c 2 Jan 2012 10:42:07 -0000 @@ -161,25 +161,19 @@ scoop_gpio_pin_ctl(struct scoop_softc *s void scoop_set_backlight(int on, int cont) { - struct scoop_softc *sc; -#if 0 struct scoop_softc *sc0; + struct scoop_softc *sc1; sc0 = device_lookup_private(&scoop_cd, 0); -#endif - - sc = device_lookup_private(&scoop_cd, 1); - if (sc != NULL) { + sc1 = device_lookup_private(&scoop_cd, 1); + if (sc1 != NULL) { /* C3000 */ - scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_CONT, !cont); - scoop_gpio_pin_write(sc, SCOOP1_BACKLIGHT_ON, on); - } -#if 0 - else if (sc0 != NULL) { - scoop_gpio_pin_write(sc0, - SCOOP0_BACKLIGHT_CONT, cont); + scoop_gpio_pin_write(sc1, SCOOP1_BACKLIGHT_CONT, !cont); + scoop_gpio_pin_write(sc1, SCOOP1_BACKLIGHT_ON, on); + } else if (sc0 != NULL) { + /* C860 */ + scoop_gpio_pin_write(sc0, SCOOP0_BACKLIGHT_CONT, cont); } -#endif } /* @@ -291,6 +285,9 @@ scoop_charge_battery(int enable, int vol { struct scoop_softc *sc; + if (!ZAURUS_ISC3000) + return; + sc = device_lookup_private(&scoop_cd, 0); if (sc != NULL) { @@ -304,6 +301,12 @@ scoop_discharge_battery(int enable) { struct scoop_softc *sc; + if (!ZAURUS_ISC3000) + return; + + if (!ZAURUS_ISC3000) + return; + sc = device_lookup_private(&scoop_cd, 0); if (sc != NULL) { @@ -333,6 +336,9 @@ scoop0_set_card_power(enum scoop_card ca bus_space_handle_t ioh; uint16_t cpr; + if (!ZAURUS_ISC3000) + return; + sc = device_lookup_private(&scoop_cd, 0); if (sc == NULL) return; @@ -399,6 +405,9 @@ scoop_suspend(void) struct scoop_softc *sc, *sc0, *sc1; uint32_t rv; + if (!ZAURUS_ISC3000) + return; + sc0 = device_lookup_private(&scoop_cd, 0); sc1 = device_lookup_private(&scoop_cd, 1); Index: arch/zaurus/dev/scoopreg.h =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/scoopreg.h,v retrieving revision 1.4 diff -u -p -r1.4 scoopreg.h --- arch/zaurus/dev/scoopreg.h 17 Oct 2007 19:58:34 -0000 1.4 +++ arch/zaurus/dev/scoopreg.h 2 Jan 2012 10:42:07 -0000 @@ -61,7 +61,9 @@ #define SCOOP0_LED_GREEN 1 #define SCOOP0_JK_B_C3000 2 +#define SCOOP0_SWA_C860 2 #define SCOOP0_CHARGE_OFF_C3000 3 +#define SCOOP0_SWB_C860 3 #define SCOOP0_MUTE_L 4 #define SCOOP0_MUTE_R 5 #define SCOOP0_AKIN_PULLUP 6 Index: arch/zaurus/dev/zapm.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/zapm.c,v retrieving revision 1.11 diff -u -p -r1.11 zapm.c --- arch/zaurus/dev/zapm.c 19 Jun 2011 16:20:09 -0000 1.11 +++ arch/zaurus/dev/zapm.c 2 Jan 2012 10:42:07 -0000 @@ -649,9 +649,11 @@ static void zapm_set_charging(struct zapm_softc *sc, int enable) { - scoop_discharge_battery(0); - scoop_charge_battery(enable, 0); - scoop_led_set(SCOOP_LED_ORANGE, enable); + if (ZAURUS_ISC3000) { + scoop_discharge_battery(0); + scoop_charge_battery(enable, 0); + scoop_led_set(SCOOP_LED_ORANGE, enable); + } } /* @@ -867,7 +869,8 @@ zapm_poll1(void *v, int do_suspend) if (charging) zapm_set_charging(sc, 0); sc->discharging = 1; - scoop_discharge_battery(1); + if (ZAURUS_ISC3000) + scoop_discharge_battery(1); callout_schedule(&sc->sc_discharge_poll, DISCHARGE_TIMEOUT); } else if (!ac_state) { Index: arch/zaurus/dev/zkbd.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/zkbd.c,v retrieving revision 1.14 diff -u -p -r1.14 zkbd.c --- arch/zaurus/dev/zkbd.c 21 Jun 2011 18:13:19 -0000 1.14 +++ arch/zaurus/dev/zkbd.c 2 Jan 2012 10:42:07 -0000 @@ -72,6 +72,32 @@ static const int gpio_strobe_pins_c3000[ 114 }; +static const int gpio_sense_pins_c860[] = { + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65 +}; + +static const int gpio_strobe_pins_c860[] = { + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77 +}; + static const int stuck_keys[] = { 7, 15, @@ -87,8 +113,10 @@ struct zkbd_softc { const int *sc_sense_array; const int *sc_strobe_array; + const int *sc_stuck_keys; int sc_nsense; int sc_nstrobe; + int sc_nstuck; short sc_onkey_pin; short sc_sync_pin; @@ -108,6 +136,7 @@ struct zkbd_softc { /* wskbd bits */ struct device *sc_wskbddev; + struct wskbd_mapdata *sc_keymapdata; int sc_rawkbd; #ifdef WSDISPLAY_COMPAT_RAWKBD const char *sc_xt_keymap; @@ -161,6 +190,11 @@ static struct wskbd_mapdata zkbd_keymapd KB_US, }; +static struct wskbd_mapdata zkbd_keymapdata_c860 = { + zkbd_keydesctab_c860, + KB_US, +}; + static int zkbd_match(device_t parent, cfdata_t cf, void *aux) { @@ -201,14 +235,33 @@ zkbd_attach(device_t parent, device_t se sc->sc_strobe_array = gpio_strobe_pins_c3000; sc->sc_nsense = __arraycount(gpio_sense_pins_c3000); sc->sc_nstrobe = __arraycount(gpio_strobe_pins_c3000); + sc->sc_stuck_keys = stuck_keys; + sc->sc_nstuck = __arraycount(stuck_keys); sc->sc_maxkbdcol = 10; sc->sc_onkey_pin = 95; sc->sc_sync_pin = 16; sc->sc_swa_pin = 97; sc->sc_swb_pin = 96; + sc->sc_keymapdata = &zkbd_keymapdata; #ifdef WSDISPLAY_COMPAT_RAWKBD sc->sc_xt_keymap = xt_keymap; #endif + } else if (ZAURUS_ISC860) { + sc->sc_sense_array = gpio_sense_pins_c860; + sc->sc_strobe_array = gpio_strobe_pins_c860; + sc->sc_nsense = __arraycount(gpio_sense_pins_c860); + sc->sc_nstrobe = __arraycount(gpio_strobe_pins_c860); + sc->sc_stuck_keys = NULL; + sc->sc_nstuck = 0; + sc->sc_maxkbdcol = 0; + sc->sc_onkey_pin = -1; + sc->sc_sync_pin = -1; + sc->sc_swa_pin = -1; + sc->sc_swb_pin = -1; + sc->sc_keymapdata = &zkbd_keymapdata_c860; +#ifdef WSDISPLAY_COMPAT_RAWKBD + sc->sc_xt_keymap = xt_keymap_c860; +#endif } else { /* XXX */ return; @@ -244,22 +297,26 @@ zkbd_attach(device_t parent, device_t se zkbd_irq, sc); } - pxa2x0_gpio_intr_establish(sc->sc_onkey_pin, IST_EDGE_BOTH, IPL_TTY, - zkbd_on, sc); - pxa2x0_gpio_intr_establish(sc->sc_sync_pin, IST_EDGE_RISING, IPL_TTY, - zkbd_sync, sc); - pxa2x0_gpio_intr_establish(sc->sc_swa_pin, IST_EDGE_BOTH, IPL_TTY, - zkbd_hinge, sc); - pxa2x0_gpio_intr_establish(sc->sc_swb_pin, IST_EDGE_BOTH, IPL_TTY, - zkbd_hinge, sc); + if (sc->sc_onkey_pin >= 0) + pxa2x0_gpio_intr_establish(sc->sc_onkey_pin, IST_EDGE_BOTH, + IPL_TTY, zkbd_on, sc); + if (sc->sc_sync_pin >= 0) + pxa2x0_gpio_intr_establish(sc->sc_sync_pin, IST_EDGE_RISING, + IPL_TTY, zkbd_sync, sc); + if (sc->sc_swa_pin >= 0) + pxa2x0_gpio_intr_establish(sc->sc_swa_pin, IST_EDGE_BOTH, + IPL_TTY, zkbd_hinge, sc); + if (sc->sc_swb_pin >= 0) + pxa2x0_gpio_intr_establish(sc->sc_swb_pin, IST_EDGE_BOTH, + IPL_TTY, zkbd_hinge, sc); if (glass_console) { - wskbd_cnattach(&zkbd_consops, sc, &zkbd_keymapdata); + wskbd_cnattach(&zkbd_consops, sc, sc->sc_keymapdata); a.console = 1; } else { a.console = 0; } - a.keymap = &zkbd_keymapdata; + a.keymap = sc->sc_keymapdata; a.accessops = &zkbd_accessops; a.accesscookie = sc; @@ -377,8 +434,8 @@ zkbd_poll(void *v) stuck = 0; /* extend xt_keymap to do this faster. */ /* ignore 'stuck' keys' */ - for (j = 0; j < __arraycount(stuck_keys); j++) { - if (stuck_keys[j] == i) { + for (j = 0; j < sc->sc_nstuck; j++) { + if (sc->sc_stuck_keys[j] == i) { stuck = 1; break; } @@ -461,7 +518,12 @@ zkbd_on(void *v) { #if NAPM > 0 struct zkbd_softc *sc = (struct zkbd_softc *)v; - int down = pxa2x0_gpio_get_bit(sc->sc_onkey_pin) ? 1 : 0; + int down; + + if (sc->sc_onkey_pin < 0) + return 1; + + down = pxa2x0_gpio_get_bit(sc->sc_onkey_pin) ? 1 : 0; /* * Change run mode depending on how long the key is held down. @@ -503,8 +565,13 @@ static int zkbd_hinge(void *v) { struct zkbd_softc *sc = (struct zkbd_softc *)v; - int a = pxa2x0_gpio_get_bit(sc->sc_swa_pin) ? 1 : 0; - int b = pxa2x0_gpio_get_bit(sc->sc_swb_pin) ? 2 : 0; + int a, b; + + if (sc->sc_swa_pin < 0 || sc->sc_swb_pin < 0) + return 1; + + a = pxa2x0_gpio_get_bit(sc->sc_swa_pin) ? 1 : 0; + b = pxa2x0_gpio_get_bit(sc->sc_swb_pin) ? 2 : 0; sc->sc_hinge = a | b; Index: arch/zaurus/dev/zkbdmap.h =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/zkbdmap.h,v retrieving revision 1.5 diff -u -p -r1.5 zkbdmap.h --- arch/zaurus/dev/zkbdmap.h 19 Jun 2011 16:20:09 -0000 1.5 +++ arch/zaurus/dev/zkbdmap.h 2 Jan 2012 10:42:07 -0000 @@ -86,6 +86,73 @@ static const keysym_t zkbd_keydesc_us[] KC(93), KS_Mode_switch /* Fn */ }; +static const keysym_t zkbd_keydesc_us_c860[] = { + KC(2), KS_Tab, KS_Tab, KS_Caps_Lock, + KC(3), KS_Cmd_Screen0, KS_f1, /* Cal, */ + KC(4), KS_Cmd_Screen1, KS_f2, /* Addr, */ + KC(5), KS_Cmd_Screen2, KS_f3, /* Mail, */ + KC(6), KS_Cmd_Screen3, KS_f4, /* Home, */ + KC(7), KS_Power, /* XXX */ + KC(8), KS_1, KS_exclam, + KC(9), KS_2, KS_quotedbl, + KC(10), KS_q, + KC(11), KS_w, KS_W, KS_asciicircum, + KC(12), KS_a, + KC(13), KS_z, + KC(14), KS_Cmd, KS_Alt_L, + KC(15), KS_KP_Right, /* OK, (ext) */ + KC(16), KS_Cmd_BrightnessDown, KS_3, KS_numbersign, + KC(17), KS_Cmd_BrightnessUp, KS_4, KS_dollar, + KC(18), KS_e, KS_E, KS_equal, + KC(19), KS_s, + KC(20), KS_d, KS_D, KS_grave, + KC(21), KS_x, + KC(22), KS_Control_L, + KC(23), KS_KP_Left, /*Cancel (ext)*/ + KC(24), KS_5, KS_percent, + KC(25), KS_r, KS_R, KS_plus, + KC(26), KS_t, KS_T, KS_bracketleft, + KC(27), KS_f, KS_F, KS_backslash, + KC(28), KS_c, + KC(29), KS_minus, KS_minus, KS_at, + KC(30), KS_Cmd_Debugger,KS_Escape, /* Cancel, */ + KC(31), KS_KP_Down, /* tog left, */ + KC(32), KS_6, KS_ampersand, + KC(33), KS_y, KS_Y, KS_bracketright, + KC(34), KS_g, KS_G, KS_semicolon, + KC(35), KS_v, + KC(36), KS_b, KS_B, KS_underscore, + KC(37), KS_space, + KC(38), KS_KP_Enter, /* OK, */ + KC(39), KS_KP_Up, /* tog right, */ + KC(40), KS_7, KS_apostrophe, + KC(41), KS_8, KS_parenleft, + KC(42), KS_u, KS_U, KS_braceleft, + KC(43), KS_h, KS_H, KS_colon, + KC(44), KS_n, + KC(45), KS_comma, KS_slash, KS_less, + KC(46), KS_Cmd_Screen4, KS_f5, /* Menu, */ + KC(48), KS_9, KS_parenright, + KC(49), KS_i, KS_I, KS_braceright, + KC(50), KS_j, KS_J, KS_asterisk, + KC(51), KS_m, + KC(52), KS_period, KS_question, KS_greater, + KC(54), KS_KP_Left, KS_KP_Left, KS_Home, /* left, */ + KC(56), KS_0, KS_asciitilde, + KC(57), KS_o, + KC(58), KS_k, + KC(59), KS_l, KS_L, KS_bar, + KC(61), KS_KP_Up, KS_KP_Up, KS_Prior, /* up, */ + KC(62), KS_KP_Down, KS_KP_Down, KS_Next, /* down, */ + KC(64), KS_Delete, KS_BackSpace, + KC(65), KS_p, + KC(68), KS_Return, + KC(70), KS_KP_Right, KS_KP_Right, KS_End, /* right, */ + KC(75), KS_Shift_R, + KC(84), KS_Shift_L, + KC(93), KS_Mode_switch /* Fn */ +}; + #ifdef WSDISPLAY_COMPAT_RAWKBD static const char xt_keymap[] = { /* KC(0), */ 0x1d, /* KS_Control_L, */ @@ -183,6 +250,103 @@ static const char xt_keymap[] = { /* KC(92), */ 0x00, /* NC */ /* KC(93), */ 0xb8, /* KS_Mode_switch Fn */ }; + +static const char xt_keymap_c860[] = { + /* KC(0), */ 0x00, /* NC */ + /* KC(1), */ 0x00, /* NC */ + /* KC(2), */ 0x0f, /* KS_Tab, KS_Tab, KS_Caps_Lock, */ + /* KC(3), */ 0x3b, /* KS_Cmd_Screen0, KS_f1, Cal, */ + /* KC(4), */ 0x3c, /* KS_Cmd_Screen1, KS_f2, Addr, */ + /* KC(5), */ 0x3d, /* KS_Cmd_Screen2, KS_f3, Mail, */ + /* KC(6), */ 0x3e, /* KS_Cmd_Screen3, KS_f4, Home, */ + /* KC(7), */ 0x00, /* XXX */ + /* KC(8), */ 0x02, /* KS_1, KS_exclam, */ + /* KC(9), */ 0x03, /* KS_2, KS_quotedbl, */ + /* KC(10), */ 0x10, /* KS_q, */ + /* KC(11), */ 0x11, /* KS_w, KS_W, KS_asciicircum, */ + /* KC(12), */ 0x1e, /* KS_a, */ + /* KC(13), */ 0x2c, /* KS_z, */ + /* KC(14), */ 0x38, /* KS_Cmd, KS_Alt_L, */ + /* KC(15), */ 0xcd, /* KS_KP_Right, OK, (ext) */ + /* KC(16), */ 0x04, /* KS_3, KS_numbersign, */ + /* KC(17), */ 0x05, /* KS_4, KS_dollar, */ + /* KC(18), */ 0x12, /* KS_e, KS_E, KS_equal, */ + /* KC(19), */ 0x1f, /* KS_s, */ + /* KC(20), */ 0x20, /* KS_d, KS_D, KS_grave, */ + /* KC(21), */ 0x2d, /* KS_x, */ + /* KC(22), */ 0x1d, /* KS_Control_L, */ + /* KC(23), */ 0xcb, /* KS_KP_Left, cancel (ext), */ + /* KC(24), */ 0x06, /* KS_5, KS_percent, */ + /* KC(25), */ 0x13, /* KS_r, KS_R, KS_plus, */ + /* KC(26), */ 0x14, /* KS_t, KS_T, KS_bracketleft, */ + /* KC(27), */ 0x21, /* KS_f, KS_F, KS_backslash, */ + /* KC(28), */ 0x2e, /* KS_c, */ + /* KC(29), */ 0x0c, /* KS_minus, KS_minus, KS_at, */ + /* KC(30), */ 0x01, /* KS_Escape, Cancel */ + /* KC(31), */ 0xd0, /* KS_KP_Down, tog left, */ + /* KC(32), */ 0x07, /* KS_6, KS_ampersand, */ + /* KC(33), */ 0x15, /* KS_y, KS_Y, KS_bracketright, */ + /* KC(34), */ 0x22, /* KS_g, KS_G, KS_semicolon, */ + /* KC(35), */ 0x2f, /* KS_v, */ + /* KC(36), */ 0x30, /* KS_b, KS_B, KS_underscore, */ + /* KC(37), */ 0x39, /* KS_space, */ + /* KC(38), */ 0x9c, /* KS_KP_Enter, ok */ + /* KC(39), */ 0xc8, /* KS_KP_Up, tog right, */ + /* KC(40), */ 0x08, /* KS_7, KS_apostrophe, */ + /* KC(41), */ 0x09, /* KS_8, KS_parenleft, */ + /* KC(42), */ 0x16, /* KS_u, KS_U, KS_braceleft, */ + /* KC(43), */ 0x23, /* KS_h, KS_H, KS_colon, */ + /* KC(44), */ 0x31, /* KS_n, */ + /* KC(45), */ 0x33, /* KS_comma, KS_slash, KS_less, */ + /* KC(46), */ 0x3f, /* KS_Cmd_Screen4, KS_f5, Menu, */ + /* KC(47), */ 0x00, /* NC */ + /* KC(48), */ 0x0a, /* KS_9, KS_parenright, */ + /* KC(49), */ 0x17, /* KS_i, KS_I, KS_braceright, */ + /* KC(50), */ 0x24, /* KS_j, KS_J, KS_asterisk, */ + /* KC(51), */ 0x32, /* KS_m, */ + /* KC(52), */ 0x34, /* KS_period, KS_question, KS_greater, */ + /* KC(53), */ 0x00, /* NC */ + /* KC(54), */ 0xcb, /* KS_KP_Left, left, */ + /* KC(55), */ 0x00, /* NC */ + /* KC(56), */ 0x0b, /* KS_0, KS_asciitilde, */ + /* KC(57), */ 0x18, /* KS_o, */ + /* KC(58), */ 0x25, /* KS_k, */ + /* KC(59), */ 0x26, /* KS_l, KS_L, KS_bar, */ + /* KC(60), */ 0x00, /* NC */ + /* KC(61), */ 0xc8, /* KS_KP_Up, up, */ + /* KC(62), */ 0xd0, /* KS_KP_Down, down, */ + /* KC(63), */ 0x00, /* NC */ + /* KC(64), */ 0x0e, /* KS_Delete, KS_BackSpace, */ + /* KC(65), */ 0x19, /* KS_p, */ + /* KC(66), */ 0x00, /* NC */ + /* KC(67), */ 0x00, /* NC */ + /* KC(68), */ 0x1c, /* KS_Return, */ + /* KC(69), */ 0x00, /* NC */ + /* KC(70), */ 0xcd, /* KS_KP_Right, right, */ + /* KC(71), */ 0x00, /* NC */ + /* KC(72), */ 0x00, /* NC */ + /* KC(73), */ 0x00, /* NC */ + /* KC(74), */ 0x00, /* NC */ + /* KC(75), */ 0x00, /* NC */ + /* KC(76), */ 0x00, /* NC */ + /* KC(77), */ 0x00, /* NC */ + /* KC(78), */ 0x00, /* NC */ + /* KC(79), */ 0x00, /* NC */ + /* KC(80), */ 0x00, /* NC */ + /* KC(81), */ 0x00, /* NC */ + /* KC(82), */ 0x00, /* NC */ + /* KC(83), */ 0x36, /* KS_Shift_R, */ + /* KC(84), */ 0x2a, /* KS_Shift_L, */ + /* KC(85), */ 0x00, /* NC */ + /* KC(86), */ 0x00, /* NC */ + /* KC(87), */ 0x00, /* NC */ + /* KC(88), */ 0x00, /* NC */ + /* KC(89), */ 0x00, /* NC */ + /* KC(90), */ 0x00, /* NC */ + /* KC(91), */ 0x00, /* NC */ + /* KC(92), */ 0x00, /* NC */ + /* KC(93), */ 0xb8, /* KS_Mode_switch Fn */ +}; #endif #define KBD_MAP(name, base, map) \ @@ -194,5 +358,11 @@ static const struct wscons_keydesc zkbd_ {0, 0, 0, 0} }; +static const struct wscons_keydesc zkbd_keydesctab_c860[] = { + KBD_MAP(KB_US, 0, zkbd_keydesc_us_c860), + + {0, 0, 0, 0} +}; + #undef KBD_MAP #undef KC Index: arch/zaurus/dev/zmci.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/zmci.c,v retrieving revision 1.3 diff -u -p -r1.3 zmci.c --- arch/zaurus/dev/zmci.c 19 Jun 2011 16:20:09 -0000 1.3 +++ arch/zaurus/dev/zmci.c 2 Jan 2012 10:42:07 -0000 @@ -63,6 +63,7 @@ struct zmci_softc { void *sc_detect_ih; int sc_detect_pin; int sc_wp_pin; + int sc_power_pin; }; static int pxamci_match(device_t, cfdata_t, void *); @@ -82,7 +83,7 @@ static int pxamci_match(device_t parent, cfdata_t cf, void *aux) { - if (ZAURUS_ISC1000 || ZAURUS_ISC3000) + if (ZAURUS_ISC860 || ZAURUS_ISC1000 || ZAURUS_ISC3000) return 1; return 0; } @@ -101,8 +102,13 @@ pxamci_attach(device_t parent, device_t pxa2x0_gpio_set_function(sc->sc_detect_pin, GPIO_IN); pxa2x0_gpio_set_function(sc->sc_wp_pin, GPIO_IN); } else { - /* XXX: C7x0/C8x0 */ - return; + /* C860 */ + sc->sc_detect_pin = C860_GPIO_SD_DETECT_PIN; + sc->sc_wp_pin = C860_GPIO_SD_WP_PIN; + sc->sc_power_pin = C860_GPIO_SD_POWER_PIN; + pxa2x0_gpio_set_function(sc->sc_detect_pin, GPIO_IN); + pxa2x0_gpio_set_function(sc->sc_wp_pin, GPIO_IN); + pxa2x0_gpio_set_function(sc->sc_power_pin, GPIO_OUT|GPIO_SET); } /* Establish SD detect interrupt */ @@ -162,7 +168,10 @@ zmci_set_power(void *arg, uint32_t ocr) struct zmci_softc *sc = (struct zmci_softc *)arg; if (ISSET(ocr, MMC_OCR_3_2V_3_3V|MMC_OCR_3_3V_3_4V)) { - scoop_set_sdmmc_power(1); + if (ZAURUS_ISC3000) + scoop_set_sdmmc_power(1); + else if (ZAURUS_ISC860) + pxa2x0_gpio_set_bit(sc->sc_power_pin); return 0; } @@ -173,7 +182,10 @@ zmci_set_power(void *arg, uint32_t ocr) } /* power off */ - scoop_set_sdmmc_power(0); + if (ZAURUS_ISC3000) + scoop_set_sdmmc_power(0); + else if(ZAURUS_ISC860) + pxa2x0_gpio_clear_bit(sc->sc_power_pin); return 0; } Index: arch/zaurus/dev/zssp.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/zssp.c,v retrieving revision 1.11 diff -u -p -r1.11 zssp.c --- arch/zaurus/dev/zssp.c 19 Jul 2011 15:11:49 -0000 1.11 +++ arch/zaurus/dev/zssp.c 2 Jan 2012 10:42:07 -0000 @@ -35,15 +35,40 @@ __KERNEL_RCSID(0, "$NetBSD: zssp.c,v 1.1 #define GPIO_ADS7846_CS_C3000 14 /* SSP SFRM */ #define GPIO_MAX1111_CS_C3000 20 #define GPIO_TG_CS_C3000 53 +#define GPIO_ADS7846_CS_C860 24 /* SSP SFRM */ +#define GPIO_MAX1111_CS_C860 20 +#define GPIO_TG_CS_C860 19 #define SSCR0_ADS7846_C3000 0x06ab /* 12bit/Microwire/div by 7 */ #define SSCR0_MAX1111 0x0387 #define SSCR0_LZ9JG18 0x01ab +#define SSCR0_ADS7846_C860 0x00ab /* 12bit/Microwire/div by 7 */ + +struct zssp_ads7846 { + u_int gpio; + uint32_t sscr0; +}; +struct zssp_max1111 { + u_int gpio; + uint32_t sscr0; +}; +struct zssp_lz9jg18 { + u_int gpio; + uint32_t sscr0; + int sclk_pin; + int sfrm_pin; + int txd_pin; + int rxd_pin; +}; struct zssp_softc { device_t sc_dev; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; + bus_addr_t sc_ssp; + struct zssp_ads7846 ads7846; + struct zssp_max1111 max1111; + struct zssp_lz9jg18 lz9jg18; }; static int zssp_match(device_t, cfdata_t, void *); @@ -78,7 +103,33 @@ zssp_attach(device_t parent, device_t se aprint_naive("\n"); sc->sc_iot = &pxa2x0_bs_tag; - if (bus_space_map(sc->sc_iot, PXA2X0_SSP1_BASE, PXA2X0_SSP_SIZE, + if (ZAURUS_ISC1000 || ZAURUS_ISC3000) { + sc->sc_ssp = PXA2X0_SSP1_BASE; + sc->ads7846.gpio = GPIO_ADS7846_CS_C3000; + sc->ads7846.sscr0 = SSCR0_ADS7846_C3000; + sc->max1111.gpio = GPIO_MAX1111_CS_C3000; + sc->max1111.sscr0 = SSCR0_MAX1111; + sc->lz9jg18.gpio = GPIO_TG_CS_C3000; + sc->lz9jg18.sscr0 = SSCR0_LZ9JG18; + sc->lz9jg18.sclk_pin = 19; + sc->lz9jg18.sfrm_pin = 14; + sc->lz9jg18.txd_pin = 87; + sc->lz9jg18.rxd_pin = 86; + } else { + sc->sc_ssp = PXA2X0_SSP_BASE; + sc->ads7846.gpio = GPIO_ADS7846_CS_C860; + sc->ads7846.sscr0 = SSCR0_ADS7846_C860; + sc->max1111.gpio = GPIO_MAX1111_CS_C860; + sc->max1111.sscr0 = SSCR0_MAX1111; + sc->lz9jg18.gpio = GPIO_TG_CS_C860; + sc->lz9jg18.sscr0 = SSCR0_LZ9JG18; + sc->lz9jg18.sclk_pin = 23; + sc->lz9jg18.sfrm_pin = 24; + sc->lz9jg18.txd_pin = 25; + sc->lz9jg18.rxd_pin = 26; + } + + if (bus_space_map(sc->sc_iot, sc->sc_ssp, PXA2X0_SSP_SIZE, 0, &sc->sc_ioh)) { aprint_error_dev(sc->sc_dev, "can't map bus space\n"); return; @@ -105,12 +156,12 @@ zssp_init(void) pxa2x0_clkman_config(CKEN_SSP, 1); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, SSCR0_LZ9JG18); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, sc->lz9jg18.sscr0); bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR1, 0); - pxa2x0_gpio_set_function(GPIO_ADS7846_CS_C3000, GPIO_OUT|GPIO_SET); - pxa2x0_gpio_set_function(GPIO_MAX1111_CS_C3000, GPIO_OUT|GPIO_SET); - pxa2x0_gpio_set_function(GPIO_TG_CS_C3000, GPIO_OUT|GPIO_SET); + pxa2x0_gpio_set_function(sc->ads7846.gpio, GPIO_OUT|GPIO_SET); + pxa2x0_gpio_set_function(sc->max1111.gpio, GPIO_OUT|GPIO_SET); + pxa2x0_gpio_set_function(sc->lz9jg18.gpio, GPIO_OUT|GPIO_SET); } static bool @@ -141,28 +192,28 @@ zssp_ic_start(int ic, uint32_t data) /* disable other ICs */ bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0); if (ic != ZSSP_IC_ADS7846) - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); if (ic != ZSSP_IC_LZ9JG18) - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); if (ic != ZSSP_IC_MAX1111) - pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); + pxa2x0_gpio_set_bit(sc->max1111.gpio); /* activate the chosen one */ switch (ic) { case ZSSP_IC_ADS7846: bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, - SSCR0_ADS7846_C3000); - pxa2x0_gpio_clear_bit(GPIO_ADS7846_CS_C3000); + sc->ads7846.sscr0); + pxa2x0_gpio_clear_bit(sc->ads7846.gpio); bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, data); while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR) & SSSR_TNF) != SSSR_TNF) continue; /* poll */ break; case ZSSP_IC_LZ9JG18: - pxa2x0_gpio_clear_bit(GPIO_TG_CS_C3000); + pxa2x0_gpio_clear_bit(sc->lz9jg18.gpio); break; case ZSSP_IC_MAX1111: - pxa2x0_gpio_clear_bit(GPIO_MAX1111_CS_C3000); + pxa2x0_gpio_clear_bit(sc->max1111.gpio); break; } } @@ -195,9 +246,9 @@ zssp_ic_stop(int ic) break; } - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); + pxa2x0_gpio_set_bit(sc->max1111.gpio); return rv; } @@ -239,11 +290,11 @@ zssp_read_max1111(uint32_t cmd) s = splhigh(); bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, SSCR0_MAX1111); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, sc->max1111.sscr0); - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); - pxa2x0_gpio_clear_bit(GPIO_MAX1111_CS_C3000); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); + pxa2x0_gpio_clear_bit(sc->max1111.gpio); delay(1); @@ -263,9 +314,9 @@ zssp_read_max1111(uint32_t cmd) SSP_SSDR); } - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); + pxa2x0_gpio_set_bit(sc->max1111.gpio); bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0); @@ -282,7 +333,6 @@ uint32_t zssp_read_ads7846(uint32_t cmd) { struct zssp_softc *sc; - unsigned int cr0; uint32_t val; int s; @@ -294,33 +344,34 @@ zssp_read_ads7846(uint32_t cmd) s = splhigh(); - if (ZAURUS_ISC1000 || ZAURUS_ISC3000) { - cr0 = SSCR0_ADS7846_C3000; - } else { - cr0 = 0x00ab; - } bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, 0); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, cr0); + delay(10); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSCR0, sc->ads7846.sscr0); - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); - pxa2x0_gpio_clear_bit(GPIO_ADS7846_CS_C3000); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); + pxa2x0_gpio_set_bit(sc->max1111.gpio); + pxa2x0_gpio_clear_bit(sc->ads7846.gpio); + delay(10); bus_space_write_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR, cmd); + delay(10); while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR) & SSSR_TNF) != SSSR_TNF) continue; /* poll */ - delay(1); + delay(10); while ((bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSSR) - & SSSR_RNE) != SSSR_RNE) + & SSSR_RNE) != SSSR_RNE) { + delay(1); continue; /* poll */ + } val = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SSP_SSDR); + delay(10); - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); splx(s); @@ -330,66 +381,58 @@ zssp_read_ads7846(uint32_t cmd) void zssp_write_lz9jg18(uint32_t data) { - int sclk_pin, sclk_fn; - int sfrm_pin, sfrm_fn; - int txd_pin, txd_fn; - int rxd_pin, rxd_fn; + struct zssp_softc *sc; + int sclk_fn; + int sfrm_fn; + int txd_fn; + int rxd_fn; int i; int s; + KASSERT(zssp_sc != NULL); + sc = zssp_sc; + /* XXX this creates a DAC command from a backlight duty value. */ data = 0x40 | (data & 0x1f); - if (ZAURUS_ISC1000 || ZAURUS_ISC3000) { - sclk_pin = 19; - sfrm_pin = 14; - txd_pin = 87; - rxd_pin = 86; - } else { - sclk_pin = 23; - sfrm_pin = 24; - txd_pin = 25; - rxd_pin = 26; - } - s = splhigh(); - sclk_fn = pxa2x0_gpio_get_function(sclk_pin); - sfrm_fn = pxa2x0_gpio_get_function(sfrm_pin); - txd_fn = pxa2x0_gpio_get_function(txd_pin); - rxd_fn = pxa2x0_gpio_get_function(rxd_pin); - - pxa2x0_gpio_set_function(sfrm_pin, GPIO_OUT | GPIO_SET); - pxa2x0_gpio_set_function(sclk_pin, GPIO_OUT | GPIO_CLR); - pxa2x0_gpio_set_function(txd_pin, GPIO_OUT | GPIO_CLR); - pxa2x0_gpio_set_function(rxd_pin, GPIO_IN); - - pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); - pxa2x0_gpio_set_bit(GPIO_ADS7846_CS_C3000); - pxa2x0_gpio_clear_bit(GPIO_TG_CS_C3000); + sclk_fn = pxa2x0_gpio_get_function(sc->lz9jg18.sclk_pin); + sfrm_fn = pxa2x0_gpio_get_function(sc->lz9jg18.sfrm_pin); + txd_fn = pxa2x0_gpio_get_function(sc->lz9jg18.txd_pin); + rxd_fn = pxa2x0_gpio_get_function(sc->lz9jg18.rxd_pin); + + pxa2x0_gpio_set_function(sc->lz9jg18.sfrm_pin, GPIO_OUT | GPIO_SET); + pxa2x0_gpio_set_function(sc->lz9jg18.sclk_pin, GPIO_OUT | GPIO_CLR); + pxa2x0_gpio_set_function(sc->lz9jg18.txd_pin, GPIO_OUT | GPIO_CLR); + pxa2x0_gpio_set_function(sc->lz9jg18.rxd_pin, GPIO_IN); + + pxa2x0_gpio_set_bit(sc->max1111.gpio); + pxa2x0_gpio_set_bit(sc->ads7846.gpio); + pxa2x0_gpio_clear_bit(sc->lz9jg18.gpio); delay(10); for (i = 0; i < 8; i++) { if (data & 0x80) - pxa2x0_gpio_set_bit(txd_pin); + pxa2x0_gpio_set_bit(sc->lz9jg18.txd_pin); else - pxa2x0_gpio_clear_bit(txd_pin); + pxa2x0_gpio_clear_bit(sc->lz9jg18.txd_pin); delay(10); - pxa2x0_gpio_set_bit(sclk_pin); + pxa2x0_gpio_set_bit(sc->lz9jg18.sclk_pin); delay(10); - pxa2x0_gpio_clear_bit(sclk_pin); + pxa2x0_gpio_clear_bit(sc->lz9jg18.sclk_pin); delay(10); data <<= 1; } - pxa2x0_gpio_clear_bit(txd_pin); - pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); + pxa2x0_gpio_clear_bit(sc->lz9jg18.txd_pin); + pxa2x0_gpio_set_bit(sc->lz9jg18.gpio); - pxa2x0_gpio_set_function(sclk_pin, sclk_fn); - pxa2x0_gpio_set_function(sfrm_pin, sfrm_fn); - pxa2x0_gpio_set_function(txd_pin, txd_fn); - pxa2x0_gpio_set_function(rxd_pin, rxd_fn); + pxa2x0_gpio_set_function(sc->lz9jg18.sclk_pin, sclk_fn); + pxa2x0_gpio_set_function(sc->lz9jg18.sfrm_pin, sfrm_fn); + pxa2x0_gpio_set_function(sc->lz9jg18.txd_pin, txd_fn); + pxa2x0_gpio_set_function(sc->lz9jg18.rxd_pin, rxd_fn); splx(s); } Index: arch/zaurus/dev/ztp.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/dev/ztp.c,v retrieving revision 1.10 diff -u -p -r1.10 ztp.c --- arch/zaurus/dev/ztp.c 24 Feb 2010 22:37:56 -0000 1.10 +++ arch/zaurus/dev/ztp.c 2 Jan 2012 10:42:07 -0000 @@ -21,6 +21,7 @@ __KERNEL_RCSID(0, "$NetBSD: ztp.c,v 1.10 2010/02/24 22:37:56 dyoung Exp $"); #include "lcd.h" +#include "c700lcd.h" #include #include @@ -41,11 +42,15 @@ __KERNEL_RCSID(0, "$NetBSD: ztp.c,v 1.10 #include #include #include -#include #include +#if NLCD > 0 +#include +#elif NC700LCD > 0 +#include +#endif +#include #include - #ifdef ZTP_DEBUG #define DPRINTF(s) printf s #else @@ -64,15 +69,23 @@ __KERNEL_RCSID(0, "$NetBSD: ztp.c,v 1.10 #define GPIO_TP_INT_C3K 11 #define GPIO_HSYNC_C3K 22 +#define GPIO_TP_INT_C860 5 +#define GPIO_HSYNC_C860 44 #define POLL_TIMEOUT_RATE0 ((hz * 150)/1000) #define POLL_TIMEOUT_RATE1 (hz / 100) /* XXX every tick */ #define CCNT_HS_400_VGA_C3K 6250 /* 15.024us */ +#define CCNT_HS_400_VGA_C860 7013 /* 17.615us */ /* XXX need to ask zaurus_lcd.c for the screen dimension */ +#if NLCD > 0 #define CURRENT_DISPLAY (&sharp_zaurus_C3000) extern const struct lcd_panel_geometry sharp_zaurus_C3000; +#elif NC700LCD > 0 +#define CURRENT_DISPLAY (&sharp_zaurus_C700) +extern const struct w100_panel_geometry sharp_zaurus_C700; +#endif /* Settable via sysctl. */ int ztp_rawmode; @@ -106,6 +119,10 @@ struct ztp_softc { int sc_resx; int sc_resy; struct tpcalib_softc sc_tpcalib; + + u_int sc_tp_int_pin; + u_int sc_hsync_pin; + u_int sc_ccnt_hs; }; static int ztp_match(device_t, cfdata_t, void *); @@ -152,21 +169,21 @@ ztp_attach(device_t parent, device_t sel /* Initialize ADS7846 Difference Reference mode */ (void)zssp_ic_send(ZSSP_IC_ADS7846, (1< 0 +#if NLCD > 0 || NC700LCD > 0 sc->sc_resx = CURRENT_DISPLAY->panel_height; sc->sc_resy = CURRENT_DISPLAY->panel_width; #else @@ -174,6 +191,17 @@ ztp_attach(device_t parent, device_t sel sc->sc_resy = 640; /* XXX */ #endif + if (ZAURUS_ISC1000 || ZAURUS_ISC3000) { + sc->sc_tp_int_pin = GPIO_TP_INT_C3K; + sc->sc_hsync_pin = GPIO_HSYNC_C3K; + sc->sc_ccnt_hs = CCNT_HS_400_VGA_C3K; + } else { + /* C860 */ + sc->sc_tp_int_pin = GPIO_TP_INT_C860; + sc->sc_hsync_pin = GPIO_HSYNC_C860; + sc->sc_ccnt_hs = CCNT_HS_400_VGA_C860; + } + sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); /* Initialize calibration, set default parameters. */ @@ -200,11 +228,11 @@ ztp_enable(void *v) aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n"); - pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); + pxa2x0_gpio_set_function(sc->sc_tp_int_pin, GPIO_IN); /* XXX */ if (sc->sc_gh == NULL) { - sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K, + sc->sc_gh = pxa2x0_gpio_intr_establish(sc->sc_tp_int_pin, IST_EDGE_FALLING, IPL_TTY, ztp_irq, sc); } else { pxa2x0_gpio_intr_unmask(sc->sc_gh); @@ -252,7 +280,7 @@ ztp_suspend(device_t dv, const pmf_qual_ (void)zssp_ic_send(ZSSP_IC_ADS7846, (1 << ADSCTRL_PD1_SH) | (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH)); - pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_OUT | GPIO_SET); + pxa2x0_gpio_set_function(sc->sc_tp_int_pin, GPIO_OUT | GPIO_SET); return true; } @@ -264,7 +292,7 @@ ztp_resume(device_t dv, const pmf_qual_t DPRINTF(("%s: ztp_resume()\n", device_xname(sc->sc_dev))); - pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); + pxa2x0_gpio_set_function(sc->sc_tp_int_pin, GPIO_IN); pxa2x0_gpio_intr_mask(sc->sc_gh); /* Enable automatic low power mode. */ @@ -279,17 +307,17 @@ ztp_resume(device_t dv, const pmf_qual_t #define HSYNC() \ do { \ - while (pxa2x0_gpio_get_bit(GPIO_HSYNC_C3K) == 0) \ + while (pxa2x0_gpio_get_bit(sc->sc_hsync_pin) == 0) \ continue; \ - while (pxa2x0_gpio_get_bit(GPIO_HSYNC_C3K) != 0) \ + while (pxa2x0_gpio_get_bit(sc->sc_hsync_pin) != 0) \ continue; \ } while (/*CONSTCOND*/0) static inline uint32_t pxa2x0_ccnt_enable(uint32_t); static inline uint32_t pxa2x0_read_ccnt(void); -static uint32_t ztp_sync_ads784x(int, int, uint32_t); -static void ztp_sync_send(uint32_t); -static int ztp_readpos(struct ztp_pos *); +static uint32_t ztp_sync_ads784x(struct ztp_softc *, int, int, uint32_t); +static void ztp_sync_send(struct ztp_softc *, uint32_t); +static int ztp_readpos(struct ztp_softc *, struct ztp_pos *); static inline uint32_t pxa2x0_ccnt_enable(uint32_t reg) @@ -316,7 +344,8 @@ pxa2x0_read_ccnt(void) * Communicate synchronously with the ADS784x touch screen controller. */ static uint32_t -ztp_sync_ads784x(int dorecv/* XXX */, int dosend/* XXX */, uint32_t cmd) +ztp_sync_ads784x(struct ztp_softc *sc, int dorecv/* XXX */, + int dosend/* XXX */, uint32_t cmd) { uint32_t ccen; uint32_t rv = 0; @@ -334,7 +363,7 @@ ztp_sync_ads784x(int dorecv/* XXX */, in } if (dosend) { - ztp_sync_send(cmd); + ztp_sync_send(sc, cmd); } /* stop clock counter */ @@ -344,13 +373,13 @@ ztp_sync_ads784x(int dorecv/* XXX */, in } void -ztp_sync_send(uint32_t cmd) +ztp_sync_send(struct ztp_softc *sc, uint32_t cmd) { volatile uint32_t base, now; uint32_t tck; /* XXX */ - tck = CCNT_HS_400_VGA_C3K - 151; + tck = sc->sc_ccnt_hs - 151; /* send dummy command; discard SSDR */ (void)zssp_ic_send(ZSSP_IC_ADS7846, cmd); @@ -369,14 +398,14 @@ ztp_sync_send(uint32_t cmd) } static int -ztp_readpos(struct ztp_pos *pos) +ztp_readpos(struct ztp_softc *sc, struct ztp_pos *pos) { int cmd; int t0, t1; int down; /* XXX */ - pxa2x0_gpio_set_function(GPIO_HSYNC_C3K, GPIO_IN); + pxa2x0_gpio_set_function(sc->sc_hsync_pin, GPIO_IN); /* check that pen is down */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | @@ -391,30 +420,30 @@ ztp_readpos(struct ztp_pos *pos) /* Y */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH); - (void)ztp_sync_ads784x(0, 1, cmd); + (void)ztp_sync_ads784x(sc, 0, 1, cmd); /* Y */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | (1 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH); - (void)ztp_sync_ads784x(1, 1, cmd); + (void)ztp_sync_ads784x(sc, 1, 1, cmd); /* X */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | (5 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH); - pos->y = ztp_sync_ads784x(1, 1, cmd); + pos->y = ztp_sync_ads784x(sc, 1, 1, cmd); DPRINTF(("ztp_readpos(): y = %d\n", pos->y)); /* T0 */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | (3 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH); - pos->x = ztp_sync_ads784x(1, 1, cmd); + pos->x = ztp_sync_ads784x(sc, 1, 1, cmd); DPRINTF(("ztp_readpos(): x = %d\n", pos->x)); /* T1 */ cmd = (1 << ADSCTRL_PD0_SH) | (1 << ADSCTRL_PD1_SH) | (4 << ADSCTRL_ADR_SH) | (1 << ADSCTRL_STS_SH); - t0 = ztp_sync_ads784x(1, 1, cmd); - t1 = ztp_sync_ads784x(1, 0, cmd); + t0 = ztp_sync_ads784x(sc, 1, 1, cmd); + t1 = ztp_sync_ads784x(sc, 1, 0, cmd); DPRINTF(("ztp_readpos(): t0 = %d, t1 = %d\n", t0, t1)); /* check that pen is still down */ @@ -457,14 +486,14 @@ ztp_irq(void *v) s = splhigh(); - pindown = pxa2x0_gpio_get_bit(GPIO_TP_INT_C3K) ? 0 : 1; + pindown = pxa2x0_gpio_get_bit(sc->sc_tp_int_pin) ? 0 : 1; DPRINTF(("%s: pindown = %d\n", device_xname(sc->sc_dev), pindown)); if (pindown) { pxa2x0_gpio_intr_mask(sc->sc_gh); callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE1); } - down = ztp_readpos(&tp); + down = ztp_readpos(sc, &tp); DPRINTF(("%s: x = %d, y = %d, z = %d, down = %d\n", device_xname(sc->sc_dev), tp.x, tp.y, tp.z, down)); @@ -472,7 +501,7 @@ ztp_irq(void *v) pxa2x0_gpio_intr_unmask(sc->sc_gh); callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE0); } - pxa2x0_gpio_clear_intr(GPIO_TP_INT_C3K); + pxa2x0_gpio_clear_intr(sc->sc_tp_int_pin); splx(s); Index: arch/zaurus/zaurus/kloader_zaurus.S =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/kloader_zaurus.S,v retrieving revision 1.1 diff -u -p -r1.1 kloader_zaurus.S --- arch/zaurus/zaurus/kloader_zaurus.S 11 Mar 2009 09:02:05 -0000 1.1 +++ arch/zaurus/zaurus/kloader_zaurus.S 2 Jan 2012 10:42:08 -0000 @@ -32,6 +32,8 @@ #include #include /* for PMAP_DOMAIN_KERNEL */ +#define PROGRESS + /* * CPWAIT -- Canonical method to wait for CP15 update. * NOTE: Clobbers the specified temp reg. Index: arch/zaurus/zaurus/machdep.c =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/machdep.c,v retrieving revision 1.27 diff -u -p -r1.27 machdep.c --- arch/zaurus/zaurus/machdep.c 12 Nov 2011 04:39:19 -0000 1.27 +++ arch/zaurus/zaurus/machdep.c 2 Jan 2012 10:42:08 -0000 @@ -168,6 +168,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v #include #include +#include #include @@ -1302,6 +1303,10 @@ consinit(void) glass_console = 1; lcd_cnattach(); #endif +#if (NC700LCD > 0) && (NWSDISPLAY > 0) + glass_console = 1; + c700lcd_cnattach(); +#endif } #if (NCOM > 0) && defined(COM_PXA2X0) Index: arch/zaurus/zaurus/zaurus_reg.h =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/zaurus_reg.h,v retrieving revision 1.3 diff -u -p -r1.3 zaurus_reg.h --- arch/zaurus/zaurus/zaurus_reg.h 31 Mar 2008 23:35:39 -0000 1.3 +++ arch/zaurus/zaurus/zaurus_reg.h 2 Jan 2012 10:42:08 -0000 @@ -73,7 +73,11 @@ #define C3000_CF1_IRQ 106 /* processor GPIO pins */ +#define C860_GPIO_SD_DETECT_PIN 9 +#define C860_RC_IRQ_PIN 4 /* remote control */ +#define C860_GPIO_SD_WP_PIN 7 #define C860_CF0_IRQ_PIN 14 +#define C860_GPIO_SD_POWER_PIN 33 #define C3000_GPIO_SD_DETECT_PIN 9 #define C3000_RC_IRQ_PIN 13 /* remote control */ #define C3000_GPIO_SD_WP_PIN 81 Index: arch/zaurus/zaurus/zaurus_start.S =================================================================== RCS file: /cvsroot/src/sys/arch/zaurus/zaurus/zaurus_start.S,v retrieving revision 1.1 diff -u -p -r1.1 zaurus_start.S --- arch/zaurus/zaurus/zaurus_start.S 16 Dec 2006 05:57:48 -0000 1.1 +++ arch/zaurus/zaurus/zaurus_start.S 2 Jan 2012 10:42:08 -0000 @@ -35,6 +35,7 @@ #include #include /* for PMAP_DOMAIN_KERNEL */ +/* #define PROGRESS */ /* * CPWAIT -- Canonical method to wait for CP15 update. * NOTE: Clobbers the specified temp reg. @@ -61,6 +62,21 @@ _C_LABEL(zaurus_start): * in VA 0xc0200000.. */ +#ifdef PROGRESS + mov r0, #0x7a /*'z'*/ + bl .Lputchar + mov r0, #0x61 /*'a'*/ + bl .Lputchar + mov r0, #0x75 /*'u'*/ + bl .Lputchar + mov r0, #0x72 /*'r'*/ + bl .Lputchar + mov r0, #0x75 /*'u'*/ + bl .Lputchar + mov r0, #0x73 /*'s'*/ + bl .Lputchar +#endif + /* build page table from scratch */ ldr r0, Lstartup_pagetable adr r4, mmu_init_table @@ -73,6 +89,10 @@ _C_LABEL(zaurus_start): adds r1, r1, #-1 bhi 2b 3: +#ifdef PROGRESS + bl .Lprogress + ldr r0, Lstartup_pagetable +#endif ldmia r4!, {r1,r2,r3} /* # of sections, PA|attr, VA */ cmp r1, #0 bne 2b @@ -92,6 +112,19 @@ _C_LABEL(zaurus_start): CPWAIT(r0) /* Jump to kernel code in TRUE VA */ +#ifdef PROGRESS + mov r0, #0x73 /*'s'*/ + bl .Lputchar + mov r0, #0x74 /*'t'*/ + bl .Lputchar + mov r0, #0x61 /*'a'*/ + bl .Lputchar + mov r0, #0x72 /*'r'*/ + bl .Lputchar + mov r0, #0x74 /*'t'*/ + bl .Lputchar + bl .Lputcrlf +#endif adr r0, Lstart ldr pc, [r0] @@ -115,3 +148,62 @@ mmu_init_table: MMU_INIT(0xc0000000, 0xa0000000, 64, L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)) .word 0,0,0 /* end of table */ + +#ifdef PROGRESS +.Lprogress: + mov r0, #0x2e /*'.'*/ + b .Lputchar + +.Lputchar: + ldr r2, .Lffuart_txdata + ldr r1, .Lffuart_txbusy +1: + ldr r9, [r1] + tst r9, #0x20 + beq 1b + str r0, [r2] + mov pc, lr + +.Lhexprint: + ldr r2, .Lffuart_txdata + ldr r1, .Lffuart_txbusy + mov r10, #32 +1: sub r10, r10, #4 + mov r11, r0, lsr r10 + and r11, r11, #0xf +2: ldr r9, [r1] + tst r9, #0x20 + beq 2b + adr r12, .Lhextable + ldrb r9, [r12, r11] + str r9, [r2] + cmp r10, #0 + bne 1b +3: ldr r9, [r1] + tst r9, #0x20 + beq 3b + mov r9, #0x0d + str r9, [r2] +4: ldr r9, [r1] + tst r9, #0x20 + beq 4b + mov r9, #0x0a + str r9, [r2] + mov pc, lr + +.Lputcrlf: + ldr r2, .Lffuart_txdata + ldr r1, .Lffuart_txbusy + b 3b + + .align 2 + +.Lffuart_txdata: + .word 0x40100000 +.Lffuart_txbusy: + .word 0x40100014 + +.Lhextable: + .asciz "0123456789abcdef" +#endif + --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/conf/C700 2011-12-30 03:08:02.000000000 +0900 @@ -0,0 +1,402 @@ +# $NetBSD: GENERIC,v 1.45 2011/07/15 13:47:12 nonaka Exp $ +# +# GENERIC machine description file +# +# This machine description file is used to generate the default NetBSD +# kernel. The generic kernel does not include all options, subsystems +# and device drivers, but should be useful for most applications. +# +# The machine description file can be customised for your specific +# machine to reduce the kernel size and improve its performance. +# +# For further information on compiling NetBSD kernels, see the config(8) +# man page. +# +# For further information on hardware support for this architecture, see +# the intro(4) man page. For further information about kernel options +# for this architecture, see the options(4) man page. For an explanation +# of each device driver in this file see the section 4 man page for the +# device. + +include "arch/zaurus/conf/std.zaurus" + +#options INCLUDE_CONFIG_FILE # embed config file in kernel binary + +maxusers 32 # estimated number of users + +# CPU options + +# For XScale systems +options CPU_XSCALE_PXA250 # Support the XScale PXA25x core +#options CPU_XSCALE_PXA270 # Support the XScale PXA27x core +makeoptions CPUFLAGS="-mcpu=xscale" +makeoptions COPTS="-O2 -fno-tree-ter" + +# Architecture options +options XSCALE_CACHE_READ_WRITE_ALLOCATE +options PXAGPIO_HAS_GPION_INTRS + +# in-kernel bootloader, see kloader(4) +#options KLOADER +#options KLOADER_KERNEL_PATH="\"/netbsd\"" +#options KLOADER_DEBUG + +# Standard system options +options INSECURE # disable kernel security levels + +options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT +#options HZ=512 # clock interrupt generates every 1/HZ sec +#options NTP # NTP phase/frequency locked loop + +# File systems +file-system FFS # UFS +#file-system EXT2FS # second extended file system (linux) +#file-system LFS # log-structured file system +file-system MFS # memory file system +file-system NFS # Network File System client +#file-system NTFS # Windows/NT file system (experimental) +file-system CD9660 # ISO 9660 + Rock Ridge file system +file-system MSDOSFS # MS-DOS file system +#file-system FDESC # /dev/fd +file-system KERNFS # /kern +file-system NULLFS # loopback file system +#file-system OVERLAY # overlay file system +file-system PROCFS # /proc +#file-system UMAPFS # NULLFS + uid and gid remapping +#file-system UNION # union file system +#file-system CODA # Coda File System; also needs vcoda (below) +file-system PTYFS # /dev/pts/N support +file-system TMPFS # Efficient memory file-system +#file-system UDF # experimental - OSTA UDF CD/DVD file-system + +# File system options +#options QUOTA # legacy UFS quotas +#options QUOTA2 # new, in-filesystem UFS quotas +#options FFS_EI # FFS Endian Independent support +#options NFSSERVER +options WAPBL # File system journaling support - Experimental +#options UFS_DIRHASH # UFS Large Directory Hashing - Experimental +options FFS_NO_SNAPSHOT # No FFS snapshot support +#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and + # immutable) behave as system flags. + +# Networking options +#options GATEWAY # packet forwarding +options INET # IP + ICMP + TCP + UDP +options INET6 # IPv6 + +# Compatibility options +#options COMPAT_09 # NetBSD 0.9, +#options COMPAT_10 # NetBSD 1.0, +#options COMPAT_11 # NetBSD 1.1, +#options COMPAT_12 # NetBSD 1.2, +options COMPAT_13 # NetBSD 1.3, +options COMPAT_14 # NetBSD 1.4, +options COMPAT_15 # NetBSD 1.5, +options COMPAT_16 # NetBSD 1.6, +options COMPAT_20 # NetBSD 2.0, +options COMPAT_30 # NetBSD 3.0, +options COMPAT_40 # NetBSD 4.0, +options COMPAT_50 # NetBSD 5.0 compatibility. +options COMPAT_43 # and 4.3BSD +#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended. + +options COMPAT_OSSAUDIO # OSS (Voxware) audio driver compatibility +options COMPAT_BSDPTY # /dev/[pt]ty?? ptys. + +# Wedge support +options DKWEDGE_AUTODISCOVER # Automatically add dk(4) instances +#options DKWEDGE_METHOD_GPT # Supports GPT partitions as wedges +# The following two options can break /etc/fstab, so handle with care +#options DKWEDGE_METHOD_BSDLABEL # Support disklabel entries as wedges +#options DKWEDGE_METHOD_MBR # Support MBR partitions as wedges + +# Shared memory options + +options SYSVMSG # System V-like message queues +options SYSVSEM # System V-like semaphores +options SYSVSHM # System V-like memory sharing +options P1003_1B_SEMAPHORE # p1003.1b semaphore support + +# Loadable kernel module support +#options MODULAR # new style module(7) framework + +# Device options + +# Miscellaneous kernel options +#options KTRACE # system call tracing via ktrace(1) +#options KMEMSTATS # kernel memory statistics +#options SCSIVERBOSE # Verbose SCSI errors +#options MIIVERBOSE # Verbose MII autoconfuration messages +#options USBVERBOSE # verbose USB device autoconfig messages +#options USERCONF # userconf(4) support +#options PIPE_SOCKETPAIR # smaller, but slower pipe(2) +#options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel + +# +# wscons options +# +# builtin terminal emulations +options WSEMUL_VT100 +# allocate a number of virtual screens at autoconfiguration time +#options WSDISPLAY_DEFAULTSCREENS=2 + +# customization of console and kernel output - see dev/wscons/wsdisplayvar.h +#options WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8) +#options WS_DEFAULT_FG=WSCOL_WHITE +#options WS_DEFAULT_BG=WSCOL_BLACK +#options WS_DEFAULT_COLATTR="(0)" +#options WS_DEFAULT_MONOATTR="(0)" +options WS_KERNEL_FG=WSCOL_GREEN +#options WS_KERNEL_BG=WSCOL_BLACK +#options WS_KERNEL_COLATTR="" +#options WS_KERNEL_MONOATTR="" + +# compatibility to other console drivers +options WSDISPLAY_COMPAT_PCVT # emulate some ioctls +options WSDISPLAY_COMPAT_USL # VT handling +options WSDISPLAY_COMPAT_RAWKBD # can get raw scancodes + +# Development and Debugging options + +options DIAGNOSTIC # internal consistency checks +options DEBUG +#options VERBOSE_INIT_ARM # verbose bootstraping messages +options DDB # in-kernel debugger +options DDB_HISTORY_SIZE=100 # Enable history editing in DDB +#options KGDB +#makeoptions DEBUG="-g" # compile full symbol table +#options SYMTAB_SPACE=512000 +options SYMTAB_SPACE=576000 + + +# Kernel root file system and dump configuration. +config netbsd root on ? type ? + + +# The main bus device +mainbus0 at root + +# The boot cpu +cpu0 at mainbus? + +# integrated peripherals +pxaip0 at mainbus? + +pxaintc0 at pxaip? # interrupt controller +pxagpio0 at pxaip? # GPIO +pxartc0 at pxaip? addr 0x40900000 size 0x10 # RTC + +# DMAC support +pxadmac0 at pxaip? addr 0x40000000 intr 25 +options PXA2X0_DMAC_DMOVER_CONCURRENCY=4 # Enable dmover(9) backend +#options PXA2X0_DMAC_FIXED_PRIORITY # Don't want multiple priority + +# I2C support +#ziic0 at pxaip? +#iic0 at ziic? + +# Power management +#zapm0 at pxaip? # power management +#apmdev0 at zapm0 # APM + +# PCMCIA/CF socket and GPIO controllers +scoop0 at pxaip? +#scoop1 at pxaip? + +# alternate GPIO contoller for SL-C1000 +#ioexp0 at iic? addr 0x18 + +# ADC, touchpad, backlight +zssp0 at pxaip? + +# touchpad +ztp0 at pxaip? +wsmouse* at ztp? mux 0 + +# keyboard +zkbd0 at pxaip? +wskbd* at zkbd? mux 1 + +# remote controller +#zrc0 at pxaip? +#wskbd* at zrc? mux 1 + +# LCD +#lcd0 at pxaip? +#options PXA2X0_LCD_WRITETHROUGH +#wsdisplay* at lcd? console ? +c700lcd0 at pxaip? +wsdisplay* at c700lcd? console ? + +# WM8750 Audio +#zaudio0 at iic? addr 0x1b +#audio* at zaudio? +#options ZAUDIO_VOLUME_STRIDE=8 + +# Audio support +#audio* at audiobus? + +# integrated 16550 UARTs +options COM_PXA2X0 +#options FFUARTCONSOLE +com0 at pxaip? addr 0x40100000 intr 22 # Full Function UART +com1 at pxaip? addr 0x40200000 intr 21 # Bluetooth UART +com2 at pxaip? addr 0x40700000 intr 20 # Standard UART (for IrDA) + +# integrated PCMCIA/CF controller +pxapcic0 at pxaip? + +# PCMCIA bus support +pcmcia* at pxapcic? + +# PCMCIA (CF) devices +com* at pcmcia? # PCMCIA modems/serial ports +wi* at pcmcia? # WaveLAN IEEE 802.11DS +ne* at pcmcia? # PCMCIA based NE2000 ethernet +wdc* at pcmcia? # hard disk controller + +atabus* at wdc? channel ? + +# IDE hard drives +wd* at atabus? drive ? flags 0x0000 + + +# USB Controller and Devices +#zusb* at pxaip? +##pxaudc0 at pxaip? addr 0x40600000 # USB Device Controller +#ohci0 at pxaip? addr 0x4c000000 intr 3 # USB Host Controller + +# PCMCIA USB controllers +#slhci* at pcmcia? function ? # ScanLogic SL811HS + +# USB bus support +#usb* at ohci? +#usb* at slhci? + +# USB Hubs +#uhub* at usb? +#uhub* at uhub? port ? + +# USB HID device +#uhidev* at uhub? port ? configuration ? interface ? + +# USB Mice +#ums* at uhidev? reportid ? +#wsmouse* at ums? mux 0 + +# USB Keyboards +#ukbd* at uhidev? reportid ? +#wskbd* at ukbd? console ? mux 1 + +# USB Generic HID devices +#uhid* at uhidev? reportid ? + +# USB Mass Storage +#umass* at uhub? port ? configuration ? interface ? +#wd* at umass? + +# SCSI bus support +#scsibus* at scsi? + +# SCSI devices +#sd* at scsibus? target ? lun ? # SCSI disk drives +#cd* at scsibus? target ? lun ? # SCSI CD-ROM drives +#uk* at scsibus? target ? lun ? # SCSI unknown + +# ATAPI bus support +atapibus* at atapi? + +# ATAPI devices +cd* at atapibus? drive ? # ATAPI CD-ROM drives +#sd* at atapibus? drive ? # ATAPI disk drives +#st* at atapibus? drive ? # ATAPI tape drives +#uk* at atapibus? drive ? # ATAPI unknown + +# USB audio +#uaudio* at uhub? port ? configuration ? + +# USB Ethernet adapters +#aue* at uhub? port ? # ADMtek AN986 Pegasus based adapters +#axe* at uhub? port ? # ASIX AX88172 based adapters +#cdce* at uhub? port ? # CDC, Ethernet Networking Control Model +#cue* at uhub? port ? # CATC USB-EL1201A based adapters +#kue* at uhub? port ? # Kawasaki LSI KL5KUSB101B based adapters +#udav* at uhub? port ? # Davicom DM9601 based adapters +#url* at uhub? port ? # Realtek RTL8150L based adapters + +# Kyocera AIR-EDGE PHONE +#ukyopon* at uhub? port ? +#ucom* at ukyopon? portno ? + +# USB Generic driver +#ugen* at uhub? port ? + +# MII/PHY support +acphy* at mii? phy ? # DAltima AC101 and AMD Am79c874 PHYs +amhphy* at mii? phy ? # AMD 79c901 Ethernet PHYs +bmtphy* at mii? phy ? # Broadcom BCM5201 and BCM5202 PHYs +brgphy* at mii? phy ? # Broadcom BCM5400-family PHYs +dmphy* at mii? phy ? # Davicom DM9101 PHYs +exphy* at mii? phy ? # 3Com internal PHYs +glxtphy* at mii? phy ? # Level One LXT-1000 PHYs +gphyter* at mii? phy ? # NS83861 Gig-E PHY +icsphy* at mii? phy ? # Integrated Circuit Systems ICS189x +inphy* at mii? phy ? # Intel 82555 PHYs +iophy* at mii? phy ? # Intel 82553 PHYs +lxtphy* at mii? phy ? # Level One LXT-970 PHYs +makphy* at mii? phy ? # Marvell Semiconductor 88E1000 PHYs +nsphy* at mii? phy ? # NS83840 PHYs +nsphyter* at mii? phy ? # NS83843 PHYs +pnaphy* at mii? phy ? # generic HomePNA PHYs +qsphy* at mii? phy ? # Quality Semiconductor QS6612 PHYs +sqphy* at mii? phy ? # Seeq 80220/80221/80223 PHYs +tlphy* at mii? phy ? # ThunderLAN PHYs +tqphy* at mii? phy ? # TDK Semiconductor PHYs +ukphy* at mii? phy ? # generic unknown PHYs +urlphy* at mii? phy ? # Realtek RTL8150L internal PHYs + + +# integrated MMC/SD contoller +pxamci0 at pxaip? addr 0x41100000 size 0x48 +sdmmc* at pxamci? +#options PXAMCI_DEBUG +#options SDMMC_DEBUG +#options SDMMC_DUMP_CSD + +ld* at sdmmc? # MMC/SD/SDHC card + +# Pull in optional local configuration +cinclude "arch/zaurus/conf/GENERIC.local" + + +# Pseudo-Devices + +# disk/mass storage pseudo-devices +pseudo-device md # memory disk device (ramdisk) +pseudo-device vnd # disk-like interface to files +options VND_COMPRESSION # compressed vnd(4) + +# network pseudo-devices +pseudo-device bpfilter # Berkeley packet filter +pseudo-device loop # network loopback + +# accept filters +pseudo-device accf_data # "dataready" accept filter +pseudo-device accf_http # "httpready" accept filter + +# miscellaneous pseudo-devices +pseudo-device pty # pseudo-terminals +#pseudo-device sequencer # MIDI sequencer +pseudo-device clockctl # user control of clock subsystem +pseudo-device ksyms # /dev/ksyms + +# a pseudo device needed for Coda # also needs CODA (above) +#pseudo-device vcoda 4 # coda minicache <-> venus comm. + +# a pseudo device needed for SMBFS +#pseudo-device nsmb # experimental - SMB requester + +# wscons pseudo-devices +pseudo-device wsmux # mouse & keyboard multiplexor +pseudo-device wsfont --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/dev/c700lcd.c 2011-12-11 03:55:44.000000000 +0900 @@ -0,0 +1,448 @@ +/* $$ */ +/* + * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. + * Written by Hiroyuki Bessho for Genetec Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of Genetec Corporation may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * LCD driver for Sharp Zaurus (based on the Intel Lubbock driver). + * + * Controlling LCD is almost completely done through PXA2X0's + * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c. + * + * Codes in this file provide platform specific things including: + * LCD on/off switch and backlight brightness + * LCD panel geometry + */ +#include +__KERNEL_RCSID(0, "$$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +/* + * wsdisplay glue + */ +static struct w100_wsscreen_descr c700lcd_std_screen = { + .c = { + .name = "std", + .textops = &w100_emulops, + .fontwidth = 8, + .fontheight = 16, + .capabilities = WSSCREEN_WSCOLORS, + }, + .depth = 16, /* bits per pixel */ + .flags = 0, +}; + +static const struct wsscreen_descr *c700lcd_scr_descr[] = { + &c700lcd_std_screen.c +}; + +static const struct wsscreen_list c700lcd_screen_list = { + .nscreens = __arraycount(c700lcd_scr_descr), + .screens = c700lcd_scr_descr, +}; + +static int c700lcd_ioctl(void *, void *, u_long, void *, int, + struct lwp *); +static int c700lcd_param(struct w100_softc *, u_long, + struct wsdisplay_param *); +static int c700lcd_show_screen(void *, void *, int, + void (*)(void *, int, int), void *); + +struct wsdisplay_accessops c700lcd_accessops = { + c700lcd_ioctl, + w100_mmap, + w100_alloc_screen, + w100_free_screen, + c700lcd_show_screen, + NULL, + NULL, + NULL, +}; + +#define CURRENT_DISPLAY &sharp_zaurus_C700 + +const struct w100_panel_geometry sharp_zaurus_C700 = +{ + 480, /* Width */ + 640, /* Height */ + W100_PANEL_ROTATE_CW, /* Rotate */ +}; + +struct sharp_lcd_backlight { + int duty; /* LZ9JG18 DAC value */ + int cont; /* BACKLIGHT_CONT signal */ + int on; /* BACKLIGHT_ON signal */ +}; + +#define CURRENT_BACKLIGHT sharp_zaurus_C700_bl + +const struct sharp_lcd_backlight sharp_zaurus_C700_bl[] = { + { 0x00, 0, 0 }, /* 0: Off */ + { 0x00, 0, 1 }, /* 1: 0% */ + { 0x01, 0, 1 }, /* 2: 20% */ + { 0x07, 0, 1 }, /* 3: 40% */ + { 0x01, 1, 1 }, /* 4: 60% */ + { 0x07, 1, 1 }, /* 5: 80% */ + { 0x11, 1, 1 }, /* 6: 100% */ + { -1, -1, -1 }, /* 7: Invalid */ +}; + +static int c700lcd_match(device_t, cfdata_t, void *); +static void c700lcd_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(c700lcd, sizeof(struct w100_softc), + c700lcd_match, c700lcd_attach, NULL, NULL); + +static bool c700lcd_suspend(device_t, const pmf_qual_t *); +static bool c700lcd_resume(device_t, const pmf_qual_t *); +static void c700lcd_brightness_up(device_t); +static void c700lcd_brightness_down(device_t); +static void c700lcd_display_on(device_t); +static void c700lcd_display_off(device_t); + +static int c700lcd_max_brightness(void); +static int c700lcd_get_brightness(void); +static void c700lcd_set_brightness(int); +static void c700lcd_set_brightness_internal(int); +static int c700lcd_get_backlight(void); +static void c700lcd_set_backlight(int); + +static int +c700lcd_match(device_t parent, cfdata_t cf, void *aux) +{ + if (ZAURUS_ISC860) + return 1; + return 0; +} + +static void +c700lcd_attach(device_t parent, device_t self, void *aux) +{ + struct w100_softc *sc = device_private(self); + struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; + struct wsemuldisplaydev_attach_args aa; + + sc->dev = self; + + w100_attach_subr(sc, pxa->pxa_iot, CURRENT_DISPLAY); + + aa.console = glass_console; + aa.scrdata = &c700lcd_screen_list; + aa.accessops = &c700lcd_accessops; + aa.accesscookie = sc; + + (void)config_found(self, &aa, wsemuldisplaydevprint); + + /* Start with approximately 40% of full brightness. */ + c700lcd_set_brightness(3); + + if (!pmf_device_register(self, c700lcd_suspend, c700lcd_resume)) + aprint_error_dev(self, "couldn't establish power handler\n"); + if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_UP, + c700lcd_brightness_up, true)) + aprint_error_dev(self, "couldn't register event handler\n"); + if (!pmf_event_register(self, PMFE_DISPLAY_BRIGHTNESS_DOWN, + c700lcd_brightness_down, true)) + aprint_error_dev(self, "couldn't register event handler\n"); + if (!pmf_event_register(self, PMFE_DISPLAY_ON, + c700lcd_display_on, true)) + aprint_error_dev(self, "couldn't register event handler\n"); + if (!pmf_event_register(self, PMFE_DISPLAY_OFF, + c700lcd_display_off, true)) + aprint_error_dev(self, "couldn't register event handler\n"); +} + +void +c700lcd_cnattach(void) +{ + w100_cnattach(&c700lcd_std_screen, CURRENT_DISPLAY); +} + +/* + * power management + */ +static bool +c700lcd_suspend(device_t dv, const pmf_qual_t *qual) +{ + struct w100_softc *sc = device_private(dv); + + c700lcd_set_brightness(0); + w100_suspend(sc); + + return true; +} + +static bool +c700lcd_resume(device_t dv, const pmf_qual_t *qual) +{ + struct w100_softc *sc = device_private(dv); + + w100_resume(sc); + c700lcd_set_brightness(c700lcd_get_brightness()); + + return true; +} + +static void +c700lcd_brightness_up(device_t dv) +{ + + c700lcd_set_brightness(c700lcd_get_brightness() + 1); +} + +static void +c700lcd_brightness_down(device_t dv) +{ + + c700lcd_set_brightness(c700lcd_get_brightness() - 1); +} + +static void +c700lcd_display_on(device_t dv) +{ + + c700lcd_blank(0); + c700lcd_set_backlight(1); +} + +static void +c700lcd_display_off(device_t dv) +{ + + c700lcd_set_backlight(0); + c700lcd_blank(1); +} + +/* + * wsdisplay accessops overrides + */ +static int +c700lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) +{ + struct w100_softc *sc = (struct w100_softc *)v; + int res = EINVAL; + + switch (cmd) { + case WSDISPLAYIO_GETPARAM: + case WSDISPLAYIO_SETPARAM: + res = c700lcd_param(sc, cmd, (struct wsdisplay_param *)data); + break; + + default: + break; + } + + if (res == EINVAL) + res = w100_ioctl(v, vs, cmd, data, flag, l); + + return res; +} + +static int +c700lcd_show_screen(void *v, void *cookie, int waitok, + void (*cb_func)(void *, int, int), void *cb_arg) +{ + int error; + + error = w100_show_screen(v, cookie, waitok, cb_func, cb_arg); + if (error) + return (error); + + /* Turn on LCD */ + c700lcd_set_brightness(c700lcd_get_brightness()); + + return 0; +} + +/* + * wsdisplay I/O controls + */ +static int +c700lcd_param(struct w100_softc *sc, u_long cmd, struct wsdisplay_param *dp) +{ + int res = EINVAL; + + switch (dp->param) { + case WSDISPLAYIO_PARAM_BACKLIGHT: + if (cmd == WSDISPLAYIO_GETPARAM) { + dp->min = 0; + dp->max = 1; + dp->curval = c700lcd_get_backlight(); + res = 0; + } else if (cmd == WSDISPLAYIO_SETPARAM) { + c700lcd_set_backlight(dp->curval); + res = 0; + } + break; + + case WSDISPLAYIO_PARAM_CONTRAST: + /* unsupported */ + res = ENOTTY; + break; + + case WSDISPLAYIO_PARAM_BRIGHTNESS: + if (cmd == WSDISPLAYIO_GETPARAM) { + dp->min = 1; + dp->max = c700lcd_max_brightness(); + dp->curval = c700lcd_get_brightness(); + res = 0; + } else if (cmd == WSDISPLAYIO_SETPARAM) { + c700lcd_set_brightness(dp->curval); + res = 0; + } + break; + } + + return res; +} + +/* + * LCD backlight + */ + +static int c700lcdbrightnesscurval = 1; +static int c700lcdislit = 1; +static int c700lcdisblank = 0; + +static int +c700lcd_max_brightness(void) +{ + int i; + + for (i = 0; CURRENT_BACKLIGHT[i].duty != -1; i++) + continue; + return i - 1; +} + +static int +c700lcd_get_brightness(void) +{ + + return c700lcdbrightnesscurval; +} + +static void +c700lcd_set_brightness(int newval) +{ + int maxval; + + maxval = c700lcd_max_brightness(); + if (newval < 0) + newval = 0; + else if (newval > maxval) + newval = maxval; + + if (c700lcd_get_backlight() && !c700lcdisblank) + c700lcd_set_brightness_internal(newval); + + if (newval > 0) + c700lcdbrightnesscurval = newval; +} + +static void +c700lcd_set_brightness_internal(int newval) +{ + static int curval = 1; + int i; + + /* + * It appears that the C3000 backlight can draw too much power if we + * switch it from a low to a high brightness. Increasing brightness + * in steps avoids this issue. + */ + if (newval > curval) { + for (i = curval + 1; i <= newval; i++) { + (void)zssp_ic_send(ZSSP_IC_LZ9JG18, + CURRENT_BACKLIGHT[i].duty); + scoop_set_backlight(CURRENT_BACKLIGHT[i].on, + CURRENT_BACKLIGHT[i].cont); + delay(5000); + } + } else { + (void)zssp_ic_send(ZSSP_IC_LZ9JG18, + CURRENT_BACKLIGHT[newval].duty); + scoop_set_backlight(CURRENT_BACKLIGHT[newval].on, + CURRENT_BACKLIGHT[newval].cont); + } + + curval = newval; +} + +static int +c700lcd_get_backlight(void) +{ + + return c700lcdislit; +} + +static void +c700lcd_set_backlight(int onoff) +{ + + if (!onoff) { + c700lcd_set_brightness(0); + c700lcdislit = 0; + } else { + c700lcdislit = 1; + c700lcd_set_brightness(c700lcd_get_brightness()); + } +} + +void +c700lcd_blank(int blank) +{ + + if (blank) { + c700lcd_set_brightness(0); + c700lcdisblank = 1; + } else { + c700lcdisblank = 0; + c700lcd_set_brightness(c700lcd_get_brightness()); + } +} --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/dev/c700lcdvar.h 2011-12-11 03:55:44.000000000 +0900 @@ -0,0 +1,14 @@ +/* $$ */ +#ifndef _ZAURUS_DEV_C700LCDVAR_H_ +#define _ZAURUS_DEV_C700LCDVAR_H_ + +#include "c700lcd.h" + +void c700lcd_cnattach(void); +#if NC700LCD > 0 +void c700lcd_blank(int); +#else +#define c700lcd_blank(blank) do { } while (/*CONSTCOND*/0) +#endif + +#endif /* _ZAURUS_DEV_C700LCDVAR_H_ */ --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/dev/w100.c 2011-12-11 03:57:53.000000000 +0900 @@ -0,0 +1,589 @@ +/* $$ */ +/* + * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. + * Written by Hiroyuki Bessho for Genetec Corporation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of Genetec Corporation may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORPORATION + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__KERNEL_RCSID(0, "$$"); + +#include +#include +#include +#include +#include +#include /* for cold */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "wsdisplay.h" + +#include "w100var.h" +#include "w100reg.h" + +/* Console */ +struct { + int is_console; + struct w100_wsscreen_descr *descr; + const struct w100_panel_geometry *geom; +} w100_console; + +static void w100_initialize(struct w100_softc *sc, + const struct w100_panel_geometry *geom); +static int w100_new_screen(struct w100_softc *sc, int depth, + struct w100_screen **scrpp); +static void w100_lcd_geometry(struct w100_softc *sc, + const struct w100_panel_geometry *geom); +#if NWSDISPLAY > 0 +static void w100_setup_rasops(struct w100_softc *sc, + struct rasops_info *rinfo, + struct w100_wsscreen_descr *descr, + const struct w100_panel_geometry *geom); +#endif + +#define w100_reg_write(sc, offset, value) \ + bus_space_write_4((sc)->iot, (sc)->ioh_reg, offset, value) + +static void +w100_lcd_geometry(struct w100_softc *sc, + const struct w100_panel_geometry *geom) +{ + sc->geometry = geom; + switch (geom->rotate) { + case W100_PANEL_ROTATE_CW: + sc->display_width = geom->panel_height; + sc->display_height = geom->panel_width; + w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000061); + w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00de1d0e); + w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x00895b00); + w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x00000500); + break; + case W100_PANEL_ROTATE_CCW: + sc->display_width = geom->panel_height; + sc->display_height = geom->panel_width; + w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000061); + w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00de1d16); + w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x008004fc); + w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x00000500); + break; + case W100_PANEL_ROTATE_UD: + sc->display_width = geom->panel_width; + sc->display_height = geom->panel_height; + w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000021); + w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00ded7e); + w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x00895ffc); + w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x000003c0); + break; + default: + sc->display_width = geom->panel_width; + sc->display_height = geom->panel_height; + w100_reg_write(sc, W100_REG_PCLK_CTRL, 0x00000021); + w100_reg_write(sc, W100_REG_GRAPHIC_CTRL, 0x00de1d66); + w100_reg_write(sc, W100_REG_GRAPHIC_OFFSET, 0x00800000); + w100_reg_write(sc, W100_REG_GRAPHIC_PITCH, 0x000003c0); + break; + } + w100_reg_write(sc, W100_REG_DISP_DB_BUF_CTRL, 0x0000007b); +} + +/* + * Initialize the LCD controller. + */ +static void w100_initialize(struct w100_softc *sc, + const struct w100_panel_geometry *geom) +{ + w100_lcd_geometry(sc, geom); + return; +} + + +/* + * Common driver attachment code. + */ +void +w100_attach_subr(struct w100_softc *sc, bus_space_tag_t iot, + const struct w100_panel_geometry *geom) +{ + bus_space_handle_t ioh_cfg, ioh_reg, ioh_vram; + int error; + + aprint_normal(": ATI Imageon100 LCD controller\n"); + aprint_naive("\n"); + + sc->n_screens = 0; + LIST_INIT(&sc->screens); + + /* config handler */ + error = bus_space_map(iot, W100_CFG_ADDRESS, W100_CFG_SIZE, 0, + &ioh_cfg); + if (error) { + aprint_error_dev(sc->dev, + "failed to map config (errorno=%d)\n", error); + return; + } + + /* register handler */ + error = bus_space_map(iot, W100_REG_ADDRESS, W100_REG_SIZE, 0, + &ioh_reg); + if (error) { + aprint_error_dev(sc->dev, + "failed to map register (errorno=%d)\n", error); + return; + } + + /* videomem handler */ + error = bus_space_map(iot, W100_EXTMEM_ADDRESS, W100_EXTMEM_SIZE, 0, + &ioh_vram); + if (error) { + aprint_error_dev(sc->dev, + "failed to vram register (errorno=%d)\n", error); + return; + } + + sc->iot = iot; + sc->ioh_cfg = ioh_cfg; + sc->ioh_reg = ioh_reg; + sc->ioh_vram = ioh_vram; + + w100_initialize(sc, geom); + +#if NWSDISPLAY > 0 + if (w100_console.is_console) { + struct w100_wsscreen_descr *descr = w100_console.descr; + struct w100_screen *scr; + struct rasops_info *ri; + long defattr; + + error = w100_new_screen(sc, descr->depth, &scr); + if (error) { + aprint_error_dev(sc->dev, + "unable to create new screen (errno=%d)", error); + return; + } + + ri = &scr->rinfo; + ri->ri_hw = (void *)scr; + ri->ri_bits = scr->buf_va; + w100_setup_rasops(sc, ri, descr, geom); + + /* assumes 16 bpp */ + (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr); + +// pxa2x0_lcd_start_dma(sc, scr); + sc->active = scr; + + wsdisplay_cnattach(&descr->c, ri, ri->ri_ccol, ri->ri_crow, + defattr); + + aprint_normal_dev(sc->dev, "console\n"); + } +#endif +} + +int +w100_cnattach(struct w100_wsscreen_descr *descr, + const struct w100_panel_geometry *geom) +{ + w100_console.descr = descr; + w100_console.geom = geom; + w100_console.is_console = 1; + + return 0; +} + +/* + * Create and initialize a new screen buffer. + */ +static int +w100_new_screen(struct w100_softc *sc, int depth, struct w100_screen **scrpp) +{ + struct w100_screen *scr = NULL; + int error = 0; + + scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); + if (scr == NULL) + return ENOMEM; + + memset(scr, 0, sizeof(*scr)); + + scr->buf_va = (u_char *)bus_space_vaddr(sc->iot, sc->ioh_vram); + scr->depth = depth; + + LIST_INSERT_HEAD(&sc->screens, scr, link); + sc->n_screens++; + + *scrpp = scr; + + return error; +} + +#if NWSDISPLAY > 0 +/* + * Initialize rasops for a screen, as well as struct wsscreen_descr if this + * is the first screen creation. + */ +static void +w100_setup_rasops(struct w100_softc *sc, struct rasops_info *rinfo, + struct w100_wsscreen_descr *descr, const struct w100_panel_geometry *geom) +{ + rinfo->ri_flg = descr->flags; + rinfo->ri_depth = descr->depth; + rinfo->ri_width = sc->display_width; + rinfo->ri_height = sc->display_height; + rinfo->ri_stride = rinfo->ri_width * rinfo->ri_depth / 8; +#ifdef notyet + rinfo->ri_wsfcookie = -1; /* XXX */ +#endif + + /* swap B and R */ + if (descr->depth == 16) { + rinfo->ri_rnum = 5; + rinfo->ri_rpos = 11; + rinfo->ri_gnum = 6; + rinfo->ri_gpos = 5; + rinfo->ri_bnum = 5; + rinfo->ri_bpos = 0; + } + + if (descr->c.nrows == 0) { + /* get rasops to compute screen size the first time */ + rasops_init(rinfo, 100, 100); + } else { + rasops_init(rinfo, descr->c.nrows, descr->c.ncols); + } + + descr->c.nrows = rinfo->ri_rows; + descr->c.ncols = rinfo->ri_cols; + descr->c.capabilities = rinfo->ri_caps; + descr->c.textops = &rinfo->ri_ops; +} +#endif + +/* + * Power management + */ +void +w100_suspend(struct w100_softc *sc) +{ + + if (sc->active) { + //pxa2x0_lcd_stop_dma(sc); + //pxa2x0_clkman_config(CKEN_LCD, 0); + } +} + +void +w100_resume(struct w100_softc *sc) +{ + + if (sc->active) { + w100_initialize(sc, sc->geometry); + //pxa2x0_lcd_start_dma(sc, sc->active); + } +} + +void +w100_power(int why, void *v) +{ + struct w100_softc *sc = v; + + switch (why) { + case PWR_SUSPEND: + case PWR_STANDBY: + w100_suspend(sc); + break; + + case PWR_RESUME: + w100_resume(sc); + break; + } +} + +/* + * Initialize struct wsscreen_descr based on values calculated by + * raster operation subsystem. + */ +#if 0 +int +w100_setup_wsscreen(struct w100_wsscreen_descr *descr, + const struct w100_panel_geometry *geom, + const char *fontname) +{ + int width = geom->panel_width; + int height = geom->panel_height; + int cookie = -1; + struct rasops_info rinfo; + + memset(&rinfo, 0, sizeof rinfo); + + if (fontname) { + wsfont_init(); + cookie = wsfont_find(fontname, 0, 0, 0, + WSDISPLAY_FONTORDER_L2R, WSDISPLAY_FONTORDER_L2R); + if (cookie < 0 || + wsfont_lock(cookie, &rinfo.ri_font)) + return -1; + } + else { + /* let rasops_init() choose any font */ + } + + /* let rasops_init calculate # of cols and rows in character */ + rinfo.ri_flg = 0; + rinfo.ri_depth = descr->depth; + rinfo.ri_bits = NULL; + rinfo.ri_width = width; + rinfo.ri_height = height; + rinfo.ri_stride = width * rinfo.ri_depth / 8; + rinfo.ri_wsfcookie = cookie; + + rasops_init(&rinfo, 100, 100); + + descr->c.nrows = rinfo.ri_rows; + descr->c.ncols = rinfo.ri_cols; + descr->c.capabilities = rinfo.ri_caps; + + return cookie; +} +#endif + +int +w100_show_screen(void *v, void *cookie, int waitok, + void (*cb)(void *, int, int), void *cbarg) +{ + return 0; +} + +int +w100_alloc_screen(void *v, const struct wsscreen_descr *_type, + void **cookiep, int *curxp, int *curyp, long *attrp) +{ + struct w100_softc *sc = v; + struct w100_screen *scr; + const struct w100_wsscreen_descr *type = + (const struct w100_wsscreen_descr *)_type; + int error; + + if (sc->n_screens > 0) + return ENOMEM; + + error = w100_new_screen(sc, type->depth, &scr); + if (error) + return error; + + /* + * initialize raster operation for this screen. + */ + scr->rinfo.ri_flg = 0; + scr->rinfo.ri_depth = type->depth; + scr->rinfo.ri_bits = scr->buf_va; + scr->rinfo.ri_width = sc->display_width; + scr->rinfo.ri_height = sc->display_height; + scr->rinfo.ri_stride = scr->rinfo.ri_width * scr->rinfo.ri_depth / 8; + scr->rinfo.ri_wsfcookie = -1; /* XXX */ + + rasops_init(&scr->rinfo, type->c.nrows, type->c.ncols); + + (*scr->rinfo.ri_ops.allocattr)(&scr->rinfo, 0, 0, 0, attrp); + + *cookiep = scr; + *curxp = 0; + *curyp = 0; + + return 0; +} + +void +w100_free_screen(void *v, void *cookie) +{ + struct w100_softc *sc = v; + struct w100_screen *scr = cookie; + + LIST_REMOVE(scr, link); + sc->n_screens--; +} + +int +w100_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, + struct lwp *l) +{ + struct w100_softc *sc = v; + struct w100_screen *scr = sc->active; /* ??? */ + struct wsdisplay_fbinfo *wsdisp_info; + + switch (cmd) { + case WSDISPLAYIO_GTYPE: + *(int *)data = WSDISPLAY_TYPE_UNKNOWN; + return 0; + + case WSDISPLAYIO_GINFO: + wsdisp_info = (struct wsdisplay_fbinfo *)data; + wsdisp_info->height = sc->display_height; + wsdisp_info->width = sc->display_width; + wsdisp_info->depth = scr->depth; + wsdisp_info->cmsize = 0; + return 0; + + case WSDISPLAYIO_LINEBYTES: + *(u_int *)data = scr->rinfo.ri_stride; + return 0; + + case WSDISPLAYIO_GETCMAP: + case WSDISPLAYIO_PUTCMAP: + return EPASSTHROUGH; /* XXX Colormap */ + + case WSDISPLAYIO_SVIDEO: + if (*(int *)data == WSDISPLAYIO_VIDEO_ON) { + /* turn it on */ + } + else { + /* start LCD shutdown */ + /* sleep until interrupt */ + } + return 0; + + case WSDISPLAYIO_GVIDEO: +// ccr0 = bus_space_read_4(sc->iot, sc->ioh, LCDC_LCCR0); +// *(u_int *)data = (ccr0 & (LCCR0_ENB|LCCR0_DIS)) == LCCR0_ENB ? +// WSDISPLAYIO_VIDEO_ON : WSDISPLAYIO_VIDEO_OFF; + *(u_int *)data = WSDISPLAYIO_VIDEO_ON; + return 0; + + case WSDISPLAYIO_GCURPOS: + case WSDISPLAYIO_SCURPOS: + case WSDISPLAYIO_GCURMAX: + case WSDISPLAYIO_GCURSOR: + case WSDISPLAYIO_SCURSOR: + return EPASSTHROUGH; /* XXX */ + } + + return EPASSTHROUGH; +} + +paddr_t +w100_mmap(void *v, void *vs, off_t offset, int prot) +{ + struct w100_softc *sc = v; + struct w100_screen *scr = sc->active; /* ??? */ + + if (scr == NULL) + return -1; + + if (offset < 0 || + offset >= scr->rinfo.ri_stride * scr->rinfo.ri_height) + return -1; + + return arm_btop(W100_EXTMEM_ADDRESS + offset); +} + + +static void +w100_cursor(void *cookie, int on, int row, int col) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.cursor)(&scr->rinfo, on, row, col); +} + +static int +w100_mapchar(void *cookie, int c, unsigned int *cp) +{ + struct w100_screen *scr = cookie; + + return (*scr->rinfo.ri_ops.mapchar)(&scr->rinfo, c, cp); +} + +static void +w100_putchar(void *cookie, int row, int col, u_int uc, long attr) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.putchar)(&scr->rinfo, row, col, uc, attr); +} + +static void +w100_copycols(void *cookie, int row, int src, int dst, int num) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.copycols)(&scr->rinfo, row, src, dst, num); +} + +static void +w100_erasecols(void *cookie, int row, int col, int num, long attr) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.erasecols)(&scr->rinfo, row, col, num, attr); +} + +static void +w100_copyrows(void *cookie, int src, int dst, int num) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.copyrows)(&scr->rinfo, src, dst, num); +} + +static void +w100_eraserows(void *cookie, int row, int num, long attr) +{ + struct w100_screen *scr = cookie; + + (*scr->rinfo.ri_ops.eraserows)(&scr->rinfo, row, num, attr); +} + +static int +w100_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr) +{ + struct w100_screen *scr = cookie; + + return (*scr->rinfo.ri_ops.allocattr)(&scr->rinfo, fg, bg, flg, attr); +} + +const struct wsdisplay_emulops w100_emulops = { + w100_cursor, + w100_mapchar, + w100_putchar, + w100_copycols, + w100_erasecols, + w100_copyrows, + w100_eraserows, + w100_alloc_attr +}; + + --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/dev/w100reg.h 2011-12-11 03:57:11.000000000 +0900 @@ -0,0 +1,7 @@ +#define W100_REG_PCLK_CTRL 0x0090 + +#define W100_REG_GRAPHIC_CTRL 0x0414 +#define W100_REG_GRAPHIC_OFFSET 0x0418 +#define W100_REG_GRAPHIC_PITCH 0x041c + +#define W100_REG_DISP_DB_BUF_CTRL 0x04d8 --- /dev/null 2012-01-02 19:30:47.000000000 +0900 +++ arch/zaurus/dev/w100var.h 2011-12-11 03:55:44.000000000 +0900 @@ -0,0 +1,86 @@ +#ifndef _W100VAR_H +#define _W100VAR_H + +#include +#include + +struct w100_screen { + LIST_ENTRY(w100_screen) link; + + /* Frame buffer */ + void *buf_va; + int depth; + + /* rasterop */ + struct rasops_info rinfo; +}; + +struct w100_softc { + device_t dev; + /* control register */ + bus_space_tag_t iot; + bus_space_handle_t ioh_cfg; /* config */ + bus_space_handle_t ioh_reg; /* register */ + bus_space_handle_t ioh_vram; /* video memory */ + + const struct w100_panel_geometry *geometry; + + short display_width; + short display_height; + + int n_screens; + LIST_HEAD(, w100_screen) screens; + struct w100_screen *active; +}; + +struct w100_panel_geometry { + short panel_width; + short panel_height; + + short rotate; +#define W100_PANEL_ROTATE_CW 1 /* quarter clockwise */ +#define W100_PANEL_ROTATE_CCW 2 /* quarter counter-clockwise */ +#define W100_PANEL_ROTATE_UD 3 /* upside-down */ +}; + +struct w100_wsscreen_descr { + struct wsscreen_descr c; /* standard descriptor */ + int depth; /* bits per pixel */ + int flags; /* rasops flags */ +}; + +#define W100_CFG_OFFSET (0x00000000) +#define W100_REG_OFFSET (0x00010000) +#define W100_INTMEM_OFFSET (0x00100000) +#define W100_EXTMEM_OFFSET (0x00800000) + +#define W100_BASE_ADDRESS (0x08000000) +#define W100_CFG_ADDRESS (W100_BASE_ADDRESS + W100_CFG_OFFSET) +#define W100_REG_ADDRESS (W100_BASE_ADDRESS + W100_REG_OFFSET) +#define W100_INTMEM_ADDRESS (W100_BASE_ADDRESS + W100_INTMEM_OFFSET) +#define W100_EXTMEM_ADDRESS (W100_BASE_ADDRESS + W100_EXTMEM_OFFSET) + +#define W100_CFG_SIZE (0x00000010) +#define W100_REG_SIZE (0x00002000) +#define W100_INTMEM_SIZE (0x00060000) +#define W100_EXTMEM_SIZE (0x00160000) + +void w100_attach_subr(struct w100_softc *, bus_space_tag_t, + const struct w100_panel_geometry *); +int w100_cnattach(struct w100_wsscreen_descr *, + const struct w100_panel_geometry *); +void w100_suspend(struct w100_softc *); +void w100_resume(struct w100_softc *); +void w100_power(int, void *); +int w100_show_screen(void *, void *, int, void (*)(void *, int, int), + void *); +int w100_alloc_screen(void *, const struct wsscreen_descr *, void **, + int *, int *, long *); +void w100_free_screen(void *, void *); +int w100_ioctl(void *, void *, u_long, void *, int, struct lwp *); +paddr_t w100_mmap(void *, void *, off_t, int); + +extern const struct wsdisplay_emulops w100_emulops; + + +#endif /* _W100VAR_H */