1/*-
2 * Copyright 2017 Adrian Chadd <adrian@FreeBSD.org>.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 *
25 */
26
27#include "opt_ah.h"
28#include "opt_wlan.h"
29
30#include <sys/types.h>
31#include <sys/systm.h>
32#include <sys/conf.h>
33#include <sys/errno.h>
34#include <sys/kernel.h>
35#include <sys/module.h>
36
37#include <dev/ath/ath_hal/ah.h>
38#include <dev/ath/ath_hal/ah_internal.h>
39
40extern struct ath_hal_chip AR5212_chip;
41//extern struct ath_hal_rf RF2316_rf;
42//extern struct ath_hal_rf RF2317_rf;
43extern struct ath_hal_rf RF2413_rf;
44extern struct ath_hal_rf RF2425_rf;
45extern struct ath_hal_rf RF5111_rf;
46extern struct ath_hal_rf RF5112_rf;
47extern struct ath_hal_rf RF5413_rf;
48
49static int
50ath_hal_ar5212_modevent(module_t mod __unused, int type, void *data __unused)
51{
52	int error = 0;
53
54	switch (type) {
55	case MOD_LOAD:
56		ath_hal_add_chip(&AR5212_chip);
57//		ath_hal_add_rf(&RF2316_rf);
58//		ath_hal_add_rf(&RF2317_rf);
59		ath_hal_add_rf(&RF2413_rf);
60		ath_hal_add_rf(&RF2425_rf);
61		ath_hal_add_rf(&RF5111_rf);
62		ath_hal_add_rf(&RF5112_rf);
63		ath_hal_add_rf(&RF5413_rf);
64		printf("[ar5212] loaded\n");
65		break;
66
67	case MOD_UNLOAD:
68		ath_hal_remove_chip(&AR5212_chip);
69//		ath_hal_remove_rf(&RF2316_rf);
70//		ath_hal_remove_rf(&RF2317_rf);
71		ath_hal_remove_rf(&RF2413_rf);
72		ath_hal_remove_rf(&RF2425_rf);
73		ath_hal_remove_rf(&RF5111_rf);
74		ath_hal_remove_rf(&RF5112_rf);
75		ath_hal_remove_rf(&RF5413_rf);
76		printf("[ar5212] unloaded\n");
77		break;
78
79	case MOD_SHUTDOWN:
80		break;
81
82	default:
83		error = EOPNOTSUPP;
84		break;
85	}
86	return (error);
87}
88
89DEV_MODULE(ath_hal_ar5212, ath_hal_ar5212_modevent, NULL);
90MODULE_VERSION(ath_hal_ar5212, 1);
91MODULE_DEPEND(ath_hal_ar5212, ath_hal, 1, 1, 1);
92