Commit 4b3b8ee5 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] ARM/ARM26 IDE cleanups

- clear hwif->hw in setup-pci.c before using it

- fix arch/arm/Kconfig to allow IDE only on platforms supporting it

- introduce IDE_ARCH_OBSOLETE_INIT and ide_default_io_ctl() so
  we can use generic ide_init_hwif_ports() and kill no longer needed
  <asm-arm/arch-*/ide.h> (leave broken lh7a40x and sa1100 versions)

Cross-compile tested on ARM.
parent 20ebd12c
......@@ -609,7 +609,9 @@ source "drivers/acorn/block/Kconfig"
source "net/Kconfig"
if ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX || ARCH_L7200 || ARCH_LH7A40X || ARCH_FTVPCI || ARCH_PXA || ARCH_RPC || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE
source "drivers/ide/Kconfig"
endif
source "drivers/scsi/Kconfig"
......
......@@ -315,13 +315,6 @@ static void __init init_ide_data (void)
#endif
}
/* OBSOLETE: still needed on arm26 and arm */
#ifdef CONFIG_ARM
/* Add default hw interfaces */
initializing = 1;
ide_init_default_hwifs();
initializing = 0;
#endif
#ifdef CONFIG_IDE_ARM
ide_arm_init();
#endif
......
......@@ -444,13 +444,12 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
}
if ((hwif = ide_match_hwif(base, d->bootable, d->name)) == NULL)
return NULL; /* no room in ide_hwifs[] */
if (hwif->io_ports[IDE_DATA_OFFSET] != base) {
fixup_address:
if (hwif->io_ports[IDE_DATA_OFFSET] != base ||
hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
memset(&hwif->hw, 0, sizeof(hwif->hw));
ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL);
memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
} else if (hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
goto fixup_address;
}
hwif->chipset = ide_pci;
hwif->pci_dev = dev;
......
......@@ -43,6 +43,9 @@ static inline unsigned long ide_default_io_base(int index)
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_PCI
#define ide_init_default_irq(base) (0)
#else
......
/*
* linux/include/asm-arm/arch-cl7500/ide.h
*
* Copyright (c) 1997 Russell King
*
* Modifications:
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
if (ctrl_port) {
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
} else {
hw->io_ports[IDE_CONTROL_OFFSET] = data_port + 0x206;
}
if (irq != NULL)
*irq = 0;
hw->io_ports[IDE_IRQ_OFFSET] = 0;
}
static inline void ide_init_default_hwifs(void) { ; }
/*
* linux/include/asm-arm/arch-ebsa285/ide.h
*
* Copyright (C) 1998 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Modifications:
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
#include <asm/irq.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
/*
* This registers the standard ports for this architecture with the IDE
* driver.
*/
static __inline__ void ide_init_default_hwifs(void)
{
#if 0
hw_regs_t hw;
memset(hw, 0, sizeof(*hw));
ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
hw.irq = IRQ_HARDDISK;
ide_register_hw(&hw);
#endif
}
/*
* include/asm-arm/arch-iop3xx/ide.h
*
* Generic IDE functions for IOP310 systems
*
* Author: Deepak Saxena <dsaxena@mvista.com>
*
* Copyright 2001 MontaVista Software Inc.
*
* 09/26/2001 - Sharon Baartmans
* Fixed so it actually works.
*/
#ifndef _ASM_ARCH_IDE_H_
#define _ASM_ARCH_IDE_H_
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
int regincr = 1;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += regincr;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq) *irq = 0;
}
/*
* This registers the standard ports for this architecture with the IDE
* driver.
*/
static __inline__ void ide_init_default_hwifs(void)
{
/* There are no standard ports */
}
#endif
/*
* linux/include/asm-arm/arch-ixp4xx/ide.h
*
* Copyright (C) 2003-2004 MontaVista Software, Inc.
* Based on original code Copyright (c) 1998 Russell King
*/
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static __inline__ void
ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
{
unsigned long reg = (unsigned long) data_port;
int i;
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long) ctrl_port;
if (irq)
*irq = 0;
}
/*
* This registers the standard ports for this architecture with the IDE
* driver.
*/
static __inline__ void ide_init_default_hwifs(void)
{
/* There are no standard ports */
}
/*
* linux/include/asm-arm/arch-l7200/ide.h
*
* Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
*
* Changelog:
* 03-29-2000 SJH Created file placeholder
*/
#include <asm/irq.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
}
/*
* This registers the standard ports for this architecture with the IDE
* driver.
*/
static __inline__ void
ide_init_default_hwifs(void)
{
}
......@@ -64,13 +64,6 @@ static __inline__ void ide_init_default_hwifs (void)
ide_register_hw (&hw, &hwif);
lpd7a40x_hwif_ioops (hwif); /* Override IO routines */
}
#else
static __inline__ void ide_init_hwif_ports (hw_regs_t *hw, int data_port,
int ctrl_port, int *irq) {}
static __inline__ void ide_init_default_hwifs (void) {}
#endif
#endif
/*
* linux/include/asm-arm/arch-nexuspci/ide.h
*
* Copyright (c) 1998 Russell King
*
* Modifications:
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
#include <asm/irq.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
/*
* This registers the standard ports for this architecture with the IDE
* driver.
*/
static __inline__ void ide_init_default_hwifs(void)
{
/* There are no standard ports */
}
/*
* linux/include/asm-arm/arch-pxa/ide.h
*
* Author: George Davis
* Created: Jan 10, 2002
* Copyright: MontaVista Software Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*
* Originally based upon linux/include/asm-arm/arch-sa1100/ide.h
*
*/
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
int regincr = 1;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += regincr;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
/*
* Register the standard ports for this architecture with the IDE driver.
*/
static __inline__ void
ide_init_default_hwifs(void)
{
/* Nothing to declare... */
}
/*
* linux/include/asm-arm/arch-rpc/ide.h
*
* Copyright (C) 1997 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Modifications:
* 29-07-1998 RMK Major re-work of IDE architecture specific code
*/
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
static inline void ide_init_default_hwifs(void) { ; }
/* linux/include/asm-arm/arch-s3c2410/ide.h
*
* Copyright (C) 1997 Russell King
* Copyright (C) 2003 Simtec Electronics
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Modifications:
* 29-07-1998 RMK Major re-work of IDE architecture specific code
* 16-05-2003 BJD Changed to work with BAST IDE ports
* 04-09-2003 BJD Modifications for V2.6
*/
#ifndef __ASM_ARCH_IDE_H
#define __ASM_ARCH_IDE_H
#include <asm/irq.h>
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
/* we initialise our ide devices from the main ide core, due to problems
* with doing it in this function
*/
#define ide_init_default_hwifs() do { } while(0)
#endif /* __ASM_ARCH_IDE_H */
/*
* linux/include/asm-arm/arch-shark/ide.h
*
* by Alexander Schulz
*
* derived from:
* linux/include/asm-arm/arch-ebsa285/ide.h
* Copyright (c) 1998 Russell King
*/
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
memset(hw, 0, sizeof(*hw));
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
static inline void ide_init_default_hwifs(void) { ; }
/*
* linux/include/asm-arm/arch-tbox/ide.h
*/
......@@ -17,7 +17,9 @@
#define MAX_HWIFS 4
#endif
#include <asm/arch/ide.h>
#if defined(CONFIG_ARCH_LH7A40X) || defined(CONFIG_ARCH_SA1100)
# include <asm/arch/ide.h> /* obsolete + broken */
#endif
/*
* We always use the new IDE port registering,
......@@ -26,6 +28,15 @@
#define ide_default_io_base(i) (0)
#define ide_default_irq(b) (0)
#if !defined(CONFIG_ARCH_L7200) && !defined(CONFIG_ARCH_LH7A40X)
# define IDE_ARCH_OBSOLETE_INIT
# ifdef CONFIG_ARCH_CLPS7500
# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
# else
# define ide_default_io_ctl(base) (0)
# endif
#endif /* !ARCH_L7200 && !ARCH_LH7A40X */
#define ide_init_default_irq(base) (0)
#define __ide_mm_insw(port,addr,len) readsw(port,addr,len)
......
......@@ -26,29 +26,8 @@
#define __ide_mm_outsw(port,addr,len) writesw(port,addr,len)
#define __ide_mm_outsl(port,addr,len) writesl(port,addr,len)
/*
* Set up a hw structure for a specified data port, control port and IRQ.
* This should follow whatever the default interface uses.
*/
static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{
unsigned long reg = data_port;
int i;
for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hw->io_ports[i] = reg;
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
if (irq)
*irq = 0;
}
#define ide_init_default_irq(base) (0)
static inline void ide_init_default_hwifs(void) { ; }
/*
* We always use the new IDE port registering,
* so these are fixed here.
......@@ -56,6 +35,9 @@ static inline void ide_init_default_hwifs(void) { ; }
#define ide_default_io_base(i) (0)
#define ide_default_irq(b) (0)
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#endif /* __KERNEL__ */
#endif /* __ASMARM_IDE_H */
......@@ -85,6 +85,9 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_por
}
#endif
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_BLK_DEV_IDEPCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -53,6 +53,9 @@ static inline unsigned long ide_default_io_base(int index)
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_PCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -48,6 +48,9 @@ static inline unsigned long ide_default_io_base(int index)
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_BLK_DEV_IDEPCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -22,6 +22,9 @@
#define ide_default_irq(base) (0)
#define ide_default_io_base(index) (0)
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#define ide_init_default_irq(base) (0)
#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
......
......@@ -57,6 +57,9 @@ static __inline__ unsigned long ide_default_io_base(int index)
return 0;
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_PCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -25,6 +25,9 @@
static inline int ide_default_irq(unsigned long base) { return 0; }
static inline unsigned long ide_default_io_base(int index) { return 0; }
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#define ide_init_default_irq(base) (0)
#endif /* __KERNEL__ */
......
......@@ -72,6 +72,9 @@ static inline unsigned long ide_default_io_base(int index)
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_PCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -29,6 +29,9 @@ static __inline__ unsigned long ide_default_io_base(int index)
return 0;
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#define ide_init_default_irq(base) (0)
#define __ide_insl(data_reg, buffer, wcount) \
......
......@@ -34,6 +34,9 @@ static __inline__ unsigned long ide_default_io_base(int index)
return 0;
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#define ide_init_default_irq(base) (0)
#define __ide_insl(data_reg, buffer, wcount) \
......
......@@ -51,6 +51,9 @@ static __inline__ unsigned long ide_default_io_base(int index)
}
}
#define IDE_ARCH_OBSOLETE_INIT
#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
#ifdef CONFIG_BLK_DEV_IDEPCI
#define ide_init_default_irq(base) (0)
#else
......
......@@ -307,18 +307,20 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
/*
* ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series.
* New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>.
*
* arm26, arm, h8300, m68k, m68knommu (broken) and i386-pc9800 (broken)
* h8300, m68k, m68knommu (broken) and i386-pc9800 (broken)
* still have their own versions.
*/
#if !defined(CONFIG_ARM) && !defined(CONFIG_H8300) && !defined(CONFIG_M68K)
#if !defined(CONFIG_H8300) && !defined(CONFIG_M68K)
#ifdef IDE_ARCH_OBSOLETE_INIT
static inline void ide_init_hwif_ports(hw_regs_t *hw,
unsigned long io_addr,
unsigned long ctl_addr,
int *irq)
{
if (!ctl_addr)
ide_std_init_ports(hw, io_addr, io_addr + 0x206);
ide_std_init_ports(hw, io_addr, ide_default_io_ctl(io_addr));
else
ide_std_init_ports(hw, io_addr, ctl_addr);
......@@ -332,7 +334,10 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
ppc_ide_md.ide_init_hwif(hw, io_addr, ctl_addr, irq);
#endif
}
#endif /* !ARM && !H8300 && !M68K */
#else
# define ide_init_hwif_ports(hw, io, ctl, irq) do {} while (0)
#endif /* IDE_ARCH_OBSOLETE_INIT */
#endif /* !H8300 && !M68K */
/* Currently only m68k, apus and m8xx need it */
#ifndef IDE_ARCH_ACK_INTR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment