diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-02-27 07:52:05 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-02-27 07:52:05 -0500 |
commit | afde9626089e3d0c32090120960d1e32f65e3be4 (patch) | |
tree | d986b671aee7ee9fd984b373223a5aad31aa4a53 | |
parent | 2daa79ec2126f8e710391e9d8e8f0d31d7c91d5f (diff) | |
parent | 64a38516ff50c3f6c1ef563c2f410db3239d9302 (diff) |
Merge branch 'features/cs89x0' of git://git.pengutronix.de/git/imx/linux-2.6 into next/drivers
* 'features/cs89x0' of git://git.pengutronix.de/git/imx/linux-2.6:
CS89x0 : add CS89x0 platform device to the iMX31ADS board
CS89x0 : remove QQ2440 board support from the CS89x0 driver
CS89x0 : add CS89x0 platform device to the iMX21ADS board
CS89x0 : add platform driver support
-rw-r--r-- | arch/arm/configs/imx_v4_v5_defconfig | 2 | ||||
-rw-r--r-- | arch/arm/configs/imx_v6_v7_defconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-mx21ads.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-mx31ads.c | 35 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/board-mx31ads.h | 33 | ||||
-rw-r--r-- | drivers/net/Space.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/cirrus/Kconfig | 19 | ||||
-rw-r--r-- | drivers/net/ethernet/cirrus/cs89x0.c | 148 |
8 files changed, 186 insertions, 73 deletions
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index a22e93079063..b5f08e9813b3 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -78,6 +78,8 @@ CONFIG_MISC_DEVICES=y | |||
78 | CONFIG_EEPROM_AT24=y | 78 | CONFIG_EEPROM_AT24=y |
79 | CONFIG_EEPROM_AT25=y | 79 | CONFIG_EEPROM_AT25=y |
80 | CONFIG_NETDEVICES=y | 80 | CONFIG_NETDEVICES=y |
81 | CONFIG_CS89x0=y | ||
82 | CONFIG_CS89x0_PLATFORM=y | ||
81 | CONFIG_DM9000=y | 83 | CONFIG_DM9000=y |
82 | CONFIG_SMC91X=y | 84 | CONFIG_SMC91X=y |
83 | CONFIG_SMC911X=y | 85 | CONFIG_SMC911X=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 3a4fb2e5fc68..c032fe8d3e0b 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -26,7 +26,6 @@ CONFIG_MACH_ARMADILLO5X0=y | |||
26 | CONFIG_MACH_KZM_ARM11_01=y | 26 | CONFIG_MACH_KZM_ARM11_01=y |
27 | CONFIG_MACH_PCM043=y | 27 | CONFIG_MACH_PCM043=y |
28 | CONFIG_MACH_MX35_3DS=y | 28 | CONFIG_MACH_MX35_3DS=y |
29 | CONFIG_MACH_EUKREA_CPUIMX35=y | ||
30 | CONFIG_MACH_VPR200=y | 29 | CONFIG_MACH_VPR200=y |
31 | CONFIG_MACH_IMX51_DT=y | 30 | CONFIG_MACH_IMX51_DT=y |
32 | CONFIG_MACH_MX51_3DS=y | 31 | CONFIG_MACH_MX51_3DS=y |
@@ -82,8 +81,9 @@ CONFIG_PATA_IMX=y | |||
82 | CONFIG_NETDEVICES=y | 81 | CONFIG_NETDEVICES=y |
83 | # CONFIG_NET_VENDOR_BROADCOM is not set | 82 | # CONFIG_NET_VENDOR_BROADCOM is not set |
84 | # CONFIG_NET_VENDOR_CHELSIO is not set | 83 | # CONFIG_NET_VENDOR_CHELSIO is not set |
84 | CONFIG_CS89x0=y | ||
85 | CONFIG_CS89x0_PLATFORM=y | ||
85 | # CONFIG_NET_VENDOR_FARADAY is not set | 86 | # CONFIG_NET_VENDOR_FARADAY is not set |
86 | CONFIG_FEC=y | ||
87 | # CONFIG_NET_VENDOR_INTEL is not set | 87 | # CONFIG_NET_VENDOR_INTEL is not set |
88 | # CONFIG_NET_VENDOR_MARVELL is not set | 88 | # CONFIG_NET_VENDOR_MARVELL is not set |
89 | # CONFIG_NET_VENDOR_MICREL is not set | 89 | # CONFIG_NET_VENDOR_MICREL is not set |
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c index 8d9f95514b1f..e432d4acee1f 100644 --- a/arch/arm/mach-imx/mach-mx21ads.c +++ b/arch/arm/mach-imx/mach-mx21ads.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ | 37 | #define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \ |
38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) | 38 | (MX21ADS_MMIO_BASE_ADDR + (offset)) |
39 | 39 | ||
40 | #define MX21ADS_CS8900A_MMIO_SIZE 0x200000 | ||
40 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) | 41 | #define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11) |
41 | #define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000) | ||
42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) | 42 | #define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000) |
43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) | 43 | #define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000) |
44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) | 44 | #define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000) |
@@ -159,6 +159,18 @@ static struct platform_device mx21ads_nor_mtd_device = { | |||
159 | .resource = &mx21ads_flash_resource, | 159 | .resource = &mx21ads_flash_resource, |
160 | }; | 160 | }; |
161 | 161 | ||
162 | static const struct resource mx21ads_cs8900_resources[] __initconst = { | ||
163 | DEFINE_RES_MEM(MX21_CS1_BASE_ADDR, MX21ADS_CS8900A_MMIO_SIZE), | ||
164 | DEFINE_RES_IRQ(MX21ADS_CS8900A_IRQ), | ||
165 | }; | ||
166 | |||
167 | static const struct platform_device_info mx21ads_cs8900_devinfo __initconst = { | ||
168 | .name = "cs89x0", | ||
169 | .id = 0, | ||
170 | .res = mx21ads_cs8900_resources, | ||
171 | .num_res = ARRAY_SIZE(mx21ads_cs8900_resources), | ||
172 | }; | ||
173 | |||
162 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { | 174 | static const struct imxuart_platform_data uart_pdata_rts __initconst = { |
163 | .flags = IMXUART_HAVE_RTSCTS, | 175 | .flags = IMXUART_HAVE_RTSCTS, |
164 | }; | 176 | }; |
@@ -292,6 +304,8 @@ static void __init mx21ads_board_init(void) | |||
292 | imx21_add_mxc_nand(&mx21ads_nand_board_info); | 304 | imx21_add_mxc_nand(&mx21ads_nand_board_info); |
293 | 305 | ||
294 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 306 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
307 | platform_device_register_full( | ||
308 | (struct platform_device_info *)&mx21ads_cs8900_devinfo); | ||
295 | } | 309 | } |
296 | 310 | ||
297 | static void __init mx21ads_timer_init(void) | 311 | static void __init mx21ads_timer_init(void) |
diff --git a/arch/arm/mach-imx/mach-mx31ads.c b/arch/arm/mach-imx/mach-mx31ads.c index 4917aab0e253..4518e5448227 100644 --- a/arch/arm/mach-imx/mach-mx31ads.c +++ b/arch/arm/mach-imx/mach-mx31ads.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/memory.h> | 28 | #include <asm/memory.h> |
29 | #include <asm/mach/map.h> | 29 | #include <asm/mach/map.h> |
30 | #include <mach/common.h> | 30 | #include <mach/common.h> |
31 | #include <mach/board-mx31ads.h> | ||
32 | #include <mach/iomux-mx3.h> | 31 | #include <mach/iomux-mx3.h> |
33 | 32 | ||
34 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 | 33 | #ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 |
@@ -39,6 +38,9 @@ | |||
39 | 38 | ||
40 | #include "devices-imx31.h" | 39 | #include "devices-imx31.h" |
41 | 40 | ||
41 | /* Base address of PBC controller */ | ||
42 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
43 | |||
42 | /* PBC Board interrupt status register */ | 44 | /* PBC Board interrupt status register */ |
43 | #define PBC_INTSTATUS 0x000016 | 45 | #define PBC_INTSTATUS 0x000016 |
44 | 46 | ||
@@ -62,6 +64,7 @@ | |||
62 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) | 64 | #define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) |
63 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) | 65 | #define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) |
64 | 66 | ||
67 | #define MXC_EXP_IO_BASE MXC_BOARD_IRQ_START | ||
65 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) | 68 | #define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) |
66 | 69 | ||
67 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) | 70 | #define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10) |
@@ -69,6 +72,10 @@ | |||
69 | 72 | ||
70 | #define MXC_MAX_EXP_IO_LINES 16 | 73 | #define MXC_MAX_EXP_IO_LINES 16 |
71 | 74 | ||
75 | /* CS8900 */ | ||
76 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
77 | #define CS4_CS8900_MMIO_START 0x20000 | ||
78 | |||
72 | /* | 79 | /* |
73 | * The serial port definition structure. | 80 | * The serial port definition structure. |
74 | */ | 81 | */ |
@@ -101,11 +108,29 @@ static struct platform_device serial_device = { | |||
101 | }, | 108 | }, |
102 | }; | 109 | }; |
103 | 110 | ||
111 | static const struct resource mx31ads_cs8900_resources[] __initconst = { | ||
112 | DEFINE_RES_MEM(MX31_CS4_BASE_ADDR + CS4_CS8900_MMIO_START, SZ_64K), | ||
113 | DEFINE_RES_IRQ(EXPIO_INT_ENET_INT), | ||
114 | }; | ||
115 | |||
116 | static const struct platform_device_info mx31ads_cs8900_devinfo __initconst = { | ||
117 | .name = "cs89x0", | ||
118 | .id = 0, | ||
119 | .res = mx31ads_cs8900_resources, | ||
120 | .num_res = ARRAY_SIZE(mx31ads_cs8900_resources), | ||
121 | }; | ||
122 | |||
104 | static int __init mxc_init_extuart(void) | 123 | static int __init mxc_init_extuart(void) |
105 | { | 124 | { |
106 | return platform_device_register(&serial_device); | 125 | return platform_device_register(&serial_device); |
107 | } | 126 | } |
108 | 127 | ||
128 | static void __init mxc_init_ext_ethernet(void) | ||
129 | { | ||
130 | platform_device_register_full( | ||
131 | (struct platform_device_info *)&mx31ads_cs8900_devinfo); | ||
132 | } | ||
133 | |||
109 | static const struct imxuart_platform_data uart_pdata __initconst = { | 134 | static const struct imxuart_platform_data uart_pdata __initconst = { |
110 | .flags = IMXUART_HAVE_RTSCTS, | 135 | .flags = IMXUART_HAVE_RTSCTS, |
111 | }; | 136 | }; |
@@ -492,12 +517,15 @@ static void __init mxc_init_audio(void) | |||
492 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); | 517 | mxc_iomux_setup_multiple_pins(ssi_pins, ARRAY_SIZE(ssi_pins), "ssi"); |
493 | } | 518 | } |
494 | 519 | ||
495 | /* static mappings */ | 520 | /* |
521 | * Static mappings, starting from the CS4 start address up to the start address | ||
522 | * of the CS8900. | ||
523 | */ | ||
496 | static struct map_desc mx31ads_io_desc[] __initdata = { | 524 | static struct map_desc mx31ads_io_desc[] __initdata = { |
497 | { | 525 | { |
498 | .virtual = MX31_CS4_BASE_ADDR_VIRT, | 526 | .virtual = MX31_CS4_BASE_ADDR_VIRT, |
499 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), | 527 | .pfn = __phys_to_pfn(MX31_CS4_BASE_ADDR), |
500 | .length = MX31_CS4_SIZE / 2, | 528 | .length = CS4_CS8900_MMIO_START, |
501 | .type = MT_DEVICE | 529 | .type = MT_DEVICE |
502 | }, | 530 | }, |
503 | }; | 531 | }; |
@@ -522,6 +550,7 @@ static void __init mx31ads_init(void) | |||
522 | mxc_init_imx_uart(); | 550 | mxc_init_imx_uart(); |
523 | mxc_init_i2c(); | 551 | mxc_init_i2c(); |
524 | mxc_init_audio(); | 552 | mxc_init_audio(); |
553 | mxc_init_ext_ethernet(); | ||
525 | } | 554 | } |
526 | 555 | ||
527 | static void __init mx31ads_timer_init(void) | 556 | static void __init mx31ads_timer_init(void) |
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h deleted file mode 100644 index 94b60dd47137..000000000000 --- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
12 | #define __ASM_ARCH_MXC_BOARD_MX31ADS_H__ | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | |||
16 | /* | ||
17 | * These symbols are used by drivers/net/cs89x0.c. | ||
18 | * This is ugly as hell, but we have to provide them until | ||
19 | * someone fixed the driver. | ||
20 | */ | ||
21 | |||
22 | /* Base address of PBC controller */ | ||
23 | #define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT | ||
24 | /* Offsets for the PBC Controller register */ | ||
25 | |||
26 | /* Ethernet Controller IO base address */ | ||
27 | #define PBC_CS8900A_IOBASE 0x020000 | ||
28 | |||
29 | #define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START) | ||
30 | |||
31 | #define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8) | ||
32 | |||
33 | #endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */ | ||
diff --git a/drivers/net/Space.c b/drivers/net/Space.c index 068c3563e00f..88bbd8ffa7fe 100644 --- a/drivers/net/Space.c +++ b/drivers/net/Space.c | |||
@@ -190,8 +190,10 @@ static struct devprobe2 isa_probes[] __initdata = { | |||
190 | {seeq8005_probe, 0}, | 190 | {seeq8005_probe, 0}, |
191 | #endif | 191 | #endif |
192 | #ifdef CONFIG_CS89x0 | 192 | #ifdef CONFIG_CS89x0 |
193 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | {cs89x0_probe, 0}, | 194 | {cs89x0_probe, 0}, |
194 | #endif | 195 | #endif |
196 | #endif | ||
195 | #ifdef CONFIG_AT1700 | 197 | #ifdef CONFIG_AT1700 |
196 | {at1700_probe, 0}, | 198 | {at1700_probe, 0}, |
197 | #endif | 199 | #endif |
diff --git a/drivers/net/ethernet/cirrus/Kconfig b/drivers/net/ethernet/cirrus/Kconfig index 1f8648f099c7..8388e36cf08f 100644 --- a/drivers/net/ethernet/cirrus/Kconfig +++ b/drivers/net/ethernet/cirrus/Kconfig | |||
@@ -5,8 +5,7 @@ | |||
5 | config NET_VENDOR_CIRRUS | 5 | config NET_VENDOR_CIRRUS |
6 | bool "Cirrus devices" | 6 | bool "Cirrus devices" |
7 | default y | 7 | default y |
8 | depends on ISA || EISA || MACH_IXDP2351 || ARCH_IXDP2X01 \ | 8 | depends on ISA || EISA || ARM || MAC |
9 | || MACH_MX31ADS || MACH_QQ2440 || (ARM && ARCH_EP93XX) || MAC | ||
10 | ---help--- | 9 | ---help--- |
11 | If you have a network (Ethernet) card belonging to this class, say Y | 10 | If you have a network (Ethernet) card belonging to this class, say Y |
12 | and read the Ethernet-HOWTO, available from | 11 | and read the Ethernet-HOWTO, available from |
@@ -21,8 +20,7 @@ if NET_VENDOR_CIRRUS | |||
21 | 20 | ||
22 | config CS89x0 | 21 | config CS89x0 |
23 | tristate "CS89x0 support" | 22 | tristate "CS89x0 support" |
24 | depends on (ISA || EISA || MACH_IXDP2351 \ | 23 | depends on ISA || EISA || ARM |
25 | || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440) | ||
26 | ---help--- | 24 | ---help--- |
27 | Support for CS89x0 chipset based Ethernet cards. If you have a | 25 | Support for CS89x0 chipset based Ethernet cards. If you have a |
28 | network (Ethernet) card of this type, say Y and read the | 26 | network (Ethernet) card of this type, say Y and read the |
@@ -33,10 +31,15 @@ config CS89x0 | |||
33 | To compile this driver as a module, choose M here. The module | 31 | To compile this driver as a module, choose M here. The module |
34 | will be called cs89x0. | 32 | will be called cs89x0. |
35 | 33 | ||
36 | config CS89x0_NONISA_IRQ | 34 | config CS89x0_PLATFORM |
37 | def_bool y | 35 | bool "CS89x0 platform driver support" |
38 | depends on CS89x0 != n | 36 | depends on CS89x0 |
39 | depends on MACH_IXDP2351 || ARCH_IXDP2X01 || MACH_MX31ADS || MACH_QQ2440 | 37 | help |
38 | Say Y to compile the cs89x0 driver as a platform driver. This | ||
39 | makes this driver suitable for use on certain evaluation boards | ||
40 | such as the iMX21ADS. | ||
41 | |||
42 | If you are unsure, say N. | ||
40 | 43 | ||
41 | config EP93XX_ETH | 44 | config EP93XX_ETH |
42 | tristate "EP93xx Ethernet support" | 45 | tristate "EP93xx Ethernet support" |
diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c index f328da24c8fa..7202ca951bf3 100644 --- a/drivers/net/ethernet/cirrus/cs89x0.c +++ b/drivers/net/ethernet/cirrus/cs89x0.c | |||
@@ -100,9 +100,6 @@ | |||
100 | 100 | ||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* Always include 'config.h' first in case the user wants to turn on | ||
104 | or override something. */ | ||
105 | #include <linux/module.h> | ||
106 | 103 | ||
107 | /* | 104 | /* |
108 | * Set this to zero to disable DMA code | 105 | * Set this to zero to disable DMA code |
@@ -131,9 +128,12 @@ | |||
131 | 128 | ||
132 | */ | 129 | */ |
133 | 130 | ||
131 | #include <linux/module.h> | ||
132 | #include <linux/printk.h> | ||
134 | #include <linux/errno.h> | 133 | #include <linux/errno.h> |
135 | #include <linux/netdevice.h> | 134 | #include <linux/netdevice.h> |
136 | #include <linux/etherdevice.h> | 135 | #include <linux/etherdevice.h> |
136 | #include <linux/platform_device.h> | ||
137 | #include <linux/kernel.h> | 137 | #include <linux/kernel.h> |
138 | #include <linux/types.h> | 138 | #include <linux/types.h> |
139 | #include <linux/fcntl.h> | 139 | #include <linux/fcntl.h> |
@@ -151,6 +151,7 @@ | |||
151 | #include <asm/system.h> | 151 | #include <asm/system.h> |
152 | #include <asm/io.h> | 152 | #include <asm/io.h> |
153 | #include <asm/irq.h> | 153 | #include <asm/irq.h> |
154 | #include <linux/atomic.h> | ||
154 | #if ALLOW_DMA | 155 | #if ALLOW_DMA |
155 | #include <asm/dma.h> | 156 | #include <asm/dma.h> |
156 | #endif | 157 | #endif |
@@ -174,26 +175,20 @@ static char version[] __initdata = | |||
174 | them to system IRQ numbers. This mapping is card specific and is set to | 175 | them to system IRQ numbers. This mapping is card specific and is set to |
175 | the configuration of the Cirrus Eval board for this chip. */ | 176 | the configuration of the Cirrus Eval board for this chip. */ |
176 | #if defined(CONFIG_MACH_IXDP2351) | 177 | #if defined(CONFIG_MACH_IXDP2351) |
178 | #define CS89x0_NONISA_IRQ | ||
177 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; | 179 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2351_VIRT_CS8900_BASE, 0}; |
178 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; | 180 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2351_CS8900, 0, 0, 0}; |
179 | #elif defined(CONFIG_ARCH_IXDP2X01) | 181 | #elif defined(CONFIG_ARCH_IXDP2X01) |
182 | #define CS89x0_NONISA_IRQ | ||
180 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; | 183 | static unsigned int netcard_portlist[] __used __initdata = {IXDP2X01_CS8900_VIRT_BASE, 0}; |
181 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; | 184 | static unsigned int cs8900_irq_map[] = {IRQ_IXDP2X01_CS8900, 0, 0, 0}; |
182 | #elif defined(CONFIG_MACH_QQ2440) | ||
183 | #include <mach/qq2440.h> | ||
184 | static unsigned int netcard_portlist[] __used __initdata = { QQ2440_CS8900_VIRT_BASE + 0x300, 0 }; | ||
185 | static unsigned int cs8900_irq_map[] = { QQ2440_CS8900_IRQ, 0, 0, 0 }; | ||
186 | #elif defined(CONFIG_MACH_MX31ADS) | ||
187 | #include <mach/board-mx31ads.h> | ||
188 | static unsigned int netcard_portlist[] __used __initdata = { | ||
189 | PBC_BASE_ADDRESS + PBC_CS8900A_IOBASE + 0x300, 0 | ||
190 | }; | ||
191 | static unsigned cs8900_irq_map[] = {EXPIO_INT_ENET_INT, 0, 0, 0}; | ||
192 | #else | 185 | #else |
186 | #ifndef CONFIG_CS89x0_PLATFORM | ||
193 | static unsigned int netcard_portlist[] __used __initdata = | 187 | static unsigned int netcard_portlist[] __used __initdata = |
194 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; | 188 | { 0x300, 0x320, 0x340, 0x360, 0x200, 0x220, 0x240, 0x260, 0x280, 0x2a0, 0x2c0, 0x2e0, 0}; |
195 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; | 189 | static unsigned int cs8900_irq_map[] = {10,11,12,5}; |
196 | #endif | 190 | #endif |
191 | #endif | ||
197 | 192 | ||
198 | #if DEBUGGING | 193 | #if DEBUGGING |
199 | static unsigned int net_debug = DEBUGGING; | 194 | static unsigned int net_debug = DEBUGGING; |
@@ -236,11 +231,16 @@ struct net_local { | |||
236 | unsigned char *end_dma_buff; /* points to the end of the buffer */ | 231 | unsigned char *end_dma_buff; /* points to the end of the buffer */ |
237 | unsigned char *rx_dma_ptr; /* points to the next packet */ | 232 | unsigned char *rx_dma_ptr; /* points to the next packet */ |
238 | #endif | 233 | #endif |
234 | #ifdef CONFIG_CS89x0_PLATFORM | ||
235 | void __iomem *virt_addr;/* Virtual address for accessing the CS89x0. */ | ||
236 | unsigned long phys_addr;/* Physical address for accessing the CS89x0. */ | ||
237 | unsigned long size; /* Length of CS89x0 memory region. */ | ||
238 | #endif | ||
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* Index to functions, as function prototypes. */ | 241 | /* Index to functions, as function prototypes. */ |
242 | 242 | ||
243 | static int cs89x0_probe1(struct net_device *dev, int ioaddr, int modular); | 243 | static int cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular); |
244 | static int net_open(struct net_device *dev); | 244 | static int net_open(struct net_device *dev); |
245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); | 245 | static netdev_tx_t net_send_packet(struct sk_buff *skb, struct net_device *dev); |
246 | static irqreturn_t net_interrupt(int irq, void *dev_id); | 246 | static irqreturn_t net_interrupt(int irq, void *dev_id); |
@@ -294,6 +294,7 @@ static int __init media_fn(char *str) | |||
294 | __setup("cs89x0_media=", media_fn); | 294 | __setup("cs89x0_media=", media_fn); |
295 | 295 | ||
296 | 296 | ||
297 | #ifndef CONFIG_CS89x0_PLATFORM | ||
297 | /* Check for a network adaptor of this type, and return '0' iff one exists. | 298 | /* Check for a network adaptor of this type, and return '0' iff one exists. |
298 | If dev->base_addr == 0, probe all likely locations. | 299 | If dev->base_addr == 0, probe all likely locations. |
299 | If dev->base_addr == 1, always return failure. | 300 | If dev->base_addr == 1, always return failure. |
@@ -343,6 +344,7 @@ out: | |||
343 | return ERR_PTR(err); | 344 | return ERR_PTR(err); |
344 | } | 345 | } |
345 | #endif | 346 | #endif |
347 | #endif | ||
346 | 348 | ||
347 | #if defined(CONFIG_MACH_IXDP2351) | 349 | #if defined(CONFIG_MACH_IXDP2351) |
348 | static u16 | 350 | static u16 |
@@ -504,7 +506,7 @@ static const struct net_device_ops net_ops = { | |||
504 | */ | 506 | */ |
505 | 507 | ||
506 | static int __init | 508 | static int __init |
507 | cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | 509 | cs89x0_probe1(struct net_device *dev, unsigned long ioaddr, int modular) |
508 | { | 510 | { |
509 | struct net_local *lp = netdev_priv(dev); | 511 | struct net_local *lp = netdev_priv(dev); |
510 | static unsigned version_printed; | 512 | static unsigned version_printed; |
@@ -529,15 +531,12 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
529 | lp->force = g_cs89x0_media__force; | 531 | lp->force = g_cs89x0_media__force; |
530 | #endif | 532 | #endif |
531 | 533 | ||
532 | #if defined(CONFIG_MACH_QQ2440) | ||
533 | lp->force |= FORCE_RJ45 | FORCE_FULL; | ||
534 | #endif | ||
535 | } | 534 | } |
536 | 535 | ||
537 | /* Grab the region so we can find another board if autoIRQ fails. */ | 536 | /* Grab the region so we can find another board if autoIRQ fails. */ |
538 | /* WTF is going on here? */ | 537 | /* WTF is going on here? */ |
539 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { | 538 | if (!request_region(ioaddr & ~3, NETCARD_IO_EXTENT, DRV_NAME)) { |
540 | printk(KERN_ERR "%s: request_region(0x%x, 0x%x) failed\n", | 539 | printk(KERN_ERR "%s: request_region(0x%lx, 0x%x) failed\n", |
541 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); | 540 | DRV_NAME, ioaddr, NETCARD_IO_EXTENT); |
542 | retval = -EBUSY; | 541 | retval = -EBUSY; |
543 | goto out1; | 542 | goto out1; |
@@ -549,7 +548,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
549 | will skip the test for the ADD_PORT. */ | 548 | will skip the test for the ADD_PORT. */ |
550 | if (ioaddr & 1) { | 549 | if (ioaddr & 1) { |
551 | if (net_debug > 1) | 550 | if (net_debug > 1) |
552 | printk(KERN_INFO "%s: odd ioaddr 0x%x\n", dev->name, ioaddr); | 551 | printk(KERN_INFO "%s: odd ioaddr 0x%lx\n", dev->name, ioaddr); |
553 | if ((ioaddr & 2) != 2) | 552 | if ((ioaddr & 2) != 2) |
554 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { | 553 | if ((readword(ioaddr & ~3, ADD_PORT) & ADD_MASK) != ADD_SIG) { |
555 | printk(KERN_ERR "%s: bad signature 0x%x\n", | 554 | printk(KERN_ERR "%s: bad signature 0x%x\n", |
@@ -560,13 +559,13 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
560 | } | 559 | } |
561 | 560 | ||
562 | ioaddr &= ~3; | 561 | ioaddr &= ~3; |
563 | printk(KERN_DEBUG "PP_addr at %x[%x]: 0x%x\n", | 562 | printk(KERN_DEBUG "PP_addr at %lx[%x]: 0x%x\n", |
564 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); | 563 | ioaddr, ADD_PORT, readword(ioaddr, ADD_PORT)); |
565 | writeword(ioaddr, ADD_PORT, PP_ChipID); | 564 | writeword(ioaddr, ADD_PORT, PP_ChipID); |
566 | 565 | ||
567 | tmp = readword(ioaddr, DATA_PORT); | 566 | tmp = readword(ioaddr, DATA_PORT); |
568 | if (tmp != CHIP_EISA_ID_SIG) { | 567 | if (tmp != CHIP_EISA_ID_SIG) { |
569 | printk(KERN_DEBUG "%s: incorrect signature at %x[%x]: 0x%x!=" | 568 | printk(KERN_DEBUG "%s: incorrect signature at %lx[%x]: 0x%x!=" |
570 | CHIP_EISA_ID_SIG_STR "\n", | 569 | CHIP_EISA_ID_SIG_STR "\n", |
571 | dev->name, ioaddr, DATA_PORT, tmp); | 570 | dev->name, ioaddr, DATA_PORT, tmp); |
572 | retval = -ENODEV; | 571 | retval = -ENODEV; |
@@ -736,8 +735,9 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
736 | dev->irq = i; | 735 | dev->irq = i; |
737 | } else { | 736 | } else { |
738 | i = lp->isa_config & INT_NO_MASK; | 737 | i = lp->isa_config & INT_NO_MASK; |
738 | #ifndef CONFIG_CS89x0_PLATFORM | ||
739 | if (lp->chip_type == CS8900) { | 739 | if (lp->chip_type == CS8900) { |
740 | #ifdef CONFIG_CS89x0_NONISA_IRQ | 740 | #ifdef CS89x0_NONISA_IRQ |
741 | i = cs8900_irq_map[0]; | 741 | i = cs8900_irq_map[0]; |
742 | #else | 742 | #else |
743 | /* Translate the IRQ using the IRQ mapping table. */ | 743 | /* Translate the IRQ using the IRQ mapping table. */ |
@@ -758,6 +758,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
758 | } | 758 | } |
759 | #endif | 759 | #endif |
760 | } | 760 | } |
761 | #endif | ||
761 | if (!dev->irq) | 762 | if (!dev->irq) |
762 | dev->irq = i; | 763 | dev->irq = i; |
763 | } | 764 | } |
@@ -1168,6 +1169,7 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1168 | int i; | 1169 | int i; |
1169 | 1170 | ||
1170 | if (chip_type == CS8900) { | 1171 | if (chip_type == CS8900) { |
1172 | #ifndef CONFIG_CS89x0_PLATFORM | ||
1171 | /* Search the mapping table for the corresponding IRQ pin. */ | 1173 | /* Search the mapping table for the corresponding IRQ pin. */ |
1172 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) | 1174 | for (i = 0; i != ARRAY_SIZE(cs8900_irq_map); i++) |
1173 | if (cs8900_irq_map[i] == irq) | 1175 | if (cs8900_irq_map[i] == irq) |
@@ -1175,6 +1177,10 @@ write_irq(struct net_device *dev, int chip_type, int irq) | |||
1175 | /* Not found */ | 1177 | /* Not found */ |
1176 | if (i == ARRAY_SIZE(cs8900_irq_map)) | 1178 | if (i == ARRAY_SIZE(cs8900_irq_map)) |
1177 | i = 3; | 1179 | i = 3; |
1180 | #else | ||
1181 | /* INTRQ0 pin is used for interrupt generation. */ | ||
1182 | i = 0; | ||
1183 | #endif | ||
1178 | writereg(dev, PP_CS8900_ISAINT, i); | 1184 | writereg(dev, PP_CS8900_ISAINT, i); |
1179 | } else { | 1185 | } else { |
1180 | writereg(dev, PP_CS8920_ISAINT, irq); | 1186 | writereg(dev, PP_CS8920_ISAINT, irq); |
@@ -1228,7 +1234,7 @@ net_open(struct net_device *dev) | |||
1228 | } | 1234 | } |
1229 | else | 1235 | else |
1230 | { | 1236 | { |
1231 | #ifndef CONFIG_CS89x0_NONISA_IRQ | 1237 | #if !defined(CS89x0_NONISA_IRQ) && !defined(CONFIG_CS89x0_PLATFORM) |
1232 | if (((1 << dev->irq) & lp->irq_map) == 0) { | 1238 | if (((1 << dev->irq) & lp->irq_map) == 0) { |
1233 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", | 1239 | printk(KERN_ERR "%s: IRQ %d is not in our map of allowable IRQs, which is %x\n", |
1234 | dev->name, dev->irq, lp->irq_map); | 1240 | dev->name, dev->irq, lp->irq_map); |
@@ -1746,7 +1752,7 @@ static int set_mac_address(struct net_device *dev, void *p) | |||
1746 | return 0; | 1752 | return 0; |
1747 | } | 1753 | } |
1748 | 1754 | ||
1749 | #ifdef MODULE | 1755 | #if defined(MODULE) && !defined(CONFIG_CS89x0_PLATFORM) |
1750 | 1756 | ||
1751 | static struct net_device *dev_cs89x0; | 1757 | static struct net_device *dev_cs89x0; |
1752 | 1758 | ||
@@ -1900,7 +1906,97 @@ cleanup_module(void) | |||
1900 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); | 1906 | release_region(dev_cs89x0->base_addr, NETCARD_IO_EXTENT); |
1901 | free_netdev(dev_cs89x0); | 1907 | free_netdev(dev_cs89x0); |
1902 | } | 1908 | } |
1903 | #endif /* MODULE */ | 1909 | #endif /* MODULE && !CONFIG_CS89x0_PLATFORM */ |
1910 | |||
1911 | #ifdef CONFIG_CS89x0_PLATFORM | ||
1912 | static int __init cs89x0_platform_probe(struct platform_device *pdev) | ||
1913 | { | ||
1914 | struct net_device *dev = alloc_etherdev(sizeof(struct net_local)); | ||
1915 | struct net_local *lp; | ||
1916 | struct resource *mem_res; | ||
1917 | int err; | ||
1918 | |||
1919 | if (!dev) | ||
1920 | return -ENOMEM; | ||
1921 | |||
1922 | lp = netdev_priv(dev); | ||
1923 | |||
1924 | mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1925 | dev->irq = platform_get_irq(pdev, 0); | ||
1926 | if (mem_res == NULL || dev->irq <= 0) { | ||
1927 | dev_warn(&dev->dev, "memory/interrupt resource missing.\n"); | ||
1928 | err = -ENXIO; | ||
1929 | goto free; | ||
1930 | } | ||
1931 | |||
1932 | lp->phys_addr = mem_res->start; | ||
1933 | lp->size = resource_size(mem_res); | ||
1934 | if (!request_mem_region(lp->phys_addr, lp->size, DRV_NAME)) { | ||
1935 | dev_warn(&dev->dev, "request_mem_region() failed.\n"); | ||
1936 | err = -EBUSY; | ||
1937 | goto free; | ||
1938 | } | ||
1939 | |||
1940 | lp->virt_addr = ioremap(lp->phys_addr, lp->size); | ||
1941 | if (!lp->virt_addr) { | ||
1942 | dev_warn(&dev->dev, "ioremap() failed.\n"); | ||
1943 | err = -ENOMEM; | ||
1944 | goto release; | ||
1945 | } | ||
1946 | |||
1947 | err = cs89x0_probe1(dev, (unsigned long)lp->virt_addr, 0); | ||
1948 | if (err) { | ||
1949 | dev_warn(&dev->dev, "no cs8900 or cs8920 detected.\n"); | ||
1950 | goto unmap; | ||
1951 | } | ||
1952 | |||
1953 | platform_set_drvdata(pdev, dev); | ||
1954 | return 0; | ||
1955 | |||
1956 | unmap: | ||
1957 | iounmap(lp->virt_addr); | ||
1958 | release: | ||
1959 | release_mem_region(lp->phys_addr, lp->size); | ||
1960 | free: | ||
1961 | free_netdev(dev); | ||
1962 | return err; | ||
1963 | } | ||
1964 | |||
1965 | static int cs89x0_platform_remove(struct platform_device *pdev) | ||
1966 | { | ||
1967 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1968 | struct net_local *lp = netdev_priv(dev); | ||
1969 | |||
1970 | unregister_netdev(dev); | ||
1971 | iounmap(lp->virt_addr); | ||
1972 | release_mem_region(lp->phys_addr, lp->size); | ||
1973 | free_netdev(dev); | ||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1977 | static struct platform_driver cs89x0_driver = { | ||
1978 | .driver = { | ||
1979 | .name = DRV_NAME, | ||
1980 | .owner = THIS_MODULE, | ||
1981 | }, | ||
1982 | .remove = cs89x0_platform_remove, | ||
1983 | }; | ||
1984 | |||
1985 | static int __init cs89x0_init(void) | ||
1986 | { | ||
1987 | return platform_driver_probe(&cs89x0_driver, cs89x0_platform_probe); | ||
1988 | } | ||
1989 | |||
1990 | module_init(cs89x0_init); | ||
1991 | |||
1992 | static void __exit cs89x0_cleanup(void) | ||
1993 | { | ||
1994 | platform_driver_unregister(&cs89x0_driver); | ||
1995 | } | ||
1996 | |||
1997 | module_exit(cs89x0_cleanup); | ||
1998 | |||
1999 | #endif /* CONFIG_CS89x0_PLATFORM */ | ||
1904 | 2000 | ||
1905 | /* | 2001 | /* |
1906 | * Local variables: | 2002 | * Local variables: |