* Tell IDE layer to not manage resources by setting hwif->mmio flag.
* Use {request,release}_region() for resources management.
* Set ->name field of 'struct ide_port_info' instances in legacy VLB
host drivers and use driver name for resources management.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move the common code for primary/seconary port setup from
ide_legacy_device_add() to ide_legacy_init_one().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Tell IDE layer to not manage resources by setting hwif->mmio flag.
* Use {request,release}_region() for resources management.
* Use driver name for resources management.
* Remove no longer needed 'hwif->chipset == ide_4drives' handling
from ide_device_add_all().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add 'unsigned long config' argument to ide_legacy_device_add()
for setting hwif->config_data.
* Use ide_find_port_slot() instead of ide_find_port() in
ide_legacy_device_add().
* Handle IDE_HFLAG_QD_2ND_PORT and IDE_HFLAG_SINGLE host flags in
ide_legacy_device_add().
* Convert qd65xx host driver to use ide_legacy_device_add().
v2:
* Update ali14xx, dtc2278, ht6560b and umc8672 host drivers.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add ide_legacy_device_add() helper for use by legacy VLB host drivers
(+ convert them to use it).
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Update IDE PMAC host driver to use drive->noprobe instead of hwif->noprobe
and remove hwif->noprobe completely (it is always set to zero now).
There should be no functional changes caused by this patch.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Move hooks for port/host specific methods from ide_hwif_t to
'struct ide_port_ops'.
* Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info'
and ide_hwif_t.
* Update host drivers and core code accordingly.
While at it:
* Rename ata66_*() cable detect functions to *_cable_detect() to match
the standard naming. (Suggested by Sergei Shtylyov)
v2:
* Fix build for bast-ide. (Noticed by Andrew Morton)
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_HFLAG_QD_2ND_PORT host flag to indicate the need of skipping
first ide_hwifs[] slot for the second port of QD65xx controller.
* Handle this new host flag in ide_find_port_slot().
* Convert legacy VLB host drivers to use ide_find_port().
While at it:
* Fix couple of printk()-s in qd65xx host driver to not use hwif->name.
v2:
* Fix qd65xx.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Change ide_match_hwif() argument from 'u8 bootable' to
'struct ide_port_info *d'.
* Move ide_match_hwif() to ide-probe.c from setup-pci.c and rename
it to ide_find_port_slot(). Update some comments while at it.
* ide_find_port() can be now just a wrapper for ide_find_port_slot().
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS to drivers/ide/Kconfig and use
it instead of defining IDE_ARCH_OBSOLETE_DEFAULTS in <arch/ide.h>.
v2:
* Define ide_default_irq() in ide-probe.c/ns87415.c if not already defined
and drop defining ide_default_irq() for CONFIG_IDE_ARCH_OBSOLETE_DEFAULTS=n.
[ Thanks to Stephen Rothwell and David Miller for noticing the problem. ]
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add IDE_{ALTSTATUS,IREASON,BCOUNTL,BCOUNTH}_OFFSET defines.
* Remove IDE_*_REG macros - this results in more readable
and slightly smaller code.
There should be no functional changes caused by this patch.
Cc: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
request_irq() will fail if there is already another IRQ handler
registered and IRQ flags are mismatched.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add 'struct class ide_port_class' ('ide_port' class) and a 'struct
device *portdev' ('ide_port' class device) in ide_hwif_t.
* Register 'ide_port' class in ide_init() and unregister it in
cleanup_module().
* Create ->portdev in ide_register_port () and unregister it in
ide_unregister().
* Add "delete_devices" class device attribute for unregistering IDE devices
on a port and "scan" one for probing+registering IDE devices on a port.
* Add ide_sysfs_register_port() helper for registering "delete_devices"
and "scan" attributes with ->portdev. Call it in ide_device_add_all().
* Document IDE warm-plug support in Documentation/ide/warm-plug-howto.txt.
v2:
* Convert patch from using 'struct class_device' to use 'struct device'.
(thanks to Kay Sievers for doing it)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Rework PowerMac media-bay support in such way that instead of
un/registering the IDE interface we un/register IDE devices:
* Add ide_port_scan() helper for probing+registerering devices on a port.
* Rename ide_port_unregister_devices() to __ide_port_unregister_devices().
* Add ide_port_unregister_devices() helper for unregistering devices on a port.
* Add 'ide_hwif_t *cd_port' to 'struct media_bay_info', pass 'hwif' instead
of hwif->index to media_bay_set_ide_infos() and use it to setup 'cd_port'.
* Use ide_port_unregister_devices() instead of ide_unregister()
and ide_port_scan() instead of ide_register_hw() in media_bay_step().
* Unexport ide_register_hw() and make it static.
v2:
* Fix build by adding <linux/ide.h> include to <asm-powerpc/mediabay.h>.
(Reported by Michael/Kamalesh/Andrew).
Cc: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Add ide_cfg_mtx lock/unlock to ide_port_setup_devices() and then move
ide_port_setup_devices() call from init_irq() to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
IDE devices need to be removed from /proc/ide/ _before_ being unregistered:
* Drop 'ide_hwif_t *hwif' argument from destroy_proc_ide_device()
and use drive->hwif instead.
* Rename destroy_proc_ide_device() to ide_proc_unregister_device().
* Call ide_proc_unregister_device() in drive_release_dev().
* Remove no longer needed destroy_proc_ide_drives().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out cable detection from ide_init_port() to ide_port_cable_detect().
* Move ide_port_cable_detect() call to ide_device_add_all().
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This reverts commit b140b99c41.
[ conflict in drivers/ide/ide-probe.c fixed manually ]
It turned out that probing order change causes problems for some drives:
http://bugzilla.kernel.org/show_bug.cgi?id=10239
Since root causes are still being investigated and are unlikely to be fixed
before 2.6.25 lets revert this change for now. As a result cable detection
becomes less reliable when compared with 2.6.24 but the affected drives are
useable again.
Reported-by: Richard Genoud <richard.genoud@gmail.com>
Bisected-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Skip probing port if "hdx=noprobe" parameter was used for both devices on it.
* Obsolete "idex=noprobe" parameter - it only works for ide_generic, cmd640
and PCI hosts in Compatibility mode (on alpha/x86/ia64/m32r/mips/ppc32).
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
After the APUS removal, some code can be removed.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Karsten Keil <kkeil@suse.de>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Cache value read from the Status register in 'stat' variable in do_probe()
and enable_nest(), then remove remove needless Status register reads.
While at it:
* Add proper KERN_* levels to printk() calls.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Un-static create_proc_ide_drives() and call it from ide_device_add_all().
While at it:
* Rename create_proc_ide_drives() to ide_proc_port_register_devices().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move hwif->present check out from ide_proc_register_port() to
ide_device_add_all().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out devices setup from ide_acpi_init() to
ide_acpi_port_init_devices().
* Call ide_acpi_port_init_devices() in ide_device_add_all().
While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out devices setup from init_irq() to ide_port_setup_devices().
While at it:
* Do devices setup after printing port information.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move hwif->rqsize init from ide_init_queue() to init_irq().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Move blk_register_region() call out from init_gendisk() to hwif_init().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
No need to initialize drive->gendev and waste memory on IDE settings
for not present devices.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add ->port_init_devs method to ide_hwif_t for a host specific
initialization of devices on a port. Call the new method from
ide_port_init_devices().
* Convert ht6560b, qd65xx and opti621 host drivers to use the new
->port_init_devs method.
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Use the same bit for IDE_HFLAG_CS5520 and IDE_HFLAG_VDMA host flags
(both are used only by cs5520 host driver currently).
* Add IDE_HFLAG_NO_IO32_BIT host flag and use it instead of ->no_io_32bit
ide_hwif_t field.
* Add IDE_HFLAG_NO_UNMASK_IRQS host flag, then convert dtc2278 and rz1000
host drivers to use it.
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out code initializing devices from ide_init_port() to
ide_port_init_devices().
* Call the new function from ide_device_add_all().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add ->cable_detect method to ide_hwif_t.
* Call the new method in ide_init_port() if:
- the host supports UDMA modes > UDMA2 ('hwif->ultra_mask & 78')
- DMA initialization was successful (if hwif->dma_base is not set
ide_init_port() sets hwif->ultra_mask to zero)
- "idex=ata66" is not used ('hwif->cbl != ATA_CBL_PATA40_SHORT')
* Convert PCI host drivers to use ->cable_detect method.
While at it:
* Factor out cable detection to separate functions (if not already done).
* hpt366.c/it8213.c/slc90e66.c:
- don't check cable type if "idex=ata66" is used
* pdc202xx_new.c:
- add __devinit tag to pdcnew_cable_detect()
* pdc202xx_old.c:
- rename pdc202xx_old_cable_detect() to pdc2026x_old_cable_detect()
- add __devinit tag to pdc2026x_old_cable_detect()
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma().
* Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version.
* Add 'const struct ide_port_info *d' argument to ide_device_add[_all]().
* Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(),
move it to ide-probe.c and call it in in ide_device_add_all() instead of
ide_pci_setup_ports().
* Move ->mate setup to ide_device_add_all() from ide_port_init().
* Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable
->autotune currently.
* Setup hwif->chipset in ide_init_port() but iff pi->chipset is set
(to not override setup done by ide_hwif_configure()).
* Add ETRAX host handling to ide_device_add_all().
* cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n.
* pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks
setup to pmac_ide_setup_device().
* Add 'struct ide_port_info' instances to legacy host drivers, pass them to
ide_device_add() calls and then remove open-coded ports initialization.
Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Add BUG_ON(hwif->present) at the start of ide_probe_port().
* Move hwif_register() call (along with setting hwif->present) from
ide_probe_port() to ide_device_add_all().
As a result the port will be registered with the device tree _after_:
- probing both devices (if both are present)
- port reset (if hwif->reset is set)
- restoring local IRQs state and re-enabling port IRQ
While at it:
* Rename hwif_register() to ide_register_port().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* Factor out code for tuning devices from ide_probe_port()
to ide_port_tune_devices().
* Move ide_port_tune_devices() call from ide_probe_port()
to ide_device_add_all().
There should be no functionality changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Make probe_hwif() return an error value.
While at it:
* Remove comment about MAX_DRIVES == 2 limitation (it is not special to
probe_hwif(), it is a general assumption taken by a lot of IDE code).
* Rename probe_hwif() to ide_probe_port().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
* BUG_ON() early if 'hwif->next == hwif' and there is a 'match' hwgroup.
* Remove printk() for impossible condition and add a BUG_ON(hwgroup->drive)
to match code in ide_unregister().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Since kmalloc_node() is called with __GFP_ZERO flag there is no need to
explicitly zero hwgroup fields.
While at it:
* Use 'hwif' instead of 'hwif->drives[0].hwif' for kmalloc_node() call.
* Fix whitespace damage.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>