Commit 7fc42b4bbddc47a6bebc281ee96e9ddcd537d46e

Authored by balrog
1 parent 9fceefa7

The PINT/DAV pin is active low in the chip spec, not inverted on the board.

Make changes on known GPIO lines be verbose, initialise GPIO levels.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3511 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 2 changed files with 63 additions and 11 deletions
hw/palm.c
... ... @@ -78,11 +78,10 @@ static CPUWriteMemoryFunc *static_writefn[] = {
78 78  
79 79 static void palmte_microwire_setup(struct omap_mpu_state_s *cpu)
80 80 {
81   - qemu_irq p_int = omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO];
82   -
83 81 omap_uwire_attach(
84 82 cpu->microwire,
85   - tsc2102_init(qemu_irq_invert(p_int)),
  83 + tsc2102_init(
  84 + omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO]),
86 85 0);
87 86 }
88 87  
... ... @@ -115,6 +114,62 @@ static void palmte_button_event(void *opaque, int keycode)
115 114 !(keycode & 0x80));
116 115 }
117 116  
  117 +static void palmte_onoff_gpios(void *opaque, int line, int level)
  118 +{
  119 + switch (line) {
  120 + case 0:
  121 + printf("%s: current to MMC/SD card %sabled.\n",
  122 + __FUNCTION__, level ? "dis" : "en");
  123 + break;
  124 + case 1:
  125 + printf("%s: internal speaker amplifier %s.\n",
  126 + __FUNCTION__, level ? "down" : "on");
  127 + break;
  128 +
  129 + /* These LCD & Audio output signals have not been identified yet. */
  130 + case 2:
  131 + case 3:
  132 + case 4:
  133 + printf("%s: LCD GPIO%i %s.\n",
  134 + __FUNCTION__, line - 1, level ? "high" : "low");
  135 + break;
  136 + case 5:
  137 + case 6:
  138 + printf("%s: Audio GPIO%i %s.\n",
  139 + __FUNCTION__, line - 4, level ? "high" : "low");
  140 + break;
  141 + }
  142 +}
  143 +
  144 +static void palmte_gpio_setup(struct omap_mpu_state_s *cpu)
  145 +{
  146 + qemu_irq *misc_gpio;
  147 +
  148 + omap_mmc_handlers(cpu->mmc,
  149 + omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO],
  150 + qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
  151 + [PALMTE_MMC_SWITCH_GPIO]));
  152 +
  153 + misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7);
  154 + omap_gpio_out_set(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]);
  155 + omap_gpio_out_set(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]);
  156 + omap_gpio_out_set(cpu->gpio, 11, misc_gpio[2]);
  157 + omap_gpio_out_set(cpu->gpio, 12, misc_gpio[3]);
  158 + omap_gpio_out_set(cpu->gpio, 13, misc_gpio[4]);
  159 + omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]);
  160 + omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]);
  161 +
  162 + /* Reset some inputs to initial state. */
  163 + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USBDETECT_GPIO]);
  164 + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USB_OR_DC_GPIO]);
  165 + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[4]);
  166 + qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_HEADPHONES_GPIO]);
  167 + qemu_irq_lower(omap_mpuio_in_get(cpu->mpuio)[PALMTE_DC_GPIO]);
  168 + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[6]);
  169 + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[7]);
  170 + qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[11]);
  171 +}
  172 +
118 173 static void palmte_init(int ram_size, int vga_ram_size,
119 174 const char *boot_device, DisplayState *ds,
120 175 const char **fd_filename, int snapshot,
... ... @@ -158,10 +213,7 @@ static void palmte_init(int ram_size, int vga_ram_size,
158 213  
159 214 qemu_add_kbd_event_handler(palmte_button_event, cpu);
160 215  
161   - omap_mmc_handlers(cpu->mmc,
162   - omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO],
163   - qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
164   - [PALMTE_MMC_SWITCH_GPIO]));
  216 + palmte_gpio_setup(cpu);
165 217  
166 218 /* Setup initial (reset) machine state */
167 219 if (nb_option_roms) {
... ...
hw/tsc210x.c
1 1 /*
2   - * TI TSC2102 (touchscreen/sensors/audio controller) controller.
  2 + * TI TSC2102 (touchscreen/sensors/audio controller) emulator.
3 3 *
4 4 * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
5 5 *
... ... @@ -171,7 +171,7 @@ static void tsc210x_reset(struct tsc210x_state_s *s)
171 171 s->filter_data[0x12] = 0x7d83;
172 172 s->filter_data[0x13] = 0x84ee;
173 173  
174   - qemu_set_irq(s->pint, s->irq);
  174 + qemu_set_irq(s->pint, !s->irq);
175 175 }
176 176  
177 177 static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg)
... ... @@ -572,7 +572,7 @@ static void tsc210x_pin_update(struct tsc210x_state_s *s)
572 572  
573 573 if (pin_state != s->irq) {
574 574 s->irq = pin_state;
575   - qemu_set_irq(s->pint, s->irq);
  575 + qemu_set_irq(s->pint, !s->irq);
576 576 }
577 577  
578 578 switch (s->nextfunction) {
... ... @@ -810,7 +810,7 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
810 810 qemu_get_be16s(f, &s->filter_data[i]);
811 811  
812 812 s->busy = qemu_timer_pending(s->timer);
813   - qemu_set_irq(s->pint, s->irq);
  813 + qemu_set_irq(s->pint, !s->irq);
814 814  
815 815 return 0;
816 816 }
... ...