1c51552792cca76b1d1fd042ae9d91eec6af86a5
[openembedded.git] /
1 From 334eef94045c93957cad3477522086492dd19b06 Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <sakoman@gmail.com>
3 Date: Tue, 15 Dec 2009 15:34:29 -0800
4 Subject: [PATCH 05/16] ARM: OMAP: add support for TCT Zippy to Beagle board file
5
6 Signed-off-by: Steve Sakoman <sakoman@gmail.com>
7 ---
8  arch/arm/mach-omap2/board-omap3beagle.c |   74 +++++++++++++++++++++++++++++-
9  1 files changed, 71 insertions(+), 3 deletions(-)
10
11 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
12 index 41480bd..f3df638 100644
13 --- a/arch/arm/mach-omap2/board-omap3beagle.c
14 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
15 @@ -21,6 +21,7 @@
16  #include <linux/io.h>
17  #include <linux/leds.h>
18  #include <linux/gpio.h>
19 +#include <linux/irq.h>
20  #include <linux/input.h>
21  #include <linux/gpio_keys.h>
22  
23 @@ -52,6 +53,49 @@
24  
25  #define NAND_BLOCK_SIZE                SZ_128K
26  
27 +#if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
28 +
29 +#include <plat/mcspi.h>
30 +#include <linux/spi/spi.h>
31 +
32 +#define OMAP3BEAGLE_GPIO_ENC28J60_IRQ 157
33 +
34 +static struct omap2_mcspi_device_config enc28j60_spi_chip_info = {
35 +       .turbo_mode     = 0,
36 +       .single_channel = 1,    /* 0: slave, 1: master */
37 +};
38 +
39 +static struct spi_board_info omap3beagle_spi_board_info[] __initdata = {
40 +       {
41 +               .modalias               = "enc28j60",
42 +               .bus_num                = 4,
43 +               .chip_select            = 0,
44 +               .max_speed_hz           = 20000000,
45 +               .controller_data        = &enc28j60_spi_chip_info,
46 +       },
47 +};
48 +
49 +static void __init omap3beagle_enc28j60_init(void)
50 +{
51 +       if ((gpio_request(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, "ENC28J60_IRQ") == 0) &&
52 +           (gpio_direction_input(OMAP3BEAGLE_GPIO_ENC28J60_IRQ) == 0)) {
53 +               gpio_export(OMAP3BEAGLE_GPIO_ENC28J60_IRQ, 0);
54 +               omap3beagle_spi_board_info[0].irq       = OMAP_GPIO_IRQ(OMAP3BEAGLE_GPIO_ENC28J60_IRQ);
55 +               set_irq_type(omap3beagle_spi_board_info[0].irq, IRQ_TYPE_EDGE_FALLING);
56 +       } else {
57 +               printk(KERN_ERR "could not obtain gpio for ENC28J60_IRQ\n");
58 +               return;
59 +       }
60 +
61 +       spi_register_board_info(omap3beagle_spi_board_info,
62 +                       ARRAY_SIZE(omap3beagle_spi_board_info));
63 +}
64 +
65 +#else
66 +static inline void __init omap3beagle_enc28j60_init(void) { return; }
67 +#endif
68 +
69 +
70  static struct mtd_partition omap3beagle_nand_partitions[] = {
71         /* All the partition sizes are listed in terms of NAND block size */
72         {
73 @@ -114,6 +158,14 @@ static struct twl4030_hsmmc_info mmc[] = {
74                 .wires          = 8,
75                 .gpio_wp        = 29,
76         },
77 +       {
78 +               .mmc            = 2,
79 +               .wires          = 4,
80 +               .gpio_wp        = 141,
81 +               .gpio_cd        = 162,
82 +               .transceiver    = true,
83 +               .ocr_mask       = 0x00100000,   /* 3.3V */
84 +       },
85         {}      /* Terminator */
86  };
87  
88 @@ -277,7 +329,7 @@ static struct twl4030_platform_data beagle_twldata = {
89         .vpll2          = &beagle_vpll2,
90  };
91  
92 -static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
93 +static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = {
94         {
95                 I2C_BOARD_INFO("twl4030", 0x48),
96                 .flags = I2C_CLIENT_WAKE,
97 @@ -286,10 +338,24 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
98         },
99  };
100  
101 +#if defined(CONFIG_RTC_DRV_DS1307) || \
102 +       defined(CONFIG_RTC_DRV_DS1307_MODULE)
103 +
104 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {
105 +       {
106 +               I2C_BOARD_INFO("ds1307", 0x68),
107 +       },
108 +};
109 +#else
110 +static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = {};
111 +#endif
112 +
113  static int __init omap3_beagle_i2c_init(void)
114  {
115 -       omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo,
116 -                       ARRAY_SIZE(beagle_i2c_boardinfo));
117 +       omap_register_i2c_bus(1, 2600, beagle_i2c1_boardinfo,
118 +                       ARRAY_SIZE(beagle_i2c1_boardinfo));
119 +       omap_register_i2c_bus(2, 400,  beagle_i2c2_boardinfo,
120 +                       ARRAY_SIZE(beagle_i2c2_boardinfo));
121         /* Bus 3 is attached to the DVI port where devices like the pico DLP
122          * projector don't work reliably with 400kHz */
123         omap_register_i2c_bus(3, 100, NULL, 0);
124 @@ -434,6 +500,8 @@ static void __init omap3_beagle_init(void)
125         /* REVISIT leave DVI powered down until it's needed ... */
126         gpio_direction_output(170, true);
127  
128 +       omap3beagle_enc28j60_init();
129 +
130         usb_musb_init();
131         usb_ehci_init(&ehci_pdata);
132         omap3beagle_flash_init();
133 -- 
134 1.6.2.4
135