aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-07-04 11:18:46 +0000
committerPeter Maydell <peter.maydell@linaro.org>2012-07-25 13:34:00 +0100
commit383b2aeb904cb047307663b9d04935334d04dd52 (patch)
treeea980d5e51b1e3eb50581aade7c79dfae93c0079
parentdb070669d92cbd0ed39fb14effef3dcbd5bdd852 (diff)
downloadqemu-arm-383b2aeb904cb047307663b9d04935334d04dd52.tar.gz
hw/nseries.c: Add debug trace to MIPID
-rw-r--r--hw/nseries.c63
1 files changed, 54 insertions, 9 deletions
diff --git a/hw/nseries.c b/hw/nseries.c
index f58989fc79..53f7629fa2 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -36,6 +36,15 @@
#include "sysbus.h"
#include "exec-memory.h"
+//#define MIPID_DEBUG
+
+#ifdef MIPID_DEBUG
+#define TRACE_MIPID(fmt, ...) \
+ fprintf(stderr, "%s@%d: " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define TRACE_MIPID(...)
+#endif
+
/* Nokia N8x0 support */
struct n800_s {
struct omap_mpu_state_s *mpu;
@@ -414,8 +423,9 @@ static void mipid_reset(DeviceState *qdev)
{
struct mipid_s *s = FROM_SPI_DEVICE(struct mipid_s,
SPI_DEVICE_FROM_QDEV(qdev));
- if (!s->sleep)
- fprintf(stderr, "%s: Display off\n", __FUNCTION__);
+ if (!s->sleep) {
+ TRACE_MIPID("display off");
+ }
s->pm = 0;
s->cmd = 0;
@@ -454,16 +464,20 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
switch (s->cmd) {
case 0x00: /* NOP */
+ TRACE_MIPID("NOP");
break;
case 0x01: /* SWRESET */
+ TRACE_MIPID("SWRESET");
mipid_reset(&s->spi.qdev);
break;
case 0x02: /* BSTROFF */
+ TRACE_MIPID("BSTROFF");
s->booster = 0;
break;
case 0x03: /* BSTRON */
+ TRACE_MIPID("BSTRON");
s->booster = 1;
break;
@@ -472,6 +486,8 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
s->resp[0] = (s->id >> 16) & 0xff;
s->resp[1] = (s->id >> 8) & 0xff;
s->resp[2] = (s->id >> 0) & 0xff;
+ TRACE_MIPID("RDDID 0x%02x 0x%02x 0x%02x",
+ s->resp[0], s->resp[1], s->resp[2]);
break;
case 0x06: /* RD_RED */
@@ -479,6 +495,7 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
/* XXX the bootloader sometimes issues RD_BLUE meaning RDDID so
* for the bootloader one needs to change this. */
case 0x08: /* RD_BLUE */
+ TRACE_MIPID("RD_RED/GREEN_BLUE 0x01");
s->p = 0;
/* TODO: return first pixel components */
s->resp[0] = 0x01;
@@ -492,83 +509,101 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
s->resp[2] = (s->vscr << 7) | (s->invert << 5) |
(s->onoff << 2) | (s->te << 1) | (s->gamma >> 2);
s->resp[3] = s->gamma << 6;
+ TRACE_MIPID("RDDST 0x%02x 0x%02x 0x%02x 0x%02x",
+ s->resp[0], s->resp[1], s->resp[2], s->resp[3]);
break;
case 0x0a: /* RDDPM */
s->p = 0;
s->resp[0] = (s->onoff << 2) | (s->normal << 3) | (s->sleep << 4) |
(s->partial << 5) | (s->sleep << 6) | (s->booster << 7);
+ TRACE_MIPID("RDDPM 0x%02x", s->resp[0]);
break;
case 0x0b: /* RDDMADCTR */
s->p = 0;
s->resp[0] = 0;
+ TRACE_MIPID("RDDMACTR 0x%02x", s->resp[0]);
break;
case 0x0c: /* RDDCOLMOD */
s->p = 0;
s->resp[0] = 5; /* 65K colours */
+ TRACE_MIPID("RDDCOLMOD 0x%02x", s->resp[0]);
break;
case 0x0d: /* RDDIM */
s->p = 0;
s->resp[0] = (s->invert << 5) | (s->vscr << 7) | s->gamma;
+ TRACE_MIPID("RDDIM 0x%02x", s->resp[0]);
break;
case 0x0e: /* RDDSM */
s->p = 0;
s->resp[0] = s->te << 7;
+ TRACE_MIPID("RDDSM 0x%02x", s->resp[0]);
break;
case 0x0f: /* RDDSDR */
s->p = 0;
s->resp[0] = s->selfcheck;
+ TRACE_MIPID("RDDSDR 0x%02x", s->resp[0]);
break;
case 0x10: /* SLPIN */
+ TRACE_MIPID("SLPIN");
s->sleep = 1;
break;
case 0x11: /* SLPOUT */
+ TRACE_MIPID("SLPOUT");
s->sleep = 0;
s->selfcheck ^= 1 << 6; /* POFF self-diagnosis Ok */
break;
case 0x12: /* PTLON */
+ TRACE_MIPID("PTLON");
s->partial = 1;
s->normal = 0;
s->vscr = 0;
break;
case 0x13: /* NORON */
+ TRACE_MIPID("NORON");
s->partial = 0;
s->normal = 1;
s->vscr = 0;
break;
case 0x20: /* INVOFF */
+ TRACE_MIPID("INVOFF");
s->invert = 0;
break;
case 0x21: /* INVON */
+ TRACE_MIPID("INVON");
s->invert = 1;
break;
case 0x22: /* APOFF */
case 0x23: /* APON */
+ TRACE_MIPID("APON/OFF");
goto bad_cmd;
case 0x25: /* WRCNTR */
+ TRACE_MIPID("WRCNTR");
if (s->pm < 0)
s->pm = 1;
goto bad_cmd;
case 0x26: /* GAMSET */
- if (!s->pm)
+ if (!s->pm) {
s->gamma = ffs(s->param[0] & 0xf) - 1;
- else if (s->pm < 0)
+ TRACE_MIPID("GAMSET 0x%02x", s->gamma);
+ } else if (s->pm < 0) {
s->pm = 1;
+ }
break;
case 0x28: /* DISPOFF */
+ TRACE_MIPID("DISPOFF");
s->onoff = 0;
- fprintf(stderr, "%s: Display off\n", __FUNCTION__);
break;
case 0x29: /* DISPON */
+ TRACE_MIPID("DISPON");
s->onoff = 1;
- fprintf(stderr, "%s: Display on\n", __FUNCTION__);
break;
case 0x2a: /* CASET */
@@ -581,19 +616,24 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
goto bad_cmd;
case 0x34: /* TEOFF */
+ TRACE_MIPID("TEOFF");
s->te = 0;
break;
case 0x35: /* TEON */
- if (!s->pm)
+ if (!s->pm) {
s->te = 1;
- else if (s->pm < 0)
+ TRACE_MIPID("TEON 0x%02x", s->param[0] & 0xff);
+ } else if (s->pm < 0) {
s->pm = 1;
+ }
break;
case 0x36: /* MADCTR */
+ TRACE_MIPID("MADCTR");
goto bad_cmd;
case 0x37: /* VSCSAD */
+ TRACE_MIPID("VSCSAD");
s->partial = 0;
s->normal = 0;
s->vscr = 1;
@@ -611,6 +651,7 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
break;
case 0xb4: /* FRMSEL */
+ TRACE_MIPID("FRMSEL");
break;
case 0xb5: /* FRM8SEL */
@@ -625,6 +666,7 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
s->p = 0;
s->resp[0] = 0;
s->resp[1] = 1;
+ TRACE_MIPID("??? 0x%02x 0x%02x", s->resp[0], s->resp[1]);
break;
case 0xc2: /* IFMOD */
@@ -643,19 +685,22 @@ static uint32_t mipid_txrx(SPIDevice *spidev, uint32_t cmd, int len)
case 0xda: /* RDID1 */
s->p = 0;
s->resp[0] = (s->id >> 16) & 0xff;
+ TRACE_MIPID("RDID1 0x%02x", s->resp[0]);
break;
case 0xdb: /* RDID2 */
s->p = 0;
s->resp[0] = (s->id >> 8) & 0xff;
+ TRACE_MIPID("RDID2 0x%02x", s->resp[0]);
break;
case 0xdc: /* RDID3 */
s->p = 0;
s->resp[0] = (s->id >> 0) & 0xff;
+ TRACE_MIPID("RDID3 0x%02x", s->resp[0]);
break;
default:
bad_cmd:
- fprintf(stderr, "%s: unknown command %02x\n", __FUNCTION__, s->cmd);
+ fprintf(stderr, "%s: unknown command 0x%02x\n", __FUNCTION__, s->cmd);
break;
}