3254fe4562f83c792a157f4b266207c8c1664eb4
[openembedded.git] /
1 From 190c75031e65008425dbdd74c3e3237beed18460 Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <sakoman@gmail.com>
3 Date: Tue, 15 Dec 2009 14:59:42 -0800
4 Subject: [PATCH 01/16] ARM: OMAP: Overo: Add support for second ethernet port
5
6 Signed-off-by: Steve Sakoman <sakoman@gmail.com>
7 ---
8  arch/arm/mach-omap2/board-overo.c |   56 +++++++++++++++++++++++++++++++++++--
9  1 files changed, 53 insertions(+), 3 deletions(-)
10
11 diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
12 index 52dfd51..1b94f2c 100644
13 --- a/arch/arm/mach-omap2/board-overo.c
14 +++ b/arch/arm/mach-omap2/board-overo.c
15 @@ -63,6 +63,8 @@
16  
17  #define OVERO_SMSC911X_CS      5
18  #define OVERO_SMSC911X_GPIO    176
19 +#define OVERO_SMSC911X2_CS     4
20 +#define OVERO_SMSC911X2_GPIO   65
21  
22  #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
23         defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
24 @@ -137,6 +139,16 @@ static struct resource overo_smsc911x_resources[] = {
25         },
26  };
27  
28 +static struct resource overo_smsc911x2_resources[] = {
29 +       {
30 +               .name   = "smsc911x2-memory",
31 +               .flags  = IORESOURCE_MEM,
32 +       },
33 +       {
34 +               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
35 +       },
36 +};
37 +
38  static struct smsc911x_platform_config overo_smsc911x_config = {
39         .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
40         .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
41 @@ -146,7 +158,7 @@ static struct smsc911x_platform_config overo_smsc911x_config = {
42  
43  static struct platform_device overo_smsc911x_device = {
44         .name           = "smsc911x",
45 -       .id             = -1,
46 +       .id             = 0,
47         .num_resources  = ARRAY_SIZE(overo_smsc911x_resources),
48         .resource       = overo_smsc911x_resources,
49         .dev            = {
50 @@ -154,9 +166,26 @@ static struct platform_device overo_smsc911x_device = {
51         },
52  };
53  
54 +static struct platform_device overo_smsc911x2_device = {
55 +       .name           = "smsc911x",
56 +       .id             = 1,
57 +       .num_resources  = ARRAY_SIZE(overo_smsc911x2_resources),
58 +       .resource       = overo_smsc911x2_resources,
59 +       .dev            = {
60 +               .platform_data = &overo_smsc911x_config,
61 +       },
62 +};
63 +
64 +static struct platform_device *smsc911x_devices[] = {
65 +       &overo_smsc911x_device,
66 +       &overo_smsc911x2_device,
67 +};
68 +
69  static inline void __init overo_init_smsc911x(void)
70  {
71 -       unsigned long cs_mem_base;
72 +       unsigned long cs_mem_base, cs_mem_base2;
73 +
74 +       /* set up first smsc911x chip */
75  
76         if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
77                 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
78 @@ -177,7 +206,28 @@ static inline void __init overo_init_smsc911x(void)
79         overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
80         overo_smsc911x_resources[1].end   = 0;
81  
82 -       platform_device_register(&overo_smsc911x_device);
83 +       /* set up second smsc911x chip */
84 +
85 +       if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
86 +               printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
87 +               return;
88 +       }
89 +
90 +       overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
91 +       overo_smsc911x2_resources[0].end   = cs_mem_base2 + 0xff;
92 +
93 +       if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
94 +           (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
95 +               gpio_export(OVERO_SMSC911X2_GPIO, 0);
96 +       } else {
97 +               printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
98 +               return;
99 +       }
100 +
101 +       overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
102 +       overo_smsc911x2_resources[1].end   = 0;
103 +
104 +       platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
105  }
106  
107  #else
108 -- 
109 1.6.2.4
110