|
From: Richard C. <Ric...@su...> - 2004-05-04 14:37:20
|
Hi Marcelo,
Also against 2.4.26:
[sh64] Decouple io_addr handling to allow building for Cayman without
supporting PCI. Tidy up naming + comments to emphasize when entities
relate to the Cayman SMSC SuperIO chip (as distinct from the SMSC LAN
controller chip.)
Please apply.
Cheers
Richard
--- sh64--to-marcelo--040504--patch-1/arch/sh64/lib/io.c 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/arch/sh64/lib/io.c 2004-05-04 14:09:00.000000000 +0100
@@ -27,17 +27,23 @@
#define dprintk(x...)
-//#define io_addr(x) (((unsigned)(x) & 0x000fffff)| PCI_ST50_IO_ADDR )
-
+static int io_addr(int x) {
+ if (x < 0x400) {
#ifdef CONFIG_SH_CAYMAN
-extern unsigned long smsc_virt;
-extern unsigned long pciio_virt;
-#define io_addr(x) ( ((x)<0x400) ? \
- (((x) << 2)|smsc_virt) : \
- ((unsigned long)(x)+pciio_virt) )
+ return (x << 2) | smsc_superio_virt;
+#else
+ panic ("Illegal access to I/O port 0x%04x\n", x);
+ return 0;
+#endif
+ } else {
+#ifdef CONFIG_PCI
+ return (x + pciio_virt);
#else
-#define io_addr(x) ((unsigned long)(x)+pciio_virt)
+ panic ("Illegal access to I/O port 0x%04x\n", x);
+ return 0;
#endif
+ }
+}
unsigned long inb(unsigned long port)
{
diff -urN -x {arch} -x ',,*' -x .arch-ids sh64--to-marcelo--040504--patch-1/arch/sh64/mach-cayman/irq.c sh64--to-marcelo--040504--patch-2/arch/sh64/mach-cayman/irq.c
--- sh64--to-marcelo--040504--patch-1/arch/sh64/mach-cayman/irq.c 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/arch/sh64/mach-cayman/irq.c 2004-05-04 14:09:00.000000000 +0100
@@ -27,9 +27,12 @@
#define EPLD_STATUS_BASE (epld_virt + 0x10)
#define EPLD_MASK_BASE (epld_virt + 0x20)
+/* Note the SMSC SuperIO chip and SMSC LAN chip interrupts are all muxed onto
+ the same SH-5 interrupt */
+
static void cayman_interrupt_smsc(int irq, void *dev_id, struct pt_regs *regs)
{
- printk(KERN_INFO "CAYMAN: spurious interrupt\n");
+ printk(KERN_INFO "CAYMAN: spurious SMSC interrupt\n");
}
static void cayman_interrupt_pci2(int irq, void *dev_id, struct pt_regs *regs)
diff -urN -x {arch} -x ',,*' -x .arch-ids sh64--to-marcelo--040504--patch-1/arch/sh64/mach-cayman/setup.c sh64--to-marcelo--040504--patch-2/arch/sh64/mach-cayman/setup.c
--- sh64--to-marcelo--040504--patch-1/arch/sh64/mach-cayman/setup.c 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/arch/sh64/mach-cayman/setup.c 2004-05-04 14:09:00.000000000 +0100
@@ -74,7 +74,7 @@
#define ITI TOP_PRIORITY /* WDT Ints */
/* Setup for the SMSC FDC37C935 */
-#define SMSC_BASE 0x04000000
+#define SMSC_SUPERIO_BASE 0x04000000
#define SMSC_CONFIG_PORT_ADDR 0x3f0
#define SMSC_INDEX_PORT_ADDR SMSC_CONFIG_PORT_ADDR
#define SMSC_DATA_PORT_ADDR 0x3f1
@@ -91,14 +91,14 @@
#define SMSC_KEYBOARD_DEVICE 7
-#define SMSC_READ_INDEXED(index) ({ \
+#define SMSC_SUPERIO_READ_INDEXED(index) ({ \
outb((index), SMSC_INDEX_PORT_ADDR); \
inb(SMSC_DATA_PORT_ADDR); })
-#define SMSC_WRITE_INDEXED(val, index) ({ \
+#define SMSC_SUPERIO_WRITE_INDEXED(val, index) ({ \
outb((index), SMSC_INDEX_PORT_ADDR); \
outb((val), SMSC_DATA_PORT_ADDR); })
-unsigned long smsc_virt;
+unsigned long smsc_superio_virt;
/*
* Platform dependent structures: maps and parms block.
@@ -145,13 +145,13 @@
RES, RES, RES, RES, RES, RES, RES, ITI, /* IRQ 56-63 */
};
-static int __init smsc_setup(void)
+static int __init smsc_superio_setup(void)
{
unsigned char devid, devrev;
- smsc_virt = onchip_remap(SMSC_BASE, 1024, "SMSC");
- if (!smsc_virt) {
- panic("Unable to remap SMSC\n");
+ smsc_superio_virt = onchip_remap(SMSC_SUPERIO_BASE, 1024, "SMSC SuperIO");
+ if (!smsc_superio_virt) {
+ panic("Unable to remap SMSC SuperIO\n");
}
/* Initially the chip is in run state */
@@ -160,20 +160,20 @@
outb(SMSC_ENTER_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
/* Read device ID info */
- devid = SMSC_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
- devrev = SMSC_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
- printk("SMSC devid %02x rev %02x\n", devid, devrev);
+ devid = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_ID_INDEX);
+ devrev = SMSC_SUPERIO_READ_INDEXED(SMSC_DEVICE_REV_INDEX);
+ printk("SMSC SuperIO devid %02x rev %02x\n", devid, devrev);
/* Select the keyboard device */
- SMSC_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
+ SMSC_SUPERIO_WRITE_INDEXED(SMSC_KEYBOARD_DEVICE, SMCS_LOGICAL_DEV_INDEX);
/* enable it */
- SMSC_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
+ SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
/* Select the interrupts */
/* On a PC keyboard is IRQ1, mouse is IRQ12 */
- SMSC_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
- SMSC_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
+ SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
+ SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
/* Exit the configuraton state */
outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
@@ -184,7 +184,7 @@
/* This is grotty, but, because kernel is always referenced on the link line
* before any devices, this is safe.
*/
-__initcall(smsc_setup);
+__initcall(smsc_superio_setup);
void __init platform_setup(void)
{
diff -urN -x {arch} -x ',,*' -x .arch-ids sh64--to-marcelo--040504--patch-1/include/asm-sh64/cayman.h sh64--to-marcelo--040504--patch-2/include/asm-sh64/cayman.h
--- sh64--to-marcelo--040504--patch-1/include/asm-sh64/cayman.h 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/include/asm-sh64/cayman.h 2004-05-04 14:09:00.000000000 +0100
@@ -13,7 +13,7 @@
*/
-/* Setup for the SMSC FDC37C935 */
+/* Setup for the SMSC FDC37C935 / LAN91C100FD */
#define SMSC_IRQ IRQ_IRL1
/* Setup for PCI Bus 2, which transmits interrupts via the EPLD */
diff -urN -x {arch} -x ',,*' -x .arch-ids sh64--to-marcelo--040504--patch-1/include/asm-sh64/io.h sh64--to-marcelo--040504--patch-2/include/asm-sh64/io.h
--- sh64--to-marcelo--040504--patch-1/include/asm-sh64/io.h 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/include/asm-sh64/io.h 2004-05-04 14:09:00.000000000 +0100
@@ -107,6 +107,13 @@
#ifdef __KERNEL__
+#ifdef CONFIG_SH_CAYMAN
+extern unsigned long smsc_superio_virt;
+#endif
+#ifdef CONFIG_PCI
+extern unsigned long pciio_virt;
+#endif
+
#define IO_SPACE_LIMIT 0xffffffff
/*
diff -urN -x {arch} -x ',,*' -x .arch-ids sh64--to-marcelo--040504--patch-1/include/asm-sh64/keyboard.h sh64--to-marcelo--040504--patch-2/include/asm-sh64/keyboard.h
--- sh64--to-marcelo--040504--patch-1/include/asm-sh64/keyboard.h 2004-04-30 12:53:29.000000000 +0100
+++ sh64--to-marcelo--040504--patch-2/include/asm-sh64/keyboard.h 2004-05-04 14:09:00.000000000 +0100
@@ -19,7 +19,7 @@
#include <asm/io.h>
#ifdef CONFIG_SH_CAYMAN
-#define KEYBOARD_IRQ (START_EXT_IRQS + 2) /* SMSC IRQ 1 */
+#define KEYBOARD_IRQ (START_EXT_IRQS + 2) /* SMSC SuperIO IRQ 1 */
#endif
#define DISABLE_KBD_DURING_INTERRUPTS 0
@@ -61,7 +61,7 @@
*/
#ifdef CONFIG_SH_CAYMAN
-#define AUX_IRQ (START_EXT_IRQS + 6) /* SMSC IRQ12 */
+#define AUX_IRQ (START_EXT_IRQS + 6) /* SMSC SuperIO IRQ12 */
#endif
#define aux_request_irq(hand, dev_id) \
--
Richard \\\ SH-4/SH-5 Core & Debug Architect
Curnow \\\ SuperH (UK) Ltd, Bristol
|