Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
@@ -26,7 +26,7 @@ drv_mac80211_init_device_config() {
|
||||
config_add_string tx_burst
|
||||
config_add_string distance
|
||||
config_add_int beacon_int chanbw frag rts
|
||||
config_add_int rxantenna txantenna antenna_gain txpower min_tx_power
|
||||
config_add_int rxantenna txantenna txpower min_tx_power
|
||||
config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
|
||||
config_add_array ht_capab
|
||||
config_add_array channels
|
||||
@@ -1080,7 +1080,7 @@ drv_mac80211_setup() {
|
||||
json_get_vars \
|
||||
phy macaddr path \
|
||||
country chanbw distance \
|
||||
txpower antenna_gain \
|
||||
txpower \
|
||||
rxantenna txantenna \
|
||||
frag rts beacon_int:100 htmode
|
||||
json_get_values basic_rate_list basic_rate
|
||||
@@ -1127,7 +1127,6 @@ drv_mac80211_setup() {
|
||||
set_default rxantenna 0xffffffff
|
||||
set_default txantenna 0xffffffff
|
||||
set_default distance 0
|
||||
set_default antenna_gain 0
|
||||
|
||||
[ "$txantenna" = "all" ] && txantenna=0xffffffff
|
||||
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff
|
||||
@@ -1136,7 +1135,6 @@ drv_mac80211_setup() {
|
||||
wireless_set_data phy="$phy" txantenna="$txantenna" rxantenna="$rxantenna"
|
||||
|
||||
iw phy "$phy" set antenna $txantenna $rxantenna >/dev/null 2>&1
|
||||
iw phy "$phy" set antenna_gain $antenna_gain >/dev/null 2>&1
|
||||
iw phy "$phy" set distance "$distance" >/dev/null 2>&1
|
||||
|
||||
if [ -n "$txpower" ]; then
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
--- a/include/net/cfg80211.h
|
||||
+++ b/include/net/cfg80211.h
|
||||
@@ -4084,6 +4084,7 @@ struct mgmt_frame_regs {
|
||||
* (as advertised by the nl80211 feature flag.)
|
||||
* @get_tx_power: store the current TX power into the dbm variable;
|
||||
* return 0 if successful
|
||||
+ * @set_antenna_gain: set antenna gain to reduce maximum tx power if necessary
|
||||
*
|
||||
* @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
|
||||
* functions to adjust rfkill hw state
|
||||
@@ -4434,6 +4435,7 @@ struct cfg80211_ops {
|
||||
enum nl80211_tx_power_setting type, int mbm);
|
||||
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
|
||||
int *dbm);
|
||||
+ int (*set_antenna_gain)(struct wiphy *wiphy, int dbi);
|
||||
|
||||
void (*rfkill_poll)(struct wiphy *wiphy);
|
||||
|
||||
--- a/include/net/mac80211.h
|
||||
+++ b/include/net/mac80211.h
|
||||
@@ -1677,6 +1677,7 @@ enum ieee80211_smps_mode {
|
||||
*
|
||||
* @power_level: requested transmit power (in dBm), backward compatibility
|
||||
* value only that is set to the minimum of all interfaces
|
||||
+ * @max_antenna_gain: maximum antenna gain adjusted by user config (in dBi)
|
||||
*
|
||||
* @chandef: the channel definition to tune to
|
||||
* @radar_enabled: whether radar detection is enabled
|
||||
@@ -1697,6 +1698,7 @@ enum ieee80211_smps_mode {
|
||||
struct ieee80211_conf {
|
||||
u32 flags;
|
||||
int power_level, dynamic_ps_timeout;
|
||||
+ int max_antenna_gain;
|
||||
|
||||
u16 listen_interval;
|
||||
u8 ps_dtim_period;
|
||||
--- a/include/uapi/linux/nl80211.h
|
||||
+++ b/include/uapi/linux/nl80211.h
|
||||
@@ -2749,6 +2749,9 @@ enum nl80211_commands {
|
||||
* When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
|
||||
* timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
|
||||
* the incoming frame RX timestamp.
|
||||
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
|
||||
+ * transmit power to stay within regulatory limits. u32, dBi.
|
||||
+ *
|
||||
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
@@ -3277,6 +3280,8 @@ enum nl80211_attrs {
|
||||
NL80211_ATTR_TX_HW_TIMESTAMP,
|
||||
NL80211_ATTR_RX_HW_TIMESTAMP,
|
||||
|
||||
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
|
||||
+
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
--- a/net/mac80211/cfg.c
|
||||
+++ b/net/mac80211/cfg.c
|
||||
@@ -3046,6 +3046,19 @@ static int ieee80211_get_tx_power(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int ieee80211_set_antenna_gain(struct wiphy *wiphy, int dbi)
|
||||
+{
|
||||
+ struct ieee80211_local *local = wiphy_priv(wiphy);
|
||||
+
|
||||
+ if (dbi < 0)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ local->user_antenna_gain = dbi;
|
||||
+ ieee80211_hw_config(local, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void ieee80211_rfkill_poll(struct wiphy *wiphy)
|
||||
{
|
||||
struct ieee80211_local *local = wiphy_priv(wiphy);
|
||||
@@ -4956,6 +4969,7 @@ const struct cfg80211_ops mac80211_confi
|
||||
.set_wiphy_params = ieee80211_set_wiphy_params,
|
||||
.set_tx_power = ieee80211_set_tx_power,
|
||||
.get_tx_power = ieee80211_get_tx_power,
|
||||
+ .set_antenna_gain = ieee80211_set_antenna_gain,
|
||||
.rfkill_poll = ieee80211_rfkill_poll,
|
||||
CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd)
|
||||
CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump)
|
||||
--- a/net/mac80211/ieee80211_i.h
|
||||
+++ b/net/mac80211/ieee80211_i.h
|
||||
@@ -1542,6 +1542,7 @@ struct ieee80211_local {
|
||||
int dynamic_ps_forced_timeout;
|
||||
|
||||
int user_power_level; /* in dBm, for all interfaces */
|
||||
+ int user_antenna_gain; /* in dBi */
|
||||
|
||||
enum ieee80211_smps_mode smps_mode;
|
||||
|
||||
--- a/net/mac80211/main.c
|
||||
+++ b/net/mac80211/main.c
|
||||
@@ -96,7 +96,7 @@ static u32 ieee80211_hw_conf_chan(struct
|
||||
struct ieee80211_sub_if_data *sdata;
|
||||
struct cfg80211_chan_def chandef = {};
|
||||
u32 changed = 0;
|
||||
- int power;
|
||||
+ int power, max_power;
|
||||
u32 offchannel_flag;
|
||||
|
||||
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
|
||||
@@ -157,6 +157,12 @@ static u32 ieee80211_hw_conf_chan(struct
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
+ max_power = chandef.chan->max_reg_power;
|
||||
+ if (local->user_antenna_gain > 0) {
|
||||
+ max_power -= local->user_antenna_gain;
|
||||
+ power = min(power, max_power);
|
||||
+ }
|
||||
+
|
||||
if (local->hw.conf.power_level != power) {
|
||||
changed |= IEEE80211_CONF_CHANGE_POWER;
|
||||
local->hw.conf.power_level = power;
|
||||
@@ -762,6 +768,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_
|
||||
IEEE80211_RADIOTAP_MCS_HAVE_BW;
|
||||
local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
|
||||
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
|
||||
+ local->user_antenna_gain = 0;
|
||||
local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
|
||||
local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
|
||||
local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
|
||||
--- a/net/wireless/nl80211.c
|
||||
+++ b/net/wireless/nl80211.c
|
||||
@@ -799,6 +799,7 @@ static const struct nla_policy nl80211_p
|
||||
[NL80211_ATTR_MLD_ADDR] = NLA_POLICY_EXACT_LEN(ETH_ALEN),
|
||||
[NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
|
||||
[NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
|
||||
+ [NL80211_ATTR_WIPHY_ANTENNA_GAIN] = { .type = NLA_U32 },
|
||||
};
|
||||
|
||||
/* policy for the key attributes */
|
||||
@@ -3511,6 +3512,22 @@ static int nl80211_set_wiphy(struct sk_b
|
||||
if (result)
|
||||
goto out;
|
||||
}
|
||||
+
|
||||
+ if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_GAIN]) {
|
||||
+ int idx, dbi = 0;
|
||||
+
|
||||
+ if (!rdev->ops->set_antenna_gain) {
|
||||
+ result = -EOPNOTSUPP;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ idx = NL80211_ATTR_WIPHY_ANTENNA_GAIN;
|
||||
+ dbi = nla_get_u32(info->attrs[idx]);
|
||||
+
|
||||
+ result = rdev->ops->set_antenna_gain(&rdev->wiphy, dbi);
|
||||
+ if (result)
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) {
|
||||
struct wireless_dev *txp_wdev = wdev;
|
||||
@@ -1,13 +1,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netifd
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
|
||||
PKG_SOURCE_DATE:=2023-08-17
|
||||
PKG_SOURCE_VERSION:=4711f74479e213ef86f8792b408b117d40148eb2
|
||||
PKG_MIRROR_HASH:=91c8aa8e890b0616c1ad1860618951ee73655c4e53cc31999dcbb8d00b8b456d
|
||||
PKG_SOURCE_DATE:=2023-08-31
|
||||
PKG_SOURCE_VERSION:=1a07f1dff32b3af49e39533e33e8964b59535662
|
||||
PKG_MIRROR_HASH:=dc621dd04c3c9631002f929cf10a4620f57af8b0baf614c590bda17957fa6201
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
Date: Fri, 24 Feb 2023 13:28:52 +0800
|
||||
Subject: [PATCH] Revert "device: add support for configuring device link
|
||||
speed/duplex"
|
||||
|
||||
Fixes auto-negotiate for out-of-tree ethernet drivers.
|
||||
|
||||
This reverts commit 1eb0fafaa9865b729509a7d47ecf1f05c2c0595c.
|
||||
---
|
||||
device.c | 14 --------------
|
||||
device.h | 6 ------
|
||||
system-linux.c | 52 --------------------------------------------------
|
||||
3 files changed, 72 deletions(-)
|
||||
|
||||
--- a/device.c
|
||||
+++ b/device.c
|
||||
@@ -61,8 +61,6 @@ static const struct blobmsg_policy dev_a
|
||||
[DEV_ATTR_DROP_UNSOLICITED_NA] = { .name = "drop_unsolicited_na", .type = BLOBMSG_TYPE_BOOL },
|
||||
[DEV_ATTR_ARP_ACCEPT] = { .name = "arp_accept", .type = BLOBMSG_TYPE_BOOL },
|
||||
[DEV_ATTR_AUTH] = { .name = "auth", .type = BLOBMSG_TYPE_BOOL },
|
||||
- [DEV_ATTR_SPEED] = { .name = "speed", .type = BLOBMSG_TYPE_INT32 },
|
||||
- [DEV_ATTR_DUPLEX] = { .name = "duplex", .type = BLOBMSG_TYPE_BOOL },
|
||||
[DEV_ATTR_VLAN] = { .name = "vlan", .type = BLOBMSG_TYPE_ARRAY },
|
||||
};
|
||||
|
||||
@@ -279,8 +277,6 @@ device_merge_settings(struct device *dev
|
||||
n->arp_accept = s->flags & DEV_OPT_ARP_ACCEPT ?
|
||||
s->arp_accept : os->arp_accept;
|
||||
n->auth = s->flags & DEV_OPT_AUTH ? s->auth : os->auth;
|
||||
- n->speed = s->flags & DEV_OPT_SPEED ? s->speed : os->speed;
|
||||
- n->duplex = s->flags & DEV_OPT_DUPLEX ? s->duplex : os->duplex;
|
||||
n->flags = s->flags | os->flags | os->valid_flags;
|
||||
}
|
||||
|
||||
@@ -496,15 +492,6 @@ device_init_settings(struct device *dev,
|
||||
s->flags |= DEV_OPT_AUTH;
|
||||
}
|
||||
|
||||
- if ((cur = tb[DEV_ATTR_SPEED])) {
|
||||
- s->speed = blobmsg_get_u32(cur);
|
||||
- s->flags |= DEV_OPT_SPEED;
|
||||
- }
|
||||
-
|
||||
- if ((cur = tb[DEV_ATTR_DUPLEX])) {
|
||||
- s->duplex = blobmsg_get_bool(cur);
|
||||
- s->flags |= DEV_OPT_DUPLEX;
|
||||
- }
|
||||
device_set_extra_vlans(dev, tb[DEV_ATTR_VLAN]);
|
||||
device_set_disabled(dev, disabled);
|
||||
}
|
||||
--- a/device.h
|
||||
+++ b/device.h
|
||||
@@ -60,8 +60,6 @@ enum {
|
||||
DEV_ATTR_DROP_UNSOLICITED_NA,
|
||||
DEV_ATTR_ARP_ACCEPT,
|
||||
DEV_ATTR_AUTH,
|
||||
- DEV_ATTR_SPEED,
|
||||
- DEV_ATTR_DUPLEX,
|
||||
DEV_ATTR_VLAN,
|
||||
__DEV_ATTR_MAX,
|
||||
};
|
||||
@@ -125,8 +123,6 @@ enum {
|
||||
DEV_OPT_DROP_GRATUITOUS_ARP = (1ULL << 27),
|
||||
DEV_OPT_DROP_UNSOLICITED_NA = (1ULL << 28),
|
||||
DEV_OPT_ARP_ACCEPT = (1ULL << 29),
|
||||
- DEV_OPT_SPEED = (1ULL << 30),
|
||||
- DEV_OPT_DUPLEX = (1ULL << 31),
|
||||
};
|
||||
|
||||
/* events broadcasted to all users of a device */
|
||||
@@ -202,8 +198,6 @@ struct device_settings {
|
||||
bool drop_unsolicited_na;
|
||||
bool arp_accept;
|
||||
bool auth;
|
||||
- unsigned int speed;
|
||||
- bool duplex;
|
||||
};
|
||||
|
||||
struct device_vlan_range {
|
||||
--- a/system-linux.c
|
||||
+++ b/system-linux.c
|
||||
@@ -1702,57 +1702,6 @@ int system_vlandev_del(struct device *vl
|
||||
return system_link_del(vlandev->ifname);
|
||||
}
|
||||
|
||||
-static void
|
||||
-system_set_ethtool_settings(struct device *dev, struct device_settings *s)
|
||||
-{
|
||||
- struct ethtool_cmd ecmd = {
|
||||
- .cmd = ETHTOOL_GSET,
|
||||
- };
|
||||
- struct ifreq ifr = {
|
||||
- .ifr_data = (caddr_t)&ecmd,
|
||||
- };
|
||||
- static const struct {
|
||||
- unsigned int speed;
|
||||
- uint8_t bit_half;
|
||||
- uint8_t bit_full;
|
||||
- } speed_mask[] = {
|
||||
- { 10, ETHTOOL_LINK_MODE_10baseT_Half_BIT, ETHTOOL_LINK_MODE_10baseT_Full_BIT },
|
||||
- { 100, ETHTOOL_LINK_MODE_100baseT_Half_BIT, ETHTOOL_LINK_MODE_100baseT_Full_BIT },
|
||||
- { 1000, ETHTOOL_LINK_MODE_1000baseT_Half_BIT, ETHTOOL_LINK_MODE_1000baseT_Full_BIT },
|
||||
- };
|
||||
- uint32_t adv;
|
||||
- size_t i;
|
||||
-
|
||||
- strncpy(ifr.ifr_name, dev->ifname, sizeof(ifr.ifr_name) - 1);
|
||||
-
|
||||
- if (ioctl(sock_ioctl, SIOCETHTOOL, &ifr) != 0)
|
||||
- return;
|
||||
-
|
||||
- adv = ecmd.supported;
|
||||
- for (i = 0; i < ARRAY_SIZE(speed_mask); i++) {
|
||||
- if (s->flags & DEV_OPT_DUPLEX) {
|
||||
- int bit = s->duplex ? speed_mask[i].bit_half : speed_mask[i].bit_full;
|
||||
- adv &= ~(1 << bit);
|
||||
- }
|
||||
-
|
||||
- if (!(s->flags & DEV_OPT_SPEED) ||
|
||||
- s->speed == speed_mask[i].speed)
|
||||
- continue;
|
||||
-
|
||||
- adv &= ~(1 << speed_mask[i].bit_full);
|
||||
- adv &= ~(1 << speed_mask[i].bit_half);
|
||||
- }
|
||||
-
|
||||
-
|
||||
- if (ecmd.autoneg && ecmd.advertising == adv)
|
||||
- return;
|
||||
-
|
||||
- ecmd.autoneg = 1;
|
||||
- ecmd.advertising = adv;
|
||||
- ecmd.cmd = ETHTOOL_SSET;
|
||||
- ioctl(sock_ioctl, SIOCETHTOOL, &ifr);
|
||||
-}
|
||||
-
|
||||
void
|
||||
system_if_get_settings(struct device *dev, struct device_settings *s)
|
||||
{
|
||||
@@ -1976,7 +1925,6 @@ system_if_apply_settings(struct device *
|
||||
system_set_drop_unsolicited_na(dev, s->drop_unsolicited_na ? "1" : "0");
|
||||
if (apply_mask & DEV_OPT_ARP_ACCEPT)
|
||||
system_set_arp_accept(dev, s->arp_accept ? "1" : "0");
|
||||
- system_set_ethtool_settings(dev, s);
|
||||
}
|
||||
|
||||
int system_if_up(struct device *dev)
|
||||
@@ -82,6 +82,7 @@ ifneq ($(CONFIG_DRIVER_11AX_SUPPORT),)
|
||||
endif
|
||||
|
||||
CORE_DEPENDS = +ucode +libubus +libucode +ucode-mod-fs +ucode-mod-nl80211 +ucode-mod-rtnl +ucode-mod-ubus +ucode-mod-uloop +libblobmsg-json
|
||||
OPENSSL_DEPENDS = +PACKAGE_$(1):libopenssl +PACKAGE_$(1):libopenssl-legacy
|
||||
|
||||
DRIVER_MAKEOPTS= \
|
||||
CONFIG_ACS=$(CONFIG_PACKAGE_kmod-cfg80211) \
|
||||
@@ -174,7 +175,7 @@ define Package/hostapd-openssl
|
||||
$(call Package/hostapd/Default,$(1))
|
||||
TITLE+= (OpenSSL full)
|
||||
VARIANT:=full-openssl
|
||||
DEPENDS+=+PACKAGE_hostapd-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
endef
|
||||
|
||||
Package/hostapd-openssl/description = $(Package/hostapd/description)
|
||||
@@ -281,7 +282,7 @@ define Package/wpad-openssl
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (OpenSSL full)
|
||||
VARIANT:=wpad-full-openssl
|
||||
DEPENDS+=+PACKAGE_wpad-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
endef
|
||||
|
||||
Package/wpad-openssl/description = $(Package/wpad/description)
|
||||
@@ -318,7 +319,7 @@ define Package/wpad-basic-openssl
|
||||
$(call Package/wpad/Default,$(1))
|
||||
TITLE+= (OpenSSL, 11r, 11w)
|
||||
VARIANT:=wpad-basic-openssl
|
||||
DEPENDS+=+PACKAGE_wpad-basic-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/wpad-basic-openssl/description
|
||||
@@ -370,7 +371,7 @@ endef
|
||||
define Package/wpad-mesh-openssl
|
||||
$(call Package/wpad-mesh,$(1))
|
||||
TITLE+= (OpenSSL, 11s, SAE)
|
||||
DEPENDS+=+PACKAGE_wpad-mesh-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
VARIANT:=wpad-mesh-openssl
|
||||
endef
|
||||
|
||||
@@ -419,7 +420,7 @@ define Package/wpa-supplicant-openssl
|
||||
$(call Package/wpa-supplicant/Default,$(1))
|
||||
TITLE+= (OpenSSL full)
|
||||
VARIANT:=supplicant-full-openssl
|
||||
DEPENDS+=+PACKAGE_wpa-supplicant-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-wolfssl
|
||||
@@ -457,7 +458,7 @@ define Package/wpa-supplicant-mesh-openssl
|
||||
$(call Package/wpa-supplicant-mesh/Default,$(1))
|
||||
TITLE+= (OpenSSL, 11s, SAE)
|
||||
VARIANT:=supplicant-mesh-openssl
|
||||
DEPENDS+=+PACKAGE_wpa-supplicant-mesh-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/wpa-supplicant-mesh-wolfssl
|
||||
@@ -537,7 +538,7 @@ define Package/eapol-test-openssl
|
||||
TITLE+= (OpenSSL full)
|
||||
VARIANT:=supplicant-full-openssl
|
||||
CONFLICTS:=$(filter-out eapol-test-openssl ,$(EAPOL_TEST_PROVIDERS))
|
||||
DEPENDS+=+PACKAGE_eapol-test-openssl:libopenssl
|
||||
DEPENDS+=$(OPENSSL_DEPENDS)
|
||||
PROVIDES:=eapol-test
|
||||
endef
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ hostapd_append_wpa_key_mgmt() {
|
||||
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384"
|
||||
;;
|
||||
eap-eap192)
|
||||
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
|
||||
eap-eap2)
|
||||
append wpa_key_mgmt "WPA-EAP"
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && {
|
||||
append wpa_key_mgmt "FT-EAP-SHA384"
|
||||
append wpa_key_mgmt "FT-EAP"
|
||||
}
|
||||
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-EAP-SHA256"
|
||||
append wpa_key_mgmt "WPA-EAP-SHA256"
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
|
||||
;;
|
||||
eap2)
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
|
||||
append wpa_key_mgmt "WPA-EAP-SHA256"
|
||||
;;
|
||||
sae)
|
||||
append wpa_key_mgmt "SAE"
|
||||
@@ -77,6 +77,10 @@ hostapd_append_wpa_key_mgmt() {
|
||||
|
||||
[ "$fils" -gt 0 ] && {
|
||||
case "$auth_type" in
|
||||
eap-192)
|
||||
append wpa_key_mgmt FILS-SHA384
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt FT-FILS-SHA384
|
||||
;;
|
||||
eap*)
|
||||
append wpa_key_mgmt FILS-SHA256
|
||||
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt FT-FILS-SHA256
|
||||
@@ -641,12 +645,12 @@ hostapd_set_bss_options() {
|
||||
[ -n "$ocv" ] && append bss_conf "ocv=$ocv" "$N"
|
||||
|
||||
case "$auth_type" in
|
||||
sae|owe|eap192|eap-eap192)
|
||||
sae|owe|eap2|eap192)
|
||||
set_default ieee80211w 2
|
||||
set_default sae_require_mfp 1
|
||||
set_default sae_pwe 2
|
||||
;;
|
||||
psk-sae)
|
||||
psk-sae|eap-eap2)
|
||||
set_default ieee80211w 1
|
||||
set_default sae_require_mfp 1
|
||||
set_default sae_pwe 2
|
||||
@@ -697,7 +701,7 @@ hostapd_set_bss_options() {
|
||||
vlan_possible=1
|
||||
wps_possible=1
|
||||
;;
|
||||
eap|eap192|eap-eap192)
|
||||
eap|eap2|eap-eap2|eap192)
|
||||
json_get_vars \
|
||||
auth_server auth_secret auth_port \
|
||||
dae_client dae_secret dae_port \
|
||||
@@ -1304,7 +1308,7 @@ wpa_supplicant_add_network() {
|
||||
default_disabled
|
||||
|
||||
case "$auth_type" in
|
||||
sae|owe|eap192|eap-eap192)
|
||||
sae|owe|eap2|eap192)
|
||||
set_default ieee80211w 2
|
||||
;;
|
||||
psk-sae)
|
||||
@@ -1387,7 +1391,7 @@ wpa_supplicant_add_network() {
|
||||
fi
|
||||
append network_data "$passphrase" "$N$T"
|
||||
;;
|
||||
eap|eap192|eap-eap192)
|
||||
eap|eap2|eap192)
|
||||
hostapd_append_wpa_key_mgmt
|
||||
key_mgmt="$wpa_key_mgmt"
|
||||
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
--- a/nl80211.h
|
||||
+++ b/nl80211.h
|
||||
@@ -324,6 +324,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
+ * DOC: Multi-Link Operation
|
||||
+ *
|
||||
+ * In Multi-Link Operation, a connection between to MLDs utilizes multiple
|
||||
+ * links. To use this in nl80211, various commands and responses now need
|
||||
+ * to or will include the new %NL80211_ATTR_MLO_LINKS attribute.
|
||||
+ * Additionally, various commands that need to operate on a specific link
|
||||
+ * now need to be given the %NL80211_ATTR_MLO_LINK_ID attribute, e.g. to
|
||||
+ * use %NL80211_CMD_START_AP or similar functions.
|
||||
+ */
|
||||
+
|
||||
+/**
|
||||
* enum nl80211_commands - supported nl80211 commands
|
||||
*
|
||||
* @NL80211_CMD_UNSPEC: unspecified command to catch errors
|
||||
@@ -366,14 +377,22 @@
|
||||
* the non-transmitting interfaces are deleted as well.
|
||||
*
|
||||
* @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
|
||||
- * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
|
||||
+ * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC
|
||||
+ * represents peer's MLD address for MLO pairwise key. For MLO group key,
|
||||
+ * the link is identified by %NL80211_ATTR_MLO_LINK_ID.
|
||||
* @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
|
||||
* %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
|
||||
+ * For MLO connection, the link to set default key is identified by
|
||||
+ * %NL80211_ATTR_MLO_LINK_ID.
|
||||
* @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
|
||||
* %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
|
||||
- * and %NL80211_ATTR_KEY_SEQ attributes.
|
||||
+ * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents
|
||||
+ * peer's MLD address for MLO pairwise key. The link to add MLO
|
||||
+ * group key is identified by %NL80211_ATTR_MLO_LINK_ID.
|
||||
* @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
|
||||
- * or %NL80211_ATTR_MAC.
|
||||
+ * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address
|
||||
+ * for MLO pairwise key. The link to delete group key is identified by
|
||||
+ * %NL80211_ATTR_MLO_LINK_ID.
|
||||
*
|
||||
* @NL80211_CMD_GET_BEACON: (not used)
|
||||
* @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
|
||||
@@ -753,6 +772,13 @@
|
||||
* %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
|
||||
* counters which will be updated to the current value. This attribute
|
||||
* is used during CSA period.
|
||||
+ * For TX on an MLD, the frequency can be omitted and the link ID be
|
||||
+ * specified, or if transmitting to a known peer MLD (with MLD addresses
|
||||
+ * in the frame) both can be omitted and the link will be selected by
|
||||
+ * lower layers.
|
||||
+ * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
|
||||
+ * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may
|
||||
+ * be included to indicate the ack TX timestamp.
|
||||
* @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
|
||||
* command may be used with the corresponding cookie to cancel the wait
|
||||
* time if it is known that it is no longer necessary. This command is
|
||||
@@ -763,7 +789,9 @@
|
||||
* transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
|
||||
* the TX command and %NL80211_ATTR_FRAME includes the contents of the
|
||||
* frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
|
||||
- * the frame.
|
||||
+ * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the
|
||||
+ * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
|
||||
+ * indicate the ack RX timestamp.
|
||||
* @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for
|
||||
* backward compatibility.
|
||||
*
|
||||
@@ -1108,6 +1136,12 @@
|
||||
* has been received. %NL80211_ATTR_FRAME is used to specify the
|
||||
* frame contents. The frame is the raw EAPoL data, without ethernet or
|
||||
* 802.11 headers.
|
||||
+ * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and
|
||||
+ * its effect will depend on the destination: If the destination is known
|
||||
+ * to be an MLD, this will be used as a hint to select the link to transmit
|
||||
+ * the frame on. If the destination is not an MLD, this will select both
|
||||
+ * the link to transmit on and the source address will be set to the link
|
||||
+ * address of that link.
|
||||
* When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
|
||||
* %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
|
||||
* indicating the protocol type of the received frame; whether the frame
|
||||
@@ -1237,6 +1271,16 @@
|
||||
* to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
|
||||
* specify the timeout value.
|
||||
*
|
||||
+ * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The
|
||||
+ * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link.
|
||||
+ * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come
|
||||
+ * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links
|
||||
+ * in preparation for e.g. roaming to a regular (non-MLO) AP.
|
||||
+ *
|
||||
+ * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station
|
||||
+ * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station
|
||||
+ * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station
|
||||
+ *
|
||||
* @NL80211_CMD_MAX: highest used command number
|
||||
* @__NL80211_CMD_AFTER_LAST: internal use
|
||||
*/
|
||||
@@ -1481,6 +1525,13 @@ enum nl80211_commands {
|
||||
|
||||
NL80211_CMD_ASSOC_COMEBACK,
|
||||
|
||||
+ NL80211_CMD_ADD_LINK,
|
||||
+ NL80211_CMD_REMOVE_LINK,
|
||||
+
|
||||
+ NL80211_CMD_ADD_LINK_STA,
|
||||
+ NL80211_CMD_MODIFY_LINK_STA,
|
||||
+ NL80211_CMD_REMOVE_LINK_STA,
|
||||
+
|
||||
/* add new commands above here */
|
||||
|
||||
/* used to define NL80211_CMD_MAX below */
|
||||
@@ -2340,8 +2391,10 @@ enum nl80211_commands {
|
||||
*
|
||||
* @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes:
|
||||
* %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA,
|
||||
- * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities per
|
||||
- * interface type.
|
||||
+ * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and
|
||||
+ * other interface-type specific capabilities per interface type. For MLO,
|
||||
+ * %NL80211_ATTR_EML_CAPABILITY and %NL80211_ATTR_MLD_CAPA_AND_OPS are
|
||||
+ * present.
|
||||
*
|
||||
* @NL80211_ATTR_MU_MIMO_GROUP_DATA: array of 24 bytes that defines a MU-MIMO
|
||||
* groupID for monitor mode.
|
||||
@@ -2663,6 +2716,44 @@ enum nl80211_commands {
|
||||
* association request when used with NL80211_CMD_NEW_STATION). Can be set
|
||||
* only if %NL80211_STA_FLAG_WME is set.
|
||||
*
|
||||
+ * @NL80211_ATTR_MLO_LINK_ID: A (u8) link ID for use with MLO, to be used with
|
||||
+ * various commands that need a link ID to operate.
|
||||
+ * @NL80211_ATTR_MLO_LINKS: A nested array of links, each containing some
|
||||
+ * per-link information and a link ID.
|
||||
+ * @NL80211_ATTR_MLD_ADDR: An MLD address, used with various commands such as
|
||||
+ * authenticate/associate.
|
||||
+ *
|
||||
+ * @NL80211_ATTR_MLO_SUPPORT: Flag attribute to indicate user space supports MLO
|
||||
+ * connection. Used with %NL80211_CMD_CONNECT. If this attribute is not
|
||||
+ * included in NL80211_CMD_CONNECT drivers must not perform MLO connection.
|
||||
+ *
|
||||
+ * @NL80211_ATTR_MAX_NUM_AKM_SUITES: U16 attribute. Indicates maximum number of
|
||||
+ * AKM suites allowed for %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
|
||||
+ * %NL80211_CMD_START_AP in %NL80211_CMD_GET_WIPHY response. If this
|
||||
+ * attribute is not present userspace shall consider maximum number of AKM
|
||||
+ * suites allowed as %NL80211_MAX_NR_AKM_SUITES which is the legacy maximum
|
||||
+ * number prior to the introduction of this attribute.
|
||||
+ *
|
||||
+ * @NL80211_ATTR_EML_CAPABILITY: EML Capability information (u16)
|
||||
+ * @NL80211_ATTR_MLD_CAPA_AND_OPS: MLD Capabilities and Operations (u16)
|
||||
+ *
|
||||
+ * @NL80211_ATTR_TX_HW_TIMESTAMP: Hardware timestamp for TX operation in
|
||||
+ * nanoseconds (u64). This is the device clock timestamp so it will
|
||||
+ * probably reset when the device is stopped or the firmware is reset.
|
||||
+ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the frame TX
|
||||
+ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
|
||||
+ * the ack TX timestamp.
|
||||
+ * @NL80211_ATTR_RX_HW_TIMESTAMP: Hardware timestamp for RX operation in
|
||||
+ * nanoseconds (u64). This is the device clock timestamp so it will
|
||||
+ * probably reset when the device is stopped or the firmware is reset.
|
||||
+ * When used with %NL80211_CMD_FRAME_TX_STATUS, indicates the ack RX
|
||||
+ * timestamp. When used with %NL80211_CMD_FRAME RX notification, indicates
|
||||
+ * the incoming frame RX timestamp.
|
||||
+ * @NL80211_ATTR_TD_BITMAP: Transition Disable bitmap, for subsequent
|
||||
+ * (re)associations.
|
||||
+ * @NL80211_ATTR_WIPHY_ANTENNA_GAIN: Configured antenna gain. Used to reduce
|
||||
+ * transmit power to stay within regulatory limits. u32, dBi.
|
||||
+ *
|
||||
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
|
||||
* @NL80211_ATTR_MAX: highest attribute number currently defined
|
||||
* @__NL80211_ATTR_AFTER_LAST: internal use
|
||||
@@ -3177,6 +3268,23 @@ enum nl80211_attrs {
|
||||
|
||||
NL80211_ATTR_DISABLE_EHT,
|
||||
|
||||
+ NL80211_ATTR_MLO_LINKS,
|
||||
+ NL80211_ATTR_MLO_LINK_ID,
|
||||
+ NL80211_ATTR_MLD_ADDR,
|
||||
+
|
||||
+ NL80211_ATTR_MLO_SUPPORT,
|
||||
+
|
||||
+ NL80211_ATTR_MAX_NUM_AKM_SUITES,
|
||||
+
|
||||
+ NL80211_ATTR_EML_CAPABILITY,
|
||||
+ NL80211_ATTR_MLD_CAPA_AND_OPS,
|
||||
+
|
||||
+ NL80211_ATTR_TX_HW_TIMESTAMP,
|
||||
+ NL80211_ATTR_RX_HW_TIMESTAMP,
|
||||
+ NL80211_ATTR_TD_BITMAP,
|
||||
+
|
||||
+ NL80211_ATTR_WIPHY_ANTENNA_GAIN,
|
||||
+
|
||||
/* add attributes here, update the policy in nl80211.c */
|
||||
|
||||
__NL80211_ATTR_AFTER_LAST,
|
||||
@@ -3231,6 +3339,11 @@ enum nl80211_attrs {
|
||||
#define NL80211_HE_MIN_CAPABILITY_LEN 16
|
||||
#define NL80211_HE_MAX_CAPABILITY_LEN 54
|
||||
#define NL80211_MAX_NR_CIPHER_SUITES 5
|
||||
+
|
||||
+/*
|
||||
+ * NL80211_MAX_NR_AKM_SUITES is obsolete when %NL80211_ATTR_MAX_NUM_AKM_SUITES
|
||||
+ * present in %NL80211_CMD_GET_WIPHY response.
|
||||
+ */
|
||||
#define NL80211_MAX_NR_AKM_SUITES 2
|
||||
#define NL80211_EHT_MIN_CAPABILITY_LEN 13
|
||||
#define NL80211_EHT_MAX_CAPABILITY_LEN 51
|
||||
@@ -4853,6 +4966,8 @@ enum nl80211_bss_scan_width {
|
||||
* Contains a nested array of signal strength attributes (u8, dBm),
|
||||
* using the nesting index as the antenna number.
|
||||
* @NL80211_BSS_FREQUENCY_OFFSET: frequency offset in KHz
|
||||
+ * @NL80211_BSS_MLO_LINK_ID: MLO link ID of the BSS (u8).
|
||||
+ * @NL80211_BSS_MLD_ADDR: MLD address of this BSS if connected to it.
|
||||
* @__NL80211_BSS_AFTER_LAST: internal
|
||||
* @NL80211_BSS_MAX: highest BSS attribute
|
||||
*/
|
||||
@@ -4878,6 +4993,8 @@ enum nl80211_bss {
|
||||
NL80211_BSS_PARENT_BSSID,
|
||||
NL80211_BSS_CHAIN_SIGNAL,
|
||||
NL80211_BSS_FREQUENCY_OFFSET,
|
||||
+ NL80211_BSS_MLO_LINK_ID,
|
||||
+ NL80211_BSS_MLD_ADDR,
|
||||
|
||||
/* keep last */
|
||||
__NL80211_BSS_AFTER_LAST,
|
||||
@@ -5874,7 +5991,7 @@ enum nl80211_ap_sme_features {
|
||||
* @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
|
||||
* the connected inactive stations in AP mode.
|
||||
* @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
|
||||
- * to work properly to suppport receiving regulatory hints from
|
||||
+ * to work properly to support receiving regulatory hints from
|
||||
* cellular base stations.
|
||||
* @NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL: (no longer available, only
|
||||
* here to reserve the value for API/ABI compatibility)
|
||||
@@ -6174,6 +6291,14 @@ enum nl80211_feature_flags {
|
||||
* @NL80211_EXT_FEATURE_RADAR_BACKGROUND: Device supports background radar/CAC
|
||||
* detection.
|
||||
*
|
||||
+ * @NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE: Device can perform a MAC address
|
||||
+ * change without having to bring the underlying network device down
|
||||
+ * first. For example, in station mode this can be used to vary the
|
||||
+ * origin MAC address prior to a connection to a new AP for privacy
|
||||
+ * or other reasons. Note that certain driver specific restrictions
|
||||
+ * might apply, e.g. no scans in progress, no offchannel operations
|
||||
+ * in progress, and no active connections.
|
||||
+ *
|
||||
* @NUM_NL80211_EXT_FEATURES: number of extended features.
|
||||
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
|
||||
*/
|
||||
@@ -6241,6 +6366,7 @@ enum nl80211_ext_feature_index {
|
||||
NL80211_EXT_FEATURE_BSS_COLOR,
|
||||
NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
|
||||
NL80211_EXT_FEATURE_RADAR_BACKGROUND,
|
||||
+ NL80211_EXT_FEATURE_POWERED_ADDR_CHANGE,
|
||||
|
||||
/* add new features before the definition below */
|
||||
NUM_NL80211_EXT_FEATURES,
|
||||
@@ -1,33 +0,0 @@
|
||||
--- a/phy.c
|
||||
+++ b/phy.c
|
||||
@@ -855,3 +855,30 @@ static int handle_get_txq(struct nl80211
|
||||
COMMAND(get, txq, "",
|
||||
NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
|
||||
"Get TXQ parameters.");
|
||||
+
|
||||
+static int handle_antenna_gain(struct nl80211_state *state,
|
||||
+ struct nl_msg *msg,
|
||||
+ int argc, char **argv,
|
||||
+ enum id_input id)
|
||||
+{
|
||||
+ char *endptr;
|
||||
+ int dbm;
|
||||
+
|
||||
+ /* get the required args */
|
||||
+ if (argc != 1)
|
||||
+ return 1;
|
||||
+
|
||||
+ dbm = strtol(argv[0], &endptr, 10);
|
||||
+ if (*endptr)
|
||||
+ return 2;
|
||||
+
|
||||
+ NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_GAIN, dbm);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+ nla_put_failure:
|
||||
+ return -ENOBUFS;
|
||||
+}
|
||||
+COMMAND(set, antenna_gain, "<antenna gain in dBm>",
|
||||
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna_gain,
|
||||
+ "Specify antenna gain.");
|
||||
@@ -0,0 +1,36 @@
|
||||
From 9ccfcbeb8f32ff89e99b36cb9cdebaa0d1b44ed1 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:24 +0100
|
||||
Subject: [PATCH] nvmem: sunxi_sid: Convert to devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-3-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/sunxi_sid.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/sunxi_sid.c
|
||||
+++ b/drivers/nvmem/sunxi_sid.c
|
||||
@@ -125,7 +125,6 @@ static int sun8i_sid_read_by_reg(void *c
|
||||
static int sunxi_sid_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
- struct resource *res;
|
||||
struct nvmem_config *nvmem_cfg;
|
||||
struct nvmem_device *nvmem;
|
||||
struct sunxi_sid *sid;
|
||||
@@ -142,8 +141,7 @@ static int sunxi_sid_probe(struct platfo
|
||||
return -EINVAL;
|
||||
sid->value_offset = cfg->value_offset;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- sid->base = devm_ioremap_resource(dev, res);
|
||||
+ sid->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(sid->base))
|
||||
return PTR_ERR(sid->base);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From cfadd0e7d9225566f320bc4dc716682be910be6c Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:25 +0100
|
||||
Subject: [PATCH] nvmem: brcm_nvram: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-4-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/brcm_nvram.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/brcm_nvram.c
|
||||
+++ b/drivers/nvmem/brcm_nvram.c
|
||||
@@ -159,8 +159,7 @@ static int brcm_nvram_probe(struct platf
|
||||
return -ENOMEM;
|
||||
priv->dev = dev;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0b49178e2b6b4aac3c7fa3ce8d8c02208a13b988 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:26 +0100
|
||||
Subject: [PATCH] nvmem: lpc18xx_otp: Convert to
|
||||
devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-5-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/lpc18xx_otp.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/lpc18xx_otp.c
|
||||
+++ b/drivers/nvmem/lpc18xx_otp.c
|
||||
@@ -68,14 +68,12 @@ static int lpc18xx_otp_probe(struct plat
|
||||
{
|
||||
struct nvmem_device *nvmem;
|
||||
struct lpc18xx_otp *otp;
|
||||
- struct resource *res;
|
||||
|
||||
otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL);
|
||||
if (!otp)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- otp->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ otp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(otp->base))
|
||||
return PTR_ERR(otp->base);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0a223a097709b99a0ba738d6be5b4f52c04ffb64 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:27 +0100
|
||||
Subject: [PATCH] nvmem: meson-mx-efuse: Convert to
|
||||
devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-6-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/meson-mx-efuse.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/meson-mx-efuse.c
|
||||
+++ b/drivers/nvmem/meson-mx-efuse.c
|
||||
@@ -194,7 +194,6 @@ static int meson_mx_efuse_probe(struct p
|
||||
{
|
||||
const struct meson_mx_efuse_platform_data *drvdata;
|
||||
struct meson_mx_efuse *efuse;
|
||||
- struct resource *res;
|
||||
|
||||
drvdata = of_device_get_match_data(&pdev->dev);
|
||||
if (!drvdata)
|
||||
@@ -204,8 +203,7 @@ static int meson_mx_efuse_probe(struct p
|
||||
if (!efuse)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- efuse->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ efuse->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(efuse->base))
|
||||
return PTR_ERR(efuse->base);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 94904db28db49ac8fbb2a273d25156db26a3a985 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:28 +0100
|
||||
Subject: [PATCH] nvmem: rockchip-efuse: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-7-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/rockchip-efuse.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/rockchip-efuse.c
|
||||
+++ b/drivers/nvmem/rockchip-efuse.c
|
||||
@@ -267,8 +267,7 @@ static int rockchip_efuse_probe(struct p
|
||||
if (!efuse)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- efuse->base = devm_ioremap_resource(dev, res);
|
||||
+ efuse->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(efuse->base))
|
||||
return PTR_ERR(efuse->base);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 0a4a8c0d238fec1fa4b85591524ef42ad261cb97 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:29 +0100
|
||||
Subject: [PATCH] nvmem: stm32-romem: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-8-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/stm32-romem.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/stm32-romem.c
|
||||
+++ b/drivers/nvmem/stm32-romem.c
|
||||
@@ -196,8 +196,7 @@ static int stm32_romem_probe(struct plat
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0bc0d6dc2a9a05ae6729b4622f09782d9f230815 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:30 +0100
|
||||
Subject: [PATCH] nvmem: qfprom: do some cleanup
|
||||
|
||||
Use devm_platform_ioremap_resource() and
|
||||
devm_platform_get_and_ioremap_resource() to simplify code.
|
||||
BTW convert to use dev_err_probe() instead of open it.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-9-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/qfprom.c | 17 +++++------------
|
||||
1 file changed, 5 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/qfprom.c
|
||||
+++ b/drivers/nvmem/qfprom.c
|
||||
@@ -374,8 +374,7 @@ static int qfprom_probe(struct platform_
|
||||
return -ENOMEM;
|
||||
|
||||
/* The corrected section is always provided */
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->qfpcorrected = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpcorrected = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->qfpcorrected))
|
||||
return PTR_ERR(priv->qfpcorrected);
|
||||
|
||||
@@ -402,12 +401,10 @@ static int qfprom_probe(struct platform_
|
||||
priv->qfpraw = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(priv->qfpraw))
|
||||
return PTR_ERR(priv->qfpraw);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
|
||||
- priv->qfpconf = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpconf = devm_platform_ioremap_resource(pdev, 2);
|
||||
if (IS_ERR(priv->qfpconf))
|
||||
return PTR_ERR(priv->qfpconf);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
|
||||
- priv->qfpsecurity = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpsecurity = devm_platform_ioremap_resource(pdev, 3);
|
||||
if (IS_ERR(priv->qfpsecurity))
|
||||
return PTR_ERR(priv->qfpsecurity);
|
||||
|
||||
@@ -427,12 +424,8 @@ static int qfprom_probe(struct platform_
|
||||
return PTR_ERR(priv->vcc);
|
||||
|
||||
priv->secclk = devm_clk_get(dev, "core");
|
||||
- if (IS_ERR(priv->secclk)) {
|
||||
- ret = PTR_ERR(priv->secclk);
|
||||
- if (ret != -EPROBE_DEFER)
|
||||
- dev_err(dev, "Error getting clock: %d\n", ret);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (IS_ERR(priv->secclk))
|
||||
+ return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n");
|
||||
|
||||
/* Only enable writing if we have SoC data. */
|
||||
if (priv->soc_data)
|
||||
@@ -0,0 +1,29 @@
|
||||
From 6ac41c556e22a0d7d267c9b9d48681d73af4b368 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:31 +0100
|
||||
Subject: [PATCH] nvmem: uniphier: Use devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-10-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/uniphier-efuse.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/uniphier-efuse.c
|
||||
+++ b/drivers/nvmem/uniphier-efuse.c
|
||||
@@ -41,8 +41,7 @@ static int uniphier_efuse_probe(struct p
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
From c8efcf7a86ebf2ff48584d270b3070a7075bc345 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Alpe <richard@bit42.se>
|
||||
Date: Mon, 10 Apr 2023 10:20:51 +0200
|
||||
Subject: [PATCH] nvmem: add new NXP QorIQ eFuse driver
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add SFP (Security Fuse Processor) read support for NXP (Freescale)
|
||||
QorIQ series SOC's.
|
||||
|
||||
This patch adds support for the T1023 SOC using the SFP offset from
|
||||
the existing T1023 device tree. In theory this should also work for
|
||||
T1024, T1014 and T1013 which uses the same SFP base offset.
|
||||
|
||||
Signed-off-by: Richard Alpe <richard@bit42.se>
|
||||
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 12 ++++++
|
||||
drivers/nvmem/Makefile | 2 +
|
||||
drivers/nvmem/qoriq-efuse.c | 78 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 92 insertions(+)
|
||||
create mode 100644 drivers/nvmem/qoriq-efuse.c
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -392,4 +392,16 @@ config NVMEM_ZYNQMP
|
||||
|
||||
If sure, say yes. If unsure, say no.
|
||||
|
||||
+config NVMEM_QORIQ_EFUSE
|
||||
+ tristate "NXP QorIQ eFuse support"
|
||||
+ depends on PPC_85xx || COMPILE_TEST
|
||||
+ depends on HAS_IOMEM
|
||||
+ help
|
||||
+ This driver provides read support for the eFuses (SFP) on NXP QorIQ
|
||||
+ series SoC's. This includes secure boot settings, the globally unique
|
||||
+ NXP ID 'FUIDR' and the OEM unique ID 'OUIDR'.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module
|
||||
+ will be called nvmem_qoriq_efuse.
|
||||
+
|
||||
endif
|
||||
--- a/drivers/nvmem/Makefile
|
||||
+++ b/drivers/nvmem/Makefile
|
||||
@@ -77,3 +77,5 @@ obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvme
|
||||
nvmem-vf610-ocotp-y := vf610-ocotp.o
|
||||
obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o
|
||||
nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o
|
||||
+obj-$(CONFIG_NVMEM_QORIQ_EFUSE) += nvmem-qoriq-efuse.o
|
||||
+nvmem-qoriq-efuse-y := qoriq-efuse.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/nvmem/qoriq-efuse.c
|
||||
@@ -0,0 +1,78 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2023 Westermo Network Technologies AB
|
||||
+ */
|
||||
+
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/nvmem-provider.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+struct qoriq_efuse_priv {
|
||||
+ void __iomem *base;
|
||||
+};
|
||||
+
|
||||
+static int qoriq_efuse_read(void *context, unsigned int offset, void *val,
|
||||
+ size_t bytes)
|
||||
+{
|
||||
+ struct qoriq_efuse_priv *priv = context;
|
||||
+
|
||||
+ /* .stride = 4 so offset is guaranteed to be aligned */
|
||||
+ __ioread32_copy(val, priv->base + offset, bytes / 4);
|
||||
+
|
||||
+ /* Ignore trailing bytes (there shouldn't be any) */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int qoriq_efuse_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct nvmem_config config = {
|
||||
+ .dev = &pdev->dev,
|
||||
+ .read_only = true,
|
||||
+ .reg_read = qoriq_efuse_read,
|
||||
+ .stride = sizeof(u32),
|
||||
+ .word_size = sizeof(u32),
|
||||
+ .name = "qoriq_efuse_read",
|
||||
+ .id = NVMEM_DEVID_AUTO,
|
||||
+ .root_only = true,
|
||||
+ };
|
||||
+ struct qoriq_efuse_priv *priv;
|
||||
+ struct nvmem_device *nvmem;
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
+ if (IS_ERR(priv->base))
|
||||
+ return PTR_ERR(priv->base);
|
||||
+
|
||||
+ config.size = resource_size(res);
|
||||
+ config.priv = priv;
|
||||
+ nvmem = devm_nvmem_register(config.dev, &config);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(nvmem);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id qoriq_efuse_of_match[] = {
|
||||
+ { .compatible = "fsl,t1023-sfp", },
|
||||
+ {/* sentinel */},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, qoriq_efuse_of_match);
|
||||
+
|
||||
+static struct platform_driver qoriq_efuse_driver = {
|
||||
+ .probe = qoriq_efuse_probe,
|
||||
+ .driver = {
|
||||
+ .name = "qoriq-efuse",
|
||||
+ .of_match_table = qoriq_efuse_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(qoriq_efuse_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Richard Alpe <richard.alpe@bit42.se>");
|
||||
+MODULE_DESCRIPTION("NXP QorIQ Security Fuse Processor (SFP) Reader");
|
||||
+MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,37 @@
|
||||
From 9d53d595f688c9837e88a919229cc61a165c7b9e Mon Sep 17 00:00:00 2001
|
||||
From: Diederik de Haas <didi.debian@cknow.org>
|
||||
Date: Mon, 24 Jul 2023 13:36:22 +0200
|
||||
Subject: [PATCH] nvmem: Kconfig: Fix typo "drive" -> "driver"
|
||||
|
||||
Fix typo where "driver" was meant instead of "drive".
|
||||
While at it, also capitalize "OTP".
|
||||
|
||||
Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
|
||||
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -247,7 +247,7 @@ config NVMEM_ROCKCHIP_EFUSE
|
||||
depends on ARCH_ROCKCHIP || COMPILE_TEST
|
||||
depends on HAS_IOMEM
|
||||
help
|
||||
- This is a simple drive to dump specified values of Rockchip SoC
|
||||
+ This is a simple driver to dump specified values of Rockchip SoC
|
||||
from eFuse, such as cpu-leakage.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
@@ -258,8 +258,8 @@ config NVMEM_ROCKCHIP_OTP
|
||||
depends on ARCH_ROCKCHIP || COMPILE_TEST
|
||||
depends on HAS_IOMEM
|
||||
help
|
||||
- This is a simple drive to dump specified values of Rockchip SoC
|
||||
- from otp, such as cpu-leakage.
|
||||
+ This is a simple driver to dump specified values of Rockchip SoC
|
||||
+ from OTP, such as cpu-leakage.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called nvmem_rockchip_otp.
|
||||
@@ -0,0 +1,152 @@
|
||||
From 0a9ec38c47c1ca4528aa058e2b9ea61901a7e632 Mon Sep 17 00:00:00 2001
|
||||
From: Komal Bajaj <quic_kbajaj@quicinc.com>
|
||||
Date: Tue, 1 Aug 2023 12:10:25 +0530
|
||||
Subject: [PATCH] nvmem: sec-qfprom: Add Qualcomm secure QFPROM support
|
||||
|
||||
For some of the Qualcomm SoC's, it is possible that
|
||||
some of the fuse regions or entire qfprom region is
|
||||
protected from non-secure access. In such situations,
|
||||
the OS will have to use secure calls to read the region.
|
||||
With that motivation, add secure qfprom driver.
|
||||
|
||||
Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 13 ++++++
|
||||
drivers/nvmem/Makefile | 2 +
|
||||
drivers/nvmem/sec-qfprom.c | 96 ++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 111 insertions(+)
|
||||
create mode 100644 drivers/nvmem/sec-qfprom.c
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -226,6 +226,19 @@ config NVMEM_QCOM_QFPROM
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called nvmem_qfprom.
|
||||
|
||||
+config NVMEM_QCOM_SEC_QFPROM
|
||||
+ tristate "QCOM SECURE QFPROM Support"
|
||||
+ depends on ARCH_QCOM || COMPILE_TEST
|
||||
+ depends on HAS_IOMEM
|
||||
+ depends on OF
|
||||
+ select QCOM_SCM
|
||||
+ help
|
||||
+ Say y here to enable secure QFPROM support. The secure QFPROM provides access
|
||||
+ functions for QFPROM data to rest of the drivers via nvmem interface.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module will be called
|
||||
+ nvmem_sec_qfprom.
|
||||
+
|
||||
config NVMEM_RAVE_SP_EEPROM
|
||||
tristate "Rave SP EEPROM Support"
|
||||
depends on RAVE_SP_CORE
|
||||
--- a/drivers/nvmem/Makefile
|
||||
+++ b/drivers/nvmem/Makefile
|
||||
@@ -46,6 +46,8 @@ obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvme
|
||||
nvmem-nintendo-otp-y := nintendo-otp.o
|
||||
obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o
|
||||
nvmem_qfprom-y := qfprom.o
|
||||
+obj-$(CONFIG_NVMEM_QCOM_SEC_QFPROM) += nvmem_sec_qfprom.o
|
||||
+nvmem_sec_qfprom-y := sec-qfprom.o
|
||||
obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o
|
||||
nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o
|
||||
obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/nvmem/sec-qfprom.c
|
||||
@@ -0,0 +1,96 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/firmware/qcom/qcom_scm.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/nvmem-provider.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
+
|
||||
+/**
|
||||
+ * struct sec_qfprom - structure holding secure qfprom attributes
|
||||
+ *
|
||||
+ * @base: starting physical address for secure qfprom corrected address space.
|
||||
+ * @dev: qfprom device structure.
|
||||
+ */
|
||||
+struct sec_qfprom {
|
||||
+ phys_addr_t base;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static int sec_qfprom_reg_read(void *context, unsigned int reg, void *_val, size_t bytes)
|
||||
+{
|
||||
+ struct sec_qfprom *priv = context;
|
||||
+ unsigned int i;
|
||||
+ u8 *val = _val;
|
||||
+ u32 read_val;
|
||||
+ u8 *tmp;
|
||||
+
|
||||
+ for (i = 0; i < bytes; i++, reg++) {
|
||||
+ if (i == 0 || reg % 4 == 0) {
|
||||
+ if (qcom_scm_io_readl(priv->base + (reg & ~3), &read_val)) {
|
||||
+ dev_err(priv->dev, "Couldn't access fuse register\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ tmp = (u8 *)&read_val;
|
||||
+ }
|
||||
+
|
||||
+ val[i] = tmp[reg & 3];
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int sec_qfprom_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct nvmem_config econfig = {
|
||||
+ .name = "sec-qfprom",
|
||||
+ .stride = 1,
|
||||
+ .word_size = 1,
|
||||
+ .id = NVMEM_DEVID_AUTO,
|
||||
+ .reg_read = sec_qfprom_reg_read,
|
||||
+ };
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct nvmem_device *nvmem;
|
||||
+ struct sec_qfprom *priv;
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ priv->base = res->start;
|
||||
+
|
||||
+ econfig.size = resource_size(res);
|
||||
+ econfig.dev = dev;
|
||||
+ econfig.priv = priv;
|
||||
+
|
||||
+ priv->dev = dev;
|
||||
+
|
||||
+ nvmem = devm_nvmem_register(dev, &econfig);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(nvmem);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id sec_qfprom_of_match[] = {
|
||||
+ { .compatible = "qcom,sec-qfprom" },
|
||||
+ {/* sentinel */},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, sec_qfprom_of_match);
|
||||
+
|
||||
+static struct platform_driver qfprom_driver = {
|
||||
+ .probe = sec_qfprom_probe,
|
||||
+ .driver = {
|
||||
+ .name = "qcom_sec_qfprom",
|
||||
+ .of_match_table = sec_qfprom_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(qfprom_driver);
|
||||
+MODULE_DESCRIPTION("Qualcomm Secure QFPROM driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,30 @@
|
||||
From c32f2186acc9abb4d766361255d7ddf07d15eeb2 Mon Sep 17 00:00:00 2001
|
||||
From: Atul Raut <rauji.raut@gmail.com>
|
||||
Date: Sun, 30 Jul 2023 15:39:15 -0700
|
||||
Subject: [PATCH] nvmem: u-boot-env:: Replace zero-length array with
|
||||
DECLARE_FLEX_ARRAY() helper
|
||||
|
||||
We are moving toward replacing zero-length arrays with C99 flexible-array
|
||||
members since they are deprecated. Therefore, the new DECLARE_FLEX_ARRAY()
|
||||
helper macro should be used to replace the zero-length array declaration.
|
||||
|
||||
This fixes warnings such as:
|
||||
./drivers/nvmem/u-boot-env.c:50:9-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
|
||||
|
||||
Signed-off-by: Atul Raut <rauji.raut@gmail.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/u-boot-env.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/nvmem/u-boot-env.c
|
||||
+++ b/drivers/nvmem/u-boot-env.c
|
||||
@@ -47,7 +47,7 @@ struct u_boot_env_image_broadcom {
|
||||
__le32 magic;
|
||||
__le32 len;
|
||||
__le32 crc32;
|
||||
- uint8_t data[0];
|
||||
+ DECLARE_FLEX_ARRAY(uint8_t, data);
|
||||
} __packed;
|
||||
|
||||
static int u_boot_env_read(void *context, unsigned int offset, void *val,
|
||||
@@ -0,0 +1,40 @@
|
||||
From 104af6a5b199eb4dc7970d1304aef38ac5a6ed54 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:26 +0200
|
||||
Subject: [PATCH] nvmem: core: Create all cells before adding the nvmem device
|
||||
|
||||
Let's pack all the cells creation in one place, so they are all created
|
||||
before we add the nvmem device.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -998,17 +998,17 @@ struct nvmem_device *nvmem_register(cons
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
-
|
||||
- rval = device_add(&nvmem->dev);
|
||||
+ rval = nvmem_add_cells_from_fixed_layout(nvmem);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- rval = nvmem_add_cells_from_fixed_layout(nvmem);
|
||||
+ rval = nvmem_add_cells_from_layout(nvmem);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- rval = nvmem_add_cells_from_layout(nvmem);
|
||||
+ dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
+
|
||||
+ rval = device_add(&nvmem->dev);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 6c7f48ea2e663b679aa8e60d8d8e1e6306a644f9 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:27 +0200
|
||||
Subject: [PATCH] nvmem: core: Return NULL when no nvmem layout is found
|
||||
|
||||
Currently, of_nvmem_layout_get_container() returns NULL on error, or an
|
||||
error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We
|
||||
should likely avoid this kind of mix for two reasons: to clarify the
|
||||
intend and anyway fix the !CONFIG_OF which will likely always if we use
|
||||
this helper somewhere else. Let's just return NULL when no layout is
|
||||
found, we don't need an error value here.
|
||||
|
||||
Link: https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
|
||||
Fixes: 266570f496b9 ("nvmem: core: introduce NVMEM layouts")
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Closes: https://lore.kernel.org/r/202308030002.DnSFOrMB-lkp@intel.com/
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
include/linux/nvmem-consumer.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/nvmem-consumer.h
|
||||
+++ b/include/linux/nvmem-consumer.h
|
||||
@@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nv
|
||||
static inline struct device_node *
|
||||
of_nvmem_layout_get_container(struct nvmem_device *nvmem)
|
||||
{
|
||||
- return ERR_PTR(-EOPNOTSUPP);
|
||||
+ return NULL;
|
||||
}
|
||||
#endif /* CONFIG_NVMEM && CONFIG_OF */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From b8257f61b4ddac6d7d0e19a5a4e8b07afb3b4ed3 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:28 +0200
|
||||
Subject: [PATCH] nvmem: core: Do not open-code existing functions
|
||||
|
||||
Use of_nvmem_layout_get_container() instead of hardcoding it.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -786,10 +786,10 @@ EXPORT_SYMBOL_GPL(nvmem_layout_unregiste
|
||||
|
||||
static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem)
|
||||
{
|
||||
- struct device_node *layout_np, *np = nvmem->dev.of_node;
|
||||
+ struct device_node *layout_np;
|
||||
struct nvmem_layout *l, *layout = ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
- layout_np = of_get_child_by_name(np, "nvmem-layout");
|
||||
+ layout_np = of_nvmem_layout_get_container(nvmem);
|
||||
if (!layout_np)
|
||||
return NULL;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 0991afbe4b1805e7f0113ef10d7c5f0698a739e4 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:29 +0200
|
||||
Subject: [PATCH] nvmem: core: Notify when a new layout is registered
|
||||
|
||||
Tell listeners a new layout was introduced and is now available.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 4 ++++
|
||||
include/linux/nvmem-consumer.h | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -772,12 +772,16 @@ int __nvmem_layout_register(struct nvmem
|
||||
list_add(&layout->node, &nvmem_layouts);
|
||||
spin_unlock(&nvmem_layout_lock);
|
||||
|
||||
+ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__nvmem_layout_register);
|
||||
|
||||
void nvmem_layout_unregister(struct nvmem_layout *layout)
|
||||
{
|
||||
+ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout);
|
||||
+
|
||||
spin_lock(&nvmem_layout_lock);
|
||||
list_del(&layout->node);
|
||||
spin_unlock(&nvmem_layout_lock);
|
||||
--- a/include/linux/nvmem-consumer.h
|
||||
+++ b/include/linux/nvmem-consumer.h
|
||||
@@ -43,6 +43,8 @@ enum {
|
||||
NVMEM_REMOVE,
|
||||
NVMEM_CELL_ADD,
|
||||
NVMEM_CELL_REMOVE,
|
||||
+ NVMEM_LAYOUT_ADD,
|
||||
+ NVMEM_LAYOUT_REMOVE,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_NVMEM)
|
||||
@@ -0,0 +1,36 @@
|
||||
From 9ccfcbeb8f32ff89e99b36cb9cdebaa0d1b44ed1 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:24 +0100
|
||||
Subject: [PATCH] nvmem: sunxi_sid: Convert to devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-3-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/sunxi_sid.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/sunxi_sid.c
|
||||
+++ b/drivers/nvmem/sunxi_sid.c
|
||||
@@ -125,7 +125,6 @@ static int sun8i_sid_read_by_reg(void *c
|
||||
static int sunxi_sid_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
- struct resource *res;
|
||||
struct nvmem_config *nvmem_cfg;
|
||||
struct nvmem_device *nvmem;
|
||||
struct sunxi_sid *sid;
|
||||
@@ -142,8 +141,7 @@ static int sunxi_sid_probe(struct platfo
|
||||
return -EINVAL;
|
||||
sid->value_offset = cfg->value_offset;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- sid->base = devm_ioremap_resource(dev, res);
|
||||
+ sid->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(sid->base))
|
||||
return PTR_ERR(sid->base);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From cfadd0e7d9225566f320bc4dc716682be910be6c Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:25 +0100
|
||||
Subject: [PATCH] nvmem: brcm_nvram: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-4-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/brcm_nvram.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/brcm_nvram.c
|
||||
+++ b/drivers/nvmem/brcm_nvram.c
|
||||
@@ -159,8 +159,7 @@ static int brcm_nvram_probe(struct platf
|
||||
return -ENOMEM;
|
||||
priv->dev = dev;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0b49178e2b6b4aac3c7fa3ce8d8c02208a13b988 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:26 +0100
|
||||
Subject: [PATCH] nvmem: lpc18xx_otp: Convert to
|
||||
devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-5-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/lpc18xx_otp.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/lpc18xx_otp.c
|
||||
+++ b/drivers/nvmem/lpc18xx_otp.c
|
||||
@@ -68,14 +68,12 @@ static int lpc18xx_otp_probe(struct plat
|
||||
{
|
||||
struct nvmem_device *nvmem;
|
||||
struct lpc18xx_otp *otp;
|
||||
- struct resource *res;
|
||||
|
||||
otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL);
|
||||
if (!otp)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- otp->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ otp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(otp->base))
|
||||
return PTR_ERR(otp->base);
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 0a223a097709b99a0ba738d6be5b4f52c04ffb64 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:27 +0100
|
||||
Subject: [PATCH] nvmem: meson-mx-efuse: Convert to
|
||||
devm_platform_ioremap_resource()
|
||||
|
||||
Use devm_platform_ioremap_resource() to simplify code.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-6-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/meson-mx-efuse.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/meson-mx-efuse.c
|
||||
+++ b/drivers/nvmem/meson-mx-efuse.c
|
||||
@@ -194,7 +194,6 @@ static int meson_mx_efuse_probe(struct p
|
||||
{
|
||||
const struct meson_mx_efuse_platform_data *drvdata;
|
||||
struct meson_mx_efuse *efuse;
|
||||
- struct resource *res;
|
||||
|
||||
drvdata = of_device_get_match_data(&pdev->dev);
|
||||
if (!drvdata)
|
||||
@@ -204,8 +203,7 @@ static int meson_mx_efuse_probe(struct p
|
||||
if (!efuse)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- efuse->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
+ efuse->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(efuse->base))
|
||||
return PTR_ERR(efuse->base);
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 94904db28db49ac8fbb2a273d25156db26a3a985 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:28 +0100
|
||||
Subject: [PATCH] nvmem: rockchip-efuse: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-7-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/rockchip-efuse.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/rockchip-efuse.c
|
||||
+++ b/drivers/nvmem/rockchip-efuse.c
|
||||
@@ -267,8 +267,7 @@ static int rockchip_efuse_probe(struct p
|
||||
if (!efuse)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- efuse->base = devm_ioremap_resource(dev, res);
|
||||
+ efuse->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(efuse->base))
|
||||
return PTR_ERR(efuse->base);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
From 0a4a8c0d238fec1fa4b85591524ef42ad261cb97 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:29 +0100
|
||||
Subject: [PATCH] nvmem: stm32-romem: Use
|
||||
devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-8-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/stm32-romem.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/stm32-romem.c
|
||||
+++ b/drivers/nvmem/stm32-romem.c
|
||||
@@ -196,8 +196,7 @@ static int stm32_romem_probe(struct plat
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
From 0bc0d6dc2a9a05ae6729b4622f09782d9f230815 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:30 +0100
|
||||
Subject: [PATCH] nvmem: qfprom: do some cleanup
|
||||
|
||||
Use devm_platform_ioremap_resource() and
|
||||
devm_platform_get_and_ioremap_resource() to simplify code.
|
||||
BTW convert to use dev_err_probe() instead of open it.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-9-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/qfprom.c | 17 +++++------------
|
||||
1 file changed, 5 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/qfprom.c
|
||||
+++ b/drivers/nvmem/qfprom.c
|
||||
@@ -374,8 +374,7 @@ static int qfprom_probe(struct platform_
|
||||
return -ENOMEM;
|
||||
|
||||
/* The corrected section is always provided */
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->qfpcorrected = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpcorrected = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->qfpcorrected))
|
||||
return PTR_ERR(priv->qfpcorrected);
|
||||
|
||||
@@ -402,12 +401,10 @@ static int qfprom_probe(struct platform_
|
||||
priv->qfpraw = devm_ioremap_resource(dev, res);
|
||||
if (IS_ERR(priv->qfpraw))
|
||||
return PTR_ERR(priv->qfpraw);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
|
||||
- priv->qfpconf = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpconf = devm_platform_ioremap_resource(pdev, 2);
|
||||
if (IS_ERR(priv->qfpconf))
|
||||
return PTR_ERR(priv->qfpconf);
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 3);
|
||||
- priv->qfpsecurity = devm_ioremap_resource(dev, res);
|
||||
+ priv->qfpsecurity = devm_platform_ioremap_resource(pdev, 3);
|
||||
if (IS_ERR(priv->qfpsecurity))
|
||||
return PTR_ERR(priv->qfpsecurity);
|
||||
|
||||
@@ -427,12 +424,8 @@ static int qfprom_probe(struct platform_
|
||||
return PTR_ERR(priv->vcc);
|
||||
|
||||
priv->secclk = devm_clk_get(dev, "core");
|
||||
- if (IS_ERR(priv->secclk)) {
|
||||
- ret = PTR_ERR(priv->secclk);
|
||||
- if (ret != -EPROBE_DEFER)
|
||||
- dev_err(dev, "Error getting clock: %d\n", ret);
|
||||
- return ret;
|
||||
- }
|
||||
+ if (IS_ERR(priv->secclk))
|
||||
+ return dev_err_probe(dev, PTR_ERR(priv->secclk), "Error getting clock\n");
|
||||
|
||||
/* Only enable writing if we have SoC data. */
|
||||
if (priv->soc_data)
|
||||
@@ -0,0 +1,29 @@
|
||||
From 6ac41c556e22a0d7d267c9b9d48681d73af4b368 Mon Sep 17 00:00:00 2001
|
||||
From: Yangtao Li <frank.li@vivo.com>
|
||||
Date: Wed, 23 Aug 2023 14:27:31 +0100
|
||||
Subject: [PATCH] nvmem: uniphier: Use devm_platform_get_and_ioremap_resource()
|
||||
|
||||
Convert platform_get_resource(), devm_ioremap_resource() to a single
|
||||
call to devm_platform_get_and_ioremap_resource(), as this is exactly
|
||||
what this function does.
|
||||
|
||||
Signed-off-by: Yangtao Li <frank.li@vivo.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Link: https://lore.kernel.org/r/20230823132744.350618-10-srinivas.kandagatla@linaro.org
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
---
|
||||
drivers/nvmem/uniphier-efuse.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/uniphier-efuse.c
|
||||
+++ b/drivers/nvmem/uniphier-efuse.c
|
||||
@@ -41,8 +41,7 @@ static int uniphier_efuse_probe(struct p
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
- priv->base = devm_ioremap_resource(dev, res);
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
From c8efcf7a86ebf2ff48584d270b3070a7075bc345 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Alpe <richard@bit42.se>
|
||||
Date: Mon, 10 Apr 2023 10:20:51 +0200
|
||||
Subject: [PATCH] nvmem: add new NXP QorIQ eFuse driver
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add SFP (Security Fuse Processor) read support for NXP (Freescale)
|
||||
QorIQ series SOC's.
|
||||
|
||||
This patch adds support for the T1023 SOC using the SFP offset from
|
||||
the existing T1023 device tree. In theory this should also work for
|
||||
T1024, T1014 and T1013 which uses the same SFP base offset.
|
||||
|
||||
Signed-off-by: Richard Alpe <richard@bit42.se>
|
||||
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 12 ++++++
|
||||
drivers/nvmem/Makefile | 2 +
|
||||
drivers/nvmem/qoriq-efuse.c | 78 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 92 insertions(+)
|
||||
create mode 100644 drivers/nvmem/qoriq-efuse.c
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -392,4 +392,16 @@ config NVMEM_ZYNQMP
|
||||
|
||||
If sure, say yes. If unsure, say no.
|
||||
|
||||
+config NVMEM_QORIQ_EFUSE
|
||||
+ tristate "NXP QorIQ eFuse support"
|
||||
+ depends on PPC_85xx || COMPILE_TEST
|
||||
+ depends on HAS_IOMEM
|
||||
+ help
|
||||
+ This driver provides read support for the eFuses (SFP) on NXP QorIQ
|
||||
+ series SoC's. This includes secure boot settings, the globally unique
|
||||
+ NXP ID 'FUIDR' and the OEM unique ID 'OUIDR'.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module
|
||||
+ will be called nvmem_qoriq_efuse.
|
||||
+
|
||||
endif
|
||||
--- a/drivers/nvmem/Makefile
|
||||
+++ b/drivers/nvmem/Makefile
|
||||
@@ -77,3 +77,5 @@ obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvme
|
||||
nvmem-vf610-ocotp-y := vf610-ocotp.o
|
||||
obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o
|
||||
nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o
|
||||
+obj-$(CONFIG_NVMEM_QORIQ_EFUSE) += nvmem-qoriq-efuse.o
|
||||
+nvmem-qoriq-efuse-y := qoriq-efuse.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/nvmem/qoriq-efuse.c
|
||||
@@ -0,0 +1,78 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2023 Westermo Network Technologies AB
|
||||
+ */
|
||||
+
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/nvmem-provider.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+struct qoriq_efuse_priv {
|
||||
+ void __iomem *base;
|
||||
+};
|
||||
+
|
||||
+static int qoriq_efuse_read(void *context, unsigned int offset, void *val,
|
||||
+ size_t bytes)
|
||||
+{
|
||||
+ struct qoriq_efuse_priv *priv = context;
|
||||
+
|
||||
+ /* .stride = 4 so offset is guaranteed to be aligned */
|
||||
+ __ioread32_copy(val, priv->base + offset, bytes / 4);
|
||||
+
|
||||
+ /* Ignore trailing bytes (there shouldn't be any) */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int qoriq_efuse_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct nvmem_config config = {
|
||||
+ .dev = &pdev->dev,
|
||||
+ .read_only = true,
|
||||
+ .reg_read = qoriq_efuse_read,
|
||||
+ .stride = sizeof(u32),
|
||||
+ .word_size = sizeof(u32),
|
||||
+ .name = "qoriq_efuse_read",
|
||||
+ .id = NVMEM_DEVID_AUTO,
|
||||
+ .root_only = true,
|
||||
+ };
|
||||
+ struct qoriq_efuse_priv *priv;
|
||||
+ struct nvmem_device *nvmem;
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
+ if (IS_ERR(priv->base))
|
||||
+ return PTR_ERR(priv->base);
|
||||
+
|
||||
+ config.size = resource_size(res);
|
||||
+ config.priv = priv;
|
||||
+ nvmem = devm_nvmem_register(config.dev, &config);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(nvmem);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id qoriq_efuse_of_match[] = {
|
||||
+ { .compatible = "fsl,t1023-sfp", },
|
||||
+ {/* sentinel */},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, qoriq_efuse_of_match);
|
||||
+
|
||||
+static struct platform_driver qoriq_efuse_driver = {
|
||||
+ .probe = qoriq_efuse_probe,
|
||||
+ .driver = {
|
||||
+ .name = "qoriq-efuse",
|
||||
+ .of_match_table = qoriq_efuse_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(qoriq_efuse_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Richard Alpe <richard.alpe@bit42.se>");
|
||||
+MODULE_DESCRIPTION("NXP QorIQ Security Fuse Processor (SFP) Reader");
|
||||
+MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,37 @@
|
||||
From 9d53d595f688c9837e88a919229cc61a165c7b9e Mon Sep 17 00:00:00 2001
|
||||
From: Diederik de Haas <didi.debian@cknow.org>
|
||||
Date: Mon, 24 Jul 2023 13:36:22 +0200
|
||||
Subject: [PATCH] nvmem: Kconfig: Fix typo "drive" -> "driver"
|
||||
|
||||
Fix typo where "driver" was meant instead of "drive".
|
||||
While at it, also capitalize "OTP".
|
||||
|
||||
Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
|
||||
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -247,7 +247,7 @@ config NVMEM_ROCKCHIP_EFUSE
|
||||
depends on ARCH_ROCKCHIP || COMPILE_TEST
|
||||
depends on HAS_IOMEM
|
||||
help
|
||||
- This is a simple drive to dump specified values of Rockchip SoC
|
||||
+ This is a simple driver to dump specified values of Rockchip SoC
|
||||
from eFuse, such as cpu-leakage.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
@@ -258,8 +258,8 @@ config NVMEM_ROCKCHIP_OTP
|
||||
depends on ARCH_ROCKCHIP || COMPILE_TEST
|
||||
depends on HAS_IOMEM
|
||||
help
|
||||
- This is a simple drive to dump specified values of Rockchip SoC
|
||||
- from otp, such as cpu-leakage.
|
||||
+ This is a simple driver to dump specified values of Rockchip SoC
|
||||
+ from OTP, such as cpu-leakage.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called nvmem_rockchip_otp.
|
||||
@@ -0,0 +1,152 @@
|
||||
From 0a9ec38c47c1ca4528aa058e2b9ea61901a7e632 Mon Sep 17 00:00:00 2001
|
||||
From: Komal Bajaj <quic_kbajaj@quicinc.com>
|
||||
Date: Tue, 1 Aug 2023 12:10:25 +0530
|
||||
Subject: [PATCH] nvmem: sec-qfprom: Add Qualcomm secure QFPROM support
|
||||
|
||||
For some of the Qualcomm SoC's, it is possible that
|
||||
some of the fuse regions or entire qfprom region is
|
||||
protected from non-secure access. In such situations,
|
||||
the OS will have to use secure calls to read the region.
|
||||
With that motivation, add secure qfprom driver.
|
||||
|
||||
Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/Kconfig | 13 ++++++
|
||||
drivers/nvmem/Makefile | 2 +
|
||||
drivers/nvmem/sec-qfprom.c | 96 ++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 111 insertions(+)
|
||||
create mode 100644 drivers/nvmem/sec-qfprom.c
|
||||
|
||||
--- a/drivers/nvmem/Kconfig
|
||||
+++ b/drivers/nvmem/Kconfig
|
||||
@@ -226,6 +226,19 @@ config NVMEM_QCOM_QFPROM
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called nvmem_qfprom.
|
||||
|
||||
+config NVMEM_QCOM_SEC_QFPROM
|
||||
+ tristate "QCOM SECURE QFPROM Support"
|
||||
+ depends on ARCH_QCOM || COMPILE_TEST
|
||||
+ depends on HAS_IOMEM
|
||||
+ depends on OF
|
||||
+ select QCOM_SCM
|
||||
+ help
|
||||
+ Say y here to enable secure QFPROM support. The secure QFPROM provides access
|
||||
+ functions for QFPROM data to rest of the drivers via nvmem interface.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module will be called
|
||||
+ nvmem_sec_qfprom.
|
||||
+
|
||||
config NVMEM_RAVE_SP_EEPROM
|
||||
tristate "Rave SP EEPROM Support"
|
||||
depends on RAVE_SP_CORE
|
||||
--- a/drivers/nvmem/Makefile
|
||||
+++ b/drivers/nvmem/Makefile
|
||||
@@ -46,6 +46,8 @@ obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvme
|
||||
nvmem-nintendo-otp-y := nintendo-otp.o
|
||||
obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o
|
||||
nvmem_qfprom-y := qfprom.o
|
||||
+obj-$(CONFIG_NVMEM_QCOM_SEC_QFPROM) += nvmem_sec_qfprom.o
|
||||
+nvmem_sec_qfprom-y := sec-qfprom.o
|
||||
obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o
|
||||
nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o
|
||||
obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/nvmem/sec-qfprom.c
|
||||
@@ -0,0 +1,96 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/firmware/qcom/qcom_scm.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
+#include <linux/nvmem-provider.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
+
|
||||
+/**
|
||||
+ * struct sec_qfprom - structure holding secure qfprom attributes
|
||||
+ *
|
||||
+ * @base: starting physical address for secure qfprom corrected address space.
|
||||
+ * @dev: qfprom device structure.
|
||||
+ */
|
||||
+struct sec_qfprom {
|
||||
+ phys_addr_t base;
|
||||
+ struct device *dev;
|
||||
+};
|
||||
+
|
||||
+static int sec_qfprom_reg_read(void *context, unsigned int reg, void *_val, size_t bytes)
|
||||
+{
|
||||
+ struct sec_qfprom *priv = context;
|
||||
+ unsigned int i;
|
||||
+ u8 *val = _val;
|
||||
+ u32 read_val;
|
||||
+ u8 *tmp;
|
||||
+
|
||||
+ for (i = 0; i < bytes; i++, reg++) {
|
||||
+ if (i == 0 || reg % 4 == 0) {
|
||||
+ if (qcom_scm_io_readl(priv->base + (reg & ~3), &read_val)) {
|
||||
+ dev_err(priv->dev, "Couldn't access fuse register\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ tmp = (u8 *)&read_val;
|
||||
+ }
|
||||
+
|
||||
+ val[i] = tmp[reg & 3];
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int sec_qfprom_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct nvmem_config econfig = {
|
||||
+ .name = "sec-qfprom",
|
||||
+ .stride = 1,
|
||||
+ .word_size = 1,
|
||||
+ .id = NVMEM_DEVID_AUTO,
|
||||
+ .reg_read = sec_qfprom_reg_read,
|
||||
+ };
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct nvmem_device *nvmem;
|
||||
+ struct sec_qfprom *priv;
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ priv->base = res->start;
|
||||
+
|
||||
+ econfig.size = resource_size(res);
|
||||
+ econfig.dev = dev;
|
||||
+ econfig.priv = priv;
|
||||
+
|
||||
+ priv->dev = dev;
|
||||
+
|
||||
+ nvmem = devm_nvmem_register(dev, &econfig);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(nvmem);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id sec_qfprom_of_match[] = {
|
||||
+ { .compatible = "qcom,sec-qfprom" },
|
||||
+ {/* sentinel */},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, sec_qfprom_of_match);
|
||||
+
|
||||
+static struct platform_driver qfprom_driver = {
|
||||
+ .probe = sec_qfprom_probe,
|
||||
+ .driver = {
|
||||
+ .name = "qcom_sec_qfprom",
|
||||
+ .of_match_table = sec_qfprom_of_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(qfprom_driver);
|
||||
+MODULE_DESCRIPTION("Qualcomm Secure QFPROM driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
@@ -0,0 +1,30 @@
|
||||
From c32f2186acc9abb4d766361255d7ddf07d15eeb2 Mon Sep 17 00:00:00 2001
|
||||
From: Atul Raut <rauji.raut@gmail.com>
|
||||
Date: Sun, 30 Jul 2023 15:39:15 -0700
|
||||
Subject: [PATCH] nvmem: u-boot-env:: Replace zero-length array with
|
||||
DECLARE_FLEX_ARRAY() helper
|
||||
|
||||
We are moving toward replacing zero-length arrays with C99 flexible-array
|
||||
members since they are deprecated. Therefore, the new DECLARE_FLEX_ARRAY()
|
||||
helper macro should be used to replace the zero-length array declaration.
|
||||
|
||||
This fixes warnings such as:
|
||||
./drivers/nvmem/u-boot-env.c:50:9-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
|
||||
|
||||
Signed-off-by: Atul Raut <rauji.raut@gmail.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/u-boot-env.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/nvmem/u-boot-env.c
|
||||
+++ b/drivers/nvmem/u-boot-env.c
|
||||
@@ -47,7 +47,7 @@ struct u_boot_env_image_broadcom {
|
||||
__le32 magic;
|
||||
__le32 len;
|
||||
__le32 crc32;
|
||||
- uint8_t data[0];
|
||||
+ DECLARE_FLEX_ARRAY(uint8_t, data);
|
||||
} __packed;
|
||||
|
||||
static int u_boot_env_read(void *context, unsigned int offset, void *val,
|
||||
@@ -0,0 +1,40 @@
|
||||
From 104af6a5b199eb4dc7970d1304aef38ac5a6ed54 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:26 +0200
|
||||
Subject: [PATCH] nvmem: core: Create all cells before adding the nvmem device
|
||||
|
||||
Let's pack all the cells creation in one place, so they are all created
|
||||
before we add the nvmem device.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -998,17 +998,17 @@ struct nvmem_device *nvmem_register(cons
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
-
|
||||
- rval = device_add(&nvmem->dev);
|
||||
+ rval = nvmem_add_cells_from_fixed_layout(nvmem);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- rval = nvmem_add_cells_from_fixed_layout(nvmem);
|
||||
+ rval = nvmem_add_cells_from_layout(nvmem);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
- rval = nvmem_add_cells_from_layout(nvmem);
|
||||
+ dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name);
|
||||
+
|
||||
+ rval = device_add(&nvmem->dev);
|
||||
if (rval)
|
||||
goto err_remove_cells;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 6c7f48ea2e663b679aa8e60d8d8e1e6306a644f9 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:27 +0200
|
||||
Subject: [PATCH] nvmem: core: Return NULL when no nvmem layout is found
|
||||
|
||||
Currently, of_nvmem_layout_get_container() returns NULL on error, or an
|
||||
error pointer if either CONFIG_NVMEM or CONFIG_OF is turned off. We
|
||||
should likely avoid this kind of mix for two reasons: to clarify the
|
||||
intend and anyway fix the !CONFIG_OF which will likely always if we use
|
||||
this helper somewhere else. Let's just return NULL when no layout is
|
||||
found, we don't need an error value here.
|
||||
|
||||
Link: https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
|
||||
Fixes: 266570f496b9 ("nvmem: core: introduce NVMEM layouts")
|
||||
Reported-by: kernel test robot <lkp@intel.com>
|
||||
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
|
||||
Closes: https://lore.kernel.org/r/202308030002.DnSFOrMB-lkp@intel.com/
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
include/linux/nvmem-consumer.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/nvmem-consumer.h
|
||||
+++ b/include/linux/nvmem-consumer.h
|
||||
@@ -256,7 +256,7 @@ static inline struct nvmem_device *of_nv
|
||||
static inline struct device_node *
|
||||
of_nvmem_layout_get_container(struct nvmem_device *nvmem)
|
||||
{
|
||||
- return ERR_PTR(-EOPNOTSUPP);
|
||||
+ return NULL;
|
||||
}
|
||||
#endif /* CONFIG_NVMEM && CONFIG_OF */
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
From b8257f61b4ddac6d7d0e19a5a4e8b07afb3b4ed3 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:28 +0200
|
||||
Subject: [PATCH] nvmem: core: Do not open-code existing functions
|
||||
|
||||
Use of_nvmem_layout_get_container() instead of hardcoding it.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Reviewed-by: Michael Walle <michael@walle.cc>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -786,10 +786,10 @@ EXPORT_SYMBOL_GPL(nvmem_layout_unregiste
|
||||
|
||||
static struct nvmem_layout *nvmem_layout_get(struct nvmem_device *nvmem)
|
||||
{
|
||||
- struct device_node *layout_np, *np = nvmem->dev.of_node;
|
||||
+ struct device_node *layout_np;
|
||||
struct nvmem_layout *l, *layout = ERR_PTR(-EPROBE_DEFER);
|
||||
|
||||
- layout_np = of_get_child_by_name(np, "nvmem-layout");
|
||||
+ layout_np = of_nvmem_layout_get_container(nvmem);
|
||||
if (!layout_np)
|
||||
return NULL;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 0991afbe4b1805e7f0113ef10d7c5f0698a739e4 Mon Sep 17 00:00:00 2001
|
||||
From: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Date: Tue, 8 Aug 2023 08:29:29 +0200
|
||||
Subject: [PATCH] nvmem: core: Notify when a new layout is registered
|
||||
|
||||
Tell listeners a new layout was introduced and is now available.
|
||||
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
---
|
||||
drivers/nvmem/core.c | 4 ++++
|
||||
include/linux/nvmem-consumer.h | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -772,12 +772,16 @@ int __nvmem_layout_register(struct nvmem
|
||||
list_add(&layout->node, &nvmem_layouts);
|
||||
spin_unlock(&nvmem_layout_lock);
|
||||
|
||||
+ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_ADD, layout);
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(__nvmem_layout_register);
|
||||
|
||||
void nvmem_layout_unregister(struct nvmem_layout *layout)
|
||||
{
|
||||
+ blocking_notifier_call_chain(&nvmem_notifier, NVMEM_LAYOUT_REMOVE, layout);
|
||||
+
|
||||
spin_lock(&nvmem_layout_lock);
|
||||
list_del(&layout->node);
|
||||
spin_unlock(&nvmem_layout_lock);
|
||||
--- a/include/linux/nvmem-consumer.h
|
||||
+++ b/include/linux/nvmem-consumer.h
|
||||
@@ -43,6 +43,8 @@ enum {
|
||||
NVMEM_REMOVE,
|
||||
NVMEM_CELL_ADD,
|
||||
NVMEM_CELL_REMOVE,
|
||||
+ NVMEM_LAYOUT_ADD,
|
||||
+ NVMEM_LAYOUT_REMOVE,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_NVMEM)
|
||||
@@ -2823,6 +2823,7 @@ CONFIG_INOTIFY_USER=y
|
||||
# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
|
||||
# CONFIG_INPUT_GPIO_TILT_POLLED is not set
|
||||
# CONFIG_INPUT_GPIO_VIBRA is not set
|
||||
# CONFIG_INPUT_IBM_PANEL is not set
|
||||
# CONFIG_INPUT_IDEAPAD_SLIDEBAR is not set
|
||||
# CONFIG_INPUT_IMS_PCU is not set
|
||||
# CONFIG_INPUT_IQS269A is not set
|
||||
|
||||
@@ -18,7 +18,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -794,6 +794,19 @@ static struct nvmem_layout *nvmem_layout
|
||||
@@ -798,6 +798,19 @@ static struct nvmem_layout *nvmem_layout
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
|
||||
@@ -18,7 +18,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
|
||||
--- a/drivers/nvmem/core.c
|
||||
+++ b/drivers/nvmem/core.c
|
||||
@@ -794,6 +794,19 @@ static struct nvmem_layout *nvmem_layout
|
||||
@@ -798,6 +798,19 @@ static struct nvmem_layout *nvmem_layout
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
|
||||
@@ -308,6 +308,7 @@ CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NR_CPUS=4
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_NVMEM_QCOM_QFPROM=y
|
||||
# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set
|
||||
# CONFIG_NVMEM_SPMI_SDAM is not set
|
||||
CONFIG_NVMEM_SYSFS=y
|
||||
CONFIG_OF=y
|
||||
|
||||
@@ -306,6 +306,7 @@ CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NR_CPUS=2
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_NVMEM_QCOM_QFPROM=y
|
||||
# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set
|
||||
# CONFIG_NVMEM_SPMI_SDAM is not set
|
||||
CONFIG_NVMEM_SYSFS=y
|
||||
CONFIG_OF=y
|
||||
|
||||
@@ -71,6 +71,7 @@ define Device/bananapi_bpi-r64
|
||||
DEVICE_DTS_OVERLAY := mt7622-bananapi-bpi-r64-pcie1 mt7622-bananapi-bpi-r64-sata
|
||||
DEVICE_PACKAGES := kmod-ata-ahci-mtk kmod-btmtkuart kmod-usb3 e2fsprogs mkf2fs f2fsck
|
||||
DEVICE_DTC_FLAGS := --pad 4096
|
||||
DEVICE_DTS_LOADADDR := 0x43f00000
|
||||
ARTIFACTS := emmc-preloader.bin emmc-bl31-uboot.fip sdcard.img.gz snand-preloader.bin snand-bl31-uboot.fip
|
||||
IMAGES := sysupgrade.itb
|
||||
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
||||
|
||||
@@ -152,6 +152,7 @@ CONFIG_NLS=y
|
||||
CONFIG_NR_CPUS=1
|
||||
CONFIG_NR_IRQS=512
|
||||
CONFIG_NVMEM=y
|
||||
# CONFIG_NVMEM_QORIQ_EFUSE is not set
|
||||
CONFIG_OF=y
|
||||
CONFIG_OF_ADDRESS=y
|
||||
CONFIG_OF_DMA_DEFAULT_COHERENT=y
|
||||
|
||||
@@ -278,6 +278,7 @@ CONFIG_NR_CPUS=4
|
||||
CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_NVMEM_QCOM_QFPROM=y
|
||||
# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set
|
||||
# CONFIG_NVMEM_SPMI_SDAM is not set
|
||||
CONFIG_NVMEM_SYSFS=y
|
||||
CONFIG_NVMEM_U_BOOT_ENV=y
|
||||
|
||||
Reference in New Issue
Block a user