Merge Official Source

This commit is contained in:
CN_SZTL 2019-11-13 12:59:35 +08:00
commit 86b6a3c0af
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
31 changed files with 807 additions and 337 deletions

View File

@ -30,7 +30,7 @@ param_get_default = $(firstword $(call param_get,$(1),$(2)) $(3))
param_mangle = $(subst $(space),_,$(strip $(1)))
param_unmangle = $(subst _,$(space),$(1))
mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | head -c 8)
mkfs_packages_id = $(shell echo $(sort $(1)) | mkhash md5 | cut -b1-8)
mkfs_target_dir = $(if $(call param_get,pkg,$(1)),$(KDIR)/target-dir-$(call param_get,pkg,$(1)),$(TARGET_DIR))
KDIR=$(KERNEL_BUILD_DIR)
@ -44,7 +44,7 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS
IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
IMG_COMBINED:=$(IMG_PREFIX)-combined
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | head --bytes 8)
IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | mkhash md5 | cut -b1-8)
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt

View File

@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
endif
LINUX_VERSION-4.9 = .198
LINUX_VERSION-4.14 = .151
LINUX_VERSION-4.19 = .81
LINUX_VERSION-4.9 = .199
LINUX_VERSION-4.14 = .152
LINUX_VERSION-4.19 = .82
LINUX_KERNEL_HASH-4.9.198 = 9572ebfa6ba0efcf9f1ec7b62c7b89baa36a621ab9fd4c5ad025196c549605ac
LINUX_KERNEL_HASH-4.14.151 = ff519c428ee9bbb513a84db5ec32a7e3705cd8c23a57104b25b944cb79583fae
LINUX_KERNEL_HASH-4.19.81 = 293ec1ae0f6b3b4be83a217224b51d137f2163cf2d9d294eecf5d0a354e4e29d
LINUX_KERNEL_HASH-4.9.199 = 0f2531f0908e320ee49954e8d84406db659073b202abc514bcc999ceaa3f7ed5
LINUX_KERNEL_HASH-4.14.152 = a9239fd9d341aae07b48a8e7a2afd528fe5cde2617d783454c71e6f3dae2b0aa
LINUX_KERNEL_HASH-4.19.82 = 58d96d6c2c5ee8288fe9714891e4037a18f457b008e369e33fc744afc2cb595d
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))

View File

@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=base-files
PKG_RELEASE:=206
PKG_RELEASE:=207
PKG_FLAGS:=nonshared
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/

View File

@ -130,6 +130,10 @@ wifi_updown() {
scan_wifi
cmd=up
}
[ reconf = "$1" ] && {
scan_wifi
cmd=reconf
}
ubus_wifi_cmd "$cmd" "$2"
_wifi_updown "$@"
}
@ -241,6 +245,7 @@ case "$1" in
reload) wifi_reload "$2";;
reload_legacy) wifi_reload_legacy "$2";;
--help|help) usage;;
reconf) ubus call network reload; wifi_updown "reconf" "$2";;
''|up) ubus call network reload; wifi_updown "enable" "$2";;
*) usage; exit 1;;
esac

View File

@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=5.4-rc2-1
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.4-rc2/
PKG_HASH:=b3baedc135b455f09f266cb77e73276ca21bceeb0f24bac2184cc4b97d09cdbf

View File

@ -19,6 +19,11 @@ iw() {
command iw $@ || logger -t mac80211 "Failed command: iw $@"
}
NEWAPLIST=
OLDAPLIST=
NEWSPLIST=
OLDSPLIST=
drv_mac80211_init_device_config() {
hostapd_common_add_device_config
@ -58,7 +63,7 @@ drv_mac80211_init_iface_config() {
config_add_string 'macaddr:macaddr' ifname
config_add_boolean wds powersave
config_add_boolean wds powersave enable
config_add_int maxassoc
config_add_int max_listen_int
config_add_int dtim_period
@ -454,7 +459,7 @@ mac80211_iw_interface_add() {
mac80211_prepare_vif() {
json_select config
json_get_vars ifname mode ssid wds powersave macaddr
json_get_vars ifname mode ssid wds powersave macaddr enable
[ -n "$ifname" ] || ifname="wlan${phy#phy}${if_idx:+-$if_idx}"
if_idx=$((${if_idx:-0} + 1))
@ -490,8 +495,8 @@ mac80211_prepare_vif() {
mac80211_hostapd_setup_bss "$phy" "$ifname" "$macaddr" "$type" || return
NEWAPLIST="${NEWAPLIST}$ifname "
[ -n "$hostapd_ctrl" ] || {
mac80211_iw_interface_add "$phy" "$ifname" __ap || return
hostapd_ctrl="${hostapd_ctrl:-/var/run/hostapd/$ifname}"
}
;;
@ -503,7 +508,7 @@ mac80211_prepare_vif() {
;;
sta)
local wdsflag=
staidx="$(($staidx + 1))"
[ "$enable" = 0 ] || staidx="$(($staidx + 1))"
[ "$wds" -gt 0 ] && wdsflag="4addr on"
mac80211_iw_interface_add "$phy" "$ifname" managed "$wdsflag" || return
[ "$powersave" -gt 0 ] && powersave="on" || powersave="off"
@ -529,19 +534,62 @@ mac80211_prepare_vif() {
}
mac80211_setup_supplicant() {
local enable=$1
local add_sp=0
local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
wpa_supplicant_prepare_interface "$ifname" nl80211 || {
iw dev "$ifname" del
return 1
}
if [ "$mode" = "sta" ]; then
wpa_supplicant_add_network "$ifname"
else
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan"
fi
wpa_supplicant_run "$ifname" ${hostapd_ctrl:+-H $hostapd_ctrl}
NEWSPLIST="${NEWSPLIST}$ifname "
if [ "${NEWAPLIST%% *}" != "${OLDAPLIST%% *}" ]; then
[ "$spobj" ] && ubus call wpa_supplicant.${phy} config_del "{\"iface\":\"$ifname\"}"
add_sp=1
fi
[ "$enable" = 0 ] && {
ubus call wpa_supplicant.${phy} config_del "{\"iface\":\"$ifname\"}"
ip link set dev "$ifname" down
return 0
}
[ -z "$spobj" ] && add_sp=1
if [ "$add_sp" = "1" ]; then
wpa_supplicant_run "$ifname" "$hostapd_ctrl"
else
ubus call $spobj reload
fi
}
mac80211_setup_supplicant_noctl() {
wpa_supplicant_prepare_interface "$ifname" nl80211 || return 1
local enable=$1
local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
wpa_supplicant_prepare_interface "$ifname" nl80211 || {
iw dev "$ifname" del
return 1
}
wpa_supplicant_add_network "$ifname" "$freq" "$htmode" "$noscan"
wpa_supplicant_run "$ifname"
NEWSPLIST="${NEWSPLIST}$ifname "
[ "$enable" = 0 ] && {
ubus call wpa_supplicant.${phy} config_del "{\"iface\":\"$ifname\"}"
ip link set dev "$ifname" down
return 0
}
if [ -z "$spobj" ]; then
wpa_supplicant_run "$ifname"
else
ubus call $spobj reload
fi
}
mac80211_setup_adhoc_htmode() {
@ -579,12 +627,17 @@ mac80211_setup_adhoc_htmode() {
;;
*) ibss_htmode="" ;;
esac
}
mac80211_setup_adhoc() {
local enable=$1
json_get_vars bssid ssid key mcast_rate
[ "$enable" = 0 ] && {
ip link set dev "$ifname" down
return 0
}
keyspec=
[ "$auth_type" = "wep" ] && {
set_default key 1
@ -623,8 +676,14 @@ mac80211_setup_adhoc() {
}
mac80211_setup_mesh() {
local enable=$1
json_get_vars ssid mesh_id mcast_rate
[ "$enable" = 0 ] && {
ip link set dev "$ifname" down
return 0
}
mcval=
[ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
[ -n "$mesh_id" ] && ssid="$mesh_id"
@ -670,6 +729,7 @@ mac80211_setup_mesh() {
mac80211_setup_vif() {
local name="$1"
local failed
local action=up
json_select data
json_get_vars ifname
@ -678,13 +738,15 @@ mac80211_setup_vif() {
json_select config
json_get_vars mode
json_get_var vif_txpower txpower
json_get_var vif_enable enable 1
ip link set dev "$ifname" up || {
[ "$vif_enable" = 1 ] || action=down
logger ip link set dev "$ifname" $action
ip link set dev "$ifname" "$action" || {
wireless_setup_vif_failed IFUP_ERROR
json_select ..
return
}
set_default vif_txpower "$txpower"
[ -z "$vif_txpower" ] || iw dev "$ifname" set txpower fixed "${vif_txpower%%.*}00"
@ -693,9 +755,9 @@ mac80211_setup_vif() {
wireless_vif_parse_encryption
freq="$(get_freq "$phy" "$channel")"
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
mac80211_setup_supplicant || failed=1
mac80211_setup_supplicant $vif_enable || failed=1
else
mac80211_setup_mesh
mac80211_setup_mesh $vif_enable
fi
for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
json_get_var mp_val "$var"
@ -707,13 +769,13 @@ mac80211_setup_vif() {
mac80211_setup_adhoc_htmode
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
freq="$(get_freq "$phy" "$channel")"
mac80211_setup_supplicant_noctl || failed=1
mac80211_setup_supplicant_noctl $vif_enable || failed=1
else
mac80211_setup_adhoc
mac80211_setup_adhoc $vif_enable
fi
;;
sta)
mac80211_setup_supplicant || failed=1
mac80211_setup_supplicant $vif_enable || failed=1
;;
esac
@ -734,18 +796,26 @@ chan_is_dfs() {
return $!
}
mac80211_interface_cleanup() {
local phy="$1"
mac80211_vap_cleanup() {
local service="$1"
local vaps="$2"
for wdev in $(list_phy_interfaces "$phy"); do
local wdev_phy="$(readlink /sys/class/net/${wdev}/phy80211)"
wdev_phy="$(basename "$wdev_phy")"
[ -n "$wdev_phy" -a "$wdev_phy" != "$phy" ] && continue
for wdev in $vaps; do
ubus call ${service}.${phy} config_remove "{\"iface\":\"$wdev\"}"
ip link set dev "$wdev" down 2>/dev/null
iw dev "$wdev" del
done
}
mac80211_interface_cleanup() {
local phy="$1"
local primary_ap=$(uci -q -P /var/state get wireless._${phy}.aplist)
primary_ap=${primary_ap%% *}
mac80211_vap_cleanup hostapd "${primary_ap}"
mac80211_vap_cleanup wpa_supplicant "$(uci -q -P /var/state get wireless._${phy}.splist)"
}
mac80211_set_noscan() {
hostapd_noscan=1
}
@ -771,8 +841,10 @@ drv_mac80211_setup() {
return 1
}
wireless_set_data phy="$phy"
mac80211_interface_cleanup "$phy"
[ -z "$(uci -q -P /var/state show wireless._${phy})" ] && {
uci -q -P /var/state set wireless._${phy}=phy
wireless_set_data phy="$phy"
}
# convert channel to frequency
[ "$auto_channel" -gt 0 ] || freq="$(get_freq "$phy" "$channel")"
@ -822,32 +894,57 @@ drv_mac80211_setup() {
[ -n "$has_ap" ] && mac80211_hostapd_setup_base "$phy"
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
NEWAPLIST=
for_each_interface "ap" mac80211_prepare_vif
OLDAPLIST=$(uci -q -P /var/state get wireless._${phy}.aplist)
NEW_MD5=$(md5sum ${hostapd_conf_file})
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then
mac80211_vap_cleanup hostapd "${OLDAPLIST}"
[ -n "${NEWAPLIST}" ] && mac80211_iw_interface_add "$phy" "${NEWAPLIST%% *}" __ap || return
fi
local add_ap=0
local primary_ap=${NEWAPLIST%% *}
[ -n "$hostapd_ctrl" ] && {
/usr/sbin/hostapd -s -P /var/run/wifi-$phy.pid -B "$hostapd_conf_file"
if [ -n "$(ubus list | grep hostapd.$primary_ap)" ]; then
[ "${NEW_MD5}" = "${OLD_MD5}" ] || {
ubus call hostapd.$primary_ap reload
}
else
add_ap=1
ubus call hostapd.${phy} config_add "{\"iface\":\"$primary_ap\", \"config\":\"${hostapd_conf_file}\"}"
fi
ret="$?"
wireless_add_process "$(cat /var/run/wifi-$phy.pid)" "/usr/sbin/hostapd" 1
[ "$ret" != 0 ] && {
wireless_setup_failed HOSTAPD_START_FAILED
return
}
}
uci -q -P /var/state set wireless._${phy}.aplist="${NEWAPLIST}"
uci -q -P /var/state set wireless._${phy}.md5="${NEW_MD5}"
for_each_interface "ap sta adhoc mesh monitor" mac80211_setup_vif
[ "${add_ap}" = 1 ] && sleep 1
for_each_interface "ap" mac80211_setup_vif
NEWSPLIST=
OLDSPLIST=$(uci -q -P /var/state get wireless._${phy}.splist)
for_each_interface "sta adhoc mesh monitor" mac80211_setup_vif
uci -q -P /var/state set wireless._${phy}.splist="${NEWSPLIST}"
local foundvap
local dropvap=""
for oldvap in $OLDSPLIST; do
foundvap=0
for newvap in $NEWSPLIST; do
[ "$oldvap" = "$newvap" ] && foundvap=1
done
[ "$foundvap" = "0" ] && dropvap="$dropvap $oldvap"
done
[ -n "$dropvap" ] && mac80211_vap_cleanup wpa_supplicant "$dropvap"
wireless_set_up
}
list_phy_interfaces() {
local phy="$1"
if [ -d "/sys/class/ieee80211/${phy}/device/net" ]; then
ls "/sys/class/ieee80211/${phy}/device/net" 2>/dev/null;
else
ls "/sys/class/ieee80211/${phy}/device" 2>/dev/null | grep net: | sed -e 's,net:,,g'
fi
}
drv_mac80211_teardown() {
wireless_process_kill_all
@ -856,6 +953,7 @@ drv_mac80211_teardown() {
json_select ..
mac80211_interface_cleanup "$phy"
uci -q -P /var/state revert wireless._${phy}
}
add_driver mac80211

View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
PKG_SOURCE_DATE:=2019-08-05
PKG_SOURCE_VERSION:=5e02f94411b06f192fb2a7d9be9abde3549153a8
PKG_MIRROR_HASH:=96e158584c605e96aceb3ce7e8ad8faa8e774ffd67d59558b2d6c2ff49d0f1a5
PKG_SOURCE_DATE:=2019-11-12
PKG_SOURCE_VERSION:=e15147c272201eb17320c10ec95919e641bd03c5
PKG_MIRROR_HASH:=af830967d3d9f20d8d3c01b1931e501e075984043e38c23ac649faced34e896a
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
@ -519,8 +519,9 @@ define Install/supplicant
endef
define Package/hostapd-common/install
$(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button
$(INSTALL_DIR) $(1)/lib/netifd $(1)/etc/rc.button $(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/hostapd.sh $(1)/lib/netifd/hostapd.sh
$(INSTALL_BIN) ./files/hostapd.hotplug $(1)/etc/hotplug.d/ieee80211/20-hostapd
$(INSTALL_BIN) ./files/wps-hotplug.sh $(1)/etc/rc.button/wps
endef

View File

@ -0,0 +1,14 @@
#!/bin/sh
[ ${ACTION} = "remove" -a -n "${DEVICENAME}" ] && {
kill $(cat /var/run/hostapd-${DEVICENAME}.pid)
rm -rf /var/run/hostapd-${DEVICENAME}.pid /var/run/hostapd-${DEVICENAME}/
kill $(cat /var/run/wpa_supplicant-${DEVICENAME}.pid)
rm -rf /var/run/wpa_supplicant-${DEVICENAME}.pid /var/run/wpa_supplicant-${DEVICENAME}/
}
[ ${ACTION} = "add" -a -n "${DEVICENAME}" ] && {
/usr/sbin/hostapd -s -n ${DEVICENAME} -P /var/run/hostapd-${DEVICENAME}.pid -g /var/run/hostapd-${DEVICENAME}/global -B &
mkdir -p /var/run/wpa_supplicant-${DEVICENAME}
/usr/sbin/wpa_supplicant -s -n ${DEVICENAME} -P /var/run/wpa_supplicant-${DEVICENAME}.pid -g /var/run/wpa_supplicant-${DEVICENAME}/global -B &
}

View File

@ -254,7 +254,7 @@ hostapd_set_bss_options() {
wireless_vif_parse_encryption
local bss_conf
local bss_conf bss_md5sum
local wep_rekey wpa_group_rekey wpa_pair_rekey wpa_master_rekey wpa_key_mgmt
json_get_vars \
@ -627,6 +627,9 @@ hostapd_set_bss_options() {
}
}
bss_md5sum=$(echo $bss_conf | md5sum | cut -d" " -f1)
append bss_conf "config_id=$bss_md5sum" "$N"
append "$var" "$bss_conf" "$N"
return 0
}
@ -950,21 +953,19 @@ EOF
}
wpa_supplicant_run() {
local ifname="$1"; shift
local ifname="$1"
local hostapd_ctrl="$2"
_wpa_supplicant_common "$ifname"
/usr/sbin/wpa_supplicant -B -s \
${network_bridge:+-b $network_bridge} \
-P "/var/run/wpa_supplicant-${ifname}.pid" \
-D ${_w_driver:-wext} \
-i "$ifname" \
-c "$_config" \
-C "$_rpath" \
"$@"
ubus call wpa_supplicant.$phy config_add "{ \
\"driver\": \"${_w_driver:-wext}\", \"ctrl\": \"$_rpath\", \
\"iface\": \"$ifname\", \"config\": \"$_config\" \
${network_bridge:+, \"bridge\": \"$network_bridge\"} \
${hostapd_ctrl:+, \"hostapd_ctrl\": \"$hostapd_ctrl\"} \
}"
ret="$?"
wireless_add_process "$(cat "/var/run/wpa_supplicant-${ifname}.pid")" /usr/sbin/wpa_supplicant 1
[ "$ret" != 0 ] && wireless_setup_vif_failed WPA_SUPPLICANT_FAILED
@ -972,5 +973,5 @@ wpa_supplicant_run() {
}
hostapd_common_cleanup() {
killall hostapd wpa_supplicant meshd-nl80211
killall meshd-nl80211
}

View File

@ -22,7 +22,16 @@
#define OCE_STA_CFON_ENABLED(hapd) \
((hapd->conf->oce & OCE_STA_CFON) && \
@@ -145,6 +146,7 @@ struct hostapd_data {
@@ -72,6 +73,8 @@ struct hapd_interfaces {
#ifdef CONFIG_DPP
struct dpp_global *dpp;
#endif /* CONFIG_DPP */
+ struct ubus_object ubus;
+ char *name;
};
enum hostapd_chan_status {
@@ -145,6 +148,7 @@ struct hostapd_data {
struct hostapd_iface *iface;
struct hostapd_config *iconf;
struct hostapd_bss_config *conf;
@ -30,6 +39,14 @@
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
@@ -580,6 +584,7 @@ hostapd_alloc_bss_data(struct hostapd_if
struct hostapd_bss_config *bss);
int hostapd_setup_interface(struct hostapd_iface *iface);
int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err);
+void hostapd_set_own_neighbor_report(struct hostapd_data *hapd);
void hostapd_interface_deinit(struct hostapd_iface *iface);
void hostapd_interface_free(struct hostapd_iface *iface);
struct hostapd_iface * hostapd_alloc_iface(void);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -380,6 +380,7 @@ static void hostapd_free_hapd_data(struc
@ -298,6 +315,36 @@
/* Remove interface from the global list of interfaces */
prev = global->ifaces;
if (prev == wpa_s) {
@@ -6520,6 +6524,8 @@ struct wpa_global * wpa_supplicant_init(
if (params->override_ctrl_interface)
global->params.override_ctrl_interface =
os_strdup(params->override_ctrl_interface);
+ if (params->name)
+ global->params.name = os_strdup(params->name);
#ifdef CONFIG_MATCH_IFACE
global->params.match_iface_count = params->match_iface_count;
if (params->match_iface_count) {
@@ -6626,8 +6632,12 @@ int wpa_supplicant_run(struct wpa_global
eloop_register_signal_terminate(wpa_supplicant_terminate, global);
eloop_register_signal_reconfig(wpa_supplicant_reconfig, global);
+ wpas_ubus_add(global);
+
eloop_run();
+ wpas_ubus_free(global);
+
return 0;
}
@@ -6687,6 +6697,7 @@ void wpa_supplicant_deinit(struct wpa_gl
#ifdef CONFIG_MATCH_IFACE
os_free(global->params.match_ifaces);
#endif /* CONFIG_MATCH_IFACE */
+ os_free(global->params.name);
#ifdef CONFIG_P2P
os_free(global->params.conf_p2p_dev);
#endif /* CONFIG_P2P */
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -17,6 +17,7 @@
@ -308,7 +355,25 @@
extern const char *const wpa_supplicant_version;
extern const char *const wpa_supplicant_license;
@@ -506,6 +507,7 @@ struct wpa_supplicant {
@@ -246,6 +247,8 @@ struct wpa_params {
*/
int match_iface_count;
#endif /* CONFIG_MATCH_IFACE */
+
+ char *name;
};
struct p2p_srv_bonjour {
@@ -306,6 +309,8 @@ struct wpa_global {
#endif /* CONFIG_WIFI_DISPLAY */
struct psk_list_entry *add_psk; /* From group formation */
+
+ struct ubus_object ubus_global;
};
@@ -506,6 +511,7 @@ struct wpa_supplicant {
unsigned char own_addr[ETH_ALEN];
unsigned char perm_addr[ETH_ALEN];
char ifname[100];
@ -335,3 +400,61 @@
if (wpa_s->conf->wps_cred_processing == 1)
return 0;
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -688,7 +688,7 @@ int main(int argc, char *argv[])
wpa_supplicant_event = hostapd_wpa_event;
wpa_supplicant_event_global = hostapd_wpa_event_global;
for (;;) {
- c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:v::");
+ c = getopt(argc, argv, "b:Bde:f:hi:KP:sSTtu:g:G:n:v::");
if (c < 0)
break;
switch (c) {
@@ -763,6 +763,8 @@ int main(int argc, char *argv[])
if (hostapd_get_interface_names(&if_names,
&if_names_size, optarg))
goto out;
+ case 'n':
+ interfaces.name = optarg;
break;
default:
usage();
@@ -894,6 +896,7 @@ int main(int argc, char *argv[])
}
hostapd_global_ctrl_iface_init(&interfaces);
+ hostapd_ubus_add(&interfaces);
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {
wpa_printf(MSG_ERROR, "Failed to start eloop");
@@ -903,6 +906,7 @@ int main(int argc, char *argv[])
ret = 0;
out:
+ hostapd_ubus_free(&interfaces);
hostapd_global_ctrl_iface_deinit(&interfaces);
/* Deinitialize all interfaces */
for (i = 0; i < interfaces.count; i++) {
--- a/wpa_supplicant/main.c
+++ b/wpa_supplicant/main.c
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
for (;;) {
c = getopt(argc, argv,
- "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:No:O:p:P:qsTtuv::W");
+ "b:Bc:C:D:de:f:g:G:hH:i:I:KLMm:n:No:O:p:P:qsTtuv::W");
if (c < 0)
break;
switch (c) {
@@ -271,6 +271,10 @@ int main(int argc, char *argv[])
params.conf_p2p_dev = optarg;
break;
#endif /* CONFIG_P2P */
+ case 'n':
+ params.name = optarg;
+ iface_count = 0;
+ break;
case 'o':
params.override_driver = optarg;
break;

View File

@ -0,0 +1,118 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2470,6 +2470,8 @@ static int hostapd_config_fill(struct ho
bss->isolate = atoi(pos);
} else if (os_strcmp(buf, "ap_max_inactivity") == 0) {
bss->ap_max_inactivity = atoi(pos);
+ } else if (os_strcmp(buf, "config_id") == 0) {
+ bss->config_id = os_strdup(pos);
} else if (os_strcmp(buf, "skip_inactivity_poll") == 0) {
bss->skip_inactivity_poll = atoi(pos);
} else if (os_strcmp(buf, "country_code") == 0) {
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -698,6 +698,7 @@ void hostapd_config_free_bss(struct host
os_free(conf->radius_req_attr_sqlite);
os_free(conf->rsn_preauth_interfaces);
os_free(conf->ctrl_interface);
+ os_free(conf->config_id);
os_free(conf->ca_cert);
os_free(conf->server_cert);
os_free(conf->server_cert2);
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -829,6 +829,7 @@ struct hostapd_bss_config {
*/
u8 mka_psk_set;
#endif /* CONFIG_MACSEC */
+ char *config_id;
};
/**
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -242,13 +242,13 @@ int hostapd_reload_config(struct hostapd
if (newconf == NULL)
return -1;
- hostapd_clear_old(iface);
-
oldconf = hapd->iconf;
if (hostapd_iface_conf_changed(newconf, oldconf)) {
char *fname;
int res;
+ hostapd_clear_old(iface);
+
wpa_printf(MSG_DEBUG,
"Configuration changes include interface/BSS modification - force full disable+enable sequence");
fname = os_strdup(iface->config_fname);
@@ -273,6 +273,22 @@ int hostapd_reload_config(struct hostapd
wpa_printf(MSG_ERROR,
"Failed to enable interface on config reload");
return res;
+ } else {
+ for (j = 0; j < iface->num_bss; j++) {
+ hapd = iface->bss[j];
+ if (!hapd->config_id || strcmp(hapd->config_id, newconf->bss[j]->config_id)) {
+ hostapd_flush_old_stations(iface->bss[j],
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ hostapd_broadcast_wep_clear(iface->bss[j]);
+
+#ifndef CONFIG_NO_RADIUS
+ /* TODO: update dynamic data based on changed configuration
+ * items (e.g., open/close sockets, etc.) */
+ radius_client_flush(iface->bss[j]->radius, 0);
+#endif /* CONFIG_NO_RADIUS */
+ wpa_printf(MSG_INFO, "bss %d changed", j);
+ }
+ }
}
iface->conf = newconf;
@@ -289,6 +305,12 @@ int hostapd_reload_config(struct hostapd
for (j = 0; j < iface->num_bss; j++) {
hapd = iface->bss[j];
+ if (hapd->config_id) {
+ os_free(hapd->config_id);
+ hapd->config_id = NULL;
+ }
+ if (newconf->bss[j]->config_id)
+ hapd->config_id = strdup(newconf->bss[j]->config_id);
hapd->iconf = newconf;
hapd->conf = newconf->bss[j];
hostapd_reload_bss(hapd);
@@ -2257,6 +2279,10 @@ hostapd_alloc_bss_data(struct hostapd_if
hapd->iconf = conf;
hapd->conf = bss;
hapd->iface = hapd_iface;
+ if (bss->config_id)
+ hapd->config_id = strdup(bss->config_id);
+ else
+ hapd->config_id = NULL;
if (conf)
hapd->driver = conf->driver;
hapd->ctrl_sock = -1;
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -149,6 +149,7 @@ struct hostapd_data {
struct hostapd_config *iconf;
struct hostapd_bss_config *conf;
struct hostapd_ubus_bss ubus;
+ char *config_id;
int interface_added; /* virtual interface added for this BSS */
unsigned int started:1;
unsigned int disabled:1;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4295,6 +4295,9 @@ static int wpa_driver_nl80211_set_ap(voi
if (ret) {
wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",
ret, strerror(-ret));
+ if (!bss->beacon_set)
+ ret = 0;
+ bss->beacon_set = 0;
} else {
bss->beacon_set = 1;
nl80211_set_bss(bss, params->cts_protect, params->preamble,

View File

@ -26,12 +26,16 @@ static struct ubus_context *ctx;
static struct blob_buf b;
static int ctx_ref;
static inline struct hapd_interfaces *get_hapd_interfaces_from_object(struct ubus_object *obj)
{
return container_of(obj, struct hapd_interfaces, ubus);
}
static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj)
{
return container_of(obj, struct hostapd_data, ubus.obj);
}
struct ubus_banned_client {
struct avl_node avl;
u8 addr[ETH_ALEN];
@ -142,6 +146,16 @@ hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time)
eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd);
}
static int
hostapd_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
hostapd_reload_config(hapd->iface);
hostapd_reload_iface(hapd->iface);
}
static int
hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@ -379,6 +393,70 @@ hostapd_bss_update_beacon(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
enum {
CONFIG_IFACE,
CONFIG_FILE,
__CONFIG_MAX
};
static const struct blobmsg_policy config_add_policy[__CONFIG_MAX] = {
[CONFIG_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
[CONFIG_FILE] = { "config", BLOBMSG_TYPE_STRING },
};
static int
hostapd_config_add(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__CONFIG_MAX];
struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj);
char buf[128];
blobmsg_parse(config_add_policy, __CONFIG_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[CONFIG_FILE] || !tb[CONFIG_IFACE])
return UBUS_STATUS_INVALID_ARGUMENT;
snprintf(buf, sizeof(buf), "bss_config=%s:%s",
blobmsg_get_string(tb[CONFIG_IFACE]),
blobmsg_get_string(tb[CONFIG_FILE]));
if (hostapd_add_iface(interfaces, buf))
return UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_OK;
}
enum {
CONFIG_REM_IFACE,
__CONFIG_REM_MAX
};
static const struct blobmsg_policy config_remove_policy[__CONFIG_REM_MAX] = {
[CONFIG_REM_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
};
static int
hostapd_config_remove(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__CONFIG_REM_MAX];
struct hapd_interfaces *interfaces = get_hapd_interfaces_from_object(obj);
char buf[128];
blobmsg_parse(config_remove_policy, __CONFIG_REM_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[CONFIG_REM_IFACE])
return UBUS_STATUS_INVALID_ARGUMENT;
if (hostapd_remove_iface(interfaces, blobmsg_get_string(tb[CONFIG_REM_IFACE])))
return UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_OK;
}
enum {
CSA_FREQ,
CSA_BCN_COUNT,
@ -949,6 +1027,7 @@ hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
#endif
static const struct ubus_method bss_methods[] = {
UBUS_METHOD_NOARG("reload", hostapd_bss_reload),
UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
@ -1021,6 +1100,56 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd)
free(name);
}
static const struct ubus_method daemon_methods[] = {
UBUS_METHOD("config_add", hostapd_config_add, config_add_policy),
UBUS_METHOD("config_remove", hostapd_config_remove, config_remove_policy),
};
static struct ubus_object_type daemon_object_type =
UBUS_OBJECT_TYPE("hostapd", daemon_methods);
void hostapd_ubus_add(struct hapd_interfaces *interfaces)
{
struct ubus_object *obj = &interfaces->ubus;
int name_len;
int ret;
if (!hostapd_ubus_init())
return;
name_len = strlen("hostapd") + 1;
if (interfaces->name)
name_len += strlen(interfaces->name) + 1;
obj->name = malloc(name_len);
strcpy(obj->name, "hostapd");
if (interfaces->name) {
strcat(obj->name, ".");
strcat(obj->name, interfaces->name);
}
obj->type = &daemon_object_type;
obj->methods = daemon_object_type.methods;
obj->n_methods = daemon_object_type.n_methods;
ret = ubus_add_object(ctx, obj);
hostapd_ubus_ref_inc();
}
void hostapd_ubus_free(struct hapd_interfaces *interfaces)
{
struct ubus_object *obj = &interfaces->ubus;
char *name = (char *) obj->name;
if (!ctx)
return;
if (obj->id) {
ubus_remove_object(ctx, obj);
hostapd_ubus_ref_dec();
}
free(name);
}
struct ubus_event_req {
struct ubus_notify_request nreq;
int resp;

View File

@ -25,6 +25,7 @@ struct hostapd_ubus_request {
struct hostapd_iface;
struct hostapd_data;
struct hapd_interfaces;
#ifdef UBUS_SUPPORT
@ -45,6 +46,9 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd);
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
void hostapd_ubus_add(struct hapd_interfaces *interfaces);
void hostapd_ubus_free(struct hapd_interfaces *interfaces);
#else
struct hostapd_ubus_bss {};
@ -73,6 +77,14 @@ static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct ho
static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
{
}
static inline void hostapd_ubus_add(struct hapd_interfaces *interfaces)
{
}
static inline void hostapd_ubus_free(struct hapd_interfaces *interfaces)
{
}
#endif
#endif

View File

@ -20,6 +20,11 @@ static struct ubus_context *ctx;
static struct blob_buf b;
static int ctx_ref;
static inline struct wpa_global *get_wpa_global_from_object(struct ubus_object *obj)
{
return container_of(obj, struct wpa_global, ubus_global);
}
static inline struct wpa_supplicant *get_wpas_from_object(struct ubus_object *obj)
{
return container_of(obj, struct wpa_supplicant, ubus.obj);
@ -95,6 +100,19 @@ wpas_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
static int
wpas_bss_reload(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct wpa_supplicant *wpa_s = get_wpas_from_object(obj);
if (wpa_supplicant_reload_configuration(wpa_s))
return UBUS_STATUS_UNKNOWN_ERROR;
else
return 0;
}
#ifdef CONFIG_WPS
enum {
WPS_START_MULTI_AP,
@ -146,11 +164,12 @@ wpas_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj,
#endif
static const struct ubus_method bss_methods[] = {
UBUS_METHOD_NOARG("reload", wpas_bss_reload),
UBUS_METHOD_NOARG("get_features", wpas_bss_get_features),
#ifdef CONFIG_WPS
UBUS_METHOD_NOARG("wps_start", wpas_bss_wps_start),
UBUS_METHOD_NOARG("wps_cancel", wpas_bss_wps_cancel),
#endif
UBUS_METHOD_NOARG("get_features", wpas_bss_get_features),
};
static struct ubus_object_type bss_object_type =
@ -162,8 +181,6 @@ void wpas_ubus_add_bss(struct wpa_supplicant *wpa_s)
char *name;
int ret;
if (!wpas_ubus_init())
return;
if (asprintf(&name, "wpa_supplicant.%s", wpa_s->ifname) < 0)
return;
@ -192,6 +209,159 @@ void wpas_ubus_free_bss(struct wpa_supplicant *wpa_s)
free(name);
}
enum {
WPAS_CONFIG_DRIVER,
WPAS_CONFIG_IFACE,
WPAS_CONFIG_BRIDGE,
WPAS_CONFIG_HOSTAPD_CTRL,
WPAS_CONFIG_CTRL,
WPAS_CONFIG_FILE,
__WPAS_CONFIG_MAX
};
static const struct blobmsg_policy wpas_config_add_policy[__WPAS_CONFIG_MAX] = {
[WPAS_CONFIG_DRIVER] = { "driver", BLOBMSG_TYPE_STRING },
[WPAS_CONFIG_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
[WPAS_CONFIG_BRIDGE] = { "bridge", BLOBMSG_TYPE_STRING },
[WPAS_CONFIG_HOSTAPD_CTRL] = { "hostapd_ctrl", BLOBMSG_TYPE_STRING },
[WPAS_CONFIG_CTRL] = { "ctrl", BLOBMSG_TYPE_STRING },
[WPAS_CONFIG_FILE] = { "config", BLOBMSG_TYPE_STRING },
};
static int
wpas_config_add(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__WPAS_CONFIG_MAX];
struct wpa_global *global = get_wpa_global_from_object(obj);
struct wpa_interface *iface;
blobmsg_parse(wpas_config_add_policy, __WPAS_CONFIG_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[WPAS_CONFIG_FILE] || !tb[WPAS_CONFIG_IFACE] || !tb[WPAS_CONFIG_DRIVER])
return UBUS_STATUS_INVALID_ARGUMENT;
iface = os_zalloc(sizeof(struct wpa_interface));
if (iface == NULL)
return UBUS_STATUS_UNKNOWN_ERROR;
iface->driver = blobmsg_get_string(tb[WPAS_CONFIG_DRIVER]);
iface->ifname = blobmsg_get_string(tb[WPAS_CONFIG_IFACE]);
iface->confname = blobmsg_get_string(tb[WPAS_CONFIG_FILE]);
if (tb[WPAS_CONFIG_BRIDGE])
iface->bridge_ifname = blobmsg_get_string(tb[WPAS_CONFIG_BRIDGE]);
if (tb[WPAS_CONFIG_CTRL])
iface->ctrl_interface = blobmsg_get_string(tb[WPAS_CONFIG_CTRL]);
if (tb[WPAS_CONFIG_HOSTAPD_CTRL])
iface->hostapd_ctrl = blobmsg_get_string(tb[WPAS_CONFIG_HOSTAPD_CTRL]);
if (!wpa_supplicant_add_iface(global, iface, NULL))
return UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_OK;
}
enum {
WPAS_CONFIG_REM_IFACE,
__WPAS_CONFIG_REM_MAX
};
static const struct blobmsg_policy wpas_config_remove_policy[__WPAS_CONFIG_REM_MAX] = {
[WPAS_CONFIG_REM_IFACE] = { "iface", BLOBMSG_TYPE_STRING },
};
static int
wpas_config_remove(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__WPAS_CONFIG_REM_MAX];
struct wpa_global *global = get_wpa_global_from_object(obj);
struct wpa_supplicant *wpa_s = NULL;
unsigned int found = 0;
blobmsg_parse(wpas_config_remove_policy, __WPAS_CONFIG_REM_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[WPAS_CONFIG_REM_IFACE])
return UBUS_STATUS_INVALID_ARGUMENT;
/* find wpa_s object for to-be-removed interface */
for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
if (!strncmp(wpa_s->ifname,
blobmsg_get_string(tb[WPAS_CONFIG_REM_IFACE]),
sizeof(wpa_s->ifname)))
{
found = 1;
break;
}
}
if (!found)
return UBUS_STATUS_INVALID_ARGUMENT;
if (wpa_supplicant_remove_iface(global, wpa_s, 0))
return UBUS_STATUS_INVALID_ARGUMENT;
return UBUS_STATUS_OK;
}
static const struct ubus_method wpas_daemon_methods[] = {
UBUS_METHOD("config_add", wpas_config_add, wpas_config_add_policy),
UBUS_METHOD("config_remove", wpas_config_remove, wpas_config_remove_policy),
};
static struct ubus_object_type wpas_daemon_object_type =
UBUS_OBJECT_TYPE("wpa_supplicant", wpas_daemon_methods);
void wpas_ubus_add(struct wpa_global *global)
{
struct ubus_object *obj = &global->ubus_global;
int name_len;
int ret;
if (!wpas_ubus_init())
return;
name_len = strlen("wpa_supplicant") + 1;
if (global->params.name)
name_len += strlen(global->params.name) + 1;
obj->name = malloc(name_len);
strcpy(obj->name, "wpa_supplicant");
if (global->params.name)
{
strcat(obj->name, ".");
strcat(obj->name, global->params.name);
}
obj->type = &wpas_daemon_object_type;
obj->methods = wpas_daemon_object_type.methods;
obj->n_methods = wpas_daemon_object_type.n_methods;
ret = ubus_add_object(ctx, obj);
wpas_ubus_ref_inc();
}
void wpas_ubus_free(struct wpa_global *global)
{
struct ubus_object *obj = &global->ubus_global;
char *name = (char *) obj->name;
if (!ctx)
return;
if (obj->id) {
ubus_remove_object(ctx, obj);
wpas_ubus_ref_dec();
}
free(name);
}
#ifdef CONFIG_WPS
void wpas_ubus_notify(struct wpa_supplicant *wpa_s, const struct wps_credential *cred)
{

View File

@ -10,6 +10,8 @@
#define __WPAS_UBUS_H
struct wpa_supplicant;
struct wpa_global;
#include "wps_supplicant.h"
#ifdef UBUS_SUPPORT
@ -22,6 +24,9 @@ struct wpas_ubus_bss {
void wpas_ubus_add_bss(struct wpa_supplicant *wpa_s);
void wpas_ubus_free_bss(struct wpa_supplicant *wpa_s);
void wpas_ubus_add(struct wpa_global *global);
void wpas_ubus_free(struct wpa_global *global);
#ifdef CONFIG_WPS
void wpas_ubus_notify(struct wpa_supplicant *wpa_s, const struct wps_credential *cred);
#endif
@ -48,6 +53,14 @@ static inline void wpas_ubus_free_bss(struct wpa_supplicant *wpa_s)
static inline void wpas_ubus_notify(struct wpa_supplicant *wpa_s, struct wps_credential *cred)
{
}
static inline void wpas_ubus_add(struct wpa_global *global)
{
}
static inline void wpas_ubus_free(struct wpa_global *global)
{
}
#endif
#endif

View File

@ -917,7 +917,7 @@ Fixes https://github.com/raspberrypi/linux/issues/2408
}
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5214,7 +5214,7 @@ static void port_event(struct usb_hub *h
@@ -5221,7 +5221,7 @@ static void port_event(struct usb_hub *h
u16 status = 0, unused;
port_dev->over_current_count++;

View File

@ -10,7 +10,7 @@ Subject: [PATCH 100/806] ARM64: Force hardware emulation of deprecated
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -182,10 +182,15 @@ static void __init register_insn_emulati
@@ -185,10 +185,15 @@ static void __init register_insn_emulati
switch (ops->status) {
case INSN_DEPRECATED:

View File

@ -12,7 +12,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -678,6 +678,8 @@ static bool sc16is7xx_port_irq(struct sc
@@ -696,6 +696,8 @@ static bool sc16is7xx_port_irq(struct sc
rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG);
if (rxlen)
sc16is7xx_handle_rx(port, rxlen, iir);

View File

@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/rtc/rtc-pcf8523.c
+++ b/drivers/rtc/rtc-pcf8523.c
@@ -201,8 +201,28 @@ static int pcf8523_rtc_read_time(struct
@@ -212,8 +212,28 @@ static int pcf8523_rtc_read_time(struct
if (err < 0)
return err;
@ -46,7 +46,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
tm->tm_sec = bcd2bin(regs[0] & 0x7f);
tm->tm_min = bcd2bin(regs[1] & 0x7f);
@@ -238,7 +258,6 @@ static int pcf8523_rtc_set_time(struct d
@@ -249,7 +269,6 @@ static int pcf8523_rtc_set_time(struct d
return err;
regs[0] = REG_SECONDS;

View File

@ -1,110 +0,0 @@
From 53fc43d7a369bab50b4d3dce73adf7d522f0ee20 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 18 May 2018 10:26:59 +0100
Subject: [PATCH 295/806] sc16is7xx: Fix for "Unexpected interrupt: 8"
The SC16IS752 has an Enhanced Feature Register which is aliased at the
same address as the Interrupt Identification Register; accessing it
requires that a magic value is written to the Line Configuration
Register. If an interrupt is raised while the EFR is mapped in then
the ISR won't be able to access the IIR, leading to the "Unexpected
interrupt" error messages.
Avoid the problem by claiming a mutex around accesses to the EFR
register, also claiming the mutex in the interrupt handler work
item (this is equivalent to disabling interrupts to interlock against
a non-threaded interrupt handler).
See: https://github.com/raspberrypi/linux/issues/2529
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/tty/serial/sc16is7xx.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -328,6 +328,7 @@ struct sc16is7xx_port {
struct kthread_worker kworker;
struct task_struct *kworker_task;
struct kthread_work irq_work;
+ struct mutex efr_lock;
struct sc16is7xx_one p[0];
};
@@ -499,6 +500,21 @@ static int sc16is7xx_set_baud(struct uar
div /= 4;
}
+ /* In an amazing feat of design, the Enhanced Features Register shares
+ * the address of the Interrupt Identification Register, and is
+ * switched in by writing a magic value (0xbf) to the Line Control
+ * Register. Any interrupt firing during this time will see the EFR
+ * where it expects the IIR to be, leading to "Unexpected interrupt"
+ * messages.
+ *
+ * Prevent this possibility by claiming a mutex while accessing the
+ * EFR, and claiming the same mutex from within the interrupt handler.
+ * This is similar to disabling the interrupt, but that doesn't work
+ * because the bulk of the interrupt processing is run as a workqueue
+ * job in thread context.
+ */
+ mutex_lock(&s->efr_lock);
+
lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG);
/* Open the LCR divisors for configuration */
@@ -514,6 +530,8 @@ static int sc16is7xx_set_baud(struct uar
/* Put LCR back to the normal mode */
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr);
+ mutex_unlock(&s->efr_lock);
+
sc16is7xx_port_update(port, SC16IS7XX_MCR_REG,
SC16IS7XX_MCR_CLKSEL_BIT,
prescaler);
@@ -698,6 +716,8 @@ static void sc16is7xx_ist(struct kthread
{
struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work);
+ mutex_lock(&s->efr_lock);
+
while (1) {
bool keep_polling = false;
int i;
@@ -707,6 +727,8 @@ static void sc16is7xx_ist(struct kthread
if (!keep_polling)
break;
}
+
+ mutex_unlock(&s->efr_lock);
}
static irqreturn_t sc16is7xx_irq(int irq, void *dev_id)
@@ -901,6 +923,9 @@ static void sc16is7xx_set_termios(struct
if (!(termios->c_cflag & CREAD))
port->ignore_status_mask |= SC16IS7XX_LSR_BRK_ERROR_MASK;
+ /* As above, claim the mutex while accessing the EFR. */
+ mutex_lock(&s->efr_lock);
+
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG,
SC16IS7XX_LCR_CONF_MODE_B);
@@ -922,6 +947,8 @@ static void sc16is7xx_set_termios(struct
/* Update LCR register */
sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr);
+ mutex_unlock(&s->efr_lock);
+
/* Get baud rate generator configuration */
baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 4 / 0xffff,
@@ -1187,6 +1214,7 @@ static int sc16is7xx_probe(struct device
s->regmap = regmap;
s->devtype = devtype;
dev_set_drvdata(dev, s);
+ mutex_init(&s->efr_lock);
kthread_init_worker(&s->kworker);
kthread_init_work(&s->irq_work, sc16is7xx_ist);

View File

@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
#define USB_VENDOR_ID_BELKIN 0x050d
#define USB_DEVICE_ID_FLIP_KVM 0x3201
@@ -1189,6 +1192,9 @@
@@ -1190,6 +1193,9 @@
#define USB_VENDOR_ID_XAT 0x2505
#define USB_DEVICE_ID_XAT_CSR 0x0220

View File

@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -368,12 +368,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
@@ -373,12 +373,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
extern struct Qdisc_ops pfifo_fast_ops;
extern struct Qdisc_ops mq_qdisc_ops;
extern struct Qdisc_ops noqueue_qdisc_ops;
@ -44,7 +44,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
device, it has to decide which ones to send first, which ones to
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -2029,7 +2029,7 @@ static int __init pktsched_init(void)
@@ -2031,7 +2031,7 @@ static int __init pktsched_init(void)
return err;
}

View File

@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -481,12 +481,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
@@ -486,12 +486,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
extern struct Qdisc_ops pfifo_fast_ops;
extern struct Qdisc_ops mq_qdisc_ops;
extern struct Qdisc_ops noqueue_qdisc_ops;

View File

@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -339,12 +339,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
@@ -344,12 +344,13 @@ extern struct Qdisc_ops noop_qdisc_ops;
extern struct Qdisc_ops pfifo_fast_ops;
extern struct Qdisc_ops mq_qdisc_ops;
extern struct Qdisc_ops noqueue_qdisc_ops;

View File

@ -267,16 +267,15 @@ Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
/*
--- a/arch/arm64/include/asm/pgtable-prot.h
+++ b/arch/arm64/include/asm/pgtable-prot.h
@@ -48,6 +48,8 @@
#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))
#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))
#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
+#define PROT_NORMAL_NS (PTE_TYPE_PAGE | PTE_AF | PTE_PXN | PTE_UXN | PTE_DIRTY | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
+
@@ -48,6 +48,7 @@
#define PROT_NORMAL_NC (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_NC))
#define PROT_NORMAL_WT (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL_WT))
#define PROT_NORMAL (PROT_DEFAULT | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
+#define PROT_NORMAL_NS (PTE_TYPE_PAGE | PTE_AF | PTE_PXN | PTE_UXN | PTE_WRITE | PTE_ATTRINDX(MT_NORMAL))
#define PROT_SECT_DEVICE_nGnRE (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
#define PROT_SECT_NORMAL (PROT_SECT_DEFAULT | PMD_SECT_PXN | PMD_SECT_UXN | PMD_ATTRINDX(MT_NORMAL))
@@ -68,6 +70,7 @@
@@ -68,6 +69,7 @@
#define PAGE_HYP_DEVICE __pgprot(PROT_DEVICE_nGnRE | PTE_HYP)
#define PAGE_S2 __pgprot(_PROT_DEFAULT | PTE_S2_MEMATTR(MT_S2_NORMAL) | PTE_S2_RDONLY)

View File

@ -14,11 +14,9 @@ Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
arch/arm/mach-mediatek/platsmp.c | 1 -
2 files changed, 3 deletions(-)
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6910b4e0d913..c3cf215773b2 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -30,7 +30,6 @@ static void __init mediatek_timer_init(void)
@@ -30,7 +30,6 @@ static void __init mediatek_timer_init(v
if (of_machine_is_compatible("mediatek,mt6589") ||
of_machine_is_compatible("mediatek,mt7623") ||
@ -26,7 +24,7 @@ index 6910b4e0d913..c3cf215773b2 100644
of_machine_is_compatible("mediatek,mt8135") ||
of_machine_is_compatible("mediatek,mt8127")) {
/* turn on GPT6 which ungates arch timer clocks */
@@ -50,7 +49,6 @@ static const char * const mediatek_board_dt_compat[] = {
@@ -50,7 +49,6 @@ static const char * const mediatek_board
"mediatek,mt6589",
"mediatek,mt6592",
"mediatek,mt7623",
@ -34,11 +32,9 @@ index 6910b4e0d913..c3cf215773b2 100644
"mediatek,mt8127",
"mediatek,mt8135",
NULL,
diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 6882ff07aaa6..51e85562098c 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -60,7 +60,6 @@ static const struct of_device_id mtk_tz_smp_boot_infos[] __initconst = {
@@ -60,7 +60,6 @@ static const struct of_device_id mtk_tz_
static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
{ .compatible = "mediatek,mt6589", .data = &mtk_mt6589_boot },
{ .compatible = "mediatek,mt7623", .data = &mtk_mt7623_boot },
@ -46,6 +42,3 @@ index 6882ff07aaa6..51e85562098c 100644
{},
};
--
2.21.0

View File

@ -13,8 +13,6 @@ Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
arch/arm/mach-mediatek/platsmp.c | 1 +
3 files changed, 6 insertions(+)
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
index 91cc461f7b04..11ed264f0731 100644
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -26,6 +26,10 @@ config MACH_MT7623
@ -28,11 +26,9 @@ index 91cc461f7b04..11ed264f0731 100644
config MACH_MT8127
bool "MediaTek MT8127 SoCs support"
default ARCH_MEDIATEK
diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index c3cf215773b2..b6a81ba1ce32 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -49,6 +49,7 @@ static const char * const mediatek_board_dt_compat[] = {
@@ -49,6 +49,7 @@ static const char * const mediatek_board
"mediatek,mt6589",
"mediatek,mt6592",
"mediatek,mt7623",
@ -40,11 +36,9 @@ index c3cf215773b2..b6a81ba1ce32 100644
"mediatek,mt8127",
"mediatek,mt8135",
NULL,
diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 51e85562098c..c9d7c0458452 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -60,6 +60,7 @@ static const struct of_device_id mtk_tz_smp_boot_infos[] __initconst = {
@@ -60,6 +60,7 @@ static const struct of_device_id mtk_tz_
static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
{ .compatible = "mediatek,mt6589", .data = &mtk_mt6589_boot },
{ .compatible = "mediatek,mt7623", .data = &mtk_mt7623_boot },
@ -52,6 +46,3 @@ index 51e85562098c..c9d7c0458452 100644
{},
};
--
2.21.0

View File

@ -22,8 +22,6 @@ Signed-off-by: Stephen Boyd <sboyd@kernel.org>
create mode 100644 drivers/clk/mediatek/clk-mt7629.c
create mode 100644 include/dt-bindings/clock/mt7629-clk.h
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
index 3dd1dab92223..53edade25a1d 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -178,6 +178,29 @@ config COMMON_CLK_MT7622_AUDSYS
@ -56,11 +54,9 @@ index 3dd1dab92223..53edade25a1d 100644
config COMMON_CLK_MT8135
bool "Clock driver for MediaTek MT8135"
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 844b55d2770d..ee4410ff43ab 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -26,5 +26,8 @@ obj-$(CONFIG_COMMON_CLK_MT7622) += clk-mt7622.o
@@ -26,5 +26,8 @@ obj-$(CONFIG_COMMON_CLK_MT7622) += clk-m
obj-$(CONFIG_COMMON_CLK_MT7622_ETHSYS) += clk-mt7622-eth.o
obj-$(CONFIG_COMMON_CLK_MT7622_HIFSYS) += clk-mt7622-hif.o
obj-$(CONFIG_COMMON_CLK_MT7622_AUDSYS) += clk-mt7622-aud.o
@ -69,9 +65,6 @@ index 844b55d2770d..ee4410ff43ab 100644
+obj-$(CONFIG_COMMON_CLK_MT7629_HIFSYS) += clk-mt7629-hif.o
obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o
obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
diff --git a/drivers/clk/mediatek/clk-mt7629-eth.c b/drivers/clk/mediatek/clk-mt7629-eth.c
new file mode 100644
index 000000000000..88279d0ea1a7
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt7629-eth.c
@@ -0,0 +1,159 @@
@ -234,9 +227,6 @@ index 000000000000..88279d0ea1a7
+};
+
+builtin_platform_driver(clk_mt7629_eth_drv);
diff --git a/drivers/clk/mediatek/clk-mt7629-hif.c b/drivers/clk/mediatek/clk-mt7629-hif.c
new file mode 100644
index 000000000000..5c5b37207afb
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt7629-hif.c
@@ -0,0 +1,156 @@
@ -396,9 +386,6 @@ index 000000000000..5c5b37207afb
+};
+
+builtin_platform_driver(clk_mt7629_hif_drv);
diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c
new file mode 100644
index 000000000000..200ba147bbc6
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt7629.c
@@ -0,0 +1,723 @@
@ -1125,9 +1112,6 @@ index 000000000000..200ba147bbc6
+}
+
+arch_initcall(clk_mt7629_init);
diff --git a/include/dt-bindings/clock/mt7629-clk.h b/include/dt-bindings/clock/mt7629-clk.h
new file mode 100644
index 000000000000..ad8e6d7f0154
--- /dev/null
+++ b/include/dt-bindings/clock/mt7629-clk.h
@@ -0,0 +1,203 @@
@ -1334,6 +1318,3 @@ index 000000000000..ad8e6d7f0154
+#define CLK_SGMII_NR_CLK 4
+
+#endif /* _DT_BINDINGS_CLK_MT7629_H */
--
2.21.0

View File

@ -53,8 +53,6 @@ a1a503a8c332 pinctrl: mediatek: add pinctrl-mtk-common-v2 for all MediaTek pinct
1c5fb66afa2a pinctrl: Include <linux/gpio/driver.h> nothing else
94f4e54cecaf pinctrl: Convert to using %pOFn instead of device_node.name
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index 9905dc672f6b..26ed5dca1460 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -3,7 +3,8 @@ menu "MediaTek pinctrl drivers"
@ -113,7 +111,7 @@ index 9905dc672f6b..26ed5dca1460 100644
config PINCTRL_MT8135
bool "Mediatek MT8135 pin control"
depends on MACH_MT8135 || COMPILE_TEST
@@ -45,15 +78,26 @@ config PINCTRL_MT2712
@@ -45,21 +78,46 @@ config PINCTRL_MT2712
default ARM64 && ARCH_MEDIATEK
select PINCTRL_MTK
@ -145,10 +143,11 @@ index 9905dc672f6b..26ed5dca1460 100644
config PINCTRL_MT8173
bool "Mediatek MT8173 pin control"
@@ -62,6 +106,20 @@ config PINCTRL_MT8173
depends on OF
depends on ARM64 || COMPILE_TEST
default ARM64 && ARCH_MEDIATEK
select PINCTRL_MTK
+ select PINCTRL_MTK
+
+config PINCTRL_MT8183
+ bool "Mediatek MT8183 pin control"
+ depends on OF
@ -161,13 +160,9 @@ index 9905dc672f6b..26ed5dca1460 100644
+ depends on OF
+ depends on ARM64 || COMPILE_TEST
+ default ARM64 && ARCH_MEDIATEK
+ select PINCTRL_MTK
+
select PINCTRL_MTK
# For PMIC
config PINCTRL_MT6397
bool "Mediatek MT6397 pin control"
diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
index 3de7156df345..a74325abd877 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -2,12 +2,20 @@
@ -191,8 +186,6 @@ index 3de7156df345..a74325abd877 100644
+obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o
+obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
obj-$(CONFIG_PINCTRL_MT6397) += pinctrl-mt6397.o
diff --git a/drivers/pinctrl/mediatek/mtk-eint.c b/drivers/pinctrl/mediatek/mtk-eint.c
index a613e546717a..f464f8cd274b 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.c
+++ b/drivers/pinctrl/mediatek/mtk-eint.c
@@ -11,7 +11,7 @@
@ -204,11 +197,9 @@ index a613e546717a..f464f8cd274b 100644
#include <linux/io.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
diff --git a/drivers/pinctrl/mediatek/mtk-eint.h b/drivers/pinctrl/mediatek/mtk-eint.h
index c286a9b940f2..48468d0fae68 100644
--- a/drivers/pinctrl/mediatek/mtk-eint.h
+++ b/drivers/pinctrl/mediatek/mtk-eint.h
@@ -92,13 +92,13 @@ static inline int mtk_eint_do_resume(struct mtk_eint *eint)
@@ -92,13 +92,13 @@ static inline int mtk_eint_do_resume(str
return -EOPNOTSUPP;
}
@ -224,9 +215,6 @@ index c286a9b940f2..48468d0fae68 100644
{
return -EOPNOTSUPP;
}
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
new file mode 100644
index 000000000000..aa1068d2867f
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -0,0 +1,690 @@
@ -920,9 +908,6 @@ index 000000000000..aa1068d2867f
+
+ return 0;
+}
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.h b/drivers/pinctrl/mediatek/pinctrl-moore.h
new file mode 100644
index 000000000000..e1b4b82b9d3d
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.h
@@ -0,0 +1,51 @@
@ -977,9 +962,6 @@ index 000000000000..e1b4b82b9d3d
+ const struct mtk_pin_soc *soc);
+
+#endif /* __PINCTRL_MOORE_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6765.c b/drivers/pinctrl/mediatek/pinctrl-mt6765.c
new file mode 100644
index 000000000000..32451e8693be
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt6765.c
@@ -0,0 +1,1108 @@
@ -2091,9 +2073,6 @@ index 000000000000..32451e8693be
+ return platform_driver_register(&mt6765_pinctrl_driver);
+}
+arch_initcall(mt6765_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6797.c b/drivers/pinctrl/mediatek/pinctrl-mt6797.c
new file mode 100644
index 000000000000..adebe4333ed9
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt6797.c
@@ -0,0 +1,82 @@
@ -2179,8 +2158,6 @@ index 000000000000..adebe4333ed9
+ return platform_driver_register(&mt6797_pinctrl_driver);
+}
+arch_initcall(mt6797_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7622.c b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
index 6f931b85701b..ce4a8a0cc19c 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7622.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7622.c
@@ -1,297 +1,140 @@
@ -2266,14 +2243,14 @@ index 6f931b85701b..ce4a8a0cc19c 100644
- * @bitpos: the start bit relative to the register
- * @next: the indication that the field would be extended to the
- next register
*/
- */
-struct mtk_pin_field {
- u32 offset;
- u32 mask;
- u8 bitpos;
- u8 next;
-};
-
-/* struct mtk_pin_field_calc - the structure that holds the range providing
- * the guide used to look up the relevant field
- * @s_pin: the start pin within the range
@ -2293,19 +2270,18 @@ index 6f931b85701b..ce4a8a0cc19c 100644
- u8 s_bit;
- u8 x_bits;
-};
+#include "pinctrl-moore.h"
-
-/* struct mtk_pin_reg_calc - the structure that holds all ranges used to
- * determine which register the pin would make use of
- * for certain pin attribute.
- * @range: the start address for the range
- * @nranges: the number of items in the range
- */
*/
-struct mtk_pin_reg_calc {
- const struct mtk_pin_field_calc *range;
- unsigned int nranges;
-};
-
-/* struct mtk_pin_soc - the structure that holds SoC-specific data */
-struct mtk_pin_soc {
- const struct mtk_pin_reg_calc *reg_cal;
@ -2318,7 +2294,8 @@ index 6f931b85701b..ce4a8a0cc19c 100644
- const struct mtk_eint_regs *eint_regs;
- const struct mtk_eint_hw *eint_hw;
-};
-
+#include "pinctrl-moore.h"
-struct mtk_pinctrl {
- struct pinctrl_dev *pctrl;
- void __iomem *base;
@ -2577,7 +2554,7 @@ index 6f931b85701b..ce4a8a0cc19c 100644
};
static const struct mtk_pin_reg_calc mt7622_reg_cals[PINCTRL_PIN_REG_MAX] = {
@@ -309,110 +152,110 @@ static const struct mtk_pin_reg_calc mt7622_reg_cals[PINCTRL_PIN_REG_MAX] = {
@@ -309,110 +152,110 @@ static const struct mtk_pin_reg_calc mt7
[PINCTRL_PIN_REG_RDSEL] = MTK_RANGE(mt7622_pin_rdsel_range),
};
@ -2792,7 +2769,7 @@ index 6f931b85701b..ce4a8a0cc19c 100644
};
/* List all groups consisting of these pins dedicated to the enablement of
@@ -906,18 +749,6 @@ static const struct function_desc mt7622_functions[] = {
@@ -906,18 +749,6 @@ static const struct function_desc mt7622
{"watchdog", mt7622_wdt_groups, ARRAY_SIZE(mt7622_wdt_groups)},
};
@ -2811,12 +2788,22 @@ index 6f931b85701b..ce4a8a0cc19c 100644
static const struct mtk_eint_hw mt7622_eint_hw = {
.port_mask = 7,
.ports = 7,
@@ -934,830 +765,38 @@ static const struct mtk_pin_soc mt7622_data = {
@@ -934,830 +765,38 @@ static const struct mtk_pin_soc mt7622_d
.funcs = mt7622_functions,
.nfuncs = ARRAY_SIZE(mt7622_functions),
.eint_hw = &mt7622_eint_hw,
-};
-
+ .gpio_m = 1,
+ .ies_present = false,
+ .base_names = mtk_default_register_base_names,
+ .nbase_names = ARRAY_SIZE(mtk_default_register_base_names),
+ .bias_disable_set = mtk_pinconf_bias_disable_set,
+ .bias_disable_get = mtk_pinconf_bias_disable_get,
+ .bias_set = mtk_pinconf_bias_set,
+ .bias_get = mtk_pinconf_bias_get,
+ .drive_set = mtk_pinconf_drive_set,
+ .drive_get = mtk_pinconf_drive_get,
};
-static void mtk_w32(struct mtk_pinctrl *pctl, u32 reg, u32 val)
-{
- writel_relaxed(val, pctl->base + reg);
@ -3549,18 +3536,6 @@ index 6f931b85701b..ce4a8a0cc19c 100644
-
-static const struct of_device_id mtk_pinctrl_of_match[] = {
- { .compatible = "mediatek,mt7622-pinctrl", .data = &mt7622_data},
+ .gpio_m = 1,
+ .ies_present = false,
+ .base_names = mtk_default_register_base_names,
+ .nbase_names = ARRAY_SIZE(mtk_default_register_base_names),
+ .bias_disable_set = mtk_pinconf_bias_disable_set,
+ .bias_disable_get = mtk_pinconf_bias_disable_get,
+ .bias_set = mtk_pinconf_bias_set,
+ .bias_get = mtk_pinconf_bias_get,
+ .drive_set = mtk_pinconf_drive_set,
+ .drive_get = mtk_pinconf_drive_get,
+};
+
+static const struct of_device_id mt7622_pinctrl_of_match[] = {
+ { .compatible = "mediatek,mt7622-pinctrl", },
{ }
@ -3665,9 +3640,6 @@ index 6f931b85701b..ce4a8a0cc19c 100644
}
-arch_initcall(mtk_pinctrl_init);
+arch_initcall(mt7622_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7623.c b/drivers/pinctrl/mediatek/pinctrl-mt7623.c
new file mode 100644
index 000000000000..b8d9d31db74f
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7623.c
@@ -0,0 +1,1441 @@
@ -5112,9 +5084,6 @@ index 000000000000..b8d9d31db74f
+ return platform_driver_register(&mtk_pinctrl_driver);
+}
+arch_initcall(mtk_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7629.c b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
new file mode 100644
index 000000000000..b5f0fa43245f
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
@@ -0,0 +1,450 @@
@ -5568,9 +5537,6 @@ index 000000000000..b5f0fa43245f
+ return platform_driver_register(&mt7629_pinctrl_driver);
+}
+arch_initcall(mt7629_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8183.c b/drivers/pinctrl/mediatek/pinctrl-mt8183.c
new file mode 100644
index 000000000000..9a74d5025be6
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8183.c
@@ -0,0 +1,595 @@
@ -6169,9 +6135,6 @@ index 000000000000..9a74d5025be6
+ return platform_driver_register(&mt8183_pinctrl_driver);
+}
+arch_initcall(mt8183_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8516.c b/drivers/pinctrl/mediatek/pinctrl-mt8516.c
new file mode 100644
index 000000000000..b375426aa61e
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8516.c
@@ -0,0 +1,362 @@
@ -6537,9 +6500,6 @@ index 000000000000..b375426aa61e
+ return platform_driver_register(&mtk_pinctrl_driver);
+}
+arch_initcall(mtk_pinctrl_init);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
new file mode 100644
index 000000000000..20e1c890e73b
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -0,0 +1,725 @@
@ -7268,9 +7228,6 @@ index 000000000000..20e1c890e73b
+
+ return 0;
+}
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
new file mode 100644
index 000000000000..1b7da42aa1d5
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
@@ -0,0 +1,302 @@
@ -7576,11 +7533,9 @@ index 000000000000..1b7da42aa1d5
+ const struct mtk_pin_desc *desc, u32 *val);
+
+#endif /* __PINCTRL_MTK_COMMON_V2_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 16ff56f93501..071623873ca5 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -514,8 +514,8 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
@@ -514,8 +514,8 @@ static int mtk_pctrl_dt_subnode_to_map(s
pins = of_find_property(node, "pinmux", NULL);
if (!pins) {
@ -7591,9 +7546,6 @@ index 16ff56f93501..071623873ca5 100644
return -EINVAL;
}
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt6765.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt6765.h
new file mode 100644
index 000000000000..772563720461
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt6765.h
@@ -0,0 +1,1754 @@
@ -9351,9 +9303,6 @@ index 000000000000..772563720461
+};
+
+#endif /* __PINCTRL_MTK_MT6765_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt6797.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt6797.h
new file mode 100644
index 000000000000..86ab78e80326
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt6797.h
@@ -0,0 +1,2429 @@
@ -11786,9 +11735,6 @@ index 000000000000..86ab78e80326
+};
+
+#endif /* __PINCTRL_MTK_MT6797_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h
new file mode 100644
index 000000000000..79adf5b8a186
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8183.h
@@ -0,0 +1,1916 @@
@ -13708,9 +13654,6 @@ index 000000000000..79adf5b8a186
+};
+
+#endif /* __PINCTRL_MTK_MT8183_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h
new file mode 100644
index 000000000000..f7a4c6e4a026
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8516.h
@@ -0,0 +1,1182 @@
@ -14896,9 +14839,6 @@ index 000000000000..f7a4c6e4a026
+};
+
+#endif /* __PINCTRL_MTK_MT8516_H */
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
new file mode 100644
index 000000000000..923264d0e9ef
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -0,0 +1,947 @@
@ -15849,9 +15789,6 @@ index 000000000000..923264d0e9ef
+ .suspend_noirq = mtk_paris_pinctrl_suspend,
+ .resume_noirq = mtk_paris_pinctrl_resume,
+};
diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.h b/drivers/pinctrl/mediatek/pinctrl-paris.h
new file mode 100644
index 000000000000..3d43771074e6
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.h
@@ -0,0 +1,65 @@

View File

@ -15,11 +15,9 @@ Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
drivers/mtd/spi-nor/mtk-quadspi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index 5442993b71ff..d9eed6844ba1 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -431,7 +431,8 @@ static int mtk_nor_init(struct mtk_nor *mtk_nor,
@@ -431,7 +431,8 @@ static int mtk_nor_init(struct mtk_nor *
struct device_node *flash_node)
{
const struct spi_nor_hwcaps hwcaps = {
@ -29,6 +27,3 @@ index 5442993b71ff..d9eed6844ba1 100644
SNOR_HWCAPS_READ_1_1_2 |
SNOR_HWCAPS_PP,
};
--
2.21.0