(unknown)
Subsystems (7)
Hello Geert,
This series of patches updates Atari EtherNAT and EtherNEC network support, plus adds USB driver support for the ISP1160 chip found on EtherNAT and NetUSBee adapters.
It is meant to apply on top of your m68k-queue or master branches. Expect a merge conflict in #4 (the EtherNAT base address has been moved to atarihw.h as per your feedback). I can provide the necessary patch on top of the 'Initial EtherNAT support' patch from your queue that would avoid the conflict.
Network stuff:
01/14 m68k/atari EtherNEC: remove original EtherNEC driver
02/14 m68k/atari EtherNAT: remove original EtherNAT driver
03/14 m68k/atari: use CONFIG_ATARI in smc91x.h
04/14 m68k/atari: EtherNAT - change number of Atari interrupt sources 05/14 m68k/irq: add handle_polled_irq() for timer based soft interrupts 06/14 m68k/atari: use dedicated irq_chip for timer D interrupts 07/14 m68k/atari: EtherNEC - add platform device support
08/14 m68k/atari: EtherNAT - ethernet support - new driver (smc91x) 09/14 m68k/atari: EtherNEC - ethernet support - new driver (ne.c) 10/14 m68k/atari: EtherNAT - add interrupt chip for Ethernet and USB interrupts
USB related:
11/14 m68k/atari: Implement 16 bit access macros for ROM port 12/14 m68k: Implement ndelay() based on the existing udelay() logic 13/14 m68k/atari: USB - add platform device definitions for ISP1160 HCD 14/14 m68k/atari: USB - Add ISP1160 USB host controller support
You may well decide to leave out #5 - use of EtherNEC and NetUSBee is then possible only with the 'noirqdebug' kernel option.
Many thanks to David Galvez for setting me straight on register locations, ways to deal with the USB fifo transfers and testing/fixing the code for the NetUSBee case. I have departed from the code David used to switch between NetUSBee and EtherNAT access, but only slighlty. Please test this version and yell if it's not doing the right thing, David.
With the present code, the timer D interrupt frequency is approximately 100 Hz. On fast hardware, it should probably be doubled (change the timer D counter value fron 254 to 123 to achieve that. I had the timer rate adjustable via kernel options in an earlier incarnation pf the ethernet drivers. Or make it a function of the processor clock rate
- whoever feels like it can revive that bit please).
Thorsten: I will shortly send another patch series against upstream linus-3.9-rc2. That one may be easier to integrate into Debian kernel sources.
Cheers,
Michael
PATCH 1/14 m68k/atari EtherNEC: remove original EtherNEC driver
--- drivers/net/Space.c | 4 - drivers/net/ethernet/8390/Kconfig | 8 - drivers/net/ethernet/8390/Makefile | 1 - drivers/net/ethernet/8390/atari_ethernec.c | 1008 ---------------------------- 4 files changed, 0 insertions(+), 1021 deletions(-) delete mode 100644 drivers/net/ethernet/8390/atari_ethernec.c
drivers/net/Space.c +0 -4
@@ -47,7 +47,6 @@ extern struct net_device *ni65_probe(int unit);extern struct net_device *sonic_probe (int unit);extern struct net_device *smc_init (int unit);extern struct net_device *atarilance_probe (int unit); -extern struct net_device *atari_ethernec_probe (int unit);extern struct net_device *sun3lance_probe (int unit);extern struct net_device *sun3_82586_probe (int unit);extern struct net_device *apne_probe (int unit);
@@ -131,9 +130,6 @@ static struct devprobe2 m68k_probes[] __initdata = { #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */ {atarilance_probe, 0}, #endif -#ifdef CONFIG_ATARI_ETHERNEC /* NE2000 based ROM port ethernet cards */ - {atari_ethernec_probe, 0}, -#endif #ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */ {sun3lance_probe, 0}, #endif
drivers/net/ethernet/8390/Kconfig +0 -8
@@ -135,14 +135,6 @@ config APNE To compile this driver as a module, choose M here: the module will be called apne. -config ATARI_ETHERNEC - tristate "Atari EtherNEC Ethernet support" - depends on ATARI_ROM_ISA - help - Say Y to include support for the EtherNEC network adapter for the - ROM port. The driver works by polling instead of interrupts, so it - is quite slow. - config PCMCIA_PCNET tristate "NE2000 compatible PCMCIA support" depends on PCMCIA
drivers/net/ethernet/8390/Makefile +0 -1
@@ -5,7 +5,6 @@ obj-$(CONFIG_MAC8390) += mac8390.o obj-$(CONFIG_APNE) += apne.o 8390.o obj-$(CONFIG_ARM_ETHERH) += etherh.o -obj-$(CONFIG_ATARI_ETHERNEC) += atari_ethernec.o 8390.o obj-$(CONFIG_AX88796) += ax88796.o obj-$(CONFIG_HYDRA) += hydra.o 8390.o obj-$(CONFIG_MCF8390) += mcf8390.o 8390.o
drivers/net/ethernet/8390/atari_ethernec.c deleted +0 -1008
1,008 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 2/14 m68k/atari EtherNAT: remove original EtherNAT driver
In reply to Michael Schmitz--- drivers/net/ethernet/smsc/Kconfig | 10 - drivers/net/ethernet/smsc/Makefile | 1 - drivers/net/ethernet/smsc/atari_91C111.c | 2434 ------------------------------ 3 files changed, 0 insertions(+), 2445 deletions(-) delete mode 100644 drivers/net/ethernet/smsc/atari_91C111.c
drivers/net/ethernet/smsc/Kconfig +0 -10
@@ -19,16 +19,6 @@ config NET_VENDOR_SMSC if NET_VENDOR_SMSC -config ATARI_ETHERNAT - tristate "Atari EtherNAT Ethernet support" - select CRC32 - select MII - depends on ATARI - help - Say Y to include support for the EtherNAT network adapter for the - CT/60 extension port. The driver works by polling instead of - interrupts, so it is quite slow. - config SMC9194 tristate "SMC 9194 support" depends on (ISA || MAC && BROKEN)
drivers/net/ethernet/smsc/Makefile +0 -1
@@ -2,7 +2,6 @@ # Makefile for the SMSC network device drivers. # -obj-$(CONFIG_ATARI_ETHERNAT) += atari_91C111.o obj-$(CONFIG_SMC9194) += smc9194.o obj-$(CONFIG_SMC91X) += smc91x.o obj-$(CONFIG_PCMCIA_SMC91C92) += smc91c92_cs.o
drivers/net/ethernet/smsc/atari_91C111.c deleted +0 -2434
2,434 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 3/14 m68k/atari: use CONFIG_ATARI in smc91x.h
In reply to Michael Schmitz--- drivers/net/ethernet/smsc/smc91x.h | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/smsc/smc91x.h +2 -4
@@ -231,7 +231,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)#include <unit/smc91111.h> -#elif defined(CONFIG_ATARI_ETHERNAT ) || defined(CONFIG_ATARI_ETHERNAT_MODULE ) +#elif defined(CONFIG_ATARI )#define SMC_CAN_USE_8BIT 1#define SMC_CAN_USE_16BIT 1
@@ -255,8 +255,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)#define RPC_LSA_DEFAULT RPC_LED_100_10#define RPC_LSB_DEFAULT RPC_LED_TX_RX -#define SMC_DYNAMIC_BUS_CONFIG -#elif defined(CONFIG_ARCH_MSM )#define SMC_CAN_USE_8BIT 0
@@ -1142,7 +1140,7 @@ static const char * chip_ids[ 16 ] = { } \ } while (0) -#if defined(CONFIG_ATARI_ETHERNAT ) || defined(CONFIG_ATARI_ETHERNAT_MODULE ) +#if defined(CONFIG_ATARI )/* * MSch: EtherNAT is 32 bit, so the misaligned data buffer hack applies. * This appears to hurt quite a lot ... we actually need to byte swap the
Signature · 1 line
1.7.0.4
PATCH 4/14 m68k/atari: EtherNAT - change number of Atari interrupt sources
In reply to Michael SchmitzIncrease the number of Atari interrupt sources to include EtherNAT interrupts (interrupt nunbers 139/140, vectors 0xc3/0xc4).
--- arch/m68k/atari/config.c | 20 +++++++++++++++++--- arch/m68k/include/asm/atariints.h | 2 +- arch/m68k/include/asm/irq.h | 6 +++++- 3 files changed, 23 insertions(+), 5 deletions(-)
arch/m68k/atari/config.c +17 -3
@@ -661,7 +661,7 @@ static void atari_get_hardware_list(struct seq_file *m)* MSch: initial platform device support for Atari, required for EtherNAT */ -#define ATARI_ETHERNAT_IRQ 0xc3 +#define ATARI_ETHERNAT_IRQ 140static struct resource smc91x_resources[] = { [0 ] = {
@@ -685,16 +685,30 @@ static struct platform_device smc91x_device = { .resource = smc91x_resources, }; -static struct platform_device *atari_platform_devices[]__initdata = { +static struct platform_device *atari_ethernat_devices[]__initdata = { &smc91x_device };int __init atari_platform_init (void ) { +int rv =0 ; +if (!MACH_IS_ATARI )return -ENODEV ; -return platform_add_devices (atari_platform_devices,ARRAY_SIZE (atari_platform_devices)); +#ifdef CONFIG_ATARI_ETHERNAT + { +unsigned char *enatc_virt; + enatc_virt = (unsigned char *)ioremap ((ATARI_ETHERNAT_PHYS_ADDR +0x23 ),0xf ); +if (hwreg_present (enatc_virt)) { + rv =platform_add_devices (atari_ethernat_devices, +ARRAY_SIZE (atari_ethernat_devices)); + } +iounmap (enatc_virt); + } +#endif + +return rv; }arch_initcall (atari_platform_init);
arch/m68k/include/asm/atariints.h +1 -1
@@ -32,7 +32,7 @@#define VME_SOURCE_BASE 56#define VME_MAX_SOURCES 16 -#define NUM_ATARI_SOURCES (VME_SOURCE_BASE+VME_MAX_SOURCES-STMFP_SOURCE_BASE) +#define NUM_ATARI_SOURCES 141/* convert vector number to int source number */ #define IRQ_VECTOR_TO_SOURCE (v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8)))
arch/m68k/include/asm/irq.h +5 -1
@@ -6,12 +6,16 @@* different m68k hosts compiled into the kernel. * Currently the Atari has 72 and the Amiga 24, but if both are * supported in the kernel it is better to make room for 72. +* With EtherNAT add-on card on Atari, the highest interrupt +* number is 140 so NR_IRQS needs to be 141. */ #if defined(CONFIG_COLDFIRE )#define NR_IRQS 256#elif defined(CONFIG_VME ) || defined(CONFIG_SUN3 ) || defined(CONFIG_SUN3X )#define NR_IRQS 200 -#elif defined(CONFIG_ATARI ) || defined(CONFIG_MAC ) +#elif defined(CONFIG_ATARI ) +#define NR_IRQS 141 +#elif defined(CONFIG_MAC )#define NR_IRQS 72#elif defined(CONFIG_Q40 )#define NR_IRQS 43
Signature · 1 line
1.7.0.4
PATCH 5/14 m68k/irq: add handle_polled_irq() for timer based soft interrupts
In reply to Michael SchmitzThis patch adds a special 'polled interrupt' handler for timer based software interrupts.
handle_simple_irq() will respond to excessive unhandled interrupts (as are expected for a polling timer interrupt) by disabling the apparently unhandled interrupt source.
handle_polled_irq() prevents this by setting the IRQS_POLL_INPROGRESS flag which will cause the unhandled interrupt events to be ignored.
This is a temporary hack to allow timer based polling of the Atari ROM port network and USB cards only. Suggestions on how to properly handle this in the normal interrupt framework are most welcome.
--- include/linux/irq.h | 1 + kernel/irq/chip.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 0 deletions(-)
include/linux/irq.h +1 -0
@@ -407,6 +407,7 @@ extern void handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc);extern void handle_edge_irq (unsigned int irq,struct irq_desc *desc);extern void handle_edge_eoi_irq (unsigned int irq,struct irq_desc *desc);extern void handle_simple_irq (unsigned int irq,struct irq_desc *desc); +extern void handle_polled_irq (unsigned int irq,struct irq_desc *desc);extern void handle_percpu_irq (unsigned int irq,struct irq_desc *desc);extern void handle_percpu_devid_irq (unsigned int irq,struct irq_desc *desc);extern void handle_bad_irq (unsigned int irq,struct irq_desc *desc);
kernel/irq/chip.c +36 -0
@@ -353,6 +353,42 @@ out_unlock: }EXPORT_SYMBOL_GPL (handle_simple_irq); +/** +* handle_polled_irq - Simple and software-decoded IRQs. +* @irq: the interrupt number +* @desc: the interrupt description structure for this irq +* +* Polled interrupts are sent from a demultiplexing software interrupt +* handler, where no interrupt hardware control is necessary. +*/ +void +handle_polled_irq (unsigned int irq,struct irq_desc *desc) +{ +raw_spin_lock (&desc->lock); + +if (unlikely (irqd_irq_inprogress (&desc->irq_data))) +if (!irq_check_poll (desc)) + goto out_unlock; + + desc->istate &= ~(IRQS_REPLAY |IRQS_WAITING ); +kstat_incr_irqs_this_cpu (irq, desc); + +if (unlikely (!desc->action ||irqd_irq_disabled (&desc->irq_data))) { + desc->istate |=IRQS_PENDING ; + goto out_unlock; + } + + desc->istate |=IRQS_POLL_INPROGRESS ; + +handle_irq_event (desc); + + desc->istate &= ~(IRQS_POLL_INPROGRESS ); + +out_unlock: +raw_spin_unlock (&desc->lock); +} +EXPORT_SYMBOL_GPL (handle_polled_irq); +/* * Called unconditionally from handle_level_irq() and only for oneshot * interrupts from handle_fasteoi_irq()
Signature · 1 line
1.7.0.4
PATCH 6/14 m68k/atari: use dedicated irq_chip for timer D interrupts
In reply to Michael SchmitzThe MFP timer D is used as a polling timer for EtherNEC and NetUSBee on Atari. Set up a dedicated IRQ chip for timer D to simplify interrupt sharing, and use the new 'polling' IRQ handler for its interrupts.
--- arch/m68k/atari/ataints.c | 70 +++++++++++++++++++++++++++++++++++++ arch/m68k/include/asm/atariints.h | 9 +++++ 2 files changed, 79 insertions(+), 0 deletions(-)
arch/m68k/atari/ataints.c +70 -0
@@ -122,6 +122,62 @@ static struct irq_chip atari_irq_chip = { };/* +* ST-MFP timer D chained interrupts - each driver gets its own timer +* interrupt instance. +*/ + +struct mfptimerbase { +volatile struct MFP *mfp; +unsigned char mfp_mask, mfp_data; +unsigned short int_mask; +int handler_irq, mfptimer_irq, server_irq; +char *name; +} stmfp_base = { + .mfp = &st_mfp, + .int_mask =0x0 , + .handler_irq =IRQ_MFP_TIMD , + .mfptimer_irq =IRQ_MFP_TIMER1 , + .name ="MFP Timer D" +}; + +static irqreturn_t mfptimer_handler (int irq,void *dev_id) +{ +struct mfptimerbase *base = dev_id; +int mach_irq; +unsigned char ints; + + mach_irq = base->mfptimer_irq; + ints = base->int_mask; +for (; ints; mach_irq++, ints >>=1 ) { +if (ints &1 ) +generic_handle_irq (mach_irq); + } +return IRQ_HANDLED ; +} + + +static void atari_mfptimer_enable (struct irq_data *data) +{ +int mfp_num = data->irq -IRQ_MFP_TIMER1 ; + stmfp_base.int_mask |=1 << mfp_num; +atari_enable_irq (IRQ_MFP_TIMD ); +} + +static void atari_mfptimer_disable (struct irq_data *data) +{ +int mfp_num = data->irq -IRQ_MFP_TIMER1 ; + stmfp_base.int_mask &= ~(1 << mfp_num); +if (!stmfp_base.int_mask) +atari_disable_irq (IRQ_MFP_TIMD ); +} + +static struct irq_chip atari_mfptimer_chip = { + .name ="timer_d" , + .irq_enable = atari_mfptimer_enable, + .irq_disable = atari_mfptimer_disable, +}; + +/* * void atari_init_IRQ (void) * * Parameters: None
@@ -198,6 +254,20 @@ void __init atari_init_IRQ(void)/* Initialize the PSG: all sounds off, both ports output */ sound_ym.rd_data_reg_sel =7 ; sound_ym.wd_data =0xff ; + +m68k_setup_irq_controller (&atari_mfptimer_chip, handle_polled_irq, +IRQ_MFP_TIMER1 ,8 ); + +/* prepare timer D data for use as poll interrupt */ +/* set Timer D data Register - needs to be > 0 */ + st_mfp.tim_dt_d =254 ;/* < 100 Hz */ +/* start timer D, div = 1:100 */ + st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd &0xf0 ) |0x6 ; + +/* request timer D dispatch handler */ +if (request_irq (IRQ_MFP_TIMD , mfptimer_handler,IRQF_SHARED , + stmfp_base.name, &stmfp_base)) +pr_err ("Couldn't register %s interrupt\n" , stmfp_base.name); }
arch/m68k/include/asm/atariints.h +9 -0
@@ -94,6 +94,15 @@#define IRQ_SCCA_RX (52)#define IRQ_SCCA_SPCOND (54) +/* shared MFP timer D interrupts - hires timer for EtherNEC et al. */ +#define IRQ_MFP_TIMER1 (64) +#define IRQ_MFP_TIMER2 (65) +#define IRQ_MFP_TIMER3 (66) +#define IRQ_MFP_TIMER4 (67) +#define IRQ_MFP_TIMER5 (68) +#define IRQ_MFP_TIMER6 (69) +#define IRQ_MFP_TIMER7 (70) +#define IRQ_MFP_TIMER8 (71)#define INT_CLK 24576/* CLK while int_clk =2.456MHz and divide = 100 */ #define INT_TICKS 246/* to make sched_time = 99.902... HZ */
Signature · 1 line
1.7.0.4
PATCH 7/14 m68k/atari: EtherNEC - add platform device support
In reply to Michael SchmitzPlatform device support for EtherNEC, uset by ne.c driver.
--- arch/m68k/atari/config.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +45 -0
@@ -689,6 +689,36 @@ static struct platform_device *atari_ethernat_devices[] __initdata = { &smc91x_device }; +#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000 +#define ATARI_ETHERNEC_BASE 0x300 +#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1 + +static struct resource rtl8019_resources[] = { + [0 ] = { + .name ="rtl8019-regs" , + .start =ATARI_ETHERNEC_BASE , + .end =ATARI_ETHERNEC_BASE +0x20 -1 , + .flags =IORESOURCE_IO , + }, + [1 ] = { + .name ="rtl8019-irq" , + .start =ATARI_ETHERNEC_IRQ , + .end =ATARI_ETHERNEC_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device rtl8019_device = { + .name ="ne" , + .id =-1 , + .num_resources =ARRAY_SIZE (rtl8019_resources), + .resource = rtl8019_resources, +}; + +static struct platform_device *atari_ethernec_devices[]__initdata = { + &rtl8019_device +}; +int __init atari_platform_init (void ) {int rv =0 ;
@@ -708,6 +738,21 @@ int __init atari_platform_init(void) }#endif +#ifdef CONFIG_ATARI_ETHERNEC + { +int error; +unsigned char *enec_virt; + enec_virt = (unsigned char *)ioremap ((ATARI_ETHERNEC_PHYS_ADDR ),0xf ); +if (hwreg_present (enec_virt)) { + error =platform_add_devices (atari_ethernec_devices, +ARRAY_SIZE (atari_ethernec_devices)); +if (error && !rv) + rv = error; + } +iounmap (enec_virt); + } +#endif +return rv; }
Signature · 1 line
1.7.0.4
PATCH 8/14 m68k/atari: EtherNAT - ethernet support - new driver (smc91x)
In reply to Michael SchmitzUse smc91x driver for Atari EtherNAT SMC91C111 ethernet chip. Change to smc91x.h is necessary to avoid corruption of outgoing ethernet packet headers (first two bytes end up swapped otherwise).
--- arch/m68k/Kconfig.devices | 10 ++++++++++ drivers/net/ethernet/smsc/Kconfig | 2 +- 2 files changed, 11 insertions(+), 1 deletions(-)
arch/m68k/Kconfig.devices +10 -0
@@ -55,6 +55,16 @@ config NFETH which will emulate a regular ethernet device while presenting an ethertap device to the host system. +config ATARI_ETHERNAT + bool "Atari EtherNAT Ethernet support" + depends on ATARI + ---help--- + Say Y to include support for the EtherNAT network adapter for the + CT/60 extension port. + + To compile the actual ethernet driver, choose Y or M for the SMC91X + option in the network device section; the module will be called smc91x. + endmenu menu "Character devices"
drivers/net/ethernet/smsc/Kconfig +1 -1
@@ -40,7 +40,7 @@ config SMC91X select NET_CORE select MII depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \ - MN10300 || COLDFIRE) + MN10300 || COLDFIRE || ATARI_ETHERNAT) ---help--- This is a driver for SMC's 91x series of Ethernet chipsets, including the SMC91C94 and the SMC91C111. Say Y if you want it
Signature · 1 line
1.7.0.4
PATCH 9/14 m68k/atari: EtherNEC - ethernet support - new driver (ne.c)
In reply to Michael SchmitzUse ne.c driver for Atari EtherNEC and NetUSBee network adapters.
--- arch/m68k/Kconfig.devices | 11 +++++++++++ drivers/net/ethernet/8390/Kconfig | 3 ++- drivers/net/ethernet/8390/ne.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletions(-)
arch/m68k/Kconfig.devices +11 -0
@@ -65,6 +65,17 @@ config ATARI_ETHERNAT To compile the actual ethernet driver, choose Y or M for the SMC91X option in the network device section; the module will be called smc91x. +config ATARI_ETHERNEC + bool "Atari EtherNEC Ethernet support" + depends on ATARI_ROM_ISA + ---help--- + Say Y to include support for the EtherNEC and NetUSBee network adapters + for the ROM port. The driver works by polling instead of interrupts, so + it is quite slow. + + To compile the actual ethernet driver, choose Y or M in for the NE2000 + option in the network device section; the module will be called ne. + endmenu menu "Character devices"
drivers/net/ethernet/8390/Kconfig +2 -1
@@ -91,7 +91,8 @@ config MCF8390 config NE2000 tristate "NE2000/NE1000 support" - depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX) + depends on (ISA || (Q40 && m) || M32R || MACH_TX49XX || \ + ATARI_ETHERNEC) select CRC32 ---help--- If you have a network (Ethernet) card of this type, say Y and read
drivers/net/ethernet/8390/ne.c +2 -0
@@ -166,6 +166,8 @@ bad_clone_list[] __initdata = {#elif defined(CONFIG_PLAT_OAKS32R ) || \ defined(CONFIG_MACH_TX49XX )# define DCR_VAL 0x48/* 8-bit mode */ +#elif defined(CONFIG_ATARI )/* 8-bit mode on Atari, normal on Q40 */ +# define DCR_VAL (MACH_IS_ATARI ? 0x48 : 0x49)#else # define DCR_VAL 0x49#endif
Signature · 1 line
1.7.0.4
PATCH 10/14 m68k/atari: EtherNAT - add interrupt chip for Ethernet and USB interrupts
In reply to Michael SchmitzAdd a dedicated interrupt chip definition for the EtherNAT CPLD interrupts. SMC91C111 and ISP1160 chips have separate interrupts that can be enabled and disabled in a CPLD register at offset 0x23 from the card base.
The smc91x and isp116x-hcd drivers will use this feature.
--- arch/m68k/atari/ataints.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 68 insertions(+), 0 deletions(-)
arch/m68k/atari/ataints.c +68 -0
@@ -49,6 +49,7 @@#include <asm/atari_stdma.h> #include <asm/irq.h> #include <asm/entry.h> +#include <asm/io.h> /*
@@ -177,6 +178,66 @@ static struct irq_chip atari_mfptimer_chip = { .irq_disable = atari_mfptimer_disable, }; + +/* +* EtherNAT CPLD interrupt handling +* CPLD interrupt register is at phys. 0x80000023 +* Need this mapped in at interrupt startup time +*/ + +static unsigned char *enat_cpld; + +static unsigned int atari_ethernat_startup (struct irq_data *data) +{ +int enat_num =140 - data->irq +1 ; + +m68k_irq_startup (data); +/* +* map CPLD interrupt register +*/ +if (!enat_cpld) + enat_cpld = (unsigned char *)ioremap ((ATARI_ETHERNAT_PHYS_ADDR +0x23 ),0x2 ); +/* +* do _not_ enable the USB chip interrupt here - causes interrupt storm +* and triggers dead interrupt watchdog +* Need to reset the USB chip to a sane state in early startup before removing this hack +*/ +if (enat_num ==1 ) + *enat_cpld |=1 << enat_num; + +return 0 ; +} + +static void atari_ethernat_enable (struct irq_data *data) +{ +int enat_num =140 - data->irq +1 ; + *enat_cpld |=1 << enat_num; +} + +static void atari_ethernat_disable (struct irq_data *data) +{ +int enat_num =140 - data->irq +1 ; + *enat_cpld &= ~(1 << enat_num); +} + +static void atari_ethernat_shutdown (struct irq_data *data) +{ +int enat_num =140 - data->irq +1 ; +if (enat_cpld) { + *enat_cpld &= ~(1 << enat_num); +iounmap (enat_cpld); + enat_cpld =NULL ; + } +} + +static struct irq_chip atari_ethernat_chip = { + .name ="ethernat" , + .irq_startup = atari_ethernat_startup, + .irq_shutdown = atari_ethernat_shutdown, + .irq_enable = atari_ethernat_enable, + .irq_disable = atari_ethernat_disable, +}; +/* * void atari_init_IRQ (void) *
@@ -268,6 +329,13 @@ void __init atari_init_IRQ(void)if (request_irq (IRQ_MFP_TIMD , mfptimer_handler,IRQF_SHARED , stmfp_base.name, &stmfp_base))pr_err ("Couldn't register %s interrupt\n" , stmfp_base.name); + +/* +* EtherNAT ethernet / USB interrupt handlers +*/ + +m68k_setup_irq_controller (&atari_ethernat_chip, handle_simple_irq, +139 ,2 ); }
Signature · 1 line
1.7.0.4
PATCH 11/14 m68k/atari: Implement 16 bit access macros for ROM port
In reply to Michael SchmitzImplement 16 bit access for ROM port adapter cards, following debugging and clarification by David Galvez <[email protected]>
Remove 32 bit ROM port access macros introduced in original ROM port access patch. 32 bit writes are impossible to Atari ROM port adapters without dropping the top bits - even 16 bit writes are done as two 8 bit ones in order to keep room for the address and chip select bits. 32 bit read should work but there's no adapter hardware that would use these.
--- arch/m68k/include/asm/io_mm.h | 44 ++++++++++++------------------ arch/m68k/include/asm/raw_io.h | 57 +++++++++++++++++---------------------- 2 files changed, 43 insertions(+), 58 deletions(-)
arch/m68k/include/asm/io_mm.h +18 -26
@@ -68,10 +68,10 @@#define enec_isa_read_base 0xfffa0000#define enec_isa_write_base 0xfffb0000 -#define ENEC_ISA_IO_B (ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x1F)<<9)) -#define ENEC_ISA_IO_W (ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x1F)<<9)) -#define ENEC_ISA_MEM_B (madr) (enec_isa_read_base+((((unsigned long)(madr))&0x1F)<<9)) -#define ENEC_ISA_MEM_W (madr) (enec_isa_read_base+((((unsigned long)(madr))&0x1F)<<9)) +#define ENEC_ISA_IO_B (ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9)) +#define ENEC_ISA_IO_W (ioaddr) (enec_isa_read_base+((((unsigned long)(ioaddr))&0x7F)<<9)) +#define ENEC_ISA_MEM_B (madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9)) +#define ENEC_ISA_MEM_W (madr) (enec_isa_read_base+((((unsigned long)(madr))&0x7F)<<9))#ifndef MULTI_ISA #define MULTI_ISA 0
@@ -261,27 +261,29 @@ static inline u16 __iomem *isa_mtw(unsigned long addr)#define isa_rom_inw (port) \ (ISA_SEX ? rom_in_be16(isa_itw(port)) \ : rom_in_le16(isa_itw(port))) -#define isa_rom_inl (port) \ - (ISA_SEX ? rom_in_be32(isa_itw(port)) \ - : rom_in_le32(isa_itw(port)))#define isa_rom_outb (val, port) rom_out_8(isa_itb(port), (val))#define isa_rom_outw (val, port) \ (ISA_SEX ? rom_out_be16(isa_itw(port), (val)) \ : rom_out_le16(isa_itw(port), (val))) -#define isa_rom_outl (val, port) \ - (ISA_SEX ? rom_out_be32(isa_itw(port), (val)) \ - : rom_out_le32(isa_itw(port), (val)))#define isa_rom_readb (p) rom_in_8(isa_mtb((unsigned long)(p)))#define isa_rom_readw (p) \ (ISA_SEX ? rom_in_be16(isa_mtw((unsigned long)(p))) \ : rom_in_le16(isa_mtw((unsigned long)(p)))) +#define isa_rom_readw_swap (p) \ + (ISA_SEX ? rom_in_le16(isa_mtw((unsigned long)(p))) \ + : rom_in_be16(isa_mtw((unsigned long)(p)))) +#define isa_rom_readw_raw (p) rom_in_be16(isa_mtw((unsigned long)(p)))#define isa_rom_writeb (val, p) rom_out_8(isa_mtb((unsigned long)(p)), (val))#define isa_rom_writew (val, p) \ (ISA_SEX ? rom_out_be16(isa_mtw((unsigned long)(p)), (val)) \ : rom_out_le16(isa_mtw((unsigned long)(p)), (val))) +#define isa_rom_writew_swap (val, p) \ + (ISA_SEX ? rom_out_le16(isa_mtw((unsigned long)(p)), (val)) \ + : rom_out_be16(isa_mtw((unsigned long)(p)), (val))) +#define isa_rom_writew_raw (val, p) rom_out_be16(isa_mtw((unsigned long)(p)), (val))#endif /* CONFIG_ATARI_ROM_ISA */ static inline void isa_delay (void )
@@ -331,10 +333,8 @@ static inline void isa_delay(void)#ifdef CONFIG_ATARI_ROM_ISA #define isa_rom_inb_p (p) ({ u8 _v = isa_rom_inb(p); isa_delay(); _v; })#define isa_rom_inw_p (p) ({ u16 _v = isa_rom_inw(p); isa_delay(); _v; }) -#define isa_rom_inl_p (p) ({ u32 _v = isa_rom_inl(p); isa_delay(); _v; })#define isa_rom_outb_p (v, p) ({ isa_rom_outb((v), (p)); isa_delay(); })#define isa_rom_outw_p (v, p) ({ isa_rom_outw((v), (p)); isa_delay(); }) -#define isa_rom_outl_p (v, p) ({ isa_rom_outl((v), (p)); isa_delay(); })#define isa_rom_insb (port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr))
@@ -342,19 +342,11 @@ static inline void isa_delay(void) (ISA_SEX ?raw_rom_insw (isa_itw (port), (u16 *)(buf), (nr)) : \ raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) -#define isa_rom_insl (port, buf, nr) \ - (ISA_SEX ? raw_rom_insl(isa_itw(port), (u32 *)(buf), (nr)) : \ - raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) -#define isa_rom_outsb (port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr))#define isa_rom_outsw (port, buf, nr) \ (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) - -#define isa_rom_outsl (port, buf, nr) \ - (ISA_SEX ? raw_rom_outsl(isa_itw(port), (u32 *)(buf), (nr)) : \ - raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1))#endif /* CONFIG_ATARI_ROM_ISA */ #endif /* CONFIG_ISA || CONFIG_ATARI_ROM_ISA */
@@ -396,22 +388,22 @@ static inline void isa_delay(void)#define inb_p (port) ((port) < 1024 ? isa_rom_inb_p(port) : in_8(port))#define inw (port) ((port) < 1024 ? isa_rom_inw(port) : in_le16(port))#define inw_p (port) ((port) < 1024 ? isa_rom_inw_p(port) : in_le16(port)) -#define inl (port) ((port) < 1024 ? isa_rom_inl(port) : in_le32(port)) -#define inl_p (port) ((port) < 1024 ? isa_rom_inl_p(port) : in_le32(port)) +#define inl isa_inl +#define inl_p isa_inl_p#define outb (val, port) ((port) < 1024 ? isa_rom_outb((val), (port)) : out_8((port), (val)))#define outb_p (val, port) ((port) < 1024 ? isa_rom_outb_p((val), (port)) : out_8((port), (val)))#define outw (val, port) ((port) < 1024 ? isa_rom_outw((val), (port)) : out_le16((port), (val)))#define outw_p (val, port) ((port) < 1024 ? isa_rom_outw_p((val), (port)) : out_le16((port), (val))) -#define outl (val, port) ((port) < 1024 ? isa_rom_outl((val), (port)) : out_le32((port), (val))) -#define outl_p (val, port) ((port) < 1024 ? isa_rom_outl_p((val), (port)) : out_le32((port), (val))) +#define outl isa_outl +#define outl_p isa_outl_p#define insb (port, buf, nr) ((port) < 1024 ? isa_rom_insb((port), (buf), (nr)) : isa_insb((port), (buf), (nr)))#define insw (port, buf, nr) ((port) < 1024 ? isa_rom_insw((port), (buf), (nr)) : isa_insw((port), (buf), (nr))) -#define insl (port, buf, nr) ((port) < 1024 ? isa_rom_insl((port), (buf), (nr)) : isa_insl((port), (buf), (nr))) +#define insl isa_insl#define outsb (port, buf, nr) ((port) < 1024 ? isa_rom_outsb((port), (buf), (nr)) : isa_outsb((port), (buf), (nr)))#define outsw (port, buf, nr) ((port) < 1024 ? isa_rom_outsw((port), (buf), (nr)) : isa_outsw((port), (buf), (nr))) -#define outsl (port, buf, nr) ((port) < 1024 ? isa_rom_outsl((port), (buf), (nr)) : isa_outsl((port), (buf), (nr))) +#define outsl isa_outsl#define readb (addr) in_8(addr)#define writeb (val,addr) out_8((addr),(val))
arch/m68k/include/asm/raw_io.h +25 -32
83 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 12/14 m68k: Implement ndelay() based on the existing udelay() logic
In reply to Michael SchmitzAdd ndelay macro, modeled after the CF udelay macro. The ISP1160 USB HCD chip on EtherNAT and NetUSBee needs a 150ns delay after register access.
--- arch/m68k/include/asm/delay.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
arch/m68k/include/asm/delay.h +20 -0
@@ -92,5 +92,25 @@ static inline void __udelay(unsigned long usecs)#define udelay (n) (__builtin_constant_p(n) ? \ ((n) > 20000 ? __bad_udelay() : __const_udelay(n)) : __udelay(n)) +/* +* nanosecond delay: +* +* ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) is the number of loops per microsecond +* +* 1000 / ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) is the number of nanoseconds per loop +* +* So n / ( 1000 / ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6) ) would be the number of loops for n nanoseconds +*/ + +/* +* The simpler m68k and ColdFire processors do not have a 32*32->64 +* multiply instruction. So we need to handle them a little differently. +* We use a bit of shifting and a single 32*32->32 multiply to get close. +* This is a macro so that the const version can factor out the first +* multiply and shift. +*/ +#define HZSCALE (268435456 / (1000000 / HZ)) + +#define ndelay (n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000));#endif /* defined(_M68K_DELAY_H) */
Signature · 1 line
1.7.0.4
PATCH 13/14 m68k/atari: USB - add platform device definitions for ISP1160 HCD
In reply to Michael SchmitzAdd platform devices for use by isp116x-hcd driver for EtherNAT and NetUSBee USB functions.
Register definitions thanks to David Galvez <[email protected]>
--- arch/m68k/atari/config.c | 131 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 126 insertions(+), 5 deletions(-)
arch/m68k/atari/config.c +126 -5
@@ -32,6 +32,7 @@#include <linux/delay.h> #include <linux/ioport.h> #include <linux/platform_device.h> +#include <linux/usb/isp116x.h> #include <linux/vt_kern.h> #include <linux/module.h>
@@ -685,8 +686,70 @@ static struct platform_device smc91x_device = { .resource = smc91x_resources, }; +/* +* ISP 1160 - using the isp116x-hcd module +*/ + +#define ATARI_USB_PHYS_ADDR 0x80000012 +#define ATARI_USB_IRQ 139 + +static struct resource isp1160_resources[] = { + [0 ] = { + .name ="isp1160-data" , + .start =ATARI_USB_PHYS_ADDR , + .end =ATARI_USB_PHYS_ADDR +0x1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .name ="isp1160-regs" , + .start =ATARI_USB_PHYS_ADDR +0x4 , + .end =ATARI_USB_PHYS_ADDR +0x5 , + .flags =IORESOURCE_MEM , + }, + [2 ] = { + .name ="isp1160-irq" , + .start =ATARI_USB_IRQ , + .end =ATARI_USB_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +static void isp1160_delay (struct device *dev,int delay) +{ +ndelay (delay); +} + +/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ +static struct isp116x_platform_data isp1160_platform_data = { +/* Enable internal resistors on downstream ports */ + .sel15Kres =1 , +/* On-chip overcurrent protection */ + .oc_enable =1 , +/* INT output polarity */ + .int_act_high =1 , +/* INT edge or level triggered */ + .int_edge_triggered =0 , + +/* WAKEUP pin connected - NOT SUPPORTED */ +/* .remote_wakeup_connected = 0, */ +/* Wakeup by devices on usb bus enabled */ + .remote_wakeup_enable =0 , + .delay = isp1160_delay, +}; + +static struct platform_device isp1160_device = { + .name ="isp116x-hcd" , + .id =0 , + .num_resources =ARRAY_SIZE (isp1160_resources), + .resource = isp1160_resources, + .dev = { + .platform_data = &isp1160_platform_data, + }, +}; +static struct platform_device *atari_ethernat_devices[]__initdata = { - &smc91x_device + &smc91x_device, + &isp1160_device };#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
@@ -715,8 +778,66 @@ static struct platform_device rtl8019_device = { .resource = rtl8019_resources, }; -static struct platform_device *atari_ethernec_devices[]__initdata = { - &rtl8019_device +/* +* NetUSBee: ISP1160 USB host adapter via ROM-port adapter +*/ + +#define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000 +#define ATARI_NETUSBEE_BASE 0x340 +#define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2 + +static struct resource netusbee_resources[] = { + [0 ] = { + .name ="isp1160-data" , + .start =ATARI_NETUSBEE_BASE , + .end =ATARI_NETUSBEE_BASE +0x1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .name ="isp1160-regs" , + .start =ATARI_NETUSBEE_BASE +0x20 , + .end =ATARI_NETUSBEE_BASE +0x21 , + .flags =IORESOURCE_MEM , + }, + [2 ] = { + .name ="isp1160-irq" , + .start =ATARI_NETUSBEE_IRQ , + .end =ATARI_NETUSBEE_IRQ , + .flags =IORESOURCE_IRQ , + }, +}; + +/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ +static struct isp116x_platform_data netusbee_platform_data = { +/* Enable internal resistors on downstream ports */ + .sel15Kres =1 , +/* On-chip overcurrent protection */ + .oc_enable =1 , +/* INT output polarity */ + .int_act_high =1 , +/* INT edge or level triggered */ + .int_edge_triggered =0 , + +/* WAKEUP pin connected - NOT SUPPORTED */ +/* .remote_wakeup_connected = 0, */ +/* Wakeup by devices on usb bus enabled */ + .remote_wakeup_enable =0 , + .delay = isp1160_delay, +}; + +static struct platform_device netusbee_device = { + .name ="isp116x-hcd" , + .id =1 , + .num_resources =ARRAY_SIZE (netusbee_resources), + .resource = netusbee_resources, + .dev = { + .platform_data = &netusbee_platform_data, + }, +}; + +static struct platform_device *atari_netusbee_devices[]__initdata = { + &rtl8019_device, + &netusbee_device };int __init atari_platform_init (void )
@@ -744,8 +865,8 @@ int __init atari_platform_init(void)unsigned char *enec_virt; enec_virt = (unsigned char *)ioremap ((ATARI_ETHERNEC_PHYS_ADDR ),0xf );if (hwreg_present (enec_virt)) { - error =platform_add_devices (atari_ethernec_devices, -ARRAY_SIZE (atari_ethernec_devices)); + error =platform_add_devices (atari_netusbee_devices, +ARRAY_SIZE (atari_netusbee_devices));if (error && !rv) rv = error; }
Signature · 1 line
1.7.0.4
PATCH 14/14 m68k/atari: USB - Add ISP1160 USB host controller support
In reply to Michael SchmitzAdd Atari specific support code for isp116x-hcd driver used by EtherNAT and NetUSBee adapters. Both use a 16-bit data bus wiring that is byte-swapped in hardware. The EtherNAT adapter also has quirks relating to interrupts and needs interrupts disabled until after the chip has been reset.
Debugging of FIFO register access code and NetUSBee support by David Galvez <[email protected]> (MiNT driver author).
--- arch/m68k/Kconfig.bus | 11 ++++ drivers/usb/host/isp116x-hcd.c | 109 +++++++++++++++++++++++++++++++++++++++- drivers/usb/host/isp116x.h | 41 ++++++++++++--- 3 files changed, 150 insertions(+), 11 deletions(-)
arch/m68k/Kconfig.bus +11 -0
@@ -55,6 +55,17 @@ config ATARI_ROM_ISA The only driver currently using this adapter is the EtherNEC driver for RTL8019AS based NE2000 compatible network cards. +config ATARI_USB + bool "Atari USB host controller support" + depends on ATARI + select USB_SUPPORT + select USB_ARCH_HAS_HCD + help + This option enables support for USB host controllers contained on + the EtherNAT and NetUSBee cards for Atari. You will have to select + an appropriate HCD driver in the USB section (the ISP1160 one is + the most commonly used one). + config GENERIC_ISA_DMA def_bool ISA
drivers/usb/host/isp116x-hcd.c +107 -2
225 lines not on this page · raw message
drivers/usb/host/isp116x.h +32 -9
86 lines not on this page · raw message
Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): CAN5rfbQMfUDDu6jUJaR=u0o-_SeVGA+6FQ-SwBShtq3rN3APCQ@mail.gmail.com
Re: [PATCH 14/14] m68k/atari: USB - Add ISP1160 USB host controller support
Miro,
[resent as plain text, sorry]
Quoted 16 lines · Miro Kropáček
Hi Michael,
On Mon, 25 Mar 2013 at 11:36, Michael Schmitz <[email protected]> wrote:
Add Atari specific support code for isp116x-hcd driver used by EtherNAT
and NetUSBee adapters. Both use a 16-bit data bus wiring that is byte-swapped
in hardware. The EtherNAT adapter also has quirks relating to interrupts
and needs interrupts disabled until after the chip has been reset.Debugging of FIFO register access code and NetUSBee support by David Galvez
<[email protected]> (MiNT driver author).
Quoted 5 lines
Signed-off-by Michael Schmitz <[email protected]>Sorry to necro-bump this email thread but this specific commit is quite interesting. As far as I understand it, this patch was proposed and merged on top of Geert's m68k-queue branch. However five hours later there was another set of patches meant for upstream/debian merge: https://lore.kernel.org/linux-m68k/[email protected] (interestingly, it wasn't CC'ed to debian-m68k) where you explicitly asked (https://lore.kernel.org/linux-m68k/[email protected]) to skip https://lore.kernel.org/linux-m68k/[email protected] and https://lore.kernel.org/linux-m68k/[email protected] (this one) patches.
"I don't mind for it to live in m68k-queue for a while" ... so, 13 years later ;), what prevents merging NetUSBee support upstream?
The register access logic was far too hacky for my taste (and I'm sure, Geert's). Unless a way can be found to handle the endianness issues and required byte swapping transparently, this patch just isn't up to the expected standards.
I never tried to submit these patches to linux-usb but I had interactions with the netdev and scsi maintainers, and despite my best efforts, some patches that were a lot cleaner than this one never got accepted.
These days, my EtherNAT board is broken (PHY dead as far as I can tell, never generates an interrupt when probing for carrier), and the CT60 boots up with broken video mode, so I even if I could improve on this patch, I can't test the USB code anymore. Haven't had much time for kernel hacking either recently.
Anyone with access to the hardware and an inclination to get their hands dirty is welcome to take over these patches and have a little fun with the code review!
Cheers,
Michael
Quoted 3 lines
Signature · 2 lines
-- http://mikro.atari.org