aboutsummaryrefslogtreecommitdiff
path: root/hw/palm.c
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-03 00:41:31 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-03 00:41:31 +0000
commit7fc42b4bbddc47a6bebc281ee96e9ddcd537d46e (patch)
tree3effd8da803a2b61fd2ca7bbdd5a58e9efb62474 /hw/palm.c
parent9fceefa7d12c832c4da69737ce216c415309a7c3 (diff)
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
Diffstat (limited to 'hw/palm.c')
-rw-r--r--hw/palm.c66
1 files changed, 59 insertions, 7 deletions
diff --git a/hw/palm.c b/hw/palm.c
index c21b44a9d6..8800dc608b 100644
--- a/hw/palm.c
+++ b/hw/palm.c
@@ -78,11 +78,10 @@ static CPUWriteMemoryFunc *static_writefn[] = {
static void palmte_microwire_setup(struct omap_mpu_state_s *cpu)
{
- qemu_irq p_int = omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO];
-
omap_uwire_attach(
cpu->microwire,
- tsc2102_init(qemu_irq_invert(p_int)),
+ tsc2102_init(
+ omap_gpio_in_get(cpu->gpio)[PALMTE_PINTDAV_GPIO]),
0);
}
@@ -115,6 +114,62 @@ static void palmte_button_event(void *opaque, int keycode)
!(keycode & 0x80));
}
+static void palmte_onoff_gpios(void *opaque, int line, int level)
+{
+ switch (line) {
+ case 0:
+ printf("%s: current to MMC/SD card %sabled.\n",
+ __FUNCTION__, level ? "dis" : "en");
+ break;
+ case 1:
+ printf("%s: internal speaker amplifier %s.\n",
+ __FUNCTION__, level ? "down" : "on");
+ break;
+
+ /* These LCD & Audio output signals have not been identified yet. */
+ case 2:
+ case 3:
+ case 4:
+ printf("%s: LCD GPIO%i %s.\n",
+ __FUNCTION__, line - 1, level ? "high" : "low");
+ break;
+ case 5:
+ case 6:
+ printf("%s: Audio GPIO%i %s.\n",
+ __FUNCTION__, line - 4, level ? "high" : "low");
+ break;
+ }
+}
+
+static void palmte_gpio_setup(struct omap_mpu_state_s *cpu)
+{
+ qemu_irq *misc_gpio;
+
+ omap_mmc_handlers(cpu->mmc,
+ omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO],
+ qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
+ [PALMTE_MMC_SWITCH_GPIO]));
+
+ misc_gpio = qemu_allocate_irqs(palmte_onoff_gpios, cpu, 7);
+ omap_gpio_out_set(cpu->gpio, PALMTE_MMC_POWER_GPIO, misc_gpio[0]);
+ omap_gpio_out_set(cpu->gpio, PALMTE_SPEAKER_GPIO, misc_gpio[1]);
+ omap_gpio_out_set(cpu->gpio, 11, misc_gpio[2]);
+ omap_gpio_out_set(cpu->gpio, 12, misc_gpio[3]);
+ omap_gpio_out_set(cpu->gpio, 13, misc_gpio[4]);
+ omap_mpuio_out_set(cpu->mpuio, 1, misc_gpio[5]);
+ omap_mpuio_out_set(cpu->mpuio, 3, misc_gpio[6]);
+
+ /* Reset some inputs to initial state. */
+ qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USBDETECT_GPIO]);
+ qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_USB_OR_DC_GPIO]);
+ qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[4]);
+ qemu_irq_lower(omap_gpio_in_get(cpu->gpio)[PALMTE_HEADPHONES_GPIO]);
+ qemu_irq_lower(omap_mpuio_in_get(cpu->mpuio)[PALMTE_DC_GPIO]);
+ qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[6]);
+ qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[7]);
+ qemu_irq_raise(omap_mpuio_in_get(cpu->mpuio)[11]);
+}
+
static void palmte_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char **fd_filename, int snapshot,
@@ -158,10 +213,7 @@ static void palmte_init(int ram_size, int vga_ram_size,
qemu_add_kbd_event_handler(palmte_button_event, cpu);
- omap_mmc_handlers(cpu->mmc,
- omap_gpio_in_get(cpu->gpio)[PALMTE_MMC_WP_GPIO],
- qemu_irq_invert(omap_mpuio_in_get(cpu->mpuio)
- [PALMTE_MMC_SWITCH_GPIO]));
+ palmte_gpio_setup(cpu);
/* Setup initial (reset) machine state */
if (nb_option_roms) {