rt2560.c (184345) | rt2560.c (190526) |
---|---|
1/* $FreeBSD: head/sys/dev/ral/rt2560.c 184345 2008-10-27 16:46:50Z sam $ */ | 1/* $FreeBSD: head/sys/dev/ral/rt2560.c 190526 2009-03-29 17:59:14Z sam $ */ |
2 3/*- 4 * Copyright (c) 2005, 2006 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> | 2 3/*- 4 * Copyright (c) 2005, 2006 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20#include <sys/cdefs.h> |
21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2560.c 184345 2008-10-27 16:46:50Z sam $"); | 21__FBSDID("$FreeBSD: head/sys/dev/ral/rt2560.c 190526 2009-03-29 17:59:14Z sam $"); |
22 23/*- 24 * Ralink Technology RT2560 chipset driver 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sysctl.h> --- 167 unchanged lines hidden (view full) --- 197int 198rt2560_attach(device_t dev, int id) 199{ 200 struct rt2560_softc *sc = device_get_softc(dev); 201 struct ieee80211com *ic; 202 struct ifnet *ifp; 203 int error; 204 uint8_t bands; | 22 23/*- 24 * Ralink Technology RT2560 chipset driver 25 * http://www.ralinktech.com/ 26 */ 27 28#include <sys/param.h> 29#include <sys/sysctl.h> --- 167 unchanged lines hidden (view full) --- 197int 198rt2560_attach(device_t dev, int id) 199{ 200 struct rt2560_softc *sc = device_get_softc(dev); 201 struct ieee80211com *ic; 202 struct ifnet *ifp; 203 int error; 204 uint8_t bands; |
205 uint8_t macaddr[IEEE80211_ADDR_LEN]; |
|
205 206 sc->sc_dev = dev; 207 208 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, 209 MTX_DEF | MTX_RECURSE); 210 211 callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); 212 --- 42 unchanged lines hidden (view full) --- 255 ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); 256 if (ifp == NULL) { 257 device_printf(sc->sc_dev, "can not if_alloc()\n"); 258 goto fail6; 259 } 260 ic = ifp->if_l2com; 261 262 /* retrieve MAC address */ | 206 207 sc->sc_dev = dev; 208 209 mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, 210 MTX_DEF | MTX_RECURSE); 211 212 callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0); 213 --- 42 unchanged lines hidden (view full) --- 256 ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); 257 if (ifp == NULL) { 258 device_printf(sc->sc_dev, "can not if_alloc()\n"); 259 goto fail6; 260 } 261 ic = ifp->if_l2com; 262 263 /* retrieve MAC address */ |
263 rt2560_get_macaddr(sc, ic->ic_myaddr); | 264 rt2560_get_macaddr(sc, macaddr); |
264 265 ifp->if_softc = sc; 266 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 267 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 268 ifp->if_init = rt2560_init; 269 ifp->if_ioctl = rt2560_ioctl; 270 ifp->if_start = rt2560_start; 271 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); --- 23 unchanged lines hidden (view full) --- 295 296 bands = 0; 297 setbit(&bands, IEEE80211_MODE_11B); 298 setbit(&bands, IEEE80211_MODE_11G); 299 if (sc->rf_rev == RT2560_RF_5222) 300 setbit(&bands, IEEE80211_MODE_11A); 301 ieee80211_init_channels(ic, NULL, &bands); 302 | 265 266 ifp->if_softc = sc; 267 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 268 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; 269 ifp->if_init = rt2560_init; 270 ifp->if_ioctl = rt2560_ioctl; 271 ifp->if_start = rt2560_start; 272 IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); --- 23 unchanged lines hidden (view full) --- 296 297 bands = 0; 298 setbit(&bands, IEEE80211_MODE_11B); 299 setbit(&bands, IEEE80211_MODE_11G); 300 if (sc->rf_rev == RT2560_RF_5222) 301 setbit(&bands, IEEE80211_MODE_11A); 302 ieee80211_init_channels(ic, NULL, &bands); 303 |
303 ieee80211_ifattach(ic); | 304 ieee80211_ifattach(ic, macaddr); |
304 ic->ic_newassoc = rt2560_newassoc; 305 ic->ic_raw_xmit = rt2560_raw_xmit; 306 ic->ic_updateslot = rt2560_update_slot; 307 ic->ic_update_promisc = rt2560_update_promisc; 308 ic->ic_node_alloc = rt2560_node_alloc; 309 ic->ic_scan_start = rt2560_scan_start; 310 ic->ic_scan_end = rt2560_scan_end; 311 ic->ic_set_channel = rt2560_set_channel; --- 2366 unchanged lines hidden (view full) --- 2678 2679 RAL_WRITE(sc, RT2560_RXCSR1, tmp); 2680 RAL_WRITE(sc, RT2560_RXCSR2, sc->rxq.physaddr); 2681 2682 /* initialize MAC registers to default values */ 2683 for (i = 0; i < N(rt2560_def_mac); i++) 2684 RAL_WRITE(sc, rt2560_def_mac[i].reg, rt2560_def_mac[i].val); 2685 | 305 ic->ic_newassoc = rt2560_newassoc; 306 ic->ic_raw_xmit = rt2560_raw_xmit; 307 ic->ic_updateslot = rt2560_update_slot; 308 ic->ic_update_promisc = rt2560_update_promisc; 309 ic->ic_node_alloc = rt2560_node_alloc; 310 ic->ic_scan_start = rt2560_scan_start; 311 ic->ic_scan_end = rt2560_scan_end; 312 ic->ic_set_channel = rt2560_set_channel; --- 2366 unchanged lines hidden (view full) --- 2679 2680 RAL_WRITE(sc, RT2560_RXCSR1, tmp); 2681 RAL_WRITE(sc, RT2560_RXCSR2, sc->rxq.physaddr); 2682 2683 /* initialize MAC registers to default values */ 2684 for (i = 0; i < N(rt2560_def_mac); i++) 2685 RAL_WRITE(sc, rt2560_def_mac[i].reg, rt2560_def_mac[i].val); 2686 |
2686 IEEE80211_ADDR_COPY(ic->ic_myaddr, IF_LLADDR(ifp)); 2687 rt2560_set_macaddr(sc, ic->ic_myaddr); | 2687 rt2560_set_macaddr(sc, IF_LLADDR(ifp)); |
2688 2689 /* set basic rate set (will be updated later) */ 2690 RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x153); 2691 2692 rt2560_update_slot(ifp); 2693 rt2560_update_plcp(sc); 2694 rt2560_update_led(sc, 0, 0); 2695 --- 162 unchanged lines hidden --- | 2688 2689 /* set basic rate set (will be updated later) */ 2690 RAL_WRITE(sc, RT2560_ARSP_PLCP_1, 0x153); 2691 2692 rt2560_update_slot(ifp); 2693 rt2560_update_plcp(sc); 2694 rt2560_update_led(sc, 0, 0); 2695 --- 162 unchanged lines hidden --- |