2009-04-05 17:40:41 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007-2009 Geert Uytterhoeven
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file COPYING in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
#include <linux/err.h>
|
2009-04-05 17:40:41 +07:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/zorro.h>
|
|
|
|
|
|
|
|
#include <asm/amigahw.h>
|
2009-12-09 02:12:20 +07:00
|
|
|
#include <asm/amigayle.h>
|
2013-10-04 14:38:53 +07:00
|
|
|
#include <asm/byteorder.h>
|
2009-04-05 17:40:41 +07:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ZORRO
|
|
|
|
|
|
|
|
static const struct resource zorro_resources[] __initconst = {
|
|
|
|
/* Zorro II regions (on Zorro II/III) */
|
|
|
|
{
|
|
|
|
.name = "Zorro II exp",
|
|
|
|
.start = 0x00e80000,
|
|
|
|
.end = 0x00efffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}, {
|
|
|
|
.name = "Zorro II mem",
|
|
|
|
.start = 0x00200000,
|
|
|
|
.end = 0x009fffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
/* Zorro III regions (on Zorro III only) */
|
|
|
|
{
|
|
|
|
.name = "Zorro III exp",
|
|
|
|
.start = 0xff000000,
|
|
|
|
.end = 0xffffffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}, {
|
|
|
|
.name = "Zorro III cfg",
|
|
|
|
.start = 0x40000000,
|
|
|
|
.end = 0x7fffffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static int __init amiga_init_bus(void)
|
|
|
|
{
|
2012-01-22 18:44:25 +07:00
|
|
|
struct platform_device *pdev;
|
|
|
|
unsigned int n;
|
|
|
|
|
2009-04-05 17:40:41 +07:00
|
|
|
if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
|
|
|
|
return -ENODEV;
|
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
|
|
|
|
pdev = platform_device_register_simple("amiga-zorro", -1,
|
|
|
|
zorro_resources, n);
|
2013-07-15 08:50:32 +07:00
|
|
|
return PTR_ERR_OR_ZERO(pdev);
|
2009-04-05 17:40:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
subsys_initcall(amiga_init_bus);
|
|
|
|
|
2009-12-09 02:12:20 +07:00
|
|
|
|
2012-01-22 18:25:55 +07:00
|
|
|
static int __init z_dev_present(zorro_id id)
|
2009-12-09 02:12:20 +07:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
2013-10-04 14:38:53 +07:00
|
|
|
for (i = 0; i < zorro_num_autocon; i++) {
|
|
|
|
const struct ExpansionRom *rom = &zorro_autocon_init[i].rom;
|
|
|
|
if (be16_to_cpu(rom->er_Manufacturer) == ZORRO_MANUF(id) &&
|
|
|
|
rom->er_Product == ZORRO_PROD(id))
|
2009-12-09 02:12:20 +07:00
|
|
|
return 1;
|
2013-10-04 14:38:53 +07:00
|
|
|
}
|
2009-12-09 02:12:20 +07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !CONFIG_ZORRO */
|
|
|
|
|
|
|
|
static inline int z_dev_present(zorro_id id) { return 0; }
|
|
|
|
|
|
|
|
#endif /* !CONFIG_ZORRO */
|
2009-04-05 17:45:56 +07:00
|
|
|
|
|
|
|
|
2009-04-05 18:02:45 +07:00
|
|
|
static const struct resource a3000_scsi_resource __initconst = {
|
|
|
|
.start = 0xdd0000,
|
|
|
|
.end = 0xdd00ff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-05 18:05:50 +07:00
|
|
|
static const struct resource a4000t_scsi_resource __initconst = {
|
|
|
|
.start = 0xdd0000,
|
|
|
|
.end = 0xdd0fff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-12-09 02:12:20 +07:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-05 18:15:10 +07:00
|
|
|
static const struct resource amiga_rtc_resource __initconst = {
|
|
|
|
.start = 0x00dc0000,
|
|
|
|
.end = 0x00dcffff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-05 17:45:56 +07:00
|
|
|
static int __init amiga_init_devices(void)
|
|
|
|
{
|
2009-12-09 02:12:20 +07:00
|
|
|
struct platform_device *pdev;
|
2012-01-22 18:44:25 +07:00
|
|
|
int error;
|
2009-12-09 02:12:20 +07:00
|
|
|
|
2009-04-05 17:45:56 +07:00
|
|
|
if (!MACH_IS_AMIGA)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
/* video hardware */
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_VIDEO)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-video", -1, NULL,
|
|
|
|
0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 17:45:56 +07:00
|
|
|
|
2009-04-05 17:59:54 +07:00
|
|
|
|
|
|
|
/* sound hardware */
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_AUDIO)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-audio", -1, NULL,
|
|
|
|
0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 17:59:54 +07:00
|
|
|
|
2009-04-05 18:02:13 +07:00
|
|
|
|
|
|
|
/* storage interfaces */
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_FLOPPY)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-floppy", -1,
|
|
|
|
NULL, 0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:02:13 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(A3000_SCSI)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-a3000-scsi", -1,
|
|
|
|
&a3000_scsi_resource, 1);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:02:45 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(A4000_SCSI)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-a4000t-scsi", -1,
|
|
|
|
&a4000t_scsi_resource,
|
|
|
|
1);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:05:50 +07:00
|
|
|
|
2009-12-09 02:12:20 +07:00
|
|
|
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);
|
2012-01-22 18:44:25 +07:00
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
error = platform_device_add_data(pdev, &a1200_ide_pdata,
|
|
|
|
sizeof(a1200_ide_pdata));
|
|
|
|
if (error)
|
|
|
|
return error;
|
2009-12-09 02:12:20 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (AMIGAHW_PRESENT(A4000_IDE)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-gayle-ide", -1,
|
|
|
|
&a4000_ide_resource, 1);
|
2012-01-22 18:44:25 +07:00
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
error = platform_device_add_data(pdev, &a4000_ide_pdata,
|
|
|
|
sizeof(a4000_ide_pdata));
|
|
|
|
if (error)
|
|
|
|
return error;
|
2009-12-09 02:12:20 +07:00
|
|
|
}
|
|
|
|
|
2009-04-05 18:10:56 +07:00
|
|
|
|
|
|
|
/* other I/O hardware */
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_KEYBOARD)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-keyboard", -1,
|
|
|
|
NULL, 0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:10:56 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_MOUSE)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-mouse", -1, NULL,
|
|
|
|
0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:11:28 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_SERIAL)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-serial", -1,
|
|
|
|
NULL, 0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:12:30 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(AMI_PARALLEL)) {
|
|
|
|
pdev = platform_device_register_simple("amiga-parallel", -1,
|
|
|
|
NULL, 0);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:13:20 +07:00
|
|
|
|
2009-04-05 18:15:10 +07:00
|
|
|
|
|
|
|
/* real time clocks */
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(A2000_CLK)) {
|
|
|
|
pdev = platform_device_register_simple("rtc-msm6242", -1,
|
|
|
|
&amiga_rtc_resource, 1);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:15:10 +07:00
|
|
|
|
2012-01-22 18:44:25 +07:00
|
|
|
if (AMIGAHW_PRESENT(A3000_CLK)) {
|
|
|
|
pdev = platform_device_register_simple("rtc-rp5c01", -1,
|
|
|
|
&amiga_rtc_resource, 1);
|
|
|
|
if (IS_ERR(pdev))
|
|
|
|
return PTR_ERR(pdev);
|
|
|
|
}
|
2009-04-05 18:15:10 +07:00
|
|
|
|
2009-04-05 17:45:56 +07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-22 18:45:45 +07:00
|
|
|
arch_initcall(amiga_init_devices);
|