Skip to contentSkip to conversation

Atari Ethernet/USB patch series - for upstream and debian-kernel

PATCH In review Michael Schmitz 7 participants 41 messages Mar 25, 2013 – Mar 30, 2013

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover Atari Ethernet/USB patch series - for upstream and debian-kernel

Hello Geert,

This series of patches contains Atari EtherNAT and EtherNEC network support, plus USB driver support for the ISP1160 chip found on EtherNAT and NetUSBee adapters, to be applied to upstream 3.9-rc2 (_not_ m68k-queue or master).

Support stuff:
01/11 m68k/atari: ROM port ISA adapter support
02/11 m68k/irq: Add handle_polled_irq() for timer based soft interrupts 03/11 m68k/atari: use dedicated irq_chip for timer D interrupts

Ethernet:
04/11 m68k/atari: EtherNAT - platform device and IRQ support code 05/11 m68k/atari: EtherNEC - add platform device support
06/11 m68k/atari: EtherNAT - ethernet support - new driver (smc91x) 07/11 m68k/atari: EtherNEC - ethernet support - new driver (ne.c) 08/11 m68k/atari: EtherNAT - add interrupt chip definition for CPLD interrupts

USB:
09/11 m68k: Implement ndelay() based on the existing udelay() logic 10/11 m68k/atari: USB - add platform devices for EtherNAT/NetUSBee ISP1160 HCD 11/11 m68k/atari: USB - add ISP1160 USB host controller support

Again, the polled IRQ support patch is likely controversial. Ethernet patches should be fairly straightforward to merge upstream, the last patch from the USB part is of the 'Works For Me' variety and I will have to experiment a bit more to minimize changes to the core isp116x-hcd interrupt code. The 16 bit access quirks probably cannot be avoided though.

My thanks goes to David Galvez for information on the EtherNAT USB register offsets, NetUSBee 16 bit access tricks and above mentioned 16 bit access quirks. This code has only been tested on my EtherNAT, so re-testing on NetUSBee might be a good idea before we can consider kicking the USB portion upstream. It's fairly self-contained and did not have any history in m68k-queue so I don't mind for it to live in m68k-queue for a while.

This patch series should be suitable for inclusion in the debian/68k kernel packages (if policy allows). Thorsten: If you want help with that, I can try to cherry-pick into a debian-patched git branch to simplify that process.

Cheers,

Michael

#1 lore raw

PATCH 1/11 m68k/atari: ROM port ISA adapter support

From: Michael Schmitz <[email protected]>

Atari ROM port ISA adapter support for EtherNEC and NetUSBee adapters

16 bit access for ROM port adapters follows debugging and clarification by David Galvez <[email protected]>. The NetUSBee ISP1160 USB chip uses these macros.

---
 arch/m68k/Kconfig.bus          |   10 +++
 arch/m68k/include/asm/io_mm.h  |  136 ++++++++++++++++++++++++++++++++++++++--
 arch/m68k/include/asm/raw_io.h |  109 +++++++++++++++++++++++++++++++-
 arch/m68k/kernel/setup_mm.c    |    6 ++
 4 files changed, 254 insertions(+), 7 deletions(-)
arch/m68k/Kconfig.bus +10 -0
index 93ef034..675b087 100644
@@ -45,6 +45,16 @@ config ISA
 	  (MCA) or VESA.  ISA is an older system, now being displaced by PCI;
 	  newer boards don't support it.  If you have ISA, say Y, otherwise N.
 
+config ATARI_ROM_ISA
+	bool "Atari ROM port ISA adapter support"
+	depends on ATARI
+	help
+	  This option enables support for the ROM port ISA adapter used to
+	  operate ISA cards on Atari. Only 8  bit cards are supported, and
+	  no interrupt lines are connected.
+	  The only driver currently using this adapter is the EtherNEC
+	  driver for RTL8019AS based NE2000 compatible network cards.
+
 config GENERIC_ISA_DMA
 	def_bool ISA
 
arch/m68k/include/asm/io_mm.h +130 -6

214 lines not on this page · raw message

arch/m68k/include/asm/raw_io.h +108 -1

127 lines not on this page · raw message

arch/m68k/kernel/setup_mm.c +6 -0
index 80cfbe5..e67e531 100644
@@ -381,6 +381,12 @@ void __init setup_arch(char **cmdline_p)
 		isa_sex = 1;
 	}
 #endif
+#ifdef CONFIG_ATARI_ROM_ISA
+	if (MACH_IS_ATARI) {
+		isa_type = ISA_TYPE_ENEC;
+		isa_sex = 0;
+	}
+#endif
 #endif
 }
 
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/11 m68k/irq: Add handle_polled_irq() for timer based soft interrupts

In reply to Michael Schmitz

Experimental hack to avoid unhandled interrupt timer to fire on EtherNEC/NetUSBee cards that have no hardware interrupt and need to be polled from a timer interrupt.

This 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
index bc4e066..5064385 100644
@@ -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
index cbd97ce..667e4c1 100644
@@ -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
#3 lore raw

PATCH 3/11 m68k/atari: use dedicated irq_chip for timer D interrupts

In reply to Michael Schmitz

Add a special irq_chip for the Atari MFP timer D interrupt, which is used as a polling timer for EtherNEC and NetUSBee

---
 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
index 3f41092..2cf7349 100644
@@ -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
index 5fc13bd..8f71504 100644
@@ -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
#4 lore raw

PATCH 4/11 m68k/atari: EtherNAT - platform device and IRQ support code

In reply to Michael Schmitz

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.

---
 arch/m68k/atari/config.c          |   62 +++++++++++++++++++++++++++++++++++++
 arch/m68k/include/asm/atarihw.h   |    6 +++
 arch/m68k/include/asm/atariints.h |    2 +-
 arch/m68k/include/asm/irq.h       |    6 +++-
 4 files changed, 74 insertions(+), 2 deletions(-)
arch/m68k/atari/config.c +62 -0
index 037c11c..d35e89d 100644
@@ -31,6 +31,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
+#include <linux/platform_device.h>
 #include <linux/vt_kern.h>
 #include <linux/module.h>
 
@@ -655,3 +656,64 @@ static void atari_get_hardware_list(struct seq_file *m)
 	ATARIHW_ANNOUNCE(VME, "VME Bus");
 	ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
 }
+
+/*
+ * MSch: initial platform device support for Atari,
+ * required for EtherNAT/EtherNEC/NetUSBee drivers
+ */
+
+/*
+ * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver
+ */
+
+#define ATARI_ETHERNAT_IRQ		140
+
+static struct resource smc91x_resources[] = {
+	[0] = {
+		.name	= "smc91x-regs",
+		.start	= ATARI_ETHERNAT_PHYS_ADDR,
+		.end	= ATARI_ETHERNAT_PHYS_ADDR + 0xfffff,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.name	= "smc91x-irq",
+		.start	= ATARI_ETHERNAT_IRQ,
+		.end	= ATARI_ETHERNAT_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device smc91x_device = {
+	.name		= "smc91x",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(smc91x_resources),
+	.resource	= smc91x_resources,
+};
+
+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;
+
+#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/atarihw.h +6 -0
index c0cb363..d887050 100644
@@ -805,5 +805,11 @@ struct MSTE_RTC {
 
 #define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))
 
+/*
+** EtherNAT add-on card for Falcon - combined ethernet and USB adapter
+*/
+
+#define ATARI_ETHERNAT_PHYS_ADDR	0x80000000
+
 #endif /* linux/atarihw.h */
 
arch/m68k/include/asm/atariints.h +1 -1
index 8f71504..953e0ac 100644
@@ -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
index c1155f0..81ca118 100644
@@ -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
#5 lore raw

PATCH 5/11 m68k/atari: EtherNEC - add platform device support

In reply to Michael Schmitz

Add platform device for the Atari ROM port ethernet adapter, EtherNEC. This platform device will be used by the ne.c driver.

---
 arch/m68k/atari/config.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)
arch/m68k/atari/config.c +50 -0
index d35e89d..fdcd875 100644
@@ -694,6 +694,41 @@ static struct platform_device *atari_ethernat_devices[] __initdata = {
 	&smc91x_device
 };
 
+/*
+ * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset,
+ * handled by ne.c driver
+ */
+
+#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;
@@ -713,6 +748,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
#6 lore raw

PATCH 6/11 m68k/atari: EtherNAT - ethernet support - new driver (smc91x)

In reply to Michael Schmitz

Add Atari specific code to the smc91x Ethernet driver. This code is used on the EtherNAT adapter card for the Atari Falcon extension port.

Without the patch to smc91x.h, the first two bytes of every ethernet packet sent out are swapped, resulting in a wrong MAC address being read by the packet's target, and failure to establish communication.

---
 arch/m68k/Kconfig.devices          |   10 ++++++
 drivers/net/ethernet/smsc/Kconfig  |    4 +-
 drivers/net/ethernet/smsc/smc91x.h |   63 ++++++++++++++++++++++++++++++++++-
 3 files changed, 73 insertions(+), 4 deletions(-)
arch/m68k/Kconfig.devices +10 -0
index 4bc945d..d50ecbf 100644
@@ -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 +2 -2
index 5a689af..d3485cf 100644
@@ -6,7 +6,7 @@ config NET_VENDOR_SMSC
 	bool "SMC (SMSC)/Western Digital devices"
 	default y
 	depends on ARM || ISA || MAC || ARM || MIPS || M32R || SUPERH || \
-		BLACKFIN || MN10300 || COLDFIRE || PCI || PCMCIA
+		BLACKFIN || MN10300 || COLDFIRE || PCI || PCMCIA || ATARI
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y
 	  and read the Ethernet-HOWTO, available from
@@ -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
drivers/net/ethernet/smsc/smc91x.h +61 -2

90 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 7/11 m68k/atari: EtherNEC - ethernet support - new driver (ne.c)

In reply to Michael Schmitz

Support for Atari EtherNEC ROM port adapters in ne.c

---
 arch/m68k/Kconfig.devices         |   14 ++++++++++++++
 drivers/net/ethernet/8390/Kconfig |    3 ++-
 drivers/net/ethernet/8390/ne.c    |    2 ++
 3 files changed, 18 insertions(+), 1 deletions(-)
arch/m68k/Kconfig.devices +14 -0
index d50ecbf..d163991 100644
@@ -65,6 +65,20 @@ 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 network adapter for the
+	  ROM port. The driver works by polling instead of interrupts, so it
+	  is quite slow.
+
+	  This driver also suppports the ethernet part of the NetUSBee ROM
+	  port combined Ethernet/USB adapter.
+
+	  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
index a5f91e1..53abc78 100644
@@ -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
index 47618e5..49948f6 100644
@@ -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
#8 lore raw

PATCH 8/11 m68k/atari: EtherNAT - add interrupt chip definition for CPLD interrupts

In reply to Michael Schmitz

Add 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
index 2cf7349..525e641 100644
@@ -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
#9 lore raw

PATCH 9/11 m68k: Implement ndelay() based on the existing udelay() logic

In reply to Michael Schmitz

Add a ndelay macro modeled after the Coldfire udelay(). The ISP1160 driver needs a 150ns delay, so we need to have ndelay().

---
 arch/m68k/include/asm/delay.h |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
arch/m68k/include/asm/delay.h +20 -0
index 12d8fe4..8a9971d 100644
@@ -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
#10 lore raw

PATCH 10/11 m68k/atari: USB - add platform devices for EtherNAT/NetUSBee ISP1160 HCD

In reply to Michael Schmitz

Add platform devices used by the isp116x-hcd driver for EtherNAT and NetUSBee. Note that the NetUSBee also contains a RTL8019 Ethernet chip, so its platform device is used to cover the EtherNEC case, too. 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
index fdcd875..29ffc1a 100644
@@ -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>
 
@@ -690,8 +691,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
 };
 
 /*
@@ -725,8 +788,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)
@@ -754,8 +875,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
#11 lore raw

PATCH 11/11 m68k/atari: USB - add ISP1160 USB host controller support

In reply to Michael Schmitz

Add Atari specific quirks to the isp116x-hcd USB driver used for EtherNAT and NetUSBee.

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
index 675b087..efb6aab 100644
@@ -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
#12 lore raw
In reply to Michael Schmitz

Michael Schmitz dixit:

Quoted 2 lines

This patch series should be suitable for inclusion in the debian/68k kernel packages (if policy allows).

Sadly, policy allows only stuff that’s in Linus’ tree.

But once it went upstream, we can just build a bleeding edge kernel from Debian/experimental with no amount of manual fiddling required.

It just won’t go into the stable kernel. But it’s no regression, as the old driver was never in it either…

bye,
//mirabilos

Signature · 4 lines
[DJBDNS Zone] TTL 86400 – <Natureshadow> kann man da auch 1d schreiben?
<mirabilos> nö, außerdem kann ein Deutscher oder ein Japaner mit 1d
    ja erstmal nix anfangen, oder könntest du 1日 im zone file lesen?
<Natureshadow> das heißt für mich: ein Regal, das u.U. schiefstehen könnte
#13 lore raw

Thorsten,

Quoted 4 lines
Quoted 2 lines

This patch series should be suitable for inclusion in the debian/68k kernel packages (if policy allows).

Sadly, policy allows only stuff that’s in Linus’ tree.

Fair enough. The network stuff should be possible to integrate (minus the polled interrupt changes, perhaps). Should I split the timer D interrupt chip patch into two (basic setup, then change to use the polled interrupt handler), Geert?

Quoted 6 lines

But once it went upstream, we can just build a bleeding edge kernel from Debian/experimental with no amount of manual fiddling required.

It just won’t go into the stable kernel. But it’s no regression, as the old driver was never in it either…

The old driver(s) might have been in earlier Debian kernels when policy was otherwise. But I won't push for stable inclusion (upstream) without need either.

Cheers,

Michael

#14 lore raw
In reply to Thorsten Glaser
Quoted 6 lines · Thorsten Glaser

Michael Schmitz dixit:

Quoted 2 lines

This patch series should be suitable for inclusion in the debian/68k kernel packages (if policy allows).

Sadly, policy allows only stuff that’s in Linus’ tree.

Nothing says we can't put a kernel with those patches into unreleased (or what was it called again?) for the time being...

Quoted 3 lines

But once it went upstream, we can just build a bleeding edge kernel from Debian/experimental with no amount of manual fiddling required.

That also works, I suppose.

Quoted 2 lines

It just won’t go into the stable kernel. But it’s no regression, as the old driver was never in it either…

Indeed.

Signature · 3 lines
Copyshops should do vouchers. So that next time some bureaucracy
requires you to mail a form in triplicate, you can mail it just once,
add a voucher, and save on postage.
#15 lore raw

Wouter,

Quoted 3 lines
Quoted 1 line

Sadly, policy allows only stuff that’s in Linus’ tree.

Nothing says we can't put a kernel with those patches into unreleased (or what was it called again?) for the time being...

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

Quoted 4 lines
Quoted 3 lines

But once it went upstream, we can just build a bleeding edge kernel from Debian/experimental with no amount of manual fiddling required.

That also works, I suppose.

I've split the commit introducing the timer D handling to use handle_simple_irq in the first instance, and switch to handle_polled_irq in a separate commit. We can leave out that one (and the commit introducing handle_polled_irq) for upstream submission for now, and revisit the issue once we have feedback from linux-kernel and linux-netdev. I'd also leave out the USB patches for now - the changes to the ISP116x driver are far too intrusive for my taste.

Geert: only patches touching code outside arch/m68k have to go to linux-netdev?

Next on my TODO: Amiga ESP SCSI (I've let that one sit for too long)

Cheers,

Michael

#16 lore raw
Quoted 7 lines · Michael Schmitz

I've split the commit introducing the timer D handling to use handle_simple_irq in the first instance,
and switch to handle_polled_irq in a separate commit. We can leave out that one (and the commit
introducing handle_polled_irq) for upstream submission for now, and revisit the issue once we have
feedback from linux-kernel and linux-netdev. I'd also leave out the USB

Good!

Quoted 2 lines

patches for now - the changes
to the ISP116x driver are far too intrusive for my taste.

OK. Do you want me to skip these as well?

Quoted 2 lines

Geert: only patches touching code outside arch/m68k have to go to linux-netdev?

Indeed.

And the USB changes have to go to [email protected] instead ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#17 lore raw

Geert,

Quoted 3 lines

patches for now - the changes
to the ISP116x driver are far too intrusive for my taste. OK. Do you want me to skip these as well?

Only for upstream submission - I would prefer having all of them in m68k-queue (for things like building kernel packages for unreleased).

Quoted 3 lines
Quoted 2 lines

Geert: only patches touching code outside arch/m68k have to go to linux-netdev?

Indeed.

OK. Let's hope Paul has no further objections then.

Quoted 1 line

And the USB changes have to go to [email protected] instead ;-)

Of course.

Cheers,

Michael

#18 lore raw
In reply to Michael Schmitz
Quoted 2 lines · Michael Schmitz

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

I've setup that virtual machine for cross-compile. It seemed to work, but maybe needs an update in the meanwhile. I can start that VM after work when I'm back home.

Quoted 1 line

Next on my TODO: Amiga ESP SCSI (I've let that one sit for too long)

Yeah, would be great to have that driver working again... :-)

It's planned that Elgar will moved to FU Berlin somewhen in May. When we would have a working ESP driver I could setup Akire as well until then and both machines could move to Berlin. Would be a great improvement... :-)

Signature · 4 lines
Ciao...          //    Fon: 0381-2744150
.     Ingo     \X/     http://blog.windfluechter.net

gpg pubkey: http://www.juergensmann.de/ij_public_key.
#19 lore raw

Ingo,

Quoted 6 lines · Michael Schmitz
Quoted 3 lines

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

I've setup that virtual machine for cross-compile. It seemed to work, but maybe needs an update in the meanwhile. I can start that VM after work when I'm back home.

Thanks, seems back up now.

Quoted 4 lines
Quoted 2 lines

Next on my TODO: Amiga ESP SCSI (I've let that one sit for too long)

Yeah, would be great to have that driver working again... :-)

I'll do what I can.

Quoted 1 line

It's planned that Elgar will moved to FU Berlin somewhen in May. When we would have a working ESP driver I could setup Akire as well until then and both machines could move to Berlin. Would be a great improvement... :-)

Still a bit of work to do until then :-)

Cheers,

Michael

#20 lore raw
In reply to Michael Schmitz
Quoted 6 lines · Michael Schmitz

Wouter,

Quoted 3 lines
Quoted 1 line

Sadly, policy allows only stuff that???s in Linus??? tree.

Nothing says we can't put a kernel with those patches into unreleased (or what was it called again?) for the time being...

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

I have the cross-compilers from Thorsten installed and could just build a kernel for amiga from Geert's m68k repo. I trimmed down the config a bit and removed some not needed drivers. The kernel is now 3698472 bytes big. I still find that huge, but it allowed me to boot without a memfile to reduce the RAM! Alas, no SCSI support for the B2060...

The official Debian package fails to cross-compile when building the hid-microsoft module, maybe its time to disable that? Probably this is not set in the m68k config, but in the "main" debian config. I am not sure if I can override that, it may be easier to build kernels (for testing and the buildds) another way. kernel-package?

Quoted 1 line

Next on my TODO: Amiga ESP SCSI (I've let that one sit for too long)

Yes, please!

Christian

#21 lore raw

Christian,

Quoted 4 lines
Quoted 2 lines

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

I have the cross-compilers from Thorsten installed and could just build a kernel for amiga from Geert's m68k repo. I trimmed down the config a bit

Let's wait until Geert has applied my patches to m68k-queue.

Quoted 3 lines

and removed some not needed drivers. The kernel is now 3698472 bytes big. I still find that huge, but it allowed me to boot without a memfile to reduce the RAM! Alas, no SCSI support for the B2060...

Not entirely unexpected.

Quoted 4 lines

The official Debian package fails to cross-compile when building the hid-microsoft module, maybe its time to disable that? Probably this is not set in the m68k config, but in the "main" debian config. I am not sure if I can override that, it may be easier to build kernels (for testing and the

Why not? Just add another m68k patch that removes this option from the defconfig used.

Quoted 1 line

buildds) another way. kernel-package?

No idea really - how are the kernel packages built otherwise?

Quoted 2 lines
Quoted 1 line

Next on my TODO: Amiga ESP SCSI (I've let that one sit for too long)

Yes, please!

I hear you ...

Cheers,

Michael

#22 lore raw
Quoted 7 lines · Michael Schmitz

Christian,

Quoted 4 lines
Quoted 2 lines

If that's possible - does anyone have a kernel cross-compile machine set up for that purpose?IJ?

I have the cross-compilers from Thorsten installed and could just build a kernel for amiga from Geert's m68k repo. I trimmed down the config a bit

Let's wait until Geert has applied my patches to m68k-queue.

I still need to figure out again how kernel building works nowadays, so I am not in a big hurry.

Quoted 5 lines
Quoted 3 lines

and removed some not needed drivers. The kernel is now 3698472 bytes big. I still find that huge, but it allowed me to boot without a memfile to reduce the RAM! Alas, no SCSI support for the B2060...

Not entirely unexpected.

yup. CONFIG_SCSI_ZORRO7XX is enabled, will this be the new driver? The blizzard and cyberstorm options are still set in the amiga config, but the are filtered out, since the drivers are not present anymor I think.

Quoted 7 lines
Quoted 4 lines

The official Debian package fails to cross-compile when building the hid-microsoft module, maybe its time to disable that? Probably this is not set in the m68k config, but in the "main" debian config. I am not sure if I can override that, it may be easier to build kernels (for testing and the

Why not? Just add another m68k patch that removes this option from the defconfig used.

As far as I remember, the config is combined of a generic config, an m68k config, and an amiga config. Each file set only part of the total config, probably so that the kernels across all arches support more of less the same features. Thats a good idea, but I think many drivers are useless for the buildds, by removing them the kernel can fit into memory again, just barely. The HID drivers seem to be enabled in the official kernel, which runs on kullervo, I don't seem to be able to switch off just the microsoft one. Maybe by modifying the generic config, but I am afraid the magical package building breaks again, genconfig.py does not run on my testing box, not sure why. In Geert's tree, memcmp is not used in the driver, thats probably why this one builds:

@@ -47,9 +46,9 @@

                rdesc[559] = 0x45;
        }
        /* the same as above (s/usage/physical/) */

- if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
- !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
- &rdesc[94], 4)) {
+ if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
+ rdesc[95] == 0x00 && rdesc[96] == 0x29 &&

+                       rdesc[97] == 0xff) {
                rdesc[94] = 0x35;
                rdesc[96] = 0x45;
        }
Quoted 3 lines
Quoted 1 line

buildds) another way. kernel-package?

No idea really - how are the kernel packages built otherwise?

I tried: 4.5 Building a custom kernel from Debian kernel source:
http://kernel-handbook.alioth.debian.org/ch-common-tasks.html

with linux-source-3.8, which is easier to modify than the linux source package (it does not run genconfig for one). Cross-compiling is easy:
make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

but it creates the same failure due to memcmp. I wonder how the debian packages have been built, or maybe the cross-compilers are outdated on my system?

The kernel packages are built with python magic, it seems. kernel-package does not seem to be used anymore. You do not look at the kernel for four and a half years, and BOOM, suddenly everything has changed!

Christian

#23 lore raw

Christian,

Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

and removed some not needed drivers. The kernel is now 3698472 bytes big. I still find that huge, but it allowed me to boot without a memfile to reduce the RAM! Alas, no SCSI support for the B2060...

Not entirely unexpected.

yup. CONFIG_SCSI_ZORRO7XX is enabled, will this be the new driver?

No, that's a different chipset, not ESP.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The official Debian package fails to cross-compile when building the hid-microsoft module, maybe its time to disable that? Probably this is not set in the m68k config, but in the "main" debian config. I am not sure if I can override that, it may be easier to build kernels (for testing and the

Why not? Just add another m68k patch that removes this option from the defconfig used.

As far as I remember, the config is combined of a generic config, an m68k config, and an amiga config. Each file set only part of the total config,

And you can't patch the generic config? Not that I'd want to submit that as a patch against the kernel source, of course.

Quoted 3 lines

probably so that the kernels across all arches support more of less the same features. Thats a good idea, but I think many drivers are useless for the buildds, by removing them the kernel can fit into memory again, just barely.

That sort of stuff should be built as modules anyway.

Quoted 10 lines

The HID drivers seem to be enabled in the official kernel, which runs on kullervo, I don't seem to be able to switch off just the microsoft one. Maybe by modifying the generic config, but I am afraid the magical package building breaks again, genconfig.py does not run on my testing box, not sure why. In Geert's tree, memcmp is not used in the driver, thats probably why this one builds:

(quoted diff) +0 -0
@@ -47,9 +46,9 @@
                 rdesc[559] = 0x45;
         }

Review line 54

Quoted 10 lines
(quoted diff) +3 -3
         /* the same as above (s/usage/physical/) */
-       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
-                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
-                               &rdesc[94], 4)) {
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
+                       rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
+                       rdesc[97] == 0xff) {
                 rdesc[94] = 0x35;
                 rdesc[96] = 0x45;
         }

Looks like it - we'd either need memcmp, or use above patch to sanitize the HID driver.

I don't think I have seen that patch on m68k-queue though.

Quoted 5 lines
Quoted 2 lines

No idea really - how are the kernel packages built otherwise?

I tried: 4.5 Building a custom kernel from Debian kernel source:
http://kernel-handbook.alioth.debian.org/ch-common-tasks.html

Quoted 7 lines

with linux-source-3.8, which is easier to modify than the linux source package (it does not run genconfig for one). Cross-compiling is easy:
make ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

but it creates the same failure due to memcmp. I wonder how the debian packages have been built, or maybe the cross-compilers are outdated on my system?

That might be the case - I've had to patch around stuff that was suddenly expected to be provided by the compiler on occasion.

Quoted 3 lines

The kernel packages are built with python magic, it seems. kernel-package does not seem to be used anymore. You do not look at the kernel for four and a half years, and BOOM, suddenly everything has changed!

I'm amazed that I can still build Geert's tree with gcc 3.3.6 :-)

Anyway, I'll poke around a bit on IJ's virtual machine, maybe it does work there.

Cheers,

Michael

#24 lore raw
Quoted 5 lines · Michael Schmitz

Christian,

Quoted 1 line

yup. CONFIG_SCSI_ZORRO7XX is enabled, will this be the new driver?

No, that's a different chipset, not ESP.

ok

Quoted 5 lines
Quoted 2 lines

As far as I remember, the config is combined of a generic config, an m68k config, and an amiga config. Each file set only part of the total config,

And you can't patch the generic config? Not that I'd want to submit that as a patch against the kernel source, of course.

yes, probably. But it is not really defined anywhere... how does this Makefile work?
In drivers/hid/Makefile there is a line:

obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o

This depends on HID_USB, we don't have USB on Amiga so I add:
# CONFIG_USB_HID is not set
to config.amiga, but then the build fails here, just as when I edit the subarches that should be built:

debian/bin/gencontrol.py
Traceback (most recent call last):
File "debian/bin/gencontrol.py", line 427, in <module>

    Gencontrol()()
  File "debian/lib/python/debian_linux/gencontrol.py", line 91, in __call__
    self.do_main(packages, makefile)
  File "debian/lib/python/debian_linux/gencontrol.py", line 111, in do_main
    self.do_main_recurse(packages, makefile, vars, makeflags, extra)
  File "debian/lib/python/debian_linux/gencontrol.py", line 125, in do_main_recurse
    self.do_arch(packages, makefile, arch, vars.copy(), makeflags.copy(), extra)
  File "debian/lib/python/debian_linux/gencontrol.py", line 157, in do_arch
    self.do_arch_packages(packages, makefile, arch, vars, makeflags, extra)
  File "debian/bin/gencontrol.py", line 132, in do_arch_packages
    env=kw_env)

File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Maybe that is the real problem I am facing. And I always thought python produces usable error messages...

Quoted 5 lines
Quoted 3 lines

probably so that the kernels across all arches support more of less the same features. Thats a good idea, but I think many drivers are useless for the buildds, by removing them the kernel can fit into memory again, just barely.

That sort of stuff should be built as modules anyway.

Yes, it is built as a module, but the build still fails. I removed some video and network drivers, some filesystems which we do not use on the buildds, but the kernel size was just reduced by a little bit. So in the long run, maybe we do have to fix amiboot so that we can still use the full memory?

Christian

#25 lore raw
In reply to Christian T. Steigies
Quoted 21 lines · Christian T. Steigies

The HID drivers seem to be enabled in the official kernel, which runs on kullervo, I don't seem to be able to switch off just the microsoft one. Maybe by modifying the generic config, but I am afraid the magical package building breaks again, genconfig.py does not run on my testing box, not sure why. In Geert's tree, memcmp is not used in the driver, thats probably why this one builds:

(quoted diff) +3 -3
@@ -47,9 +46,9 @@
                rdesc[559] = 0x45;
        }
        /* the same as above (s/usage/physical/) */
-       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
-                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
-                               &rdesc[94], 4)) {
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
+                       rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
+                       rdesc[97] == 0xff) {
                rdesc[94] = 0x35;
                rdesc[96] = 0x45;
        }
Quoted 1 line
Quoted 1 line
Quoted 1 line

buildds) another way. kernel-package?

I reported that problem and it got fixed. Probably the fix never made it to -stable?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#26 lore raw
Quoted 22 lines · Geert Uytterhoeven
Quoted 21 lines · Christian T. Steigies

The HID drivers seem to be enabled in the official kernel, which runs on kullervo, I don't seem to be able to switch off just the microsoft one. Maybe by modifying the generic config, but I am afraid the magical package building breaks again, genconfig.py does not run on my testing box, not sure why. In Geert's tree, memcmp is not used in the driver, thats probably why this one builds:

(quoted diff) +3 -3
@@ -47,9 +46,9 @@
                rdesc[559] = 0x45;
        }
        /* the same as above (s/usage/physical/) */
-       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
-                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
-                               &rdesc[94], 4)) {
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
+                       rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
+                       rdesc[97] == 0xff) {
                rdesc[94] = 0x35;
                rdesc[96] = 0x45;
        }
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

buildds) another way. kernel-package?

I reported that problem and it got fixed. Probably the fix never made it to -stable?

Yes, I was not precise. The orig is what hid-microsoft looks like in Debian's linux-source-3.8. The patched one is from Geert's tree, so it is fixed in linux-m68k. Maybe I am missing something, but I don't see anything in the patches at first glance, only this, which makes me shiver:

+ ret = hid_add_device(hid_dev);
+ if (ret)
+ goto probe_err1;

Reminds me of fortran, are gotos legal in kernel source?

In any case, I can build from Geert's try, but no debian packages (yet). I should try in an unstable chroot, or a real m68k box.

Christian

#27 lore raw
Quoted 23 lines · Christian T. Steigies
Quoted 22 lines · Geert Uytterhoeven
Quoted 21 lines · Christian T. Steigies

The HID drivers seem to be enabled in the official kernel, which runs on kullervo, I don't seem to be able to switch off just the microsoft one. Maybe by modifying the generic config, but I am afraid the magical package building breaks again, genconfig.py does not run on my testing box, not sure why. In Geert's tree, memcmp is not used in the driver, thats probably why this one builds:

(quoted diff) +3 -3
@@ -47,9 +46,9 @@
                rdesc[559] = 0x45;
        }
        /* the same as above (s/usage/physical/) */
-       if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
-                       !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
-                               &rdesc[94], 4)) {
+       if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
+                       rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
+                       rdesc[97] == 0xff) {
                rdesc[94] = 0x35;
                rdesc[96] = 0x45;
        }
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

buildds) another way. kernel-package?

I reported that problem and it got fixed. Probably the fix never made it to -stable?

commit 6b90466cfec2a2fe027187d675d8d14217c12d82

Author: Jiri Slaby <[email protected]>
Date:   Mon Nov 12 10:16:09 2012 +0100

HID: microsoft: do not use compound literal - fix build

Quoted 3 lines

Yes, I was not precise. The orig is what hid-microsoft looks like in Debian's linux-source-3.8. The patched one is from Geert's tree, so it is fixed in linux-m68k. Maybe I am missing something, but I don't see anything

The fix is present in upstream

$ git tag --contains 6b90466cfec2a2fe027187d675d8d14217c12d82
linux-3.7
linux-3.7-rc6
linux-3.7-rc7
linux-3.7-rc8
linux-3.7.1
linux-3.7.10
linux-3.7.2
linux-3.7.3
linux-3.7.4
linux-3.7.5
linux-3.7.6
linux-3.7.7
linux-3.7.8
linux-3.7.9
linux-3.8
linux-3.8-rc1
linux-3.8-rc2
linux-3.8-rc3
linux-3.8-rc4
linux-3.8-rc5
linux-3.8-rc6
linux-3.8-rc7
linux-3.8.1
linux-3.8.2
linux-3.8.3
linux-3.9-rc1
linux-3.9-rc2
linux-3.9-rc3
linux-3.9-rc4

How come it's broken in Debian's 3.8?

Quoted 7 lines

in the patches at first glance, only this, which makes me shiver:

(quoted diff) +3 -0
+       ret = hid_add_device(hid_dev);
+       if (ret)
+               goto probe_err1;

Reminds me of fortran, are gotos legal in kernel source?

Nope, that's fine.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#28 lore raw

Christian,

Quoted 8 lines
Quoted 7 lines

in the patches at first glance, only this, which makes me shiver:

(quoted diff) +3 -0
+       ret = hid_add_device(hid_dev);
+       if (ret)
+               goto probe_err1;

Reminds me of fortran, are gotos legal in kernel source?

Nope, that's fine.

Explicitly allowed (and preferred) for that purpose (and a few select other uses). Nesting of if () else () branches for error unwinding would otherwise look silly.

There's still some Real Programmers (Tm) out there :-)

Cheers,

Michael

#29 lore raw
Quoted 6 lines · Michael Schmitz

Explicitly allowed (and preferred) for that purpose (and a few select other uses).
Nesting of if () else () branches for error unwinding would otherwise look silly.

There's still some Real Programmers (Tm) out there :-)

I think that goto could be easily avoided... but I am not a Real Programmer and this is getting off-topic.

I managed to build an amiga kernel from linux-source-3.8 (in experimental) with this command:

make KBUILD_DEBARCH=m68k ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

after applying a little patch:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=704223

The vmlinuz file is neither stripped nor compressed, but after stripping it, it boots on the Amiga without a memfile (I removed unneeded video and network drivers and some other things).

I think the first part is needed for building deb packages on m68k:

scripts/package/builddeb +1 -1
index acb8650..73b6088 100644
@@ -28,7 +28,7 @@ create_package() {
        # Attempt to find the correct Debian architecture
        local forcearch="" debarch=""
        case "$UTS_MACHINE" in
-       i386|ia64|alpha)
+       i386|ia64|alpha|m68k)
                debarch="$UTS_MACHINE" ;;
        x86_64)
                debarch=amd64 ;;

The second part seems is needed for cross-compiling, this one works:
https://patchwork.kernel.org/patch/752622/

With this is should be easy to (cross-) build kernel-images for m68k with additional patches and minimized config, since this does not use Debian's gencontrol.py. Maybe I will try to understand that later.

Christian

#30 lore raw

Christian T. Steigies dixit:

Quoted 5 lines · Michael Schmitz
Quoted 4 lines

Explicitly allowed (and preferred) for that purpose (and a few select other uses).
Nesting of if () else () branches for error unwinding would otherwise look silly.

Aye.

Quoted 1 line
Quoted 1 line

There's still some Real Programmers (Tm) out there :-)

Right ;-)

Quoted 1 line

I think that goto could be easily avoided... but I am not a Real Programmer

Avoiding gotos for the purpose of avoiding gotos is absolutely silly (as the compiler translates them to jumps, which are the same in asm) and positively harmful (for the legibility of the code; I wish I had goto in mksh…).

Quoted 4 lines

I managed to build an amiga kernel from linux-source-3.8 (in experimental) with this command:

make KBUILD_DEBARCH=m68k ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

You can just run dpkg-buildpackage -am68k…

Quoted 3 lines

With this is should be easy to (cross-) build kernel-images for m68k with additional patches and minimized config, since this does not use Debian's gencontrol.py. Maybe I will try to understand that later.

I don’t think that’s a good thing. And patches can be added to the normal process with not too much difficulty… but YMMV, and it’s up to the person doing the work.

IMHO we should try to get to as close to the normal Debian processes as possible though. I’d wager a guess and say that, if you ask, for example, waldi or bwh in IRC, they’d be happy to help (as opposed to see you doing some nōn-standard stuff).

bye,
//mirabilos

Signature · 4 lines
[DJBDNS Zone] TTL 86400 – <Natureshadow> kann man da auch 1d schreiben?
<mirabilos> nö, außerdem kann ein Deutscher oder ein Japaner mit 1d
    ja erstmal nix anfangen, oder könntest du 1日 im zone file lesen?
<Natureshadow> das heißt für mich: ein Regal, das u.U. schiefstehen könnte
#31 lore raw
Quoted 7 lines · Thorsten Glaser

Avoiding gotos for the purpose of avoiding gotos is absolutely silly (as the compiler translates them to jumps, which are the same in asm) and positively harmful (for the legibility of the code; I wish I had goto in mksh???).

From my Commodore Basic days I still know gotos and spaghetti. I know it

will be translated to jumps, but I thought we are programming in C and not asm, because the readability is better. But maybe I just read too much about python recently ;-)

Quoted 6 lines
Quoted 4 lines

I managed to build an amiga kernel from linux-source-3.8 (in experimental) with this command:

make KBUILD_DEBARCH=m68k ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

You can just run dpkg-buildpackage -am68k???

Because linux-source, just like linux-m68k git, does not contain a debian directory. The linux source package (note the missing dash) does contain a debian directory, but that fails because gencontrol.py does not run on my box (OSError: missing file or directory with no hint what file is missing).

Quoted 7 lines
Quoted 3 lines

With this is should be easy to (cross-) build kernel-images for m68k with additional patches and minimized config, since this does not use Debian's gencontrol.py. Maybe I will try to understand that later.

I don???t think that???s a good thing. And patches can be added to the normal process with not too much difficulty??? but YMMV, and it???s up to the person doing the work.

You are right, that this is not the way to build official debian kernels, but as far as I understand it is the correct way to build local kernels from linux-source. This has the nice benefit, that it works identically with the linux-m68k source, and it does not run gencontrol.py.

Quoted 4 lines

IMHO we should try to get to as close to the normal Debian processes as possible though. I???d wager a guess and say that, if you ask, for example, waldi or bwh in IRC, they???d be happy to help (as opposed to see you doing some n??n-standard stuff).

The kernels I am building are not for official use, only for testing of new patches. In the long run I want to understand how the offical Debian images are built again, but unfortunately my vacation comes to an end and the new semester is starting... it will be at least a month before I will have time to study the Debian processes again. I may try to get crest running again with the IDE disk before that.

Christian

#32 lore raw

Christian,

thanks for this - I'm sure it will come handy for building test kernel packages.

Generic questions first - what is the best strategy to make Zorro boards work with platform device utilizing drivers? Should I go and add code to amiga/platform.c to enumerate all Zorro devices and add platform devices for those, or revert to looking up Zorro device data in the SCSI driver probe function? Geert?

I've seen the following output on elgar:

schmitz@elgar:~$ cat /proc/bus/zorro/devices
00    21400c00    00e90000    00010000    d1
01    0877c900    00ea0000    00010000    c1

The 21400c00 is product code I presume - what's the d1? Which of the two is the SCSI board?

Quoted 9 lines
Quoted 5 lines
Quoted 4 lines

I managed to build an amiga kernel from linux-source-3.8 (in experimental) with this command:

make KBUILD_DEBARCH=m68k ARCH=m68k CROSS_COMPILE=m68k-linux-gnu- deb-pkg

You can just run dpkg-buildpackage -am68k???

Because linux-source, just like linux-m68k git, does not contain a debian directory. The linux source package (note the missing dash) does contain a debian directory, but that fails because gencontrol.py does not run on my box (OSError: missing file or directory with no hint what file is missing).

While you can catch errors of that sort in python, it's still left to the programmer to provide a meaningful error message. Shame on python's subprocess.py for not printing the missing path on failed exec.

File "debian/bin/gencontrol.py", line 132, in do_arch_packages

    env=kw_env)

seems to be where subprocess.py is invoked - I'd add a trace print there.

Quoted 10 lines
Quoted 4 lines

IMHO we should try to get to as close to the normal Debian processes as possible though. I???d wager a guess and say that, if you ask, for example, waldi or bwh in IRC, they???d be happy to help (as opposed to see you doing some n??n-standard stuff).

The kernels I am building are not for official use, only for testing of new patches. In the long run I want to understand how the offical Debian images are built again, but unfortunately my vacation comes to an end and the new semester is starting... it will be at least a month before I will have time to study the Debian processes again. I may try to get crest running again with the IDE disk before that.

If you do - what SCSI board does crest use? Can you test kernels or possibly just modules there for me?

Cheers,

Michael

#33 lore raw
Quoted 7 lines · Michael Schmitz

Generic questions first - what is the best strategy to make Zorro boards work with platform device utilizing drivers? Should I go and add code to amiga/platform.c to enumerate all Zorro devices and add platform devices for those,
or revert to looking up Zorro device data in the SCSI driver probe function? Geert?
I've seen the following output on elgar:

Quoted 5 lines
schmitz@elgar:~$ cat /proc/bus/zorro/devices
00    21400c00    00e90000    00010000    d1
01    0877c900    00ea0000    00010000    c1
The 21400c00 is product code I presume - what's the d1?  Which of the
two is the SCSI board?

That's easy to answer:

elgar:~# lszorro -vv
00: Phase 5 Blizzard 1220/CyberStorm [Accelerator and SCSI Host Adapter]
        Type: Zorro II
        Address: 00e90000 (00010000 bytes)
        Serial number: 00000000
        Slot address: 00e9
        Slot size: 0001

01: Village Tronic Ariadne [Ethernet Card and Parallel Ports]

        Type: Zorro II
        Address: 00ea0000 (00010000 bytes)
        Serial number: 01001091
        Slot address: 00ea
        Slot size: 0001

;-)

Quoted 8 lines
Quoted 6 lines

The kernels I am building are not for official use, only for testing of new patches. In the long run I want to understand how the offical Debian images are built again, but unfortunately my vacation comes to an end and the new semester is starting... it will be at least a month before I will have time to study the Debian processes again. I may try to get crest running again with the IDE disk before that.

If you do - what SCSI board does crest use? Can you test kernels or possibly just modules there for me?

Crest is using the same card as Elgar, IIRC: Cyberstorm Mk1 Christian, please correct me if I'm wrong.

Signature · 4 lines
Ciao...          //    Fon: 0381-2744150
.     Ingo     \X/     http://blog.windfluechter.net

gpg pubkey: http://www.juergensmann.de/ij_public_key.
#34 lore raw

Am 30.03.2013 um 01:00 schrieb Ingo Jürgensmann <[email protected]>:

Quoted 4 lines
Quoted 2 lines

If you do - what SCSI board does crest use? Can you test kernels or possibly just modules there for me?

Crest is using the same card as Elgar, IIRC: Cyberstorm Mk1 Christian, please correct me if I'm wrong.

To correct myself after looking into an old mail from 2004: It's an Cyberstorm MkII in Crest.

Signature · 5 lines
Ciao...            //      Fon: 0381-2744150
      Ingo       \X/       http://blog.windfluechter.net


gpg pubkey:  http://www.juergensmann.de/ij_public_key.asc
#35 lore raw
In reply to Ingo Jürgensmann

Ingo,

Quoted 15 lines
Quoted 7 lines

Generic questions first - what is the best strategy to make Zorro boards work with platform device utilizing drivers? Should I go and add code to amiga/platform.c to enumerate all Zorro devices and add platform devices for those,
or revert to looking up Zorro device data in the SCSI driver probe function? Geert?
I've seen the following output on elgar:

Quoted 5 lines
schmitz@elgar:~$ cat /proc/bus/zorro/devices
00    21400c00    00e90000    00010000    d1
01    0877c900    00ea0000    00010000    c1
The 21400c00 is product code I presume - what's the d1?  Which of the
two is the SCSI board?

That's easy to answer:

Quoted 8 lines
elgar:~# lszorro -vv
00: Phase 5 Blizzard 1220/CyberStorm [Accelerator and SCSI Host Adapter]
        Type: Zorro II
        Address: 00e90000 (00010000 bytes)
        Serial number: 00000000
        Slot address: 00e9
        Slot size: 0001

Thanks - I forgot about lszorro :-)

Slot address is just the top two bytes of the base address - the d1 and c1 part of the proc output is meaningless?

Quoted 6 lines
Quoted 2 lines

If you do - what SCSI board does crest use? Can you test kernels or possibly just modules there for me?

Crest is using the same card as Elgar, IIRC: Cyberstorm Mk1 Christian, please correct me if I'm wrong.

So we have cyberstorm, cyberstormII and blz2060 drivers to port? What is the difference between the cyberstorm ones? DMA setup looks fairly similar to me (blz2060 is a bit different there). Looks to me as though we should be able to get away with a single ESP front end driver, perhaps set the DMA functions different based on the model?

Cheers,

Michael

#36 lore raw
Quoted 2 lines · Michael Schmitz

So we have cyberstorm, cyberstormII and blz2060 drivers to port? What is the difference between the cyberstorm ones?

There are some good sites for Amiga related hardware, sometimes even with high quality photos of the hardware, driver & software download, etc:

http://amiga.resource.cx/
http://www.bigbookofamigahardware.com/Default.aspx

Cyberstorm Mk1: CSI ID 7 Clk 40MHz CCF=8 TOut 167 NCR53C9XF(espfast)
http://amiga.resource.cx/photos/photos/cyberstorm-scsi.jpg

Cyberstorm Mk2:
http://amiga.resource.cx/exp/cyberstorm2
http://amiga.resource.cx/photos/photos/cyberstorm2-scsi.jpg

And there's even a Cyberstorm Mk3: Ultra Wide SCSI controller, NCR 53C770
http://amiga.resource.cx/exp/cyberstorm3

... and some more.

I think the main difference between CS Mk1 and Mk2 is evolution in design and a higher integration. You'll see that the Mk2 is much smaller in size than the Mk1.

Quoted 4 lines

DMA setup looks fairly similar to me (blz2060 is a bit different there). Looks to me as though we should be able to get away with a single ESP front end driver, perhaps set the DMA functions different based on the model?

Yes, I think there was just only one ESP driver in the past as well. So the best would be to look at the old implementation of DMA, I think...

Signature · 4 lines
Ciao...          //    Fon: 0381-2744150
.     Ingo     \X/     http://blog.windfluechter.net

gpg pubkey: http://www.juergensmann.de/ij_public_key.
#37 lore raw
In reply to Michael Schmitz
Quoted 6 lines · Michael Schmitz

Generic questions first - what is the best strategy to make Zorro boards work with platform device utilizing drivers?
Should I go and add code to amiga/platform.c to enumerate all Zorro devices and add platform devices for those,
or revert to looking up Zorro device data in the SCSI driver probe function? Geert?

Not platform devices, but zorro devices.
zorro_register_driver()

Cfr. a2091/gvp11/zorro7xx under drivers/scsi/
ariadne/a2065/hydra/zorro8390 under drivers/net/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#38 lore raw
In reply to Christian T. Steigies
Quoted 11 lines · Christian T. Steigies
Quoted 5 lines · Thorsten Glaser

Avoiding gotos for the purpose of avoiding gotos is absolutely silly (as the compiler translates them to jumps, which are the same in asm) and positively harmful (for the legibility of the code; I wish I had goto in mksh???).

From my Commodore Basic days I still know gotos and spaghetti. I know it will be translated to jumps, but I thought we are programming in C and not asm, because the readability is better. But maybe I just read too much about python recently ;-)

Goto in BASIC is not the same thing as goto in C. In BASIC, a goto statement can go all over the place. You see a goto, you don't know where you'll end up. Yes, that is spaghetti code.

In C, a goto can only jump within the same function. It's possible to overuse it, but error unwinding is one of the few cases where it's sensible and good to use it. Consider:

int handle = initialize_handle();

if(connect_handle(handle)!=CONNECTION_OK) {
	unintialize_handle(handle);
	return ECONNFAILED;
}
if(send_greeting(handle)!=GREETING_OK) {
	uninitialize_handle(handle);
	return EGREETFAILED;
}

return HANDLE_OK;

This code works, and it's fairly clear what it does; but the problem here is that you replicate deinitialization code. If that deinitialization code ever needs to change, you have to change it in multiple places. You might miss one, causing you a leak of sorts. It's of course possible to nest the ifs, but that's even worse:

int handle = initialize_handle();
int retval = HANDLE_OK;

if(connect_handle(handle) != CONNECTION_OK) {
	retval = ECONNFAILED;
} else {
	if(send_greeting(handle) != GREETING_OK) {
		retval = EGREETFAILED;
	}
}

uninitialize_handle(handle);
return retval;

it's easy to see that this kind of code will become unreadable once you're past three or four of these checks. However, the compiled code will be *exactly* the same as the following:

int handle = initialize_handle();
int retval = HANDLE_OK;

if(connect_handle(handle) != CONNECTION_OK) {
	retval = ECONNFAILED;
	goto err_out;
}
if(send_greeting(handle) != GREETING_OK) {
	retval = EGREETFAILED;
	goto err_out;
}

err_out:
uninitialize_handle(handle);
return retval;

This is again as readable as the first example, but the deinitialization is grouped at the bottom of the function.

Signature · 3 lines
Copyshops should do vouchers. So that next time some bureaucracy
requires you to mail a form in triplicate, you can mail it just once,
add a voucher, and save on postage.
#39 lore raw

Wouter,

Quoted 64 lines · Wouter Verhelst
Quoted 11 lines · Christian T. Steigies
Quoted 5 lines · Thorsten Glaser

Avoiding gotos for the purpose of avoiding gotos is absolutely silly (as the compiler translates them to jumps, which are the same in asm) and positively harmful (for the legibility of the code; I wish I had goto in mksh???).

From my Commodore Basic days I still know gotos and spaghetti. I know it will be translated to jumps, but I thought we are programming in C and not asm, because the readability is better. But maybe I just read too much about python recently ;-)

Goto in BASIC is not the same thing as goto in C. In BASIC, a goto statement can go all over the place. You see a goto, you don't know where you'll end up. Yes, that is spaghetti code.

In C, a goto can only jump within the same function. It's possible to overuse it, but error unwinding is one of the few cases where it's sensible and good to use it. Consider:

int handle = initialize_handle();

if(connect_handle(handle)!=CONNECTION_OK) {
	unintialize_handle(handle);
	return ECONNFAILED;
}
if(send_greeting(handle)!=GREETING_OK) {
	uninitialize_handle(handle);
	return EGREETFAILED;
}

return HANDLE_OK;

This code works, and it's fairly clear what it does; but the problem here is that you replicate deinitialization code. If that deinitialization code ever needs to change, you have to change it in multiple places. You might miss one, causing you a leak of sorts. It's of course possible to nest the ifs, but that's even worse:

int handle = initialize_handle();
int retval = HANDLE_OK;

if(connect_handle(handle) != CONNECTION_OK) {
	retval = ECONNFAILED;
} else {
	if(send_greeting(handle) != GREETING_OK) {
		retval = EGREETFAILED;
	}
}

uninitialize_handle(handle);
return retval;

it's easy to see that this kind of code will become unreadable once you're past three or four of these checks. However, the compiled code will be *exactly* the same as the following:

int handle = initialize_handle();
int retval = HANDLE_OK;

if(connect_handle(handle) != CONNECTION_OK) {
	retval = ECONNFAILED;
	goto err_out;
}
if(send_greeting(handle) != GREETING_OK) {
	retval = EGREETFAILED;
	goto err_out;
}
Quoted 6 lines

err_out:
uninitialize_handle(handle);
return retval;

This is again as readable as the first example, but the deinitialization is grouped at the bottom of the function.

Thanks for the detailed example, do you want to teach me to be a kernel hacker? :-)

I don't know too much C, but I have the feeling that in your last example uninitialize_handle is called in any case, or are commands after the goto lable skipped if you do not jump to them? If that is the case, I do not find this more readable. I think the last lines of your example have to look like this:

goto no_err;
err_out:
uninitialize_handle(handle);
no_err:
return retval;

And that in my exes is spaghetti... but I understand the rest of your reasoning.

bon appetit!
Christian

#40 lore raw
In reply to Christian T. Steigies
Quoted 1 line · Christian T. Steigies

but I thought we are programming in C and not asm,

C is just portable assembler. :-)

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."