diff options
author | Michael Schmitz <schmitzmic@gmail.com> | 2013-04-05 20:26:39 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-04-16 15:18:29 -0400 |
commit | 736b24db32a806f79b43511e461321981bcfd5bf (patch) | |
tree | 1a8a84dedc03ca7366ddbe382ad88f2cb5cbb89d | |
parent | b1ae432c5e3d682d86a88fc798a9ed2469c14a7a (diff) |
m68k/atari: EtherNAT - platform device and IRQ support code
Add platform device and interrupt definitions necessary for the EtherNAT
Ethernet/USB adapter for the Falcon extension port. EtherNAT interrupt
numbers are 139/140 so the max. interrupt number for Atari has to be
increased.
[Geert] Conditionalize platform device data structures
Signed-off-by: Michael Schmitz <schmitz@debian.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
-rw-r--r-- | arch/m68k/Kconfig.devices | 10 | ||||
-rw-r--r-- | arch/m68k/atari/config.c | 64 | ||||
-rw-r--r-- | arch/m68k/include/asm/atarihw.h | 6 | ||||
-rw-r--r-- | arch/m68k/include/asm/atariints.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/irq.h | 6 |
5 files changed, 86 insertions, 2 deletions
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices index 4bc945dfe467..d50ecbf6d64f 100644 --- a/arch/m68k/Kconfig.devices +++ b/arch/m68k/Kconfig.devices | |||
@@ -55,6 +55,16 @@ config NFETH | |||
55 | which will emulate a regular ethernet device while presenting an | 55 | which will emulate a regular ethernet device while presenting an |
56 | ethertap device to the host system. | 56 | ethertap device to the host system. |
57 | 57 | ||
58 | config ATARI_ETHERNAT | ||
59 | bool "Atari EtherNAT Ethernet support" | ||
60 | depends on ATARI | ||
61 | ---help--- | ||
62 | Say Y to include support for the EtherNAT network adapter for the | ||
63 | CT/60 extension port. | ||
64 | |||
65 | To compile the actual ethernet driver, choose Y or M for the SMC91X | ||
66 | option in the network device section; the module will be called smc91x. | ||
67 | |||
58 | endmenu | 68 | endmenu |
59 | 69 | ||
60 | menu "Character devices" | 70 | menu "Character devices" |
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c index 037c11c99331..49d1c750acb0 100644 --- a/arch/m68k/atari/config.c +++ b/arch/m68k/atari/config.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/ioport.h> | 33 | #include <linux/ioport.h> |
34 | #include <linux/platform_device.h> | ||
34 | #include <linux/vt_kern.h> | 35 | #include <linux/vt_kern.h> |
35 | #include <linux/module.h> | 36 | #include <linux/module.h> |
36 | 37 | ||
@@ -655,3 +656,66 @@ static void atari_get_hardware_list(struct seq_file *m) | |||
655 | ATARIHW_ANNOUNCE(VME, "VME Bus"); | 656 | ATARIHW_ANNOUNCE(VME, "VME Bus"); |
656 | ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); | 657 | ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); |
657 | } | 658 | } |
659 | |||
660 | /* | ||
661 | * MSch: initial platform device support for Atari, | ||
662 | * required for EtherNAT driver | ||
663 | */ | ||
664 | |||
665 | #ifdef CONFIG_ATARI_ETHERNAT | ||
666 | /* | ||
667 | * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver | ||
668 | */ | ||
669 | |||
670 | #define ATARI_ETHERNAT_IRQ 140 | ||
671 | |||
672 | static struct resource smc91x_resources[] = { | ||
673 | [0] = { | ||
674 | .name = "smc91x-regs", | ||
675 | .start = ATARI_ETHERNAT_PHYS_ADDR, | ||
676 | .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff, | ||
677 | .flags = IORESOURCE_MEM, | ||
678 | }, | ||
679 | [1] = { | ||
680 | .name = "smc91x-irq", | ||
681 | .start = ATARI_ETHERNAT_IRQ, | ||
682 | .end = ATARI_ETHERNAT_IRQ, | ||
683 | .flags = IORESOURCE_IRQ, | ||
684 | }, | ||
685 | }; | ||
686 | |||
687 | static struct platform_device smc91x_device = { | ||
688 | .name = "smc91x", | ||
689 | .id = -1, | ||
690 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
691 | .resource = smc91x_resources, | ||
692 | }; | ||
693 | |||
694 | static struct platform_device *atari_ethernat_devices[] __initdata = { | ||
695 | &smc91x_device | ||
696 | }; | ||
697 | #endif /* CONFIG_ATARI_ETHERNAT */ | ||
698 | |||
699 | int __init atari_platform_init(void) | ||
700 | { | ||
701 | int rv = 0; | ||
702 | |||
703 | if (!MACH_IS_ATARI) | ||
704 | return -ENODEV; | ||
705 | |||
706 | #ifdef CONFIG_ATARI_ETHERNAT | ||
707 | { | ||
708 | unsigned char *enatc_virt; | ||
709 | enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf); | ||
710 | if (hwreg_present(enatc_virt)) { | ||
711 | rv = platform_add_devices(atari_ethernat_devices, | ||
712 | ARRAY_SIZE(atari_ethernat_devices)); | ||
713 | } | ||
714 | iounmap(enatc_virt); | ||
715 | } | ||
716 | #endif | ||
717 | |||
718 | return rv; | ||
719 | } | ||
720 | |||
721 | arch_initcall(atari_platform_init); | ||
diff --git a/arch/m68k/include/asm/atarihw.h b/arch/m68k/include/asm/atarihw.h index c0cb36350775..d887050e6da6 100644 --- a/arch/m68k/include/asm/atarihw.h +++ b/arch/m68k/include/asm/atarihw.h | |||
@@ -805,5 +805,11 @@ struct MSTE_RTC { | |||
805 | 805 | ||
806 | #define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS)) | 806 | #define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS)) |
807 | 807 | ||
808 | /* | ||
809 | ** EtherNAT add-on card for Falcon - combined ethernet and USB adapter | ||
810 | */ | ||
811 | |||
812 | #define ATARI_ETHERNAT_PHYS_ADDR 0x80000000 | ||
813 | |||
808 | #endif /* linux/atarihw.h */ | 814 | #endif /* linux/atarihw.h */ |
809 | 815 | ||
diff --git a/arch/m68k/include/asm/atariints.h b/arch/m68k/include/asm/atariints.h index 8f71504956cd..953e0ac6855e 100644 --- a/arch/m68k/include/asm/atariints.h +++ b/arch/m68k/include/asm/atariints.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define VME_SOURCE_BASE 56 | 32 | #define VME_SOURCE_BASE 56 |
33 | #define VME_MAX_SOURCES 16 | 33 | #define VME_MAX_SOURCES 16 |
34 | 34 | ||
35 | #define NUM_ATARI_SOURCES (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE) | 35 | #define NUM_ATARI_SOURCES 141 |
36 | 36 | ||
37 | /* convert vector number to int source number */ | 37 | /* convert vector number to int source number */ |
38 | #define IRQ_VECTOR_TO_SOURCE(v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8))) | 38 | #define IRQ_VECTOR_TO_SOURCE(v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8))) |
diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h index c1155f0e22cc..81ca118d58af 100644 --- a/arch/m68k/include/asm/irq.h +++ b/arch/m68k/include/asm/irq.h | |||
@@ -6,12 +6,16 @@ | |||
6 | * different m68k hosts compiled into the kernel. | 6 | * different m68k hosts compiled into the kernel. |
7 | * Currently the Atari has 72 and the Amiga 24, but if both are | 7 | * Currently the Atari has 72 and the Amiga 24, but if both are |
8 | * supported in the kernel it is better to make room for 72. | 8 | * supported in the kernel it is better to make room for 72. |
9 | * With EtherNAT add-on card on Atari, the highest interrupt | ||
10 | * number is 140 so NR_IRQS needs to be 141. | ||
9 | */ | 11 | */ |
10 | #if defined(CONFIG_COLDFIRE) | 12 | #if defined(CONFIG_COLDFIRE) |
11 | #define NR_IRQS 256 | 13 | #define NR_IRQS 256 |
12 | #elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) | 14 | #elif defined(CONFIG_VME) || defined(CONFIG_SUN3) || defined(CONFIG_SUN3X) |
13 | #define NR_IRQS 200 | 15 | #define NR_IRQS 200 |
14 | #elif defined(CONFIG_ATARI) || defined(CONFIG_MAC) | 16 | #elif defined(CONFIG_ATARI) |
17 | #define NR_IRQS 141 | ||
18 | #elif defined(CONFIG_MAC) | ||
15 | #define NR_IRQS 72 | 19 | #define NR_IRQS 72 |
16 | #elif defined(CONFIG_Q40) | 20 | #elif defined(CONFIG_Q40) |
17 | #define NR_IRQS 43 | 21 | #define NR_IRQS 43 |