Commit a23867f1 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata

Pull libata updates from Tejun Heo:
 "Nothing too interesting.

  The biggest change is refcnting fix for ata_host - the bug is recent
  and can only be triggered on controller hotplug, so very few are
  hitting it.

  There also are a number of trivial license / error message changes and
  some hardware specific changes"

* 'for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (23 commits)
  ahci: imx: add the imx8qm ahci sata support
  libata: ensure host is free'd on error exit paths
  ata: ahci-platform: add reset control support
  ahci: imx: fix the build warning
  ata: add Amiga Gayle PATA controller driver
  ahci: imx: add the imx6qp ahci sata support
  ata: change Tegra124 to Tegra
  ata: ahci_tegra: Add AHCI support for Tegra210
  ata: ahci_tegra: disable DIPM
  ata: ahci_tegra: disable devslp for Tegra124
  ata: ahci_tegra: initialize regulators from soc struct
  ata: ahci_tegra: Update initialization sequence
  dt-bindings: Tegra210: add binding documentation
  libata: add refcounting to ata_host
  pata_bk3710: clarify license version and use SPDX header
  pata_falcon: clarify license version and use SPDX header
  pata_it821x: Delete an error message for a failed memory allocation in it821x_firmware_command()
  pata_macio: Delete an error message for a failed memory allocation in two functions
  pata_mpc52xx: Delete an error message for a failed memory allocation in mpc52xx_ata_probe()
  sata_dwc_460ex: Delete an error message for a failed memory allocation in sata_dwc_port_start()
  ...
parents ef1c4a6f 027fa4de
...@@ -30,6 +30,7 @@ compatible: ...@@ -30,6 +30,7 @@ compatible:
Optional properties: Optional properties:
- dma-coherent : Present if dma operations are coherent - dma-coherent : Present if dma operations are coherent
- clocks : a list of phandle + clock specifier pairs - clocks : a list of phandle + clock specifier pairs
- resets : a list of phandle + reset specifier pairs
- target-supply : regulator for SATA target power - target-supply : regulator for SATA target power
- phys : reference to the SATA PHY node - phys : reference to the SATA PHY node
- phy-names : must be "sata-phy" - phy-names : must be "sata-phy"
......
...@@ -7,6 +7,7 @@ Required properties: ...@@ -7,6 +7,7 @@ Required properties:
- compatible : should be one of the following: - compatible : should be one of the following:
- "fsl,imx53-ahci" for i.MX53 SATA controller - "fsl,imx53-ahci" for i.MX53 SATA controller
- "fsl,imx6q-ahci" for i.MX6Q SATA controller - "fsl,imx6q-ahci" for i.MX6Q SATA controller
- "fsl,imx6qp-ahci" for i.MX6QP SATA controller
- interrupts : interrupt mapping for SATA IRQ - interrupts : interrupt mapping for SATA IRQ
- reg : registers mapping - reg : registers mapping
- clocks : list of clock specifiers, must contain an entry for each - clocks : list of clock specifiers, must contain an entry for each
......
Tegra124 SoC SATA AHCI controller Tegra SoC SATA AHCI controller
Required properties : Required properties :
- compatible : For Tegra124, must contain "nvidia,tegra124-ahci". Otherwise, - compatible : Must be one of:
must contain '"nvidia,<chip>-ahci", "nvidia,tegra124-ahci"', where <chip> - Tegra124 : "nvidia,tegra124-ahci"
is tegra132. - Tegra132 : "nvidia,tegra132-ahci", "nvidia,tegra124-ahci"
- Tegra210 : "nvidia,tegra210-ahci"
- reg : Should contain 2 entries: - reg : Should contain 2 entries:
- AHCI register set (SATA BAR5) - AHCI register set (SATA BAR5)
- SATA register set - SATA register set
...@@ -13,8 +14,6 @@ Required properties : ...@@ -13,8 +14,6 @@ Required properties :
- clock-names : Must include the following entries: - clock-names : Must include the following entries:
- sata - sata
- sata-oob - sata-oob
- cml1
- pll_e
- resets : Must contain an entry for each entry in reset-names. - resets : Must contain an entry for each entry in reset-names.
See ../reset/reset.txt for details. See ../reset/reset.txt for details.
- reset-names : Must include the following entries: - reset-names : Must include the following entries:
...@@ -24,9 +23,22 @@ Required properties : ...@@ -24,9 +23,22 @@ Required properties :
- phys : Must contain an entry for each entry in phy-names. - phys : Must contain an entry for each entry in phy-names.
See ../phy/phy-bindings.txt for details. See ../phy/phy-bindings.txt for details.
- phy-names : Must include the following entries: - phy-names : Must include the following entries:
- sata-phy : XUSB PADCTL SATA PHY - For Tegra124 and Tegra132:
- hvdd-supply : Defines the SATA HVDD regulator - sata-phy : XUSB PADCTL SATA PHY
- vddio-supply : Defines the SATA VDDIO regulator - For Tegra124 and Tegra132:
- avdd-supply : Defines the SATA AVDD regulator - hvdd-supply : Defines the SATA HVDD regulator
- target-5v-supply : Defines the SATA 5V power regulator - vddio-supply : Defines the SATA VDDIO regulator
- target-12v-supply : Defines the SATA 12V power regulator - avdd-supply : Defines the SATA AVDD regulator
- target-5v-supply : Defines the SATA 5V power regulator
- target-12v-supply : Defines the SATA 12V power regulator
Optional properties:
- reg :
- AUX register set
- clock-names :
- cml1 :
cml1 clock should be defined here if the PHY driver
doesn't manage them. If it does, they should not be.
- phy-names :
- For T210:
- sata-phy
...@@ -211,10 +211,10 @@ config AHCI_SUNXI ...@@ -211,10 +211,10 @@ config AHCI_SUNXI
If unsure, say N. If unsure, say N.
config AHCI_TEGRA config AHCI_TEGRA
tristate "NVIDIA Tegra124 AHCI SATA support" tristate "NVIDIA Tegra AHCI SATA support"
depends on ARCH_TEGRA depends on ARCH_TEGRA
help help
This option enables support for the NVIDIA Tegra124 SoC's This option enables support for the NVIDIA Tegra SoC's
onboard AHCI SATA. onboard AHCI SATA.
If unsure, say N. If unsure, say N.
...@@ -954,6 +954,18 @@ config PATA_FALCON ...@@ -954,6 +954,18 @@ config PATA_FALCON
If unsure, say N. If unsure, say N.
config PATA_GAYLE
tristate "Amiga Gayle PATA support"
depends on M68K && AMIGA
help
This option enables support for the on-board IDE
interfaces on some Amiga models (A600, A1200,
A4000 and A4000T) and also for IDE interfaces on
the Zorro expansion bus (M-Tech E-Matrix 530
expansion card).
If unsure, say N.
config PATA_ISAPNP config PATA_ISAPNP
tristate "ISA Plug and Play PATA support" tristate "ISA Plug and Play PATA support"
depends on ISAPNP depends on ISAPNP
......
...@@ -97,6 +97,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o ...@@ -97,6 +97,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o
# SFF PIO only # SFF PIO only
obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o
obj-$(CONFIG_PATA_FALCON) += pata_falcon.o obj-$(CONFIG_PATA_FALCON) += pata_falcon.o
obj-$(CONFIG_PATA_GAYLE) += pata_gayle.o
obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o
obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o
obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o
......
...@@ -350,6 +350,7 @@ struct ahci_host_priv { ...@@ -350,6 +350,7 @@ struct ahci_host_priv {
u32 em_msg_type; /* EM message type */ u32 em_msg_type; /* EM message type */
bool got_runtime_pm; /* Did we do pm_runtime_get? */ bool got_runtime_pm; /* Did we do pm_runtime_get? */
struct clk *clks[AHCI_MAX_CLKS]; /* Optional */ struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
struct reset_control *rsts; /* Optional */
struct regulator **target_pwrs; /* Optional */ struct regulator **target_pwrs; /* Optional */
/* /*
* If platform uses PHYs. There is a 1:1 relation between the port number and * If platform uses PHYs. There is a 1:1 relation between the port number and
......
This diff is collapsed.
This diff is collapsed.
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/phy/phy.h> #include <linux/phy/phy.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/reset.h>
#include "ahci.h" #include "ahci.h"
static void ahci_host_stop(struct ata_host *host); static void ahci_host_stop(struct ata_host *host);
...@@ -195,7 +196,8 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators); ...@@ -195,7 +196,8 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators);
* following order: * following order:
* 1) Regulator * 1) Regulator
* 2) Clocks (through ahci_platform_enable_clks) * 2) Clocks (through ahci_platform_enable_clks)
* 3) Phys * 3) Resets
* 4) Phys
* *
* If resource enabling fails at any point the previous enabled resources * If resource enabling fails at any point the previous enabled resources
* are disabled in reverse order. * are disabled in reverse order.
...@@ -215,12 +217,19 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv) ...@@ -215,12 +217,19 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv)
if (rc) if (rc)
goto disable_regulator; goto disable_regulator;
rc = ahci_platform_enable_phys(hpriv); rc = reset_control_deassert(hpriv->rsts);
if (rc) if (rc)
goto disable_clks; goto disable_clks;
rc = ahci_platform_enable_phys(hpriv);
if (rc)
goto disable_resets;
return 0; return 0;
disable_resets:
reset_control_assert(hpriv->rsts);
disable_clks: disable_clks:
ahci_platform_disable_clks(hpriv); ahci_platform_disable_clks(hpriv);
...@@ -239,12 +248,15 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources); ...@@ -239,12 +248,15 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources);
* following order: * following order:
* 1) Phys * 1) Phys
* 2) Clocks (through ahci_platform_disable_clks) * 2) Clocks (through ahci_platform_disable_clks)
* 3) Regulator * 3) Resets
* 4) Regulator
*/ */
void ahci_platform_disable_resources(struct ahci_host_priv *hpriv) void ahci_platform_disable_resources(struct ahci_host_priv *hpriv)
{ {
ahci_platform_disable_phys(hpriv); ahci_platform_disable_phys(hpriv);
reset_control_assert(hpriv->rsts);
ahci_platform_disable_clks(hpriv); ahci_platform_disable_clks(hpriv);
ahci_platform_disable_regulators(hpriv); ahci_platform_disable_regulators(hpriv);
...@@ -393,6 +405,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) ...@@ -393,6 +405,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev)
hpriv->clks[i] = clk; hpriv->clks[i] = clk;
} }
hpriv->rsts = devm_reset_control_array_get_optional_shared(dev);
if (IS_ERR(hpriv->rsts)) {
rc = PTR_ERR(hpriv->rsts);
goto err_out;
}
hpriv->nports = child_nodes = of_get_child_count(dev->of_node); hpriv->nports = child_nodes = of_get_child_count(dev->of_node);
/* /*
......
...@@ -6026,7 +6026,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ...@@ -6026,7 +6026,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
return ap; return ap;
} }
static void ata_host_release(struct device *gendev, void *res) static void ata_devres_release(struct device *gendev, void *res)
{ {
struct ata_host *host = dev_get_drvdata(gendev); struct ata_host *host = dev_get_drvdata(gendev);
int i; int i;
...@@ -6040,13 +6040,36 @@ static void ata_host_release(struct device *gendev, void *res) ...@@ -6040,13 +6040,36 @@ static void ata_host_release(struct device *gendev, void *res)
if (ap->scsi_host) if (ap->scsi_host)
scsi_host_put(ap->scsi_host); scsi_host_put(ap->scsi_host);
}
dev_set_drvdata(gendev, NULL);
ata_host_put(host);
}
static void ata_host_release(struct kref *kref)
{
struct ata_host *host = container_of(kref, struct ata_host, kref);
int i;
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
kfree(ap->pmp_link); kfree(ap->pmp_link);
kfree(ap->slave_link); kfree(ap->slave_link);
kfree(ap); kfree(ap);
host->ports[i] = NULL; host->ports[i] = NULL;
} }
kfree(host);
}
dev_set_drvdata(gendev, NULL); void ata_host_get(struct ata_host *host)
{
kref_get(&host->kref);
}
void ata_host_put(struct ata_host *host)
{
kref_put(&host->kref, ata_host_release);
} }
/** /**
...@@ -6074,26 +6097,31 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports) ...@@ -6074,26 +6097,31 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports)
struct ata_host *host; struct ata_host *host;
size_t sz; size_t sz;
int i; int i;
void *dr;
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
if (!devres_open_group(dev, NULL, GFP_KERNEL))
return NULL;
/* alloc a container for our list of ATA ports (buses) */ /* alloc a container for our list of ATA ports (buses) */
sz = sizeof(struct ata_host) + (max_ports + 1) * sizeof(void *); sz = sizeof(struct ata_host) + (max_ports + 1) * sizeof(void *);
/* alloc a container for our list of ATA ports (buses) */ host = kzalloc(sz, GFP_KERNEL);
host = devres_alloc(ata_host_release, sz, GFP_KERNEL);
if (!host) if (!host)
return NULL;
if (!devres_open_group(dev, NULL, GFP_KERNEL))
goto err_free;
dr = devres_alloc(ata_devres_release, 0, GFP_KERNEL);
if (!dr)
goto err_out; goto err_out;
devres_add(dev, host); devres_add(dev, dr);
dev_set_drvdata(dev, host); dev_set_drvdata(dev, host);
spin_lock_init(&host->lock); spin_lock_init(&host->lock);
mutex_init(&host->eh_mutex); mutex_init(&host->eh_mutex);
host->dev = dev; host->dev = dev;
host->n_ports = max_ports; host->n_ports = max_ports;
kref_init(&host->kref);
/* allocate ports bound to this host */ /* allocate ports bound to this host */
for (i = 0; i < max_ports; i++) { for (i = 0; i < max_ports; i++) {
...@@ -6112,6 +6140,8 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports) ...@@ -6112,6 +6140,8 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports)
err_out: err_out:
devres_release_group(dev, NULL); devres_release_group(dev, NULL);
err_free:
kfree(host);
return NULL; return NULL;
} }
......
...@@ -224,6 +224,8 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class, ...@@ -224,6 +224,8 @@ static DECLARE_TRANSPORT_CLASS(ata_port_class,
static void ata_tport_release(struct device *dev) static void ata_tport_release(struct device *dev)
{ {
struct ata_port *ap = tdev_to_port(dev);
ata_host_put(ap->host);
} }
/** /**
...@@ -284,6 +286,7 @@ int ata_tport_add(struct device *parent, ...@@ -284,6 +286,7 @@ int ata_tport_add(struct device *parent,
dev->type = &ata_port_type; dev->type = &ata_port_type;
dev->parent = parent; dev->parent = parent;
ata_host_get(ap->host);
dev->release = ata_tport_release; dev->release = ata_tport_release;
dev_set_name(dev, "ata%d", ap->print_id); dev_set_name(dev, "ata%d", ap->print_id);
transport_setup_device(dev); transport_setup_device(dev);
...@@ -314,6 +317,7 @@ int ata_tport_add(struct device *parent, ...@@ -314,6 +317,7 @@ int ata_tport_add(struct device *parent,
tport_err: tport_err:
transport_destroy_device(dev); transport_destroy_device(dev);
put_device(dev); put_device(dev);
ata_host_put(ap->host);
return error; return error;
} }
......
...@@ -100,6 +100,8 @@ extern int ata_port_probe(struct ata_port *ap); ...@@ -100,6 +100,8 @@ extern int ata_port_probe(struct ata_port *ap);
extern void __ata_port_probe(struct ata_port *ap); extern void __ata_port_probe(struct ata_port *ap);
extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log, extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
u8 page, void *buf, unsigned int sectors); u8 page, void *buf, unsigned int sectors);
extern void ata_host_get(struct ata_host *host);
extern void ata_host_put(struct ata_host *host);
#define to_ata_port(d) container_of(d, struct ata_port, tdev) #define to_ata_port(d) container_of(d, struct ata_port, tdev)
......
...@@ -796,7 +796,7 @@ static int arasan_cf_probe(struct platform_device *pdev) ...@@ -796,7 +796,7 @@ static int arasan_cf_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
u32 quirk; u32 quirk;
irq_handler_t irq_handler = NULL; irq_handler_t irq_handler = NULL;
int ret = 0; int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) if (!res)
...@@ -809,10 +809,8 @@ static int arasan_cf_probe(struct platform_device *pdev) ...@@ -809,10 +809,8 @@ static int arasan_cf_probe(struct platform_device *pdev)
} }
acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL); acdev = devm_kzalloc(&pdev->dev, sizeof(*acdev), GFP_KERNEL);
if (!acdev) { if (!acdev)
dev_warn(&pdev->dev, "kzalloc fail\n");
return -ENOMEM; return -ENOMEM;
}
if (pdata) if (pdata)
quirk = pdata->quirk; quirk = pdata->quirk;
......
// SPDX-License-Identifier: GPL-2.0
/* /*
* Palmchip BK3710 PATA controller driver * Palmchip BK3710 PATA controller driver
* *
...@@ -8,10 +10,6 @@ ...@@ -8,10 +10,6 @@
* *
* Copyright (C) 2006 Texas Instruments. * Copyright (C) 2006 Texas Instruments.
* Copyright (C) 2007 MontaVista Software, Inc., <source@mvista.com> * Copyright (C) 2007 MontaVista Software, Inc., <source@mvista.com>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/ */
#include <linux/ata.h> #include <linux/ata.h>
...@@ -379,4 +377,4 @@ static int __init pata_bk3710_init(void) ...@@ -379,4 +377,4 @@ static int __init pata_bk3710_init(void)
} }
module_init(pata_bk3710_init); module_init(pata_bk3710_init);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL v2");
// SPDX-License-Identifier: GPL-2.0
/* /*
* Atari Falcon PATA controller driver * Atari Falcon PATA controller driver
* *
...@@ -7,10 +9,6 @@ ...@@ -7,10 +9,6 @@
* Based on falconide.c: * Based on falconide.c:
* *
* Created 12 Jul 1997 by Geert Uytterhoeven * Created 12 Jul 1997 by Geert Uytterhoeven
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -180,5 +178,5 @@ module_init(pata_falcon_init_one); ...@@ -180,5 +178,5 @@ module_init(pata_falcon_init_one);
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
MODULE_DESCRIPTION("low-level driver for Atari Falcon PATA"); MODULE_DESCRIPTION("low-level driver for Atari Falcon PATA");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL v2");
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
// SPDX-License-Identifier: GPL-2.0
/*
* Amiga Gayle PATA controller driver
*
* Copyright (c) 2018 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Based on gayle.c:
*
* Created 12 Jul 1997 by Geert Uytterhoeven
*/
#include <linux/ata.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/libata.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/zorro.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include <asm/amigahw.h>
#include <asm/amigaints.h>
#include <asm/amigayle.h>
#include <asm/ide.h>
#include <asm/setup.h>
#define DRV_NAME "pata_gayle"
#define DRV_VERSION "0.1.0"
#define GAYLE_CONTROL 0x101a
static struct scsi_host_template pata_gayle_sht = {
ATA_PIO_SHT(DRV_NAME),
};
/* FIXME: is this needed? */
static unsigned int pata_gayle_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf,
unsigned int buflen, int rw)
{
struct ata_device *dev = qc->dev;
struct ata_port *ap = dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1;
/* Transfer multiple of 2 bytes */
if (rw == READ)
raw_insw((u16 *)data_addr, (u16 *)buf, words);
else
raw_outsw((u16 *)data_addr, (u16 *)buf, words);
/* Transfer trailing byte, if any. */
if (unlikely(buflen & 0x01)) {
unsigned char pad[2] = { };
/* Point buf to the tail of buffer */
buf += buflen - 1;
if (rw == READ) {
raw_insw((u16 *)data_addr, (u16 *)pad, 1);
*buf = pad[0];
} else {
pad[0] = *buf;
raw_outsw((u16 *)data_addr, (u16 *)pad, 1);
}
words++;
}
return words << 1;
}
/*
* Provide our own set_mode() as we don't want to change anything that has
* already been configured..
*/
static int pata_gayle_set_mode(struct ata_link *link,
struct ata_device **unused)
{
struct ata_device *dev;
ata_for_each_dev(dev, link, ENABLED) {
/* We don't really care */
dev->pio_mode = dev->xfer_mode = XFER_PIO_0;
dev->xfer_shift = ATA_SHIFT_PIO;
dev->flags |= ATA_DFLAG_PIO;
ata_dev_info(dev, "configured for PIO\n");
}
return 0;
}
static bool pata_gayle_irq_check(struct ata_port *ap)
{
u8 ch;
ch = z_readb((unsigned long)ap->private_data);
return !!(ch & GAYLE_IRQ_IDE);
}
static void pata_gayle_irq_clear(struct ata_port *ap)
{
(void)z_readb((unsigned long)ap->ioaddr.status_addr);
z_writeb(0x7c, (unsigned long)ap->private_data);
}
static struct ata_port_operations pata_gayle_a1200_ops = {
.inherits = &ata_sff_port_ops,
.sff_data_xfer = pata_gayle_data_xfer,
.sff_irq_check = pata_gayle_irq_check,
.sff_irq_clear = pata_gayle_irq_clear,
.cable_detect = ata_cable_unknown,
.set_mode = pata_gayle_set_mode,
};
static struct ata_port_operations pata_gayle_a4000_ops = {
.inherits = &ata_sff_port_ops,
.sff_data_xfer = pata_gayle_data_xfer,
.cable_detect = ata_cable_unknown,
.set_mode = pata_gayle_set_mode,
};
static int __init pata_gayle_init_one(struct platform_device *pdev)
{
struct resource *res;
struct gayle_ide_platform_data *pdata;
struct ata_host *host;
struct ata_port *ap;
void __iomem *base;
int ret;
pdata = dev_get_platdata(&pdev->dev);
dev_info(&pdev->dev, "Amiga Gayle IDE controller (A%u style)\n",
pdata->explicit_ack ? 1200 : 4000);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
if (!devm_request_mem_region(&pdev->dev, res->start,
resource_size(res), DRV_NAME)) {
pr_err(DRV_NAME ": resources busy\n");
return -EBUSY;
}
/* allocate host */
host = ata_host_alloc(&pdev->dev, 1);
if (!host)
return -ENOMEM;
ap = host->ports[0];
if (pdata->explicit_ack)
ap->ops = &pata_gayle_a1200_ops;
else
ap->ops = &pata_gayle_a4000_ops;
ap->pio_mask = ATA_PIO4;
ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
base = ZTWO_VADDR(pdata->base);
ap->ioaddr.data_addr = base;
ap->ioaddr.error_addr = base + 2 + 1 * 4;
ap->ioaddr.feature_addr = base + 2 + 1 * 4;
ap->ioaddr.nsect_addr = base + 2 + 2 * 4;
ap->ioaddr.lbal_addr = base + 2 + 3 * 4;
ap->ioaddr.lbam_addr = base + 2 + 4 * 4;
ap->ioaddr.lbah_addr = base + 2 + 5 * 4;
ap->ioaddr.device_addr = base + 2 + 6 * 4;
ap->ioaddr.status_addr = base + 2 + 7 * 4;
ap->ioaddr.command_addr = base + 2 + 7 * 4;
ap->ioaddr.altstatus_addr = base + GAYLE_CONTROL;
ap->ioaddr.ctl_addr = base + GAYLE_CONTROL;
ap->private_data = (void *)ZTWO_VADDR(pdata->irqport);
ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", pdata->base,
pdata->base + GAYLE_CONTROL);
ret = ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt,
IRQF_SHARED, &pata_gayle_sht);
if (ret)
return ret;
platform_set_drvdata(pdev, host);
return 0;
}
static int __exit pata_gayle_remove_one(struct platform_device *pdev)
{
struct ata_host *host = platform_get_drvdata(pdev);
ata_host_detach(host);
return 0;
}
static struct platform_driver pata_gayle_driver = {
.remove = __exit_p(pata_gayle_remove_one),
.driver = {
.name = "amiga-gayle-ide",
},
};
module_platform_driver_probe(pata_gayle_driver, pata_gayle_init_one);
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
MODULE_DESCRIPTION("low-level driver for Amiga Gayle PATA");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:amiga-gayle-ide");
MODULE_VERSION(DRV_VERSION);
...@@ -658,10 +658,10 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len) ...@@ -658,10 +658,10 @@ static u8 *it821x_firmware_command(struct ata_port *ap, u8 cmd, int len)
u8 status; u8 status;
int n = 0; int n = 0;
u16 *buf = kmalloc(len, GFP_KERNEL); u16 *buf = kmalloc(len, GFP_KERNEL);
if (buf == NULL) {
printk(KERN_ERR "it821x_firmware_command: Out of memory\n"); if (!buf)
return NULL; return NULL;
}
/* This isn't quite a normal ATA command as we are talking to the /* This isn't quite a normal ATA command as we are talking to the
firmware not the drives */ firmware not the drives */
ap->ctl |= ATA_NIEN; ap->ctl |= ATA_NIEN;
......
...@@ -1131,11 +1131,9 @@ static int pata_macio_attach(struct macio_dev *mdev, ...@@ -1131,11 +1131,9 @@ static int pata_macio_attach(struct macio_dev *mdev,
/* Allocate and init private data structure */ /* Allocate and init private data structure */
priv = devm_kzalloc(&mdev->ofdev.dev, priv = devm_kzalloc(&mdev->ofdev.dev,
sizeof(struct pata_macio_priv), GFP_KERNEL); sizeof(struct pata_macio_priv), GFP_KERNEL);
if (priv == NULL) { if (!priv)
dev_err(&mdev->ofdev.dev,
"Failed to allocate private memory\n");
return -ENOMEM; return -ENOMEM;
}
priv->node = of_node_get(mdev->ofdev.dev.of_node); priv->node = of_node_get(mdev->ofdev.dev.of_node);
priv->mdev = mdev; priv->mdev = mdev;
priv->dev = &mdev->ofdev.dev; priv->dev = &mdev->ofdev.dev;
...@@ -1277,11 +1275,9 @@ static int pata_macio_pci_attach(struct pci_dev *pdev, ...@@ -1277,11 +1275,9 @@ static int pata_macio_pci_attach(struct pci_dev *pdev,
/* Allocate and init private data structure */ /* Allocate and init private data structure */
priv = devm_kzalloc(&pdev->dev, priv = devm_kzalloc(&pdev->dev,
sizeof(struct pata_macio_priv), GFP_KERNEL); sizeof(struct pata_macio_priv), GFP_KERNEL);
if (priv == NULL) { if (!priv)
dev_err(&pdev->dev,
"Failed to allocate private memory\n");
return -ENOMEM; return -ENOMEM;
}
priv->node = of_node_get(np); priv->node = of_node_get(np);
priv->pdev = pdev; priv->pdev = pdev;
priv->dev = &pdev->dev; priv->dev = &pdev->dev;
......
...@@ -738,7 +738,6 @@ static int mpc52xx_ata_probe(struct platform_device *op) ...@@ -738,7 +738,6 @@ static int mpc52xx_ata_probe(struct platform_device *op)
/* Prepare our private structure */ /* Prepare our private structure */
priv = devm_kzalloc(&op->dev, sizeof(*priv), GFP_ATOMIC); priv = devm_kzalloc(&op->dev, sizeof(*priv), GFP_ATOMIC);
if (!priv) { if (!priv) {
dev_err(&op->dev, "error allocating private structure\n");
rv = -ENOMEM; rv = -ENOMEM;
goto err1; goto err1;
} }
......
...@@ -505,10 +505,8 @@ static int __init pata_s3c_probe(struct platform_device *pdev) ...@@ -505,10 +505,8 @@ static int __init pata_s3c_probe(struct platform_device *pdev)
cpu_type = platform_get_device_id(pdev)->driver_data; cpu_type = platform_get_device_id(pdev)->driver_data;
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
if (!info) { if (!info)
dev_err(dev, "failed to allocate memory for device data\n");
return -ENOMEM; return -ENOMEM;
}
info->irq = platform_get_irq(pdev, 0); info->irq = platform_get_irq(pdev, 0);
......
...@@ -901,7 +901,6 @@ static int sata_dwc_port_start(struct ata_port *ap) ...@@ -901,7 +901,6 @@ static int sata_dwc_port_start(struct ata_port *ap)
/* Allocate Port Struct */ /* Allocate Port Struct */
hsdevp = kzalloc(sizeof(*hsdevp), GFP_KERNEL); hsdevp = kzalloc(sizeof(*hsdevp), GFP_KERNEL);
if (!hsdevp) { if (!hsdevp) {
dev_err(ap->dev, "%s: kmalloc failed for hsdevp\n", __func__);
err = -ENOMEM; err = -ENOMEM;
goto CLEANUP; goto CLEANUP;
} }
......
...@@ -617,6 +617,7 @@ struct ata_host { ...@@ -617,6 +617,7 @@ struct ata_host {
void *private_data; void *private_data;
struct ata_port_operations *ops; struct ata_port_operations *ops;
unsigned long flags; unsigned long flags;
struct kref kref;
struct mutex eh_mutex; struct mutex eh_mutex;
struct task_struct *eh_owner; struct task_struct *eh_owner;
......
...@@ -243,6 +243,8 @@ ...@@ -243,6 +243,8 @@
#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0) #define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)
#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) #define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
#define IMX6Q_GPR5_SATA_SW_PD BIT(10)
#define IMX6Q_GPR5_SATA_SW_RST BIT(11)
#define IMX6Q_GPR6_IPU1_ID00_WR_QOS_MASK (0xf << 0) #define IMX6Q_GPR6_IPU1_ID00_WR_QOS_MASK (0xf << 0)
#define IMX6Q_GPR6_IPU1_ID01_WR_QOS_MASK (0xf << 4) #define IMX6Q_GPR6_IPU1_ID01_WR_QOS_MASK (0xf << 4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment