patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-arm / arch-omap / bus.h
1 /*
2  * linux/include/asm-arm/arch-omap/bus.h
3  *
4  * Virtual bus for OMAP. Allows better power management, such as managing
5  * shared clocks, and mapping of bus addresses to Local Bus addresses.
6  *
7  * See drivers/usb/host/ohci-omap.c or drivers/video/omap/omapfb.c for
8  * examples on how to register drivers to this bus.
9  *
10  * Copyright (C) 2003 - 2004 Nokia Corporation
11  * Written by Tony Lindgren <tony@atomide.com>
12  * Portions of code based on sa1111.c.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  */
28
29 #ifndef __ASM_ARM_ARCH_OMAP_BUS_H
30 #define __ASM_ARM_ARCH_OMAP_BUS_H
31
32 extern struct bus_type omap_bus_types[];
33
34 /*
35  * Description for physical device
36  */
37 struct omap_dev {
38         struct device   dev;            /* Standard device description */
39         char            *name;
40         unsigned int    devid;          /* OMAP device id */
41         unsigned int    busid;          /* OMAP virtual busid */
42         struct resource res;            /* Standard resource description */
43         void            *mapbase;       /* OMAP physical address */
44         unsigned int    irq[6];         /* OMAP interrupts */
45         u64             *dma_mask;      /* Used by USB OHCI only */
46         u64             coherent_dma_mask;      /* Used by USB OHCI only */
47 };
48
49 #define OMAP_DEV(_d)    container_of((_d), struct omap_dev, dev)
50
51 #define omap_get_drvdata(d)     dev_get_drvdata(&(d)->dev)
52 #define omap_set_drvdata(d,p)   dev_set_drvdata(&(d)->dev, p)
53
54 /*
55  * Description for device driver
56  */
57 struct omap_driver {
58         struct device_driver    drv;    /* Standard driver description */
59         unsigned int            devid;  /* OMAP device id for bus */
60         unsigned int            busid;  /* OMAP virtual busid */
61         unsigned int            clocks; /* OMAP shared clocks */
62         int (*probe)(struct omap_dev *);
63         int (*remove)(struct omap_dev *);
64         int (*suspend)(struct omap_dev *, u32);
65         int (*resume)(struct omap_dev *);
66 };
67
68 #define OMAP_DRV(_d)    container_of((_d), struct omap_driver, drv)
69 #define OMAP_DRIVER_NAME(_omapdev) ((_omapdev)->dev.driver->name)
70
71 /*
72  * Device ID numbers for bus types
73  */
74 #define OMAP_OCP_DEVID_USB      0
75
76 #define OMAP_TIPB_DEVID_OHCI    0
77 #define OMAP_TIPB_DEVID_LCD     1
78 #define OMAP_TIPB_DEVID_MMC     2
79 #define OMAP_TIPB_DEVID_OTG     3
80 #define OMAP_TIPB_DEVID_UDC     4
81
82 /*
83  * Virtual bus definitions for OMAP
84  */
85 #define OMAP_NR_BUSES   2
86
87 #define OMAP_BUS_NAME_TIPB      "tipb"
88 #define OMAP_BUS_NAME_LBUS      "lbus"
89
90 enum {
91         OMAP_BUS_TIPB = 0,
92         OMAP_BUS_LBUS,
93 };
94
95 /* See arch/arm/mach-omap/bus.c for the rest of the bus definitions. */
96
97 extern int omap_driver_register(struct omap_driver *driver);
98 extern void omap_driver_unregister(struct omap_driver *driver);
99 extern int omap_device_register(struct omap_dev *odev);
100 extern void omap_device_unregister(struct omap_dev *odev);
101
102 #endif