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
3b911ff1
Commit
3b911ff1
authored
Jun 28, 2017
by
David Clark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates after getting WiFi connect and data transfer working
parent
6e818594
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
310 additions
and
153 deletions
+310
-153
interrupt.c
linux_kernel_modules/mt7697q/interrupt.c
+12
-5
mt7697q.mdef
linux_kernel_modules/mt7697q/mt7697q.mdef
+1
-1
queue.c
linux_kernel_modules/mt7697q/queue.c
+37
-40
spi.c
linux_kernel_modules/mt7697q/spi.c
+67
-29
spi.h
linux_kernel_modules/mt7697q/spi.h
+1
-1
cfg80211.c
linux_kernel_modules/mt7697wifi/cfg80211.c
+0
-0
core.h
linux_kernel_modules/mt7697wifi/core.h
+12
-6
main.c
linux_kernel_modules/mt7697wifi/main.c
+15
-8
mtwifi
linux_kernel_modules/mt7697wifi/scripts/mtwifi
+12
-9
txrx.c
linux_kernel_modules/mt7697wifi/txrx.c
+45
-0
wmi.c
linux_kernel_modules/mt7697wifi/wmi.c
+0
-0
wmi.h
linux_kernel_modules/mt7697wifi/wmi.h
+84
-47
mangOH_Red.sdef
mangOH_Red.sdef
+24
-7
No files found.
linux_kernel_modules/mt7697q/interrupt.c
View file @
3b911ff1
...
...
@@ -144,7 +144,8 @@ void mt7697_irq_work(struct work_struct *irq_work)
ret
=
mt7697io_rd_s2m_mbx
(
qinfo
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): mt7697io_rd_s2m_mbx() failed(%d)
\n
"
,
__func__
,
ret
);
dev_err
(
qinfo
->
dev
,
"%s(): mt7697io_rd_s2m_mbx() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
@@ -154,7 +155,8 @@ void mt7697_irq_work(struct work_struct *irq_work)
ret
=
mt7697io_clr_s2m_mbx
(
qinfo
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): mt7697io_clr_s2m_mbx() failed(%d)
\n
"
,
__func__
,
ret
);
"%s(): mt7697io_clr_s2m_mbx() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
@@ -167,26 +169,31 @@ void mt7697_irq_work(struct work_struct *irq_work)
if
(
in_use
&&
(
dir
==
MT7697_QUEUE_DIR_SLAVE_TO_MASTER
))
{
WARN_ON
(
!
qs
->
rx_fcn
);
mutex_unlock
(
&
qinfo
->
mutex
);
ret
=
qs
->
rx_fcn
(
qs
->
priv
);
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): rx_fcn() failed(%d)
\n
"
,
__func__
,
ret
);
}
mutex_lock
(
&
qinfo
->
mutex
);
}
else
if
(
!
in_use
)
{
dev_warn
(
qinfo
->
dev
,
"%s(): unused channel(%d)
\n
"
,
__func__
,
ch
);
"%s(): unused channel(%d)
\n
"
,
__func__
,
ch
);
}
}
}
cleanup:
ret
=
queue_delayed_work
(
qinfo
->
irq_workq
,
&
qinfo
->
irq_work
,
msecs_to_jiffies
(
100
0
));
msecs_to_jiffies
(
100
));
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): queue_delayed_work() failed(%d)
\n
"
,
__func__
,
ret
);
"%s(): queue_delayed_work() failed(%d)
\n
"
,
__func__
,
ret
);
}
mutex_unlock
(
&
qinfo
->
mutex
);
...
...
linux_kernel_modules/mt7697q/mt7697q.mdef
View file @
3b911ff1
...
...
@@ -8,6 +8,6 @@ sources:
cflags:
{
-DDEBUG
//
-DDEBUG
}
linux_kernel_modules/mt7697q/queue.c
View file @
3b911ff1
...
...
@@ -121,29 +121,34 @@ void* mt7697q_init(u8 ch, void *priv, rx_hndlr rx_fcn)
}
snprintf
(
str
,
sizeof
(
str
),
"%s.%u"
,
dev_name
(
&
master
->
dev
),
MT7697_SPI_CS
);
pr_info
(
DRVNAME
" find SPI device('%s')
\n
"
,
str
);
dev_dbg
(
&
master
->
dev
,
"%s(): find SPI device('%s')
\n
"
,
__func__
,
str
);
dev
=
bus_find_device_by_name
(
&
spi_bus_type
,
NULL
,
str
);
if
(
!
dev
)
{
pr_err
(
DRVNAME
" '%s' bus_find_device_by_name() failed
\n
"
,
str
);
dev_err
(
&
master
->
dev
,
"%s(): '%s' bus_find_device_by_name() failed
\n
"
,
__func__
,
str
);
goto
cleanup
;
}
spi
=
container_of
(
dev
,
struct
spi_device
,
dev
);
if
(
!
spi
)
{
pr_err
(
DRVNAME
" get SPI device failed
\n
"
);
dev_err
(
&
master
->
dev
,
"%s(): get SPI device failed
\n
"
,
__func__
);
goto
cleanup
;
}
qinfo
=
spi_get_drvdata
(
spi
);
if
(
!
qinfo
)
{
pr_err
(
DRVNAME
" spi_get_drvdata() failed
\n
"
);
dev_dbg
(
&
master
->
dev
,
"%s(): spi_get_drvdata() failed
\n
"
,
__func__
);
goto
cleanup
;
}
pr_info
(
DRVNAME
" init queue(%u)
\n
"
,
ch
);
dev_dbg
(
&
master
->
dev
,
"%s(): init queue(%u)
\n
"
,
__func__
,
ch
);
if
(
ch
>=
MT7697_NUM_QUEUES
)
{
pr_err
(
DRVNAME
" invalid queue(%u)
\n
"
,
ch
);
dev_err
(
&
master
->
dev
,
"%s(): invalid queue(%u)
\n
"
,
__func__
,
ch
);
goto
cleanup
;
}
...
...
@@ -155,47 +160,38 @@ void* mt7697q_init(u8 ch, void *priv, rx_hndlr rx_fcn)
mutex_lock
(
&
qinfo
->
mutex
);
/* TODO: Remove when CP2130 working */
while
(
1
)
{
pr_info
(
DRVNAME
" base(0x%08x)
\n
"
,
MT7697_IO_SLAVE_BUFFER_ADDRESS
+
ch
*
sizeof
(
struct
mt7697q_data
));
ret
=
mt7697io_rd
(
qinfo
,
MT7697_IO_SLAVE_BUFFER_ADDRESS
+
ch
*
sizeof
(
struct
mt7697q_data
),
(
u32
*
)
&
qs
->
data
,
MT7697_QUEUE_LEN_TO_WORD
(
sizeof
(
struct
mt7697q_data
)));
if
(
ret
<
0
)
{
pr_err
(
DRVNAME
" mt7697io_rd() failed(%d)
\n
"
,
ret
);
goto
failed_rd
;
}
if
((
ch
==
0
)
&&
(
qs
->
data
.
flags
==
0x04000001
)
&&
!
qs
->
data
.
rd_offset
&&
!
qs
->
data
.
wr_offset
&&
(
qs
->
data
.
base_addr
==
0x20005ec4
))
break
;
else
if
((
ch
==
1
)
&&
(
qs
->
data
.
flags
==
0x04000002
)
&&
!
qs
->
data
.
rd_offset
&&
!
qs
->
data
.
wr_offset
&&
(
qs
->
data
.
base_addr
==
0x20006ed4
))
break
;
}
ret
=
mt7697io_rd
(
qinfo
,
MT7697_IO_SLAVE_BUFFER_ADDRESS
+
ch
*
sizeof
(
struct
mt7697q_data
),
(
u32
*
)
&
qs
->
data
,
MT7697_QUEUE_LEN_TO_WORD
(
sizeof
(
struct
mt7697q_data
)));
if
(
ret
<
0
)
{
dev_err
(
&
master
->
dev
,
"%s(): mt7697io_rd() failed(%d)
\n
"
,
__func__
,
ret
);
goto
failed_rd
;
}
pr_info
(
DRVNAME
" flags(0x%08x)
\n
"
,
qs
->
data
.
flags
);
pr_info
(
DRVNAME
" base_addr(0x%08x)
\n
"
,
qs
->
data
.
base_addr
);
pr_info
(
DRVNAME
" rd_offset(0x%08x)
\n
"
,
qs
->
data
.
rd_offset
);
pr_info
(
DRVNAME
" wr_offset(0x%08x)
\n
"
,
qs
->
data
.
wr_offset
);
dev_dbg
(
&
master
->
dev
,
"%s(): flags(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
flags
);
dev_dbg
(
&
master
->
dev
,
"%s(): base_addr(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
base_addr
);
dev_dbg
(
&
master
->
dev
,
"%s(): rd_offset(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
rd_offset
);
dev_dbg
(
&
master
->
dev
,
"%s(): wr_offset(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
wr_offset
);
if
(
!
qs
->
data
.
base_addr
)
{
pr_err
(
DRVNAME
"
invalid base address(0x%08x)
\n
"
,
qs
->
data
.
base_addr
);
dev_err
(
&
master
->
dev
,
"%s():
invalid base address(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
base_addr
);
goto
failed_rd
;
}
else
if
(
!
qs
->
data
.
flags
)
{
pr_err
(
DRVNAME
"
invalid flags(0x%08x)
\n
"
,
qs
->
data
.
flags
);
dev_err
(
&
master
->
dev
,
"%s():
invalid flags(0x%08x)
\n
"
,
__func__
,
qs
->
data
.
flags
);
goto
failed_rd
;
}
else
if
(
qs
->
data
.
rd_offset
||
qs
->
data
.
wr_offset
)
{
pr_err
(
DRVNAME
" invalid rd/wr offset(0x%08x/0x%08x)
\n
"
,
qs
->
data
.
rd_offset
,
qs
->
data
.
wr_offset
);
dev_err
(
&
master
->
dev
,
"%s(): invalid rd/wr offset(0x%08x/0x%08x)
\n
"
,
__func__
,
qs
->
data
.
rd_offset
,
qs
->
data
.
wr_offset
);
goto
failed_rd
;
}
...
...
@@ -389,7 +385,8 @@ size_t mt7697q_write(void *hndl, const u32 *buff, size_t num)
ret
=
mt7697q_push_wr_ptr
(
qs
);
if
(
ret
<
0
)
{
dev_err
(
qs
->
qinfo
->
dev
,
"%s(): mt7697q_push_wr_ptr() failed(%d)
\n
"
,
ret
);
"%s(): mt7697q_push_wr_ptr() failed(%d)
\n
"
,
__func__
,
ret
);
goto
cleanup
;
}
...
...
linux_kernel_modules/mt7697q/spi.c
View file @
3b911ff1
...
...
@@ -53,11 +53,36 @@ static const struct mt7697spi_hw_ops hw_ops =
.
disable_irq
=
mt7697spi_disable_irq
,
};
static
int
mt7697spi_probe
(
struct
spi_device
*
spi
)
static
int
__init
mt7697spi_init
(
void
)
{
char
str
[
32
];
struct
spi_master
*
master
;
struct
device
*
dev
;
struct
spi_device
*
spi
;
struct
mt7697q_info
*
qinfo
;
int
ret
=
0
;
master
=
spi_busnum_to_master
(
MT7697_SPI_BUS_NUM
);
if
(
!
master
)
{
pr_err
(
DRVNAME
" spi_busnum_to_master(%d) failed
\n
"
,
MT7697_SPI_BUS_NUM
);
goto
cleanup
;
}
snprintf
(
str
,
sizeof
(
str
),
"%s.%u"
,
dev_name
(
&
master
->
dev
),
MT7697_SPI_CS
);
pr_info
(
DRVNAME
" find SPI device('%s')
\n
"
,
str
);
dev
=
bus_find_device_by_name
(
&
spi_bus_type
,
NULL
,
str
);
if
(
!
dev
)
{
pr_err
(
DRVNAME
" '%s' bus_find_device_by_name() failed
\n
"
,
str
);
goto
cleanup
;
}
spi
=
container_of
(
dev
,
struct
spi_device
,
dev
);
if
(
!
spi
)
{
pr_err
(
DRVNAME
" get SPI device failed
\n
"
);
goto
cleanup
;
}
pr_info
(
DRVNAME
" init dev('%s') mode(%d) max speed(%d) "
"CS(%d) GPIO(%d) bits/word(%d)
\n
"
,
spi
->
modalias
,
spi
->
mode
,
spi
->
max_speed_hz
,
spi
->
chip_select
,
...
...
@@ -85,11 +110,11 @@ static int mt7697spi_probe(struct spi_device *spi)
goto
cleanup
;
}
/* TODO: revove after CP2130 working */
INIT_DELAYED_WORK
(
&
qinfo
->
irq_work
,
mt7697_irq_work
);
// INIT_WORK(&qinfo->irq_work, mt7697_irq_work);
qinfo
->
irq
=
spi
->
irq
;
dev_info
(
qinfo
->
dev
,
"%s(): '%s' request irq(%d)
\n
"
,
__func__
,
spi
->
modalias
,
spi
->
irq
);
dev_info
(
qinfo
->
dev
,
"'%s' request irq(%d)
\n
"
,
spi
->
modalias
,
spi
->
irq
);
/* ret = request_irq(spi->irq, mt7697_irq,
IRQF_SHARED| IRQF_NO_SUSPEND, spi->modalias, qinfo);
if (ret < 0) {
...
...
@@ -99,12 +124,12 @@ static int mt7697spi_probe(struct spi_device *spi)
*/
spi_set_drvdata
(
spi
,
qinfo
);
/* TODO: revove after CP2130 working */
ret
=
queue_delayed_work
(
qinfo
->
irq_workq
,
&
qinfo
->
irq_work
,
msecs_to_jiffies
(
1000
));
if
(
ret
<
0
)
{
dev_err
(
qinfo
->
dev
,
"%s(): queue_delayed_work() failed(%d)
\n
"
,
__func__
,
ret
);
"queue_delayed_work() failed(%d)
\n
"
,
ret
);
}
return
0
;
...
...
@@ -116,37 +141,50 @@ cleanup:
return
ret
;
}
static
int
mt7697spi_remove
(
struct
spi_device
*
spi
)
static
void
__exit
mt7697spi_exit
(
void
)
{
struct
mt7697q_info
*
qinfo
=
spi_get_drvdata
(
spi
);
if
(
qinfo
)
{
dev_info
(
qinfo
->
dev
,
"%s(): remove
\n
"
,
__func__
);
free_irq
(
spi
->
irq
,
qinfo
);
kfree
(
qinfo
);
}
char
str
[
32
];
struct
spi_master
*
master
;
struct
device
*
dev
;
struct
spi_device
*
spi
;
struct
mt7697q_info
*
qinfo
;
return
0
;
}
master
=
spi_busnum_to_master
(
MT7697_SPI_BUS_NUM
);
if
(
!
master
)
{
pr_err
(
DRVNAME
" spi_busnum_to_master(%d) failed
\n
"
,
MT7697_SPI_BUS_NUM
);
goto
cleanup
;
}
static
const
struct
of_device_id
dt_ids
[]
=
{
{
.
compatible
=
"MediaTek,mt7697"
},
{},
};
snprintf
(
str
,
sizeof
(
str
),
"%s.%u"
,
dev_name
(
&
master
->
dev
),
MT7697_SPI_CS
);
pr_info
(
DRVNAME
" find SPI device('%s')
\n
"
,
str
);
dev
=
bus_find_device_by_name
(
&
spi_bus_type
,
NULL
,
str
);
if
(
!
dev
)
{
pr_err
(
DRVNAME
" '%s' bus_find_device_by_name() failed
\n
"
,
str
);
goto
cleanup
;
}
MODULE_DEVICE_TABLE
(
of
,
dt_ids
);
spi
=
container_of
(
dev
,
struct
spi_device
,
dev
);
if
(
!
spi
)
{
pr_err
(
DRVNAME
" get SPI device failed
\n
"
);
goto
cleanup
;
}
static
struct
spi_driver
mt7697spi_driver
=
{
.
driver
=
{
.
name
=
DRVNAME
,
.
owner
=
THIS_MODULE
,
.
of_match_table
=
of_match_ptr
(
dt_ids
),
},
qinfo
=
spi_get_drvdata
(
spi
);
if
(
qinfo
)
{
dev_info
(
qinfo
->
dev
,
"remove
\n
"
);
flush_workqueue
(
qinfo
->
irq_workq
);
destroy_workqueue
(
qinfo
->
irq_workq
);
// free_irq(spi->irq, qinfo);
kfree
(
qinfo
);
}
.
probe
=
mt7697spi_probe
,
.
remove
=
mt7697spi_remove
,
}
;
cleanup:
return
;
}
module_spi_driver
(
mt7697spi_driver
)
module_init
(
mt7697spi_init
);
module_exit
(
mt7697spi_exit
);
MODULE_AUTHOR
(
"Sierra Wireless Corporation"
);
MODULE_LICENSE
(
"GPL"
);
...
...
linux_kernel_modules/mt7697q/spi.h
View file @
3b911ff1
...
...
@@ -24,7 +24,7 @@
#include <linux/spi/spi.h>
#define DRVNAME "mt7697"
#define DRVNAME "mt7697
q
"
#define MT7697_SPI_BUS_NUM 32766
#define MT7697_SPI_CS 0
...
...
linux_kernel_modules/mt7697wifi/cfg80211.c
View file @
3b911ff1
This diff is collapsed.
Click to expand it.
linux_kernel_modules/mt7697wifi/core.h
View file @
3b911ff1
...
...
@@ -27,15 +27,17 @@
#define MT7697_MAC80211_QUEUE_TX 0
#define MT7697_MAC80211_QUEUE_RX 1
#define MT7697_CH_MAX_2G_CHANNEL 14
/* Max channel in 2G band */
#define MT7697_CH_MAX_2G_CHANNEL 14
#define MT7697_CH_MIN_5G_CHANNEL 34
#define MT7697_CH_MAX_5G_CHANNEL 216
#define MT7697_SCAN_MAX_ITEMS 16
#define MT7697_IFACE_MAX_CNT 2
#define MT7697_MAX_MC_FILTERS_PER_LIST 7
#define MT7697_MAX_COOKIE_NUM 180
#define MT7697_TX_TIMEOUT 10
#define MT7697_DISCON_TIMER_INTVAL 10000
/* in msec */
/* TODO update below */
#define MT7697_DISCON_TIMER_INTVAL_MSEC (300 * 1000)
#define MT7697_KEY_SEQ_LEN 8
#define MT7697_MAX_KEY_INDEX 3
...
...
@@ -97,19 +99,21 @@ struct mt7697_cfg80211_info {
struct
mt7697_cookie
cookie_mem
[
MT7697_MAX_COOKIE_NUM
];
struct
work_struct
tx_work
;
u8
tx_data
[
IEEE80211_MAX_DATA_LEN
]
;
u8
rx_data
[
IEEE80211_MAX_DATA_LEN
];
u8
probe_data
[
IEEE80211_MAX_DATA_LEN
];
struct
mt7697_tx_raw_packet
tx_req
;
u8
rx_data
[
MT7697_LEN32_ALIGNED
(
IEEE80211_MAX_FRAME_LEN
)
];
u8
probe_data
[
MT7697_LEN32_ALIGNED
(
IEEE80211_MAX_DATA_LEN
)
];
struct
mt7697_rsp_hdr
rsp
;
enum
mt7697_radio_state
radio_state
;
enum
mt7697_wifi_phy_mode_t
wireless_mode
;
enum
mt7697_wifi_phy_mode_t
hw_wireless_mode
;
struct
mac_address
mac_addr
;
struct
mt7697_wifi_config_t
wifi_config
;
int
listen_interval
;
enum
mt7697_wifi_rx_filter_t
rx_filter
;
u8
pmkid
[
MT7697_WIFI_LENGTH_PMK
];
u8
smart_conn_filter
;
u8
psk
[
MT7697_PASSPHRASE_LEN
];
struct
list_head
vif_list
;
spinlock_t
vif_list_lock
;
...
...
@@ -191,10 +195,12 @@ static inline struct mt7697_vif *mt7697_vif_from_wdev(struct wireless_dev *wdev)
void
mt7697_init_netdev
(
struct
net_device
*
);
struct
mt7697_vif
*
mt7697_get_vif_by_idx
(
struct
mt7697_cfg80211_info
*
,
u8
);
struct
wireless_dev
*
mt7697_interface_add
(
struct
mt7697_cfg80211_info
*
,
const
char
*
,
enum
nl80211_iftype
,
u8
fw_vif_idx
);
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
);
void
mt7697_disconnect_timer_hndlr
(
unsigned
long
);
int
mt7697_disconnect
(
struct
mt7697_vif
*
);
...
...
linux_kernel_modules/mt7697wifi/main.c
View file @
3b911ff1
...
...
@@ -146,6 +146,14 @@ static void mt7697_init_hw_start(struct work_struct *work)
goto
failed
;
}
err
=
mt7697_send_get_smart_conn_filter_req
(
cfg
);
if
(
err
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s: mt7697_send_get_smart_conn_filter_req() failed(%d)
\n
"
,
__func__
,
err
);
goto
failed
;
}
err
=
mt7697_send_get_listen_interval_req
(
cfg
);
if
(
err
<
0
)
{
dev_err
(
cfg
->
dev
,
...
...
@@ -162,9 +170,9 @@ static void mt7697_init_hw_start(struct work_struct *work)
goto
failed
;
}
err
=
mt7697_send_get_p
m
k_req
(
cfg
,
MT7697_PORT_STA
);
err
=
mt7697_send_get_p
s
k_req
(
cfg
,
MT7697_PORT_STA
);
if
(
err
<
0
)
{
dev_err
(
cfg
->
dev
,
"%s: mt7697_send_get_p
m
k_req() failed(%d)
\n
"
,
dev_err
(
cfg
->
dev
,
"%s: mt7697_send_get_p
s
k_req() failed(%d)
\n
"
,
__func__
,
err
);
goto
failed
;
}
...
...
@@ -369,8 +377,8 @@ int mt7697_disconnect(struct mt7697_vif *vif)
NULL
);
if
(
ret
<
0
)
{
dev_err
(
vif
->
cfg
->
dev
,
"mt7697_send_disconnect_req() failed(%d)
\n
"
,
ret
);
"
%s:
mt7697_send_disconnect_req() failed(%d)
\n
"
,
__func__
,
ret
);
goto
failed
;
}
...
...
@@ -402,7 +410,6 @@ struct mt7697_cookie *mt7697_alloc_cookie(struct mt7697_cfg80211_info *cfg)
void
mt7697_free_cookie
(
struct
mt7697_cfg80211_info
*
cfg
,
struct
mt7697_cookie
*
cookie
)
{
/* Insert first */
if
(
!
cfg
||
!
cookie
)
return
;
...
...
@@ -411,7 +418,7 @@ void mt7697_free_cookie(struct mt7697_cfg80211_info *cfg, struct mt7697_cookie *
cfg
->
cookie_count
++
;
}
MODULE_AUTHOR
(
"Sierra Wireless Corporation"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_DESCRIPTION
(
"MediaTek7697 WiFi 80211"
);
MODULE_AUTHOR
(
"Sierra Wireless Corporation"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_DESCRIPTION
(
"MediaTek7697 WiFi 80211"
);
linux_kernel_modules/mt7697wifi/scripts/mtwifi
View file @
3b911ff1
...
...
@@ -8,46 +8,49 @@
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp
mt_wifi_start
()
{
# insmod /tmp/spisvc.ko || exit 127
lsmod |
grep
spi-cp2130
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /tmp/spi-cp2130.ko
||
exit
127
for
f
in
`
ls
-d
/sys/class/gpio/gpiochip
*
`
;
do
echo
$f
`
cat
$f
/label
$f
/base
$f
/ngpio
`
;
done
echo
-n
0,2,6,0,0,1,2,0,0,0,0,mt7697
>
/sys/devices/platform/msm_hsic_host/usb1/1-1/1-1.
3/1-1.3
:1.0/channel_config
echo
-n
0,2,6,0,0,1,2,0,0,0,0,mt7697
>
/sys/devices/platform/msm_hsic_host/usb1/1-1/1-1.
1/1-1.1
:1.0/channel_config
fi
lsmod |
grep
cfg80211
>
/dev/null
if
[
$?
-eq
1
]
;
then
# modprobe cfg80211 || exit 127
insmod /tmp/cfg80211.ko
||
exit
127
fi
lsmod |
grep
cfg
80211
>
/dev/null
lsmod |
grep
mac
80211
>
/dev/null
if
[
$?
-eq
1
]
;
then
# modprobe mac80211 || exit 127
insmod /tmp/mac80211.ko
||
exit
127
fi
lsmod |
grep
mt7697q
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /tmp/mt7697q.ko
||
exit
127
echo
"Initialized MT7697 queues"
;
exit
127
echo
"Initialized MT7697 queues"
;
fi
lsmod |
grep
mt7697wifi_core
>
/dev/null
if
[
$?
-eq
1
]
;
then
insmod /tmp/mt7697wifi_core.ko
||
exit
127
echo
"Initialized MT7697 80211 core"
;
exit
127
echo
"Initialized MT7697 80211 core"
;
sleep
2
fi
ifconfig
-a
|
grep
wlan0
>
/dev/null
if
[
$?
-ne
0
]
;
then
echo
"Failed to init MT7697 80211 core"
;
exit
127
echo
"Failed to init MT7697 80211 core"
;
exit
127
fi
ifconfig wlan0 up
>
/dev/null
if
[
$?
-ne
0
]
;
then
echo
"Failed to start MT7697 80211 core"
;
exit
127
fi
echo
"Failed to start MT7697 80211 core"
;
exit
127
fi
/tmp/wpa_supplicant
-i
wlan0
-D
wext
-c
/etc/swi-mobile
-B
}
mt_wifi_stop
()
{
...
...
linux_kernel_modules/mt7697wifi/txrx.c
View file @
3b911ff1
...
...
@@ -14,6 +14,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/etherdevice.h>
#include "core.h"
int
mt7697_data_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
ndev
)
...
...
@@ -82,3 +83,47 @@ void mt7697_tx_work(struct work_struct *work)
cleanup:
return
;
}
int
mt7697_rx_data
(
struct
mt7697_cfg80211_info
*
cfg
,
u32
if_idx
)
{
struct
mt7697_vif
*
vif
;
struct
sk_buff
*
skb
;
int
ret
=
0
;
skb
=
alloc_skb
(
cfg
->
rsp
.
result
,
GFP_KERNEL
);
if
(
!
skb
)
{
dev_err
(
cfg
->
dev
,
"%s: alloc_skb() failed
\n
"
,
__func__
);
ret
=
-
ENOMEM
;
goto
cleanup
;
}
skb_put
(
skb
,
cfg
->
rsp
.
result
);
memcpy
(
skb
->
data
,
cfg
->
rx_data
,
cfg
->
rsp
.
result
);
vif
=
mt7697_get_vif_by_idx
(
cfg
,
if_idx
);
if
(
!
vif
)
{
dev_err
(
cfg
->
dev
,
"%s: mt7697_get_vif_by_idx(%u) failed
\n
"
,
__func__
,
if_idx
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
dev_dbg
(
cfg
->
dev
,
"%s: vif(%u)
\n
"
,
__func__
,
vif
->
fw_vif_idx
);
skb
->
dev
=
vif
->
ndev
;
if
(
!
(
skb
->
dev
->
flags
&
IFF_UP
))
{
dev_warn
(
cfg
->
dev
,
"%s: net device NOT up
\n
"
,
__func__
);
ret
=
-
EINVAL
;
goto
cleanup
;
}
skb
->
protocol
=
eth_type_trans
(
skb
,
skb
->
dev
);
dev_dbg
(
cfg
->
dev
,
"%s: protocol(%u)
\n
"
,
__func__
,
skb
->
protocol
);
netif_rx_ni
(
skb
);
cleanup:
if
(
ret
&&
skb
)
dev_kfree_skb
(
skb
);
return
ret
;
}
linux_kernel_modules/mt7697wifi/wmi.c
View file @
3b911ff1
This diff is collapsed.
Click to expand it.
linux_kernel_modules/mt7697wifi/wmi.h
View file @
3b911ff1
...
...
@@ -25,22 +25,31 @@
#define MT7697_LEN32_ALIGNED(x) (((x) / sizeof(u32) + \
((x) % sizeof(u32) ? 1:0)) * sizeof(u32))
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64
#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_scan_stop mt7697_cmd_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_listen_interval_rsp mt7697_rsp_hdr
#define mt7697_set_pmk_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define MT7697_WOW_MAX_FILTERS_PER_LIST 4
#define MT7697_WOW_PATTERN_SIZE 64
#define MT7697_PASSPHRASE_LEN 64
#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_register_rx_hndlr_req mt7697_cmd_hdr
#define mt7697_unregister_rx_hndlr_req 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_psk_rsp mt7697_rsp_hdr
#define mt7697_set_security_mode_rsp mt7697_rsp_hdr
#define mt7697_scan_stop_rsp mt7697_rsp_hdr
#define mt7697_register_rx_hndlr_rsp mt7697_rsp_hdr
#define mt7697_unregister_rx_hndlr_rsp mt7697_rsp_hdr
enum
mt7697_connect_ctrl_flags_bits
{
MT7697_CONNECT_ASSOC_POLICY_USER
=
0x0001
,
...
...
@@ -72,6 +81,8 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_GET_CFG_RSP
,
MT7697_CMD_GET_WIRELESS_MODE_REQ
,
MT7697_CMD_GET_WIRELESS_MODE_RSP
,
MT7697_CMD_SET_WIRELESS_MODE_REQ
,
MT7697_CMD_SET_WIRELESS_MODE_RSP
,
MT7697_CMD_SET_OP_MODE_REQ
,
MT7697_CMD_SET_OP_MODE_RSP
,
MT7697_CMD_GET_RADIO_STATE_REQ
,
...
...
@@ -90,15 +101,23 @@ enum mt7697_wifi_cmd_types {
MT7697_CMD_SET_SECURITY_MODE_RSP
,
MT7697_CMD_GET_SECURITY_MODE_REQ
,
MT7697_CMD_GET_SECURITY_MODE_RSP
,
MT7697_CMD_GET_SMART_CONN_FILTER_REQ
,
MT7697_CMD_GET_SMART_CONN_FILTER_RSP
,
MT7697_CMD_SET_SMART_CONN_FILTER_REQ
,
MT7697_CMD_SET_SMART_CONN_FILTER_RSP
,
MT7697_CMD_REGISTER_RX_HNDLR_REQ
,
MT7697_CMD_REGISTER_RX_HNDLR_RSP
,
MT7697_CMD_UNREGISTER_RX_HNDLR_REQ
,
MT7697_CMD_UNREGISTER_RX_HNDLR_RSP
,
MT7697_CMD_SCAN_REQ
,
MT7697_CMD_SCAN_RSP
,
MT7697_CMD_SCAN_COMPLETE
,
MT7697_CMD_SCAN_STOP
,
MT7697_CMD_SCAN_STOP_RSP
,
MT7697_CMD_GET_P
M
K_REQ
,
MT7697_CMD_GET_P
M
K_RSP
,
MT7697_CMD_SET_P
M
K_REQ
,
MT7697_CMD_SET_P
M
K_RSP
,
MT7697_CMD_GET_P
S
K_REQ
,
MT7697_CMD_GET_P
S
K_RSP
,
MT7697_CMD_SET_P
S
K_REQ
,
MT7697_CMD_SET_P
S
K_RSP
,
MT7697_CMD_CONNECT_REQ
,
MT7697_CMD_CONNECT_RSP
,
MT7697_CMD_DISCONNECT_REQ
,
...
...
@@ -126,14 +145,9 @@ struct mt7697_mac_addr_req {
__be32
port
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_mac_addr
{
__be16
len
;
u8
data
[
ETH_ALEN
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_mac_addr_rsp
{
struct
mt7697_rsp_hdr
rsp
;
struct
mt7697_mac_addr
addr
;
u8
addr
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)]
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_wireless_mode_req
{
...
...
@@ -146,6 +160,12 @@ struct mt7697_get_wireless_mode_rsp {
__be32
mode
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_wireless_mode_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
__be32
mode
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_cfg_rsp
{
struct
mt7697_rsp_hdr
rsp
;
struct
mt7697_wifi_config_t
cfg
;
...
...
@@ -176,6 +196,16 @@ struct mt7697_set_rx_filter_req {
__be32
rx_filter
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_smart_conn_filter_rsp
{
struct
mt7697_rsp_hdr
rsp
;
__be32
flag
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_smart_conn_filter_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
flag
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_listen_interval_rsp
{
struct
mt7697_rsp_hdr
rsp
;
__be32
interval
;
...
...
@@ -189,11 +219,12 @@ struct mt7697_set_listen_interval_req {
struct
mt7697_scan_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
if_idx
;
u8
mode
;
u8
option
;
u8
ssid_len
;
u8
bssid_len
;
u8
ssid_bssid
[
ETH_ALEN
+
IEEE80211_MAX_SSID_LEN
];
__be32
mode
;
__be32
option
;
__be32
bssid_len
;
u8
bssid
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)];
__be32
ssid_len
;
u8
ssid
[
MT7697_LEN32_ALIGNED
(
IEEE80211_MAX_SSID_LEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_scan_rsp
{
...
...
@@ -209,20 +240,22 @@ struct mt7697_scan_complete_rsp {
__be32
if_idx
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_p
m
k_req
{
struct
mt7697_get_p
s
k_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_get_p
m
k_rsp
{
struct
mt7697_get_p
s
k_rsp
{
struct
mt7697_rsp_hdr
rsp
;
u8
pmk
[
MT7697_WIFI_LENGTH_PMK
];
__be32
len
;
u8
psk
[
MT7697_LEN32_ALIGNED
(
MT7697_PASSPHRASE_LEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_p
m
k_req
{
struct
mt7697_set_p
s
k_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
port
;
u8
pmk
[
MT7697_WIFI_LENGTH_PMK
];
__be32
len
;
u8
psk
[
MT7697_LEN32_ALIGNED
(
MT7697_PASSPHRASE_LEN
)];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_set_security_mode_req
{
...
...
@@ -250,56 +283,60 @@ struct mt7697_connect_req {
__be32
if_idx
;
__be32
port
;
__be32
channel
;
__be32
bssid_len
;
u8
bssid
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)]
;
__be32
ssid_len
;
u8
bssid_ssid
[
];
u8
ssid
[
MT7697_LEN32_ALIGNED
(
IEEE80211_MAX_SSID_LEN
)
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_connect_rsp
{
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
__be32
channel
;
u8
bssid
[
ETH_ALEN
];
u8
bssid
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_disconnect_req
{
struct
mt7697_cmd_hdr
cmd
;
__be32
if_idx
;
__be32
addr_len
;
u8
addr
[];
__be32
port
;
u8
addr
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_disconnect_rsp
{
struct
mt7697_rsp_hdr
rsp
;
__be32
if_idx
;
u8
bssid
[
ETH_ALEN
];
u8
bssid
[
MT7697_LEN32_ALIGNED
(
ETH_ALEN
)
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_tx_raw_packet
{
struct
mt7697_cmd_hdr
cmd
;
__be32
len
;
u8
data
[];
u8
data
[
MT7697_LEN32_ALIGNED
(
IEEE80211_MAX_FRAME_LEN
)
];
}
__attribute__
((
packed
,
aligned
(
4
)));
struct
mt7697_rx_raw_packet
{
struct
mt7697_cmd_hdr
cmd
;
__be32
len
;
struct
mt7697_rsp_hdr
hdr
;
u8
data
[];
}
__attribute__
((
packed
,
aligned
(
4
)));
int
mt7697_send_init
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_reset
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_wireless_mode_req
(
struct
mt7697_cfg80211_info
*
,
u8
,
u8
);
int
mt7697_send_get_wireless_mode_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_get_p
m
k_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_set_p
m
k_req
(
struct
mt7697_cfg80211_info
*
,
u8
,
const
u8
[]);
int
mt7697_send_get_p
s
k_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_set_p
s
k_req
(
struct
mt7697_cfg80211_info
*
,
u8
,
const
u8
[]);
int
mt7697_send_mac_addr_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_cfg_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_register_rx_hndlr_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_unregister_rx_hndlr_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_op_mode_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_get_radio_state_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_radio_state_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_get_rx_filter_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_rx_filter_req
(
struct
mt7697_cfg80211_info
*
,
u32
);
int
mt7697_send_get_smart_conn_filter_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_smart_conn_filter_req
(
struct
mt7697_cfg80211_info
*
,
u8
);
int
mt7697_send_get_listen_interval_req
(
struct
mt7697_cfg80211_info
*
);
int
mt7697_send_set_listen_interval_req
(
struct
mt7697_cfg80211_info
*
,
u32
);
int
mt7697_send_scan_req
(
struct
mt7697_cfg80211_info
*
,
u32
,
...
...
mangOH_Red.sdef
View file @
3b911ff1
...
...
@@ -5,10 +5,14 @@
// Copyright (C) Sierra Wireless Inc. Use of this work is subject to license.
//--------------------------------------------------------------------------------------------------
#include "$LEGATO_ROOT/legatoTargetConfig.sinc"
#include "$LEGATO_ROOT/apps/platformServices/defaultAirVantage.sinc"
apps:
{
// Platform services.
$LEGATO_ROOT/apps/platformServices/airVantage/avcService
//
$LEGATO_ROOT/apps/platformServices/airVantage/avcService
$LEGATO_ROOT/apps/platformServices/audioService
$LEGATO_ROOT/apps/platformServices/cellNetService
$LEGATO_ROOT/apps/platformServices/dataConnectionService
...
...
@@ -20,10 +24,10 @@ apps:
$LEGATO_ROOT/apps/platformServices/smsInboxService
$LEGATO_ROOT/apps/platformServices/voiceCallService
$LEGATO_ROOT/apps/platformServices/gpioService
$LEGATO_ROOT/apps/platformServices/atClient
$LEGATO_ROOT/apps/platformServices/atServer
//
$LEGATO_ROOT/apps/platformServices/atClient
//
$LEGATO_ROOT/apps/platformServices/atServer
$LEGATO_ROOT/apps/platformServices/spiService
$LEGATO_ROOT/apps/
platformService
s/devMode
$LEGATO_ROOT/apps/
tool
s/devMode
$MANGOH_ROOT/apps/GpioExpander/gpioExpanderService/gpioExpanderServiceRed
...
...
@@ -33,14 +37,27 @@ apps:
// $MANGOH_ROOT/apps/MuxControl/tools/muxCtrlTools
$MANGOH_ROOT/apps/MqttClient/mqttClient
$MANGOH_ROOT/apps/DataRouter/dataRouter
$MANGOH_ROOT/apps/DataRouter/drTool/drTool
//
$MANGOH_ROOT/apps/DataRouter/dataRouter
//
$MANGOH_ROOT/apps/DataRouter/drTool/drTool
$MANGOH_ROOT/apps/SocialService/socialService
// Command-line tools.
$LEGATO_ROOT/apps/tools/tools
}
kernelModules:
{
$MANGOH_ROOT/linux_kernel_modules/cp2130/spi-cp2130.mdef
$MANGOH_ROOT/linux_kernel_modules/spisvc/spisvc.mdef
$MANGOH_ROOT/linux_kernel_modules/mt7697wifi/mt7697wifi_core.mdef
$MANGOH_ROOT/linux_kernel_modules/mt7697q/mt7697q.mdef
}
buildVars:
{
LEGATO_KERNELROOT = /home/david/kernel
}
commands:
{
cm = tools:/bin/cm
...
...
@@ -52,7 +69,7 @@ commands:
// mux = muxCtrlTools:/bin/mux
dr = drTool:/bin/dr
//
dr = drTool:/bin/dr
twitter = socialService:/bin/twitter
}
...
...
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