ipc/sem.c: replace shared sem_otime with per-semaphore value
[linux-2.6.git] / include / linux / platform_data / brcmfmac-sdio.h
blob1ade657d5fc16a886e69b913ed4df285284eb39b
1 /*
2 * Copyright (c) 2013 Broadcom Corporation
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #ifndef _LINUX_BRCMFMAC_PLATFORM_H
18 #define _LINUX_BRCMFMAC_PLATFORM_H
21 * Platform specific driver functions and data. Through the platform specific
22 * device data functions can be provided to help the brcmfmac driver to
23 * operate with the device in combination with the used platform.
25 * Use the platform data in the following (similar) way:
28 #include <brcmfmac_platform.h>
31 static void brcmfmac_power_on(void)
35 static void brcmfmac_power_off(void)
39 static void brcmfmac_reset(void)
43 static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = {
44 .power_on = brcmfmac_power_on,
45 .power_off = brcmfmac_power_off,
46 .reset = brcmfmac_reset
49 static struct platform_device brcmfmac_device = {
50 .name = BRCMFMAC_SDIO_PDATA_NAME,
51 .id = PLATFORM_DEVID_NONE,
52 .dev.platform_data = &brcmfmac_sdio_pdata
55 void __init brcmfmac_init_pdata(void)
57 brcmfmac_sdio_pdata.oob_irq_supported = true;
58 brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB);
59 brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ |
60 IORESOURCE_IRQ_HIGHLEVEL;
61 platform_device_register(&brcmfmac_device);
65 * Note: the brcmfmac can be loaded as module or be statically built-in into
66 * the kernel. If built-in then do note that it uses module_init (and
67 * module_exit) routines which equal device_initcall. So if you intend to
68 * create a module with the platform specific data for the brcmfmac and have
69 * it built-in to the kernel then use a higher initcall then device_initcall
70 * (see init.h). If this is not done then brcmfmac will load without problems
71 * but will not pickup the platform data.
73 * When the driver does not "detect" platform driver data then it will continue
74 * without reporting anything and just assume there is no data needed. Which is
75 * probably true for most platforms.
77 * Explanation of the platform_data fields:
79 * drive_strength: is the preferred drive_strength to be used for the SDIO
80 * pins. If 0 then a default value will be used. This is the target drive
81 * strength, the exact drive strength which will be used depends on the
82 * capabilities of the device.
84 * oob_irq_supported: does the board have support for OOB interrupts. SDIO
85 * in-band interrupts are relatively slow and for having less overhead on
86 * interrupt processing an out of band interrupt can be used. If the HW
87 * supports this then enable this by setting this field to true and configure
88 * the oob related fields.
90 * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are
91 * used for registering the irq using request_irq function.
93 * power_on: This function is called by the brcmfmac when the module gets
94 * loaded. This can be particularly useful for low power devices. The platform
95 * spcific routine may for example decide to power up the complete device.
96 * If there is no use-case for this function then provide NULL.
98 * power_off: This function is called by the brcmfmac when the module gets
99 * unloaded. At this point the device can be powered down or otherwise be reset.
100 * So if an actual power_off is not supported but reset is then reset the device
101 * when this function gets called. This can be particularly useful for low power
102 * devices. If there is no use-case for this function (either power-down or
103 * reset) then provide NULL.
105 * reset: This function can get called if the device communication broke down.
106 * This functionality is particularly useful in case of SDIO type devices. It is
107 * possible to reset a dongle via sdio data interface, but it requires that
108 * this is fully functional. This function is chip/module specific and this
109 * function should return only after the complete reset has completed.
112 #define BRCMFMAC_SDIO_PDATA_NAME "brcmfmac_sdio"
114 struct brcmfmac_sdio_platform_data {
115 unsigned int drive_strength;
116 bool oob_irq_supported;
117 unsigned int oob_irq_nr;
118 unsigned long oob_irq_flags;
119 void (*power_on)(void);
120 void (*power_off)(void);
121 void (*reset)(void);
124 #endif /* _LINUX_BRCMFMAC_PLATFORM_H */