[U-Boot-Users] U-boot IDE working, what now?

Travis B. Sawyer tsawyer at sandburst.com
Wed Nov 16 20:24:08 CET 2005


> -----Original Message-----
> From: u-boot-users-admin at lists.sourceforge.net 
> [mailto:u-boot-users-admin at lists.sourceforge.net] On Behalf 
> Of Gregg Nemas
> Sent: Wednesday, November 16, 2005 12:45 PM
> To: u-boot-users at lists.sourceforge.net
> Subject: [U-Boot-Users] U-boot IDE working, what now?
> 
> 
> I have a PCP 440GP-based custom CPU board with a Compact 
> Flash connected directly to the 440GP peripheral bus. There 
> is no PCMCIA controller or PCI bus in this setup. The IDE 
> registers simply appear at a fixed physical address I have 
> chosen. This is the so-called "True IDE mode".

You have exactly what we use in our Sandburst Metrobox and Karef boards.

I modeled our linux ide driver after drivers/ide/ppc/cpci405ide.c
(Note the orginal author of cpci405ide.c watches this list ;)



Here's the cruft of it:
/*
 *  Taken from:
 *  linux/drivers/ide/ppc/cpci405ide.c -- CPCI405 IDE Driver
 *
 *  Copyright (C) 2001-2003 Stefan Roese,
stefan.roese at esd-electronics.de
 *
 *  This driver was written based on information obtained from the MacOS
IDE
 *  driver binary by Mikael Forselius
 *
 *  This file is subject to the terms and conditions of the GNU General
Public
 *  License.  See the file COPYING in the main directory of this archive
for
 *  more details.
 */
#include <linux/config.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/init.h>
#include <linux/errno.h>
 
/*
 *  Base of the IDE interface
 */
 
#define SANDBURST_HD_BASE       0x00000001f0000000ULL
 
/*
 *  Offsets from the above base (scaling 4)
 */
 
#define SANDBURST_HD_DATA       0x00
#define SANDBURST_HD_ERROR      0x02            /* see err-bits */
#define SANDBURST_HD_NSECTOR    0x04            /* nr of sectors to
read/write */
#define SANDBURST_HD_SECTOR     0x06            /* starting sector */
#define SANDBURST_HD_LCYL       0x08            /* starting cylinder */
#define SANDBURST_HD_HCYL       0x0a            /* high byte of starting
cyl */
#define SANDBURST_HD_SELECT     0x0c            /* 101dhhhh , d=drive,
hhhh=head */
#define SANDBURST_HD_STATUS     0x0e            /* see status-bits */
#define SANDBURST_HD_CONTROL    0x0010000e      /* control/altstatus */
 
#define SANDBURST_IRQ_IDE         52             /* (UIC1:20, external
irq 9, GPIO 9) */
 
static int metroboxide_offsets[IDE_NR_PORTS] __initdata = {
        SANDBURST_HD_DATA, SANDBURST_HD_ERROR, SANDBURST_HD_NSECTOR,
SANDBURST_HD_SECTOR,
        SANDBURST_HD_LCYL, SANDBURST_HD_HCYL, SANDBURST_HD_SELECT,
SANDBURST_HD_STATUS,
        SANDBURST_HD_CONTROL
};
 
static void *metrobox_ide_base_mapped;
 
 
/*
 *  Probe for a SANDBURST IDE interface
 */
 
void __init sandburstide_init(void)
{
        hw_regs_t hw;
        ide_hwif_t *hwif;
        int index = -1;
        int i;
 
        metrobox_ide_base_mapped =
                ioremap64(SANDBURST_HD_BASE, 0x00100200) - _IO_BASE;
        ide_setup_ports(&hw, (ide_ioreg_t)metrobox_ide_base_mapped,
                        metroboxide_offsets, 0, 0, NULL,
SANDBURST_IRQ_IDE);
        index = ide_register_hw(&hw, &hwif);
        if (index != -1)
                printk("ide%d: Sandburst CF IDE interface\n", index);
 
        /*
         * Only one 'drive'
         */
        for(i = 1; i < MAX_DRIVES; i++) {
                hwif->drives[1].present = 0;
                hwif->drives[1].noprobe = 1;
        }
 
        hwif->drives[0].autodma = 1;
 
}


HTH,

Travis





More information about the U-Boot mailing list