qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2] mainstone: use gpio 0 for connection of FPGA instead of hooking into PIC directly
@ 2011-03-04  0:54 Dmitry Eremin-Solenikov
  2011-03-04  0:54 ` [Qemu-devel] [PATCH 2/2] mainstone: PCMCIA support Dmitry Eremin-Solenikov
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-03-04  0:54 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 hw/mainstone.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/mainstone.c b/hw/mainstone.c
index 4eabdb9..8970dd8 100644
--- a/hw/mainstone.c
+++ b/hw/mainstone.c
@@ -140,7 +140,7 @@ static void mainstone_common_init(ram_addr_t ram_size,
     }
 
     mst_irq = sysbus_create_simple("mainstone-fpga", MST_FPGA_PHYS,
-                    qdev_get_gpio_in(cpu->pic, PXA2XX_PIC_GPIO_0));
+                    qdev_get_gpio_in(cpu->gpio, 0));
 
     /* setup keypad */
     printf("map addr %p\n", &map);
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] [PATCH 2/2] mainstone: PCMCIA support
  2011-03-04  0:54 [Qemu-devel] [PATCH 1/2] mainstone: use gpio 0 for connection of FPGA instead of hooking into PIC directly Dmitry Eremin-Solenikov
@ 2011-03-04  0:54 ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-03-04  0:54 UTC (permalink / raw)
  To: qemu-devel

Extend mst_fpga and mainstone with logic to support PCMCIA
attachment (IRQs, status regs).

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 hw/mainstone.c |    7 +++++++
 hw/mst_fpga.c  |   29 +++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/hw/mainstone.c b/hw/mainstone.c
index 8970dd8..50691ca 100644
--- a/hw/mainstone.c
+++ b/hw/mainstone.c
@@ -149,6 +149,13 @@ static void mainstone_common_init(ram_addr_t ram_size,
     /* MMC/SD host */
     pxa2xx_mmci_handlers(cpu->mmc, NULL, qdev_get_gpio_in(mst_irq, MMC_IRQ));
 
+    pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[0],
+            qdev_get_gpio_in(mst_irq, S0_IRQ),
+            qdev_get_gpio_in(mst_irq, S0_CD_IRQ));
+    pxa2xx_pcmcia_set_irq_cb(cpu->pcmcia[1],
+            qdev_get_gpio_in(mst_irq, S1_IRQ),
+            qdev_get_gpio_in(mst_irq, S1_CD_IRQ));
+
     smc91c111_init(&nd_table[0], MST_ETH_PHYS,
                     qdev_get_gpio_in(mst_irq, ETHERNET_IRQ));
 
diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c
index 407bac9..9ee415e 100644
--- a/hw/mst_fpga.c
+++ b/hw/mst_fpga.c
@@ -26,6 +26,12 @@
 #define MST_PCMCIA0		0xe0
 #define MST_PCMCIA1		0xe4
 
+#define MST_PCMCIAx_READY	(1 << 10)
+#define MST_PCMCIAx_nCD		(1 << 5)
+
+#define MST_PCMCIA_CD0_IRQ 9
+#define MST_PCMCIA_CD1_IRQ 13
+
 typedef struct mst_irq_state{
 	SysBusDevice busdev;
 
@@ -57,6 +63,21 @@ mst_fpga_set_irq(void *opaque, int irq, int level)
 	else
 		s->prev_level &= ~(1u << irq);
 
+	switch(irq) {
+	case MST_PCMCIA_CD0_IRQ:
+		if (level)
+			s->pcmcia0 &= ~MST_PCMCIAx_nCD;
+		else
+			s->pcmcia0 |=  MST_PCMCIAx_nCD;
+		break;
+	case MST_PCMCIA_CD1_IRQ:
+		if (level)
+			s->pcmcia1 &= ~MST_PCMCIAx_nCD;
+		else
+			s->pcmcia1 |=  MST_PCMCIAx_nCD;
+		break;
+	}
+
 	if ((s->intmskena & (1u << irq)) && level)
 		s->intsetclr |= 1u << irq;
 
@@ -141,11 +162,12 @@ mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
 		s->intsetclr = (value & 0xFEEFF);
 		qemu_set_irq(s->parent, s->intsetclr & s->intmskena);
 		break;
+		/* For PCMCIAx allow the to change only power and reset */
 	case MST_PCMCIA0:
-		s->pcmcia0 = value;
+		s->pcmcia0 = (value & 0x1f) | (s->pcmcia0 & ~0x1f);
 		break;
 	case MST_PCMCIA1:
-		s->pcmcia1 = value;
+		s->pcmcia1 = (value & 0x1f) | (s->pcmcia1 & ~0x1f);
 		break;
 	default:
 		printf("Mainstone - mst_fpga_writeb: Bad register offset "
@@ -180,6 +202,9 @@ static int mst_fpga_init(SysBusDevice *dev)
 
 	s = FROM_SYSBUS(mst_irq_state, dev);
 
+	s->pcmcia0 = MST_PCMCIAx_READY | MST_PCMCIAx_nCD;
+	s->pcmcia1 = MST_PCMCIAx_READY | MST_PCMCIAx_nCD;
+
 	sysbus_init_irq(dev, &s->parent);
 
 	/* alloc the external 16 irqs */
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-04  0:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04  0:54 [Qemu-devel] [PATCH 1/2] mainstone: use gpio 0 for connection of FPGA instead of hooking into PIC directly Dmitry Eremin-Solenikov
2011-03-04  0:54 ` [Qemu-devel] [PATCH 2/2] mainstone: PCMCIA support Dmitry Eremin-Solenikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).