Commit a9a0aff5 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: (24 commits)
  m68k: amiga - RTC platform device conversion
  m68k: amiga - Parallel port platform device conversion
  m68k: amiga - Serial port platform device conversion
  m68k: amiga - Mouse platform device conversion
  m68k: amiga - Keyboard platform device conversion
  m68k: amiga - Amiga Gayle IDE platform device conversion
  m68k: amiga - A4000T SCSI platform device conversion
  m68k/scsi: a3000 - Do not use legacy Scsi_Host.base
  m68k: amiga - A3000 SCSI platform device conversion
  m68k/scsi: gvp11 - Do not use legacy Scsi_Host.base
  m68k: amiga - GVP Series II SCSI zorro_driver conversion
  m68k/scsi: a2091 - Do not use legacy Scsi_Host.base
  m68k: amiga - A2091/A590 SCSI zorro_driver conversion
  m68k/scsi: mvme147 - Kill obsolete HOSTS_C logic
  m68k/scsi: a3000 - Kill a3000_scsiregs typedef
  m68k/scsi: gvp11 - Kill gvp11_scsiregs typedef
  m68k/scsi: a2091 - Kill a2091_scsiregs typedef
  m68k/scsi: gvp11 - Extract check_wd33c93()
  m68k/scsi: a3000 - Kill static global a3000_host
  m68k/scsi: mvme147 - Kill static global mvme147_host
  ...
parents ade61088 0779c862
......@@ -7,6 +7,7 @@ config M68K
default y
select HAVE_AOUT
select HAVE_IDE
select GENERIC_ATOMIC64
config MMU
bool
......
......@@ -97,10 +97,6 @@ static void amiga_get_model(char *model);
static void amiga_get_hardware_list(struct seq_file *m);
/* amiga specific timer functions */
static unsigned long amiga_gettimeoffset(void);
static int a3000_hwclk(int, struct rtc_time *);
static int a2000_hwclk(int, struct rtc_time *);
static int amiga_set_clock_mmss(unsigned long);
static unsigned int amiga_get_ss(void);
extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset(void);
extern void amiga_init_sound(void);
......@@ -138,10 +134,6 @@ static struct {
}
};
static struct resource rtc_resource = {
.start = 0x00dc0000, .end = 0x00dcffff
};
static struct resource ram_resource[NUM_MEMINFO];
......@@ -387,15 +379,6 @@ void __init config_amiga(void)
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
mach_gettimeoffset = amiga_gettimeoffset;
if (AMIGAHW_PRESENT(A3000_CLK)) {
mach_hwclk = a3000_hwclk;
rtc_resource.name = "A3000 RTC";
request_resource(&iomem_resource, &rtc_resource);
} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
mach_hwclk = a2000_hwclk;
rtc_resource.name = "A2000 RTC";
request_resource(&iomem_resource, &rtc_resource);
}
/*
* default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
......@@ -404,8 +387,6 @@ void __init config_amiga(void)
*/
mach_max_dma_address = 0xffffffff;
mach_set_clock_mmss = amiga_set_clock_mmss;
mach_get_ss = amiga_get_ss;
mach_reset = amiga_reset;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
mach_beep = amiga_mksound;
......@@ -530,161 +511,6 @@ static unsigned long amiga_gettimeoffset(void)
return ticks + offset;
}
static int a3000_hwclk(int op, struct rtc_time *t)
{
tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
if (!op) { /* read */
t->tm_sec = tod_3000.second1 * 10 + tod_3000.second2;
t->tm_min = tod_3000.minute1 * 10 + tod_3000.minute2;
t->tm_hour = tod_3000.hour1 * 10 + tod_3000.hour2;
t->tm_mday = tod_3000.day1 * 10 + tod_3000.day2;
t->tm_wday = tod_3000.weekday;
t->tm_mon = tod_3000.month1 * 10 + tod_3000.month2 - 1;
t->tm_year = tod_3000.year1 * 10 + tod_3000.year2;
if (t->tm_year <= 69)
t->tm_year += 100;
} else {
tod_3000.second1 = t->tm_sec / 10;
tod_3000.second2 = t->tm_sec % 10;
tod_3000.minute1 = t->tm_min / 10;
tod_3000.minute2 = t->tm_min % 10;
tod_3000.hour1 = t->tm_hour / 10;
tod_3000.hour2 = t->tm_hour % 10;
tod_3000.day1 = t->tm_mday / 10;
tod_3000.day2 = t->tm_mday % 10;
if (t->tm_wday != -1)
tod_3000.weekday = t->tm_wday;
tod_3000.month1 = (t->tm_mon + 1) / 10;
tod_3000.month2 = (t->tm_mon + 1) % 10;
if (t->tm_year >= 100)
t->tm_year -= 100;
tod_3000.year1 = t->tm_year / 10;
tod_3000.year2 = t->tm_year % 10;
}
tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
return 0;
}
static int a2000_hwclk(int op, struct rtc_time *t)
{
int cnt = 5;
tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt) {
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
udelay(70);
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
--cnt;
}
if (!cnt)
printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
tod_2000.cntrl1);
if (!op) { /* read */
t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
t->tm_min = tod_2000.minute1 * 10 + tod_2000.minute2;
t->tm_hour = (tod_2000.hour1 & 3) * 10 + tod_2000.hour2;
t->tm_mday = tod_2000.day1 * 10 + tod_2000.day2;
t->tm_wday = tod_2000.weekday;
t->tm_mon = tod_2000.month1 * 10 + tod_2000.month2 - 1;
t->tm_year = tod_2000.year1 * 10 + tod_2000.year2;
if (t->tm_year <= 69)
t->tm_year += 100;
if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
t->tm_hour = 0;
else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
t->tm_hour += 12;
}
} else {
tod_2000.second1 = t->tm_sec / 10;
tod_2000.second2 = t->tm_sec % 10;
tod_2000.minute1 = t->tm_min / 10;
tod_2000.minute2 = t->tm_min % 10;
if (tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)
tod_2000.hour1 = t->tm_hour / 10;
else if (t->tm_hour >= 12)
tod_2000.hour1 = TOD2000_HOUR1_PM +
(t->tm_hour - 12) / 10;
else
tod_2000.hour1 = t->tm_hour / 10;
tod_2000.hour2 = t->tm_hour % 10;
tod_2000.day1 = t->tm_mday / 10;
tod_2000.day2 = t->tm_mday % 10;
if (t->tm_wday != -1)
tod_2000.weekday = t->tm_wday;
tod_2000.month1 = (t->tm_mon + 1) / 10;
tod_2000.month2 = (t->tm_mon + 1) % 10;
if (t->tm_year >= 100)
t->tm_year -= 100;
tod_2000.year1 = t->tm_year / 10;
tod_2000.year2 = t->tm_year % 10;
}
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
return 0;
}
static int amiga_set_clock_mmss(unsigned long nowtime)
{
short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
if (AMIGAHW_PRESENT(A3000_CLK)) {
tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
tod_3000.second1 = real_seconds / 10;
tod_3000.second2 = real_seconds % 10;
tod_3000.minute1 = real_minutes / 10;
tod_3000.minute2 = real_minutes % 10;
tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
int cnt = 5;
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt) {
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
udelay(70);
tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
--cnt;
}
if (!cnt)
printk(KERN_INFO "set_clock_mmss: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1);
tod_2000.second1 = real_seconds / 10;
tod_2000.second2 = real_seconds % 10;
tod_2000.minute1 = real_minutes / 10;
tod_2000.minute2 = real_minutes % 10;
tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
}
return 0;
}
static unsigned int amiga_get_ss(void)
{
unsigned int s;
if (AMIGAHW_PRESENT(A3000_CLK)) {
tod_3000.cntrl1 = TOD3000_CNTRL1_HOLD;
s = tod_3000.second1 * 10 + tod_3000.second2;
tod_3000.cntrl1 = TOD3000_CNTRL1_FREE;
} else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
s = tod_2000.second1 * 10 + tod_2000.second2;
}
return s;
}
static NORET_TYPE void amiga_reset(void)
ATTRIB_NORET;
......
......@@ -11,6 +11,7 @@
#include <linux/zorro.h>
#include <asm/amigahw.h>
#include <asm/amigayle.h>
#ifdef CONFIG_ZORRO
......@@ -55,11 +56,77 @@ static int __init amiga_init_bus(void)
subsys_initcall(amiga_init_bus);
#endif /* CONFIG_ZORRO */
static int z_dev_present(zorro_id id)
{
unsigned int i;
for (i = 0; i < zorro_num_autocon; i++)
if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
return 1;
return 0;
}
#else /* !CONFIG_ZORRO */
static inline int z_dev_present(zorro_id id) { return 0; }
#endif /* !CONFIG_ZORRO */
static const struct resource a3000_scsi_resource __initconst = {
.start = 0xdd0000,
.end = 0xdd00ff,
.flags = IORESOURCE_MEM,
};
static const struct resource a4000t_scsi_resource __initconst = {
.start = 0xdd0000,
.end = 0xdd0fff,
.flags = IORESOURCE_MEM,
};
static const struct resource a1200_ide_resource __initconst = {
.start = 0xda0000,
.end = 0xda1fff,
.flags = IORESOURCE_MEM,
};
static const struct gayle_ide_platform_data a1200_ide_pdata __initconst = {
.base = 0xda0000,
.irqport = 0xda9000,
.explicit_ack = 1,
};
static const struct resource a4000_ide_resource __initconst = {
.start = 0xdd2000,
.end = 0xdd3fff,
.flags = IORESOURCE_MEM,
};
static const struct gayle_ide_platform_data a4000_ide_pdata __initconst = {
.base = 0xdd2020,
.irqport = 0xdd3020,
.explicit_ack = 0,
};
static const struct resource amiga_rtc_resource __initconst = {
.start = 0x00dc0000,
.end = 0x00dcffff,
.flags = IORESOURCE_MEM,
};
static int __init amiga_init_devices(void)
{
struct platform_device *pdev;
if (!MACH_IS_AMIGA)
return -ENODEV;
......@@ -77,6 +144,53 @@ static int __init amiga_init_devices(void)
if (AMIGAHW_PRESENT(AMI_FLOPPY))
platform_device_register_simple("amiga-floppy", -1, NULL, 0);
if (AMIGAHW_PRESENT(A3000_SCSI))
platform_device_register_simple("amiga-a3000-scsi", -1,
&a3000_scsi_resource, 1);
if (AMIGAHW_PRESENT(A4000_SCSI))
platform_device_register_simple("amiga-a4000t-scsi", -1,
&a4000t_scsi_resource, 1);
if (AMIGAHW_PRESENT(A1200_IDE) ||
z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
&a1200_ide_resource, 1);
platform_device_add_data(pdev, &a1200_ide_pdata,
sizeof(a1200_ide_pdata));
}
if (AMIGAHW_PRESENT(A4000_IDE)) {
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
&a4000_ide_resource, 1);
platform_device_add_data(pdev, &a4000_ide_pdata,
sizeof(a4000_ide_pdata));
}
/* other I/O hardware */
if (AMIGAHW_PRESENT(AMI_KEYBOARD))
platform_device_register_simple("amiga-keyboard", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_MOUSE))
platform_device_register_simple("amiga-mouse", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_SERIAL))
platform_device_register_simple("amiga-serial", -1, NULL, 0);
if (AMIGAHW_PRESENT(AMI_PARALLEL))
platform_device_register_simple("amiga-parallel", -1, NULL, 0);
/* real time clocks */
if (AMIGAHW_PRESENT(A2000_CLK))
platform_device_register_simple("rtc-msm6242", -1,
&amiga_rtc_resource, 1);
if (AMIGAHW_PRESENT(A3000_CLK))
platform_device_register_simple("rtc-rp5c01", -1,
&amiga_rtc_resource, 1);
return 0;
}
......
......@@ -104,4 +104,10 @@ struct GAYLE {
#define GAYLE_CFG_250NS 0x00
#define GAYLE_CFG_720NS 0x0c
struct gayle_ide_platform_data {
unsigned long base;
unsigned long irqport;
int explicit_ack; /* A1200 IDE needs explicit ack */
};
#endif /* asm-m68k/amigayle.h */
......@@ -3,3 +3,5 @@
#else
#include "atomic_mm.h"
#endif
#include <asm-generic/atomic64.h>
......@@ -8,4 +8,6 @@
#define L1_CACHE_SHIFT 4
#define L1_CACHE_BYTES (1<< L1_CACHE_SHIFT)
#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
#endif
......@@ -84,6 +84,7 @@ static char *serial_version = "4.30";
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
......@@ -1954,29 +1955,16 @@ static const struct tty_operations serial_ops = {
/*
* The serial driver boot-time initialization code!
*/
static int __init rs_init(void)
static int __init amiga_serial_probe(struct platform_device *pdev)
{
unsigned long flags;
struct serial_state * state;
int error;
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_SERIAL))
return -ENODEV;
serial_driver = alloc_tty_driver(1);
if (!serial_driver)
return -ENOMEM;
/*
* We request SERDAT and SERPER only, because the serial registers are
* too spreaded over the custom register space
*/
if (!request_mem_region(CUSTOM_PHYSADDR+0x30, 4,
"amiserial [Paula]")) {
error = -EBUSY;
goto fail_put_tty_driver;
}
IRQ_ports = NULL;
show_serial_version();
......@@ -1998,7 +1986,7 @@ static int __init rs_init(void)
error = tty_register_driver(serial_driver);
if (error)
goto fail_release_mem_region;
goto fail_put_tty_driver;
state = rs_table;
state->magic = SSTATE_MAGIC;
......@@ -2050,23 +2038,24 @@ static int __init rs_init(void)
ciab.ddra |= (SER_DTR | SER_RTS); /* outputs */
ciab.ddra &= ~(SER_DCD | SER_CTS | SER_DSR); /* inputs */
platform_set_drvdata(pdev, state);
return 0;
fail_free_irq:
free_irq(IRQ_AMIGA_TBE, state);
fail_unregister:
tty_unregister_driver(serial_driver);
fail_release_mem_region:
release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
fail_put_tty_driver:
put_tty_driver(serial_driver);
return error;
}
static __exit void rs_exit(void)
static int __exit amiga_serial_remove(struct platform_device *pdev)
{
int error;
struct async_struct *info = rs_table[0].info;
struct serial_state *state = platform_get_drvdata(pdev);
struct async_struct *info = state->info;
/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
tasklet_kill(&info->tlet);
......@@ -2075,19 +2064,38 @@ static __exit void rs_exit(void)
error);
put_tty_driver(serial_driver);
if (info) {
rs_table[0].info = NULL;
kfree(info);
}
free_irq(IRQ_AMIGA_TBE, rs_table);
free_irq(IRQ_AMIGA_RBF, rs_table);
release_mem_region(CUSTOM_PHYSADDR+0x30, 4);
platform_set_drvdata(pdev, NULL);
return error;
}
static struct platform_driver amiga_serial_driver = {
.remove = __exit_p(amiga_serial_remove),
.driver = {
.name = "amiga-serial",
.owner = THIS_MODULE,
},
};
static int __init amiga_serial_init(void)
{
return platform_driver_probe(&amiga_serial_driver, amiga_serial_probe);
}
module_init(amiga_serial_init);
static void __exit amiga_serial_exit(void)
{
platform_driver_unregister(&amiga_serial_driver);
}
module_init(rs_init)
module_exit(rs_exit)
module_exit(amiga_serial_exit);
#if defined(CONFIG_SERIAL_CONSOLE) && !defined(MODULE)
......@@ -2154,3 +2162,4 @@ console_initcall(amiserial_console_init);
#endif /* CONFIG_SERIAL_CONSOLE && !MODULE */
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:amiga-serial");
......@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/zorro.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/amigahw.h>
......@@ -23,15 +24,6 @@
#include <asm/amigayle.h>
/*
* Bases of the IDE interfaces
*/
#define GAYLE_BASE_4000 0xdd2020 /* A4000/A4000T */
#define GAYLE_BASE_1200 0xda0000 /* A1200/A600 and E-Matrix 530 */
#define GAYLE_IDEREG_SIZE 0x2000
/*
* Offsets from one of the above bases
*/
......@@ -122,64 +114,89 @@ static const struct ide_port_info gayle_port_info = {
* Probe for a Gayle IDE interface (and optionally for an IDE doubler)
*/
static int __init gayle_init(void)
static int __init amiga_gayle_ide_probe(struct platform_device *pdev)
{
unsigned long phys_base, res_start, res_n;
struct resource *res;
struct gayle_ide_platform_data *pdata;
unsigned long base, ctrlport, irqport;
int a4000, i, rc;
unsigned int i;
int error;
struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS];
struct ide_port_info d = gayle_port_info;
struct ide_host *host;
if (!MACH_IS_AMIGA)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
if ((a4000 = AMIGAHW_PRESENT(A4000_IDE)) || AMIGAHW_PRESENT(A1200_IDE))
goto found;
#ifdef CONFIG_ZORRO
if (zorro_find_device(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE,
NULL))
goto found;
#endif
return -ENODEV;
if (!request_mem_region(res->start, resource_size(res), "IDE"))
return -EBUSY;
found:
printk(KERN_INFO "ide: Gayle IDE controller (A%d style%s)\n",
a4000 ? 4000 : 1200,
pdata = pdev->dev.platform_data;
pr_info("ide: Gayle IDE controller (A%u style%s)\n",
pdata->explicit_ack ? 1200 : 4000,
ide_doubler ? ", IDE doubler" : "");
if (a4000) {
phys_base = GAYLE_BASE_4000;
irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
d.port_ops = &gayle_a4000_port_ops;
} else {
phys_base = GAYLE_BASE_1200;
irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
base = (unsigned long)ZTWO_VADDR(pdata->base);
ctrlport = 0;
irqport = (unsigned long)ZTWO_VADDR(pdata->irqport);
if (pdata->explicit_ack)
d.port_ops = &gayle_a1200_port_ops;
else
d.port_ops = &gayle_a4000_port_ops;
for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++, base += GAYLE_NEXT_PORT) {
if (GAYLE_HAS_CONTROL_REG)
ctrlport = base + GAYLE_CONTROL;
gayle_setup_ports(&hw[i], base, ctrlport, irqport);
hws[i] = &hw[i];
}
res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
res_n = GAYLE_IDEREG_SIZE;
error = ide_host_add(&d, hws, i, &host);
if (error)
goto out;
if (!request_mem_region(res_start, res_n, "IDE"))
return -EBUSY;
platform_set_drvdata(pdev, host);
return 0;
for (i = 0; i < GAYLE_NUM_PROBE_HWIFS; i++) {
base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
out:
release_mem_region(res->start, resource_size(res));
return error;
}
gayle_setup_ports(&hw[i], base, ctrlport, irqport);
static int __exit amiga_gayle_ide_remove(struct platform_device *pdev)
{
struct ide_host *host = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hws[i] = &hw[i];
}
ide_host_remove(host);
release_mem_region(res->start, resource_size(res));
return 0;
}
rc = ide_host_add(&d, hws, i, NULL);
if (rc)
release_mem_region(res_start, res_n);
static struct platform_driver amiga_gayle_ide_driver = {
.remove = __exit_p(amiga_gayle_ide_remove),
.driver = {
.name = "amiga-gayle-ide",
.owner = THIS_MODULE,
},
};
return rc;
static int __init amiga_gayle_ide_init(void)
{
return platform_driver_probe(&amiga_gayle_ide_driver,
amiga_gayle_ide_probe);
}
module_init(amiga_gayle_ide_init);
static void __exit amiga_gayle_ide_exit(void)
{
platform_driver_unregister(&amiga_gayle_ide_driver);
}
module_init(gayle_init);
module_exit(amiga_gayle_ide_exit);
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:amiga-gayle-ide");
......@@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/keyboard.h>
#include <linux/platform_device.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
......@@ -154,10 +155,9 @@ static const char *amikbd_messages[8] = {
[7] = KERN_WARNING "amikbd: keyboard interrupt\n"
};
static struct input_dev *amikbd_dev;
static irqreturn_t amikbd_interrupt(int irq, void *dummy)
static irqreturn_t amikbd_interrupt(int irq, void *data)
{
struct input_dev *dev = data;
unsigned char scancode, down;
scancode = ~ciaa.sdr; /* get and invert scancode (keyboard is active low) */
......@@ -170,47 +170,42 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy)
if (scancode < 0x78) { /* scancodes < 0x78 are keys */
if (scancode == 98) { /* CapsLock is a toggle switch key on Amiga */
input_report_key(amikbd_dev, scancode, 1);
input_report_key(amikbd_dev, scancode, 0);
input_report_key(dev, scancode, 1);
input_report_key(dev, scancode, 0);
} else {
input_report_key(amikbd_dev, scancode, down);
input_report_key(dev, scancode, down);
}
input_sync(amikbd_dev);
input_sync(dev);
} else /* scancodes >= 0x78 are error codes */
printk(amikbd_messages[scancode - 0x78]);
return IRQ_HANDLED;
}
static int __init amikbd_init(void)
static int __init amikbd_probe(struct platform_device *pdev)
{
struct input_dev *dev;
int i, j, err;
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
return -ENODEV;
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
amikbd_dev = input_allocate_device();
if (!amikbd_dev) {
printk(KERN_ERR "amikbd: not enough memory for input device\n");
err = -ENOMEM;
goto fail1;
dev = input_allocate_device();
if (!dev) {
dev_err(&pdev->dev, "Not enough memory for input device\n");
return -ENOMEM;
}
amikbd_dev->name = "Amiga Keyboard";
amikbd_dev->phys = "amikbd/input0";
amikbd_dev->id.bustype = BUS_AMIGA;
amikbd_dev->id.vendor = 0x0001;
amikbd_dev->id.product = 0x0001;
amikbd_dev->id.version = 0x0100;
dev->name = pdev->name;
dev->phys = "amikbd/input0";
dev->id.bustype = BUS_AMIGA;
dev->id.vendor = 0x0001;
dev->id.product = 0x0001;
dev->id.version = 0x0100;
dev->dev.parent = &pdev->dev;
amikbd_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
for (i = 0; i < 0x78; i++)
set_bit(i, amikbd_dev->keybit);
set_bit(i, dev->keybit);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
static u_short temp_map[NR_KEYS] __initdata;
......@@ -229,30 +224,54 @@ static int __init amikbd_init(void)
memcpy(key_maps[i], temp_map, sizeof(temp_map));
}
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
if (request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd",
amikbd_interrupt)) {
err = -EBUSY;
err = request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd",
dev);
if (err)
goto fail2;
}
err = input_register_device(amikbd_dev);
err = input_register_device(dev);
if (err)
goto fail3;
platform_set_drvdata(pdev, dev);
return 0;
fail3: free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt);
fail2: input_free_device(amikbd_dev);
fail1: release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
fail3: free_irq(IRQ_AMIGA_CIAA_SP, dev);
fail2: input_free_device(dev);
return err;
}
static void __exit amikbd_exit(void)
static int __exit amikbd_remove(struct platform_device *pdev)
{
struct input_dev *dev = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL);
free_irq(IRQ_AMIGA_CIAA_SP, dev);
input_unregister_device(dev);
return 0;
}
static struct platform_driver amikbd_driver = {
.remove = __exit_p(amikbd_remove),
.driver = {
.name = "amiga-keyboard",
.owner = THIS_MODULE,
},
};
static int __init amikbd_init(void)
{
free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt);
input_unregister_device(amikbd_dev);
release_mem_region(CIAA_PHYSADDR - 1 + 0xb00, 0x100);
return platform_driver_probe(&amikbd_driver, amikbd_probe);
}
module_init(amikbd_init);
static void __exit amikbd_exit(void)
{
platform_driver_unregister(&amikbd_driver);
}
module_exit(amikbd_exit);
MODULE_ALIAS("platform:amiga-keyboard");
......@@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
#include <asm/setup.h>
......@@ -34,10 +35,10 @@ MODULE_DESCRIPTION("Amiga mouse driver");
MODULE_LICENSE("GPL");
static int amimouse_lastx, amimouse_lasty;
static struct input_dev *amimouse_dev;
static irqreturn_t amimouse_interrupt(int irq, void *dummy)
static irqreturn_t amimouse_interrupt(int irq, void *data)
{
struct input_dev *dev = data;
unsigned short joy0dat, potgor;
int nx, ny, dx, dy;
......@@ -59,14 +60,14 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
potgor = amiga_custom.potgor;
input_report_rel(amimouse_dev, REL_X, dx);
input_report_rel(amimouse_dev, REL_Y, dy);
input_report_rel(dev, REL_X, dx);
input_report_rel(dev, REL_Y, dy);
input_report_key(amimouse_dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(amimouse_dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(amimouse_dev, BTN_RIGHT, potgor & 0x0400);
input_report_key(dev, BTN_LEFT, ciaa.pra & 0x40);
input_report_key(dev, BTN_MIDDLE, potgor & 0x0100);
input_report_key(dev, BTN_RIGHT, potgor & 0x0400);
input_sync(amimouse_dev);
input_sync(dev);
return IRQ_HANDLED;
}
......@@ -74,63 +75,90 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
static int amimouse_open(struct input_dev *dev)
{
unsigned short joy0dat;
int error;
joy0dat = amiga_custom.joy0dat;
amimouse_lastx = joy0dat & 0xff;
amimouse_lasty = joy0dat >> 8;
if (request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse", amimouse_interrupt)) {
printk(KERN_ERR "amimouse.c: Can't allocate irq %d\n", IRQ_AMIGA_VERTB);
return -EBUSY;
}
error = request_irq(IRQ_AMIGA_VERTB, amimouse_interrupt, 0, "amimouse",
dev);
if (error)
dev_err(&dev->dev, "Can't allocate irq %d\n", IRQ_AMIGA_VERTB);
return 0;
return error;
}
static void amimouse_close(struct input_dev *dev)
{
free_irq(IRQ_AMIGA_VERTB, amimouse_interrupt);
free_irq(IRQ_AMIGA_VERTB, dev);
}
static int __init amimouse_init(void)
static int __init amimouse_probe(struct platform_device *pdev)
{
int err;
struct input_dev *dev;
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_MOUSE))
return -ENODEV;
amimouse_dev = input_allocate_device();
if (!amimouse_dev)
dev = input_allocate_device();
if (!dev)
return -ENOMEM;
amimouse_dev->name = "Amiga mouse";
amimouse_dev->phys = "amimouse/input0";
amimouse_dev->id.bustype = BUS_AMIGA;
amimouse_dev->id.vendor = 0x0001;
amimouse_dev->id.product = 0x0002;
amimouse_dev->id.version = 0x0100;
dev->name = pdev->name;
dev->phys = "amimouse/input0";
dev->id.bustype = BUS_AMIGA;
dev->id.vendor = 0x0001;
dev->id.product = 0x0002;
dev->id.version = 0x0100;
amimouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
amimouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
amimouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
amimouse_dev->open = amimouse_open;
amimouse_dev->close = amimouse_close;
dev->open = amimouse_open;
dev->close = amimouse_close;
dev->dev.parent = &pdev->dev;
err = input_register_device(amimouse_dev);
err = input_register_device(dev);
if (err) {
input_free_device(amimouse_dev);
input_free_device(dev);
return err;
}
platform_set_drvdata(pdev, dev);
return 0;
}
static void __exit amimouse_exit(void)
static int __exit amimouse_remove(struct platform_device *pdev)
{
input_unregister_device(amimouse_dev);
struct input_dev *dev = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL);
input_unregister_device(dev);
return 0;
}
static struct platform_driver amimouse_driver = {
.remove = __exit_p(amimouse_remove),
.driver = {
.name = "amiga-mouse",
.owner = THIS_MODULE,
},
};
static int __init amimouse_init(void)
{
return platform_driver_probe(&amimouse_driver, amimouse_probe);
}
module_init(amimouse_init);
static void __exit amimouse_exit(void)
{
platform_driver_unregister(&amimouse_driver);
}
module_exit(amimouse_exit);
MODULE_ALIAS("platform:amiga-mouse");
......@@ -18,6 +18,8 @@
#include <linux/parport.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/setup.h>
#include <asm/amigahw.h>
#include <asm/irq.h>
......@@ -31,7 +33,6 @@
#define DPRINTK(x...) do { } while (0)
#endif
static struct parport *this_port = NULL;
static void amiga_write_data(struct parport *p, unsigned char data)
{
......@@ -227,18 +228,11 @@ static struct parport_operations pp_amiga_ops = {
/* ----------- Initialisation code --------------------------------- */
static int __init parport_amiga_init(void)
static int __init amiga_parallel_probe(struct platform_device *pdev)
{
struct parport *p;
int err;
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(AMI_PARALLEL))
return -ENODEV;
err = -EBUSY;
if (!request_mem_region(CIAA_PHYSADDR-1+0x100, 0x100, "parallel"))
goto out_mem;
ciaa.ddrb = 0xff;
ciab.ddra &= 0xf8;
mb();
......@@ -246,41 +240,63 @@ static int __init parport_amiga_init(void)
p = parport_register_port((unsigned long)&ciaa.prb, IRQ_AMIGA_CIAA_FLG,
PARPORT_DMA_NONE, &pp_amiga_ops);
if (!p)
goto out_port;
return -EBUSY;
err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name, p);
err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name,
p);
if (err)
goto out_irq;
this_port = p;
printk(KERN_INFO "%s: Amiga built-in port using irq\n", p->name);
/* XXX: set operating mode */
parport_announce_port(p);
platform_set_drvdata(pdev, p);
return 0;
out_irq:
parport_put_port(p);
out_port:
release_mem_region(CIAA_PHYSADDR-1+0x100, 0x100);
out_mem:
return err;
}
static void __exit parport_amiga_exit(void)
static int __exit amiga_parallel_remove(struct platform_device *pdev)
{
parport_remove_port(this_port);
if (this_port->irq != PARPORT_IRQ_NONE)
free_irq(IRQ_AMIGA_CIAA_FLG, this_port);
parport_put_port(this_port);
release_mem_region(CIAA_PHYSADDR-1+0x100, 0x100);
struct parport *port = platform_get_drvdata(pdev);
parport_remove_port(port);
if (port->irq != PARPORT_IRQ_NONE)
free_irq(IRQ_AMIGA_CIAA_FLG, port);
parport_put_port(port);
platform_set_drvdata(pdev, NULL);
return 0;
}
static struct platform_driver amiga_parallel_driver = {
.remove = __exit_p(amiga_parallel_remove),
.driver = {
.name = "amiga-parallel",
.owner = THIS_MODULE,
},
};
static int __init amiga_parallel_init(void)
{
return platform_driver_probe(&amiga_parallel_driver,
amiga_parallel_probe);
}
module_init(amiga_parallel_init);
static void __exit amiga_parallel_exit(void)
{
platform_driver_unregister(&amiga_parallel_driver);
}
module_exit(amiga_parallel_exit);
MODULE_AUTHOR("Joerg Dorchain <joerg@dorchain.net>");
MODULE_DESCRIPTION("Parport Driver for Amiga builtin Port");
MODULE_SUPPORTED_DEVICE("Amiga builtin Parallel Port");
MODULE_LICENSE("GPL");
module_init(parport_amiga_init)
module_exit(parport_amiga_exit)
MODULE_ALIAS("platform:amiga-parallel");
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/zorro.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/pgtable.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
#include <linux/zorro.h>
#include <asm/irq.h>
#include <linux/spinlock.h>
#include "scsi.h"
#include <scsi/scsi_host.h>
#include "wd33c93.h"
#include "a2091.h"
#include <linux/stat.h>
static int a2091_release(struct Scsi_Host *instance);
struct a2091_hostdata {
struct WD33C93_hostdata wh;
struct a2091_scsiregs *regs;
};
static irqreturn_t a2091_intr(int irq, void *data)
{
struct Scsi_Host *instance = data;
a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
unsigned int status = regs->ISTR;
struct a2091_hostdata *hdata = shost_priv(instance);
unsigned int status = hdata->regs->ISTR;
unsigned long flags;
if (!(status & (ISTR_INT_F | ISTR_INT_P)) || !(status & ISTR_INTS))
......@@ -43,38 +40,39 @@ static irqreturn_t a2091_intr(int irq, void *data)
static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
{
struct Scsi_Host *instance = cmd->device->host;
struct WD33C93_hostdata *hdata = shost_priv(instance);
a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
struct a2091_hostdata *hdata = shost_priv(instance);
struct WD33C93_hostdata *wh = &hdata->wh;
struct a2091_scsiregs *regs = hdata->regs;
unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
unsigned long addr = virt_to_bus(cmd->SCp.ptr);
/* don't allow DMA if the physical address is bad */
if (addr & A2091_XFER_MASK) {
hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff;
hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len,
wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff;
wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len,
GFP_KERNEL);
/* can't allocate memory; use PIO */
if (!hdata->dma_bounce_buffer) {
hdata->dma_bounce_len = 0;
if (!wh->dma_bounce_buffer) {
wh->dma_bounce_len = 0;
return 1;
}
/* get the physical address of the bounce buffer */
addr = virt_to_bus(hdata->dma_bounce_buffer);
addr = virt_to_bus(wh->dma_bounce_buffer);
/* the bounce buffer may not be in the first 16M of physmem */
if (addr & A2091_XFER_MASK) {
/* we could use chipmem... maybe later */
kfree(hdata->dma_bounce_buffer);
hdata->dma_bounce_buffer = NULL;
hdata->dma_bounce_len = 0;
kfree(wh->dma_bounce_buffer);
wh->dma_bounce_buffer = NULL;
wh->dma_bounce_len = 0;
return 1;
}
if (!dir_in) {
/* copy to bounce buffer for a write */
memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr,
memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr,
cmd->SCp.this_residual);
}
}
......@@ -84,7 +82,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
cntr |= CNTR_DDIR;
/* remember direction */
hdata->dma_dir = dir_in;
wh->dma_dir = dir_in;
regs->CNTR = cntr;
......@@ -108,20 +106,21 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
int status)
{
struct WD33C93_hostdata *hdata = shost_priv(instance);
a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
struct a2091_hostdata *hdata = shost_priv(instance);
struct WD33C93_hostdata *wh = &hdata->wh;
struct a2091_scsiregs *regs = hdata->regs;
/* disable SCSI interrupts */
unsigned short cntr = CNTR_PDMD;
if (!hdata->dma_dir)
if (!wh->dma_dir)
cntr |= CNTR_DDIR;
/* disable SCSI interrupts */
regs->CNTR = cntr;
/* flush if we were reading */
if (hdata->dma_dir) {
if (wh->dma_dir) {
regs->FLUSH = 1;
while (!(regs->ISTR & ISTR_FE_FLG))
;
......@@ -137,95 +136,37 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
regs->CNTR = CNTR_PDMD | CNTR_INTEN;
/* copy from a bounce buffer, if necessary */
if (status && hdata->dma_bounce_buffer) {
if (hdata->dma_dir)
memcpy(SCpnt->SCp.ptr, hdata->dma_bounce_buffer,
if (status && wh->dma_bounce_buffer) {
if (wh->dma_dir)
memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer,
SCpnt->SCp.this_residual);
kfree(hdata->dma_bounce_buffer);
hdata->dma_bounce_buffer = NULL;
hdata->dma_bounce_len = 0;
}
}
static int __init a2091_detect(struct scsi_host_template *tpnt)
{
static unsigned char called = 0;
struct Scsi_Host *instance;
unsigned long address;
struct zorro_dev *z = NULL;
wd33c93_regs wdregs;
a2091_scsiregs *regs;
struct WD33C93_hostdata *hdata;
int num_a2091 = 0;
if (!MACH_IS_AMIGA || called)
return 0;
called = 1;
tpnt->proc_name = "A2091";
tpnt->proc_info = &wd33c93_proc_info;
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
if (z->id != ZORRO_PROD_CBM_A590_A2091_1 &&
z->id != ZORRO_PROD_CBM_A590_A2091_2)
continue;
address = z->resource.start;
if (!request_mem_region(address, 256, "wd33c93"))
continue;
instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
if (instance == NULL)
goto release;
instance->base = ZTWO_VADDR(address);
instance->irq = IRQ_AMIGA_PORTS;
instance->unique_id = z->slotaddr;
regs = (a2091_scsiregs *)(instance->base);
regs->DAWR = DAWR_A2091;
wdregs.SASR = &regs->SASR;
wdregs.SCMD = &regs->SCMD;
hdata = shost_priv(instance);
hdata->no_sync = 0xff;
hdata->fast = 0;
hdata->dma_mode = CTRL_DMA;
wd33c93_init(instance, wdregs, dma_setup, dma_stop,
WD33C93_FS_8_10);
if (request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED,
"A2091 SCSI", instance))
goto unregister;
regs->CNTR = CNTR_PDMD | CNTR_INTEN;
num_a2091++;
continue;
unregister:
scsi_unregister(instance);
release:
release_mem_region(address, 256);
kfree(wh->dma_bounce_buffer);
wh->dma_bounce_buffer = NULL;
wh->dma_bounce_len = 0;
}
return num_a2091;
}
static int a2091_bus_reset(struct scsi_cmnd *cmd)
{
struct Scsi_Host *instance = cmd->device->host;
/* FIXME perform bus-specific reset */
/* FIXME 2: kill this function, and let midlayer fall back
to the same action, calling wd33c93_host_reset() */
spin_lock_irq(cmd->device->host->host_lock);
spin_lock_irq(instance->host_lock);
wd33c93_host_reset(cmd);
spin_unlock_irq(cmd->device->host->host_lock);
spin_unlock_irq(instance->host_lock);
return SUCCESS;
}
#define HOSTS_C
static struct scsi_host_template driver_template = {
.proc_name = "A2901",
static struct scsi_host_template a2091_scsi_template = {
.module = THIS_MODULE,
.name = "Commodore A2091/A590 SCSI",
.detect = a2091_detect,
.release = a2091_release,
.proc_info = wd33c93_proc_info,
.proc_name = "A2901",
.queuecommand = wd33c93_queuecommand,
.eh_abort_handler = wd33c93_abort,
.eh_bus_reset_handler = a2091_bus_reset,
......@@ -237,19 +178,103 @@ static struct scsi_host_template driver_template = {
.use_clustering = DISABLE_CLUSTERING
};
static int __devinit a2091_probe(struct zorro_dev *z,
const struct zorro_device_id *ent)
{
struct Scsi_Host *instance;
int error;
struct a2091_scsiregs *regs;
wd33c93_regs wdregs;
struct a2091_hostdata *hdata;
if (!request_mem_region(z->resource.start, 256, "wd33c93"))
return -EBUSY;
instance = scsi_host_alloc(&a2091_scsi_template,
sizeof(struct a2091_hostdata));
if (!instance) {
error = -ENOMEM;
goto fail_alloc;
}
instance->irq = IRQ_AMIGA_PORTS;
instance->unique_id = z->slotaddr;
regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start);
regs->DAWR = DAWR_A2091;
wdregs.SASR = &regs->SASR;
wdregs.SCMD = &regs->SCMD;
hdata = shost_priv(instance);
hdata->wh.no_sync = 0xff;
hdata->wh.fast = 0;
hdata->wh.dma_mode = CTRL_DMA;
hdata->regs = regs;
wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_8_10);
error = request_irq(IRQ_AMIGA_PORTS, a2091_intr, IRQF_SHARED,
"A2091 SCSI", instance);
if (error)
goto fail_irq;
regs->CNTR = CNTR_PDMD | CNTR_INTEN;
error = scsi_add_host(instance, NULL);
if (error)
goto fail_host;
zorro_set_drvdata(z, instance);
#include "scsi_module.c"
scsi_scan_host(instance);
return 0;
static int a2091_release(struct Scsi_Host *instance)
fail_host:
free_irq(IRQ_AMIGA_PORTS, instance);
fail_irq:
scsi_host_put(instance);
fail_alloc:
release_mem_region(z->resource.start, 256);
return error;
}
static void __devexit a2091_remove(struct zorro_dev *z)
{
#ifdef MODULE
a2091_scsiregs *regs = (a2091_scsiregs *)(instance->base);
struct Scsi_Host *instance = zorro_get_drvdata(z);
struct a2091_hostdata *hdata = shost_priv(instance);
regs->CNTR = 0;
release_mem_region(ZTWO_PADDR(instance->base), 256);
hdata->regs->CNTR = 0;
scsi_remove_host(instance);
free_irq(IRQ_AMIGA_PORTS, instance);
#endif
return 1;
scsi_host_put(instance);
release_mem_region(z->resource.start, 256);
}
static struct zorro_device_id a2091_zorro_tbl[] __devinitdata = {
{ ZORRO_PROD_CBM_A590_A2091_1 },
{ ZORRO_PROD_CBM_A590_A2091_2 },
{ 0 }
};
MODULE_DEVICE_TABLE(zorro, a2091_zorro_tbl);
static struct zorro_driver a2091_driver = {
.name = "a2091",
.id_table = a2091_zorro_tbl,
.probe = a2091_probe,
.remove = __devexit_p(a2091_remove),
};
static int __init a2091_init(void)
{
return zorro_register_driver(&a2091_driver);
}
module_init(a2091_init);
static void __exit a2091_exit(void)
{
zorro_unregister_driver(&a2091_driver);
}
module_exit(a2091_exit);
MODULE_DESCRIPTION("Commodore A2091/A590 SCSI");
MODULE_LICENSE("GPL");
......@@ -25,7 +25,7 @@
*/
#define A2091_XFER_MASK (0xff000001)
typedef struct {
struct a2091_scsiregs {
unsigned char pad1[64];
volatile unsigned short ISTR;
volatile unsigned short CNTR;
......@@ -44,7 +44,7 @@ typedef struct {
volatile unsigned short CINT;
unsigned char pad7[2];
volatile unsigned short FLUSH;
} a2091_scsiregs;
};
#define DAWR_A2091 (3)
......
This diff is collapsed.
......@@ -25,7 +25,7 @@
*/
#define A3000_XFER_MASK (0x00000003)
typedef struct {
struct a3000_scsiregs {
unsigned char pad1[2];
volatile unsigned short DAWR;
volatile unsigned int WTC;
......@@ -46,7 +46,7 @@ typedef struct {
volatile unsigned char SASR;
unsigned char pad9;
volatile unsigned char SCMD;
} a3000_scsiregs;
};
#define DAWR_A3000 (3)
......
......@@ -20,10 +20,6 @@
#include "53c700.h"
MODULE_AUTHOR("Alan Hourihane <alanh@fairlite.demon.co.uk> / Kars de Jong <jongk@linux-m68k.org>");
MODULE_DESCRIPTION("Amiga A4000T NCR53C710 driver");
MODULE_LICENSE("GPL");
static struct scsi_host_template a4000t_scsi_driver_template = {
.name = "A4000T builtin SCSI",
......@@ -32,30 +28,35 @@ static struct scsi_host_template a4000t_scsi_driver_template = {
.module = THIS_MODULE,
};
static struct platform_device *a4000t_scsi_device;
#define A4000T_SCSI_ADDR 0xdd0040
#define A4000T_SCSI_OFFSET 0x40
static int __devinit a4000t_probe(struct platform_device *dev)
static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
{
struct Scsi_Host *host;
struct resource *res;
phys_addr_t scsi_addr;
struct NCR_700_Host_Parameters *hostdata;
struct Scsi_Host *host;
if (!(MACH_IS_AMIGA && AMIGAHW_PRESENT(A4000_SCSI)))
goto out;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
if (!request_mem_region(A4000T_SCSI_ADDR, 0x1000,
if (!request_mem_region(res->start, resource_size(res),
"A4000T builtin SCSI"))
goto out;
return -EBUSY;
hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters),
GFP_KERNEL);
if (!hostdata) {
printk(KERN_ERR "a4000t-scsi: Failed to allocate host data\n");
dev_err(&pdev->dev, "Failed to allocate host data\n");
goto out_release;
}
scsi_addr = res->start + A4000T_SCSI_OFFSET;
/* Fill in the required pieces of hostdata */
hostdata->base = (void __iomem *)ZTWO_VADDR(A4000T_SCSI_ADDR);
hostdata->base = (void __iomem *)ZTWO_VADDR(scsi_addr);
hostdata->clock = 50;
hostdata->chip710 = 1;
hostdata->dmode_extra = DMODE_FC2;
......@@ -63,26 +64,25 @@ static int __devinit a4000t_probe(struct platform_device *dev)
/* and register the chip */
host = NCR_700_detect(&a4000t_scsi_driver_template, hostdata,
&dev->dev);
&pdev->dev);
if (!host) {
printk(KERN_ERR "a4000t-scsi: No host detected; "
"board configuration problem?\n");
dev_err(&pdev->dev,
"No host detected; board configuration problem?\n");
goto out_free;
}
host->this_id = 7;
host->base = A4000T_SCSI_ADDR;
host->base = scsi_addr;
host->irq = IRQ_AMIGA_PORTS;
if (request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "a4000t-scsi",
host)) {
printk(KERN_ERR "a4000t-scsi: request_irq failed\n");
dev_err(&pdev->dev, "request_irq failed\n");
goto out_put_host;
}
platform_set_drvdata(dev, host);
platform_set_drvdata(pdev, host);
scsi_scan_host(host);
return 0;
out_put_host:
......@@ -90,58 +90,49 @@ static int __devinit a4000t_probe(struct platform_device *dev)
out_free:
kfree(hostdata);
out_release:
release_mem_region(A4000T_SCSI_ADDR, 0x1000);
out:
release_mem_region(res->start, resource_size(res));
return -ENODEV;
}
static __devexit int a4000t_device_remove(struct platform_device *dev)
static int __exit amiga_a4000t_scsi_remove(struct platform_device *pdev)
{
struct Scsi_Host *host = platform_get_drvdata(dev);
struct Scsi_Host *host = platform_get_drvdata(pdev);
struct NCR_700_Host_Parameters *hostdata = shost_priv(host);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
scsi_remove_host(host);
NCR_700_release(host);
kfree(hostdata);
free_irq(host->irq, host);
release_mem_region(A4000T_SCSI_ADDR, 0x1000);
release_mem_region(res->start, resource_size(res));
return 0;
}
static struct platform_driver a4000t_scsi_driver = {
static struct platform_driver amiga_a4000t_scsi_driver = {
.remove = __exit_p(amiga_a4000t_scsi_remove),
.driver = {
.name = "a4000t-scsi",
.name = "amiga-a4000t-scsi",
.owner = THIS_MODULE,
},
.probe = a4000t_probe,
.remove = __devexit_p(a4000t_device_remove),
};
static int __init a4000t_scsi_init(void)
static int __init amiga_a4000t_scsi_init(void)
{
int err;
err = platform_driver_register(&a4000t_scsi_driver);
if (err)
return err;
a4000t_scsi_device = platform_device_register_simple("a4000t-scsi",
-1, NULL, 0);
if (IS_ERR(a4000t_scsi_device)) {
platform_driver_unregister(&a4000t_scsi_driver);
return PTR_ERR(a4000t_scsi_device);
}
return err;
return platform_driver_probe(&amiga_a4000t_scsi_driver,
amiga_a4000t_scsi_probe);
}
static void __exit a4000t_scsi_exit(void)
module_init(amiga_a4000t_scsi_init);
static void __exit amiga_a4000t_scsi_exit(void)
{
platform_device_unregister(a4000t_scsi_device);
platform_driver_unregister(&a4000t_scsi_driver);
platform_driver_unregister(&amiga_a4000t_scsi_driver);
}
module_init(a4000t_scsi_init);
module_exit(a4000t_scsi_exit);
module_exit(amiga_a4000t_scsi_exit);
MODULE_AUTHOR("Alan Hourihane <alanh@fairlite.demon.co.uk> / "
"Kars de Jong <jongk@linux-m68k.org>");
MODULE_DESCRIPTION("Amiga A4000T NCR53C710 driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:amiga-a4000t-scsi");
This diff is collapsed.
......@@ -11,9 +11,6 @@
#include <linux/types.h>
int gvp11_detect(struct scsi_host_template *);
int gvp11_release(struct Scsi_Host *);
#ifndef CMD_PER_LUN
#define CMD_PER_LUN 2
#endif
......@@ -22,15 +19,13 @@ int gvp11_release(struct Scsi_Host *);
#define CAN_QUEUE 16
#endif
#ifndef HOSTS_C
/*
* if the transfer address ANDed with this results in a non-zero
* result, then we can't use DMA.
*/
#define GVP11_XFER_MASK (0xff000001)
typedef struct {
struct gvp11_scsiregs {
unsigned char pad1[64];
volatile unsigned short CNTR;
unsigned char pad2[31];
......@@ -46,7 +41,7 @@ typedef struct {
volatile unsigned short SP_DMA;
volatile unsigned short secret2; /* store 1 here */
volatile unsigned short secret3; /* store 15 here */
} gvp11_scsiregs;
};
/* bits in CNTR */
#define GVP11_DMAC_BUSY (1<<0)
......@@ -54,6 +49,4 @@ typedef struct {
#define GVP11_DMAC_INT_ENABLE (1<<3)
#define GVP11_DMAC_DIR_WRITE (1<<4)
#endif /* else def HOSTS_C */
#endif /* GVP11_H */
......@@ -16,12 +16,12 @@
#include <linux/stat.h>
static struct Scsi_Host *mvme147_host = NULL;
static irqreturn_t mvme147_intr(int irq, void *dummy)
static irqreturn_t mvme147_intr(int irq, void *data)
{
struct Scsi_Host *instance = data;
if (irq == MVME147_IRQ_SCSI_PORT)
wd33c93_intr(mvme147_host);
wd33c93_intr(instance);
else
m147_pcc->dma_intr = 0x89; /* Ack and enable ints */
return IRQ_HANDLED;
......@@ -29,7 +29,8 @@ static irqreturn_t mvme147_intr(int irq, void *dummy)
static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
{
struct WD33C93_hostdata *hdata = shost_priv(mvme147_host);
struct Scsi_Host *instance = cmd->device->host;
struct WD33C93_hostdata *hdata = shost_priv(instance);
unsigned char flags = 0x01;
unsigned long addr = virt_to_bus(cmd->SCp.ptr);
......@@ -66,6 +67,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
int mvme147_detect(struct scsi_host_template *tpnt)
{
static unsigned char called = 0;
struct Scsi_Host *instance;
wd33c93_regs regs;
struct WD33C93_hostdata *hdata;
......@@ -76,25 +78,25 @@ int mvme147_detect(struct scsi_host_template *tpnt)
tpnt->proc_name = "MVME147";
tpnt->proc_info = &wd33c93_proc_info;
mvme147_host = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
if (!mvme147_host)
instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
if (!instance)
goto err_out;
mvme147_host->base = 0xfffe4000;
mvme147_host->irq = MVME147_IRQ_SCSI_PORT;
instance->base = 0xfffe4000;
instance->irq = MVME147_IRQ_SCSI_PORT;
regs.SASR = (volatile unsigned char *)0xfffe4000;
regs.SCMD = (volatile unsigned char *)0xfffe4001;
hdata = shost_priv(mvme147_host);
hdata = shost_priv(instance);
hdata->no_sync = 0xff;
hdata->fast = 0;
hdata->dma_mode = CTRL_DMA;
wd33c93_init(mvme147_host, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
wd33c93_init(instance, regs, dma_setup, dma_stop, WD33C93_FS_8_10);
if (request_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr, 0,
"MVME147 SCSI PORT", mvme147_intr))
"MVME147 SCSI PORT", instance))
goto err_unregister;
if (request_irq(MVME147_IRQ_SCSI_DMA, mvme147_intr, 0,
"MVME147 SCSI DMA", mvme147_intr))
"MVME147 SCSI DMA", instance))
goto err_free_irq;
#if 0 /* Disabled; causes problems booting */
m147_pcc->scsi_interrupt = 0x10; /* Assert SCSI bus reset */
......@@ -113,7 +115,7 @@ int mvme147_detect(struct scsi_host_template *tpnt)
err_free_irq:
free_irq(MVME147_IRQ_SCSI_PORT, mvme147_intr);
err_unregister:
scsi_unregister(mvme147_host);
scsi_unregister(instance);
err_out:
return 0;
}
......@@ -132,9 +134,6 @@ static int mvme147_bus_reset(struct scsi_cmnd *cmd)
return SUCCESS;
}
#define HOSTS_C
#include "mvme147.h"
static struct scsi_host_template driver_template = {
.proc_name = "MVME147",
......
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