aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/u_ether.h
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-05-23 03:22:05 -0400
committerFelipe Balbi <balbi@ti.com>2013-06-10 10:11:51 -0400
commitbcd4a1c40bee885e5266ca53de05d985a5518d7a (patch)
treea9e37de23decad21ec2dfa7b70ad63b13da5cb29 /drivers/usb/gadget/u_ether.h
parentcbbd14a9021140a306a01f8fcaa645faafae18a5 (diff)
usb: gadget: u_ether: construct with default values and add setters/getters
Add an interface to create a struct netdev_dev filled with default values, an interface which makes it an interface to fill the struct with useful values and an interface to read the values set. The patch also adds an interface to register the net device associated with an ethernet-over-usb link. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/u_ether.h')
-rw-r--r--drivers/usb/gadget/u_ether.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h
index 02f58acdd5e9..d74b8f7214a4 100644
--- a/drivers/usb/gadget/u_ether.h
+++ b/drivers/usb/gadget/u_ether.h
@@ -115,6 +115,129 @@ static inline struct eth_dev *gether_setup(struct usb_gadget *g,
115 return gether_setup_name(g, dev_addr, host_addr, ethaddr, qmult, "usb"); 115 return gether_setup_name(g, dev_addr, host_addr, ethaddr, qmult, "usb");
116} 116}
117 117
118/*
119 * variant of gether_setup_default that allows customizing
120 * network device name
121 */
122struct net_device *gether_setup_name_default(const char *netname);
123
124/*
125 * gether_register_netdev - register the net device
126 * @net: net device to register
127 *
128 * Registers the net device associated with this ethernet-over-usb link
129 *
130 */
131int gether_register_netdev(struct net_device *net);
132
133/* gether_setup_default - initialize one ethernet-over-usb link
134 * Context: may sleep
135 *
136 * This sets up the single network link that may be exported by a
137 * gadget driver using this framework. The link layer addresses
138 * are set to random values.
139 *
140 * Returns negative errno, or zero on success
141 */
142static inline struct net_device *gether_setup_default(void)
143{
144 return gether_setup_name_default("usb");
145}
146
147/**
148 * gether_set_gadget - initialize one ethernet-over-usb link with a gadget
149 * @net: device representing this link
150 * @g: the gadget to initialize with
151 *
152 * This associates one ethernet-over-usb link with a gadget.
153 */
154void gether_set_gadget(struct net_device *net, struct usb_gadget *g);
155
156/**
157 * gether_set_dev_addr - initialize an ethernet-over-usb link with eth address
158 * @net: device representing this link
159 * @dev_addr: eth address of this device
160 *
161 * This sets the device-side Ethernet address of this ethernet-over-usb link
162 * if dev_addr is correct.
163 * Returns negative errno if the new address is incorrect.
164 */
165int gether_set_dev_addr(struct net_device *net, const char *dev_addr);
166
167/**
168 * gether_get_dev_addr - get an ethernet-over-usb link eth address
169 * @net: device representing this link
170 * @dev_addr: place to store device's eth address
171 * @len: length of the @dev_addr buffer
172 *
173 * This gets the device-side Ethernet address of this ethernet-over-usb link.
174 * Returns zero on success, else negative errno.
175 */
176int gether_get_dev_addr(struct net_device *net, char *dev_addr, int len);
177
178/**
179 * gether_set_host_addr - initialize an ethernet-over-usb link with host address
180 * @net: device representing this link
181 * @host_addr: eth address of the host
182 *
183 * This sets the host-side Ethernet address of this ethernet-over-usb link
184 * if host_addr is correct.
185 * Returns negative errno if the new address is incorrect.
186 */
187int gether_set_host_addr(struct net_device *net, const char *host_addr);
188
189/**
190 * gether_get_host_addr - get an ethernet-over-usb link host address
191 * @net: device representing this link
192 * @host_addr: place to store eth address of the host
193 * @len: length of the @host_addr buffer
194 *
195 * This gets the host-side Ethernet address of this ethernet-over-usb link.
196 * Returns zero on success, else negative errno.
197 */
198int gether_get_host_addr(struct net_device *net, char *host_addr, int len);
199
200/**
201 * gether_get_host_addr_cdc - get an ethernet-over-usb link host address
202 * @net: device representing this link
203 * @host_addr: place to store eth address of the host
204 * @len: length of the @host_addr buffer
205 *
206 * This gets the CDC formatted host-side Ethernet address of this
207 * ethernet-over-usb link.
208 * Returns zero on success, else negative errno.
209 */
210int gether_get_host_addr_cdc(struct net_device *net, char *host_addr, int len);
211
212/**
213 * gether_set_qmult - initialize an ethernet-over-usb link with a multiplier
214 * @net: device representing this link
215 * @qmult: queue multiplier
216 *
217 * This sets the queue length multiplier of this ethernet-over-usb link.
218 * For higher speeds use longer queues.
219 */
220void gether_set_qmult(struct net_device *net, unsigned qmult);
221
222/**
223 * gether_get_qmult - get an ethernet-over-usb link multiplier
224 * @net: device representing this link
225 *
226 * This gets the queue length multiplier of this ethernet-over-usb link.
227 */
228unsigned gether_get_qmult(struct net_device *net);
229
230/**
231 * gether_get_ifname - get an ethernet-over-usb link interface name
232 * @net: device representing this link
233 * @name: place to store the interface name
234 * @len: length of the @name buffer
235 *
236 * This gets the interface name of this ethernet-over-usb link.
237 * Returns zero on success, else negative errno.
238 */
239int gether_get_ifname(struct net_device *net, char *name, int len);
240
118void gether_cleanup(struct eth_dev *dev); 241void gether_cleanup(struct eth_dev *dev);
119 242
120/* connect/disconnect is handled by individual functions */ 243/* connect/disconnect is handled by individual functions */