Hi,I am a beginner in kernel porting. I am trying to port Linux kernel (version- 4.9.22) on Custom SoC (cpu = arm1176jzfs based) for custom evaluation Board. I am having ARM Prime cell pl011 UART in my SoC. And it is physically mapped to 0x5800_1000 address. While i am trying to use it as Debug UART, kernel is asking for its virtual Address. How should i configure this option.i.e: -> Kernel low-level debugging functions -> kernel low-level debugging port (Kernel low-level debugging on via ARM Ltd PL01x Primecell UART) (0x58001000) Physical base address of debug UART (??) Virtual base address of debug UART
Thanks,
Vivek T.
Hi Matt,
Thanks! for the quick Response. I have tried with your suggestion, But my boot process gets hung up after "Starting kernel ... Uncompressing Linux... done, booting the kernel."
I have also tried with different boot args like console=ttyS0 etc... still, it's same.I am currently using Raspberry Pi Kernel version 4.9.22, it has progressed a bit after specifying my virtual address as 0xf0201000.I am also facing issues with my virtual address map. The DDR(256MByte) in my Custom Eval. Board is physically mapped from 0xC000_0000 to 0xCFFF_FFFF. And currently my PHYS_OFFSET & PAGE_OFFSET are configured as 0xC000_0000 & 0xC000_0000. when I am trying to initialize my VIC driver (where VIC is physically mapped at 0x4800_0000 in my custom SoC), kernel booting fails by showing up the following log:
[ 0.000000] Unable to handle kernel paging request at virtual address 48000fe0[ 0.000000] pgd = c0004000[ 0.000000] [48000fe0] *pgd=00000000[ 0.000000] Internal error: Oops: 5 [#1] ARM[ 0.000000] Modules linked in:[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.9.22+ #69
........Any suggestions on this issue?
Vivek
Well, "done, booting the kernel" is what you should see from the DEBUG_LL stuff, so it's working. For RPi, depending on which board you use, the serial port is either ttyS0 (for the mini uart) or ttyAMA0 (for the PL011). The 32-bit boards use ttyAMA0 for the UART and the 64-bit boards use ttyS0 (ttyAMA0 is connected to the Bluetooth controller). If it's hung up why do you think it's the virtual address of the serial port that's the problem?
As for your VIC problem you're getting a translation fault at 0x48000fe0 - if the VIC is at 0x48000000 physical then your virtual address is not going to be the same thing. PHYS_OFFSET and PAGE_OFFSET are irrelevant to you, they're just where the kernel virtual address space starts.
You need to ioremap() (or devm_ioremap()) your VIC address and get a virtual address for it, before you access that location. You can't just use a physical address in a register with the MMU turned on unless it's flat-mapped, and in Linux it most certainly is not.
You might want to look at other similar drivers in the Linux source tree and how they map in physical addresses to virtual address spaces.
Ta,
Matt
VIC translation fault got resolved. From your suggestion I have gone through other drivers in the kernel, I have incorporated a small piece of code using ioremap() to obtain a virtual address. Looks like now the VIC is initialized and I am able to see the Peripheral ID while booting. Below is the code I have incorporated into my IRQ init function
{void __iomem *vic_base; Int i =0; for(i = 0; i<2; i++) { if (!request_mem_region(bbsoc_vic[i].start, VIC_SIZE, "Vic")) { pr_err("Vic_%d Request mem region failed.\n", i); return –1; } vic_base = ioremap(bbsoc_vic[i].start, VIC_SIZE); if(!vic_base) { pr_err("VIC_%d : ioremap failed...\n\r", i); release_mem_region(bbsoc_vic[i].start, VIC_SIZE); return –1; } If (I == 0) vic_init(vic_base, 0, BBSOC_VIC0_IRQ_MASK, 0); If(I == 1) vic_init(vic_base, 32, BBSOC_VIC0_IRQ_MASK, 0);}
With this, my issue got resolved. and I am unsure about the uart virtual address, Parallelly I need to work on other issues too. Will get back to you once I found anything. Thanks for helping me, Matt.