linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Surovegin <ebs@ebshome.net>
To: Marco Schramel <Schramel.Linux@go.bartec.de>
Cc: Linuxppc-embedded@ozlabs.org
Subject: Re: true ide
Date: Wed, 9 Feb 2005 09:11:49 -0800	[thread overview]
Message-ID: <20050209171149.GA10316@gate.ebshome.net> (raw)
In-Reply-To: <200502091710.25227.Schramel.Linux@go.bartec.de>

On Wed, Feb 09, 2005 at 05:10:25PM +0100, Marco Schramel wrote:
> on my custom board i can access my compact flash card through true ide interface. My UPM's work und the taskfile is ready to use.
> How i tell my kernel (denx 2.4.25) to use my taskfile for ide access?
> How can i register the compact flash as hard drive in linux ??

Here is an example code for CF attached to the external bus on PPC4xx:

---------------------------------------------------------------------
static void cf_ide_insw(unsigned long port, void *addr, u32 count){
    _insw((volatile u16*)port, addr, count);
}

static void cf_ide_outsw(unsigned long port, void *addr, u32 count){
    _outsw((volatile u16*)port, addr, count);
}

void __init cf_ide_probe(void){

	/* Find an empty slot */
	while (idx < MAX_HWIFS && ide_hwifs[idx].io_ports[IDE_DATA_OFFSET])
		++idx;

	if (idx == MAX_HWIFS){
		printk(KERN_ERR"Cannot find empty IDE hwif slot\n");
                return;
        }

	hwif = &ide_hwifs[idx];
        hw = &hwif->hw;
        hw->io_ports[IDE_DATA_OFFSET]    = cf_taskfile_main_kva;
        hw->io_ports[IDE_ERROR_OFFSET]   = cf_taskfile_main_kva + 3;
        hw->io_ports[IDE_NSECTOR_OFFSET] = cf_taskfile_main_kva + 5;
        hw->io_ports[IDE_SECTOR_OFFSET]  = cf_taskfile_main_kva + 7;
        hw->io_ports[IDE_LCYL_OFFSET]    = cf_taskfile_main_kva + 9;
        hw->io_ports[IDE_HCYL_OFFSET]    = cf_taskfile_main_kva + 0xb;
        hw->io_ports[IDE_SELECT_OFFSET]  = cf_taskfile_main_kva + 0xd;
        hw->io_ports[IDE_STATUS_OFFSET]  = cf_taskfile_main_kva + 0xf;
        hw->io_ports[IDE_CONTROL_OFFSET] = cf_taskfile_alt_kva + 0xd;
        memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
        hwif->irq = hw->irq = CF_IRQ;
        hwif->noprobe = 0;

        /* Don't probe second drive */
        hwif->drives[1].noprobe = 1;

        default_hwif_mmiops(hwif);

        /* Override 16-bit string ops to do byte-swapping */
        hwif->OUTSW = cf_ide_outsw;
        hwif->INSW = cf_ide_insw;
}
-------------------------------------------------------------------

Some comments: cf_task_main_kva - ioremmaped main taskfile (main chip 
select), cf_task_file_atl_kva - ioremapped alternative taskfile 
(second chip select). In my case board support code sets up those. 
CF_IRQ - interrupt request from CF.

Also, note that actual offset for each taskfile register depends on 
how you wired CF to the CPU, it may be different in your case, so use 
this code as an _example_.

I call cf_ide_probe() from drivers/ide/ide.c::probe_for_hwifs.

--
Eugene

      reply	other threads:[~2005-02-09 17:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-09 16:10 true ide Marco Schramel
2005-02-09 17:11 ` Eugene Surovegin [this message]

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=20050209171149.GA10316@gate.ebshome.net \
    --to=ebs@ebshome.net \
    --cc=Linuxppc-embedded@ozlabs.org \
    --cc=Schramel.Linux@go.bartec.de \
    /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;
as well as URLs for NNTP newsgroup(s).