[Qemu-devel] [PATCH] pxa2xx: Auto-assign name for i2c bus in i2c_init_bus.

2016-10-13 Thread Vijay Kumar B
If a name is provided, the same name is assigned to both the I2C
controllers. Leaving it NULL, causes names to be automatically
assigned with an ID suffix, giving unique names to each
controller. This helps us to uniquely identify each controller in the
device tree, for example when adding an I2C device.

Signed-off-by: Vijay Kumar B. 
Reviewed-by: Deepak S. 
---
 hw/arm/pxa2xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 0241e07..9898287 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -1505,7 +1505,7 @@ static void pxa2xx_i2c_initfn(Object *obj)
 PXA2xxI2CState *s = PXA2XX_I2C(obj);
 SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
 
-s->bus = i2c_init_bus(dev, "i2c");
+s->bus = i2c_init_bus(dev, NULL);
 
 memory_region_init_io(&s->iomem, obj, &pxa2xx_i2c_ops, s,
   "pxa2xx-i2c", s->region_size);
-- 
2.1.4




[Qemu-devel] [PATCH] pxa2xx: Add a reset handler to reset the ARM CPU.

2016-09-29 Thread Vijay Kumar B
Currently the CPU does not get reset when the system_reset command is
invoked. We register a handler in the pxa2xx SoC code, to reset the
CPU as well.

Signed-off-by: Vijay Kumar B. 
Reviewed-by: Deepak S. 
---
 hw/arm/pxa2xx.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
index 0241e07..08223b7 100644
--- a/hw/arm/pxa2xx.c
+++ b/hw/arm/pxa2xx.c
@@ -2056,6 +2056,12 @@ static void pxa2xx_reset(void *opaque, int line, int 
level)
 }
 }
 
+static void pxa_reset_cb(void *opaque)
+{
+PXA2xxState *s = opaque;
+cpu_reset(CPU(s->cpu));
+}
+
 /* Initialise a PXA270 integrated chip (ARM based core).  */
 PXA2xxState *pxa270_init(MemoryRegion *address_space,
  unsigned int sdram_size, const char *revision)
@@ -2192,6 +2198,8 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
 /* GPIO1 resets the processor */
 /* The handler can be overridden by board-specific code */
 qdev_connect_gpio_out(s->gpio, 1, s->reset);
+
+qemu_register_reset(pxa_reset_cb, s);
 return s;
 }
 
-- 
2.1.4




[Qemu-devel] [PATCH 2/2] mainstone: Add mapping for dot, slash and backspace.

2016-09-28 Thread Vijay Kumar B
Add missed out mappings. These mappings are from the "Intel PXA27x
Processor Developer's Kit User Guide".

Signed-off-by: Vijay Kumar B. 
Reviewed-by: Deepak S. 
---
 hw/arm/mainstone.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index e81b878..f962236 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -73,8 +73,10 @@ static const struct keymap map[0xE0] = {
 [0x2f] = {3,3}, /* v */
 [0x11] = {3,4}, /* w */
 [0x2d] = {3,5}, /* x */
+[0x34] = {4,0}, /* . */
 [0x15] = {4,2}, /* y */
 [0x2c] = {4,3}, /* z */
+[0x35] = {4,4}, /* / */
 [0xc7] = {5,0}, /* Home */
 [0x2a] = {5,1}, /* shift */
 /*
@@ -89,6 +91,7 @@ static const struct keymap map[0xE0] = {
  * TODO: Compare with Linux code and test real hardware.
  */
 [0x1c] = {5,4}, /* enter */
+[0x0e] = {5,5}, /* backspace */
 [0xc8] = {6,0}, /* up */
 [0xd0] = {6,1}, /* down */
 [0xcb] = {6,2}, /* left */
-- 
2.1.4




[Qemu-devel] [PATCH 0/2] mainstone: Fix incorrect and missed out keypad mappings.

2016-09-28 Thread Vijay Kumar B
Resending, since I missed qemu-devel in the previous submission. Sorry
about that.

This patch series fixes the key mappings for the mainstone board. The
incorrect mappings renders the console unusable when used with the
Linux kernel's fbcon driver.

Vijay Kumar B (2):
  Fix incorrect key mapping for Enter key.
  Add mapping for dot, slash and backspace.

 hw/arm/mainstone.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.1.4




[Qemu-devel] PXA2xx system_reset command

2016-09-28 Thread Vijay Kumar B.

Hi Everyone,

We would like to add support for resetting the PXA2xx when the user 
invokes the system_reset command. What would be the best way to 
implement this? The PXA2xx emulation has a callback registered for the 
reset IRQ, which does a CPU reset. The callback is shown below. This 
gets invoked when the corresponding GPIO is toggled. (Not sure how one 
will toggle the GPIO though).


static void pxa2xx_reset(void *opaque, int line, int level)
{
PXA2xxState *s = (PXA2xxState *) opaque;

if (level && (s->pm_regs[PCFR >> 2] & 0x10)) {/* GPR_EN */
cpu_reset(CPU(s->cpu));
/* TODO: reset peripherals */
}
}

We would like to do something similar for the system_reset command. 
Would it be sufficient to do the same by registering a callback using 
qemu_register_reset()?


Regards,

Vijay




[Qemu-devel] [PATCH] usb: Fix incorrect default DMA offset.

2016-09-28 Thread Vijay Kumar B
The default DMA offset is set to 3. When the property is not set by
the consumer, the default causes DMA access to be shifted by 3
bytes. In PXA, this results in incorrect DMA access, leading to error
notification in the USB controller driver. A better default would be
0, so that there is no offset, when the consumer does not specify one.

Signed-off-by: Vijay Kumar B. 
Reviewed-by: Deepak S. 
---
 hw/usb/hcd-ohci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index fa57038..c82a92f 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -2139,7 +2139,7 @@ static const TypeInfo ohci_pci_info = {
 
 static Property ohci_sysbus_properties[] = {
 DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
-DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 3),
+DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 0),
 DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.1.4




[Qemu-devel] [PATCH 1/2] mainstone: Fix incorrect key mapping for Enter key.

2016-09-28 Thread Vijay Kumar B
According to the manual the (5, 5) corresponds to backspace key, and
not Enter key. Linux kernel maps (5, 4) to the enter key. Fixing it up
to match the mapping in the Linux kernel.

Signed-off-by: Vijay Kumar B. 
Reviewed-by: Deepak S. 
---
 hw/arm/mainstone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
index 454acc5..e81b878 100644
--- a/hw/arm/mainstone.c
+++ b/hw/arm/mainstone.c
@@ -88,7 +88,7 @@ static const struct keymap map[0xE0] = {
  * Matrix position {5,4} and other keys are missing here.
  * TODO: Compare with Linux code and test real hardware.
  */
-[0x1c] = {5,5}, /* enter (TODO: might be wrong) */
+[0x1c] = {5,4}, /* enter */
 [0xc8] = {6,0}, /* up */
 [0xd0] = {6,1}, /* down */
 [0xcb] = {6,2}, /* left */
-- 
2.1.4