Commit 79f4d1d5 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull libata updates from Tejun Heo:

 - Bartlomiej added pata_falcon

 - Christoph is trying to remove use of static 4k buf.  It's still WIP

 - config cleanup around HAS_DMA

 - other fixes and driver-specific changes

* 'for-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (29 commits)
  ata: pata_of_platform: using of_property_read_u32() helper
  pata_atiixp: Don't use unconnected secondary port on SB600/SB700
  libata-sff: Don't scan disabled ports when checking for legacy mode.
  pata_octeon_cf: remove unused local variables from octeon_cf_set_piomode()
  ahci: qoriq: added ls2088a platforms support
  ahci: qoriq: report error when ecc register address is missing in dts
  ahci: qoriq: added a condition to enable dma coherence
  Revert "libata: switch to dynamic allocation instead of ata_scsi_rbuf"
  ahci: imx: fix building without hwmon or thermal
  ata: add Atari Falcon PATA controller driver
  ata: pass queued command to ->sff_data_xfer method
  ata: allow subsystem to be used on m68k arch
  libata: switch to dynamic allocation instead of ata_scsi_rbuf
  libata: don't call ata_scsi_rbuf_fill for command without a response buffer
  libata: call ->scsi_done from ata_scsi_simulate
  libata: remove the done callback from ata_scsi_args
  libata: move struct ata_scsi_args to libata-scsi.c
  libata: avoid global response buffer in atapi_qc_complete
  libata-eh: Use switch() instead of sparse array for protocol strings
  ata: sata_mv: Convert to devm_ioremap_resource()
  ...
parents 97a229f9 73b29514
...@@ -14,7 +14,7 @@ menuconfig ATA ...@@ -14,7 +14,7 @@ menuconfig ATA
tristate "Serial ATA and Parallel ATA drivers (libata)" tristate "Serial ATA and Parallel ATA drivers (libata)"
depends on HAS_IOMEM depends on HAS_IOMEM
depends on BLOCK depends on BLOCK
depends on !(M32R || M68K || S390) || BROKEN depends on !(M32R || S390) || BROKEN
select SCSI select SCSI
select GLOB select GLOB
---help--- ---help---
...@@ -80,6 +80,8 @@ config SATA_PMP ...@@ -80,6 +80,8 @@ config SATA_PMP
This option adds support for SATA Port Multipliers This option adds support for SATA Port Multipliers
(the SATA version of an ethernet hub, or SAS expander). (the SATA version of an ethernet hub, or SAS expander).
if HAS_DMA
comment "Controllers with non-SFF native interface" comment "Controllers with non-SFF native interface"
config SATA_AHCI config SATA_AHCI
...@@ -127,6 +129,7 @@ config AHCI_ST ...@@ -127,6 +129,7 @@ config AHCI_ST
config AHCI_IMX config AHCI_IMX
tristate "Freescale i.MX AHCI SATA support" tristate "Freescale i.MX AHCI SATA support"
depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST)
depends on (HWMON && (THERMAL || !THERMAL_OF)) || !HWMON
help help
This option enables support for the Freescale i.MX SoC's This option enables support for the Freescale i.MX SoC's
onboard AHCI SATA. onboard AHCI SATA.
...@@ -232,6 +235,8 @@ config SATA_SIL24 ...@@ -232,6 +235,8 @@ config SATA_SIL24
If unsure, say N. If unsure, say N.
endif # HAS_DMA
config ATA_SFF config ATA_SFF
bool "ATA SFF support (for legacy IDE and PATA)" bool "ATA SFF support (for legacy IDE and PATA)"
default y default y
...@@ -289,6 +294,7 @@ config SATA_SX4 ...@@ -289,6 +294,7 @@ config SATA_SX4
config ATA_BMDMA config ATA_BMDMA
bool "ATA BMDMA support" bool "ATA BMDMA support"
depends on HAS_DMA
default y default y
help help
This option adds support for SFF ATA controllers with BMDMA This option adds support for SFF ATA controllers with BMDMA
...@@ -344,6 +350,7 @@ config SATA_DWC_VDEBUG ...@@ -344,6 +350,7 @@ config SATA_DWC_VDEBUG
config SATA_HIGHBANK config SATA_HIGHBANK
tristate "Calxeda Highbank SATA support" tristate "Calxeda Highbank SATA support"
depends on HAS_DMA
depends on ARCH_HIGHBANK || COMPILE_TEST depends on ARCH_HIGHBANK || COMPILE_TEST
help help
This option enables support for the Calxeda Highbank SoC's This option enables support for the Calxeda Highbank SoC's
...@@ -353,6 +360,7 @@ config SATA_HIGHBANK ...@@ -353,6 +360,7 @@ config SATA_HIGHBANK
config SATA_MV config SATA_MV
tristate "Marvell SATA support" tristate "Marvell SATA support"
depends on HAS_DMA
depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \ depends on PCI || ARCH_DOVE || ARCH_MV78XX0 || \
ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST ARCH_MVEBU || ARCH_ORION5X || COMPILE_TEST
select GENERIC_PHY select GENERIC_PHY
...@@ -895,6 +903,15 @@ config PATA_CMD640_PCI ...@@ -895,6 +903,15 @@ config PATA_CMD640_PCI
If unsure, say N. If unsure, say N.
config PATA_FALCON
tristate "Atari Falcon PATA support"
depends on M68K && ATARI
help
This option enables support for the on-board IDE
interface on the Atari Falcon.
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
......
...@@ -93,6 +93,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o ...@@ -93,6 +93,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o
obj-$(CONFIG_PATA_AT32) += pata_at32.o obj-$(CONFIG_PATA_AT32) += pata_at32.o
obj-$(CONFIG_PATA_AT91) += pata_at91.o obj-$(CONFIG_PATA_AT91) += pata_at91.o
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_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
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include <linux/mfd/syscon.h> #include <linux/mfd/syscon.h>
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
#include <linux/libata.h> #include <linux/libata.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/thermal.h>
#include "ahci.h" #include "ahci.h"
#define DRV_NAME "ahci-imx" #define DRV_NAME "ahci-imx"
...@@ -214,6 +217,180 @@ static int imx_sata_phy_reset(struct ahci_host_priv *hpriv) ...@@ -214,6 +217,180 @@ static int imx_sata_phy_reset(struct ahci_host_priv *hpriv)
return timeout ? 0 : -ETIMEDOUT; return timeout ? 0 : -ETIMEDOUT;
} }
enum {
/* SATA PHY Register */
SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT = 0x0001,
SATA_PHY_CR_CLOCK_DAC_CTL = 0x0008,
SATA_PHY_CR_CLOCK_RTUNE_CTL = 0x0009,
SATA_PHY_CR_CLOCK_ADC_OUT = 0x000A,
SATA_PHY_CR_CLOCK_MPLL_TST = 0x0017,
};
static int read_adc_sum(void *dev, u16 rtune_ctl_reg, void __iomem * mmio)
{
u16 adc_out_reg, read_sum;
u32 index, read_attempt;
const u32 attempt_limit = 100;
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio);
imx_phy_reg_write(rtune_ctl_reg, mmio);
/* two dummy read */
index = 0;
read_attempt = 0;
adc_out_reg = 0;
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_ADC_OUT, mmio);
while (index < 2) {
imx_phy_reg_read(&adc_out_reg, mmio);
/* check if valid */
if (adc_out_reg & 0x400)
index++;
read_attempt++;
if (read_attempt > attempt_limit) {
dev_err(dev, "Read REG more than %d times!\n",
attempt_limit);
break;
}
}
index = 0;
read_attempt = 0;
read_sum = 0;
while (index < 80) {
imx_phy_reg_read(&adc_out_reg, mmio);
if (adc_out_reg & 0x400) {
read_sum = read_sum + (adc_out_reg & 0x3FF);
index++;
}
read_attempt++;
if (read_attempt > attempt_limit) {
dev_err(dev, "Read REG more than %d times!\n",
attempt_limit);
break;
}
}
/* Use the U32 to make 1000 precision */
return (read_sum * 1000) / 80;
}
/* SATA AHCI temperature monitor */
static int sata_ahci_read_temperature(void *dev, int *temp)
{
u16 mpll_test_reg, rtune_ctl_reg, dac_ctl_reg, read_sum;
u32 str1, str2, str3, str4;
int m1, m2, a;
struct ahci_host_priv *hpriv = dev_get_drvdata(dev);
void __iomem *mmio = hpriv->mmio;
/* check rd-wr to reg */
read_sum = 0;
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT, mmio);
imx_phy_reg_write(read_sum, mmio);
imx_phy_reg_read(&read_sum, mmio);
if ((read_sum & 0xffff) != 0)
dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum);
imx_phy_reg_write(0x5A5A, mmio);
imx_phy_reg_read(&read_sum, mmio);
if ((read_sum & 0xffff) != 0x5A5A)
dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum);
imx_phy_reg_write(0x1234, mmio);
imx_phy_reg_read(&read_sum, mmio);
if ((read_sum & 0xffff) != 0x1234)
dev_err(dev, "Read/Write REG error, 0x%x!\n", read_sum);
/* start temperature test */
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio);
imx_phy_reg_read(&mpll_test_reg, mmio);
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio);
imx_phy_reg_read(&rtune_ctl_reg, mmio);
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio);
imx_phy_reg_read(&dac_ctl_reg, mmio);
/* mpll_tst.meas_iv ([12:2]) */
str1 = (mpll_test_reg >> 2) & 0x7FF;
/* rtune_ctl.mode ([1:0]) */
str2 = (rtune_ctl_reg) & 0x3;
/* dac_ctl.dac_mode ([14:12]) */
str3 = (dac_ctl_reg >> 12) & 0x7;
/* rtune_ctl.sel_atbp ([4]) */
str4 = (rtune_ctl_reg >> 4);
/* Calculate the m1 */
/* mpll_tst.meas_iv */
mpll_test_reg = (mpll_test_reg & 0xE03) | (512) << 2;
/* rtune_ctl.mode */
rtune_ctl_reg = (rtune_ctl_reg & 0xFFC) | (1);
/* dac_ctl.dac_mode */
dac_ctl_reg = (dac_ctl_reg & 0x8FF) | (4) << 12;
/* rtune_ctl.sel_atbp */
rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (0) << 4;
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio);
imx_phy_reg_write(mpll_test_reg, mmio);
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio);
imx_phy_reg_write(dac_ctl_reg, mmio);
m1 = read_adc_sum(dev, rtune_ctl_reg, mmio);
/* Calculate the m2 */
/* rtune_ctl.sel_atbp */
rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (1) << 4;
m2 = read_adc_sum(dev, rtune_ctl_reg, mmio);
/* restore the status */
/* mpll_tst.meas_iv */
mpll_test_reg = (mpll_test_reg & 0xE03) | (str1) << 2;
/* rtune_ctl.mode */
rtune_ctl_reg = (rtune_ctl_reg & 0xFFC) | (str2);
/* dac_ctl.dac_mode */
dac_ctl_reg = (dac_ctl_reg & 0x8FF) | (str3) << 12;
/* rtune_ctl.sel_atbp */
rtune_ctl_reg = (rtune_ctl_reg & 0xFEF) | (str4) << 4;
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_MPLL_TST, mmio);
imx_phy_reg_write(mpll_test_reg, mmio);
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_DAC_CTL, mmio);
imx_phy_reg_write(dac_ctl_reg, mmio);
imx_phy_reg_addressing(SATA_PHY_CR_CLOCK_RTUNE_CTL, mmio);
imx_phy_reg_write(rtune_ctl_reg, mmio);
/* Compute temperature */
if (!(m2 / 1000))
m2 = 1000;
a = (m2 - m1) / (m2/1000);
*temp = ((-559) * a * a) / 1000 + (1379) * a + (-458000);
return 0;
}
static ssize_t sata_ahci_show_temp(struct device *dev,
struct device_attribute *da,
char *buf)
{
unsigned int temp = 0;
int err;
err = sata_ahci_read_temperature(dev, &temp);
if (err < 0)
return err;
return sprintf(buf, "%u\n", temp);
}
static const struct thermal_zone_of_device_ops fsl_sata_ahci_of_thermal_ops = {
.get_temp = sata_ahci_read_temperature,
};
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, sata_ahci_show_temp, NULL, 0);
static struct attribute *fsl_sata_ahci_attrs[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr,
NULL
};
ATTRIBUTE_GROUPS(fsl_sata_ahci);
static int imx_sata_enable(struct ahci_host_priv *hpriv) static int imx_sata_enable(struct ahci_host_priv *hpriv)
{ {
struct imx_ahci_priv *imxpriv = hpriv->plat_data; struct imx_ahci_priv *imxpriv = hpriv->plat_data;
...@@ -597,6 +774,25 @@ static int imx_ahci_probe(struct platform_device *pdev) ...@@ -597,6 +774,25 @@ static int imx_ahci_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
if (imxpriv->type == AHCI_IMX53 &&
IS_ENABLED(CONFIG_HWMON)) {
/* Add the temperature monitor */
struct device *hwmon_dev;
hwmon_dev =
devm_hwmon_device_register_with_groups(dev,
"sata_ahci",
hpriv,
fsl_sata_ahci_groups);
if (IS_ERR(hwmon_dev)) {
ret = PTR_ERR(hwmon_dev);
goto disable_clk;
}
devm_thermal_zone_of_sensor_register(hwmon_dev, 0, hwmon_dev,
&fsl_sata_ahci_of_thermal_ops);
dev_info(dev, "%s: sensor 'sata_ahci'\n", dev_name(hwmon_dev));
}
ret = imx_sata_enable(hpriv); ret = imx_sata_enable(hpriv);
if (ret) if (ret)
goto disable_clk; goto disable_clk;
......
...@@ -46,19 +46,21 @@ ...@@ -46,19 +46,21 @@
#define LS1021A_AXICC_ADDR 0xC0 #define LS1021A_AXICC_ADDR 0xC0
#define SATA_ECC_DISABLE 0x00020000 #define SATA_ECC_DISABLE 0x00020000
#define LS1046A_SATA_ECC_DIS 0x80000000 #define ECC_DIS_ARMV8_CH2 0x80000000
enum ahci_qoriq_type { enum ahci_qoriq_type {
AHCI_LS1021A, AHCI_LS1021A,
AHCI_LS1043A, AHCI_LS1043A,
AHCI_LS2080A, AHCI_LS2080A,
AHCI_LS1046A, AHCI_LS1046A,
AHCI_LS2088A,
}; };
struct ahci_qoriq_priv { struct ahci_qoriq_priv {
struct ccsr_ahci *reg_base; struct ccsr_ahci *reg_base;
enum ahci_qoriq_type type; enum ahci_qoriq_type type;
void __iomem *ecc_addr; void __iomem *ecc_addr;
bool is_dmacoherent;
}; };
static const struct of_device_id ahci_qoriq_of_match[] = { static const struct of_device_id ahci_qoriq_of_match[] = {
...@@ -66,6 +68,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = { ...@@ -66,6 +68,7 @@ static const struct of_device_id ahci_qoriq_of_match[] = {
{ .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A}, { .compatible = "fsl,ls1043a-ahci", .data = (void *)AHCI_LS1043A},
{ .compatible = "fsl,ls2080a-ahci", .data = (void *)AHCI_LS2080A}, { .compatible = "fsl,ls2080a-ahci", .data = (void *)AHCI_LS2080A},
{ .compatible = "fsl,ls1046a-ahci", .data = (void *)AHCI_LS1046A}, { .compatible = "fsl,ls1046a-ahci", .data = (void *)AHCI_LS1046A},
{ .compatible = "fsl,ls2088a-ahci", .data = (void *)AHCI_LS2088A},
{}, {},
}; };
MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match); MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
...@@ -157,6 +160,8 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) ...@@ -157,6 +160,8 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv)
switch (qpriv->type) { switch (qpriv->type) {
case AHCI_LS1021A: case AHCI_LS1021A:
if (!qpriv->ecc_addr)
return -EINVAL;
writel(SATA_ECC_DISABLE, qpriv->ecc_addr); writel(SATA_ECC_DISABLE, qpriv->ecc_addr);
writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
writel(LS1021A_PORT_PHY2, reg_base + PORT_PHY2); writel(LS1021A_PORT_PHY2, reg_base + PORT_PHY2);
...@@ -164,25 +169,42 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv) ...@@ -164,25 +169,42 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv)
writel(LS1021A_PORT_PHY4, reg_base + PORT_PHY4); writel(LS1021A_PORT_PHY4, reg_base + PORT_PHY4);
writel(LS1021A_PORT_PHY5, reg_base + PORT_PHY5); writel(LS1021A_PORT_PHY5, reg_base + PORT_PHY5);
writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
writel(AHCI_PORT_AXICC_CFG, reg_base + LS1021A_AXICC_ADDR); if (qpriv->is_dmacoherent)
writel(AHCI_PORT_AXICC_CFG,
reg_base + LS1021A_AXICC_ADDR);
break; break;
case AHCI_LS1043A: case AHCI_LS1043A:
if (!qpriv->ecc_addr)
return -EINVAL;
writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr);
writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
if (qpriv->is_dmacoherent)
writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
break; break;
case AHCI_LS2080A: case AHCI_LS2080A:
writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
if (qpriv->is_dmacoherent)
writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
break; break;
case AHCI_LS1046A: case AHCI_LS1046A:
writel(LS1046A_SATA_ECC_DIS, qpriv->ecc_addr); if (!qpriv->ecc_addr)
return -EINVAL;
writel(ECC_DIS_ARMV8_CH2, qpriv->ecc_addr);
writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1); writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS); writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
if (qpriv->is_dmacoherent)
writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
break;
case AHCI_LS2088A:
writel(AHCI_PORT_PHY_1_CFG, reg_base + PORT_PHY1);
writel(AHCI_PORT_TRANS_CFG, reg_base + PORT_TRANS);
if (qpriv->is_dmacoherent)
writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC); writel(AHCI_PORT_AXICC_CFG, reg_base + PORT_AXICC);
break; break;
} }
...@@ -221,6 +243,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev) ...@@ -221,6 +243,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
if (IS_ERR(qoriq_priv->ecc_addr)) if (IS_ERR(qoriq_priv->ecc_addr))
return PTR_ERR(qoriq_priv->ecc_addr); return PTR_ERR(qoriq_priv->ecc_addr);
} }
qoriq_priv->is_dmacoherent = of_dma_is_coherent(np);
rc = ahci_platform_enable_resources(hpriv); rc = ahci_platform_enable_resources(hpriv);
if (rc) if (rc)
......
...@@ -821,8 +821,10 @@ static int xgene_ahci_probe(struct platform_device *pdev) ...@@ -821,8 +821,10 @@ static int xgene_ahci_probe(struct platform_device *pdev)
dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n", dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n",
__func__); __func__);
version = XGENE_AHCI_V1; version = XGENE_AHCI_V1;
} else if (info->valid & ACPI_VALID_CID) { } else {
if (info->valid & ACPI_VALID_CID)
version = XGENE_AHCI_V2; version = XGENE_AHCI_V2;
kfree(info);
} }
} }
} }
......
...@@ -4815,32 +4815,6 @@ static unsigned int ata_dev_init_params(struct ata_device *dev, ...@@ -4815,32 +4815,6 @@ static unsigned int ata_dev_init_params(struct ata_device *dev,
return err_mask; return err_mask;
} }
/**
* ata_sg_clean - Unmap DMA memory associated with command
* @qc: Command containing DMA memory to be released
*
* Unmap all mapped DMA memory associated with this command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_sg_clean(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct scatterlist *sg = qc->sg;
int dir = qc->dma_dir;
WARN_ON_ONCE(sg == NULL);
VPRINTK("unmapping %u sg elements\n", qc->n_elem);
if (qc->n_elem)
dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir);
qc->flags &= ~ATA_QCFLAG_DMAMAP;
qc->sg = NULL;
}
/** /**
* atapi_check_dma - Check whether ATAPI DMA can be supported * atapi_check_dma - Check whether ATAPI DMA can be supported
* @qc: Metadata associated with taskfile to check * @qc: Metadata associated with taskfile to check
...@@ -4925,6 +4899,34 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, ...@@ -4925,6 +4899,34 @@ void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
qc->cursg = qc->sg; qc->cursg = qc->sg;
} }
#ifdef CONFIG_HAS_DMA
/**
* ata_sg_clean - Unmap DMA memory associated with command
* @qc: Command containing DMA memory to be released
*
* Unmap all mapped DMA memory associated with this command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_sg_clean(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct scatterlist *sg = qc->sg;
int dir = qc->dma_dir;
WARN_ON_ONCE(sg == NULL);
VPRINTK("unmapping %u sg elements\n", qc->n_elem);
if (qc->n_elem)
dma_unmap_sg(ap->dev, sg, qc->orig_n_elem, dir);
qc->flags &= ~ATA_QCFLAG_DMAMAP;
qc->sg = NULL;
}
/** /**
* ata_sg_setup - DMA-map the scatter-gather table associated with a command. * ata_sg_setup - DMA-map the scatter-gather table associated with a command.
* @qc: Command with scatter-gather table to be mapped. * @qc: Command with scatter-gather table to be mapped.
...@@ -4957,6 +4959,13 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) ...@@ -4957,6 +4959,13 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
return 0; return 0;
} }
#else /* !CONFIG_HAS_DMA */
static inline void ata_sg_clean(struct ata_queued_cmd *qc) {}
static inline int ata_sg_setup(struct ata_queued_cmd *qc) { return -1; }
#endif /* !CONFIG_HAS_DMA */
/** /**
* swap_buf_le16 - swap halves of 16-bit words in place * swap_buf_le16 - swap halves of 16-bit words in place
* @buf: Buffer to swap * @buf: Buffer to swap
......
...@@ -2607,21 +2607,39 @@ static void ata_eh_link_report(struct ata_link *link) ...@@ -2607,21 +2607,39 @@ static void ata_eh_link_report(struct ata_link *link)
[DMA_TO_DEVICE] = "out", [DMA_TO_DEVICE] = "out",
[DMA_FROM_DEVICE] = "in", [DMA_FROM_DEVICE] = "in",
}; };
static const char *prot_str[] = { const char *prot_str = NULL;
[ATA_PROT_UNKNOWN] = "unknown",
[ATA_PROT_NODATA] = "nodata",
[ATA_PROT_PIO] = "pio",
[ATA_PROT_DMA] = "dma",
[ATA_PROT_NCQ] = "ncq dma",
[ATA_PROT_NCQ_NODATA] = "ncq nodata",
[ATAPI_PROT_NODATA] = "nodata",
[ATAPI_PROT_PIO] = "pio",
[ATAPI_PROT_DMA] = "dma",
};
switch (qc->tf.protocol) {
case ATA_PROT_UNKNOWN:
prot_str = "unknown";
break;
case ATA_PROT_NODATA:
prot_str = "nodata";
break;
case ATA_PROT_PIO:
prot_str = "pio";
break;
case ATA_PROT_DMA:
prot_str = "dma";
break;
case ATA_PROT_NCQ:
prot_str = "ncq dma";
break;
case ATA_PROT_NCQ_NODATA:
prot_str = "ncq nodata";
break;
case ATAPI_PROT_NODATA:
prot_str = "nodata";
break;
case ATAPI_PROT_PIO:
prot_str = "pio";
break;
case ATAPI_PROT_DMA:
prot_str = "dma";
break;
}
snprintf(data_buf, sizeof(data_buf), " %s %u %s", snprintf(data_buf, sizeof(data_buf), " %s %u %s",
prot_str[qc->tf.protocol], qc->nbytes, prot_str, qc->nbytes, dma_str[qc->dma_dir]);
dma_str[qc->dma_dir]);
} }
if (ata_is_atapi(qc->tf.protocol)) { if (ata_is_atapi(qc->tf.protocol)) {
......
...@@ -484,13 +484,6 @@ struct device_attribute *ata_common_sdev_attrs[] = { ...@@ -484,13 +484,6 @@ struct device_attribute *ata_common_sdev_attrs[] = {
}; };
EXPORT_SYMBOL_GPL(ata_common_sdev_attrs); EXPORT_SYMBOL_GPL(ata_common_sdev_attrs);
static void ata_scsi_invalid_field(struct ata_device *dev,
struct scsi_cmnd *cmd, u16 field)
{
ata_scsi_set_invalid_field(dev, cmd, field, 0xff);
cmd->scsi_done(cmd);
}
/** /**
* ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd. * ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd.
* @sdev: SCSI device for which BIOS geometry is to be determined * @sdev: SCSI device for which BIOS geometry is to be determined
...@@ -2057,6 +2050,12 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd, ...@@ -2057,6 +2050,12 @@ static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
return SCSI_MLQUEUE_HOST_BUSY; return SCSI_MLQUEUE_HOST_BUSY;
} }
struct ata_scsi_args {
struct ata_device *dev;
u16 *id;
struct scsi_cmnd *cmd;
};
/** /**
* ata_scsi_rbuf_get - Map response buffer. * ata_scsi_rbuf_get - Map response buffer.
* @cmd: SCSI command containing buffer to be mapped. * @cmd: SCSI command containing buffer to be mapped.
...@@ -2133,7 +2132,6 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, ...@@ -2133,7 +2132,6 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
if (rc == 0) if (rc == 0)
cmd->result = SAM_STAT_GOOD; cmd->result = SAM_STAT_GOOD;
args->done(cmd);
} }
/** /**
...@@ -2454,23 +2452,6 @@ static unsigned int ata_scsiop_inq_b6(struct ata_scsi_args *args, u8 *rbuf) ...@@ -2454,23 +2452,6 @@ static unsigned int ata_scsiop_inq_b6(struct ata_scsi_args *args, u8 *rbuf)
return 0; return 0;
} }
/**
* ata_scsiop_noop - Command handler that simply returns success.
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* No operation. Simply returns success to caller, to indicate
* that the caller should successfully complete this SCSI command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf)
{
VPRINTK("ENTER\n");
return 0;
}
/** /**
* modecpy - Prepare response for MODE SENSE * modecpy - Prepare response for MODE SENSE
* @dest: output buffer * @dest: output buffer
...@@ -2873,6 +2854,26 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) ...@@ -2873,6 +2854,26 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
DPRINTK("EXIT\n"); DPRINTK("EXIT\n");
} }
/*
* ATAPI devices typically report zero for their SCSI version, and sometimes
* deviate from the spec WRT response data format. If SCSI version is
* reported as zero like normal, then we make the following fixups:
* 1) Fake MMC-5 version, to indicate to the Linux scsi midlayer this is a
* modern device.
* 2) Ensure response data format / ATAPI information are always correct.
*/
static void atapi_fixup_inquiry(struct scsi_cmnd *cmd)
{
u8 buf[4];
sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4);
if (buf[2] == 0) {
buf[2] = 0x5;
buf[3] = 0x32;
}
sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), buf, 4);
}
static void atapi_qc_complete(struct ata_queued_cmd *qc) static void atapi_qc_complete(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *cmd = qc->scsicmd; struct scsi_cmnd *cmd = qc->scsicmd;
...@@ -2927,30 +2928,8 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) ...@@ -2927,30 +2928,8 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc)
*/ */
ata_gen_passthru_sense(qc); ata_gen_passthru_sense(qc);
} else { } else {
u8 *scsicmd = cmd->cmnd; if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0)
atapi_fixup_inquiry(cmd);
if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
unsigned long flags;
u8 *buf;
buf = ata_scsi_rbuf_get(cmd, true, &flags);
/* ATAPI devices typically report zero for their SCSI version,
* and sometimes deviate from the spec WRT response data
* format. If SCSI version is reported as zero like normal,
* then we make the following fixups: 1) Fake MMC-5 version,
* to indicate to the Linux scsi midlayer this is a modern
* device. 2) Ensure response data format / ATAPI information
* are always correct.
*/
if (buf[2] == 0) {
buf[2] = 0x5;
buf[3] = 0x32;
}
ata_scsi_rbuf_put(cmd, true, &flags);
}
cmd->result = SAM_STAT_GOOD; cmd->result = SAM_STAT_GOOD;
} }
...@@ -4352,12 +4331,11 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ...@@ -4352,12 +4331,11 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
args.dev = dev; args.dev = dev;
args.id = dev->id; args.id = dev->id;
args.cmd = cmd; args.cmd = cmd;
args.done = cmd->scsi_done;
switch(scsicmd[0]) { switch(scsicmd[0]) {
case INQUIRY: case INQUIRY:
if (scsicmd[1] & 2) /* is CmdDt set? */ if (scsicmd[1] & 2) /* is CmdDt set? */
ata_scsi_invalid_field(dev, cmd, 1); ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */ else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std); ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std);
else switch (scsicmd[2]) { else switch (scsicmd[2]) {
...@@ -4389,7 +4367,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ...@@ -4389,7 +4367,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
} }
/* Fallthrough */ /* Fallthrough */
default: default:
ata_scsi_invalid_field(dev, cmd, 2); ata_scsi_set_invalid_field(dev, cmd, 2, 0xff);
break; break;
} }
break; break;
...@@ -4407,7 +4385,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ...@@ -4407,7 +4385,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16) if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16)
ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap); ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap);
else else
ata_scsi_invalid_field(dev, cmd, 1); ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
break; break;
case REPORT_LUNS: case REPORT_LUNS:
...@@ -4417,7 +4395,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ...@@ -4417,7 +4395,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
case REQUEST_SENSE: case REQUEST_SENSE:
ata_scsi_set_sense(dev, cmd, 0, 0, 0); ata_scsi_set_sense(dev, cmd, 0, 0, 0);
cmd->result = (DRIVER_SENSE << 24); cmd->result = (DRIVER_SENSE << 24);
cmd->scsi_done(cmd);
break; break;
/* if we reach this, then writeback caching is disabled, /* if we reach this, then writeback caching is disabled,
...@@ -4431,31 +4408,29 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) ...@@ -4431,31 +4408,29 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
case SEEK_6: case SEEK_6:
case SEEK_10: case SEEK_10:
case TEST_UNIT_READY: case TEST_UNIT_READY:
ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
break; break;
case SEND_DIAGNOSTIC: case SEND_DIAGNOSTIC:
tmp8 = scsicmd[1] & ~(1 << 3); tmp8 = scsicmd[1] & ~(1 << 3);
if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4])) if (tmp8 != 0x4 || scsicmd[3] || scsicmd[4])
ata_scsi_rbuf_fill(&args, ata_scsiop_noop); ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
else
ata_scsi_invalid_field(dev, cmd, 1);
break; break;
case MAINTENANCE_IN: case MAINTENANCE_IN:
if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES) if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in); ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
else else
ata_scsi_invalid_field(dev, cmd, 1); ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
break; break;
/* all other commands */ /* all other commands */
default: default:
ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0); ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x20, 0x0);
/* "Invalid command operation code" */ /* "Invalid command operation code" */
cmd->scsi_done(cmd);
break; break;
} }
cmd->scsi_done(cmd);
} }
int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
......
...@@ -542,7 +542,7 @@ static inline void ata_tf_to_host(struct ata_port *ap, ...@@ -542,7 +542,7 @@ static inline void ata_tf_to_host(struct ata_port *ap,
/** /**
* ata_sff_data_xfer - Transfer data by PIO * ata_sff_data_xfer - Transfer data by PIO
* @dev: device to target * @qc: queued command
* @buf: data buffer * @buf: data buffer
* @buflen: buffer length * @buflen: buffer length
* @rw: read/write * @rw: read/write
...@@ -555,10 +555,10 @@ static inline void ata_tf_to_host(struct ata_port *ap, ...@@ -555,10 +555,10 @@ static inline void ata_tf_to_host(struct ata_port *ap,
* RETURNS: * RETURNS:
* Bytes consumed. * Bytes consumed.
*/ */
unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf, unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc, unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
...@@ -595,7 +595,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer); ...@@ -595,7 +595,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer);
/** /**
* ata_sff_data_xfer32 - Transfer data by PIO * ata_sff_data_xfer32 - Transfer data by PIO
* @dev: device to target * @qc: queued command
* @buf: data buffer * @buf: data buffer
* @buflen: buffer length * @buflen: buffer length
* @rw: read/write * @rw: read/write
...@@ -610,16 +610,17 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer); ...@@ -610,16 +610,17 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer);
* Bytes consumed. * Bytes consumed.
*/ */
unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf, unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc, unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_device *dev = qc->dev;
struct ata_port *ap = dev->link->ap; struct ata_port *ap = dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 2; unsigned int words = buflen >> 2;
int slop = buflen & 3; int slop = buflen & 3;
if (!(ap->pflags & ATA_PFLAG_PIO32)) if (!(ap->pflags & ATA_PFLAG_PIO32))
return ata_sff_data_xfer(dev, buf, buflen, rw); return ata_sff_data_xfer(qc, buf, buflen, rw);
/* Transfer multiple of 4 bytes */ /* Transfer multiple of 4 bytes */
if (rw == READ) if (rw == READ)
...@@ -658,7 +659,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); ...@@ -658,7 +659,7 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
/** /**
* ata_sff_data_xfer_noirq - Transfer data by PIO * ata_sff_data_xfer_noirq - Transfer data by PIO
* @dev: device to target * @qc: queued command
* @buf: data buffer * @buf: data buffer
* @buflen: buffer length * @buflen: buffer length
* @rw: read/write * @rw: read/write
...@@ -672,14 +673,14 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32); ...@@ -672,14 +673,14 @@ EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
* RETURNS: * RETURNS:
* Bytes consumed. * Bytes consumed.
*/ */
unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf, unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc, unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
unsigned long flags; unsigned long flags;
unsigned int consumed; unsigned int consumed;
local_irq_save(flags); local_irq_save(flags);
consumed = ata_sff_data_xfer32(dev, buf, buflen, rw); consumed = ata_sff_data_xfer32(qc, buf, buflen, rw);
local_irq_restore(flags); local_irq_restore(flags);
return consumed; return consumed;
...@@ -723,14 +724,14 @@ static void ata_pio_sector(struct ata_queued_cmd *qc) ...@@ -723,14 +724,14 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
buf = kmap_atomic(page); buf = kmap_atomic(page);
/* do the actual data transfer */ /* do the actual data transfer */
ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size,
do_write); do_write);
kunmap_atomic(buf); kunmap_atomic(buf);
local_irq_restore(flags); local_irq_restore(flags);
} else { } else {
buf = page_address(page); buf = page_address(page);
ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size, ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size,
do_write); do_write);
} }
...@@ -791,7 +792,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) ...@@ -791,7 +792,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
DPRINTK("send cdb\n"); DPRINTK("send cdb\n");
WARN_ON_ONCE(qc->dev->cdb_len < 12); WARN_ON_ONCE(qc->dev->cdb_len < 12);
ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); ap->ops->sff_data_xfer(qc, qc->cdb, qc->dev->cdb_len, 1);
ata_sff_sync(ap); ata_sff_sync(ap);
/* FIXME: If the CDB is for DMA do we need to do the transition delay /* FIXME: If the CDB is for DMA do we need to do the transition delay
or is bmdma_start guaranteed to do it ? */ or is bmdma_start guaranteed to do it ? */
...@@ -868,14 +869,14 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes) ...@@ -868,14 +869,14 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
buf = kmap_atomic(page); buf = kmap_atomic(page);
/* do the actual data transfer */ /* do the actual data transfer */
consumed = ap->ops->sff_data_xfer(dev, buf + offset, consumed = ap->ops->sff_data_xfer(qc, buf + offset,
count, rw); count, rw);
kunmap_atomic(buf); kunmap_atomic(buf);
local_irq_restore(flags); local_irq_restore(flags);
} else { } else {
buf = page_address(page); buf = page_address(page);
consumed = ap->ops->sff_data_xfer(dev, buf + offset, consumed = ap->ops->sff_data_xfer(qc, buf + offset,
count, rw); count, rw);
} }
...@@ -2427,11 +2428,21 @@ int ata_pci_sff_activate_host(struct ata_host *host, ...@@ -2427,11 +2428,21 @@ int ata_pci_sff_activate_host(struct ata_host *host,
return rc; return rc;
if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) { if ((pdev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
u8 tmp8, mask; u8 tmp8, mask = 0;
/* TODO: What if one channel is in native mode ... */ /*
* ATA spec says we should use legacy mode when one
* port is in legacy mode, but disabled ports on some
* PCI hosts appear as fixed legacy ports, e.g SB600/700
* on which the secondary port is not wired, so
* ignore ports that are marked as 'dummy' during
* this check
*/
pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8); pci_read_config_byte(pdev, PCI_CLASS_PROG, &tmp8);
mask = (1 << 2) | (1 << 0); if (!ata_port_is_dummy(host->ports[0]))
mask |= (1 << 0);
if (!ata_port_is_dummy(host->ports[1]))
mask |= (1 << 2);
if ((tmp8 & mask) != mask) if ((tmp8 & mask) != mask)
legacy_mode = 1; legacy_mode = 1;
} }
......
...@@ -31,13 +31,6 @@ ...@@ -31,13 +31,6 @@
#define DRV_NAME "libata" #define DRV_NAME "libata"
#define DRV_VERSION "3.00" /* must be exactly four chars */ #define DRV_VERSION "3.00" /* must be exactly four chars */
struct ata_scsi_args {
struct ata_device *dev;
u16 *id;
struct scsi_cmnd *cmd;
void (*done)(struct scsi_cmnd *);
};
/* libata-core.c */ /* libata-core.c */
enum { enum {
/* flags for ata_dev_read_id() */ /* flags for ata_dev_read_id() */
...@@ -89,7 +82,6 @@ extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit); ...@@ -89,7 +82,6 @@ extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
extern unsigned int ata_dev_set_feature(struct ata_device *dev, extern unsigned int ata_dev_set_feature(struct ata_device *dev,
u8 enable, u8 feature); u8 enable, u8 feature);
extern void ata_sg_clean(struct ata_queued_cmd *qc);
extern void ata_qc_free(struct ata_queued_cmd *qc); extern void ata_qc_free(struct ata_queued_cmd *qc);
extern void ata_qc_issue(struct ata_queued_cmd *qc); extern void ata_qc_issue(struct ata_queued_cmd *qc);
extern void __ata_qc_complete(struct ata_queued_cmd *qc); extern void __ata_qc_complete(struct ata_queued_cmd *qc);
......
...@@ -286,10 +286,10 @@ static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -286,10 +286,10 @@ static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev)
set_smc_timing(ap->dev, adev, info, &timing); set_smc_timing(ap->dev, adev, info, &timing);
} }
static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, static unsigned int pata_at91_data_xfer_noirq(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw) unsigned char *buf, unsigned int buflen, int rw)
{ {
struct at91_ide_info *info = dev->link->ap->host->private_data; struct at91_ide_info *info = qc->dev->link->ap->host->private_data;
unsigned int consumed; unsigned int consumed;
unsigned int mode; unsigned int mode;
unsigned long flags; unsigned long flags;
...@@ -301,7 +301,7 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, ...@@ -301,7 +301,7 @@ static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev,
regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) |
AT91_SMC_DBW_16); AT91_SMC_DBW_16);
consumed = ata_sff_data_xfer(dev, buf, buflen, rw); consumed = ata_sff_data_xfer(qc, buf, buflen, rw);
/* restore 8bit mode after data is written */ /* restore 8bit mode after data is written */
regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) | regmap_fields_write(fields.mode, info->cs, (mode & ~AT91_SMC_DBW) |
......
...@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -278,6 +278,11 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
}; };
const struct ata_port_info *ppi[] = { &info, &info }; const struct ata_port_info *ppi[] = { &info, &info };
/* SB600/700 don't have secondary port wired */
if ((pdev->device == PCI_DEVICE_ID_ATI_IXP600_IDE) ||
(pdev->device == PCI_DEVICE_ID_ATI_IXP700_IDE))
ppi[1] = &ata_dummy_port_info;
return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL, return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL,
ATA_HOST_PARALLEL_SCAN); ATA_HOST_PARALLEL_SCAN);
} }
......
...@@ -1143,7 +1143,7 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) ...@@ -1143,7 +1143,7 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap)
/** /**
* bfin_data_xfer - Transfer data by PIO * bfin_data_xfer - Transfer data by PIO
* @adev: device for this I/O * @qc: queued command
* @buf: data buffer * @buf: data buffer
* @buflen: buffer length * @buflen: buffer length
* @write_data: read/write * @write_data: read/write
...@@ -1151,10 +1151,11 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) ...@@ -1151,10 +1151,11 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap)
* Note: Original code is ata_sff_data_xfer(). * Note: Original code is ata_sff_data_xfer().
*/ */
static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf, static unsigned int bfin_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
unsigned short *buf16 = (u16 *)buf; unsigned short *buf16 = (u16 *)buf;
......
...@@ -474,11 +474,11 @@ static void ep93xx_pata_set_devctl(struct ata_port *ap, u8 ctl) ...@@ -474,11 +474,11 @@ static void ep93xx_pata_set_devctl(struct ata_port *ap, u8 ctl)
} }
/* Note: original code is ata_sff_data_xfer */ /* Note: original code is ata_sff_data_xfer */
static unsigned int ep93xx_pata_data_xfer(struct ata_device *adev, static unsigned int ep93xx_pata_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_port *ap = adev->link->ap; struct ata_port *ap = qc->dev->link->ap;
struct ep93xx_pata_data *drv_data = ap->host->private_data; struct ep93xx_pata_data *drv_data = ap->host->private_data;
u16 *data = (u16 *)buf; u16 *data = (u16 *)buf;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
......
/*
* Atari Falcon PATA controller driver
*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Based on falconide.c:
*
* 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/module.h>
#include <linux/init.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <linux/ata.h>
#include <linux/libata.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/atarihw.h>
#include <asm/atariints.h>
#include <asm/atari_stdma.h>
#include <asm/ide.h>
#define DRV_NAME "pata_falcon"
#define DRV_VERSION "0.1.0"
#define ATA_HD_BASE 0xfff00000
#define ATA_HD_CONTROL 0x39
static struct scsi_host_template pata_falcon_sht = {
ATA_PIO_SHT(DRV_NAME),
};
static unsigned int pata_falcon_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;
struct scsi_cmnd *cmd = qc->scsicmd;
bool swap = 1;
if (dev->class == ATA_DEV_ATA && cmd && cmd->request &&
!blk_rq_is_passthrough(cmd->request))
swap = 0;
/* Transfer multiple of 2 bytes */
if (rw == READ) {
if (swap)
raw_insw_swapw((u16 *)data_addr, (u16 *)buf, words);
else
raw_insw((u16 *)data_addr, (u16 *)buf, words);
} else {
if (swap)
raw_outsw_swapw((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) {
if (swap)
raw_insw_swapw((u16 *)data_addr, (u16 *)pad, 1);
else
raw_insw((u16 *)data_addr, (u16 *)pad, 1);
*buf = pad[0];
} else {
pad[0] = *buf;
if (swap)
raw_outsw_swapw((u16 *)data_addr, (u16 *)pad, 1);
else
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_falcon_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 struct ata_port_operations pata_falcon_ops = {
.inherits = &ata_sff_port_ops,
.sff_data_xfer = pata_falcon_data_xfer,
.cable_detect = ata_cable_unknown,
.set_mode = pata_falcon_set_mode,
};
static int pata_falcon_init_one(void)
{
struct ata_host *host;
struct ata_port *ap;
struct platform_device *pdev;
void __iomem *base;
if (!MACH_IS_ATARI || !ATARIHW_PRESENT(IDE))
return -ENODEV;
pr_info(DRV_NAME ": Atari Falcon PATA controller\n");
pdev = platform_device_register_simple(DRV_NAME, 0, NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
if (!devm_request_mem_region(&pdev->dev, ATA_HD_BASE, 0x40, 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];
ap->ops = &pata_falcon_ops;
ap->pio_mask = ATA_PIO4;
ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY;
ap->flags |= ATA_FLAG_PIO_POLLING;
base = (void __iomem *)ATA_HD_BASE;
ap->ioaddr.data_addr = base;
ap->ioaddr.error_addr = base + 1 + 1 * 4;
ap->ioaddr.feature_addr = base + 1 + 1 * 4;
ap->ioaddr.nsect_addr = base + 1 + 2 * 4;
ap->ioaddr.lbal_addr = base + 1 + 3 * 4;
ap->ioaddr.lbam_addr = base + 1 + 4 * 4;
ap->ioaddr.lbah_addr = base + 1 + 5 * 4;
ap->ioaddr.device_addr = base + 1 + 6 * 4;
ap->ioaddr.status_addr = base + 1 + 7 * 4;
ap->ioaddr.command_addr = base + 1 + 7 * 4;
ap->ioaddr.altstatus_addr = base + ATA_HD_CONTROL;
ap->ioaddr.ctl_addr = base + ATA_HD_CONTROL;
ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", (unsigned long)base,
(unsigned long)base + ATA_HD_CONTROL);
/* activate */
return ata_host_activate(host, 0, NULL, 0, &pata_falcon_sht);
}
module_init(pata_falcon_init_one);
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
MODULE_DESCRIPTION("low-level driver for Atari Falcon PATA");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
...@@ -40,13 +40,13 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error) ...@@ -40,13 +40,13 @@ static int ixp4xx_set_mode(struct ata_link *link, struct ata_device **error)
return 0; return 0;
} }
static unsigned int ixp4xx_mmio_data_xfer(struct ata_device *dev, static unsigned int ixp4xx_mmio_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw) unsigned char *buf, unsigned int buflen, int rw)
{ {
unsigned int i; unsigned int i;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
u16 *buf16 = (u16 *) buf; u16 *buf16 = (u16 *) buf;
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *mmio = ap->ioaddr.data_addr; void __iomem *mmio = ap->ioaddr.data_addr;
struct ixp4xx_pata_data *data = dev_get_platdata(ap->host->dev); struct ixp4xx_pata_data *data = dev_get_platdata(ap->host->dev);
......
...@@ -303,11 +303,12 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev) ...@@ -303,11 +303,12 @@ static void pdc20230_set_piomode(struct ata_port *ap, struct ata_device *adev)
} }
static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw) unsigned char *buf, unsigned int buflen, int rw)
{ {
int slop = buflen & 3; struct ata_device *dev = qc->dev;
struct ata_port *ap = dev->link->ap; struct ata_port *ap = dev->link->ap;
int slop = buflen & 3;
/* 32bit I/O capable *and* we need to write a whole number of dwords */ /* 32bit I/O capable *and* we need to write a whole number of dwords */
if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3) if (ata_id_has_dword_io(dev->id) && (slop == 0 || slop == 3)
...@@ -340,7 +341,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_device *dev, ...@@ -340,7 +341,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_device *dev,
} }
local_irq_restore(flags); local_irq_restore(flags);
} else } else
buflen = ata_sff_data_xfer_noirq(dev, buf, buflen, rw); buflen = ata_sff_data_xfer_noirq(qc, buf, buflen, rw);
return buflen; return buflen;
} }
...@@ -702,9 +703,11 @@ static unsigned int qdi_qc_issue(struct ata_queued_cmd *qc) ...@@ -702,9 +703,11 @@ static unsigned int qdi_qc_issue(struct ata_queued_cmd *qc)
return ata_sff_qc_issue(qc); return ata_sff_qc_issue(qc);
} }
static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_device *adev = qc->dev;
struct ata_port *ap = adev->link->ap; struct ata_port *ap = adev->link->ap;
int slop = buflen & 3; int slop = buflen & 3;
...@@ -727,7 +730,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf, ...@@ -727,7 +730,7 @@ static unsigned int vlb32_data_xfer(struct ata_device *adev, unsigned char *buf,
} }
return (buflen + 3) & ~3; return (buflen + 3) & ~3;
} else } else
return ata_sff_data_xfer(adev, buf, buflen, rw); return ata_sff_data_xfer(qc, buf, buflen, rw);
} }
static int qdi_port(struct platform_device *dev, static int qdi_port(struct platform_device *dev,
......
...@@ -138,9 +138,7 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev) ...@@ -138,9 +138,7 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev)
int trh; int trh;
int pause; int pause;
/* These names are timing parameters from the ATA spec */ /* These names are timing parameters from the ATA spec */
int t1;
int t2; int t2;
int t2i;
/* /*
* A divisor value of four will overflow the timing fields at * A divisor value of four will overflow the timing fields at
...@@ -154,15 +152,9 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev) ...@@ -154,15 +152,9 @@ static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev)
BUG_ON(ata_timing_compute(dev, dev->pio_mode, &timing, T, T)); BUG_ON(ata_timing_compute(dev, dev->pio_mode, &timing, T, T));
t1 = timing.setup;
if (t1)
t1--;
t2 = timing.active; t2 = timing.active;
if (t2) if (t2)
t2--; t2--;
t2i = timing.act8b;
if (t2i)
t2i--;
trh = ns_to_tim_reg(div, 20); trh = ns_to_tim_reg(div, 20);
if (trh) if (trh)
...@@ -293,17 +285,17 @@ static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev) ...@@ -293,17 +285,17 @@ static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
/** /**
* Handle an 8 bit I/O request. * Handle an 8 bit I/O request.
* *
* @dev: Device to access * @qc: Queued command
* @buffer: Data buffer * @buffer: Data buffer
* @buflen: Length of the buffer. * @buflen: Length of the buffer.
* @rw: True to write. * @rw: True to write.
*/ */
static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, static unsigned int octeon_cf_data_xfer8(struct ata_queued_cmd *qc,
unsigned char *buffer, unsigned char *buffer,
unsigned int buflen, unsigned int buflen,
int rw) int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned long words; unsigned long words;
int count; int count;
...@@ -332,17 +324,17 @@ static unsigned int octeon_cf_data_xfer8(struct ata_device *dev, ...@@ -332,17 +324,17 @@ static unsigned int octeon_cf_data_xfer8(struct ata_device *dev,
/** /**
* Handle a 16 bit I/O request. * Handle a 16 bit I/O request.
* *
* @dev: Device to access * @qc: Queued command
* @buffer: Data buffer * @buffer: Data buffer
* @buflen: Length of the buffer. * @buflen: Length of the buffer.
* @rw: True to write. * @rw: True to write.
*/ */
static unsigned int octeon_cf_data_xfer16(struct ata_device *dev, static unsigned int octeon_cf_data_xfer16(struct ata_queued_cmd *qc,
unsigned char *buffer, unsigned char *buffer,
unsigned int buflen, unsigned int buflen,
int rw) int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned long words; unsigned long words;
int count; int count;
......
...@@ -32,7 +32,6 @@ static int pata_of_platform_probe(struct platform_device *ofdev) ...@@ -32,7 +32,6 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
unsigned int reg_shift = 0; unsigned int reg_shift = 0;
int pio_mode = 0; int pio_mode = 0;
int pio_mask; int pio_mask;
const u32 *prop;
ret = of_address_to_resource(dn, 0, &io_res); ret = of_address_to_resource(dn, 0, &io_res);
if (ret) { if (ret) {
...@@ -50,13 +49,9 @@ static int pata_of_platform_probe(struct platform_device *ofdev) ...@@ -50,13 +49,9 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
prop = of_get_property(dn, "reg-shift", NULL); of_property_read_u32(dn, "reg-shift", &reg_shift);
if (prop)
reg_shift = be32_to_cpup(prop);
prop = of_get_property(dn, "pio-mode", NULL); if (!of_property_read_u32(dn, "pio-mode", &pio_mode)) {
if (prop) {
pio_mode = be32_to_cpup(prop);
if (pio_mode > 6) { if (pio_mode > 6) {
dev_err(&ofdev->dev, "invalid pio-mode\n"); dev_err(&ofdev->dev, "invalid pio-mode\n");
return -EINVAL; return -EINVAL;
......
...@@ -90,7 +90,7 @@ static int pcmcia_set_mode_8bit(struct ata_link *link, ...@@ -90,7 +90,7 @@ static int pcmcia_set_mode_8bit(struct ata_link *link,
/** /**
* ata_data_xfer_8bit - Transfer data by 8bit PIO * ata_data_xfer_8bit - Transfer data by 8bit PIO
* @dev: device to target * @qc: queued command
* @buf: data buffer * @buf: data buffer
* @buflen: buffer length * @buflen: buffer length
* @rw: read/write * @rw: read/write
...@@ -101,10 +101,10 @@ static int pcmcia_set_mode_8bit(struct ata_link *link, ...@@ -101,10 +101,10 @@ static int pcmcia_set_mode_8bit(struct ata_link *link,
* Inherited from caller. * Inherited from caller.
*/ */
static unsigned int ata_data_xfer_8bit(struct ata_device *dev, static unsigned int ata_data_xfer_8bit(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw) unsigned char *buf, unsigned int buflen, int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
if (rw == READ) if (rw == READ)
ioread8_rep(ap->ioaddr.data_addr, buf, buflen); ioread8_rep(ap->ioaddr.data_addr, buf, buflen);
......
...@@ -263,10 +263,10 @@ static u8 pata_s3c_check_altstatus(struct ata_port *ap) ...@@ -263,10 +263,10 @@ static u8 pata_s3c_check_altstatus(struct ata_port *ap)
/* /*
* pata_s3c_data_xfer - Transfer data by PIO * pata_s3c_data_xfer - Transfer data by PIO
*/ */
static unsigned int pata_s3c_data_xfer(struct ata_device *dev, static unsigned int pata_s3c_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw) unsigned char *buf, unsigned int buflen, int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
struct s3c_ide_info *info = ap->host->private_data; struct s3c_ide_info *info = ap->host->private_data;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1, i; unsigned int words = buflen >> 1, i;
......
...@@ -4067,6 +4067,7 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4067,6 +4067,7 @@ static int mv_platform_probe(struct platform_device *pdev)
struct ata_host *host; struct ata_host *host;
struct mv_host_priv *hpriv; struct mv_host_priv *hpriv;
struct resource *res; struct resource *res;
void __iomem *mmio;
int n_ports = 0, irq = 0; int n_ports = 0, irq = 0;
int rc; int rc;
int port; int port;
...@@ -4085,8 +4086,9 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4085,8 +4086,9 @@ static int mv_platform_probe(struct platform_device *pdev)
* Get the register base first * Get the register base first
*/ */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) mmio = devm_ioremap_resource(&pdev->dev, res);
return -EINVAL; if (IS_ERR(mmio))
return PTR_ERR(mmio);
/* allocate host */ /* allocate host */
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
...@@ -4130,12 +4132,7 @@ static int mv_platform_probe(struct platform_device *pdev) ...@@ -4130,12 +4132,7 @@ static int mv_platform_probe(struct platform_device *pdev)
hpriv->board_idx = chip_soc; hpriv->board_idx = chip_soc;
host->iomap = NULL; host->iomap = NULL;
hpriv->base = devm_ioremap(&pdev->dev, res->start, hpriv->base = mmio - SATAHC0_REG_BASE;
resource_size(res));
if (!hpriv->base)
return -ENOMEM;
hpriv->base -= SATAHC0_REG_BASE;
hpriv->clk = clk_get(&pdev->dev, NULL); hpriv->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(hpriv->clk)) if (IS_ERR(hpriv->clk))
...@@ -4529,7 +4526,7 @@ static void __exit mv_exit(void) ...@@ -4529,7 +4526,7 @@ static void __exit mv_exit(void)
MODULE_AUTHOR("Brett Russ"); MODULE_AUTHOR("Brett Russ");
MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers"); MODULE_DESCRIPTION("SCSI low-level driver for Marvell SATA controllers");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL v2");
MODULE_DEVICE_TABLE(pci, mv_pci_tbl); MODULE_DEVICE_TABLE(pci, mv_pci_tbl);
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
MODULE_ALIAS("platform:" DRV_NAME); MODULE_ALIAS("platform:" DRV_NAME);
......
...@@ -447,11 +447,11 @@ static void sata_rcar_exec_command(struct ata_port *ap, ...@@ -447,11 +447,11 @@ static void sata_rcar_exec_command(struct ata_port *ap,
ata_sff_pause(ap); ata_sff_pause(ap);
} }
static unsigned int sata_rcar_data_xfer(struct ata_device *dev, static unsigned int sata_rcar_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned char *buf,
unsigned int buflen, int rw) unsigned int buflen, int rw)
{ {
struct ata_port *ap = dev->link->ap; struct ata_port *ap = qc->dev->link->ap;
void __iomem *data_addr = ap->ioaddr.data_addr; void __iomem *data_addr = ap->ioaddr.data_addr;
unsigned int words = buflen >> 1; unsigned int words = buflen >> 1;
......
...@@ -968,7 +968,7 @@ struct ata_port_operations { ...@@ -968,7 +968,7 @@ struct ata_port_operations {
void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf); void (*sff_tf_read)(struct ata_port *ap, struct ata_taskfile *tf);
void (*sff_exec_command)(struct ata_port *ap, void (*sff_exec_command)(struct ata_port *ap,
const struct ata_taskfile *tf); const struct ata_taskfile *tf);
unsigned int (*sff_data_xfer)(struct ata_device *dev, unsigned int (*sff_data_xfer)(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
void (*sff_irq_on)(struct ata_port *); void (*sff_irq_on)(struct ata_port *);
bool (*sff_irq_check)(struct ata_port *); bool (*sff_irq_check)(struct ata_port *);
...@@ -1825,11 +1825,11 @@ extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); ...@@ -1825,11 +1825,11 @@ extern void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf); extern void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
extern void ata_sff_exec_command(struct ata_port *ap, extern void ata_sff_exec_command(struct ata_port *ap,
const struct ata_taskfile *tf); const struct ata_taskfile *tf);
extern unsigned int ata_sff_data_xfer(struct ata_device *dev, extern unsigned int ata_sff_data_xfer(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
extern unsigned int ata_sff_data_xfer32(struct ata_device *dev, extern unsigned int ata_sff_data_xfer32(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, extern unsigned int ata_sff_data_xfer_noirq(struct ata_queued_cmd *qc,
unsigned char *buf, unsigned int buflen, int rw); unsigned char *buf, unsigned int buflen, int rw);
extern void ata_sff_irq_on(struct ata_port *ap); extern void ata_sff_irq_on(struct ata_port *ap);
extern void ata_sff_irq_clear(struct ata_port *ap); extern void ata_sff_irq_clear(struct ata_port *ap);
......
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