From: linux@arm.linux.org.uk (Russell King - ARM Linux) Date: Thu, 29 Oct 2009 15:16:06 +0000 Subject: marvell kirkwood / openrd-base kernel freeze on bootup with PICe->PCI bridge In-Reply-To: <200910291611.02766.dk-arm-linux@gmx.de> References: <200910290936.40397.dk-arm-linux@gmx.de> <200910291157.45910.dk-arm-linux@gmx.de> <309002C0DA137042828828FC53D7A9347E13F1EA87@IL-MB01.marvell.com> <200910291611.02766.dk-arm-linux@gmx.de> Message-ID: <20091029151606.GA11460@n2100.arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Oct 29, 2009 at 05:11:02PM +0200, Dieter Kiermaier wrote: > Am Donnerstag 29 Oktober 2009 12:33:03 schrieb Ronen Shitrit: > > Sorry I don't have experience with the OpenOCD. > > Any way by using the printk hack, u can simply read the register and print it... > > I fear I need any further help: > > I've tried to read the register you told me but now I get an oops: > <1>Unable to handle kernel paging request at virtual address 40020100 > <1>pgd = c0004000 > <1>[40020100] *pgd=00000000 > <0>Internal error: Oops: 5 [#1] PREEMP > > My code to read the register is: > #include > printk("register 0x20100: %x\n", readl(virt_to_phys(0x20100))) > > also a > printk("register 0x20100: %x\n", readl(0x20100)); > fail with an Ooops :( > > What am I doing wrong here? 1. virt_to_phys() is only valid for the kernel memory region in the virtual address space. 0x20100 is not within such a region. 2. readl() takes an offsettable cookie representing the location you want to access. (you get this cookie via ioremap of a bus address or via a platform defined constant.) Practially (for most existing implementations but not all) it is a virtual address. Assuming 0x20100 is the physical address of the register, you should be able to read it like this: void __iomem *base = ioremap(0x20100, 4); if (base) printk("register 0x20100: %x\n", readl(base)); iounmap(base);