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".
I have gotten the u-boot IDE/ATA code working with this setup. I can see the partitions and I list files using ext2ls. I was able to boot a linux kernel using both the diskboot method and the loadext2 method. This is all working great.
Now I need to make linux aware of this device so it can mount its root file system from it, and I am not sure where to start.
I have looked at both
http://www.denx.de/wiki/view/DULG/
ConfigureLinuxForPCMCIACardsWithoutTheCardServicesPackage
and
http://www.denx.de/wiki/view/DULG/KernelConfigurationForPCMCIA
but I am not sure if these apply to my setup. Building the first one results in an undefined symbol IMAP_ADDR, which I see is the address of an IMMR register which the 440GP does not have. I have not tried the second one, but it looks like it requires a PCMCIA controller, and the ability to enumerate devices using a configuration space type of mechanism, which is not present on my board.
Can anyone offer some guidance?
Thanks.
Gregg
Quoted 10 lines
-----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?
Quoted 5 lines
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
Quoted 6 lines · Travis B. Sawyer <tsawyer <at> sandburst.com> writes:
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 ofcpci405ide.cwatches this list ;)Here's the cruft of it:
Thanks! I tried to modify it to work on my system, but I am not having much luck. A few questions:
1. To add the code, I just added the line
ide-core-y += ppc/mycf.o
where "ppc/mycf.c" is the name of the new driver file. Is this the only thing I need to do to include the driver in the kernel?
2. Where should I place a call to sandburstide_init()? I tried inserting it at the end of ibm4xx_platform_init (in file ibm44x_common.c), but this causes the system to hang before even generating any console output.
3. You have the register offsets at 0, 2, 4, etc. To get the interface to work with u-boot, I had to set the offsets to 0, 3, 5, etc. so that the 8-bit registers would be in the correct byte lane. Should I expect the same thing here?
4. Is it possible for this to work without using the CF interrupt? The current hardware design misrouted this signal, so I can't use it.
5. The comment at the top of the code you supplied says "scaling 4", but the register offsets would imply scaling of 2. Is there something I am misunderstanding here?
6. You mentioned that you modeled your ide driver after drivers / ide / ppc / cpci405ide.c, but I don't seem to have this file. I am working with kernel version 2.6.12.3. Was this added later?
Thanks a lot.
Gregg
Quoted 4 lines · In message <[email protected]> you wrote:
1. To add the code, I just added the line
ide-core-y += ppc/mycf.o
...
Please stop discussing Linux porting questions on this list. This is off topic here.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If the hours are long enough and the pay is short enough, someone will say it's women's work.
Quoted 2 lines · Wolfgang Denk <wd <at> denx.de> writes:
Please stop discussing Linux porting questions on this list. This is off topic here.
Could you suggest an alternative, prefreably oriented towards embedded linux?
Thanks.
Gregg
Quoted 2 lines · In message <[email protected]> you wrote:
Could you suggest an alternative, prefreably oriented towards embedded linux?
Depending on your target architecture:
linuxppc-dev at ozlabs.org,
linux-mips at linux-mips.org,
linux-arm-kernel at lists.arm.linux.org.uk,
...
Best regards,
Wolfgang Denk
Signature · 3 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Work 8 hours, sleep 8 hours; but not the same 8 hours.