summaryrefslogtreecommitdiff
path: root/drivers/ata/pata_via.c
AgeCommit message (Collapse)Author
2014-05-09ata: use CONFIG_PM_SLEEP instead of CONFIG_PM where applicable in host driversBartlomiej Zolnierkiewicz
This patch fixes host drivers to use CONFIG_PM_SLEEP instead of CONFIG_PM where applicable. Benefits of this change: * unused code is not being compiled in for CONFIG_PM=y, CONFIG_PM_SLEEP=n and CONFIG_PM_RUNTIME=y configurations * easier transition to use struct dev_pm_ops and SIMPLE_DEV_PM_OPS() in the future * more consistent code (there are host drivers which are using the correct CONFIG_PM_SLEEP checks already) The patch leaves the core libata code and ->port_[suspend,resume] support in sata_[inic162x,nv,sil24].c alone for now. Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2014-02-13ata: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: linux-ide@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2013-06-02ata: use pci_get_drvdata()Jingoo Han
Use the wrapper function for getting the driver data using pci_dev instead of using dev_get_drvdata() with &pdev->dev, so we can directly pass a struct pci_dev. This is a purely cosmetic change. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2012-07-25ata: use module_pci_driverAxel Lin
This patch converts the drivers in drivers/ata/* to use module_pci_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Alan Cox <alan@linux.intel.com> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Mikael Pettersson <mikpe@it.uu.se> Cc: Mark Lord <kernel@teksavvy.com> Cc: Jeremy Higdon <jeremy@sgi.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-10-14pata_via: add via_fixup()Bartlomiej Zolnierkiewicz
* Fix via_init_one() to enable clock on 66 MHz devices (bug introduced in commit 460f531 "pata_via: store UDMA masks in via_isa_bridges table"). * Factor out common code from via_[re]init_one() to via_fixup(). Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-08-18pata_via: disable ATAPI DMA on AVERATEC 3200Tejun Heo
On AVERATEC 3200, pata_via causes memory corruption with ATAPI DMA, which often leads to random kernel oops. The cause of the problem is not well understood yet and only small subset of machines using the controller seem affected. Blacklist ATAPI DMA on the machine. Signed-off-by: Tejun Heo <tj@kernel.org> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=11426 Reported-and-tested-by: Jim Bray <jimsantelmo@gmail.com> Cc: Alan Cox <alan@linux.intel.com> Cc: stable@kernel.org Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-07-23ata: Add and use ata_print_version_onceJoe Perches
Use a single mechanism to show driver version. Reduces text a tiny bit too. Remove uses of static int printed_version Add and use ata_print_version(const struct device *, const char *ver) and ata_print_version_once. $ size drivers/ata/built-in.* text data bss dec hex filename 544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o 543870 73893 116592 734355 b34ad drivers/ata/built-in.allyesconfig.print_once.o 141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o 141212 14689 4220 160121 27179 drivers/ata/built-in.defconfig.print_once.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-07-23ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>Joe Perches
Saves text by removing nearly duplicated text format strings by creating ata_<foo>_printk functions and printf extension %pV. ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB) Format string duplication comes from: #define ata_link_printk(link, lv, fmt, args...) do { \ if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \ printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ (link)->pmp , ##args); \ else \ printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \ } while(0) Coalesce long formats. $ size drivers/ata/built-in.* text data bss dec hex filename 544969 73893 116584 735446 b38d6 drivers/ata/built-in.allyesconfig.ata.o 558429 73893 117864 750186 b726a drivers/ata/built-in.allyesconfig.dev_level.o 141328 14689 4220 160237 271ed drivers/ata/built-in.defconfig.ata.o 149567 14689 4220 168476 2921c drivers/ata/built-in.defconfig.dev_level.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2010-09-09libata,pata_via: revert ata_wait_idle() removal from ata_sff/via_tf_load()Tejun Heo
Commit 978c0666 (libata: Remove excess delay in the tf_load path) removed ata_wait_idle() from ata_sff_tf_load() and via_tf_load(). This caused obscure detection problems in sata_sil. https://bugzilla.kernel.org/show_bug.cgi?id=16606 The commit was pure performance optimization. Revert it for now. Reported-by: Dieter Plaetinck <dieter@plaetinck.be> Reported-by: Jan Beulich <JBeulich@novell.com> Bisected-by: gianluca <gianluca@sottospazio.it> Cc: stable@kernel.org Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-25libata-sff: separate out BMDMA initTejun Heo
Separate out ata_pci_bmdma_prepare_host() and ata_pci_bmdma_init_one() from their SFF counterparts. SFF ones no longer try to initialize BMDMA or set PCI master. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-19libata-sff: clean up BMDMA initializationTejun Heo
When BMDMA initialization failed or BMDMA was not available for whatever reason, bmdma_addr was left at zero and used as an indication that BMDMA shouldn't be used. This leads to the following problems. p1. For BMDMA drivers which don't use traditional BMDMA register, ata_bmdma_mode_filter() incorrectly inhibits DMA modes. Those drivers either have to inherit from ata_sff_port_ops or clear ->mode_filter explicitly. p2. non-BMDMA drivers call into BMDMA PRD table allocation. It doesn't actually allocate PRD table if bmdma_addr is not initialized but is still confusing. p3. For BMDMA drivers which don't use traditional BMDMA register, some methods might not be invoked as expected (e.g. bmdma_stop from ata_sff_post_internal_cmd()). p4. SFF drivers w/ custom DMA interface implement noop BMDMA ops worrying libata core might call into one of them. These problems are caused by the muddy line between SFF and BMDMA and the assumption that all BMDMA controllers initialize bmdma_addr. This patch fixes p1 and p2 by removing the bmdma_addr assumption and moving prd allocation to BMDMA port start. Later patches will fix the remaining issues. This patch improves BMDMA initialization such that * When BMDMA register initialization fails, falls back to PIO instead of failing. ata_pci_bmdma_init() never fails now. * When ata_pci_bmdma_init() falls back to PIO, it clears ap->mwdma_mask and udma_mask instead of depending on ata_bmdma_mode_filter(). This makes ata_bmdma_mode_filter() unnecessary thus resolving p1. * ata_port_start() which actually is BMDMA specific is moved to ata_bmdma_port_start(). ata_port_start() and ata_sff_port_start() are killed. * ata_sff_port_start32() is moved and renamed to ata_bmdma_port_start32(). Drivers which no longer call into PRD table allocation are... pdc_adma, sata_inic162x, sata_qstor, sata_sx4, pata_cmd640 and all drivers which inherit from ata_sff_port_ops. pata_icside sets ->port_start to ATA_OP_NULL as it doesn't need PRD but is a BMDMA controller and doesn't have custom port_start like other such controllers. Note that with the previous patch which makes all and only BMDMA drivers inherit from ata_bmdma_port_ops, this change doesn't break drivers which need PRD table. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-14libata: Remove excess delay in the tf_load pathAlan Cox
We don't need to stall and wait after loading the task file and before issuing a command, so don't do it. This shows up on profiles and is not needed. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-28pata_via: fix VT6410/6415/6330 detection issueJosephChan@via.com.tw
When using VT6410/6415/6330 chips on some VIA's platforms, the HDD connection to VT6410/6415/6330 cannot be detected. It is because the driver detects wrong via_isa_bridge ID, and then causes this issue to happen. Signed-off-by: Joseph Chan <josephchan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-22pata_via: Add VIA VX900 supportJosephChan@via.com.tw
Signed-off-by: Joseph Chan <josephchan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-01libata: Pass host flags into the pci helperAlan Cox
This allows parallel scan and the like to be set without having to stop using the existing full helper functions. This patch merely adds the argument and fixes up the callers. It doesn't undo the special cases already in the tree or add any new parallel callers. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-01pata_via: store UDMA masks in via_isa_bridges tableBartlomiej Zolnierkiewicz
* store UDMA masks in via_isa_bridges[] and while at it make "flags" field to be u8 instead of u16 * convert the driver to use UDMA masks from via_isa_bridges[] * remove no longer needed VIA_UDMA* defines Make some minor documentation and CodingStyle fixes while at it. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-03-01pata_via: fix address setup timings underlockingBartlomiej Zolnierkiewicz
Correct via_do_set_mode() documentation while at it. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-03pata_via: clear UDMA transfer mode bit for PIO and MWDMABartlomiej Zolnierkiewicz
Fix register naming while at it. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-03pata_via: Blacklist some combinations of Transcend Flash and viaAlan Cox
Reported by Mikulas Patocka. VIA VT82C586B + Transcend TS64GSSD25-M v0826 does not work in UDMA mode Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-12-03pata_via: fix double put on isa bridgeJiri Slaby
In via_init_one, when via_isa_bridges iterator reaches PCI_DEVICE_ID_VIA_ANON and last but one via_isa_bridges bridge is found but rev doesn't match, pci_dev_put(isa) is called twice. Do pci_dev_put only once. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-10-16pata_via: extend the rev_max for VT6330JosephChan@via.com.tw
Fix the VT6330 issue, it's because the rev_max of VT6330 exceeds 0x2f. The VT6415 and VT6330 share the same device ID. Signed-off-by: Joseph Chan <josephchan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-04-17pata_via: Cache and rewrite the device bitAlan Cox
Some VIA chipsets will reset the DEV bit after IEN changes on ctl. Our optimised write path avoids doing this but we need to remove the optimisation on these devices. [Identified and some original patches proposed by Josehn Chan @ VIA but discussion then all ground to a halt so given a test case I dug it back out] Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk Tested-by: Christoph Bisping (bug #13086) Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-03-24[libata] convert drivers to use ata.h mode mask definesErik Inge Bolsø
No functional changes in this patch. Signed-off-by: Erik Inge Bolsø <knan-lkml@anduin.net> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2009-02-17Add support for VT6415 PCIE PATA IDE Host ControllerZlatko Calusic
Signed-off-by: Zlatko Calusic <zlatko.calusic@iskon.hr> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-26[libata] pata_via: support VX855, future chips whose IDE controller use 0x0571JosephChan@via.com.tw
It supports VX855 and future chips whose IDE controller uses PCI ID 0x0571. Signed-off-by: Joseph Chan <josephchan@via.com.tw> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-10-27ata: Switch all my stuff to a common addressAlan Cox
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-08-22pata_via: clean up recent tf_load changesTejun Heo
Commit bfce5e0179ad059035df28558724ff60af708e09 implemented custom tf_load for pata_via. This patch cleans it up a bit. * Instead of duplicating whole body, copy tf and set ATA_TFLAG_DEVICE when necessary. * Rename via_ata_tf_load() to via_tf_load(). * No need to set .tf_load in via_port_ops_noirq as it inherits from via_port_ops. * Clean up indentation. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-07-31pata_via: add VX800 flag; add function for fixing h/w bugsJosephChan@via.com.tw
Add flag VIA_SATA_PATA for vx800, VX800 uses the same chipset(0x0581/0x5324) as CX700, which has 1 PATA channel(Master/Slave) and 1 SATA channel(Master/Slave) Add function <via_ata_tf_load>. This is to fix the internal bug of VIA chipsets, which will reset the device register after changing the IEN bit in CTL register Signed-off-by: Joseph Chan <josephchan@via.com.tw> Cc: Tejun Heo <tj@kernel.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-05-19ata: remove FIT() macroHarvey Harrison
Use the kernel-provided clamp_val() macro. FIT was always applied to a member of struct ata_timing (unsigned short) and two constants. clamp_val will not cast to short anymore. Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: Jeff Garzik <jeff@garzik.org> Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-29pata_via: Fix 6410 misdetectAlan Cox
The discrete VIA ATA chips don't have 0x40 enable bits. We check that properly in one location but not another. This causes some users 6410 RAID cards to be incorrectly skipped. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-04-17libata: rename SFF port opsTejun Heo
Add sff_ prefix to SFF specific port ops. This rename is in preparation of separating SFF support out of libata core layer. This patch strictly renames ops and doesn't introduce any behavior difference. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: rename SFF functionsTejun Heo
SFF functions have confusing names. Some have sff prefix, some have bmdma, some std, some pci and some none. Unify the naming by... * SFF functions which are common to both BMDMA and non-BMDMA are prefixed with ata_sff_. * SFF functions which are specific to BMDMA are prefixed with ata_bmdma_. * SFF functions which are specific to PCI but apply to both BMDMA and non-BMDMA are prefixed with ata_pci_sff_. * SFF functions which are specific to PCI and BMDMA are prefixed with ata_pci_bmdma_. * Drop generic prefixes from LLD specific routines. For example, bfin_std_dev_select -> bfin_dev_select. The following renames are noteworthy. ata_qc_issue_prot() -> ata_sff_qc_issue() ata_pci_default_filter() -> ata_bmdma_mode_filter() ata_dev_try_classify() -> ata_sff_dev_classify() This rename is in preparation of separating SFF support out of libata core layer. This patch strictly renames functions and doesn't introduce any behavior difference. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: make reset related methods proper port operationsTejun Heo
Currently reset methods are not specified directly in the ata_port_operations table. If a LLD wants to use custom reset methods, it should construct and use a error_handler which uses those reset methods. It's done this way for two reasons. First, the ops table already contained too many methods and adding four more of them would noticeably increase the amount of necessary boilerplate code all over low level drivers. Second, as ->error_handler uses those reset methods, it can get confusing. ie. By overriding ->error_handler, those reset ops can be made useless making layering a bit hazy. Now that ops table uses inheritance, the first problem doesn't exist anymore. The second isn't completely solved but is relieved by providing default values - most drivers can just override what it has implemented and don't have to concern itself about higher level callbacks. In fact, there currently is no driver which actually modifies error handling behavior. Drivers which override ->error_handler just wraps the standard error handler only to prepare the controller for EH. I don't think making ops layering strict has any noticeable benefit. This patch makes ->prereset, ->softreset, ->hardreset, ->postreset and their PMP counterparts propoer ops. Default ops are provided in the base ops tables and drivers are converted to override individual reset methods instead of creating custom error_handler. * ata_std_error_handler() doesn't use sata_std_hardreset() if SCRs aren't accessible. sata_promise doesn't need to use separate error_handlers for PATA and SATA anymore. * softreset is broken for sata_inic162x and sata_sx4. As libata now always prefers hardreset, this doesn't really matter but the ops are forced to NULL using ATA_OP_NULL for documentation purpose. * pata_hpt374 needs to use different prereset for the first and second PCI functions. This used to be done by branching from hpt374_error_handler(). The proper way to do this is to use separate ops and port_info tables for each function. Converted. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: stop overloading port_info->private_dataTejun Heo
port_info->private_data is currently used for two purposes - to record private data about the port_info or to specify host->private_data to use when allocating ata_host. This overloading is confusing and counter-intuitive in that port_info->private_data becomes host->private_data instead of port->private_data. In addition, port_info and host don't correspond to each other 1-to-1. Currently, the first non-NULL port_info->private_data is used. This patch makes port_info->private_data just be what it is - private_data for the port_info where LLD can jot down extra info. libata no longer sets host->private_data to the first non-NULL port_info->private_data, @host_priv argument is added to ata_pci_init_one() instead. LLDs which use ata_pci_init_one() can use this argument to pass in pointer to host private data. LLDs which don't should use init-register model anyway and can initialize host->private_data directly. Adding @host_priv instead of using init-register model for LLDs which use ata_pci_init_one() is suggested by Alan Cox. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
2008-04-17libata: make ata_pci_init_one() not use ops->irq_handler and pi->shtTejun Heo
ata_pci_init_one() is the only function which uses ops->irq_handler and pi->sht. Other initialization functions take the same information as arguments. This causes confusion and duplicate unused entries in structures. Make ata_pci_init_one() take sht as an argument and use ata_interrupt implicitly. All current users use ata_interrupt and if different irq handler is necessary open coding ata_pci_init_one() using ata_prepare_sff_host() and ata_activate_sff_host can be done under ten lines including error handling and driver which requires custom interrupt handler is likely to require custom initialization anyway. As ata_pci_init_one() was the last user of ops->irq_handler, this patch also kills the field. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: implement and use ops inheritanceTejun Heo
libata lets low level drivers build ata_port_operations table and register it with libata core layer. This allows low level drivers high level of flexibility but also burdens them with lots of boilerplate entries. This becomes worse for drivers which support related similar controllers which differ slightly. They share most of the operations except for a few. However, the driver still needs to list all operations for each variant. This results in large number of duplicate entries, which is not only inefficient but also error-prone as it becomes very difficult to tell what the actual differences are. This duplicate boilerplates all over the low level drivers also make updating the core layer exteremely difficult and error-prone. When compounded with multi-branched development model, it ends up accumulating inconsistencies over time. Some of those inconsistencies cause immediate problems and fixed. Others just remain there dormant making maintenance increasingly difficult. To rectify the problem, this patch implements ata_port_operations inheritance. To allow LLDs to easily re-use their own ops tables overriding only specific methods, this patch implements poor man's class inheritance. An ops table has ->inherits field which can be set to any ops table as long as it doesn't create a loop. When the host is started, the inheritance chain is followed and any operation which isn't specified is taken from the nearest ancestor which has it specified. This operation is called finalization and done only once per an ops table and the LLD doesn't have to do anything special about it other than making the ops table non-const such that libata can update it. libata provides four base ops tables lower drivers can inherit from - base, sata, pmp, sff and bmdma. To avoid overriding these ops accidentaly, these ops are declared const and LLDs should always inherit these instead of using them directly. After finalization, all the ops table are identical before and after the patch except for setting .irq_handler to ata_interrupt in drivers which didn't use to. The .irq_handler doesn't have any actual effect and the field will soon be removed by later patch. * sata_sx4 is still using old style EH and currently doesn't take advantage of ops inheritance. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: implement and use SHT initializersTejun Heo
libata lets low level drivers build scsi_host_template and register it to the SCSI layer. This allows low level drivers high level of flexibility but also burdens them with lots of boilerplate entries. This patch implements SHT initializers which can be used to initialize all the boilerplate entries in a sht. Three variants of them are implemented - BASE, BMDMA and NCQ - for different types of drivers. Note that entries can be overriden by putting individual initializers after the helper macro. All sht tables are identical before and after this patch. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-04-17libata: PCI device should be powered up before being accessedTejun Heo
PCI device should be powered up or powered up before its PCI regsiters are accessed. Although PCI configuration register access is allowed in D3hot, PCI device is free to reset its status when transiting from D3hot to D0 causing configuration data to change. Many libata SFF drivers which use ata_pci_init_one() read and update configuration registers before calling ata_pci_init_one() which enables the PCI device. Also, in resume paths, some drivers access registers without resuming the PCI device. This patch adds a call to pcim_enable_device() in init path if register is accessed before calling ata_pci_init_one() and make resume paths first resume PCI devices, access PCI configuration regiters then resume ATA host. While at it... * cmd640 was strange in that it set ->resume even when CONFIG_PM is not. This is by-product of minimal build fix. Updated. * In cs5530, Don't BUG() on reinit failure. Just whine and fail resume. Signed-off-by: Tejun Heo <htejun@gmail.com>
2008-02-11pata_via: fix SATA cable detection on cx700Tejun Heo
The first port of cx700 is SATA. Fix cable detection. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2008-01-23libata: reimplement ata_acpi_cbl_80wire() using ata_acpi_gtm_xfermask()Tejun Heo
Reimplement ata_acpi_cbl_80wire() using ata_acpi_gtm_xfermask() and while at it relocate the function below ata_acpi_gtm_xfermask(). New ata_acpi_cbl_80wire() implementation takes @gtm, in both pata_via and pata_amd, use the initial GTM value. Both are trying to peek initial BIOS configuration, so using initial caching value makes sense. This fixes ACPI part of cable detection in pata_amd which previously always returned 0 because configuring PIO0 during reset clears DMA configuration. Signed-off-by: Tejun Heo <htejun@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-12-04pata_amd/pata_via: de-couple programming of PIO/MWDMA and UDMA timingsBartlomiej Zolnierkiewicz
* Don't program UDMA timings when programming PIO or MWDMA modes. This has also a nice side-effect of fixing regression added by commit 681c80b5d96076f447e8101ac4325c82d8dce508 ("libata: correct handling of SRST reset sequences") (->set_piomode method for PIO0 is called before ->cable_detect method which checks UDMA timings to get the cable type). * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Tested-by: "Thomas Lindroth" <thomas.lindroth@gmail.com> Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Tejun Heo <htejun@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-29[libata] fix 'if(' and similar areas that lack whitespaceJeff Garzik
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-19Fix misspellings of "system", "controller", "interrupt" and "necessary".Robert P. J. Day
Fix the various misspellings of "system", controller", "interrupt" and "[un]necessary". Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-12libata: Switch most of the remaining SFF drivers to ata_sff_port_startAlan Cox
This avoids allocating DMA buffers if not needed but at the moment is mostly just a neatness item. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] Remove ->port_disable() hookJeff Garzik
It was always set to ata_port_disable(). Removed the hook, and replaced the very few ap->ops->port_disable() callsites with direct calls to ata_port_disable(). Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata pata_via: ACPI checks for 80wire cableAlan Cox
Testing this on the VIA boards fixes several problems with otherwise undetectable SATA bridge chips Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12[libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()Jeff Garzik
* ->irq_ack() is redundant to what the irq handler already performs... chk-status + irq-clear. Furthermore, it is only called in one place, when screaming-irq-debugging is enabled, so we don't want to bother with a hook just for that. * ata_dummy_irq_on() is only ever used in drivers that have no callpath reaching ->irq_on(). Remove .irq_on hook from those drivers, and the now-unused ata_dummy_irq_on() Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-12libata-link: linkify resetTejun Heo
Make reset methods and related functions deal with ata_link instead of ata_port. * ata_do_reset() * ata_eh_reset() * all prereset/reset/postreset methods and related functions This patch introduces no behavior change. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-10-09drivers/firmware: const-ify DMI API and internalsJeff Garzik
Three main sets of changes: 1) dmi_get_system_info() return value should have been marked const, since callers should not be changing that data. 2) const-ify DMI internals, since DMI firmware tables should, whenever possible, be marked const to ensure we never ever write to that data area. 3) const-ify DMI API, to enable marking tables const where possible in low-level drivers. And if we're really lucky, this might enable some additional optimizations on the part of the compiler. The bulk of the changes are #2 and #3, which are interrelated. #1 could have been a separate patch, but it was so small compared to the others, it was easier to roll it into this changeset. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>