Add main PXA on-chip peripherals.
PATCH 1/1 Add main PXA on-chip peripherals.
This adds the remaining on-chip peripherals of the PXA2xx:
- MMC/SD host.
- PCMCIA sockets.
- System timers.
- LCD controller. For the LCD I added the "-portrait" switch that rotates the display 90 degrees left. This is for the Spitz machine (clamshell based PDA) that can work in the two display modes. The rotation can be changed in runtime when machine code decides so. When the screen is being rotated, the mouse clicks coordinates are also rotated so the guest OS doesn't have to recalibrate input devices (i.e touchscreen).
Apply on top of the earlier patches: "[PATCH] Memory mapped OHCI host with PXA-specific bits", "[PATCH] SecureDigital card emulation", "[PATCH] ARM XScale core features. PXA270 and PXA255 emulation."
Cheers,
Andrew
From 91faf02612ca8870cc58b76e1b7fd37a8bf132c1 Mon Sep 17 00:00:00 2001
From: Andrzej Zaborowski <[email protected]>
Date: Fri, 16 Mar 2007 16:26:25 +0100
Subject: [PATCH] Add main PXA on-chip peripherals.
--- hw/pxa.h | 33 ++ hw/pxa2xx.c | 29 ++ hw/pxa2xx_lcd.c | 1001 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/pxa2xx_mmci.c | 489 ++++++++++++++++++++++++ hw/pxa2xx_pcmcia.c | 230 ++++++++++++ hw/pxa2xx_template.h | 431 ++++++++++++++++++++++ hw/pxa2xx_timer.c | 437 ++++++++++++++++++++++ vl.c | 19 +- vl.h | 1 + 9 files changed, 2669 insertions(+), 1 deletions(-)
hw/pxa.h +33 -0
@@ -64,6 +64,12 @@ struct pxa2xx_pic_state_s;struct pxa2xx_pic_state_s *pxa2xx_pic_init (target_phys_addr_t base,CPUState *env); +/* pxa2xx_timer.c */ +void pxa25x_timer_init (target_phys_addr_t base, +void *pic,int irq,CPUState *cpustate); +void pxa27x_timer_init (target_phys_addr_t base, +void *pic,int irq,int irq4,CPUState *cpustate); +/* pxa2xx_gpio.c */ struct pxa2xx_gpio_info_s ; struct pxa2xx_gpio_info_s *pxa2xx_gpio_init(target_phys_addr_t base,
@@ -82,6 +88,30 @@ struct pxa2xx_dma_state_s *pxa27x_dma_init(target_phys_addr_t base, void *pic, int irq);void pxa2xx_dma_request (struct pxa2xx_dma_state_s *s,int req_num,int on); +/* pxa2xx_lcd.c */ +struct pxa2xx_lcdc_s ; +struct pxa2xx_lcdc_s *pxa2xx_lcdc_init (target_phys_addr_t base, +void *pic,DisplayState *ds); +void pxa2xx_lcd_vsync_cb (struct pxa2xx_lcdc_s *s, +void (*cb)(void *opaque),void *opaque); +void pxa2xx_lcdc_oritentation (void *opaque,int angle); + +/* pxa2xx_mmci.c */ +struct pxa2xx_mmci_s ; +struct pxa2xx_mmci_s *pxa2xx_mmci_init (target_phys_addr_t base, +void *pic,void *dma); +void pxa2xx_mmci_handlers (struct pxa2xx_mmci_s *s,void *opaque, +void (*readonly_cb)(void *,int ), +void (*coverswitch_cb)(void *,int )); + +/* pxa2xx_pcmcia.c */ +struct pxa2xx_pcmcia_s ; +struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init (target_phys_addr_t base); +int pxa2xx_pcmcia_attach (void *opaque,struct pcmcia_card_s *card); +int pxa2xx_pcmcia_dettach (void *opaque); +void pxa2xx_pcmcia_set_irq_cb (void *opaque,void (*set_irq)(void *opaque, +int line,int level),int irq,int cd_irq,void *pic); +/* pxa2xx.c */ struct pxa2xx_ssp_s ; void pxa2xx_ssp_attach(struct pxa2xx_ssp_s *port,
@@ -97,7 +127,10 @@ struct pxa2xx_state_s {struct pxa2xx_pic_state_s *pic;struct pxa2xx_dma_state_s *dma;struct pxa2xx_gpio_info_s *gpio; +struct pxa2xx_lcdc_s *lcd;struct pxa2xx_ssp_s **ssp; +struct pxa2xx_mmci_s *mmc; +struct pxa2xx_pcmcia_s *pcmcia[2 ];struct pxa2xx_i2c_s *i2c[2 ];struct pxa2xx_i2s_s *i2s;struct pxa2xx_fir_s *fir;
hw/pxa2xx.c +29 -0
@@ -1725,8 +1725,13 @@ struct pxa2xx_state_s *pxa270_init(DisplayState *ds, const char *revision) s->dma =pxa27x_dma_init (0x40000000 , s->pic,PXA2XX_PIC_DMA ); +pxa27x_timer_init (0x40a00000 , s->pic, +PXA2XX_PIC_OST_0 ,PXA27X_PIC_OST_4_11 , s->env); + s->gpio =pxa2xx_gpio_init (0x40e00000 , s->env, s->pic,121 ); + s->mmc =pxa2xx_mmci_init (0x41100000 , s->pic, s->dma); +for (i =0 ; pxa270_serial[i].io_base; i ++)if (serial_hds[i]) serial_mm_init(*(SetIRQFunc **) s->pic, s->pic,
@@ -1736,6 +1741,9 @@ struct pxa2xx_state_s *pxa270_init(DisplayState *ds, const char *revision) s->fir =pxa2xx_fir_init (0x40800000 ,PXA2XX_PIC_ICP , s->pic, s->dma, serial_hds[i]); +if (ds) + s->lcd =pxa2xx_lcdc_init (0x44000000 , s->pic, ds); + s->cm_base =0x41300000 ; s->cm_regs[CCCR >>4 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */
@@ -1769,6 +1777,13 @@ struct pxa2xx_state_s *pxa270_init(DisplayState *ds, const char *revision)cpu_register_physical_memory (ssp[i].base,0xfff , iomemtype); } +if (usb_enabled) { +usb_ohci_init_memio (0x4c000000 ,3 ,-1 , s->pic,PXA2XX_PIC_USBH1 ); + } + + s->pcmcia[0 ] =pxa2xx_pcmcia_init (0x20000000 ); + s->pcmcia[1 ] =pxa2xx_pcmcia_init (0x30000000 ); + s->rtc_base =0x40900000 ; iomemtype =cpu_register_io_memory (0 , pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s);
@@ -1807,8 +1822,12 @@ struct pxa2xx_state_s *pxa255_init(DisplayState *ds) s->dma =pxa255_dma_init (0x40000000 , s->pic,PXA2XX_PIC_DMA ); +pxa25x_timer_init (0x40a00000 , s->pic,PXA2XX_PIC_OST_0 , s->env); + s->gpio =pxa2xx_gpio_init (0x40e00000 , s->env, s->pic,121 ); + s->mmc =pxa2xx_mmci_init (0x41100000 , s->pic, s->dma); +for (i =0 ; pxa255_serial[i].io_base; i ++)if (serial_hds[i]) serial_mm_init(*(SetIRQFunc **) s->pic, s->pic,
@@ -1818,6 +1837,9 @@ struct pxa2xx_state_s *pxa255_init(DisplayState *ds) s->fir =pxa2xx_fir_init (0x40800000 ,PXA2XX_PIC_ICP , s->pic, s->dma, serial_hds[i]); +if (ds) + s->lcd =pxa2xx_lcdc_init (0x44000000 , s->pic, ds); + s->cm_base =0x41300000 ; s->cm_regs[CCCR >>4 ] =0x02000210 ;/* 416.0 MHz */ s->clkcfg =0x00000009 ;/* Turbo mode active */
@@ -1851,6 +1873,13 @@ struct pxa2xx_state_s *pxa255_init(DisplayState *ds)cpu_register_physical_memory (ssp[i].base,0xfff , iomemtype); } +if (usb_enabled) { +usb_ohci_init_memio (0x4c000000 ,3 ,-1 , s->pic,PXA2XX_PIC_USBH1 ); + } + + s->pcmcia[0 ] =pxa2xx_pcmcia_init (0x20000000 ); + s->pcmcia[1 ] =pxa2xx_pcmcia_init (0x30000000 ); + s->rtc_base =0x40900000 ; iomemtype =cpu_register_io_memory (0 , pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s);
hw/pxa2xx_lcd.c new file +1001 -0
1,001 lines not on this page · raw message
hw/pxa2xx_mmci.c new file +489 -0
489 lines not on this page · raw message
hw/pxa2xx_pcmcia.c new file +230 -0
230 lines not on this page · raw message
hw/pxa2xx_template.h new file +431 -0
431 lines not on this page · raw message
hw/pxa2xx_timer.c new file +437 -0
437 lines not on this page · raw message
vl.c +18 -1
@@ -186,6 +186,7 @@ int fd_bootchk = 1;int no_reboot =0 ;int snapshot =0 ;const char *sd_filename =0 ; +int graphic_rotate =0 ;int daemonize =0 ;const char *option_rom[MAX_OPTION_ROMS ];int nb_option_roms;
@@ -521,6 +522,7 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) {QEMUPutMouseEvent *mouse_event;void *mouse_event_opaque; +int width;if (!qemu_put_mouse_event_current) {return ;
@@ -532,7 +534,16 @@ void kbd_mouse_event(int dx, int dy, int dz, int buttons_state) qemu_put_mouse_event_current->qemu_put_mouse_event_opaque;if (mouse_event) { -mouse_event (mouse_event_opaque, dx, dy, dz, buttons_state); +if (graphic_rotate) { +if (qemu_put_mouse_event_current->qemu_put_mouse_event_absolute) + width =0x7fff ; +else + width = graphic_width; +mouse_event (mouse_event_opaque, + width - dy, dx, dz, buttons_state); + }else +mouse_event (mouse_event_opaque, + dx, dy, dz, buttons_state); } }
@@ -6420,6 +6431,7 @@ void help(void)"-m megs set virtual RAM size to megs MB [default=%d]\n" "-smp n set the number of CPUs to 'n' [default=1]\n" "-nographic disable graphical output and redirect serial I/Os to console\n" +"-portrait rotate graphical output 90 deg left (only PXA LCD)\n" #ifndef _WIN32"-k language use keyboard layout (for example \"fr\" for French)\n" #endif
@@ -6552,6 +6564,7 @@ enum {#endif QEMU_OPTION_m, QEMU_OPTION_nographic, + QEMU_OPTION_portrait, #ifdef HAS_AUDIO QEMU_OPTION_audio_help, QEMU_OPTION_soundhw,
@@ -6629,6 +6642,7 @@ const QEMUOption qemu_options[] = {#endif { "m", HAS_ARG, QEMU_OPTION_m }, { "nographic", 0, QEMU_OPTION_nographic }, + { "portrait", 0, QEMU_OPTION_portrait }, { "k", HAS_ARG, QEMU_OPTION_k }, #ifdef HAS_AUDIO { "audio-help", 0, QEMU_OPTION_audio_help },
@@ -7133,6 +7147,9 @@ int main(int argc, char **argv)pstrcpy (monitor_device,sizeof (monitor_device),"stdio" ); nographic =1 ;break ; +case QEMU_OPTION_portrait: + graphic_rotate =1 ; +break ;case QEMU_OPTION_kernel: kernel_filename = optarg;break ;
vl.h +1 -0
@@ -158,6 +158,7 @@ extern int usb_enabled;extern int smp_cpus;extern int snapshot;extern const char *sd_filename; +extern int graphic_rotate;extern int no_quit;extern int semihosting_enabled;extern int autostart;
Signature · 1 line
1.4.4.3