Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e13e5f0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  libata: accept late unlocking of HPA
  libata: Updates and fixes for pata_at91 driver
  ata_piix: Add new short cable ID
  ata_piix: Add new laptop short cable IDs
  ahci: add device IDs for Ibex Peak ahci controllers
  libata: remove superfluous NULL pointer checks
  libata: add missing NULL pointer check to ata_eh_reset()
  pata_pcmcia: add CNF-CDROM-ID
parents ccf5675a 5920dadf
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -515,10 +515,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
	{ PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3a05), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3a22), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3a22), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3a25), board_ahci }, /* ICH10 */
	{ PCI_VDEVICE(INTEL, 0x3b22), board_ahci }, /* PCH AHCI */
	{ PCI_VDEVICE(INTEL, 0x3b23), board_ahci }, /* PCH AHCI */
	{ PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b24), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b25), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b29), board_ahci }, /* PCH AHCI */
	{ PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */
	{ PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */


	/* JMicron 360/1/3/5/6, match class to avoid IDE function */
	/* JMicron 360/1/3/5/6, match class to avoid IDE function */
	{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
	{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+3 −0
Original line number Original line Diff line number Diff line
@@ -596,9 +596,12 @@ static const struct ich_laptop ich_laptop[] = {
	{ 0x27DF, 0x0005, 0x0280 },	/* ICH7 on Acer 5602WLMi */
	{ 0x27DF, 0x0005, 0x0280 },	/* ICH7 on Acer 5602WLMi */
	{ 0x27DF, 0x1025, 0x0102 },	/* ICH7 on Acer 5602aWLMi */
	{ 0x27DF, 0x1025, 0x0102 },	/* ICH7 on Acer 5602aWLMi */
	{ 0x27DF, 0x1025, 0x0110 },	/* ICH7 on Acer 3682WLMi */
	{ 0x27DF, 0x1025, 0x0110 },	/* ICH7 on Acer 3682WLMi */
	{ 0x27DF, 0x1028, 0x02b0 },	/* ICH7 on unknown Dell */
	{ 0x27DF, 0x1043, 0x1267 },	/* ICH7 on Asus W5F */
	{ 0x27DF, 0x1043, 0x1267 },	/* ICH7 on Asus W5F */
	{ 0x27DF, 0x103C, 0x30A1 },	/* ICH7 on HP Compaq nc2400 */
	{ 0x27DF, 0x103C, 0x30A1 },	/* ICH7 on HP Compaq nc2400 */
	{ 0x27DF, 0x103C, 0x361a },	/* ICH7 on unkown HP  */
	{ 0x27DF, 0x1071, 0xD221 },	/* ICH7 on Hercules EC-900 */
	{ 0x27DF, 0x1071, 0xD221 },	/* ICH7 on Hercules EC-900 */
	{ 0x27DF, 0x152D, 0x0778 },	/* ICH7 on unknown Intel */
	{ 0x24CA, 0x1025, 0x0061 },	/* ICH4 on ACER Aspire 2023WLMi */
	{ 0x24CA, 0x1025, 0x0061 },	/* ICH4 on ACER Aspire 2023WLMi */
	{ 0x24CA, 0x1025, 0x003d },	/* ICH4 on ACER TM290 */
	{ 0x24CA, 0x1025, 0x003d },	/* ICH4 on ACER TM290 */
	{ 0x266F, 0x1025, 0x0066 },	/* ICH6 on ACER Aspire 1694WLMi */
	{ 0x266F, 0x1025, 0x0066 },	/* ICH6 on ACER Aspire 1694WLMi */
+23 −7
Original line number Original line Diff line number Diff line
@@ -1515,6 +1515,7 @@ static int ata_hpa_resize(struct ata_device *dev)


		return rc;
		return rc;
	}
	}
	dev->n_native_sectors = native_sectors;


	/* nothing to do? */
	/* nothing to do? */
	if (native_sectors <= sectors || !ata_ignore_hpa) {
	if (native_sectors <= sectors || !ata_ignore_hpa) {
@@ -4099,6 +4100,7 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
		       unsigned int readid_flags)
		       unsigned int readid_flags)
{
{
	u64 n_sectors = dev->n_sectors;
	u64 n_sectors = dev->n_sectors;
	u64 n_native_sectors = dev->n_native_sectors;
	int rc;
	int rc;


	if (!ata_dev_enabled(dev))
	if (!ata_dev_enabled(dev))
@@ -4128,17 +4130,31 @@ int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
	/* verify n_sectors hasn't changed */
	/* verify n_sectors hasn't changed */
	if (dev->class == ATA_DEV_ATA && n_sectors &&
	if (dev->class == ATA_DEV_ATA && n_sectors &&
	    dev->n_sectors != n_sectors) {
	    dev->n_sectors != n_sectors) {
		ata_dev_printk(dev, KERN_INFO, "n_sectors mismatch "
		ata_dev_printk(dev, KERN_WARNING, "n_sectors mismatch "
			       "%llu != %llu\n",
			       "%llu != %llu\n",
			       (unsigned long long)n_sectors,
			       (unsigned long long)n_sectors,
			       (unsigned long long)dev->n_sectors);
			       (unsigned long long)dev->n_sectors);

		/*
		/* restore original n_sectors */
		 * Something could have caused HPA to be unlocked
		 * involuntarily.  If n_native_sectors hasn't changed
		 * and the new size matches it, keep the device.
		 */
		if (dev->n_native_sectors == n_native_sectors &&
		    dev->n_sectors > n_sectors &&
		    dev->n_sectors == n_native_sectors) {
			ata_dev_printk(dev, KERN_WARNING,
				       "new n_sectors matches native, probably "
				       "late HPA unlock, continuing\n");
			/* keep using the old n_sectors */
			dev->n_sectors = n_sectors;
		} else {
			/* restore original n_[native]_sectors and fail */
			dev->n_native_sectors = n_native_sectors;
			dev->n_sectors = n_sectors;
			dev->n_sectors = n_sectors;

			rc = -ENODEV;
			rc = -ENODEV;
			goto fail;
			goto fail;
		}
		}
	}


	return 0;
	return 0;


+1 −1
Original line number Original line Diff line number Diff line
@@ -2327,7 +2327,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
	struct ata_port *ap = link->ap;
	struct ata_port *ap = link->ap;
	struct ata_link *slave = ap->slave_link;
	struct ata_link *slave = ap->slave_link;
	struct ata_eh_context *ehc = &link->eh_context;
	struct ata_eh_context *ehc = &link->eh_context;
	struct ata_eh_context *sehc = &slave->eh_context;
	struct ata_eh_context *sehc = slave ? &slave->eh_context : NULL;
	unsigned int *classes = ehc->classes;
	unsigned int *classes = ehc->classes;
	unsigned int lflags = link->flags;
	unsigned int lflags = link->flags;
	int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
	int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
+36 −31
Original line number Original line Diff line number Diff line
@@ -26,9 +26,7 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/ata_platform.h>
#include <linux/ata_platform.h>


#include <mach/at91sam9260_matrix.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91sam9_smc.h>
#include <mach/at91sam9260.h>
#include <mach/board.h>
#include <mach/board.h>
#include <mach/gpio.h>
#include <mach/gpio.h>


@@ -44,14 +42,16 @@ struct at91_ide_info {
	unsigned long mode;
	unsigned long mode;
	unsigned int cs;
	unsigned int cs;


	struct clk *mck;

	void __iomem *ide_addr;
	void __iomem *ide_addr;
	void __iomem *alt_addr;
	void __iomem *alt_addr;
};
};


const struct ata_timing initial_timing =
static const struct ata_timing initial_timing =
	{XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0};
	{XFER_PIO_0, 70, 290, 240, 600, 165, 150, 600, 0};


static unsigned int calc_mck_cycles(unsigned int ns, unsigned int mck_hz)
static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz)
{
{
	unsigned long mul;
	unsigned long mul;


@@ -77,32 +77,27 @@ static void set_smc_mode(struct at91_ide_info *info)
static void set_smc_timing(struct device *dev,
static void set_smc_timing(struct device *dev,
		struct at91_ide_info *info, const struct ata_timing *ata)
		struct at91_ide_info *info, const struct ata_timing *ata)
{
{
	int read_cycle, write_cycle, active, recover;
	unsigned long read_cycle, write_cycle, active, recover;
	int nrd_setup, nrd_pulse, nrd_recover;
	unsigned long nrd_setup, nrd_pulse, nrd_recover;
	int nwe_setup, nwe_pulse;
	unsigned long nwe_setup, nwe_pulse;


	int ncs_write_setup, ncs_write_pulse;
	unsigned long ncs_write_setup, ncs_write_pulse;
	int ncs_read_setup, ncs_read_pulse;
	unsigned long ncs_read_setup, ncs_read_pulse;


	unsigned int mck_hz;
	unsigned long mck_hz;
	struct clk *mck;


	read_cycle  = ata->cyc8b;
	read_cycle  = ata->cyc8b;
	nrd_setup   = ata->setup;
	nrd_setup   = ata->setup;
	nrd_pulse   = ata->act8b;
	nrd_pulse   = ata->act8b;
	nrd_recover = ata->rec8b;
	nrd_recover = ata->rec8b;


	mck = clk_get(NULL, "mck");
	mck_hz = clk_get_rate(info->mck);
	BUG_ON(IS_ERR(mck));
	mck_hz = clk_get_rate(mck);


	read_cycle  = calc_mck_cycles(read_cycle, mck_hz);
	read_cycle  = calc_mck_cycles(read_cycle, mck_hz);
	nrd_setup   = calc_mck_cycles(nrd_setup, mck_hz);
	nrd_setup   = calc_mck_cycles(nrd_setup, mck_hz);
	nrd_pulse   = calc_mck_cycles(nrd_pulse, mck_hz);
	nrd_pulse   = calc_mck_cycles(nrd_pulse, mck_hz);
	nrd_recover = calc_mck_cycles(nrd_recover, mck_hz);
	nrd_recover = calc_mck_cycles(nrd_recover, mck_hz);


	clk_put(mck);

	active  = nrd_setup + nrd_pulse;
	active  = nrd_setup + nrd_pulse;
	recover = read_cycle - active;
	recover = read_cycle - active;


@@ -121,13 +116,13 @@ static void set_smc_timing(struct device *dev,
	ncs_write_setup = ncs_read_setup;
	ncs_write_setup = ncs_read_setup;
	ncs_write_pulse = ncs_read_pulse;
	ncs_write_pulse = ncs_read_pulse;


	dev_dbg(dev, "ATA timings: nrd_setup = %d nrd_pulse = %d nrd_cycle = %d\n",
	dev_dbg(dev, "ATA timings: nrd_setup = %lu nrd_pulse = %lu nrd_cycle = %lu\n",
			nrd_setup, nrd_pulse, read_cycle);
			nrd_setup, nrd_pulse, read_cycle);
	dev_dbg(dev, "ATA timings: nwe_setup = %d nwe_pulse = %d nwe_cycle = %d\n",
	dev_dbg(dev, "ATA timings: nwe_setup = %lu nwe_pulse = %lu nwe_cycle = %lu\n",
			nwe_setup, nwe_pulse, write_cycle);
			nwe_setup, nwe_pulse, write_cycle);
	dev_dbg(dev, "ATA timings: ncs_read_setup = %d ncs_read_pulse = %d\n",
	dev_dbg(dev, "ATA timings: ncs_read_setup = %lu ncs_read_pulse = %lu\n",
			ncs_read_setup, ncs_read_pulse);
			ncs_read_setup, ncs_read_pulse);
	dev_dbg(dev, "ATA timings: ncs_write_setup = %d ncs_write_pulse = %d\n",
	dev_dbg(dev, "ATA timings: ncs_write_setup = %lu ncs_write_pulse = %lu\n",
			ncs_write_setup, ncs_write_pulse);
			ncs_write_setup, ncs_write_pulse);


	at91_sys_write(AT91_SMC_SETUP(info->cs),
	at91_sys_write(AT91_SMC_SETUP(info->cs),
@@ -217,6 +212,7 @@ static int __devinit pata_at91_probe(struct platform_device *pdev)
	struct resource *mem_res;
	struct resource *mem_res;
	struct ata_host *host;
	struct ata_host *host;
	struct ata_port *ap;
	struct ata_port *ap;

	int irq_flags = 0;
	int irq_flags = 0;
	int irq = 0;
	int irq = 0;
	int ret;
	int ret;
@@ -261,6 +257,13 @@ static int __devinit pata_at91_probe(struct platform_device *pdev)
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	info->mck = clk_get(NULL, "mck");

	if (IS_ERR(info->mck)) {
		dev_err(dev, "failed to get access to mck clock\n");
		return -ENODEV;
	}

	info->cs    = board->chipselect;
	info->cs    = board->chipselect;
	info->mode  = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
	info->mode  = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
		AT91_SMC_EXNWMODE_READY | AT91_SMC_BAT_SELECT |
		AT91_SMC_EXNWMODE_READY | AT91_SMC_BAT_SELECT |
@@ -304,6 +307,7 @@ err_alt_ioremap:
	devm_iounmap(dev, info->ide_addr);
	devm_iounmap(dev, info->ide_addr);


err_ide_ioremap:
err_ide_ioremap:
	clk_put(info->mck);
	kfree(info);
	kfree(info);


	return ret;
	return ret;
@@ -326,6 +330,7 @@ static int __devexit pata_at91_remove(struct platform_device *pdev)


	devm_iounmap(dev, info->ide_addr);
	devm_iounmap(dev, info->ide_addr);
	devm_iounmap(dev, info->alt_addr);
	devm_iounmap(dev, info->alt_addr);
	clk_put(info->mck);


	kfree(info);
	kfree(info);
	return 0;
	return 0;
Loading