Commit 90621ed8 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6:
  it8213: fix return value in it8213_init_one()
  palm_bk3710: fix IDECLK period calculation
  ide: add __ide_default_irq() inline helper
parents 9c0fc4e2 be305042
...@@ -76,7 +76,7 @@ struct palm_bk3710_udmatiming { ...@@ -76,7 +76,7 @@ struct palm_bk3710_udmatiming {
#include "../ide-timing.h" #include "../ide-timing.h"
static long ide_palm_clk; static unsigned ideclk_period; /* in nanoseconds */
static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = {
{160, 240}, /* UDMA Mode 0 */ {160, 240}, /* UDMA Mode 0 */
...@@ -86,8 +86,6 @@ static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { ...@@ -86,8 +86,6 @@ static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = {
{85, 60}, /* UDMA Mode 4 */ {85, 60}, /* UDMA Mode 4 */
}; };
static struct clk *ideclkp;
static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
unsigned int mode) unsigned int mode)
{ {
...@@ -97,10 +95,10 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, ...@@ -97,10 +95,10 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
/* DMA Data Setup */ /* DMA Data Setup */
t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime, t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime,
ide_palm_clk) - 1; ideclk_period) - 1;
tenv = DIV_ROUND_UP(20, ide_palm_clk) - 1; tenv = DIV_ROUND_UP(20, ideclk_period) - 1;
trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime, trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime,
ide_palm_clk) - 1; ideclk_period) - 1;
/* udmatim Register */ /* udmatim Register */
val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0);
...@@ -141,8 +139,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev, ...@@ -141,8 +139,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev,
cycletime = max_t(int, t->cycle, min_cycle); cycletime = max_t(int, t->cycle, min_cycle);
/* DMA Data Setup */ /* DMA Data Setup */
t0 = DIV_ROUND_UP(cycletime, ide_palm_clk); t0 = DIV_ROUND_UP(cycletime, ideclk_period);
td = DIV_ROUND_UP(t->active, ide_palm_clk); td = DIV_ROUND_UP(t->active, ideclk_period);
tkw = t0 - td - 1; tkw = t0 - td - 1;
td -= 1; td -= 1;
...@@ -168,9 +166,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, ...@@ -168,9 +166,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
struct ide_timing *t; struct ide_timing *t;
/* PIO Data Setup */ /* PIO Data Setup */
t0 = DIV_ROUND_UP(cycletime, ide_palm_clk); t0 = DIV_ROUND_UP(cycletime, ideclk_period);
t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active, t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active,
ide_palm_clk); ideclk_period);
t2i = t0 - t2 - 1; t2i = t0 - t2 - 1;
t2 -= 1; t2 -= 1;
...@@ -192,8 +190,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate, ...@@ -192,8 +190,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
/* TASKFILE Setup */ /* TASKFILE Setup */
t = ide_timing_find_mode(XFER_PIO_0 + mode); t = ide_timing_find_mode(XFER_PIO_0 + mode);
t0 = DIV_ROUND_UP(t->cyc8b, ide_palm_clk); t0 = DIV_ROUND_UP(t->cyc8b, ideclk_period);
t2 = DIV_ROUND_UP(t->act8b, ide_palm_clk); t2 = DIV_ROUND_UP(t->act8b, ideclk_period);
t2i = t0 - t2 - 1; t2i = t0 - t2 - 1;
t2 -= 1; t2 -= 1;
...@@ -350,22 +348,22 @@ static const struct ide_port_info __devinitdata palm_bk3710_port_info = { ...@@ -350,22 +348,22 @@ static const struct ide_port_info __devinitdata palm_bk3710_port_info = {
static int __devinit palm_bk3710_probe(struct platform_device *pdev) static int __devinit palm_bk3710_probe(struct platform_device *pdev)
{ {
struct clk *clkp; struct clk *clk;
struct resource *mem, *irq; struct resource *mem, *irq;
ide_hwif_t *hwif; ide_hwif_t *hwif;
unsigned long base; unsigned long base, rate;
int i; int i;
hw_regs_t hw; hw_regs_t hw;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
clkp = clk_get(NULL, "IDECLK"); clk = clk_get(NULL, "IDECLK");
if (IS_ERR(clkp)) if (IS_ERR(clk))
return -ENODEV; return -ENODEV;
ideclkp = clkp; clk_enable(clk);
clk_enable(ideclkp); rate = clk_get_rate(clk);
ide_palm_clk = clk_get_rate(ideclkp)/100000; ideclk_period = 1000000000UL / rate;
ide_palm_clk = (10000/ide_palm_clk) + 1;
/* Register the IDE interface with Linux ATA Interface */ /* Register the IDE interface with Linux ATA Interface */
memset(&hw, 0, sizeof(hw)); memset(&hw, 0, sizeof(hw));
......
...@@ -1218,16 +1218,12 @@ static void drive_release_dev (struct device *dev) ...@@ -1218,16 +1218,12 @@ static void drive_release_dev (struct device *dev)
complete(&drive->gendev_rel_comp); complete(&drive->gendev_rel_comp);
} }
#ifndef ide_default_irq
#define ide_default_irq(irq) 0
#endif
static int hwif_init(ide_hwif_t *hwif) static int hwif_init(ide_hwif_t *hwif)
{ {
int old_irq; int old_irq;
if (!hwif->irq) { if (!hwif->irq) {
hwif->irq = ide_default_irq(hwif->io_ports.data_addr); hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
if (!hwif->irq) { if (!hwif->irq) {
printk("%s: DISABLED, NO IRQ\n", hwif->name); printk("%s: DISABLED, NO IRQ\n", hwif->name);
return 0; return 0;
...@@ -1257,7 +1253,7 @@ static int hwif_init(ide_hwif_t *hwif) ...@@ -1257,7 +1253,7 @@ static int hwif_init(ide_hwif_t *hwif)
* It failed to initialise. Find the default IRQ for * It failed to initialise. Find the default IRQ for
* this port and try that. * this port and try that.
*/ */
hwif->irq = ide_default_irq(hwif->io_ports.data_addr); hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
if (!hwif->irq) { if (!hwif->irq) {
printk("%s: Disabled unable to get IRQ %d.\n", printk("%s: Disabled unable to get IRQ %d.\n",
hwif->name, old_irq); hwif->name, old_irq);
......
...@@ -184,8 +184,7 @@ static const struct ide_port_info it8213_chipsets[] __devinitdata = { ...@@ -184,8 +184,7 @@ static const struct ide_port_info it8213_chipsets[] __devinitdata = {
static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit it8213_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ {
ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]); return ide_setup_pci_device(dev, &it8213_chipsets[id->driver_data]);
return 0;
} }
static const struct pci_device_id it8213_pci_tbl[] = { static const struct pci_device_id it8213_pci_tbl[] = {
......
...@@ -225,10 +225,6 @@ static int ns87415_dma_setup(ide_drive_t *drive) ...@@ -225,10 +225,6 @@ static int ns87415_dma_setup(ide_drive_t *drive)
return 1; return 1;
} }
#ifndef ide_default_irq
#define ide_default_irq(irq) 0
#endif
static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
{ {
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *dev = to_pci_dev(hwif->dev);
...@@ -288,7 +284,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif) ...@@ -288,7 +284,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
} }
if (!using_inta) if (!using_inta)
hwif->irq = ide_default_irq(hwif->io_ports.data_addr); hwif->irq = __ide_default_irq(hwif->io_ports.data_addr);
else if (!hwif->irq && hwif->mate && hwif->mate->irq) else if (!hwif->irq && hwif->mate && hwif->mate->irq)
hwif->irq = hwif->mate->irq; /* share IRQ with mate */ hwif->irq = hwif->mate->irq; /* share IRQ with mate */
......
...@@ -189,6 +189,21 @@ static inline void ide_std_init_ports(hw_regs_t *hw, ...@@ -189,6 +189,21 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
hw->io_ports.ctl_addr = ctl_addr; hw->io_ports.ctl_addr = ctl_addr;
} }
/* for IDE PCI controllers in legacy mode, temporary */
static inline int __ide_default_irq(unsigned long base)
{
switch (base) {
#ifdef CONFIG_IA64
case 0x1f0: return isa_irq_to_vector(14);
case 0x170: return isa_irq_to_vector(15);
#else
case 0x1f0: return 14;
case 0x170: return 15;
#endif
}
return 0;
}
#include <asm/ide.h> #include <asm/ide.h>
#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED) #if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
......
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