~ubuntu-branches/ubuntu/lucid/linux-rt/lucid

« back to all changes in this revision

Viewing changes to arch/arm/mach-omap1/board-h3.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-08-05 23:00:52 UTC
  • Revision ID: james.westby@ubuntu.com-20090805230052-7xedvqcyk9dnnxb2
Tags: 2.6.31-1.1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <asm/mach/flash.h>
40
40
#include <asm/mach/map.h>
41
41
 
42
 
#include <mach/gpioexpander.h>
43
42
#include <mach/irqs.h>
44
43
#include <mach/mux.h>
45
44
#include <mach/tc.h>
46
45
#include <mach/nand.h>
47
 
#include <mach/irda.h>
48
46
#include <mach/usb.h>
49
47
#include <mach/keypad.h>
50
48
#include <mach/dma.h>
51
49
#include <mach/common.h>
52
50
 
 
51
#include "board-h3.h"
 
52
 
 
53
/* In OMAP1710 H3 the Ethernet is directly connected to CS1 */
 
54
#define OMAP1710_ETHR_START             0x04000300
 
55
 
53
56
#define H3_TS_GPIO      48
54
57
 
55
58
static int h3_keymap[] = {
271
274
        .resource       = h3_kp_resources,
272
275
};
273
276
 
274
 
 
275
 
/* Select between the IrDA and aGPS module
276
 
 */
277
 
static int h3_select_irda(struct device *dev, int state)
278
 
{
279
 
        unsigned char expa;
280
 
        int err = 0;
281
 
 
282
 
        if ((err = read_gpio_expa(&expa, 0x26))) {
283
 
                printk(KERN_ERR "Error reading from I/O EXPANDER \n");
284
 
                return err;
285
 
        }
286
 
 
287
 
        /* 'P6' enable/disable IRDA_TX and IRDA_RX */
288
 
        if (state & IR_SEL) { /* IrDA */
289
 
                if ((err = write_gpio_expa(expa | 0x40, 0x26))) {
290
 
                        printk(KERN_ERR "Error writing to I/O EXPANDER \n");
291
 
                        return err;
292
 
                }
293
 
        } else {
294
 
                if ((err = write_gpio_expa(expa & ~0x40, 0x26))) {
295
 
                        printk(KERN_ERR "Error writing to I/O EXPANDER \n");
296
 
                        return err;
297
 
                }
298
 
        }
299
 
        return err;
300
 
}
301
 
 
302
 
static void set_trans_mode(struct work_struct *work)
303
 
{
304
 
        struct omap_irda_config *irda_config =
305
 
                container_of(work, struct omap_irda_config, gpio_expa.work);
306
 
        int mode = irda_config->mode;
307
 
        unsigned char expa;
308
 
        int err = 0;
309
 
 
310
 
        if ((err = read_gpio_expa(&expa, 0x27)) != 0) {
311
 
                printk(KERN_ERR "Error reading from I/O expander\n");
312
 
        }
313
 
 
314
 
        expa &= ~0x03;
315
 
 
316
 
        if (mode & IR_SIRMODE) {
317
 
                expa |= 0x01;
318
 
        } else { /* MIR/FIR */
319
 
                expa |= 0x03;
320
 
        }
321
 
 
322
 
        if ((err = write_gpio_expa(expa, 0x27)) != 0) {
323
 
                printk(KERN_ERR "Error writing to I/O expander\n");
324
 
        }
325
 
}
326
 
 
327
 
static int h3_transceiver_mode(struct device *dev, int mode)
328
 
{
329
 
        struct omap_irda_config *irda_config = dev->platform_data;
330
 
 
331
 
        irda_config->mode = mode;
332
 
        cancel_delayed_work(&irda_config->gpio_expa);
333
 
        PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
334
 
        schedule_delayed_work(&irda_config->gpio_expa, 0);
335
 
 
336
 
        return 0;
337
 
}
338
 
 
339
 
static struct omap_irda_config h3_irda_data = {
340
 
        .transceiver_cap        = IR_SIRMODE | IR_MIRMODE | IR_FIRMODE,
341
 
        .transceiver_mode       = h3_transceiver_mode,
342
 
        .select_irda            = h3_select_irda,
343
 
        .rx_channel             = OMAP_DMA_UART3_RX,
344
 
        .tx_channel             = OMAP_DMA_UART3_TX,
345
 
        .dest_start             = UART3_THR,
346
 
        .src_start              = UART3_RHR,
347
 
        .tx_trigger             = 0,
348
 
        .rx_trigger             = 0,
349
 
};
350
 
 
351
 
static struct resource h3_irda_resources[] = {
352
 
        [0] = {
353
 
                .start  = INT_UART3,
354
 
                .end    = INT_UART3,
355
 
                .flags  = IORESOURCE_IRQ,
356
 
        },
357
 
};
358
 
 
359
 
static u64 irda_dmamask = 0xffffffff;
360
 
 
361
 
static struct platform_device h3_irda_device = {
362
 
        .name           = "omapirda",
363
 
        .id             = 0,
364
 
        .dev            = {
365
 
                .platform_data  = &h3_irda_data,
366
 
                .dma_mask       = &irda_dmamask,
367
 
        },
368
 
        .num_resources  = ARRAY_SIZE(h3_irda_resources),
369
 
        .resource       = h3_irda_resources,
370
 
};
371
 
 
372
277
static struct platform_device h3_lcd_device = {
373
278
        .name           = "lcd_h3",
374
279
        .id             = -1,
390
295
        &nand_device,
391
296
        &smc91x_device,
392
297
        &intlat_device,
393
 
        &h3_irda_device,
394
298
        &h3_kp_device,
395
299
        &h3_lcd_device,
396
300
};
418
322
};
419
323
 
420
324
static struct omap_board_config_kernel h3_config[] __initdata = {
421
 
        { OMAP_TAG_USB,         &h3_usb_config },
422
325
        { OMAP_TAG_UART,        &h3_uart_config },
423
326
        { OMAP_TAG_LCD,         &h3_lcd_config },
424
327
};
472
375
        omap_serial_init();
473
376
        omap_register_i2c_bus(1, 100, h3_i2c_board_info,
474
377
                              ARRAY_SIZE(h3_i2c_board_info));
 
378
        omap_usb_init(&h3_usb_config);
475
379
        h3_mmc_init();
476
380
}
477
381