LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Garcia Jérémie" <GARCIAJ@3il.fr>
To: <linuxppc-dev@ozlabs.org>
Subject: when to do ioremap?
Date: Tue, 29 Mar 2005 17:10:42 +0200	[thread overview]
Message-ID: <D4FDDD1349B5AC46B68FC26AD8AF42D6226B16@exnet.3il.fr> (raw)

Ladies and Gentlemen,

Even if I am a Linux kernel newbie, I'm in charge of adapting a =
Montavista LSP (designed for the IBM 405EP evaluation board) to our =
propietary hardware which uses a 405EP too.
So, I created both files /arch/ppc/platforms/myBoard.c and myBoard.h =
first copying the LSP files and then modifying them.=20
However, you guess that our mapping is very different from the one used =
by the IBM eval board. The fact is that I'm not at all familiar with =
memory management (I'm a part time student/worker) and I try to =
understand the board_setup_arch function provided by the LSP (cf. =
below). I understand that the ioremap allows us to build new page tables =
mapping physical addresses on a range of contiguous (linear) virtual =
addresses. But why are we doing that at that early boot time and not in =
a driver at a wanted time? In the IBM eval board case, only 2 fpga =
registers are used but on my board, we are using up to 4K for our I/O =
space (segmented in 4 different part -> ex: =
engineer_purpose_regs,appli_regs, asic_regs,..). Then we have a software =
that must play with those registers from the user-space.
So could you explain me the original file to help me coding the new one. =
I definitely don't understand what are the consequences of that (the =
function return is void,nothing is done with the returns of ioremap =
calls except test). Does it allow us to do something later? Couldn't we =
do all of that in a driver or is there a serious reason to do it here?

void __init
board_setup_arch(void)
{
#define EVB405EP_FPGA_BASE      0xF0300000

        void *fpga_reg0;
        void *fpga_reg1;

        evb405ep_early_serial_map();
        fpga_reg0 =3D ioremap(EVB405EP_FPGA_BASE, 8);
        if (!fpga_reg0) {
                printk(KERN_CRIT
                       "evb405ep_setup_arch() fpga_reg0 ioremap =
failed\n");
                return;
        }

        fpga_reg1 =3D fpga_reg0 + 1;
}

Hoping that the question is not too stupid : tks a lot everyone for =
helping a student lost in the linux kernel sources... :-)=20

                 reply	other threads:[~2005-03-29 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D4FDDD1349B5AC46B68FC26AD8AF42D6226B16@exnet.3il.fr \
    --to=garciaj@3il.fr \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox