09 Feb, 2017

1 commit

  • commit 064c3db9c564cc5be514ac21fb4aa26cc33db746 upstream.

    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
    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Arvind Yadav
     

30 Nov, 2016

1 commit


21 Sep, 2016

1 commit


18 Jun, 2016

1 commit

  • 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
    Signed-off-by: Tejun Heo

    Ben Dooks
     

08 Apr, 2015

1 commit

  • 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
    Signed-off-by: Tejun Heo

    Quentin Lambert
     

20 Mar, 2015

1 commit

  • 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
    Acked-by: Simon Guinot
    Signed-off-by: Tejun Heo

    Thomas Petazzoni
     

03 Feb, 2015

1 commit


20 Oct, 2014

1 commit


10 May, 2014

1 commit

  • 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
    Signed-off-by: Tejun Heo

    Bartlomiej Zolnierkiewicz
     

21 Feb, 2014

1 commit

  • 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()

    Linus Torvalds
     

17 Feb, 2014

1 commit

  • 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
    Reported-by: Mikael Pettersson
    Signed-off-by: Ezequiel Garcia
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org

    Ezequiel Garcia
     

05 Feb, 2014

1 commit


20 Jan, 2014

1 commit


15 Jan, 2014

2 commits

  • 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
    Signed-off-by: Nadav Haklai
    Signed-off-by: Simon Guinot
    Cc: Thomas Petazzoni
    Cc: Jason Cooper
    Cc: Andrew Lunn
    Cc: Gregory Clement
    Cc: Sebastian Hesselbarth
    Cc: stable@vger.kernel.org # v3.6+
    Acked-by: Jason Cooper
    Signed-off-by: Tejun Heo

    Lior Amsalem
     
  • 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
    Cc: Thomas Petazzoni
    Cc: Jason Cooper
    Cc: Andrew Lunn
    Cc: Gregory Clement
    Cc: Sebastian Hesselbarth
    Cc: Lior Amsalem
    Cc: stable@vger.kernel.org # v3.6+
    Acked-by: Jason Cooper
    Signed-off-by: Tejun Heo

    Simon Guinot
     

30 Jul, 2013

2 commits

  • 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
    Acked-by: Andrew Lunn
    Signed-off-by: Tejun Heo

    Ezequiel Garcia
     
  • Use the wrapper function for retrieving the platform data instead of
    accessing dev->platform_data directly.

    Signed-off-by: Jingoo Han
    Signed-off-by: Tejun Heo

    Jingoo Han
     

29 Jul, 2013

1 commit


04 Jan, 2013

1 commit

  • 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
    Cc: Jeff Garzik
    Cc: Viresh Kumar
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

02 Oct, 2012

1 commit

  • 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
    Signed-off-by: Jeff Garzik

    Andrew Lunn
     

27 Jul, 2012

1 commit

  • 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
    Tested-by: Josh Coombs

    Andrew Lunn
     

09 May, 2012

1 commit


13 Apr, 2012

1 commit


14 Dec, 2011

1 commit


08 Oct, 2011

2 commits


24 Jul, 2011

3 commits

  • 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
    Signed-off-by: Jeff Garzik

    Joe Perches
     
  • Saves text by removing nearly duplicated text format strings by
    creating ata__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
    Signed-off-by: Jeff Garzik

    Joe Perches
     
  • 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
    Signed-off-by: Jeff Garzik

    Joe Perches
     

31 Mar, 2011

1 commit


02 Mar, 2011

2 commits

  • 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
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     
  • 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
    Signed-off-by: Jeff Garzik

    Sergei Shtylyov
     

22 Oct, 2010

1 commit

  • 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
    Cc: Ashish Kalra
    Cc: Saeed Bishara
    Cc: Mark Lord
    Cc: Robert Hancock
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

10 Sep, 2010

1 commit


26 Aug, 2010

1 commit

  • 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
    Signed-off-by: Jeff Garzik
    Cc: stable@kernel.org

    Mark Lord
     

02 Aug, 2010

1 commit

  • 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
    Cc: Ashish Kalra
    Cc: Saeed Bishara
    Cc: Mark Lord
    Cc: Robert Hancock
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

26 May, 2010

2 commits

  • 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
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • 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
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

20 May, 2010

2 commits

  • Separate out ata_bmdma_qc_issue() from ata_sff_qc_issue() such that
    ata_sff_qc_issue() only deals with non-BMDMA SFF protocols (PIO and
    nodata) while ata_bmdma_qc_issue() deals with the BMDMA protocols and
    uses ata_sff_qc_issue() for non-DMA commands. All the users are
    updated accordingly.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • port_task is tightly bound to the standard SFF PIO HSM implementation.
    Using it for any other purpose would be error-prone and there's no
    such user and if some drivers need such feature, it would be much
    better off using its own. Move it inside CONFIG_ATA_SFF and rename it
    to sff_pio_task.

    The only function which is exposed to the core layer is
    ata_sff_flush_pio_task() which is renamed from ata_port_flush_task()
    and now also takes care of resetting hsm_task_state to HSM_ST_IDLE,
    which is possible as it's now specific to PIO HSM.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo