Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KMUVY-0000LM-AL for qemu-devel@nongnu.org; Fri, 25 Jul 2008 17:07:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KMUVX-0000LA-OS for qemu-devel@nongnu.org; Fri, 25 Jul 2008 17:07:23 -0400 Received: from [199.232.76.173] (port=56319 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KMUVX-0000L7-JA for qemu-devel@nongnu.org; Fri, 25 Jul 2008 17:07:23 -0400 Received: from savannah.gnu.org ([199.232.41.3]:49923 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KMUVX-0004JR-9h for qemu-devel@nongnu.org; Fri, 25 Jul 2008 17:07:23 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KMUVW-0007bI-RA for qemu-devel@nongnu.org; Fri, 25 Jul 2008 21:07:22 +0000 Received: from balrog by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KMUVW-0007bE-Hl for qemu-devel@nongnu.org; Fri, 25 Jul 2008 21:07:22 +0000 MIME-Version: 1.0 Errors-To: balrog Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Andrzej Zaborowski Message-Id: Date: Fri, 25 Jul 2008 21:07:22 +0000 Subject: [Qemu-devel] [4943] Fix OMAP GPMC register offsets and SYSCTL 8bit io (Kyungmin Park). Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4943 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4943 Author: balrog Date: 2008-07-25 21:07:21 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix OMAP GPMC register offsets and SYSCTL 8bit io (Kyungmin Park). Modified Paths: -------------- trunk/hw/omap2.c Modified: trunk/hw/omap2.c =================================================================== --- trunk/hw/omap2.c 2008-07-25 07:42:14 UTC (rev 4942) +++ trunk/hw/omap2.c 2008-07-25 21:07:21 UTC (rev 4943) @@ -3528,6 +3528,32 @@ uint32_t msuspendmux[5]; }; +static uint32_t omap_sysctl_read8(void *opaque, target_phys_addr_t addr) +{ + + struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; + int offset = addr - s->base; + int pad_offset, byte_offset; + int value; + + switch (offset) { + case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ + pad_offset = (offset - 0x30) >> 2; + byte_offset = (offset - 0x30) & (4 - 1); + + value = s->padconf[pad_offset]; + value = (value >> (byte_offset * 8)) & 0xff; + + return value; + + default: + break; + } + + OMAP_BAD_REG(addr); + return 0; +} + static uint32_t omap_sysctl_read(void *opaque, target_phys_addr_t addr) { struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; @@ -3629,6 +3655,31 @@ return 0; } +static void omap_sysctl_write8(void *opaque, target_phys_addr_t addr, + uint32_t value) +{ + struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque; + int offset = addr - s->base; + int pad_offset, byte_offset; + int prev_value; + + switch (offset) { + case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */ + pad_offset = (offset - 0x30) >> 2; + byte_offset = (offset - 0x30) & (4 - 1); + + prev_value = s->padconf[pad_offset]; + prev_value &= ~(0xff << (byte_offset * 8)); + prev_value |= ((value & 0x1f1f1f1f) << (byte_offset * 8)) & 0x1f1f1f1f; + s->padconf[pad_offset] = prev_value; + break; + + default: + OMAP_BAD_REG(addr); + break; + } +} + static void omap_sysctl_write(void *opaque, target_phys_addr_t addr, uint32_t value) { @@ -3726,14 +3777,14 @@ } static CPUReadMemoryFunc *omap_sysctl_readfn[] = { + omap_sysctl_read8, omap_badwidth_read32, /* TODO */ - omap_badwidth_read32, /* TODO */ omap_sysctl_read, }; static CPUWriteMemoryFunc *omap_sysctl_writefn[] = { + omap_sysctl_write8, omap_badwidth_write32, /* TODO */ - omap_badwidth_write32, /* TODO */ omap_sysctl_write, }; @@ -4139,7 +4190,7 @@ cs = (offset - 0x060) / 0x30; offset -= cs * 0x30; f = s->cs_file + cs; - switch (offset - cs * 0x30) { + switch (offset) { case 0x60: /* GPMC_CONFIG1 */ return f->config[0]; case 0x64: /* GPMC_CONFIG2 */