History log of /linux-master/drivers/ata/ahci_platform.c
Revision Date Author Comments
# 259b8366 09-Jun-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

ata: ahci_platform: Make code agnostic to OF/ACPI

With the help of a new device_is_compatible() make
the driver code agnostic to the OF/ACPI. This makes
it neater. As a side effect the header inclusions is
corrected (seems mod_devicetable.h was implicitly
included).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Message-ID: <20230609154900.43024-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a7eb54d4 12-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

ata: libata: Make ata_platform_remove_one return void

The function returned zero unconditionally, so the function returning an
int is something between useless and irritating. With the goal to make
platform drivers' remove function return void, it's helpful to convert
the function accordingly. This converts several drivers to the new
.remove_new callback that was introduced to smoothen the platform driver
conversion.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>


# 25df73d9 22-Mar-2023 Bart Van Assche <bvanassche@acm.org>

scsi: ata: Declare SCSI host templates const

Make it explicit that ATA host templates are not modified.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com> (for DWC AHCI SATA)
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com> (for Tegra)
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-5-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 33629d35 09-Sep-2022 Serge Semin <Sergey.Semin@baikalelectronics.ru>

ata: ahci: Add DWC AHCI SATA controller support

Synopsys AHCI SATA controller can work pretty under with the generic
AHCI-platform driver control. But there are vendor-specific peculiarities
which can tune the device performance up and which may need to be fixed up
for proper device functioning. In addition some DWC AHCI-based controllers
may require small platform-specific fixups, so adding them in the generic
AHCI driver would have ruined the code simplicity. Shortly speaking in
order to keep the generic AHCI-platform code clean and have DWC AHCI
SATA-specific features supported we suggest to add a dedicated DWC AHCI
SATA device driver. Aside with the standard AHCI-platform resources
getting, enabling/disabling and the controller registration the new driver
performs the next actions.

First of all there is a way to verify whether the HBA/ports capabilities
activated in OF are correct. Almost all features availability is reflected
in the vendor-specific parameters registers. So the DWC AHCI driver does
the capabilities sanity check based on the corresponding fields state.

Secondly if either the Command Completion Coalescing or the Device Sleep
feature is enabled the DWC AHCI-specific internal 1ms timer must be fixed
in accordance with the application clock signal frequency. In particular
the timer value must be set to be Fapp * 1000. Normally the SoC designers
pre-configure the TIMER1MS register to contain a correct value by default.
But the platforms can support the application clock rate change. If that
happens the 1ms timer value must be accordingly updated otherwise the
dependent features won't work as expected. In the DWC AHCI driver we
suggest to rely on the "aclk" reference clock rate to set the timer
interval up. That clock source is supposed to be the AHCI SATA application
clock in accordance with the DT bindings.

Finally DWC AHCI SATA controller AXI/AHB bus DMA-engine can be tuned up to
transfer up to 1024 * FIFO words at a time by setting the Tx/Rx
transaction size in the DMA control register. The maximum value depends on
the DMA data bus and AXI/AHB bus maximum burst length. In most of the
cases it's better to set the maximum possible value to reach the best AHCI
SATA controller performance. But sometimes in order to improve the system
interconnect responsiveness, transferring in smaller data chunks may be
more preferable. For such cases and for the case when the default value
doesn't provide the best DMA bus performance we suggest to use the new
HBA-port specific DT-properties "snps,{tx,rx}-ts-max" to tune the DMA
transactions size up.

After all the settings denoted above are handled the DWC AHCI SATA driver
proceeds further with the standard AHCI-platform host initializations.

Note since DWC AHCI controller is now have a dedicated driver we can
discard the corresponding compatible string from the ahci-platform.c
module. The same concerns "snps,spear-ahci" compatible string, which is
also based on the DWC AHCI IP-core.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>


# 3f74cd04 09-Sep-2022 Serge Semin <Sergey.Semin@baikalelectronics.ru>

ata: libahci_platform: Parse ports-implemented property in resources getter

The ports-implemented property is mainly used on the OF-based platforms
with no ports mapping initialized by a bootloader/BIOS firmware. Seeing
the same of_property_read_u32()-based pattern has already been implemented
in the generic AHCI LLDD (glue) driver and in the Mediatek, St AHCI
drivers let's move the property read procedure to the generic
ahci_platform_get_resources() method. Thus we'll have the forced ports
mapping feature supported for each OF-based platform which requires that,
and stop re-implementing the same pattern in there a bit simplifying the
code.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>


# 5e776d7b 03-Mar-2022 Geert Uytterhoeven <geert+renesas@glider.be>

ata: Drop commas after OF match table sentinels

It does not make sense to have a comma after a sentinel, as any new
elements must be added before the sentinel.

Add comments to clarify the purpose of the empty elements.
Rewrap entries to a single line to have a consistent style.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Florian Fainelli <f.fainelli@gmail.com> [ahci_brcm]
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>


# 8d7c56d0 20-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 45

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 either version 2 or at your option any
later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 11 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
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/20190520170858.370933192@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 20bdc376 07-Sep-2018 Suman Tripathi <stripathi@amperecomputing.com>

ata: Disable AHCI ALPM feature for Ampere Computing eMAG SATA

Due to hardware errata, Ampere Computing eMAG SATA can't support
AHCI ALPM feature. This patch disables the AHCI ALPM feature for
eMAG SATA.

Signed-off-by: Suman Trpathi <stripathi@amperecomputing.com>
Signed-off-by: Rameshwar Prasad Sahu <rameshwar.sahu@amperecomputing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>


# 2d17f460 22-Aug-2018 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

ata: ahci_platform: enable to get and control reset

Unlike SoC-specific driver, generic ahci_platform driver doesn't
have any chances to control resets.

This adds AHCI_PLATFORM_GET_RESETS to ahci_platform_get_resources()
on the generic driver to enable reset control support.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 16af2d65 22-Aug-2018 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

ata: add an extra argument to ahci_platform_get_resources()

Add an extra argument to ahci_platform_get_resources(), that is
for the bitmap representing the resource to get in this function.

Currently there is no resources to be defined, so all the callers set
'0' to the argument.

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# eac7e072 06-Aug-2018 Tejun Heo <tj@kernel.org>

Revert "ata: ahci_platform: allow disabling of hotplug to save power"

This reverts commit aece27a2f01be4bb7683790f69cd1bed3a0929a2.

Causes boot failure on some devices.

http://lore.kernel.org/r/CA+G9fYuKW_jCFZPqG4tz=QY9ROfHO38KiCp9XTA+KaDOFVtcqQ@mail.gmail.com

Signed-off-by: Tejun Heo <tj@kernel.org>


# 95669844 24-Apr-2018 Krzysztof Kozlowski <krzk@kernel.org>

ata: ahci-platform: Remove support for Exynos5440

The Exynos5440 is not actively developed, there are no development
boards available and probably there are no real products with it.
Remove wide-tree support for Exynos5440.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>


# aece27a2 29-May-2018 Samuel Morris <samorris@lexmark.com>

ata: ahci_platform: allow disabling of hotplug to save power

A number of resources remain powered to support hotplug. On platforms
I've worked with, allowing the ahci_platform to suspend saves about
150mW. This patch enables rpm and allows the device to be auto-suspended
through sysfs.

Signed-off-by: Samuel Morris <samorris@lexmark.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 8eede5bc 20-Jul-2017 Nate Watterson <nwatters@codeaurora.org>

ata: ahci_platform: Add shutdown handler

The newly introduced ahci_platform_shutdown() method is called during
system shutdown to disable host controller DMA and interrupts in order
to avoid potentially corrupting or otherwise interfering with a new
kernel being started with kexec.

Signed-off-by: Nate Watterson <nwatters@codeaurora.org>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 17dcc37e 01-Apr-2016 Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

ata: ahci-platform: Add ports-implemented DT bindings.

On some SOCs PORTS_IMPL register value is never programmed by the
firmware and left at zero value. Which means that no sata ports are
available for software. AHCI driver used to cope up with this by
fabricating the port_map if the PORTS_IMPL register is read zero,
but recent patch broke this workaround as zero value was valid for
NVMe disks.

This patch adds ports-implemented DT bindings as workaround for this issue
in a way that DT can can override the PORTS_IMPL register in cases where
the firmware did not program it already.

Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>


# a2127e40 11-Feb-2016 Aleksey Makarov <aleksey.makarov@caviumnetworks.com>

libata: support AHCI on OCTEON platform

The OCTEON SATA controller is currently found on cn71XX devices.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Vinita Gupta <vgupta@caviumnetworks.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@auriga.com>
Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# fc4f370d 07-Sep-2015 Tang Yuantian <Yuantian.Tang@freescale.com>

Revert "ahci: added support for Freescale AHCI sata"

This reverts commit 5163fb62541e
("ahci: added support for Freescale AHCI sata")

The reverted patch added Freescale QorIQ AHCI sata support to
ahci_platform driver though, but it left SoC specific settings to uboot.
It leads to QorIQ sata heavily depending on uboot. In order to removing
the dependency we first revert the old patch and then will add a new driver
for QorIQ SATA.
Since there are no LS* platforms that have been upstreamed, So
the revert would not break anything exists.

Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 2051e924 06-Jul-2015 Suthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com>

ata: ahci_platform: Add ACPI _CLS matching

This patch adds ACPI supports for AHCI platform driver, which uses _CLS
method to match the device.

The following is an example of ASL structure in DSDT for a SATA controller,
which contains _CLS package to be matched by the ahci_platform driver:

Device (AHC0) // AHCI Controller
{
Name(_HID, "AMDI0600")
Name (_CCA, 1)
Name (_CLS, Package (3)
{
0x01, // Base Class: Mass Storage
0x06, // Sub-Class: serial ATA
0x01, // Interface: AHCI
})
Name (_CRS, ResourceTemplate ()
{
Memory32Fixed (ReadWrite, 0xE0300000, 0x00010000)
Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive,,,) { 387 }
})
}

Also, since ATA driver should not require PCI support for ATA_ACPI,
this patch removes dependency in the driver/ata/Kconfig.

Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


# 5163fb62 04-Jun-2015 Tang Yuantian <Yuantian.Tang@freescale.com>

ahci: added support for Freescale AHCI sata

Freescale introduced QorIQ series SOCs, like ls1021 ls2085, with AHCI
sata support. It complies with the serial ATA 3.0 specification
and the AHCI 1.3 specification.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: Yuantian Tang <Yuantian.Tang@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 018d5ef2 28-Jan-2015 Akinobu Mita <akinobu.mita@gmail.com>

ata: ahci_platform: fix owner module reference mismatch for scsi host

The owner module reference of the ahci platform's scsi_host is
initialized to libahci_platform's one, because these drivers use a
scsi_host_template defined in libahci_platform. So these drivers can
be unloaded even if the scsi device is being accessed.

This fixes it by pushing the scsi_host_template from libahci_platform
to all leaf drivers. The scsi_host_template is passed through a new
argument of ahci_platform_init_host().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: linux-ide@vger.kernel.org
Cc: linux-scsi@vger.kernel.org


# 65c662ab 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

ata: drop owner assignment from platform_drivers

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>


# 515d9b2c 12-Aug-2014 Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

ata: remove deprecated struct ahci_platform_data

The last user of the deprecated struct ahci_platform_data has been
cleaned up recently (SPEAr1340 got a proper PHY driver).

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 30f3c73c 30-Jul-2014 Antoine Tenart <atenart@kernel.org>

ata: ahci_platform: add a generic AHCI compatible

The ahci_platform driver is a generic driver using the libahci_platform
functions. Add a generic compatible to avoid having an endless list of
compatibles with no differences for the same driver.

Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>


# 725c7b57 30-Jul-2014 Antoine Tenart <atenart@kernel.org>

ata: libahci_platform: move port_map parameters into the AHCI structure

This patch moves force_port_map and mask_port_map into the
ahci_host_priv structure. This allows to modify them into the AHCI
framework. This is needed by the new dt bindings representing ports as
the port_map mask is computed automatically.

Parameters modifying force_port_map, mask_port_map and flags have been
removed from the ahci_platform_init_host() function, and inputs in the
ahci_host_priv structure are now directly filed.

Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 72cbaa3d 24-Jun-2014 Kefeng Wang <kefeng.wang@linaro.org>

ahci: disable ncq feature for hisilicon sata

NCQ feature is unsupported on hisilicon sata controller, so disable
it. This version of IP is used by hip04 and hix5hd2 soc.

tj: "|=" was replaced with "=" for no reason. Restored "|=".

Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Sigend-off-by: Tejun Heo <tj@kernel.org>


# a1a205df 14-May-2014 Kefeng Wang <kefeng.wang@linaro.org>

ahci: add support for Hisilicon sata

The hip04 SoC of hisilicon has an AHCI compliant SATA controller,
and it is compliant with the ahci 1.3 and sata 3.0 specification.

There is a wrong bit in HOST_CAP of hip04 sata controller, which
enable unsupported feature of FBS, use AHCI_HFLAG_NO_FBS hflag to
disable it.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>


# f9f36917 14-May-2014 Kefeng Wang <kefeng.wang@linaro.org>

libahci_platform: add host_flags parameter in ahci_platform_init_host()

Add a dynamic host_flags argument to make ahci_platform_init_host more flexible,
then remove the AHCI_HFLAGS(...) argument from some driver's ata_port_info,
and pass that in as the new argument.

Cc: Hans de Geode <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kefeng Wang <kefeng.wang@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>


# fd990556 25-Mar-2014 Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

ata: move library code from ahci_platform.c to libahci_platform.c

Move AHCI platform library code from ahci_platform.c to
libahci_platform.c and fix dependencies for ahci_st,
ahci_imx and ahci_sunxi drivers.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 83b03fd6 25-Mar-2014 Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

ata: ahci_platform: fix ahci_platform_data->suspend method handling

Looking at ST SPEAr1340 AHCI code (the only user of the deprecated
pdata->suspend and pdata->resume) it is obvious the we should return
after calling pdata->suspend() only if the function have returned
non-zero return value. The code has been broken since commit 1e70c2
("ata/ahci_platform: Add clock framework support"). Fix it.

Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Shiraz Hashim <shiraz.hashim@st.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 5434b203 14-Mar-2014 Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

ata: ahci_platform: fix devm_ioremap_resource() return value checking

devm_ioremap_resource() returns a pointer to the remapped memory or
an ERR_PTR() encoded error code on failure. Fix the check inside
ahci_platform_get_resources() accordingly.

Also while at it remove a needless line break.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 6ef95e87 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci_platform: Drop unused ahci_platform_data members

These members are not used anywhere, and in the future we want
ahci_platform_data to go away entirely so there is no reason to keep these
around.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# c093e1d3 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci_platform: Drop support for imx53-ahci platform device type

Since the 3.13 release the ahci_imx driver has proper devicetree enabled
support for ahci on imx53 and that is used instead of the old board file
created imx53-ahci platform device.

Note this patch also complete drops the id-table, an id-table is not needed
for a single id platform driver, the name field in the driver struct suffices.

And the code already has an explicit "MODULE_ALIAS("platform:ahci");" so the
id-table is not needed for that either.

Cc: Marek Vasut <marex@denx.de>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# f1df8641 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci_platform: Drop support for ahci-strict platform device type

I've done a grep over the entire kernel tree and nothing is using this
(anymore?).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# e708e46e 22-Feb-2014 Roger Quadros <rogerq@ti.com>

ata: ahci_platform: runtime resume the device before use

On OMAP platforms the device needs to be runtime resumed before it can
be accessed. The OMAP HWMOD framework takes care of enabling the
module and its resources based on the device's runtime PM state.

In this patch we runtime resume during .probe() and runtime suspend
after .remove().

We also update the runtime PM state during .resume().

CC: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 21b5faee 22-Feb-2014 Roger Quadros <rogerq@ti.com>

ata: ahci_platform: Manage SATA PHY

Some platforms have a PHY hooked up to the SATA controller. The PHY
needs to be initialized and powered up for SATA to work. We do that
using the PHY framework.

tj: Minor comment formatting updates.

CC: Balaji T K <balajitk@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo<tj@kernel.org>


# c4311471 22-Feb-2014 Roger Quadros <rogerq@ti.com>

ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller

Add compatible string "snps,dwc-ahci", which should be used
for Synopsis Designware SATA cores. e.g. on TI OMAP5 and DRA7 platforms.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 648cb6fd 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci-platform: "Library-ise" suspend / resume functionality

Split suspend / resume code into host suspend / resume functionality and
resource enable / disabling phases, and export the new suspend_ / resume_host
functions.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 23b07d4c 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci-platform: "Library-ise" ahci_probe functionality

ahci_probe consists of 3 steps:
1) Get resources (get mmio, clks, regulator)
2) Enable resources, handled by ahci_platform_enable_resouces
3) The more or less standard ahci-host controller init sequence

This commit refactors step 1 and 3 into separate functions, so the platform
drivers for AHCI implementations which need a specific order in step 2,
and / or need to do some custom register poking at some time, can re-use
ahci-platform.c code without needing to copy and paste it.

Note that ahci_platform_init_host's prototype takes the 3 non function
members of ahci_platform_data as arguments, the idea is that drivers using
the new exported utility functions will not use ahci_platform_data at all,
and hopefully in the future ahci_platform_data can go away entirely.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 96a01ba5 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci-platform: Add enable_ / disable_resources helper functions

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 4b3e603a 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci-platform: Add support for an optional regulator for sata-target power

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 156c5887 22-Feb-2014 Hans de Goede <hdegoede@redhat.com>

ahci-platform: Add support for devices with more then 1 clock

The allwinner-sun4i AHCI controller needs 2 clocks to be enabled and the
imx AHCI controller needs 3 clocks to be enabled.

tj: Minor comment formatting updates.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 1bc18086 21-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

ata: delete non-required instances of include <linux/init.h>

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>


# 2435dcb9 21-Nov-2013 Alistair Popple <alistair@popple.id.au>

ahci: add support for IBM Akebono platform device

The new IBM Akebono board has a PPC476GTR SoC with an AHCI compliant
SATA controller. This patch adds a compatible property for the new SoC
to the AHCI platform driver.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org


# 8b789d89 14-Oct-2013 Richard Zhu <r65037@freescale.com>

ahci: imx: setup power saving methods

In order to save power consumption as much as possible.

* Disable sata phy internal pll reference clock when sysetem enter
into suspend mode, enable it after resume.

* Setup module parameter used to enable imx ahci test power down
mode(PDDQ) or not, when there is no device detected on the port

* minor modifications:
- The format of the copyright is changed, because that the original
one can't pass fsl internal patch reivew without the character
'(c)'.
- Exports ahci_platform_ops and ahci_error_handler().

NOTE:
* The hot-plug can't be supported when PDDQ mode is ever enabled.

* module parameter usage how-to:
- default: enable PDDQ mode when no device detected.
- add "ahci-imx.hotplug=1" into kernel command line if your don't
want to enable PDDQ mode when no device detected on the port.

tj: Slightly updated description and comments.

Signed-off-by: Richard Zhu <r65037@freescale.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 0fed4c09 04-Oct-2013 Jingoo Han <jg1.han@samsung.com>

ahci_platform: use dev_info() instead of printk()

Change "raw" printk() call to dev_info() to provide a better
message to userspace so it can properly identify the device
and not just have to guess.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 1e8f5f76 16-Apr-2013 Girish K S <girishks2000@gmail.com>

ahci: sata: add support for exynos5440 sata

This patch adds the compatible string of the exynos5440 sata controller
compliant with the ahci 1.3 and sata 3.0 specification.

changes in v2:
changed the compatible string by adding the actual IP
owners name instead of the SoC vendor name.

Signed-off-by: Girish K S <ks.giri@samsung.com>
Signed-off-by: Tejun Heo <tj@kernel.org>


# 0ec24914 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Drivers: ata: remove __dev* attributes.

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>


# 071d3ad3 06-Dec-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: make structs static

These structs are used only for ahci_platform.c, so they should be
static. Thanks to Fengguang for the (automated) suggestion.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 83291d65 02-Nov-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: utilize common ata_platform_remove_one()

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 1896b15e 02-Nov-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: perform platform exit in host_stop() hook

AHCI platform devices may provide an exit() routine, via
ahci_platform_data, that powers off the SATA core. Such a routine should
be executed from the ata_port_operations host_stop() hook. That way, the
ATA subsystem can perform any last-minute hardware cleanup (via devres,
for example), then trigger the power-off at the appropriate time.

This patch fixes bus errors triggered during module removal or device
unbinding, seen on an SoC SATA core.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 9a99e476 02-Nov-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: convert to module_platform_driver

The ahci_platform driver can now use the module_platform_driver() macro.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 941c77fd 02-Nov-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: enable hotplug unbinding

platform_driver_probe() should be used for registering this driver only
if we want to

"...remove its run-once probe() infrastructure from memory after the
driver has bound to the device."

However, we may want to leave the probe infrastructure in place in order
to support binding/unbinding a device dynamically. This is useful, for
instance, as a power management mechanism, where a device can be totally
powered down when unbound (whereas with runtime power management,
powering down the SATA core would incur unacceptable loss of
functionality).

Thus, convert this driver to use platform_driver_register().

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 29448ec1 16-Oct-2012 Yuanhan Liu <yuanhan.liu@linux.intel.com>

[libata] PM callbacks should be conditionally compiled on CONFIG_PM_SLEEP

This will fix warnings like following when CONFIG_PM_SLEEP is not set:

warning: 'xxx_suspend' defined but not used [-Wunused-function]
warning: 'xxx_resume' defined but not used [-Wunused-function]

Because
SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)

Only references the callbacks on CONFIG_PM_SLEEP (instead of CONFIG_PM).

Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: linux-ide@vger.kernel.org
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# f1e70c2c 26-Aug-2012 Viresh Kumar <viresh.kumar@linaro.org>

ata/ahci_platform: Add clock framework support

On many architectures, drivers are supposed to prepare/unprepare &
enable/disable functional clock of device. This patch adds clock support for
ahci_platform.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 8996b89d 06-Sep-2012 Mark Langsdorf <mark.langsdorf@calxeda.com>

ata: add platform driver for Calxeda AHCI controller

Calxeda highbank SATA phy has intermittent problems bringing up a link
with Gen3 drives. Retrying the phy hard reset can work-around this issue,
but each reset also disables spread spectrum support. The reset function
also needs to reprogram the phy to enable spread spectrum support.

Create a new driver based on ahci_platform to support the Calxeda Highbank
SATA controller.

Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 18c25ff4 16-Mar-2012 Shiraz Hashim <shiraz.linux.kernel@gmail.com>

ahci_platform: add hibernation callbacks

Use existing suspend, resume implementation for hibernation callbacks.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 5f098a3e 21-Apr-2012 Viresh Kumar <vireshk@kernel.org>

ata: ahci_platform: Add synopsys ahci controller in DT's compatible list

SPEAr13xx series of SoCs contain Synopsys AHCI SATA Controller which shares
ahci_platform driver with other controller versions.

This patch updates DT compatible list for ahci_platform. It also updates and
renames binding documentation to more generic name.

Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# d408e2b1 21-Feb-2012 Brian Norris <computersforpeace@gmail.com>

ahci_platform: add STRICT_AHCI platform type

Some platforms need to make use of the AHCI_HFLAG_DELAY_ENGINE flag.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Cc: stable@kernel.org


# 17ab594f 18-Nov-2011 Brian Norris <computersforpeace@gmail.com>

ahci: platform support for suspend/resume

Add platform hooks for custom suspend() and resume() functions. The
generic suspend/resume code in drivers/ata/ahci_platform.c is adapted
from the PCI version in drivers/ata/ahci.c.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# ff956135 15-Nov-2011 Rob Herring <rob.herring@calxeda.com>

[libata] ahci_platform: fix DT probing

The change in commit 904c04feaf13ed "ahci_platform: Add the board_ids..."
doesn't work for the DT probing case as platform_get_device_id returns
NULL. Pick the default ahci_port_info in this case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: Richard Zhu <richard.zhu@linaro.org>
Cc: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 00345614 31-Oct-2011 JiSheng Zhang <jszhang3@gmail.com>

ahci_platform: use dev_get_platdata()

Use dev_get_platdata() to retrieve the struct ahci_platform_data data
from the platform.

Signed-off-by: JiSheng Zhang <jszhang3@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 02aac316 03-Nov-2010 Rob Herring <rob.herring@calxeda.com>

ahci: add DT binding for Calxeda AHCI controller

Add devicetree match table to ahci platform driver for Calxeda Highbank
AHCI controller.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org


# 904c04fe 28-Sep-2011 Richard Zhu <richard.zhu@linaro.org>

[libata] ahci_platform: Add the board_ids and pi refer to different features

On imx53 AHCI, soft reset fails with IPMS set when PMP
is enabled but SATA HDD/ODD is connected to SATA port,
do soft reset again to port 0.
So the 'ahci_pmp_retry_srst_ops' is required when imx53
ahci is present.

Signed-off-by: Richard Zhu <richard.zhu@linaro.org>
Acked-by: Eric Miao <eric.miao@linaro.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 6b7ae954 01-Sep-2010 Tejun Heo <tj@kernel.org>

libata: reimplement link power management

The current LPM implementation has the following issues.

* Operation order isn't well thought-out. e.g. HIPM should be
configured after IPM in SControl is properly configured. Not the
other way around.

* Suspend/resume paths call ata_lpm_enable/disable() which must only
be called from EH context directly. Also, ata_lpm_enable/disable()
were called whether LPM was in use or not.

* Implementation is per-port when it should be per-link. As a result,
it can't be used for controllers with slave links or PMP.

* LPM state isn't managed consistently. After a link reset for
whatever reason including suspend/resume the actual LPM state would
be reset leaving ap->lpm_policy inconsistent.

* Generic/driver-specific logic boundary isn't clear. Currently,
libahci has to mangle stuff which libata EH proper should be
handling. This makes the implementation unnecessarily complex and
fragile.

* Tied to ALPM. Doesn't consider DIPM only cases and doesn't check
whether the device allows HIPM.

* Error handling isn't implemented.

Given the extent of mismatch with the rest of libata, I don't think
trying to fix it piecewise makes much sense. This patch reimplements
LPM support.

* The new implementation is per-link. The target policy is still
port-wide (ap->target_lpm_policy) but all the mechanisms and states
are per-link and integrate well with the rest of link abstraction
and can work with slave and PMP links.

* Core EH has proper control of LPM state. LPM state is reconfigured
when and only when reconfiguration is necessary. It makes sure that
LPM state is reset when probing for new device on the link.
Controller agnostic logic is now implemented in libata EH proper and
driver implementation only has to deal with controller specifics.

* Proper error handling. LPM config failure is attributed to the
device on the link and LPM is disabled for the link if it fails
repeatedly.

* ops->enable/disable_pm() are replaced with single ops->set_lpm()
which takes @policy and @hints. This simplifies driver specific
implementation.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# c93b263e 01-Sep-2010 Tejun Heo <tj@kernel.org>

libata: clean up lpm related symbols and sysfs show/store functions

Link power management related symbols are in confusing state w/ mixed
usages of lpm, ipm and pm. This patch cleans up lpm related symbols
and sysfs show/store functions as follows.

* lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and
MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and
ATA_LPM_{MIN|MAX|MED}_POWER.

* Pre/postfixes are unified to lpm.

* sysfs show/store functions for link_power_management_policy were
curiously named get/put and unnecessarily complex. Renamed to
show/store and simplified.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# fad16e7a 21-Sep-2010 Tejun Heo <htejun@gmail.com>

ahci: fix module refcount breakage introduced by libahci split

libata depends on scsi_host_template for module reference counting and
sht's should be owned by each low level driver. During libahci split,
the sht was left with libahci.ko leaving the actual low level drivers
not reference counted. This made ahci and ahci_platform always
unloadable even while they're being actively used.

Fix it by defining AHCI_SHT() macro in ahci.h and defining a sht for
each low level ahci driver.

stable: only applicable to 2.6.35.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Pedro Francisco <pedrogfrancisco@gmail.com>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: stable@kernel.org
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# da10a200 25-Jun-2010 Anton Vorontsov <avorontsov@mvista.com>

ahci_platform: Remove unneeded ahci_driver.probe assignment

The driver is using platform_driver_probe() during initialization,
so ahci_driver.probe hook is never used.

But it causes the following (harmless, luckily) section mismatch:

WARNING: vmlinux.o(.data+0x2fb20): Section mismatch in reference
from the variable ahci_driver to the function .init.text:ahci_probe()

This patch removes the ahci_driver.probe assignment, thus fixes
the warning.

p.s. Note that there's another patch[1] from Rene Bolldorf that
tried to solve the same issue by __refdata annotation. __refdata
says that this reference is actually OK, but in fact it is not OK,
because dereferencing .probe() will cause problems. So the proper
fix is to remove the assignment.

[1] http://kerneltrap.org/mailarchive/linux-kernel/2010/3/18/4549547

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 08354809 25-Jun-2010 Jassi Brar <jassi.brar@samsung.com>

ahci_platform: Provide for vendor specific init

Some AHCI implementations may use Vendor Specific HBA[A0h, FFh]
and/or Port[70h, 7Fh] registers to 'prepare' for initialization.
For that, the platform needs memory mapped address of AHCI registers.

This patch adds the 'mmio' argument and reorders the call to
platform init function.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 55787183 14-May-2010 Jeff Garzik <jeff@garzik.org>

ahci_platform: properly set up EM messaging

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# fbaf666b 29-Mar-2010 Tejun Heo <tj@kernel.org>

libata: update gfp/slab.h includes

Implicit slab.h inclusion via percpu.h is about to go away. Make sure
gfp.h or slab.h is included as necessary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>


# 1c2a49f6 04-Mar-2010 Anton Vorontsov <avorontsov@ru.mvista.com>

ahci: Add platform driver

This can be used for AHCI-compatible interfaces implemented inside
System-On-Chip solutions, or AHCI devices connected via localbus.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>