aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 167Thomas Gleixner1-14/+1
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 83 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.021731668@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-12treewide: devm_kzalloc() -> devm_kcalloc()Kees Cook1-4/+4
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc(). This patch replaces cases of: devm_kzalloc(handle, a * b, gfp) with: devm_kcalloc(handle, a * b, gfp) as well as handling cases of: devm_kzalloc(handle, a * b * c, gfp) with: devm_kzalloc(handle, array3_size(a, b, c), gfp) as it's slightly less ugly than: devm_kcalloc(handle, array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: devm_kzalloc(handle, 4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. Some manual whitespace fixes were needed in this patch, as Coccinelle really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...". The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ expression HANDLE; type TYPE; expression THING, E; @@ ( devm_kzalloc(HANDLE, - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | devm_kzalloc(HANDLE, - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression HANDLE; expression COUNT; typedef u8; typedef __u8; @@ ( devm_kzalloc(HANDLE, - sizeof(u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ expression HANDLE; type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ expression HANDLE; identifier SIZE, COUNT; @@ - devm_kzalloc + devm_kcalloc (HANDLE, - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression HANDLE; expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression HANDLE; expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ expression HANDLE; identifier STRIDE, SIZE, COUNT; @@ ( devm_kzalloc(HANDLE, - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression HANDLE; expression E1, E2, E3; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression HANDLE; expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, sizeof(THING) * C2, ...) | devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...) | devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, C1 * C2, ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * E2 + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * (E2) + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
2018-05-11libata: bump ->qc_active to a 64-bit typeJens Axboe1-1/+1
This is in preparation for allowing full usage of the tag space, which means that our reserved error handling command will be using an internal tag value of 32. This doesn't fit in a u32, so move to a u64. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Tejun Heo <tj@kernel.org>
2018-05-11libata: convert core and drivers to ->hw_tag usageJens Axboe1-12/+12
Anything that goes to the hardware should use ->hw_tag, anything related to internal lookup should be using ->tag. Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Tejun Heo <tj@kernel.org>
2018-01-25ata: sata_mv: Replace mdelay with usleep_range in mv_reset_channelJia-Ju Bai1-1/+1
After checking all possible call chains to mv_reset_channel here, my tool finds that mv_reset_channel is never called in atomic context, namely never in an interrupt handler or holding a spinlock. Thus mdelay can be replaced with usleep_range to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2017-10-23ata: mark expected switch fall-throughsGustavo A. R. Silva1-2/+2
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. In cases where a "drop through" comment was already in place, I replaced it with a proper "fall through" comment, which is what GCC is expecting to find. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2017-10-23ata: sata_mv: remove a redundant assignment to pointer ehiColin Ian King1-3/+1
The pointer ehi is being assigned to a value that is never read and is redundant. Clean up the code and move the ehi declaration and initialization to the code block where it is used. Cleans up clang warning: Value stored to 'ehi' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2017-05-24Revert "ata: sata_mv: Convert to devm_ioremap_resource()"Andrew Lunn1-5/+8
This reverts commit 368e5fbdfc60732643f34f538823ed4bc8829827. devm_ioremap_resource() enforces that there are no overlapping resources, where as devm_ioremap() does not. The sata phy driver needs a subset of the sata IO address space, so maps some of the sata address space. As a result, sata_mv now fails to probe, reporting it cannot get its resources, and so we don't have any SATA disks. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: stable@vger.kernel.org # v4.11+ Signed-off-by: Tejun Heo <tj@kernel.org>
2017-03-06ata: constify of_device_id structuresBhumika Goyal1-1/+1
Declare of_device_id structures as const as they are either passed to the macro MODULE_DEVICE_TABLE or stored in the of_match_table field of a device_driver structure. This field is of type const, so of_device_id structures having this property can be made const too. Cross compiled the files drivers/ata/pata_macio.c and drivers/ata/pata_mpc52xx.c for powerpc architecture. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2017-01-09ata: sata_mv: Convert to devm_ioremap_resource()Andy Shevchenko1-8/+5
Convert to devm_ioremap_resource() which provides more consistent error handling. Note that devm_ioremap_resource() provides its own error messages. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2017-01-09Merge branch 'for-4.10-fixes' into for-4.11Tejun Heo1-0/+3
2017-01-06ata: sata_mv:- Handle return value of devm_ioremap.Arvind Yadav1-0/+3
Here, If devm_ioremap will fail. It will return NULL. Then hpriv->base = NULL - 0x20000; Kernel can run into a NULL-pointer dereference. This error check will avoid NULL pointer dereference. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
2017-01-06ata: sata_mv: fix module license specificationUwe Kleine-König1-1/+1
The header allows GPL v2 only, so declare "GPL v2" for MODULE_LICENSE Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Tejun Heo <tj@kernel.org>
2016-11-29ata: sata_mv: check for errors when parsing nr-ports from dtUwe Kleine-König1-1/+14
If the nr-ports property is missing ata_host_alloc_pinfo is called with n_ports = 0. This results in host->ports[0] = NULL which later makes mv_init_host() oops when dereferencing this pointer. Instead be a bit more cooperative and fail the probing with an error message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Tejun Heo <tj@kernel.org>
2016-09-20ata: sata_mv: Replacing dma_pool_alloc and memset with a single call dma_pool_zalloc.Harman Kalra1-4/+2
Replacing dma_pool_alloc and memset with a single call to dma_pool_zalloc Signed-off-by: Harman Kalra <harman4linux@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2016-06-17ata: sata_mv: fix mis-conversion in mv_write_cached_reg()Ben Dooks1-1/+1
Fix the signed issue in mv_write_cached_reg() where the laddr is assigned from a (long)addr instead of (unsigned long)addr. Fixes the following warnings: drivers/ata/sata_mv.c:989:26: warning: cast removes address space of expression drivers/ata/sata_mv.c:989:26: warning: cast removes address space of expression drivers/ata/sata_mv.c:989:26: warning: cast removes address space of expression drivers/ata/sata_mv.c:989:26: warning: cast removes address space of expression Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Tejun Heo <tj@kernel.org>
2015-04-08ata: remove deprecated use of pci apiQuentin Lambert1-5/+5
Replace occurences of the pci api by appropriate call to the dma api. A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr) @deprecated@ idexpression id; position p; @@ ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @bad1@ idexpression id; position deprecated.p; @@ ...when != &id->dev when != pci_get_drvdata ( id ) when != pci_enable_device ( id ) ( pci_dma_supported@p ( id, ...) | pci_alloc_consistent@p ( id, ...) ) @depends on !bad1@ idexpression id; expression direction; position deprecated.p; @@ ( - pci_dma_supported@p ( id, + dma_supported ( &id->dev, ... + , GFP_ATOMIC ) | - pci_alloc_consistent@p ( id, + dma_alloc_coherent ( &id->dev, ... + , GFP_ATOMIC ) ) Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2015-03-19ata: sata_mv: add proper definitions for LP_PHY_CTL register valuesThomas Petazzoni1-4/+16
Commit 9013d64e661fc ("ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs") added some manipulation of the LP_PHY_CTL register, but using magic values. This commit changes the code to use proper definitions for the LP_PHY_CTL register, which allows to document what the different bits are doing. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Simon Guinot <simon.guinot@sequanux.org> Signed-off-by: Tejun Heo <tj@kernel.org>
2015-02-03sata_mv: Delete unnecessary checks before the function call "phy_power_off"Markus Elfring1-4/+2
The phy_power_off() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Tejun Heo <tj@kernel.org>
2014-10-20ata: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-05-09ata: use CONFIG_PM_SLEEP instead of CONFIG_PM where applicable in host driversBartlomiej Zolnierkiewicz1-4/+4
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-20Merge branch 'for-3.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libataLinus Torvalds1-4/+8
Pull libata fixes from Tejun Heo: "Various device specific fixes. Nothing too interesting" * 'for-3.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: ahci: disable NCQ on Samsung pci-e SSDs on macbooks ata: sata_mv: Cleanup only the initialized ports sata_sil: apply MOD15WRITE quirk to TOSHIBA MK2561GSYN ata: enable quirk from jmicron JMB350 for JMB394 ATA: SATA_MV: Add missing Kconfig select statememnt ata: pata_imx: Check the return value from clk_prepare_enable()
2014-02-16ata: sata_mv: Cleanup only the initialized portsEzequiel Garcia1-2/+7
When an error occurs in the port initialization loop, currently the driver tries to cleanup all the ports. This results in a NULL pointer dereference if the ports were only partially initialized. Fix this by updating only the number of initialized ports (either with failure or successfully), before jumping to the error path and looping over that number in the cleanup loop. Cc: Andrew Lunn <andrew@lunn.ch> Reported-by: Mikael Pettersson <mikpelinux@gmail.com> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
2014-02-05ata: sata_mv: Fix probe failures with optional physAndrew Lunn1-3/+5
Make use of devm_phy_optional_get() in order to fix probe failures on Armada 370, XP and others, when there is no phy driver available. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2014-01-20SATA: MV: Add support for the optional PHYsAndrew Lunn1-0/+27
Some Marvell SoCs have a SATA PHY which can be powered off, in order to save power. Make use of the generic phy framework to control these phys. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Tejun Heo <tj@kernel.org>
2014-01-15ata: sata_mv: fix disk hotplug for Armada 370/XP SoCsLior Amsalem1-0/+24
On Armada 370/XP SoCs, once a disk is removed from a SATA port, then the re-plug events are not detected by the sata_mv driver. This patch fixes the issue by updating the PHY speed in the LP_PHY_CTL register (0x58) according to the SControl speed. Note that this fix is only applied if the compatible string "marvell,armada-370-sata" is found in the SATA DT node. Fixes: 9ae6f740b49f ("arm: mach-mvebu: add support for Armada 370 and Armada XP with DT") Signed-off-by: Lior Amsalem <alior@marvell.com> Signed-off-by: Nadav Haklai <nadavh@marvell.com> Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Gregory Clement <gregory.clement@free-electrons.com> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: stable@vger.kernel.org # v3.6+ Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Tejun Heo <tj@kernel.org>
2014-01-15ata: sata_mv: introduce compatible string "marvell, armada-370-sata"Simon Guinot1-0/+1
The sata_mv driver supports the SATA IP found in several Marvell SoCs. As some new SATA registers have been introduced with the Armada 370/XP SoCs, a way to identify them is needed. This patch introduces a new compatible string for the SATA IP found in Armada 370/XP SoCs. Signed-off-by: Simon Guinot <simon.guinot@sequanux.org> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Gregory Clement <gregory.clement@free-electrons.com> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Cc: Lior Amsalem <alior@marvell.com> Cc: stable@vger.kernel.org # v3.6+ Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Tejun Heo <tj@kernel.org>
2013-07-30sata_mv: Remove unneeded CONFIG_HAVE_CLK ifdefsEzequiel Garcia1-14/+7
If CONFIG_HAVE_CLK is not selected, then all the clk API turn out into no-ops. In other words, there's no need to have the ifdefs. The only side-effect of this patch is the extra tiny kmalloc, but that's not enough reason to have such ugly ifdefs all around the code. tj: Slightly massaged comment as per Andrew Lunn. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Tejun Heo <tj@kernel.org>
2013-07-30ata: use dev_get_platdata()Jingoo Han1-1/+1
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2013-07-29sata_mv: Remove unneeded forward declarationEzequiel Garcia1-3/+0
These forward declarations are no longer needed, and are probably historical left-over. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Tejun Heo <tj@kernel.org>
2013-01-03Drivers: ata: remove __dev* attributes.Greg Kroah-Hartman1-4/+4
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Viresh Kumar <viresh.linux@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-01sata_mv: Fix warnings when no PCIAndrew Lunn1-3/+5
Dove can be configured without PCI. We then get a number of warnings: warning: 'msi' defined but not used warning: 'mv5_sht' defined but not used warning: 'mv_dump_pci_cfg' defined but not used. Move around variables and add #ifdef as necassary to fix the warnings. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2012-07-27ATA: sata_mv: Add device tree supportAndrew Lunn1-13/+29
Add support for instantiating this driver from device tree, and add the necassary DT information to the kirkwood.dtsi file. This is based on previous work by Michael Walle and Jason Cooper. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Josh Coombs <josh.coombs@gmail.com>
2012-05-08ARM: Orion: SATA: Add per channel clk/clkdev support.Andrew Lunn1-4/+36
The Orion kirkwood chips have a gatable clock per SATA channel. Add code to get and enable this clk if it exists. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Mike Turquette <mturquette@linaro.org>
2012-04-12sata_mv: silence an uninitialized variable warningDan Carpenter1-1/+2
Gcc version 4.6.2-12 complains that if we can't find the "nr-ports" property in of_property_read_u32_array() then "n_ports" is used uninitialized. Let's set it to zero in that case. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-12-13ARM: Orion: Get address map from plat-orion instead of via platform_dataAndrew Lunn1-8/+11
Use an getter function in plat-orion/addr-map.c to get the address map structure, rather than pass it to drivers in the platform_data structures. When the drivers are built for none orion platforms, a dummy function is provided instead which returns NULL. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Michael Walle <michael@walle.cc> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
2011-10-07sata_mv: use {platform|pci}_get_drvdata()Sergei Shtylyov1-5/+4
The driver uses dev_get_drvdata() to get to the driver data for the platform and PCI devices, while the corresponding wrappers exists for them -- in one case it even declares an otherwise unneeded variable to do that. Switch to using the {platform|pci}_get_drvdata() instead. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-10-07sata_mv: release clock on ata_host_activate() failureSergei Shtylyov1-2/+5
mv_platfrom_probe() forgets to call clk_disable() and clk_put() iff ata_host_activate() fails... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-07-23ata: Add and use ata_print_version_onceJoe Perches1-6/+2
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 Perches1-22/+19
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>
2011-07-23ata: Convert dev_printk(KERN_<LEVEL> to dev_<level>(Joe Perches1-27/+22
Saves a bit of text as the call takes fewer args. Coalesce a few formats. Convert a few bare printks to pr_cont. $ size drivers/ata/built-in.o* text data bss dec hex filename 558429 73893 117864 750186 b726a drivers/ata/built-in.o.allyesconfig.new 559574 73893 117888 751355 b76fb drivers/ata/built-in.o.allyesconfig.old 149567 14689 4220 168476 2921c drivers/ata/built-in.o.defconfig.new 149851 14689 4220 168760 29338 drivers/ata/built-in.o.defconfig.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-03-31Fix common misspellingsLucas De Marchi1-2/+2
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-02libata: remove ATA_FLAG_NO_LEGACYSergei Shtylyov1-2/+1
All checks of ATA_FLAG_NO_LEGACY have been removed by the commits c791c30670ea61f19eec390124128bf278e854fe ([libata] minor PCI IDE probe fixes and cleanups) and f0d36efdc624beb3d9e29b9ab9e9537bf0f25d5b (libata: update libata core layer to use devres), so I think it's time to finally get rid of this flag... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2011-03-02libata: remove ATA_FLAG_MMIOSergei Shtylyov1-1/+1
Commit 0d5ff566779f894ca9937231a181eb31e4adff0e (libata: convert to iomap) removed all checks of ATA_FLAG_MMIO but neglected to remove the flag itself. Do it now, at last... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-10-21libata: always use ata_qc_complete_multiple() for NCQ command completionsTejun Heo1-13/+12
Currently, sata_fsl, mv and nv call ata_qc_complete() multiple times from their interrupt handlers to indicate completion of NCQ commands. This limits the visibility the libata core layer has into how commands are being executed and completed, which is necessary to support IRQ expecting in generic way. libata already has an interface to complete multiple commands at once - ata_qc_complete_multiple() which ahci and sata_sil24 already use. This patch updates the three drivers to use ata_qc_complete_multiple() too and updates comments on ata_qc_complete[_multiple]() regarding their usages with NCQ completions. This change not only provides better visibility into command execution to the core layer but also simplifies low level drivers. * sata_fsl: It already builds done_mask. Conversion is straight forward. * sata_mv: mv_process_crpb_response() no longer checks for illegal completions, it just returns whether the tag is completed or not. mv_process_crpb_entries() builds done_mask from it and passes it to ata_qc_complete_multiple() which will check for illegal completions. * sata_nv adma: Similar to sata_mv. nv_adma_check_cpb() now just returns the tag status and nv_adma_interrupt() builds done_mask from it and passes it to ata_qc_complete_multiple(). * sata_nv swncq: It already builds done_mask. Drop unnecessary illegal transition checks and call ata_qc_complete_multiple(). In the long run, it might be a good idea to make ata_qc_complete() whine if called when multiple NCQ commands are in flight. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ashish Kalra <ashish.kalra@freescale.com> Cc: Saeed Bishara <saeed@marvell.com> Cc: Mark Lord <liml@rtr.ca> Cc: Robert Hancock <hancockr@shaw.ca> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-09-09libata-sff: Reenable Port Multiplier after libata-sff remodeling.Gwendal Grignou1-1/+1
Keep track of the link on the which the current request is in progress. It allows support of links behind port multiplier. Not all libata-sff is PMP compliant. Code for native BMDMA controller does not take in accound PMP. Tested on Marvell 7042 and Sil7526. Signed-off-by: Gwendal Grignou <gwendal@google.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-08-25sata_mv: fix broken DSM/TRIM support (v2)Mark Lord1-7/+37
Fix DSM/TRIM commands in sata_mv (v2). These need to be issued using old-school "BM DMA", rather than via the EDMA host queue. Since the chips don't have proper BM DMA status, we need to be more careful with setting the ATA_DMA_INTR bit, since DSM/TRIM often has a long delay between "DMA complete" and "command complete". GEN_I chips don't have BM DMA, so no TRIM for them. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Cc: stable@kernel.org
2010-08-01sata_fsl,mv,nv: prepare for NCQ command completion updateTejun Heo1-23/+24
Make the following changes to prepare for NCQ command completion update. Changes made by this patch don't cause any functional difference. * sata_fsl_host_intr(): rename the local variable qc_active to done_mask as that's what it is. * mv_process_crpb_response(): restructure if clause for easier update. * nv_adma_interrupt(): drop unnecessary error variable. * nv_swncq_sdbfis(): drop unnecessary nr_done and return 0 on success. Typo fix. * nv_swncq_dmafis(): drop unused return value and return void. * nv_swncq_host_interrupt(): drop unnecessary return value handling. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ashish Kalra <ashish.kalra@freescale.com> Cc: Saeed Bishara <saeed@marvell.com> Cc: Mark Lord <liml@rtr.ca> Cc: Robert Hancock <hancockr@shaw.ca> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-25libata-sff: separate out BMDMA irq handlerTejun Heo1-1/+1
Separate out BMDMA irq handler from SFF irq handler. The misnamed host_intr() functions are renamed to ata_sff_port_intr() and ata_bmdma_port_intr(). Common parts are factored into __ata_sff_port_intr() and __ata_sff_interrupt() and used by sff and bmdma interrupt routines. All BMDMA drivers now use ata_bmdma_interrupt() or ata_bmdma_port_intr() while all non-BMDMA SFF ones use ata_sff_interrupt() or ata_sff_port_intr(). For now, ata_pci_sff_init_one() uses ata_bmdma_interrupt() as it's used by both SFF and BMDMA drivers. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2010-05-25sata_mv: drop unncessary EH callback resettingTejun Heo1-2/+0
Now that BMDMA EH ops are separated out from SFF ops, mv5_ops doesn't have to explicitly reset ->error_handler() and ->post_internal_cmd(). Drop them. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>