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
bae6b7b8
Commit
bae6b7b8
authored
Oct 30, 2017
by
David Clark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WiFi Serial implementation
parent
2d7b47c0
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
316 additions
and
237 deletions
+316
-237
1-mt7697q.mdef
linux_kernel_modules/mt7697q/1-mt7697q.mdef
+2
-1
interrupt.c
linux_kernel_modules/mt7697q/interrupt.c
+9
-9
interrupt.h
linux_kernel_modules/mt7697q/interrupt.h
+5
-4
queue.c
linux_kernel_modules/mt7697q/queue.c
+62
-44
queue.h
linux_kernel_modules/mt7697q/queue.h
+5
-4
queue_i.h
linux_kernel_modules/mt7697q/queue_i.h
+10
-41
spi.c
linux_kernel_modules/mt7697q/spi.c
+23
-15
spi.h
linux_kernel_modules/mt7697q/spi.h
+7
-6
2-mt7697wifi_core.mdef
linux_kernel_modules/mt7697wifi/2-mt7697wifi_core.mdef
+7
-0
cfg80211.c
linux_kernel_modules/mt7697wifi/cfg80211.c
+19
-6
core.h
linux_kernel_modules/mt7697wifi/core.h
+3
-2
main.c
linux_kernel_modules/mt7697wifi/main.c
+68
-20
interfaces
linux_kernel_modules/mt7697wifi/scripts/interfaces
+1
-1
mt7697_setup_wifi.sh
linux_kernel_modules/mt7697wifi/scripts/mt7697_setup_wifi.sh
+1
-0
mtwifi
linux_kernel_modules/mt7697wifi/scripts/mtwifi
+21
-12
txrx.c
linux_kernel_modules/mt7697wifi/txrx.c
+1
-1
wmi.c
linux_kernel_modules/mt7697wifi/wmi.c
+21
-21
wmi.h
linux_kernel_modules/mt7697wifi/wmi.h
+50
-50
mangOH_Red.sdef
mangOH_Red.sdef
+1
-0
No files found.
linux_kernel_modules/mt7697q/1-mt7697q.mdef
View file @
bae6b7b8
...
...
@@ -9,6 +9,7 @@ sources:
cflags:
{
// -DDEBUG
-I$MANGOH_ROOT/linux_kernel_modules/cp2130
-I$MANGOH_ROOT/linux_kernel_modules/cp2130
-I$MANGOH_ROOT/linux_kernel_modules/mt7697common
}
linux_kernel_modules/mt7697q/interrupt.c
View file @
bae6b7b8
...
...
@@ -22,7 +22,7 @@
#include "io.h"
#include "spi.h"
int
mt7697
_irq_run
(
struct
mt7697q_info
*
qinfo
)
static
int
mt7697q
_irq_run
(
struct
mt7697q_info
*
qinfo
)
{
int
ret
;
u8
ch
;
...
...
@@ -80,16 +80,16 @@ cleanup:
return
ret
;
}
void
mt7697_irq_delayed_work
(
struct
work_struct
*
irq_delayed_work
)
void
mt7697
q
_irq_delayed_work
(
struct
work_struct
*
irq_delayed_work
)
{
struct
mt7697q_info
*
qinfo
=
container_of
(
irq_delayed_work
,
struct
mt7697q_info
,
irq_delayed_work
.
work
);
int
ret
;
dev_dbg
(
qinfo
->
dev
,
"%s(): process work
\n
"
,
__func__
);
ret
=
mt7697_irq_run
(
qinfo
);
ret
=
mt7697
q
_irq_run
(
qinfo
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): mt7697_irq_run() failed(%d)
\n
"
,
dev_err
(
qinfo
->
dev
,
"%s(): mt7697
q
_irq_run() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
@@ -98,17 +98,17 @@ cleanup:
return
;
}
void
mt7697_irq_work
(
struct
work_struct
*
irq_work
)
void
mt7697
q
_irq_work
(
struct
work_struct
*
irq_work
)
{
struct
mt7697q_info
*
qinfo
=
container_of
(
irq_work
,
struct
mt7697q_info
,
irq_work
);
int
ret
;
dev_dbg
(
qinfo
->
dev
,
"%s(): process work
\n
"
,
__func__
);
ret
=
mt7697_irq_run
(
qinfo
);
ret
=
mt7697
q
_irq_run
(
qinfo
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): mt7697_irq_run() failed(%d)
\n
"
,
"%s(): mt7697
q
_irq_run() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
@@ -117,9 +117,9 @@ cleanup:
return
;
}
irqreturn_t
mt7697
_isr
(
int
irq
,
void
*
cookie
)
irqreturn_t
mt7697
q_isr
(
int
irq
,
void
*
arg
)
{
struct
mt7697q_info
*
qinfo
=
cookie
;
struct
mt7697q_info
*
qinfo
=
(
struct
mt7697q_info
*
)
arg
;
disable_irq_nosync
(
qinfo
->
irq
);
if
(
!
queue_work
(
qinfo
->
irq_workq
,
&
qinfo
->
irq_work
))
{
...
...
linux_kernel_modules/mt7697q/interrupt.h
View file @
bae6b7b8
...
...
@@ -14,12 +14,13 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _MT7697_INTERRUPT_H_
#define _MT7697_INTERRUPT_H_
#ifndef _MT7697_
SPI_QUEUE_
INTERRUPT_H_
#define _MT7697_
SPI_QUEUE_
INTERRUPT_H_
#include <linux/interrupt.h>
irqreturn_t
mt7697_isr
(
int
,
void
*
);
void
mt7697_irq_work
(
struct
work_struct
*
);
irqreturn_t
mt7697q_isr
(
int
,
void
*
);
void
mt7697q_irq_work
(
struct
work_struct
*
);
void
mt7697q_irq_delayed_work
(
struct
work_struct
*
);
#endif
linux_kernel_modules/mt7697q/queue.c
View file @
bae6b7b8
...
...
@@ -290,6 +290,40 @@ cleanup:
return
ret
;
}
static
int
mt7697q_wr_unused
(
struct
mt7697q_spec
*
qsM2S
,
struct
mt7697q_spec
*
qsS2M
)
{
struct
mt7697_queue_reset_req
req
;
int
ret
;
req
.
cmd
.
len
=
sizeof
(
struct
mt7697_queue_reset_req
);
req
.
cmd
.
grp
=
MT7697_CMD_GRP_QUEUE
;
req
.
cmd
.
type
=
MT7697_CMD_QUEUE_UNUSED
;
req
.
m2s_ch
=
qsM2S
->
ch
;
req
.
s2m_ch
=
qsS2M
->
ch
;
qsM2S
->
data
.
flags
&=
~
BF_GET
(
qsM2S
->
data
.
flags
,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET
,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH
);
qsS2M
->
data
.
flags
&=
~
BF_GET
(
qsS2M
->
data
.
flags
,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET
,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH
);
dev_dbg
(
qsM2S
->
qinfo
->
dev
,
"%s(): <-- QUEUE UNUSED(%u/%u)
\n
"
,
__func__
,
req
.
m2s_ch
,
req
.
s2m_ch
);
ret
=
mt7697q_write
(
qsM2S
,
(
const
u32
*
)
&
req
,
LEN_TO_WORD
(
req
.
cmd
.
len
));
if
(
ret
!=
LEN_TO_WORD
(
req
.
cmd
.
len
))
{
dev_err
(
qsM2S
->
qinfo
->
dev
,
"%s(): mt7697q_write() failed(%d != %d)
\n
"
,
__func__
,
ret
,
LEN_TO_WORD
(
req
.
cmd
.
len
));
ret
=
(
ret
<
0
)
?
ret
:-
EIO
;
goto
cleanup
;
}
ret
=
0
;
cleanup:
return
ret
;
}
__inline
size_t
mt7697q_get_free_words
(
const
struct
mt7697q_spec
*
qs
)
{
return
mt7697q_get_capacity
(
qs
)
-
mt7697q_get_num_words
(
qs
);
...
...
@@ -345,8 +379,8 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
avail
=
mt7697q_get_num_words
(
qsS2M
);
req
=
(
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
>
0
)
?
LEN_TO_WORD
(
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
))
:
LEN_TO_WORD
(
sizeof
(
struct
mt7697
q
_rsp_hdr
));
LEN_TO_WORD
(
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
))
:
LEN_TO_WORD
(
sizeof
(
struct
mt7697_rsp_hdr
));
dev_dbg
(
qsS2M
->
qinfo
->
dev
,
"%s(): avail(%u) len(%u) req(%u)
\n
"
,
__func__
,
avail
,
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
,
req
);
...
...
@@ -360,8 +394,8 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
goto
cleanup
;
}
avail
-=
LEN_TO_WORD
(
sizeof
(
struct
mt7697
q
_rsp_hdr
));
req
=
LEN_TO_WORD
(
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
));
avail
-=
LEN_TO_WORD
(
sizeof
(
struct
mt7697_rsp_hdr
));
req
=
LEN_TO_WORD
(
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
));
dev_dbg
(
qsS2M
->
qinfo
->
dev
,
"%s(): avail(%u) len(%u) req(%u)
\n
"
,
__func__
,
avail
,
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
,
req
);
}
...
...
@@ -404,7 +438,7 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
}
else
{
WARN_ON
(
!
qsS2M
->
rx_fcn
);
ret
=
qsS2M
->
rx_fcn
((
const
struct
mt7697
q
_rsp_hdr
*
)
&
qsS2M
->
qinfo
->
rsp
,
qsS2M
->
priv
);
ret
=
qsS2M
->
rx_fcn
((
const
struct
mt7697_rsp_hdr
*
)
&
qsS2M
->
qinfo
->
rsp
,
qsS2M
->
priv
);
if
(
ret
<
0
)
{
dev_err
(
qsS2M
->
qinfo
->
dev
,
"%s(): rx_fcn() failed(%d)
\n
"
,
...
...
@@ -414,7 +448,7 @@ int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
avail
-=
req
;
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
=
0
;
req
=
LEN_TO_WORD
(
sizeof
(
struct
mt7697
q
_rsp_hdr
));
req
=
LEN_TO_WORD
(
sizeof
(
struct
mt7697_rsp_hdr
));
dev_dbg
(
qsS2M
->
qinfo
->
dev
,
"%s(): avail(%u) len(%u) req(%u)
\n
"
,
__func__
,
avail
,
qsS2M
->
qinfo
->
rsp
.
cmd
.
len
,
req
);
...
...
@@ -453,44 +487,6 @@ __inline void mt7697q_unblock_writer(void *hndl)
EXPORT_SYMBOL
(
mt7697q_unblock_writer
);
int
mt7697q_wr_unused
(
void
*
tx_hndl
,
void
*
rx_hndl
)
{
struct
mt7697q_spec
*
qsM2S
=
(
struct
mt7697q_spec
*
)
tx_hndl
;
struct
mt7697q_spec
*
qsS2M
=
(
struct
mt7697q_spec
*
)
rx_hndl
;
struct
mt7697_queue_reset_req
req
;
int
ret
;
req
.
cmd
.
len
=
sizeof
(
struct
mt7697_queue_reset_req
);
req
.
cmd
.
grp
=
MT7697_CMD_GRP_QUEUE
;
req
.
cmd
.
type
=
MT7697_CMD_QUEUE_UNUSED
;
req
.
m2s_ch
=
qsM2S
->
ch
;
req
.
s2m_ch
=
qsS2M
->
ch
;
qsM2S
->
data
.
flags
&=
~
BF_GET
(
qsM2S
->
data
.
flags
,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET
,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH
);
qsS2M
->
data
.
flags
&=
~
BF_GET
(
qsS2M
->
data
.
flags
,
MT7697_QUEUE_FLAGS_IN_USE_OFFSET
,
MT7697_QUEUE_FLAGS_IN_USE_WIDTH
);
dev_dbg
(
qsM2S
->
qinfo
->
dev
,
"%s(): <-- QUEUE UNUSED(%u/%u)
\n
"
,
__func__
,
req
.
m2s_ch
,
req
.
s2m_ch
);
ret
=
mt7697q_write
(
qsM2S
,
(
const
u32
*
)
&
req
,
LEN_TO_WORD
(
req
.
cmd
.
len
));
if
(
ret
!=
LEN_TO_WORD
(
req
.
cmd
.
len
))
{
dev_err
(
qsM2S
->
qinfo
->
dev
,
"%s(): mt7697q_write() failed(%d != %d)
\n
"
,
__func__
,
ret
,
LEN_TO_WORD
(
req
.
cmd
.
len
));
ret
=
(
ret
<
0
)
?
ret
:-
EIO
;
goto
cleanup
;
}
ret
=
0
;
cleanup:
return
ret
;
}
EXPORT_SYMBOL
(
mt7697q_wr_unused
);
int
mt7697q_wr_reset
(
void
*
tx_hndl
,
void
*
rx_hndl
)
{
struct
mt7697q_spec
*
qsM2S
=
(
struct
mt7697q_spec
*
)
tx_hndl
;
...
...
@@ -646,6 +642,28 @@ cleanup:
EXPORT_SYMBOL
(
mt7697q_init
);
int
mt7697q_shutdown
(
void
**
tx_hndl
,
void
**
rx_hndl
)
{
struct
mt7697q_spec
*
qsM2S
=
*
tx_hndl
;
struct
mt7697q_spec
*
qsS2M
=
*
rx_hndl
;
int
ret
;
ret
=
mt7697q_wr_unused
(
qsM2S
,
qsS2M
);
if
(
ret
<
0
)
{
dev_err
(
qsM2S
->
qinfo
->
dev
,
"%s(): mt7697q_wr_unused() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
*
tx_hndl
=
NULL
;
*
rx_hndl
=
NULL
;
cleanup:
return
ret
;
}
EXPORT_SYMBOL
(
mt7697q_shutdown
);
size_t
mt7697q_read
(
void
*
hndl
,
u32
*
buf
,
size_t
num
)
{
struct
mt7697q_spec
*
qs
=
(
struct
mt7697q_spec
*
)
hndl
;
...
...
linux_kernel_modules/mt7697q/queue.h
View file @
bae6b7b8
...
...
@@ -54,7 +54,7 @@ struct mt7697q_spec {
struct
mt7697q_info
{
struct
mt7697q_spec
queues
[
MT7697_NUM_QUEUES
];
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
u8
txBuffer
[
sizeof
(
u32
)];
u8
rxBuffer
[
sizeof
(
u32
)];
...
...
@@ -68,14 +68,15 @@ struct mt7697q_info {
struct
work_struct
irq_work
;
struct
delayed_work
irq_delayed_work
;
atomic_t
blocked_writer
;
int
gpio_pin
;
int
irq
;
u8
s2m_mbox
;
bool
slave_busy
;
};
void
mt7697_irq_delayed_work
(
struct
work_struct
*
);
void
mt7697_irq_work
(
struct
work_struct
*
);
irqreturn_t
mt7697_isr
(
int
,
void
*
);
void
mt7697
q
_irq_delayed_work
(
struct
work_struct
*
);
void
mt7697
q
_irq_work
(
struct
work_struct
*
);
irqreturn_t
mt7697
q
_isr
(
int
,
void
*
);
int
mt7697q_blocked_writer
(
const
struct
mt7697q_spec
*
);
size_t
mt7697q_get_free_words
(
const
struct
mt7697q_spec
*
);
...
...
linux_kernel_modules/mt7697q/queue_i.h
View file @
bae6b7b8
...
...
@@ -17,13 +17,10 @@
#ifndef _MT7697_QUEUE_I_H_
#define _MT7697_QUEUE_I_H_
#define LEN32_ALIGNED(x) (((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0)) * sizeof(u32))
#define LEN_TO_WORD(x) ((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0))
#include "mt7697_i.h"
#define mt7697_queue_init_rsp mt7697
q
_rsp_hdr
#define mt7697_queue_reset_rsp mt7697
q
_rsp_hdr
#define mt7697_queue_init_rsp mt7697_rsp_hdr
#define mt7697_queue_reset_rsp mt7697_rsp_hdr
enum
mt7697q_dir
{
...
...
@@ -31,12 +28,6 @@ enum mt7697q_dir
MT7697_QUEUE_DIR_S2M
,
};
enum
mt7697q_cmd_grp
{
MT7697_CMD_GRP_QUEUE
=
0
,
MT7697_CMD_GRP_80211
,
MT7697_CMD_GRP_BT
,
};
enum
mt7697q_cmd_types
{
MT7697_CMD_QUEUE_INIT
=
0
,
MT7697_CMD_QUEUE_INIT_RSP
,
...
...
@@ -45,55 +36,33 @@ enum mt7697q_cmd_types {
MT7697_CMD_QUEUE_RESET_RSP
,
};
struct
mt7697q_cmd_hdr
{
__be16
len
;
u8
grp
;
u8
type
;
}
__attribute__
((
__packed__
,
aligned
(
4
)));
struct
mt7697q_rsp_hdr
{
struct
mt7697q_cmd_hdr
cmd
;
__be32
result
;
}
__attribute__
((
__packed__
,
aligned
(
4
)));
struct
mt7697_queue_init_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
m2s_ch
;
__be32
s2m_ch
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_queue_unused_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
m2s_ch
;
__be32
s2m_ch
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_queue_reset_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
m2s_ch
;
__be32
s2m_ch
;
}
__attribute__
((
packed
,
aligned
(
4
)));
typedef
int
(
*
rx_hndlr
)(
const
struct
mt7697q_rsp_hdr
*
,
void
*
);
typedef
int
(
*
notify_tx_hndlr
)(
void
*
,
u32
);
struct
mt7697q_if_ops
{
int
(
*
init
)(
u8
,
u8
,
void
*
,
notify_tx_hndlr
,
rx_hndlr
,
void
**
,
void
**
);
size_t
(
*
read
)(
void
*
,
u32
*
,
size_t
);
size_t
(
*
write
)(
void
*
,
const
u32
*
,
size_t
);
void
(
*
reset
)(
void
*
);
void
(
*
enable_irq
)(
void
*
);
void
(
*
disable_irq
)(
void
*
);
};
u32
mt7697q_flags_get_in_use
(
u32
);
u32
mt7697q_flags_get_dir
(
u32
);
int
mt7697q_init
(
u8
,
u8
,
void
*
,
notify_tx_hndlr
,
rx_hndlr
,
void
**
,
void
**
);
int
mt7697q_wr_reset
(
void
*
,
void
*
);
int
mt7697q_wr_unused
(
void
*
,
void
*
);
int
mt7697q_shutdown
(
void
**
,
void
**
);
size_t
mt7697q_read
(
void
*
,
u32
*
,
size_t
);
void
mt7697q_unblock_writer
(
void
*
);
size_t
mt7697q_write
(
void
*
,
const
u32
*
,
size_t
);
int
mt7697q_wr_reset
(
void
*
,
void
*
);
void
mt7697q_unblock_writer
(
void
*
);
#endif
linux_kernel_modules/mt7697q/spi.c
View file @
bae6b7b8
...
...
@@ -34,9 +34,9 @@ static int mt7697spi_write_then_read(struct spi_device *spi, const void *txbuf,
void
*
rxbuf
,
unsigned
len
)
{
struct
spi_transfer
transfer
=
{
.
tx_buf
=
txbuf
,
.
rx_buf
=
rxbuf
,
.
len
=
len
,
.
tx_buf
=
txbuf
,
.
rx_buf
=
rxbuf
,
.
len
=
len
,
};
return
spi_sync_transfer
(
spi
,
&
transfer
,
1
);
...
...
@@ -123,7 +123,7 @@ static int __init mt7697spi_init(void)
goto
cleanup
;
}
dev_info
(
&
master
->
dev
,
"%s():
init
dev('%s') mode(%d) max speed(%d) "
dev_info
(
&
master
->
dev
,
"%s(): dev('%s') mode(%d) max speed(%d) "
"CS(%d) bits/word(%d)
\n
"
,
__func__
,
spi
->
modalias
,
spi
->
mode
,
spi
->
max_speed_hz
,
spi
->
chip_select
,
spi
->
bits_per_word
);
...
...
@@ -143,8 +143,8 @@ static int __init mt7697spi_init(void)
qinfo
->
hw_ops
=
&
hw_ops
;
mutex_init
(
&
qinfo
->
mutex
);
INIT_DELAYED_WORK
(
&
qinfo
->
irq_delayed_work
,
mt7697_irq_delayed_work
);
INIT_WORK
(
&
qinfo
->
irq_work
,
mt7697_irq_work
);
INIT_DELAYED_WORK
(
&
qinfo
->
irq_delayed_work
,
mt7697
q
_irq_delayed_work
);
INIT_WORK
(
&
qinfo
->
irq_work
,
mt7697
q
_irq_work
);
qinfo
->
irq_workq
=
alloc_workqueue
(
DRVNAME
"wq"
,
WQ_HIGHPRI
|
WQ_MEM_RECLAIM
|
WQ_UNBOUND
,
1
);
...
...
@@ -155,17 +155,25 @@ static int __init mt7697spi_init(void)
goto
cleanup
;
}
ret
=
gpio_request
(
MT7697_SPI_INTR_GPIO_PIN
,
MT7697_GPIO_IRQ_NAME
);
qinfo
->
gpio_pin
=
MT7697_SPI_INTR_GPIO_PIN
;
ret
=
gpio_request
(
qinfo
->
gpio_pin
,
MT7697_SPI_GPIO_IRQ_NAME
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): gpio_request() failed(%d)"
,
__func__
,
ret
);
goto
failed_workqueue
;
if
(
ret
!=
-
EBUSY
)
{
dev_err
(
qinfo
->
dev
,
"%s(): gpio_request() failed(%d)"
,
__func__
,
ret
);
goto
failed_workqueue
;
}
qinfo
->
irq
=
gpio_to_irq
(
qinfo
->
gpio_pin
);
qinfo
->
gpio_pin
=
MT7697_SPI_INTR_GPIO_PIN_INVALID
;
}
else
{
gpio_direction_input
(
qinfo
->
gpio_pin
);
qinfo
->
irq
=
gpio_to_irq
(
qinfo
->
gpio_pin
);
}
gpio_direction_input
(
MT7697_SPI_INTR_GPIO_PIN
);
qinfo
->
irq
=
gpio_to_irq
(
MT7697_SPI_INTR_GPIO_PIN
);
dev_info
(
qinfo
->
dev
,
"%s(): request irq(%d)
\n
"
,
__func__
,
qinfo
->
irq
);
ret
=
request_irq
(
qinfo
->
irq
,
mt7697_isr
,
0
,
DRVNAME
,
qinfo
);
ret
=
request_irq
(
qinfo
->
irq
,
mt7697
q
_isr
,
0
,
DRVNAME
,
qinfo
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): request_irq() failed(%d)"
,
__func__
,
ret
);
...
...
@@ -183,7 +191,7 @@ failed_workqueue:
destroy_workqueue
(
qinfo
->
irq_workq
);
failed_gpio_req:
gpio_free
(
MT7697_SPI_INTR_GPIO_PIN
);
if
(
qinfo
->
gpio_pin
>
0
)
gpio_free
(
qinfo
->
gpio_pin
);
cleanup:
if
(
qinfo
)
kfree
(
qinfo
);
...
...
@@ -241,7 +249,7 @@ static void __exit mt7697spi_exit(void)
destroy_workqueue
(
qinfo
->
irq_workq
);
free_irq
(
qinfo
->
irq
,
qinfo
);
gpio_free
(
MT7697_SPI_INTR_GPIO_PIN
);
if
(
qinfo
->
gpio_pin
>
0
)
gpio_free
(
qinfo
->
gpio_pin
);
kfree
(
qinfo
);
cleanup:
...
...
linux_kernel_modules/mt7697q/spi.h
View file @
bae6b7b8
...
...
@@ -24,14 +24,15 @@
#include <linux/spi/spi.h>
#define DRVNAME "mt7697q"
#define MT7697_GPIO_IRQ_NAME "mt7697q irq"
#define DRVNAME
"mt7697q"
#define MT7697_
SPI_
GPIO_IRQ_NAME "mt7697q irq"
#define MT7697_SPI_INTR_GPIO_PIN 50
#define MT7697_SPI_BUS_NUM 32766
#define MT7697_SPI_CS 0
#define MT7697_SPI_INTR_GPIO_PIN 50
#define MT7697_SPI_INTR_GPIO_PIN_INVALID -1
#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"
#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
);
...
...
linux_kernel_modules/mt7697wifi/2-mt7697wifi_core.mdef
View file @
bae6b7b8
...
...
@@ -7,6 +7,11 @@ sources:
ioctl.c
}
params:
{
hw_itf = "spi"
}
cflags:
{
// -DDEBUG
...
...
@@ -17,5 +22,7 @@ cflags:
-DCONFIG_WEXT_PROC
-DCONFIG_WEXT_SPY
-DCONFIG_WEXT_PRIV
-I$MANGOH_ROOT/linux_kernel_modules/mt7697common
-I$MANGOH_ROOT/linux_kernel_modules/mt7697q
-I$MANGOH_ROOT/linux_kernel_modules/mt7697serial
}
linux_kernel_modules/mt7697wifi/cfg80211.c
View file @
bae6b7b8
...
...
@@ -1082,12 +1082,25 @@ int mt7697_cfg80211_stop(struct mt7697_vif *vif)
vif
->
cfg
->
radio_state
=
MT7697_RADIO_STATE_OFF
;
}
ret
=
mt7697q_wr_unused
(
vif
->
cfg
->
txq_hdl
,
vif
->
cfg
->
rxq_hdl
);
if
(
ret
<
0
)
{
dev_err
(
vif
->
cfg
->
dev
,
"%s(): mt7697q_wr_unused() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
if
(
vif
->
cfg
->
hif_ops
->
shutdown
)
{
ret
=
vif
->
cfg
->
hif_ops
->
shutdown
(
&
vif
->
cfg
->
txq_hdl
,
&
vif
->
cfg
->
rxq_hdl
);
if
(
ret
<
0
)
{
dev_err
(
vif
->
cfg
->
dev
,
"%s(): shutdown() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
}
else
{
ret
=
vif
->
cfg
->
hif_ops
->
close
(
vif
->
cfg
->
txq_hdl
);
if
(
ret
<
0
)
{
dev_err
(
vif
->
cfg
->
dev
,
"%s(): shutdown() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
vif
->
cfg
->
rxq_hdl
=
NULL
;
}
/* Stop netdev queues, needed during recovery */
...
...
linux_kernel_modules/mt7697wifi/core.h
View file @
bae6b7b8
...
...
@@ -19,6 +19,7 @@
#include <net/cfg80211.h>
#include <net/iw_handler.h>
/* New driver API */
#include "mt7697_i.h"
#include "wifi_api.h"
#include "wmi.h"
...
...
@@ -90,7 +91,7 @@ struct mt7697_cfg80211_info {
struct
semaphore
sem
;
struct
platform_device
*
hif_priv
;
const
struct
mt7697
q
_if_ops
*
hif_ops
;
const
struct
mt7697_if_ops
*
hif_ops
;
void
*
txq_hdl
;
void
*
rxq_hdl
;
...
...
@@ -219,7 +220,7 @@ int mt7697_notify_tx(void*, u32);
void
mt7697_tx_work
(
struct
work_struct
*
);
int
mt7697_data_tx
(
struct
sk_buff
*
,
struct
net_device
*
);
int
mt7697_rx_data
(
struct
mt7697_cfg80211_info
*
,
u32
,
u32
);
int
mt7697_proc_80211cmd
(
const
struct
mt7697
q
_rsp_hdr
*
,
void
*
);
int
mt7697_proc_80211cmd
(
const
struct
mt7697_rsp_hdr
*
,
void
*
);
void
mt7697_disconnect_timer_hndlr
(
unsigned
long
);
int
mt7697_disconnect
(
struct
mt7697_vif
*
);
...
...
linux_kernel_modules/mt7697wifi/main.c
View file @
bae6b7b8
...
...
@@ -18,17 +18,34 @@
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <net/cfg80211.h>
#include "mt7697_i.h"
#include "queue_i.h"
#include "uart_i.h"
#include "common.h"
#include "ioctl.h"
#include "core.h"
#include "cfg80211.h"
static
int
itf_idx_start
=
1
;
static
char
*
hw_itf
=
"spi"
;
module_param
(
hw_itf
,
charp
,
S_IRUGO
);
MODULE_PARM_DESC
(
hw_itf
,
"MT7697 transport interface (SPI/UART"
);
static
int
itf_idx_start
=
0
;
module_param
(
itf_idx_start
,
int
,
S_IRUGO
);
MODULE_PARM_DESC
(
itf_idx_start
,
"MT7697 interface start index"
);
MODULE_PARM_DESC
(
itf_idx_start
,
"MT7697
WiFi
interface start index"
);
static
struct
platform_device
*
pdev
=
NULL
;
static
void
mt7697_to_lower
(
char
**
in
)
{
char
*
ptr
=
(
char
*
)
*
in
;
while
(
*
ptr
!=
'\0'
)
{
if
(((
*
ptr
<=
'Z'
)
&&
(
*
ptr
>=
'A'
))
||
((
*
ptr
<=
'z'
)
&&
(
*
ptr
>=
'a'
)))
*
ptr
=
((
*
ptr
<=
'Z'
)
&&
(
*
ptr
>=
'A'
))
?
*
ptr
+
'a'
-
'A'
:*
ptr
;
ptr
++
;
}
}
static
int
mt7697_open
(
struct
net_device
*
ndev
)
{
...
...
@@ -127,18 +144,30 @@ static void mt7697_init_hw_start(struct work_struct *work)
struct
mt7697_cfg80211_info
*
cfg
=
container_of
(
work
,
struct
mt7697_cfg80211_info
,
init_work
);
int
err
;
if
(
!
strcmp
(
hw_itf
,
"spi"
))
{
dev_dbg
(
cfg
->
dev
,
"%s(): init mt7697 queue(%u/%u)
\n
"
,
__func__
,
MT7697_MAC80211_QUEUE_TX
,
MT7697_MAC80211_QUEUE_RX
);
err
=
cfg
->
hif_ops
->
init
(
MT7697_MAC80211_QUEUE_TX
,
MT7697_MAC80211_QUEUE_RX
,
cfg
,
mt7697_notify_tx
,
mt7697_proc_80211cmd
,
&
cfg
->
txq_hdl
,
&
cfg
->
rxq_hdl
);
if
(
err
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): queue(%u) init() failed(%d)
\n
"
,
__func__
,
MT7697_MAC80211_QUEUE_TX
,
err
);
goto
failed
;
}
}
else
{
dev_dbg
(
cfg
->
dev
,
"%s(): open mt7697 uart
\n
"
,
__func__
);
cfg
->
txq_hdl
=
cfg
->
hif_ops
->
open
(
mt7697_proc_80211cmd
,
cfg
);
if
(
!
cfg
->
txq_hdl
)
{
dev_err
(
cfg
->
dev
,
"%s(): open() failed
\n
"
,
__func__
);
goto
failed
;
}
dev_dbg
(
cfg
->
dev
,
"%s(): init mt7697 queue(%u/%u)
\n
"
,
__func__
,
MT7697_MAC80211_QUEUE_TX
,
MT7697_MAC80211_QUEUE_RX
);
err
=
cfg
->
hif_ops
->
init
(
MT7697_MAC80211_QUEUE_TX
,
MT7697_MAC80211_QUEUE_RX
,
cfg
,
mt7697_notify_tx
,
mt7697_proc_80211cmd
,
&
cfg
->
txq_hdl
,
&
cfg
->
rxq_hdl
);
if
(
err
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): queue(%u) init() failed(%d)
\n
"
,
__func__
,
MT7697_MAC80211_QUEUE_TX
,
err
);
goto
failed
;
cfg
->
rxq_hdl
=
cfg
->
txq_hdl
;
}
cfg
->
radio_state
=
MT7697_RADIO_STATE_OFF
;
...
...
@@ -180,11 +209,7 @@ void mt7697_init_netdev(struct net_device *ndev)
ndev
->
hw_features
|=
NETIF_F_IP_CSUM
|
NETIF_F_RXCSUM
;
}
static
const
struct
mt7697q_if_ops
if_ops
=
{
.
init
=
mt7697q_init
,
.
read
=
mt7697q_read
,
.
write
=
mt7697q_write
,
};
static
struct
mt7697_if_ops
if_ops
;
static
int
mt7697_probe
(
struct
platform_device
*
pdev
)
{
...
...
@@ -223,6 +248,29 @@ static int mt7697_probe(struct platform_device *pdev)
atomic_set
(
&
cfg
->
tx_skb_pool_idx
,
0
);
memset
(
cfg
->
tx_skb_pool
,
0
,
sizeof
(
cfg
->
tx_skb_pool
));
mt7697_to_lower
(
&
hw_itf
);
dev_dbg
(
&
pdev
->
dev
,
"%s(): hw_itf('%s')
\n
"
,
__func__
,
hw_itf
);
if
(
!
strcmp
(
hw_itf
,
"spi"
))
{
if_ops
.
init
=
mt7697q_init
;
if_ops
.
shutdown
=
mt7697q_shutdown
;
if_ops
.
read
=
mt7697q_read
;
if_ops
.
write
=
mt7697q_write
;
if_ops
.
unblock_writer
=
mt7697q_unblock_writer
;
}
else
if
(
!
strcmp
(
hw_itf
,
"uart"
))
{
if_ops
.
open
=
mt7697_uart_open
;
if_ops
.
close
=
mt7697_uart_close
;
if_ops
.
read
=
mt7697_uart_read
;
if_ops
.
write
=
mt7697_uart_write
;
}
else
{
dev_err
(
&
pdev
->
dev
,
"%s(): invalid hw itf(spi/uart) module paramter('%s')
\n
"
,
__func__
,
hw_itf
);
err
=
-
EINVAL
;
goto
failed
;
}
cfg
->
hif_ops
=
&
if_ops
;
cfg
->
dev
=
&
pdev
->
dev
;
skb_queue_head_init
(
&
cfg
->
tx_skb_queue
);
...
...
@@ -299,7 +347,7 @@ static int __init mt7697_init(void)
if
(
ret
)
{
pr_err
(
DRVNAME
" %s(): platform_driver_register() failed(%d)
\n
"
,
__func__
,
ret
);
platform_device_del
(
pdev
);
platform_device_del
(
&
mt7697_platform_device
);
goto
cleanup
;
}
...
...
linux_kernel_modules/mt7697wifi/scripts/interfaces
View file @
bae6b7b8
...
...
@@ -14,5 +14,5 @@ iface wlan0 inet manual
post-down /etc/init.d/tiwifi stop
iface wlan1 inet manual
pre-up /etc/init.d/mtwifi start 1
pre-up /etc/init.d/mtwifi start
uart
1
post-down /etc/init.d/mtwifi stop 1
linux_kernel_modules/mt7697wifi/scripts/mt7697_setup_wifi.sh
View file @
bae6b7b8
...
...
@@ -24,3 +24,4 @@ fi
echo
"Updating MT7697 WiFi init script..."
cp
/tmp/mtwifi /etc/init.d/mtwifi
chmod
+x /etc/init.d/mtwifi
linux_kernel_modules/mt7697wifi/scripts/mtwifi
View file @
bae6b7b8
...
...
@@ -7,29 +7,38 @@
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/flash/wifi
mt_wifi_start
()
{
stty
-F
/dev/ttyHS0 raw
||
exit
127
stty
-F
/dev/ttyHS0 921600
||
exit
127
stty
-F
/dev/ttyHS0 crtscts
||
exit
127
stty
-F
/dev/ttyHS0
-echo
||
exit
127
lsmod |
grep
2_mt7697wifi_core
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /legato/systems/current/modules/2-mt7697wifi_core.ko
itf_idx_start
=
$1
||
exit
127
echo
"Initialized MT7697
80211
core"
;
insmod /legato/systems/current/modules/2-mt7697wifi_core.ko
hw_itf
=
$1
itf_idx_start
=
$2
||
exit
127
echo
"Initialized MT7697
WiFi
core"
;
sleep
2
fi
ifconfig
-a
|
grep
wlan
$
1
>
/dev/null
ifconfig
-a
|
grep
wlan
$
2
>
/dev/null
if
[
$?
-ne
0
]
;
then
echo
"Failed to init MT7697
80211
core"
;
echo
"Failed to init MT7697
WiFi
core"
;
exit
127
fi
ifconfig wlan
$
1
up
>
/dev/null
ifconfig wlan
$
2
up
>
/dev/null
if
[
$?
-ne
0
]
;
then
echo
"Failed to start MT7697
80211
core"
;
echo
"Failed to start MT7697
WiFi
core"
;
exit
127
fi
fi
echo
"Started MT7697 WiFi
$1
core wlan
$2
"
;
}
mt_wifi_stop
()
{
kill
-9
$(
pidof wpa_supplicant
)
echo
"Stop MT7697 WiFi core wlan
$1
"
;
ifconfig |
grep
wlan
$1
>
/dev/null
if
[
$?
-eq
0
]
;
then
ifconfig wlan
$1
down
...
...
@@ -38,20 +47,20 @@ mt_wifi_stop() {
lsmod |
grep
2_mt7697wifi_core
>
/dev/null
if
[
$?
-eq
0
]
;
then
rmmod 2_mt7697wifi_core
||
exit
127
echo
"Removed MT7697
80211
core"
;
exit
127
echo
"Removed MT7697
WiFi
core"
;
exit
127
fi
}
case
"
$1
"
in
start
)
mt_wifi_start
$2
mt_wifi_start
$2
$3
;;
stop
)
mt_wifi_stop
$2
;;
restart
)
mt_wifi_stop
$2
mt_wifi_start
$2
mt_wifi_start
$2
$3
;;
*
)
exit
1
...
...
linux_kernel_modules/mt7697wifi/txrx.c
View file @
bae6b7b8
...
...
@@ -28,7 +28,7 @@ int mt7697_notify_tx(void* priv, u32 free)
struct
mt7697_tx_pkt
*
tx_pkt
=
list_entry
(
&
cfg
->
tx_skb_list
,
struct
mt7697_tx_pkt
,
next
);
if
(
tx_pkt
->
skb
->
len
>=
free
)
{
mt7697q_
unblock_writer
(
cfg
->
txq_hdl
);
cfg
->
hif_ops
->
unblock_writer
(
cfg
->
txq_hdl
);
ret
=
queue_work
(
cfg
->
tx_workq
,
&
cfg
->
tx_work
);
if
(
ret
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s(): queue_work() failed(%d)
\n
"
,
...
...
linux_kernel_modules/mt7697wifi/wmi.c
View file @
bae6b7b8
...
...
@@ -23,7 +23,7 @@
#include "cfg80211.h"
#include "wifi_api.h"
static
int
mt7697_proc_mac_addr
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_mac_addr
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
u8
addr
[
LEN32_ALIGNED
(
ETH_ALEN
)];
...
...
@@ -77,18 +77,18 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_get_wireless_mode
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_get_wireless_mode
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
u32
wireless_mode
;
int
ret
=
0
;
dev_dbg
(
cfg
->
dev
,
"%s(): --> WIRELESS MODE
\n
"
,
__func__
);
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
)
!=
sizeof
(
u32
))
{
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
)
!=
sizeof
(
u32
))
{
dev_err
(
cfg
->
dev
,
"%s(): invalid wireless mode rsp len(%u != %u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
),
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
),
sizeof
(
u32
));
ret
=
-
EINVAL
;
goto
cleanup
;
...
...
@@ -112,7 +112,7 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_get_cfg
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_get_cfg
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
struct
mt7697_wifi_config_t
*
wifi_cfg
;
...
...
@@ -120,11 +120,11 @@ static int mt7697_proc_get_cfg(const struct mt7697q_rsp_hdr* rsp,
int
ret
=
0
;
dev_dbg
(
cfg
->
dev
,
"%s(): --> CONFIG
\n
"
,
__func__
);
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
)
!=
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
)
!=
LEN32_ALIGNED
(
sizeof
(
struct
mt7697_wifi_config_t
)))
{
dev_err
(
cfg
->
dev
,
"%s(): invalid cfg rsp len(%u != %u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
),
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
),
LEN32_ALIGNED
(
sizeof
(
struct
mt7697_wifi_config_t
)));
ret
=
-
EINVAL
;
goto
cleanup
;
...
...
@@ -264,18 +264,18 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_get_radio_state
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_get_radio_state
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
u32
state
;
int
ret
=
0
;
dev_dbg
(
cfg
->
dev
,
"%s(): --> GET RADIO STATE
\n
"
,
__func__
);
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
)
!=
sizeof
(
u32
))
{
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
)
!=
sizeof
(
u32
))
{
dev_err
(
cfg
->
dev
,
"%s(): invalid get radio state rsp len(%u != %u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
),
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
),
sizeof
(
u32
));
ret
=
-
EINVAL
;
goto
cleanup
;
...
...
@@ -298,18 +298,18 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_get_listen_interval
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_get_listen_interval
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
u32
interval
;
int
ret
=
0
;
dev_dbg
(
cfg
->
dev
,
"%s(): --> GET LISTEN INTERVAL
\n
"
,
__func__
);
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
)
!=
sizeof
(
u32
))
{
if
(
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
)
!=
sizeof
(
u32
))
{
dev_err
(
cfg
->
dev
,
"%s(): invalid get listen interval rsp len(%u != %u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697
q
_rsp_hdr
),
rsp
->
cmd
.
len
-
sizeof
(
struct
mt7697_rsp_hdr
),
sizeof
(
u32
));
ret
=
-
EINVAL
;
goto
cleanup
;
...
...
@@ -332,7 +332,7 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_scan_ind
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_scan_ind
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
struct
ieee80211_mgmt
*
rx_mgmt_frame
;
...
...
@@ -471,7 +471,7 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_scan_rsp
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_scan_rsp
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
struct
mt7697_vif
*
vif
;
...
...
@@ -545,7 +545,7 @@ cleanup:
return
ret
;
}
static
int
mt7697_proc_connect_ind
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_proc_connect_ind
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
u8
bssid
[
LEN32_ALIGNED
(
ETH_ALEN
)];
...
...
@@ -759,17 +759,17 @@ cleanup:
return
ret
;
}
static
int
mt7697_rx_raw
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
static
int
mt7697_rx_raw
(
const
struct
mt7697_rsp_hdr
*
rsp
,
struct
mt7697_cfg80211_info
*
cfg
)
{
int
ret
;
dev_dbg
(
cfg
->
dev
,
"%s(): --> RX RAW(%u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
);
if
(
rsp
->
cmd
.
len
<=
sizeof
(
struct
mt7697
q
_rsp_hdr
))
{
if
(
rsp
->
cmd
.
len
<=
sizeof
(
struct
mt7697_rsp_hdr
))
{
dev_err
(
cfg
->
dev
,
"%s(): invalid rx raw len(%u <= %u)
\n
"
,
__func__
,
rsp
->
cmd
.
len
,
sizeof
(
struct
mt7697
q
_rsp_hdr
));
sizeof
(
struct
mt7697_rsp_hdr
));
ret
=
-
EINVAL
;
goto
cleanup
;
}
...
...
@@ -812,7 +812,7 @@ cleanup:
return
ret
;
}
int
mt7697_proc_80211cmd
(
const
struct
mt7697
q
_rsp_hdr
*
rsp
,
void
*
priv
)
int
mt7697_proc_80211cmd
(
const
struct
mt7697_rsp_hdr
*
rsp
,
void
*
priv
)
{
struct
mt7697_cfg80211_info
*
cfg
=
(
struct
mt7697_cfg80211_info
*
)
priv
;
int
ret
=
0
;
...
...
@@ -1545,7 +1545,7 @@ int mt7697_wr_tx_raw_packet(struct mt7697_cfg80211_info* cfg,
{
int
ret
;
cfg
->
tx_req
.
cmd
.
len
=
sizeof
(
struct
mt7697
q
_cmd_hdr
)
+
sizeof
(
len
)
+
len
;
cfg
->
tx_req
.
cmd
.
len
=
sizeof
(
struct
mt7697_cmd_hdr
)
+
sizeof
(
len
)
+
len
;
cfg
->
tx_req
.
len
=
len
;
WARN_ON
(
len
>
sizeof
(
cfg
->
tx_req
.
data
));
memcpy
(
cfg
->
tx_req
.
data
,
data
,
len
);
...
...
linux_kernel_modules/mt7697wifi/wmi.h
View file @
bae6b7b8
...
...
@@ -20,34 +20,34 @@
#include <linux/ieee80211.h>
#include <linux/if_ether.h>
#include "
queue
_i.h"
#include "
mt7697
_i.h"
#include "wifi_api.h"
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64
#define MT7697_PASSPHRASE_LEN 64
#define mt7697_cfg_req mt7697
q
_cmd_hdr
#define mt7697_get_radio_state_req mt7697
q
_cmd_hdr
#define mt7697_get_rx_filter_req mt7697
q
_cmd_hdr
#define mt7697_get_listen_interval_req mt7697
q
_cmd_hdr
#define mt7697_get_smart_conn_filter_req mt7697
q
_cmd_hdr
#define mt7697_scan_stop mt7697
q
_cmd_hdr
#define mt7697_set_wireless_mode_rsp mt7697
q
_rsp_hdr
#define mt7697_set_radio_state_rsp mt7697
q
_rsp_hdr
#define mt7697_set_op_mode_rsp mt7697
q
_rsp_hdr
#define mt7697_set_rx_filter_rsp mt7697
q
_rsp_hdr
#define mt7697_set_smart_conn_filter_rsp mt7697
q
_rsp_hdr
#define mt7697_set_listen_interval_rsp mt7697
q
_rsp_hdr
#define mt7697_set_pmk_rsp mt7697
q
_rsp_hdr
#define mt7697_set_channel_rsp mt7697
q
_rsp_hdr
#define mt7697_set_bssid_rsp mt7697
q
_rsp_hdr
#define mt7697_set_ssid_rsp mt7697
q
_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697
q
_rsp_hdr
#define mt7697_scan_stop_rsp mt7697
q
_rsp_hdr
#define mt7697_reload_settings_rsp mt7697
q
_rsp_hdr
#define mt7697_disconnect_rsp mt7697
q
_rsp_hdr
#define mt7697_cfg_req mt7697_cmd_hdr
#define mt7697_get_radio_state_req mt7697_cmd_hdr
#define mt7697_get_rx_filter_req mt7697_cmd_hdr
#define mt7697_get_listen_interval_req mt7697_cmd_hdr
#define mt7697_get_smart_conn_filter_req mt7697_cmd_hdr
#define mt7697_scan_stop mt7697_cmd_hdr
#define mt7697_set_wireless_mode_rsp mt7697_rsp_hdr
#define mt7697_set_radio_state_rsp mt7697_rsp_hdr
#define mt7697_set_op_mode_rsp mt7697_rsp_hdr
#define mt7697_set_rx_filter_rsp mt7697_rsp_hdr
#define mt7697_set_smart_conn_filter_rsp mt7697_rsp_hdr
#define mt7697_set_listen_interval_rsp mt7697_rsp_hdr
#define mt7697_set_pmk_rsp mt7697_rsp_hdr
#define mt7697_set_channel_rsp mt7697_rsp_hdr
#define mt7697_set_bssid_rsp mt7697_rsp_hdr
#define mt7697_set_ssid_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define mt7697_reload_settings_rsp mt7697_rsp_hdr
#define mt7697_disconnect_rsp mt7697_rsp_hdr
enum
mt7697_connect_ctrl_flags_bits
{
MT7697_CONNECT_ASSOC_POLICY_USER
=
0x0001
,
...
...
@@ -112,68 +112,68 @@ struct mt7697_cfg80211_info;
struct
cfg80211_scan_request
;
struct
mt7697_mac_addr_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_mac_addr_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
u8
addr
[
LEN32_ALIGNED
(
ETH_ALEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_wireless_mode_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_wireless_mode_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
mode
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_wireless_mode_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
__be32
mode
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_cfg_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
struct
mt7697_wifi_config_t
cfg
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_op_mode_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
opmode
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_radio_state_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
state
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_radio_state_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
state
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_listen_interval_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
interval
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_listen_interval_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
interval
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_reload_settings_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
if_idx
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_scan_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
if_idx
;
__be32
mode
;
__be32
option
;
...
...
@@ -184,93 +184,93 @@ struct mt7697_scan_req {
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_scan_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_scan_ind
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
rssi
;
__be32
channel
;
u8
probe_rsp
[];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_scan_complete_ind
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_pmk_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
u8
pmk
[
LEN32_ALIGNED
(
MT7697_WIFI_LENGTH_PMK
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_channel_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
__be32
ch
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_bssid_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
u8
bssid
[
LEN32_ALIGNED
(
ETH_ALEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_ssid_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
__be32
len
;
u8
ssid
[
LEN32_ALIGNED
(
IEEE80211_MAX_SSID_LEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_security_mode_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
__be32
auth_mode
;
__be32
encrypt_type
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_security_mode_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
if_idx
;
__be32
port
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_security_mode_rsp
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
__be32
auth_mode
;
__be32
encrypt_type
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_connect_ind
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
__be32
channel
;
u8
bssid
[
LEN32_ALIGNED
(
ETH_ALEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_disconnect_req
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
u8
addr
[
LEN32_ALIGNED
(
ETH_ALEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_disconnect_ind
{
struct
mt7697
q
_rsp_hdr
rsp
;
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
u8
bssid
[
LEN32_ALIGNED
(
ETH_ALEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_tx_raw_packet
{
struct
mt7697
q
_cmd_hdr
cmd
;
struct
mt7697_cmd_hdr
cmd
;
__be32
len
;
u8
data
[
LEN32_ALIGNED
(
IEEE80211_MAX_FRAME_LEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_rx_raw_packet
{
struct
mt7697
q
_rsp_hdr
hdr
;
struct
mt7697_rsp_hdr
hdr
;
u8
data
[];
}
__attribute__
((
packed
,
aligned
(
4
)));
...
...
mangOH_Red.sdef
View file @
bae6b7b8
...
...
@@ -66,6 +66,7 @@ kernelModules:
$MANGOH_ROOT/linux_kernel_modules/bmi160/4-bmi160-i2c
$MANGOH_ROOT/linux_kernel_modules/mt7697q/1-mt7697q
$MANGOH_ROOT/linux_kernel_modules/mt7697serial/1-mt7697serial
$MANGOH_ROOT/linux_kernel_modules/mt7697wifi/2-mt7697wifi_core
// spisvc creates a spidev device which will appear as /dev/spidev0.0 once the spidev module is
...
...
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