linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* true ide
@ 2005-02-09 16:10 Marco Schramel
  2005-02-09 17:11 ` Eugene Surovegin
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Schramel @ 2005-02-09 16:10 UTC (permalink / raw)
  To: Linuxppc-embedded

Hi,

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 ??

Thanks in advance
Marco


-- 
---------
Marco Schramel
R&D
Bartec GmbH
Schulstr. 30
94239 Gotteszell, Germany
www.bartec.de
Marco.Schramel@go.bartec.de
Phone:  +49 (0)9929/301332
Fax:    +49 (0)9929/301112

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: true ide
  2005-02-09 16:10 true ide Marco Schramel
@ 2005-02-09 17:11 ` Eugene Surovegin
  0 siblings, 0 replies; 2+ messages in thread
From: Eugene Surovegin @ 2005-02-09 17:11 UTC (permalink / raw)
  To: Marco Schramel; +Cc: Linuxppc-embedded

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-09 17:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-09 16:10 true ide Marco Schramel
2005-02-09 17:11 ` Eugene Surovegin

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).