Blame view

arch/arm/plat-omap/debug-devices.c 2.14 KB
f60493123   David Brownell   ARM: OMAP: abstra...
1
2
3
4
5
6
7
8
9
10
  /*
   * linux/arch/arm/plat-omap/debug-devices.c
   *
   * Copyright (C) 2005 Nokia Corporation
   * Modified from mach-omap2/board-h4.c
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
2f8163baa   Russell King   ARM: gpio: conver...
11
  #include <linux/gpio.h>
f60493123   David Brownell   ARM: OMAP: abstra...
12
13
14
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
fced80c73   Russell King   [ARM] Convert asm...
15
  #include <linux/io.h>
3bc480147   Ladislav Michl   omap: use smc91x_...
16
  #include <linux/smc91x.h>
f60493123   David Brownell   ARM: OMAP: abstra...
17

a09e64fbc   Russell King   [ARM] Move includ...
18
  #include <mach/hardware.h>
f60493123   David Brownell   ARM: OMAP: abstra...
19

ce491cf85   Tony Lindgren   omap: headers: Mo...
20
  #include <plat/board.h>
f60493123   David Brownell   ARM: OMAP: abstra...
21
22
23
24
25
  
  
  /* Many OMAP development platforms reuse the same "debug board"; these
   * platforms include H2, H3, H4, and Perseus2.
   */
3bc480147   Ladislav Michl   omap: use smc91x_...
26
27
28
29
30
  static struct smc91x_platdata smc91x_info = {
  	.flags	= SMC91X_USE_16BIT | SMC91X_NOWAIT,
  	.leda	= RPC_LED_100_10,
  	.ledb	= RPC_LED_TX_RX,
  };
f60493123   David Brownell   ARM: OMAP: abstra...
31
32
33
34
35
  static struct resource smc91x_resources[] = {
  	[0] = {
  		.flags  = IORESOURCE_MEM,
  	},
  	[1] = {
e7b3dc7ef   Russell King   [NET] smc91x: Mak...
36
  		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
f60493123   David Brownell   ARM: OMAP: abstra...
37
38
39
40
41
42
  	},
  };
  
  static struct platform_device smc91x_device = {
  	.name		= "smc91x",
  	.id		= -1,
3bc480147   Ladislav Michl   omap: use smc91x_...
43
44
45
  	.dev		= {
  		.platform_data = &smc91x_info,
  	},
f60493123   David Brownell   ARM: OMAP: abstra...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  	.num_resources	= ARRAY_SIZE(smc91x_resources),
  	.resource	= smc91x_resources,
  };
  
  static struct resource led_resources[] = {
  	[0] = {
  		.flags	= IORESOURCE_MEM,
  	},
  };
  
  static struct platform_device led_device = {
  	.name		= "omap_dbg_led",
  	.id		= -1,
  	.num_resources	= ARRAY_SIZE(led_resources),
  	.resource	= led_resources,
  };
  
  static struct platform_device *debug_devices[] __initdata = {
  	&smc91x_device,
  	&led_device,
  	/* ps2 kbd + mouse ports */
  	/* 4 extra uarts */
  	/* 6 input dip switches */
  	/* 8 output pins */
  };
  
  int __init debug_card_init(u32 addr, unsigned gpio)
  {
  	int	status;
  
  	smc91x_resources[0].start = addr + 0x300;
  	smc91x_resources[0].end   = addr + 0x30f;
15f74b033   David Brownell   ARM: OMAP: use gp...
78
79
  	smc91x_resources[1].start = gpio_to_irq(gpio);
  	smc91x_resources[1].end   = gpio_to_irq(gpio);
f60493123   David Brownell   ARM: OMAP: abstra...
80

f2d18fea8   Jarkko Nikula   ARM: OMAP: Switch...
81
  	status = gpio_request(gpio, "SMC91x irq");
f60493123   David Brownell   ARM: OMAP: abstra...
82
83
84
85
86
  	if (status < 0) {
  		printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ
  ", gpio);
  		return status;
  	}
40e3925ba   David Brownell   ARM: OMAP: switch...
87
  	gpio_direction_input(gpio);
f60493123   David Brownell   ARM: OMAP: abstra...
88
89
90
91
92
93
  
  	led_resources[0].start = addr;
  	led_resources[0].end   = addr + SZ_4K - 1;
  
  	return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));
  }