Commit 4e0c64cf authored by 's avatar Committed by Greg Kroah-Hartman

Merge HEAD from gregkh@master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6.git

parents fae91e72 67d2c36e
...@@ -2,43 +2,68 @@ ...@@ -2,43 +2,68 @@
# Makefile for the WatchDog device drivers. # Makefile for the WatchDog device drivers.
# #
# Only one watchdog can succeed. We probe the ISA/PCI/USB based
# watchdog-cards first, then the architecture specific watchdog
# drivers and then the architecture independant "softdog" driver.
# This means that if your ISA/PCI/USB card isn't detected that
# you can fall back to an architecture specific driver and if
# that also fails then you can fall back to the software watchdog
# to give you some cover.
# ISA-based Watchdog Cards
obj-$(CONFIG_PCWATCHDOG) += pcwd.o obj-$(CONFIG_PCWATCHDOG) += pcwd.o
obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
obj-$(CONFIG_IB700_WDT) += ib700wdt.o
obj-$(CONFIG_MIXCOMWD) += mixcomwd.o obj-$(CONFIG_MIXCOMWD) += mixcomwd.o
obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
obj-$(CONFIG_WDT) += wdt.o obj-$(CONFIG_WDT) += wdt.o
# PCI-based Watchdog Cards
obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o
obj-$(CONFIG_WDTPCI) += wdt_pci.o obj-$(CONFIG_WDTPCI) += wdt_pci.o
# USB-based Watchdog Cards
obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
# ARM Architecture
obj-$(CONFIG_21285_WATCHDOG) += wdt285.o obj-$(CONFIG_21285_WATCHDOG) += wdt285.o
obj-$(CONFIG_977_WATCHDOG) += wdt977.o obj-$(CONFIG_977_WATCHDOG) += wdt977.o
obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
obj-$(CONFIG_MACHZ_WDT) += machzwd.o obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
obj-$(CONFIG_SH_WDT) += shwdt.o
obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o # X86 (i386 + ia64 + x86_64) Architecture
obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
obj-$(CONFIG_SC520_WDT) += sc520_wdt.o obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o obj-$(CONFIG_ALIM1535_WDT) += alim1535_wdt.o
obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o obj-$(CONFIG_ALIM7101_WDT) += alim7101_wdt.o
obj-$(CONFIG_SC520_WDT) += sc520_wdt.o
obj-$(CONFIG_EUROTECH_WDT) += eurotechwdt.o
obj-$(CONFIG_IB700_WDT) += ib700wdt.o
obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o
obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o obj-$(CONFIG_CPU5_WDT) += cpu5wdt.o
obj-$(CONFIG_INDYDOG) += indydog.o obj-$(CONFIG_W83627HF_WDT) += w83627hf_wdt.o
obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o obj-$(CONFIG_W83877F_WDT) += w83877f_wdt.o
obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o obj-$(CONFIG_MACHZ_WDT) += machzwd.o
obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o # PowerPC Architecture
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
# PPC64 Architecture
obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
# Only one watchdog can succeed. We probe the hardware watchdog # MIPS Architecture
# drivers first, then the softdog driver. This means if your hardware obj-$(CONFIG_INDYDOG) += indydog.o
# watchdog dies or is 'borrowed' for some reason the software watchdog
# still gives you some cover. # S390 Architecture
# SUPERH Architecture
obj-$(CONFIG_SH_WDT) += shwdt.o
# SPARC64 Architecture
# Architecture Independant
obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
...@@ -182,7 +182,7 @@ static struct file_operations ixp2000_wdt_fops = ...@@ -182,7 +182,7 @@ static struct file_operations ixp2000_wdt_fops =
static struct miscdevice ixp2000_wdt_miscdev = static struct miscdevice ixp2000_wdt_miscdev =
{ {
.minor = WATCHDOG_MINOR, .minor = WATCHDOG_MINOR,
.name = "IXP2000 Watchdog", .name = "watchdog",
.fops = &ixp2000_wdt_fops, .fops = &ixp2000_wdt_fops,
}; };
......
...@@ -176,7 +176,7 @@ static struct file_operations ixp4xx_wdt_fops = ...@@ -176,7 +176,7 @@ static struct file_operations ixp4xx_wdt_fops =
static struct miscdevice ixp4xx_wdt_miscdev = static struct miscdevice ixp4xx_wdt_miscdev =
{ {
.minor = WATCHDOG_MINOR, .minor = WATCHDOG_MINOR,
.name = "IXP4xx Watchdog", .name = "watchdog",
.fops = &ixp4xx_wdt_fops, .fops = &ixp4xx_wdt_fops,
}; };
......
...@@ -27,7 +27,10 @@ ...@@ -27,7 +27,10 @@
* Fixed tmr_count / wdt_count confusion * Fixed tmr_count / wdt_count confusion
* Added configurable debug * Added configurable debug
* *
* 11-Jan-2004 BJD Fixed divide-by-2 in timeout code * 11-Jan-2005 BJD Fixed divide-by-2 in timeout code
*
* 25-Jan-2005 DA Added suspend/resume support
* Replaced reboot notifier with .shutdown method
* *
* 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
*/ */
...@@ -40,8 +43,6 @@ ...@@ -40,8 +43,6 @@
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -317,20 +318,6 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file, ...@@ -317,20 +318,6 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file,
} }
} }
/*
* Notifier for system down
*/
static int s3c2410wdt_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
if(code==SYS_DOWN || code==SYS_HALT) {
/* Turn the WDT off */
s3c2410wdt_stop();
}
return NOTIFY_DONE;
}
/* kernel interface */ /* kernel interface */
static struct file_operations s3c2410wdt_fops = { static struct file_operations s3c2410wdt_fops = {
...@@ -348,10 +335,6 @@ static struct miscdevice s3c2410wdt_miscdev = { ...@@ -348,10 +335,6 @@ static struct miscdevice s3c2410wdt_miscdev = {
.fops = &s3c2410wdt_fops, .fops = &s3c2410wdt_fops,
}; };
static struct notifier_block s3c2410wdt_notifier = {
.notifier_call = s3c2410wdt_notify_sys,
};
/* interrupt handler code */ /* interrupt handler code */
static irqreturn_t s3c2410wdt_irq(int irqno, void *param, static irqreturn_t s3c2410wdt_irq(int irqno, void *param,
...@@ -432,18 +415,10 @@ static int s3c2410wdt_probe(struct device *dev) ...@@ -432,18 +415,10 @@ static int s3c2410wdt_probe(struct device *dev)
} }
} }
ret = register_reboot_notifier(&s3c2410wdt_notifier);
if (ret) {
printk (KERN_ERR PFX "cannot register reboot notifier (%d)\n",
ret);
return ret;
}
ret = misc_register(&s3c2410wdt_miscdev); ret = misc_register(&s3c2410wdt_miscdev);
if (ret) { if (ret) {
printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n", printk (KERN_ERR PFX "cannot register miscdev on minor=%d (%d)\n",
WATCHDOG_MINOR, ret); WATCHDOG_MINOR, ret);
unregister_reboot_notifier(&s3c2410wdt_notifier);
return ret; return ret;
} }
...@@ -479,15 +454,63 @@ static int s3c2410wdt_remove(struct device *dev) ...@@ -479,15 +454,63 @@ static int s3c2410wdt_remove(struct device *dev)
return 0; return 0;
} }
static void s3c2410wdt_shutdown(struct device *dev)
{
s3c2410wdt_stop();
}
#ifdef CONFIG_PM
static unsigned long wtcon_save;
static unsigned long wtdat_save;
static int s3c2410wdt_suspend(struct device *dev, u32 state, u32 level)
{
if (level == SUSPEND_POWER_DOWN) {
/* Save watchdog state, and turn it off. */
wtcon_save = readl(wdt_base + S3C2410_WTCON);
wtdat_save = readl(wdt_base + S3C2410_WTDAT);
/* Note that WTCNT doesn't need to be saved. */
s3c2410wdt_stop();
}
return 0;
}
static int s3c2410wdt_resume(struct device *dev, u32 level)
{
if (level == RESUME_POWER_ON) {
/* Restore watchdog state. */
writel(wtdat_save, wdt_base + S3C2410_WTDAT);
writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
writel(wtcon_save, wdt_base + S3C2410_WTCON);
printk(KERN_INFO PFX "watchdog %sabled\n",
(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
}
return 0;
}
#else
#define s3c2410wdt_suspend NULL
#define s3c2410wdt_resume NULL
#endif /* CONFIG_PM */
static struct device_driver s3c2410wdt_driver = { static struct device_driver s3c2410wdt_driver = {
.name = "s3c2410-wdt", .name = "s3c2410-wdt",
.bus = &platform_bus_type, .bus = &platform_bus_type,
.probe = s3c2410wdt_probe, .probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove, .remove = s3c2410wdt_remove,
.shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume,
}; };
static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n"; static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics\n";
static int __init watchdog_init(void) static int __init watchdog_init(void)
...@@ -499,13 +522,13 @@ static int __init watchdog_init(void) ...@@ -499,13 +522,13 @@ static int __init watchdog_init(void)
static void __exit watchdog_exit(void) static void __exit watchdog_exit(void)
{ {
driver_unregister(&s3c2410wdt_driver); driver_unregister(&s3c2410wdt_driver);
unregister_reboot_notifier(&s3c2410wdt_notifier);
} }
module_init(watchdog_init); module_init(watchdog_init);
module_exit(watchdog_exit); module_exit(watchdog_exit);
MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>, "
"Dimitry Andric <dimitry.andric@tomtom.com>");
MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver"); MODULE_DESCRIPTION("S3C2410 Watchdog Device Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
...@@ -206,7 +206,7 @@ static struct file_operations scx200_wdt_fops = { ...@@ -206,7 +206,7 @@ static struct file_operations scx200_wdt_fops = {
static struct miscdevice scx200_wdt_miscdev = { static struct miscdevice scx200_wdt_miscdev = {
.minor = WATCHDOG_MINOR, .minor = WATCHDOG_MINOR,
.name = NAME, .name = "watchdog",
.fops = &scx200_wdt_fops, .fops = &scx200_wdt_fops,
}; };
......
...@@ -77,7 +77,7 @@ static void watchdog_fire(unsigned long); ...@@ -77,7 +77,7 @@ static void watchdog_fire(unsigned long);
static struct timer_list watchdog_ticktock = static struct timer_list watchdog_ticktock =
TIMER_INITIALIZER(watchdog_fire, 0, 0); TIMER_INITIALIZER(watchdog_fire, 0, 0);
static unsigned long timer_alive; static unsigned long driver_open, orphan_timer;
static char expect_close; static char expect_close;
...@@ -87,6 +87,9 @@ static char expect_close; ...@@ -87,6 +87,9 @@ static char expect_close;
static void watchdog_fire(unsigned long data) static void watchdog_fire(unsigned long data)
{ {
if (test_and_clear_bit(0, &orphan_timer))
module_put(THIS_MODULE);
if (soft_noboot) if (soft_noboot)
printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n"); printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
else else
...@@ -128,9 +131,9 @@ static int softdog_set_heartbeat(int t) ...@@ -128,9 +131,9 @@ static int softdog_set_heartbeat(int t)
static int softdog_open(struct inode *inode, struct file *file) static int softdog_open(struct inode *inode, struct file *file)
{ {
if(test_and_set_bit(0, &timer_alive)) if (test_and_set_bit(0, &driver_open))
return -EBUSY; return -EBUSY;
if (nowayout) if (!test_and_clear_bit(0, &orphan_timer))
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
/* /*
* Activate timer * Activate timer
...@@ -147,11 +150,13 @@ static int softdog_release(struct inode *inode, struct file *file) ...@@ -147,11 +150,13 @@ static int softdog_release(struct inode *inode, struct file *file)
*/ */
if (expect_close == 42) { if (expect_close == 42) {
softdog_stop(); softdog_stop();
module_put(THIS_MODULE);
} else { } else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
set_bit(0, &orphan_timer);
softdog_keepalive(); softdog_keepalive();
} }
clear_bit(0, &timer_alive); clear_bit(0, &driver_open);
expect_close = 0; expect_close = 0;
return 0; return 0;
} }
......
...@@ -93,6 +93,12 @@ w83627hf_init(void) ...@@ -93,6 +93,12 @@ w83627hf_init(void)
w83627hf_select_wd_register(); w83627hf_select_wd_register();
outb_p(0xF6, WDT_EFER); /* Select CRF6 */
t=inb_p(WDT_EFDR); /* read CRF6 */
if (t != 0) {
printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */
}
outb_p(0xF5, WDT_EFER); /* Select CRF5 */ outb_p(0xF5, WDT_EFER); /* Select CRF5 */
t=inb_p(WDT_EFDR); /* read CRF5 */ t=inb_p(WDT_EFDR); /* read CRF5 */
t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */ t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */
......
...@@ -189,7 +189,6 @@ static void ahci_irq_clear(struct ata_port *ap); ...@@ -189,7 +189,6 @@ static void ahci_irq_clear(struct ata_port *ap);
static void ahci_eng_timeout(struct ata_port *ap); static void ahci_eng_timeout(struct ata_port *ap);
static int ahci_port_start(struct ata_port *ap); static int ahci_port_start(struct ata_port *ap);
static void ahci_port_stop(struct ata_port *ap); static void ahci_port_stop(struct ata_port *ap);
static void ahci_host_stop(struct ata_host_set *host_set);
static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
static void ahci_qc_prep(struct ata_queued_cmd *qc); static void ahci_qc_prep(struct ata_queued_cmd *qc);
static u8 ahci_check_status(struct ata_port *ap); static u8 ahci_check_status(struct ata_port *ap);
...@@ -242,7 +241,6 @@ static struct ata_port_operations ahci_ops = { ...@@ -242,7 +241,6 @@ static struct ata_port_operations ahci_ops = {
.port_start = ahci_port_start, .port_start = ahci_port_start,
.port_stop = ahci_port_stop, .port_stop = ahci_port_stop,
.host_stop = ahci_host_stop,
}; };
static struct ata_port_info ahci_port_info[] = { static struct ata_port_info ahci_port_info[] = {
...@@ -296,17 +294,9 @@ static inline unsigned long ahci_port_base_ul (unsigned long base, unsigned int ...@@ -296,17 +294,9 @@ static inline unsigned long ahci_port_base_ul (unsigned long base, unsigned int
return base + 0x100 + (port * 0x80); return base + 0x100 + (port * 0x80);
} }
static inline void *ahci_port_base (void *base, unsigned int port) static inline void __iomem *ahci_port_base (void __iomem *base, unsigned int port)
{ {
return (void *) ahci_port_base_ul((unsigned long)base, port); return (void __iomem *) ahci_port_base_ul((unsigned long)base, port);
}
static void ahci_host_stop(struct ata_host_set *host_set)
{
struct ahci_host_priv *hpriv = host_set->private_data;
kfree(hpriv);
ata_host_stop(host_set);
} }
static int ahci_port_start(struct ata_port *ap) static int ahci_port_start(struct ata_port *ap)
...@@ -314,8 +304,9 @@ static int ahci_port_start(struct ata_port *ap) ...@@ -314,8 +304,9 @@ static int ahci_port_start(struct ata_port *ap)
struct device *dev = ap->host_set->dev; struct device *dev = ap->host_set->dev;
struct ahci_host_priv *hpriv = ap->host_set->private_data; struct ahci_host_priv *hpriv = ap->host_set->private_data;
struct ahci_port_priv *pp; struct ahci_port_priv *pp;
void *mem, *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no); void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
void *mem;
dma_addr_t mem_dma; dma_addr_t mem_dma;
pp = kmalloc(sizeof(*pp), GFP_KERNEL); pp = kmalloc(sizeof(*pp), GFP_KERNEL);
...@@ -383,8 +374,8 @@ static void ahci_port_stop(struct ata_port *ap) ...@@ -383,8 +374,8 @@ static void ahci_port_stop(struct ata_port *ap)
{ {
struct device *dev = ap->host_set->dev; struct device *dev = ap->host_set->dev;
struct ahci_port_priv *pp = ap->private_data; struct ahci_port_priv *pp = ap->private_data;
void *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no); void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 tmp; u32 tmp;
tmp = readl(port_mmio + PORT_CMD); tmp = readl(port_mmio + PORT_CMD);
...@@ -546,8 +537,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) ...@@ -546,8 +537,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
{ {
void *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no); void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 tmp; u32 tmp;
int work; int work;
...@@ -595,8 +586,8 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) ...@@ -595,8 +586,8 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
static void ahci_eng_timeout(struct ata_port *ap) static void ahci_eng_timeout(struct ata_port *ap)
{ {
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base; void __iomem *mmio = host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no); void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
struct ata_queued_cmd *qc; struct ata_queued_cmd *qc;
unsigned long flags; unsigned long flags;
...@@ -626,8 +617,8 @@ static void ahci_eng_timeout(struct ata_port *ap) ...@@ -626,8 +617,8 @@ static void ahci_eng_timeout(struct ata_port *ap)
static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
{ {
void *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no); void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 status, serr, ci; u32 status, serr, ci;
serr = readl(port_mmio + PORT_SCR_ERR); serr = readl(port_mmio + PORT_SCR_ERR);
...@@ -663,7 +654,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * ...@@ -663,7 +654,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
struct ata_host_set *host_set = dev_instance; struct ata_host_set *host_set = dev_instance;
struct ahci_host_priv *hpriv; struct ahci_host_priv *hpriv;
unsigned int i, handled = 0; unsigned int i, handled = 0;
void *mmio; void __iomem *mmio;
u32 irq_stat, irq_ack = 0; u32 irq_stat, irq_ack = 0;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
...@@ -709,7 +700,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs * ...@@ -709,7 +700,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
static int ahci_qc_issue(struct ata_queued_cmd *qc) static int ahci_qc_issue(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
void *port_mmio = (void *) ap->ioaddr.cmd_addr; void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
writel(1, port_mmio + PORT_CMD_ISSUE); writel(1, port_mmio + PORT_CMD_ISSUE);
readl(port_mmio + PORT_CMD_ISSUE); /* flush */ readl(port_mmio + PORT_CMD_ISSUE); /* flush */
...@@ -894,7 +885,7 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent) ...@@ -894,7 +885,7 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
{ {
struct ahci_host_priv *hpriv = probe_ent->private_data; struct ahci_host_priv *hpriv = probe_ent->private_data;
struct pci_dev *pdev = to_pci_dev(probe_ent->dev); struct pci_dev *pdev = to_pci_dev(probe_ent->dev);
void *mmio = probe_ent->mmio_base; void __iomem *mmio = probe_ent->mmio_base;
u32 vers, cap, impl, speed; u32 vers, cap, impl, speed;
const char *speed_s; const char *speed_s;
u16 cc; u16 cc;
...@@ -967,7 +958,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -967,7 +958,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
struct ahci_host_priv *hpriv; struct ahci_host_priv *hpriv;
unsigned long base; unsigned long base;
void *mmio_base; void __iomem *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int have_msi, pci_dev_busy = 0; int have_msi, pci_dev_busy = 0;
int rc; int rc;
...@@ -1004,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1004,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent->dev = pci_dev_to_dev(pdev); probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
mmio_base = ioremap(pci_resource_start(pdev, AHCI_PCI_BAR), mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0);
pci_resource_len(pdev, AHCI_PCI_BAR));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
...@@ -1049,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1049,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_hpriv: err_out_hpriv:
kfree(hpriv); kfree(hpriv);
err_out_iounmap: err_out_iounmap:
iounmap(mmio_base); pci_iounmap(pdev, mmio_base);
err_out_free_ent: err_out_free_ent:
kfree(probe_ent); kfree(probe_ent);
err_out_msi: err_out_msi:
...@@ -1089,7 +1079,8 @@ static void ahci_remove_one (struct pci_dev *pdev) ...@@ -1089,7 +1079,8 @@ static void ahci_remove_one (struct pci_dev *pdev)
scsi_host_put(ap->host); scsi_host_put(ap->host);
} }
host_set->ops->host_stop(host_set); kfree(hpriv);
pci_iounmap(pdev, host_set->mmio_base);
kfree(host_set); kfree(host_set);
if (have_msi) if (have_msi)
...@@ -1106,7 +1097,6 @@ static int __init ahci_init(void) ...@@ -1106,7 +1097,6 @@ static int __init ahci_init(void)
return pci_module_init(&ahci_pci_driver); return pci_module_init(&ahci_pci_driver);
} }
static void __exit ahci_exit(void) static void __exit ahci_exit(void)
{ {
pci_unregister_driver(&ahci_pci_driver); pci_unregister_driver(&ahci_pci_driver);
......
...@@ -583,8 +583,7 @@ static void pci_enable_intx(struct pci_dev *pdev) ...@@ -583,8 +583,7 @@ static void pci_enable_intx(struct pci_dev *pdev)
#define AHCI_ENABLE (1 << 31) #define AHCI_ENABLE (1 << 31)
static int piix_disable_ahci(struct pci_dev *pdev) static int piix_disable_ahci(struct pci_dev *pdev)
{ {
void *mmio; void __iomem *mmio;
unsigned long addr;
u32 tmp; u32 tmp;
int rc = 0; int rc = 0;
...@@ -592,11 +591,11 @@ static int piix_disable_ahci(struct pci_dev *pdev) ...@@ -592,11 +591,11 @@ static int piix_disable_ahci(struct pci_dev *pdev)
* works because this device is usually set up by BIOS. * works because this device is usually set up by BIOS.
*/ */
addr = pci_resource_start(pdev, AHCI_PCI_BAR); if (!pci_resource_start(pdev, AHCI_PCI_BAR) ||
if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) !pci_resource_len(pdev, AHCI_PCI_BAR))
return 0; return 0;
mmio = ioremap(addr, 64); mmio = pci_iomap(pdev, AHCI_PCI_BAR, 64);
if (!mmio) if (!mmio)
return -ENOMEM; return -ENOMEM;
...@@ -610,7 +609,7 @@ static int piix_disable_ahci(struct pci_dev *pdev) ...@@ -610,7 +609,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
rc = -EIO; rc = -EIO;
} }
iounmap(mmio); pci_iounmap(pdev, mmio);
return rc; return rc;
} }
......
...@@ -75,6 +75,10 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc); ...@@ -75,6 +75,10 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc);
static unsigned int ata_unique_id = 1; static unsigned int ata_unique_id = 1;
static struct workqueue_struct *ata_wq; static struct workqueue_struct *ata_wq;
int atapi_enabled = 0;
module_param(atapi_enabled, int, 0444);
MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
MODULE_AUTHOR("Jeff Garzik"); MODULE_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("Library module for ATA devices"); MODULE_DESCRIPTION("Library module for ATA devices");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -4200,6 +4204,15 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) ...@@ -4200,6 +4204,15 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
#ifdef CONFIG_PCI
void ata_pci_host_stop (struct ata_host_set *host_set)
{
struct pci_dev *pdev = to_pci_dev(host_set->dev);
pci_iounmap(pdev, host_set->mmio_base);
}
/** /**
* ata_pci_init_native_mode - Initialize native-mode driver * ata_pci_init_native_mode - Initialize native-mode driver
* @pdev: pci device to be initialized * @pdev: pci device to be initialized
...@@ -4212,7 +4225,6 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) ...@@ -4212,7 +4225,6 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
* ata_probe_ent structure should then be freed with kfree(). * ata_probe_ent structure should then be freed with kfree().
*/ */
#ifdef CONFIG_PCI
struct ata_probe_ent * struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port) ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port)
{ {
...@@ -4595,6 +4607,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_simulate); ...@@ -4595,6 +4607,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_simulate);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
EXPORT_SYMBOL_GPL(pci_test_config_bits); EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL(ata_pci_host_stop);
EXPORT_SYMBOL_GPL(ata_pci_init_native_mode); EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
EXPORT_SYMBOL_GPL(ata_pci_init_one); EXPORT_SYMBOL_GPL(ata_pci_init_one);
EXPORT_SYMBOL_GPL(ata_pci_remove_one); EXPORT_SYMBOL_GPL(ata_pci_remove_one);
......
...@@ -1470,10 +1470,10 @@ ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev) ...@@ -1470,10 +1470,10 @@ ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev)
if (unlikely(!ata_dev_present(dev))) if (unlikely(!ata_dev_present(dev)))
return NULL; return NULL;
#ifndef ATA_ENABLE_ATAPI if (!atapi_enabled) {
if (unlikely(dev->class == ATA_DEV_ATAPI)) if (unlikely(dev->class == ATA_DEV_ATAPI))
return NULL; return NULL;
#endif }
return dev; return dev;
} }
......
...@@ -38,6 +38,7 @@ struct ata_scsi_args { ...@@ -38,6 +38,7 @@ struct ata_scsi_args {
}; };
/* libata-core.c */ /* libata-core.c */
extern int atapi_enabled;
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
struct ata_device *dev); struct ata_device *dev);
extern void ata_qc_free(struct ata_queued_cmd *qc); extern void ata_qc_free(struct ata_queued_cmd *qc);
......
...@@ -351,6 +351,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val) ...@@ -351,6 +351,7 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
static void nv_host_stop (struct ata_host_set *host_set) static void nv_host_stop (struct ata_host_set *host_set)
{ {
struct nv_host *host = host_set->private_data; struct nv_host *host = host_set->private_data;
struct pci_dev *pdev = to_pci_dev(host_set->dev);
// Disable hotplug event interrupts. // Disable hotplug event interrupts.
if (host->host_desc->disable_hotplug) if (host->host_desc->disable_hotplug)
...@@ -358,7 +359,8 @@ static void nv_host_stop (struct ata_host_set *host_set) ...@@ -358,7 +359,8 @@ static void nv_host_stop (struct ata_host_set *host_set)
kfree(host); kfree(host);
ata_host_stop(host_set); if (host_set->mmio_base)
pci_iounmap(pdev, host_set->mmio_base);
} }
static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
...@@ -420,8 +422,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -420,8 +422,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) { if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) {
unsigned long base; unsigned long base;
probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5), probe_ent->mmio_base = pci_iomap(pdev, 5, 0);
pci_resource_len(pdev, 5));
if (probe_ent->mmio_base == NULL) { if (probe_ent->mmio_base == NULL) {
rc = -EIO; rc = -EIO;
goto err_out_free_host; goto err_out_free_host;
...@@ -457,7 +458,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -457,7 +458,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_iounmap: err_out_iounmap:
if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
iounmap(probe_ent->mmio_base); pci_iounmap(pdev, probe_ent->mmio_base);
err_out_free_host: err_out_free_host:
kfree(host); kfree(host);
err_out_free_ent: err_out_free_ent:
......
...@@ -92,6 +92,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf); ...@@ -92,6 +92,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
static void pdc_irq_clear(struct ata_port *ap); static void pdc_irq_clear(struct ata_port *ap);
static int pdc_qc_issue_prot(struct ata_queued_cmd *qc); static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);
static Scsi_Host_Template pdc_ata_sht = { static Scsi_Host_Template pdc_ata_sht = {
.module = THIS_MODULE, .module = THIS_MODULE,
.name = DRV_NAME, .name = DRV_NAME,
...@@ -132,7 +133,7 @@ static struct ata_port_operations pdc_sata_ops = { ...@@ -132,7 +133,7 @@ static struct ata_port_operations pdc_sata_ops = {
.scr_write = pdc_sata_scr_write, .scr_write = pdc_sata_scr_write,
.port_start = pdc_port_start, .port_start = pdc_port_start,
.port_stop = pdc_port_stop, .port_stop = pdc_port_stop,
.host_stop = ata_host_stop, .host_stop = ata_pci_host_stop,
}; };
static struct ata_port_operations pdc_pata_ops = { static struct ata_port_operations pdc_pata_ops = {
...@@ -153,7 +154,7 @@ static struct ata_port_operations pdc_pata_ops = { ...@@ -153,7 +154,7 @@ static struct ata_port_operations pdc_pata_ops = {
.port_start = pdc_port_start, .port_start = pdc_port_start,
.port_stop = pdc_port_stop, .port_stop = pdc_port_stop,
.host_stop = ata_host_stop, .host_stop = ata_pci_host_stop,
}; };
static struct ata_port_info pdc_port_info[] = { static struct ata_port_info pdc_port_info[] = {
...@@ -282,7 +283,7 @@ static void pdc_port_stop(struct ata_port *ap) ...@@ -282,7 +283,7 @@ static void pdc_port_stop(struct ata_port *ap)
static void pdc_reset_port(struct ata_port *ap) static void pdc_reset_port(struct ata_port *ap)
{ {
void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT; void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
unsigned int i; unsigned int i;
u32 tmp; u32 tmp;
...@@ -418,7 +419,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap, ...@@ -418,7 +419,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
u8 status; u8 status;
unsigned int handled = 0, have_err = 0; unsigned int handled = 0, have_err = 0;
u32 tmp; u32 tmp;
void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
tmp = readl(mmio); tmp = readl(mmio);
if (tmp & PDC_ERR_MASK) { if (tmp & PDC_ERR_MASK) {
...@@ -447,7 +448,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap, ...@@ -447,7 +448,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
static void pdc_irq_clear(struct ata_port *ap) static void pdc_irq_clear(struct ata_port *ap)
{ {
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base; void __iomem *mmio = host_set->mmio_base;
readl(mmio + PDC_INT_SEQMASK); readl(mmio + PDC_INT_SEQMASK);
} }
...@@ -459,7 +460,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r ...@@ -459,7 +460,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
u32 mask = 0; u32 mask = 0;
unsigned int i, tmp; unsigned int i, tmp;
unsigned int handled = 0; unsigned int handled = 0;
void *mmio_base; void __iomem *mmio_base;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
...@@ -581,7 +582,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base) ...@@ -581,7 +582,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base)
static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe) static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
{ {
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
u32 tmp; u32 tmp;
/* /*
...@@ -624,7 +625,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -624,7 +625,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
static int printed_version; static int printed_version;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
void *mmio_base; void __iomem *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0; int pci_dev_busy = 0;
int rc; int rc;
...@@ -663,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -663,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
probe_ent->dev = pci_dev_to_dev(pdev); probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
mmio_base = ioremap(pci_resource_start(pdev, 3), mmio_base = pci_iomap(pdev, 3, 0);
pci_resource_len(pdev, 3));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
......
...@@ -538,11 +538,12 @@ static void qs_port_stop(struct ata_port *ap) ...@@ -538,11 +538,12 @@ static void qs_port_stop(struct ata_port *ap)
static void qs_host_stop(struct ata_host_set *host_set) static void qs_host_stop(struct ata_host_set *host_set)
{ {
void __iomem *mmio_base = host_set->mmio_base; void __iomem *mmio_base = host_set->mmio_base;
struct pci_dev *pdev = to_pci_dev(host_set->dev);
writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */ writeb(0, mmio_base + QS_HCT_CTRL); /* disable host interrupts */
writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */ writeb(QS_CNFG3_GSRST, mmio_base + QS_HCF_CNFG3); /* global reset */
ata_host_stop(host_set); pci_iounmap(pdev, mmio_base);
} }
static void qs_host_init(unsigned int chip_id, struct ata_probe_ent *pe) static void qs_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
...@@ -646,8 +647,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, ...@@ -646,8 +647,7 @@ static int qs_ata_init_one(struct pci_dev *pdev,
goto err_out_regions; goto err_out_regions;
} }
mmio_base = ioremap(pci_resource_start(pdev, 4), mmio_base = pci_iomap(pdev, 4, 0);
pci_resource_len(pdev, 4));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_regions; goto err_out_regions;
...@@ -697,7 +697,7 @@ static int qs_ata_init_one(struct pci_dev *pdev, ...@@ -697,7 +697,7 @@ static int qs_ata_init_one(struct pci_dev *pdev,
return 0; return 0;
err_out_iounmap: err_out_iounmap:
iounmap(mmio_base); pci_iounmap(pdev, mmio_base);
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
......
...@@ -86,6 +86,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg); ...@@ -86,6 +86,7 @@ static u32 sil_scr_read (struct ata_port *ap, unsigned int sc_reg);
static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
static void sil_post_set_mode (struct ata_port *ap); static void sil_post_set_mode (struct ata_port *ap);
static struct pci_device_id sil_pci_tbl[] = { static struct pci_device_id sil_pci_tbl[] = {
{ 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
{ 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
...@@ -172,7 +173,7 @@ static struct ata_port_operations sil_ops = { ...@@ -172,7 +173,7 @@ static struct ata_port_operations sil_ops = {
.scr_write = sil_scr_write, .scr_write = sil_scr_write,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop, .host_stop = ata_pci_host_stop,
}; };
static struct ata_port_info sil_port_info[] = { static struct ata_port_info sil_port_info[] = {
...@@ -231,6 +232,7 @@ MODULE_LICENSE("GPL"); ...@@ -231,6 +232,7 @@ MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(pci, sil_pci_tbl); MODULE_DEVICE_TABLE(pci, sil_pci_tbl);
MODULE_VERSION(DRV_VERSION); MODULE_VERSION(DRV_VERSION);
static unsigned char sil_get_device_cache_line(struct pci_dev *pdev) static unsigned char sil_get_device_cache_line(struct pci_dev *pdev)
{ {
u8 cache_line = 0; u8 cache_line = 0;
...@@ -242,7 +244,8 @@ static void sil_post_set_mode (struct ata_port *ap) ...@@ -242,7 +244,8 @@ static void sil_post_set_mode (struct ata_port *ap)
{ {
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
struct ata_device *dev; struct ata_device *dev;
void *addr = host_set->mmio_base + sil_port[ap->port_no].xfer_mode; void __iomem *addr =
host_set->mmio_base + sil_port[ap->port_no].xfer_mode;
u32 tmp, dev_mode[2]; u32 tmp, dev_mode[2];
unsigned int i; unsigned int i;
...@@ -375,7 +378,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -375,7 +378,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
static int printed_version; static int printed_version;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
void *mmio_base; void __iomem *mmio_base;
int rc; int rc;
unsigned int i; unsigned int i;
int pci_dev_busy = 0; int pci_dev_busy = 0;
...@@ -425,8 +428,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -425,8 +428,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent->irq_flags = SA_SHIRQ; probe_ent->irq_flags = SA_SHIRQ;
probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags; probe_ent->host_flags = sil_port_info[ent->driver_data].host_flags;
mmio_base = ioremap(pci_resource_start(pdev, 5), mmio_base = pci_iomap(pdev, 5, 0);
pci_resource_len(pdev, 5));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
......
...@@ -318,7 +318,7 @@ static struct ata_port_operations k2_sata_ops = { ...@@ -318,7 +318,7 @@ static struct ata_port_operations k2_sata_ops = {
.scr_write = k2_sata_scr_write, .scr_write = k2_sata_scr_write,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop, .host_stop = ata_pci_host_stop,
}; };
static void k2_sata_setup_port(struct ata_ioports *port, unsigned long base) static void k2_sata_setup_port(struct ata_ioports *port, unsigned long base)
...@@ -346,7 +346,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -346,7 +346,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
static int printed_version; static int printed_version;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
void *mmio_base; void __iomem *mmio_base;
int pci_dev_busy = 0; int pci_dev_busy = 0;
int rc; int rc;
int i; int i;
...@@ -392,8 +392,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -392,8 +392,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
probe_ent->dev = pci_dev_to_dev(pdev); probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
mmio_base = ioremap(pci_resource_start(pdev, 5), mmio_base = pci_iomap(pdev, 5, 0);
pci_resource_len(pdev, 5));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
......
...@@ -245,13 +245,14 @@ static struct pci_driver pdc_sata_pci_driver = { ...@@ -245,13 +245,14 @@ static struct pci_driver pdc_sata_pci_driver = {
static void pdc20621_host_stop(struct ata_host_set *host_set) static void pdc20621_host_stop(struct ata_host_set *host_set)
{ {
struct pci_dev *pdev = to_pci_dev(host_set->dev);
struct pdc_host_priv *hpriv = host_set->private_data; struct pdc_host_priv *hpriv = host_set->private_data;
void *dimm_mmio = hpriv->dimm_mmio; void *dimm_mmio = hpriv->dimm_mmio;
iounmap(dimm_mmio); pci_iounmap(pdev, dimm_mmio);
kfree(hpriv); kfree(hpriv);
ata_host_stop(host_set); pci_iounmap(pdev, host_set->mmio_base);
} }
static int pdc_port_start(struct ata_port *ap) static int pdc_port_start(struct ata_port *ap)
...@@ -451,9 +452,9 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc) ...@@ -451,9 +452,9 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
struct scatterlist *sg = qc->sg; struct scatterlist *sg = qc->sg;
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct pdc_port_priv *pp = ap->private_data; struct pdc_port_priv *pp = ap->private_data;
void *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
struct pdc_host_priv *hpriv = ap->host_set->private_data; struct pdc_host_priv *hpriv = ap->host_set->private_data;
void *dimm_mmio = hpriv->dimm_mmio; void __iomem *dimm_mmio = hpriv->dimm_mmio;
unsigned int portno = ap->port_no; unsigned int portno = ap->port_no;
unsigned int i, last, idx, total_len = 0, sgt_len; unsigned int i, last, idx, total_len = 0, sgt_len;
u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ]; u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
...@@ -513,9 +514,9 @@ static void pdc20621_nodata_prep(struct ata_queued_cmd *qc) ...@@ -513,9 +514,9 @@ static void pdc20621_nodata_prep(struct ata_queued_cmd *qc)
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct pdc_port_priv *pp = ap->private_data; struct pdc_port_priv *pp = ap->private_data;
void *mmio = ap->host_set->mmio_base; void __iomem *mmio = ap->host_set->mmio_base;
struct pdc_host_priv *hpriv = ap->host_set->private_data; struct pdc_host_priv *hpriv = ap->host_set->private_data;
void *dimm_mmio = hpriv->dimm_mmio; void __iomem *dimm_mmio = hpriv->dimm_mmio;
unsigned int portno = ap->port_no; unsigned int portno = ap->port_no;
unsigned int i; unsigned int i;
...@@ -565,7 +566,7 @@ static void __pdc20621_push_hdma(struct ata_queued_cmd *qc, ...@@ -565,7 +566,7 @@ static void __pdc20621_push_hdma(struct ata_queued_cmd *qc,
{ {
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base; void __iomem *mmio = host_set->mmio_base;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -639,7 +640,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc) ...@@ -639,7 +640,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
struct ata_port *ap = qc->ap; struct ata_port *ap = qc->ap;
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
unsigned int port_no = ap->port_no; unsigned int port_no = ap->port_no;
void *mmio = host_set->mmio_base; void __iomem *mmio = host_set->mmio_base;
unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE); unsigned int rw = (qc->tf.flags & ATA_TFLAG_WRITE);
u8 seq = (u8) (port_no + 1); u8 seq = (u8) (port_no + 1);
unsigned int port_ofs; unsigned int port_ofs;
...@@ -699,7 +700,7 @@ static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc) ...@@ -699,7 +700,7 @@ static int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc)
static inline unsigned int pdc20621_host_intr( struct ata_port *ap, static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
struct ata_queued_cmd *qc, struct ata_queued_cmd *qc,
unsigned int doing_hdma, unsigned int doing_hdma,
void *mmio) void __iomem *mmio)
{ {
unsigned int port_no = ap->port_no; unsigned int port_no = ap->port_no;
unsigned int port_ofs = unsigned int port_ofs =
...@@ -778,7 +779,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, ...@@ -778,7 +779,7 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap,
static void pdc20621_irq_clear(struct ata_port *ap) static void pdc20621_irq_clear(struct ata_port *ap)
{ {
struct ata_host_set *host_set = ap->host_set; struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base; void __iomem *mmio = host_set->mmio_base;
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -792,7 +793,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re ...@@ -792,7 +793,7 @@ static irqreturn_t pdc20621_interrupt (int irq, void *dev_instance, struct pt_re
u32 mask = 0; u32 mask = 0;
unsigned int i, tmp, port_no; unsigned int i, tmp, port_no;
unsigned int handled = 0; unsigned int handled = 0;
void *mmio_base; void __iomem *mmio_base;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
...@@ -940,9 +941,9 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource, ...@@ -940,9 +941,9 @@ static void pdc20621_get_from_dimm(struct ata_probe_ent *pe, void *psource,
u16 idx; u16 idx;
u8 page_mask; u8 page_mask;
long dist; long dist;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
struct pdc_host_priv *hpriv = pe->private_data; struct pdc_host_priv *hpriv = pe->private_data;
void *dimm_mmio = hpriv->dimm_mmio; void __iomem *dimm_mmio = hpriv->dimm_mmio;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -996,9 +997,9 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, ...@@ -996,9 +997,9 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
u16 idx; u16 idx;
u8 page_mask; u8 page_mask;
long dist; long dist;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
struct pdc_host_priv *hpriv = pe->private_data; struct pdc_host_priv *hpriv = pe->private_data;
void *dimm_mmio = hpriv->dimm_mmio; void __iomem *dimm_mmio = hpriv->dimm_mmio;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -1044,7 +1045,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource, ...@@ -1044,7 +1045,7 @@ static void pdc20621_put_to_dimm(struct ata_probe_ent *pe, void *psource,
static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device, static unsigned int pdc20621_i2c_read(struct ata_probe_ent *pe, u32 device,
u32 subaddr, u32 *pdata) u32 subaddr, u32 *pdata)
{ {
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
u32 i2creg = 0; u32 i2creg = 0;
u32 status; u32 status;
u32 count =0; u32 count =0;
...@@ -1103,7 +1104,7 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe) ...@@ -1103,7 +1104,7 @@ static int pdc20621_prog_dimm0(struct ata_probe_ent *pe)
u32 data = 0; u32 data = 0;
int size, i; int size, i;
u8 bdimmsize; u8 bdimmsize;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
static const struct { static const struct {
unsigned int reg; unsigned int reg;
unsigned int ofs; unsigned int ofs;
...@@ -1166,7 +1167,7 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe) ...@@ -1166,7 +1167,7 @@ static unsigned int pdc20621_prog_dimm_global(struct ata_probe_ent *pe)
{ {
u32 data, spd0; u32 data, spd0;
int error, i; int error, i;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -1220,7 +1221,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe) ...@@ -1220,7 +1221,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
u32 ticks=0; u32 ticks=0;
u32 clock=0; u32 clock=0;
u32 fparam=0; u32 fparam=0;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -1344,7 +1345,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe) ...@@ -1344,7 +1345,7 @@ static unsigned int pdc20621_dimm_init(struct ata_probe_ent *pe)
static void pdc_20621_init(struct ata_probe_ent *pe) static void pdc_20621_init(struct ata_probe_ent *pe)
{ {
u32 tmp; u32 tmp;
void *mmio = pe->mmio_base; void __iomem *mmio = pe->mmio_base;
/* hard-code chip #0 */ /* hard-code chip #0 */
mmio += PDC_CHIP0_OFS; mmio += PDC_CHIP0_OFS;
...@@ -1377,7 +1378,8 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1377,7 +1378,8 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
static int printed_version; static int printed_version;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
void *mmio_base, *dimm_mmio = NULL; void __iomem *mmio_base;
void __iomem *dimm_mmio = NULL;
struct pdc_host_priv *hpriv = NULL; struct pdc_host_priv *hpriv = NULL;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0; int pci_dev_busy = 0;
...@@ -1417,8 +1419,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1417,8 +1419,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
probe_ent->dev = pci_dev_to_dev(pdev); probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
mmio_base = ioremap(pci_resource_start(pdev, 3), mmio_base = pci_iomap(pdev, 3, 0);
pci_resource_len(pdev, 3));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
...@@ -1432,8 +1433,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1432,8 +1433,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
} }
memset(hpriv, 0, sizeof(*hpriv)); memset(hpriv, 0, sizeof(*hpriv));
dimm_mmio = ioremap(pci_resource_start(pdev, 4), dimm_mmio = pci_iomap(pdev, 4, 0);
pci_resource_len(pdev, 4));
if (!dimm_mmio) { if (!dimm_mmio) {
kfree(hpriv); kfree(hpriv);
rc = -ENOMEM; rc = -ENOMEM;
...@@ -1480,9 +1480,9 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1480,9 +1480,9 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
err_out_iounmap_dimm: /* only get to this label if 20621 */ err_out_iounmap_dimm: /* only get to this label if 20621 */
kfree(hpriv); kfree(hpriv);
iounmap(dimm_mmio); pci_iounmap(pdev, dimm_mmio);
err_out_iounmap: err_out_iounmap:
iounmap(mmio_base); pci_iounmap(pdev, mmio_base);
err_out_free_ent: err_out_free_ent:
kfree(probe_ent); kfree(probe_ent);
err_out_regions: err_out_regions:
......
...@@ -252,7 +252,7 @@ static struct ata_port_operations vsc_sata_ops = { ...@@ -252,7 +252,7 @@ static struct ata_port_operations vsc_sata_ops = {
.scr_write = vsc_sata_scr_write, .scr_write = vsc_sata_scr_write,
.port_start = ata_port_start, .port_start = ata_port_start,
.port_stop = ata_port_stop, .port_stop = ata_port_stop,
.host_stop = ata_host_stop, .host_stop = ata_pci_host_stop,
}; };
static void __devinit vsc_sata_setup_port(struct ata_ioports *port, unsigned long base) static void __devinit vsc_sata_setup_port(struct ata_ioports *port, unsigned long base)
...@@ -326,8 +326,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d ...@@ -326,8 +326,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
probe_ent->dev = pci_dev_to_dev(pdev); probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node); INIT_LIST_HEAD(&probe_ent->node);
mmio_base = ioremap(pci_resource_start(pdev, 0), mmio_base = pci_iomap(pdev, 0, 0);
pci_resource_len(pdev, 0));
if (mmio_base == NULL) { if (mmio_base == NULL) {
rc = -ENOMEM; rc = -ENOMEM;
goto err_out_free_ent; goto err_out_free_ent;
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#undef ATA_VERBOSE_DEBUG /* yet more debugging output */ #undef ATA_VERBOSE_DEBUG /* yet more debugging output */
#undef ATA_IRQ_TRAP /* define to ack screaming irqs */ #undef ATA_IRQ_TRAP /* define to ack screaming irqs */
#undef ATA_NDEBUG /* define to disable quick runtime checks */ #undef ATA_NDEBUG /* define to disable quick runtime checks */
#undef ATA_ENABLE_ATAPI /* define to enable ATAPI support */
#undef ATA_ENABLE_PATA /* define to enable PATA support in some #undef ATA_ENABLE_PATA /* define to enable PATA support in some
* low-level drivers */ * low-level drivers */
#undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */ #undef ATAPI_ENABLE_DMADIR /* enables ATAPI DMADIR bridge support */
...@@ -450,6 +449,7 @@ struct pci_bits { ...@@ -450,6 +449,7 @@ struct pci_bits {
unsigned long val; unsigned long val;
}; };
extern void ata_pci_host_stop (struct ata_host_set *host_set);
extern struct ata_probe_ent * extern struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port); ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port);
extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits);
......
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