4 * The is drived from pci.c
7 * Armin Kuster akuster@dslextreme.com
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
33 #include <linux/list.h>
34 #include <linux/init.h>
35 #include <linux/module.h>
36 #include <linux/config.h>
37 #include <linux/stddef.h>
38 #include <linux/slab.h>
39 #include <linux/types.h>
42 #include <asm/errno.h>
45 * ocp_get_num - This determines how many OCP devices of a given
46 * device are registered
47 * @device: OCP device such as HOST, PCI, GPT, UART, OPB, IIC, GPIO, EMAC, ZMII,
49 * The routine returns the number that devices which is registered
51 unsigned int ocp_get_num(unsigned int device)
53 unsigned int count = 0;
54 struct ocp_device *ocp;
55 struct list_head *ocp_l;
57 list_for_each(ocp_l, &ocp_devices) {
58 ocp = list_entry(ocp_l, struct ocp_device, global_list);
59 if (device == ocp->device)
66 * ocp_get_dev - get ocp driver pointer for ocp device and instance of it
67 * @device: OCP device such as PCI, GPT, UART, OPB, IIC, GPIO, EMAC, ZMII
68 * @dev_num: ocp device number whos paddr you want
70 * The routine returns ocp device pointer
71 * in list based on device and instance of that device
75 ocp_get_dev(unsigned int device, int dev_num)
77 struct ocp_device *ocp;
78 struct list_head *ocp_l;
81 list_for_each(ocp_l, &ocp_devices) {
82 ocp = list_entry(ocp_l, struct ocp_device, global_list);
83 if (device == ocp->device) {
92 EXPORT_SYMBOL(ocp_get_dev);
93 EXPORT_SYMBOL(ocp_get_num);
96 int ocp_generic_suspend(struct ocp_device *pdev, u32 state)
98 ocp_force_power_off(pdev);
102 int ocp_generic_resume(struct ocp_device *pdev)
104 ocp_force_power_on(pdev);
107 EXPORT_SYMBOL(ocp_generic_suspend);
108 EXPORT_SYMBOL(ocp_generic_resume);
109 #endif /* CONFIG_PM */