BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
e61c2559
Commit
e61c2559
authored
Sep 13, 2017
by
David Clark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates after instlegato is working
parent
befd3ef7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
96 deletions
+77
-96
5-mt7697q.mdef
linux_kernel_modules/mt7697q/5-mt7697q.mdef
+0
-13
queue.c
linux_kernel_modules/mt7697q/queue.c
+13
-6
spi.c
linux_kernel_modules/mt7697q/spi.c
+40
-17
spi.h
linux_kernel_modules/mt7697q/spi.h
+3
-1
6-mt7697wifi_core.mdef
linux_kernel_modules/mt7697wifi/6-mt7697wifi_core.mdef
+0
-21
cfg80211.c
linux_kernel_modules/mt7697wifi/cfg80211.c
+20
-37
main.c
linux_kernel_modules/mt7697wifi/main.c
+1
-1
No files found.
linux_kernel_modules/mt7697q/5-mt7697q.mdef
deleted
100644 → 0
View file @
befd3ef7
sources:
{
io.c
interrupt.c
queue.c
spi.c
}
cflags:
{
// -DDEBUG
}
linux_kernel_modules/mt7697q/queue.c
View file @
e61c2559
...
...
@@ -515,22 +515,28 @@ int mt7697q_init(u8 tx_ch, u8 rx_ch, void *priv, rx_hndlr rx_fcn,
void
**
tx_hndl
,
void
**
rx_hndl
)
{
char
str
[
32
];
struct
spi_master
*
master
;
struct
spi_master
*
master
=
NULL
;
struct
device
*
dev
;
struct
spi_device
*
spi
;
struct
mt7697q_info
*
qinfo
;
struct
mt7697q_spec
*
qsTx
,
*
qsRx
;
int
bus_num
=
MT7697_SPI_BUS_NUM
;
int
ret
;
pr_info
(
DRVNAME
" %s(): initialize queue(%u/%u)
\n
"
,
__func__
,
tx_ch
,
rx_ch
);
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
MT7697_SPI_BUS_NUM
);
master
=
spi_busnum_to_master
(
MT7697_SPI_BUS_NUM
);
while
(
!
master
&&
(
bus_num
>=
0
))
{
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
bus_num
);
master
=
spi_busnum_to_master
(
bus_num
);
if
(
!
master
)
bus_num
--
;
}
if
(
!
master
)
{
pr_err
(
DRVNAME
" %s(): spi_busnum_to_master(
%d
) failed
\n
"
,
__func__
,
MT7697_SPI_BUS_NUM
);
pr_err
(
DRVNAME
" %s(): spi_busnum_to_master() failed
\n
"
,
__func__
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
...
...
@@ -594,6 +600,7 @@ int mt7697q_init(u8 tx_ch, u8 rx_ch, void *priv, rx_hndlr rx_fcn,
goto
cleanup
;
}
ret
=
mt7697q_read_state
(
rx_ch
,
qsRx
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): mt7697q_read_state() failed(%d)
\n
"
,
...
...
linux_kernel_modules/mt7697q/spi.c
View file @
e61c2559
...
...
@@ -25,6 +25,7 @@
#include <linux/of.h>
#include <linux/usb.h>
#include <linux/gpio.h>
#include "spi-cp2130.h"
#include "interrupt.h"
#include "queue.h"
#include "spi.h"
...
...
@@ -61,20 +62,34 @@ static const struct mt7697spi_hw_ops hw_ops =
static
int
__init
mt7697spi_init
(
void
)
{
char
str
[
32
];
struct
spi_master
*
master
;
struct
spi_master
*
master
=
NULL
;
struct
device
*
dev
;
struct
spi_device
*
spi
;
struct
mt7697q_info
*
qinfo
;
struct
mt7697q_info
*
qinfo
=
NULL
;
int
bus_num
=
MT7697_SPI_BUS_NUM
;
int
ret
=
0
;
pr_info
(
DRVNAME
" %s(): '%s' initialize
\n
"
,
__func__
,
DRVNAME
);
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
MT7697_SPI_BUS_NUM
);
master
=
spi_busnum_to_master
(
MT7697_SPI_BUS_NUM
);
while
(
!
master
&&
(
bus_num
>=
0
))
{
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
bus_num
);
master
=
spi_busnum_to_master
(
bus_num
);
if
(
!
master
)
bus_num
--
;
}
if
(
!
master
)
{
pr_err
(
DRVNAME
" spi_busnum_to_master(%d) failed
\n
"
,
MT7697_SPI_BUS_NUM
);
pr_err
(
DRVNAME
" spi_busnum_to_master() failed
\n
"
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
ret
=
cp2130_update_ch_config
(
master
,
MT7697_SPI_CONFIG
);
if
(
ret
<
0
)
{
dev_err
(
&
master
->
dev
,
"%s(): cp2130_update_ch_config() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
@@ -83,8 +98,10 @@ static int __init mt7697spi_init(void)
dev
=
bus_find_device_by_name
(
&
spi_bus_type
,
NULL
,
str
);
if
(
!
dev
)
{
dev_err
(
&
master
->
dev
,
"%s():
'%s' bus_find_device_by_name(
) failed
\n
"
,
"%s():
bus_find_device_by_name('%s'
) failed
\n
"
,
__func__
,
str
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
...
...
@@ -92,13 +109,14 @@ static int __init mt7697spi_init(void)
if
(
!
spi
)
{
dev_err
(
&
master
->
dev
,
"%s(): get SPI device failed
\n
"
,
__func__
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
dev_info
(
&
master
->
dev
,
"%s(): init dev('%s') mode(%d) max speed(%d) "
"CS(%d)
GPIO(%d)
bits/word(%d)
\n
"
,
"CS(%d) bits/word(%d)
\n
"
,
__func__
,
spi
->
modalias
,
spi
->
mode
,
spi
->
max_speed_hz
,
spi
->
chip_select
,
spi
->
cs_gpio
,
spi
->
bits_per_word
);
spi
->
chip_select
,
spi
->
bits_per_word
);
qinfo
=
kzalloc
(
sizeof
(
struct
mt7697q_info
),
GFP_KERNEL
);
if
(
!
qinfo
)
{
...
...
@@ -157,24 +175,29 @@ failed_gpio_req:
gpio_free
(
MT7697_SPI_INTR_GPIO_PIN
);
cleanup:
kfree
(
qinfo
);
if
(
qinfo
)
kfree
(
qinfo
);
return
ret
;
}
static
void
__exit
mt7697spi_exit
(
void
)
{
char
str
[
32
];
struct
spi_master
*
master
;
struct
spi_master
*
master
=
NULL
;
struct
device
*
dev
;
struct
spi_device
*
spi
;
struct
mt7697q_info
*
qinfo
;
int
bus_num
=
MT7697_SPI_BUS_NUM
;
while
(
!
master
&&
(
bus_num
>=
0
))
{
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
bus_num
);
master
=
spi_busnum_to_master
(
bus_num
);
if
(
!
master
)
bus_num
--
;
}
pr_info
(
DRVNAME
" %s(): get SPI master bus(%u)
\n
"
,
__func__
,
MT7697_SPI_BUS_NUM
);
master
=
spi_busnum_to_master
(
MT7697_SPI_BUS_NUM
);
if
(
!
master
)
{
pr_err
(
DRVNAME
" %s(): spi_busnum_to_master(%d) failed
\n
"
,
__func__
,
MT7697_SPI_BUS_NUM
);
pr_err
(
DRVNAME
" spi_busnum_to_master() failed
\n
"
);
goto
cleanup
;
}
...
...
linux_kernel_modules/mt7697q/spi.h
View file @
e61c2559
...
...
@@ -27,10 +27,12 @@
#define DRVNAME "mt7697q"
#define MT7697_GPIO_IRQ_NAME "mt7697q irq"
#define MT7697_SPI_INTR_GPIO_PIN 50
//21
#define MT7697_SPI_INTR_GPIO_PIN 50
#define MT7697_SPI_BUS_NUM 32766
#define MT7697_SPI_CS 0
#define MT7697_SPI_CONFIG "0,2,-1,0,0,1,0,0,0,0,0,mt7697"
struct
mt7697spi_hw_ops
{
int
(
*
write
)(
struct
spi_device
*
,
const
void
*
,
size_t
);
int
(
*
read
)(
struct
spi_device
*
,
void
*
,
size_t
);
...
...
linux_kernel_modules/mt7697wifi/6-mt7697wifi_core.mdef
deleted
100644 → 0
View file @
befd3ef7
sources:
{
wmi.c
cfg80211.c
main.c
txrx.c
ioctl.c
}
cflags:
{
// -DDEBUG
-DCONFIG_CFG80211_WEXT
-DCONFIG_WIRELESS
-DCONFIG_WIRELESS_EXT
// -DCONFIG_WEXT_CORE
// -DCONFIG_WEXT_PROC
// -DCONFIG_WEXT_SPY
// -DCONFIG_WEXT_PRIV
-I$MANGOH_ROOT/linux_kernel_modules/mt7697q
}
linux_kernel_modules/mt7697wifi/cfg80211.c
View file @
e61c2559
...
...
@@ -245,27 +245,6 @@ cleanup:
return
ret
;
}
static
bool
mt7697_is_valid_iftype
(
const
struct
mt7697_cfg80211_info
*
cfg
,
enum
nl80211_iftype
type
,
u8
*
if_idx
)
{
int
i
;
if
(
cfg
->
ibss_if_active
||
((
type
==
NL80211_IFTYPE_ADHOC
)
&&
cfg
->
num_vif
))
return
false
;
if
(
type
==
NL80211_IFTYPE_STATION
||
type
==
NL80211_IFTYPE_AP
)
{
for
(
i
=
cfg
->
vif_start
;
i
<
cfg
->
vif_max
;
i
++
)
{
if
((
cfg
->
avail_idx_map
)
&
BIT
(
i
))
{
*
if_idx
=
i
;
return
true
;
}
}
}
return
false
;
}
static
struct
cfg80211_bss
*
mt7697_add_bss_if_needed
(
struct
mt7697_vif
*
vif
,
const
u8
*
bssid
,
u32
freq
)
...
...
@@ -344,31 +323,35 @@ static struct wireless_dev* mt7697_cfg80211_add_iface(struct wiphy *wiphy,
struct
vif_params
*
params
)
{
struct
mt7697_cfg80211_info
*
cfg
=
wiphy_priv
(
wiphy
);
struct
mt7697_vif
*
vif
;
struct
wireless_dev
*
wdev
=
NULL
;
u8
if_idx
;
dev_dbg
(
cfg
->
dev
,
"%s(): iface('%s') type(%u)
\n
"
,
__func__
,
name
,
type
);
if
(
cfg
->
num_vif
==
cfg
->
vif_max
)
{
dev_err
(
cfg
->
dev
,
"max # supported vif(%u)
\n
"
,
cfg
->
num_vif
);
goto
cleanup
;
}
if
(
!
mt7697_is_valid_iftype
(
cfg
,
type
,
&
if_idx
))
{
dev_err
(
cfg
->
dev
,
"%s(): unsupported interface(%d)
\n
"
,
__func__
,
type
);
goto
cleanup
;
spin_lock_bh
(
&
cfg
->
vif_list_lock
);
if
(
!
list_empty
(
&
cfg
->
vif_list
))
{
list_for_each_entry
(
vif
,
&
cfg
->
vif_list
,
next
)
{
wdev
=
&
vif
->
wdev
;
break
;
}
spin_unlock_bh
(
&
cfg
->
vif_list_lock
);
dev_dbg
(
cfg
->
dev
,
"%s(): iface('%s') exists
\n
"
,
__func__
,
name
);
}
else
{
wdev
=
mt7697_interface_add
(
cfg
,
name
,
type
,
if_idx
);
if
(
!
wdev
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_interface_add() failed
\n
"
,
__func__
);
goto
cleanup
;
}
wdev
=
mt7697_interface_add
(
cfg
,
name
,
type
,
if_idx
);
if
(
!
wdev
)
{
dev_err
(
cfg
->
dev
,
"%s(): mt7697_interface_add() failed
\n
"
,
__func__
);
goto
cleanup
;
cfg
->
num_vif
++
;
}
cfg
->
num_vif
++
;
cleanup:
return
wdev
;
}
...
...
linux_kernel_modules/mt7697wifi/main.c
View file @
e61c2559
...
...
@@ -170,7 +170,7 @@ static void mt7697_cookie_cleanup(struct mt7697_cfg80211_info *cfg)
cfg
->
cookie_count
=
0
;
}
static
int
__init
mt7697_probe
(
struct
platform_device
*
pdev
)
static
int
mt7697_probe
(
struct
platform_device
*
pdev
)
{
struct
wiphy
*
wiphy
;
struct
mt7697_cfg80211_info
*
cfg
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment