Commit a9a0aff5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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);
}
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
*/
......@@ -68,20 +60,20 @@ MODULE_PARM_DESC(doubler, "enable support for IDE doublers");
static int gayle_test_irq(ide_hwif_t *hwif)
{
unsigned char ch;
unsigned char ch;
ch = z_readb(hwif->io_ports.irq_addr);
if (!(ch & GAYLE_IRQ_IDE))
return 0;
return 1;
ch = z_readb(hwif->io_ports.irq_addr);
if (!(ch & GAYLE_IRQ_IDE))
return 0;
return 1;
}
static void gayle_a1200_clear_irq(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
ide_hwif_t *hwif = drive->hwif;
(void)z_readb(hwif->io_ports.status_addr);
z_writeb(0x7c, hwif->io_ports.irq_addr);
(void)z_readb(hwif->io_ports.status_addr);
z_writeb(0x7c, hwif->io_ports.irq_addr);
}
static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
......@@ -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;
unsigned long base, ctrlport, irqport;
int a4000, i, rc;
struct ide_hw hw[GAYLE_NUM_HWIFS], *hws[GAYLE_NUM_HWIFS];
struct ide_port_info d = gayle_port_info;
if (!MACH_IS_AMIGA)
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;
found:
printk(KERN_INFO "ide: Gayle IDE controller (A%d style%s)\n",
a4000 ? 4000 : 1200,
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);
d.port_ops = &gayle_a1200_port_ops;
struct resource *res;
struct gayle_ide_platform_data *pdata;
unsigned long base, ctrlport, irqport;
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;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;