diff options
author | Jason Wang <jason77.wang@gmail.com> | 2010-06-24 09:11:29 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-07-26 08:29:20 -0400 |
commit | c5d38f08ca05c5253cb491a26225bf16bfa54ab1 (patch) | |
tree | 32ca15dc4ec725e705afce0a43cf5418960d53bc | |
parent | fa94f8dce1459eef1f0f8d5b1e4f26c3f058dec2 (diff) |
mx31_3ds: revert 3ds debug board relate code
Because we add a 3ds debug board support in mxc level, we remove
those redundant codes from board level.
Signed-off-by: Jason Wang <jason77.wang@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx3/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31_3ds.c | 169 |
2 files changed, 5 insertions, 165 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig index a11112afde5e..e063657e1bf4 100644 --- a/arch/arm/mach-mx3/Kconfig +++ b/arch/arm/mach-mx3/Kconfig | |||
@@ -67,6 +67,7 @@ config MACH_MX31LITE | |||
67 | config MACH_MX31_3DS | 67 | config MACH_MX31_3DS |
68 | bool "Support MX31PDK (3DS)" | 68 | bool "Support MX31PDK (3DS)" |
69 | select ARCH_MX31 | 69 | select ARCH_MX31 |
70 | select MXC_DEBUG_BOARD | ||
70 | select IMX_HAVE_PLATFORM_IMX_UART | 71 | select IMX_HAVE_PLATFORM_IMX_UART |
71 | select IMX_HAVE_PLATFORM_MXC_NAND | 72 | select IMX_HAVE_PLATFORM_MXC_NAND |
72 | select IMX_HAVE_PLATFORM_SPI_IMX | 73 | select IMX_HAVE_PLATFORM_SPI_IMX |
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c index d4d9e7a1f735..6fe69e124d30 100644 --- a/arch/arm/mach-mx3/mach-mx31_3ds.c +++ b/arch/arm/mach-mx3/mach-mx31_3ds.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
19 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/smsc911x.h> | ||
22 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
23 | #include <linux/mfd/mc13783.h> | 22 | #include <linux/mfd/mc13783.h> |
24 | #include <linux/spi/spi.h> | 23 | #include <linux/spi/spi.h> |
@@ -34,6 +33,7 @@ | |||
34 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
35 | #include <mach/common.h> | 34 | #include <mach/common.h> |
36 | #include <mach/iomux-mx3.h> | 35 | #include <mach/iomux-mx3.h> |
36 | #include <mach/3ds_debugboard.h> | ||
37 | 37 | ||
38 | #include "devices-imx31.h" | 38 | #include "devices-imx31.h" |
39 | #include "devices.h" | 39 | #include "devices.h" |
@@ -254,173 +254,11 @@ static const struct imxuart_platform_data uart_pdata __initconst = { | |||
254 | }; | 254 | }; |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Support for the SMSC9217 on the Debug board. | ||
258 | */ | ||
259 | |||
260 | static struct smsc911x_platform_config smsc911x_config = { | ||
261 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | ||
262 | .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, | ||
263 | .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY, | ||
264 | .phy_interface = PHY_INTERFACE_MODE_MII, | ||
265 | }; | ||
266 | |||
267 | static struct resource smsc911x_resources[] = { | ||
268 | { | ||
269 | .start = LAN9217_BASE_ADDR, | ||
270 | .end = LAN9217_BASE_ADDR + 0xff, | ||
271 | .flags = IORESOURCE_MEM, | ||
272 | }, { | ||
273 | .start = EXPIO_INT_ENET, | ||
274 | .end = EXPIO_INT_ENET, | ||
275 | .flags = IORESOURCE_IRQ, | ||
276 | }, | ||
277 | }; | ||
278 | |||
279 | static struct platform_device smsc911x_device = { | ||
280 | .name = "smsc911x", | ||
281 | .id = -1, | ||
282 | .num_resources = ARRAY_SIZE(smsc911x_resources), | ||
283 | .resource = smsc911x_resources, | ||
284 | .dev = { | ||
285 | .platform_data = &smsc911x_config, | ||
286 | }, | ||
287 | }; | ||
288 | |||
289 | /* | ||
290 | * Routines for the CPLD on the debug board. It contains a CPLD handling | ||
291 | * LEDs, switches, interrupts for Ethernet. | ||
292 | */ | ||
293 | |||
294 | static void mx31_3ds_expio_irq_handler(uint32_t irq, struct irq_desc *desc) | ||
295 | { | ||
296 | uint32_t imr_val; | ||
297 | uint32_t int_valid; | ||
298 | uint32_t expio_irq; | ||
299 | |||
300 | imr_val = __raw_readw(CPLD_INT_MASK_REG); | ||
301 | int_valid = __raw_readw(CPLD_INT_STATUS_REG) & ~imr_val; | ||
302 | |||
303 | expio_irq = MXC_EXP_IO_BASE; | ||
304 | for (; int_valid != 0; int_valid >>= 1, expio_irq++) { | ||
305 | if ((int_valid & 1) == 0) | ||
306 | continue; | ||
307 | generic_handle_irq(expio_irq); | ||
308 | } | ||
309 | } | ||
310 | |||
311 | /* | ||
312 | * Disable an expio pin's interrupt by setting the bit in the imr. | ||
313 | * @param irq an expio virtual irq number | ||
314 | */ | ||
315 | static void expio_mask_irq(uint32_t irq) | ||
316 | { | ||
317 | uint16_t reg; | ||
318 | uint32_t expio = MXC_IRQ_TO_EXPIO(irq); | ||
319 | |||
320 | /* mask the interrupt */ | ||
321 | reg = __raw_readw(CPLD_INT_MASK_REG); | ||
322 | reg |= 1 << expio; | ||
323 | __raw_writew(reg, CPLD_INT_MASK_REG); | ||
324 | } | ||
325 | |||
326 | /* | ||
327 | * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr. | ||
328 | * @param irq an expanded io virtual irq number | ||
329 | */ | ||
330 | static void expio_ack_irq(uint32_t irq) | ||
331 | { | ||
332 | uint32_t expio = MXC_IRQ_TO_EXPIO(irq); | ||
333 | |||
334 | /* clear the interrupt status */ | ||
335 | __raw_writew(1 << expio, CPLD_INT_RESET_REG); | ||
336 | __raw_writew(0, CPLD_INT_RESET_REG); | ||
337 | /* mask the interrupt */ | ||
338 | expio_mask_irq(irq); | ||
339 | } | ||
340 | |||
341 | /* | ||
342 | * Enable a expio pin's interrupt by clearing the bit in the imr. | ||
343 | * @param irq a expio virtual irq number | ||
344 | */ | ||
345 | static void expio_unmask_irq(uint32_t irq) | ||
346 | { | ||
347 | uint16_t reg; | ||
348 | uint32_t expio = MXC_IRQ_TO_EXPIO(irq); | ||
349 | |||
350 | /* unmask the interrupt */ | ||
351 | reg = __raw_readw(CPLD_INT_MASK_REG); | ||
352 | reg &= ~(1 << expio); | ||
353 | __raw_writew(reg, CPLD_INT_MASK_REG); | ||
354 | } | ||
355 | |||
356 | static struct irq_chip expio_irq_chip = { | ||
357 | .ack = expio_ack_irq, | ||
358 | .mask = expio_mask_irq, | ||
359 | .unmask = expio_unmask_irq, | ||
360 | }; | ||
361 | |||
362 | static int __init mx31_3ds_init_expio(void) | ||
363 | { | ||
364 | int i; | ||
365 | int ret; | ||
366 | |||
367 | /* Check if there's a debug board connected */ | ||
368 | if ((__raw_readw(CPLD_MAGIC_NUMBER1_REG) != 0xAAAA) || | ||
369 | (__raw_readw(CPLD_MAGIC_NUMBER2_REG) != 0x5555) || | ||
370 | (__raw_readw(CPLD_MAGIC_NUMBER3_REG) != 0xCAFE)) { | ||
371 | /* No Debug board found */ | ||
372 | return -ENODEV; | ||
373 | } | ||
374 | |||
375 | pr_info("i.MX31 3DS Debug board detected, rev = 0x%04X\n", | ||
376 | __raw_readw(CPLD_CODE_VER_REG)); | ||
377 | |||
378 | /* | ||
379 | * Configure INT line as GPIO input | ||
380 | */ | ||
381 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "sms9217-irq"); | ||
382 | if (ret) | ||
383 | pr_warning("could not get LAN irq gpio\n"); | ||
384 | else | ||
385 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)); | ||
386 | |||
387 | /* Disable the interrupts and clear the status */ | ||
388 | __raw_writew(0, CPLD_INT_MASK_REG); | ||
389 | __raw_writew(0xFFFF, CPLD_INT_RESET_REG); | ||
390 | __raw_writew(0, CPLD_INT_RESET_REG); | ||
391 | __raw_writew(0x1F, CPLD_INT_MASK_REG); | ||
392 | for (i = MXC_EXP_IO_BASE; | ||
393 | i < (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES); | ||
394 | i++) { | ||
395 | set_irq_chip(i, &expio_irq_chip); | ||
396 | set_irq_handler(i, handle_level_irq); | ||
397 | set_irq_flags(i, IRQF_VALID); | ||
398 | } | ||
399 | set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_LOW); | ||
400 | set_irq_chained_handler(EXPIO_PARENT_INT, mx31_3ds_expio_irq_handler); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | /* | ||
406 | * This structure defines the MX31 memory map. | ||
407 | */ | ||
408 | static struct map_desc mx31_3ds_io_desc[] __initdata = { | ||
409 | { | ||
410 | .virtual = MX31_CS5_BASE_ADDR_VIRT, | ||
411 | .pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR), | ||
412 | .length = MX31_CS5_SIZE, | ||
413 | .type = MT_DEVICE, | ||
414 | }, | ||
415 | }; | ||
416 | |||
417 | /* | ||
418 | * Set up static virtual mappings. | 257 | * Set up static virtual mappings. |
419 | */ | 258 | */ |
420 | static void __init mx31_3ds_map_io(void) | 259 | static void __init mx31_3ds_map_io(void) |
421 | { | 260 | { |
422 | mx31_map_io(); | 261 | mx31_map_io(); |
423 | iotable_init(mx31_3ds_io_desc, ARRAY_SIZE(mx31_3ds_io_desc)); | ||
424 | } | 262 | } |
425 | 263 | ||
426 | /*! | 264 | /*! |
@@ -443,8 +281,9 @@ static void __init mxc_board_init(void) | |||
443 | mx31_3ds_usbotg_init(); | 281 | mx31_3ds_usbotg_init(); |
444 | mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); | 282 | mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); |
445 | 283 | ||
446 | if (!mx31_3ds_init_expio()) | 284 | if (!mxc_expio_init(CS5_BASE_ADDR, EXPIO_PARENT_INT)) |
447 | platform_device_register(&smsc911x_device); | 285 | printk(KERN_WARNING "Init of the debugboard failed, all " |
286 | "devices on the board are unusable.\n"); | ||
448 | } | 287 | } |
449 | 288 | ||
450 | static void __init mx31_3ds_timer_init(void) | 289 | static void __init mx31_3ds_timer_init(void) |