ipq807x: fix nss ecm support in kernel 5.15

This commit is contained in:
lean 2022-09-14 01:19:04 +08:00
parent 30c3448606
commit 1003232a70
137 changed files with 17264 additions and 15938 deletions

View File

@ -19,7 +19,7 @@ define KernelPackage/qca-nss-ecm-64
CATEGORY:=Kernel modules CATEGORY:=Kernel modules
SUBMENU:=Network Support SUBMENU:=Network Support
DEPENDS:=@(TARGET_ipq807x||TARGET_ipq60xx) \ DEPENDS:=@(TARGET_ipq807x||TARGET_ipq60xx) \
+kmod-qca-nss-drv-64 \ +kmod-qca-nss-drv-64 \
+iptables-mod-extra \ +iptables-mod-extra \
+kmod-ipt-conntrack \ +kmod-ipt-conntrack \
+kmod-ipt-physdev \ +kmod-ipt-physdev \

0
package/qca/nss/qca-nss-ecm-64/files/ecm_dump.sh Executable file → Normal file
View File

View File

@ -0,0 +1,40 @@
diff --git a/ecm_interface.c b/ecm_interface.c
index b461456..6be872a 100644
--- a/ecm_interface.c
+++ b/ecm_interface.c
@@ -7493,9 +7493,13 @@
static int ecm_interface_wifi_event_rx(struct socket *sock, struct sockaddr_nl *addr, unsigned char *buf, int len)
{
struct msghdr msg;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
struct iovec iov;
mm_segment_t oldfs;
int size;
+#else
+ struct kvec iov;
+#endif
iov.iov_base = buf;
iov.iov_len = len;
@@ -7505,9 +7509,10 @@
msg.msg_namelen = sizeof(struct sockaddr_nl);
msg.msg_control = NULL;
msg.msg_controllen = 0;
- iov_iter_init(&msg.msg_iter, READ, &iov, 1, 1);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
oldfs = get_fs();
set_fs(KERNEL_DS);
+ iov_iter_init(&msg.msg_iter, READ, &iov, 1, 1);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
size = sock_recvmsg(sock, &msg, len, msg.msg_flags);
#else
@@ -7516,6 +7521,9 @@
set_fs(oldfs);
return size;
+#else
+ return kernel_recvmsg(sock, &msg, &iov, 1, iov.iov_len, 0);
+#endif
}
/*

View File

@ -0,0 +1,72 @@
From e9073363a50a25bddd96e808f04bcf56c45da4ac Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sun, 8 May 2022 18:19:47 +0200
Subject: [PATCH 07/12] treewide: rework notifier changes for 5.15
Rework notifier changes for 5.15 conntrack new implementation.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
ecm_conntrack_notifier.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/ecm_conntrack_notifier.c b/ecm_conntrack_notifier.c
index 9c8a45e..9f2cdae 100644
--- a/ecm_conntrack_notifier.c
+++ b/ecm_conntrack_notifier.c
@@ -322,7 +322,7 @@ EXPORT_SYMBOL(ecm_conntrack_ipv4_event);
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
static int ecm_conntrack_event(struct notifier_block *this, unsigned long events, void *ptr)
#else
-static int ecm_conntrack_event(unsigned int events, struct nf_ct_event *item)
+static int ecm_conntrack_event(unsigned int events, const struct nf_ct_event *item)
#endif
{
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
@@ -388,7 +388,11 @@ static struct notifier_block ecm_conntrack_notifier = {
* Netfilter conntrack event system to monitor connection tracking changes
*/
static struct nf_ct_event_notifier ecm_conntrack_notifier = {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
.fcn = ecm_conntrack_event,
+#else
+ .ct_event = ecm_conntrack_event,
+#endif
};
#endif
#endif
@@ -426,13 +430,19 @@ int ecm_conntrack_notifier_init(struct dentry *dentry)
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
result = nf_conntrack_register_chain_notifier(&init_net, &ecm_conntrack_notifier);
#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
result = nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier);
+#else
+ nf_conntrack_register_notifier(&init_net, &ecm_conntrack_notifier);
+#endif
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
if (result < 0) {
DEBUG_ERROR("Can't register nf notifier hook.\n");
debugfs_remove_recursive(ecm_conntrack_notifier_dentry);
return result;
}
+#endif
#endif
return 0;
@@ -448,7 +458,11 @@ void ecm_conntrack_notifier_exit(void)
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
nf_conntrack_unregister_chain_notifier(&init_net, &ecm_conntrack_notifier);
#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
nf_conntrack_unregister_notifier(&init_net, &ecm_conntrack_notifier);
+#else
+ nf_conntrack_unregister_notifier(&init_net);
+#endif
#endif
/*
* Remove the debugfs files recursively.
--
2.34.1

View File

@ -0,0 +1,156 @@
--- a/frontends/nss/ecm_nss_ported_ipv4.c
+++ b/frontends/nss/ecm_nss_ported_ipv4.c
@@ -125,6 +125,7 @@
static int ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_MAX] = {0};
/* Array of Number of TCP and UDP connections currently offloaded */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
/*
* Expose what should be a static flag in the TCP connection tracker.
*/
@@ -132,6 +133,7 @@
extern int nf_ct_tcp_no_window_check;
#endif
extern int nf_ct_tcp_be_liberal;
+#endif
/*
* ecm_nss_ported_ipv4_connection_callback()
@@ -372,6 +374,10 @@
uint8_t dest_mac_xlate[ETH_ALEN];
ecm_db_direction_t ecm_dir;
ecm_front_end_acceleration_mode_t result_mode;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1236,9 +1242,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/nss/ecm_nss_ported_ipv6.c
+++ b/frontends/nss/ecm_nss_ported_ipv6.c
@@ -125,6 +125,7 @@
static int ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_MAX] = {0};
/* Array of Number of TCP and UDP connections currently offloaded */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
/*
* Expose what should be a static flag in the TCP connection tracker.
*/
@@ -132,6 +133,7 @@
extern int nf_ct_tcp_no_window_check;
#endif
extern int nf_ct_tcp_be_liberal;
+#endif
/*
* ecm_nss_ported_ipv6_connection_callback()
@@ -376,6 +378,10 @@
ip_addr_t src_ip;
ip_addr_t dest_ip;
ecm_front_end_acceleration_mode_t result_mode;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV6_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1162,9 +1168,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/sfe/ecm_sfe_ported_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv4.c
@@ -422,6 +422,10 @@
int32_t interface_type_counts[ECM_DB_IFACE_TYPE_COUNT];
bool rule_invalid;
ecm_db_direction_t ecm_dir;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
ecm_front_end_acceleration_mode_t result_mode;
DEBUG_CHECK_MAGIC(npci, ECM_SFE_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci);
@@ -1333,9 +1337,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check)
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal)
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {
--- a/frontends/sfe/ecm_sfe_ported_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ported_ipv6.c
@@ -426,6 +426,10 @@
int32_t interface_type_counts[ECM_DB_IFACE_TYPE_COUNT];
bool rule_invalid;
ip_addr_t src_ip;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
+ struct net *net = nf_ct_net(ct);
+ struct nf_tcp_net *tn = nf_tcp_pernet(net);
+#endif
ip_addr_t dest_ip;
ecm_front_end_acceleration_mode_t result_mode;
@@ -1293,9 +1297,17 @@
nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end;
nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend;
#ifdef ECM_OPENWRT_SUPPORT
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal || nf_ct_tcp_no_window_check
#else
+ if (tn->tcp_be_liberal || tn->tcp_no_window_check)
+#endif
+#else
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
if (nf_ct_tcp_be_liberal
+#else
+ if (tn->tcp_be_liberal)
+#endif
#endif
|| (ct->proto.tcp.seen[flow_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)
|| (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) {

View File

@ -0,0 +1,55 @@
From 9827d8597545ecfee17eba7b08d48dbcdf55c614 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sun, 8 May 2022 18:39:39 +0200
Subject: [PATCH 09/12] ecm_tracker_datagram: drop static for EXPORT_SYMBOL
EXPORT_SYMBOL should NOT be static
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
ecm_tracker_datagram.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ecm_tracker_datagram.c b/ecm_tracker_datagram.c
index 9c04d73..ae14146 100644
--- a/ecm_tracker_datagram.c
+++ b/ecm_tracker_datagram.c
@@ -203,7 +203,7 @@ static void ecm_tracker_datagram_datagram_discard(struct ecm_tracker_datagram_in
* ecm_tracker_datagram_discard_all()
* Discard all tracked data
*/
-static void ecm_tracker_datagram_discard_all(struct ecm_tracker_datagram_internal_instance *dtii)
+void ecm_tracker_datagram_discard_all(struct ecm_tracker_datagram_internal_instance *dtii)
{
int32_t src_count;
int32_t dest_count;
@@ -364,7 +364,7 @@ static void ecm_tracker_datagram_datagram_discard_callback(struct ecm_tracker_in
* ecm_tracker_datagram_datagram_size_get()
* Return size in bytes of datagram at index i that was sent to the target
*/
-static int32_t ecm_tracker_datagram_datagram_size_get(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, int32_t i)
+int32_t ecm_tracker_datagram_datagram_size_get(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, int32_t i)
{
struct ecm_tracker_datagram_internal_instance *dtii = (struct ecm_tracker_datagram_internal_instance *)uti;
@@ -412,7 +412,7 @@ static int32_t ecm_tracker_datagram_datagram_size_get_callback(struct ecm_tracke
* ecm_tracker_datagram_datagram_read()
* Read size bytes from datagram at index i into the buffer
*/
-static int ecm_tracker_datagram_datagram_read(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, int32_t i, int32_t offset, int32_t size, void *buffer)
+int ecm_tracker_datagram_datagram_read(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, int32_t i, int32_t offset, int32_t size, void *buffer)
{
struct ecm_tracker_datagram_internal_instance *dtii = (struct ecm_tracker_datagram_internal_instance *)uti;
int res;
@@ -466,7 +466,7 @@ static int ecm_tracker_datagram_datagram_read_callback(struct ecm_tracker_instan
* ecm_tracker_datagram_datagram_add()
* Append the datagram onto the tracker queue for the given target
*/
-static bool ecm_tracker_datagram_datagram_add(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, struct sk_buff *skb)
+bool ecm_tracker_datagram_datagram_add(struct ecm_tracker_datagram_instance *uti, ecm_tracker_sender_type_t sender, struct sk_buff *skb)
{
struct ecm_tracker_datagram_internal_instance *dtii = (struct ecm_tracker_datagram_internal_instance *)uti;
struct sk_buff *skbc;
--
2.34.1

View File

@ -0,0 +1,74 @@
From ef638a84405c9f6556a9d7c257ccbba74efd228e Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Sat, 14 May 2022 20:15:10 +0200
Subject: [PATCH 10/12] frontends: drop udp_get_timeouts and use standard
upstream api
Drop udp_get_timeouts and use nf_udp_pernet and ->timeoutrs
instead or relying on a downstream api not present upstream.
---
frontends/nss/ecm_nss_ipv4.c | 3 ++-
frontends/nss/ecm_nss_ipv6.c | 3 ++-
frontends/sfe/ecm_sfe_ipv4.c | 3 ++-
frontends/sfe/ecm_sfe_ipv6.c | 3 ++-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/frontends/nss/ecm_nss_ipv4.c b/frontends/nss/ecm_nss_ipv4.c
index 719a747..558819a 100644
--- a/frontends/nss/ecm_nss_ipv4.c
+++ b/frontends/nss/ecm_nss_ipv4.c
@@ -607,7 +607,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {
- timeouts = udp_get_timeouts(nf_ct_net(ct));
+ struct nf_udp_net *un = nf_udp_pernet(nf_ct_net(ct));
+ timeouts = un->timeouts;
}
spin_lock_bh(&ct->lock);
diff --git a/frontends/nss/ecm_nss_ipv6.c b/frontends/nss/ecm_nss_ipv6.c
index 67ee364..51eb069 100644
--- a/frontends/nss/ecm_nss_ipv6.c
+++ b/frontends/nss/ecm_nss_ipv6.c
@@ -586,7 +586,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {
- timeouts = udp_get_timeouts(nf_ct_net(ct));
+ struct nf_udp_net *un = nf_udp_pernet(nf_ct_net(ct));
+ timeouts = un->timeouts;
}
spin_lock_bh(&ct->lock);
diff --git a/frontends/sfe/ecm_sfe_ipv4.c b/frontends/sfe/ecm_sfe_ipv4.c
index 3f30821..931af5d 100644
--- a/frontends/sfe/ecm_sfe_ipv4.c
+++ b/frontends/sfe/ecm_sfe_ipv4.c
@@ -527,7 +527,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {
- timeouts = udp_get_timeouts(nf_ct_net(ct));
+ struct nf_udp_net *un = nf_udp_pernet(nf_ct_net(ct));
+ timeouts = un->timeouts;
}
spin_lock_bh(&ct->lock);
diff --git a/frontends/sfe/ecm_sfe_ipv6.c b/frontends/sfe/ecm_sfe_ipv6.c
index 54fdbf3..63d8888 100644
--- a/frontends/sfe/ecm_sfe_ipv6.c
+++ b/frontends/sfe/ecm_sfe_ipv6.c
@@ -516,7 +516,8 @@ sync_conntrack:
#else
timeouts = nf_ct_timeout_lookup(ct);
if (!timeouts) {
- timeouts = udp_get_timeouts(nf_ct_net(ct));
+ struct nf_udp_net *un = nf_udp_pernet(nf_ct_net(ct));
+ timeouts = un->timeouts;
}
spin_lock_bh(&ct->lock);
--
2.34.1

View File

@ -0,0 +1,67 @@
From 1958e34c4c1b8b4fb62eba693fbd7693536947b9 Mon Sep 17 00:00:00 2001
From: flebourse <francis.lebourse@sfr.fr>
Date: Thu, 23 Dec 2021 16:11:06 +0100
Subject: [PATCH] qca-nss-ecm: fix a memcpy overflow in ecm_db
Calls to ipv6_addr_prefix() trigger a memcpy overflow if the prefix len
argument is greater than 128, cap it at this value.
stack bactrace:
detected buffer overflow in memcpy
Kernel BUG at fortify_panic+0x20/0x24
Internal error: Oops - BUG: 0 [#1] SMP
CPU: 2 PID: 2592 Comm: netifd Not tainted 5.10.80 #0
Hardware name: Xiaomi AX9000 (DT)
Call trace:
fortify_panic+0x20/0x24
ecm_db_exit+0x42c/0x49c [ecm]
ecm_db_exit+0x464/0x49c [ecm]
atomic_notifier_call_chain+0x5c/0x90
ip6_route_add+0x13c/0x1a4
inet6_rtm_newroute+0x98/0xa0
rtnetlink_rcv_msg+0x10c/0x34c
netlink_rcv_skb+0x5c/0x130
rtnetlink_rcv+0x1c/0x2c
netlink_unicast+0x1ec/0x2e0
netlink_sendmsg+0x1a4/0x394
____sys_sendmsg+0x270/0x2b4
___sys_sendmsg+0x7c/0xc0
__sys_sendmsg+0x5c/0xb0
__arm64_sys_sendmsg+0x28/0x34
el0_svc_common.constprop.0+0x88/0x190
do_el0_svc+0x74/0x94
el0_svc+0x14/0x20
el0_sync_handler+0xa8/0x130
el0_sync+0x184/0x1c0
Code: aa0003e1 912b4040 910003fd 97fff56c (d4210000)
Signed-off-By: Francis Le Bourse <francis.lebourse@sfr.fr>
---
ecm_db/ecm_db.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ecm_db/ecm_db.c b/ecm_db/ecm_db.c
index c6f408d..df04afd 100644
--- a/ecm_db/ecm_db.c
+++ b/ecm_db/ecm_db.c
@@ -298,7 +298,7 @@ static int ecm_db_ipv6_route_table_update_event(struct notifier_block *nb,
* Compute ECM connection's prefix destination address by masking it with the
* route config's destination address prefix length.
*/
- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len);
+ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len));
DEBUG_TRACE("dest addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6);
@@ -326,7 +326,7 @@ static int ecm_db_ipv6_route_table_update_event(struct notifier_block *nb,
* Compute ECM connection's prefix source address by masking it with the
* route config's destination address prefix length.
*/
- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len);
+ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len));
DEBUG_TRACE("src addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6);
--
2.1.4

View File

@ -15,6 +15,7 @@ DEFAULT_PACKAGES += \
kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom \ kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom \
kmod-leds-gpio kmod-gpio-button-hotplug \ kmod-leds-gpio kmod-gpio-button-hotplug \
kmod-ath11k-ahb wpad-openssl uboot-envtools \ kmod-ath11k-ahb wpad-openssl uboot-envtools \
kmod-qca-nss-dp kmod-qca-nss-drv-64 kmod-qca-nss-drv-pppoe-64 nss-firmware-ipq6018 kmod-qca-nss-dp kmod-qca-nss-drv-64 kmod-qca-nss-drv-pppoe-64 \
nss-firmware-ipq6018 qca-nss-ecm-64
$(eval $(call BuildTarget)) $(eval $(call BuildTarget))

View File

@ -0,0 +1,37 @@
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -650,6 +650,34 @@
ndisc_send_skb(skb, daddr, saddr);
}
+EXPORT_SYMBOL(ndisc_send_ns);
+
+struct net_device *ipv6_dev_find_and_hold(struct net *net, struct in6_addr *addr,
+ int strict)
+{
+ struct inet6_ifaddr *ifp;
+ struct net_device *dev;
+
+ ifp = ipv6_get_ifaddr(net, addr, NULL, strict);
+ if (!ifp)
+ return NULL;
+
+ if (!ifp->idev) {
+ in6_ifa_put(ifp);
+ return NULL;
+ }
+
+ dev = ifp->idev->dev;
+ if (dev)
+ dev_hold(dev);
+
+ in6_ifa_put(ifp);
+
+ return dev;
+}
+
+EXPORT_SYMBOL(ipv6_dev_find_and_hold);
+
void ndisc_send_rs(struct net_device *dev, const struct in6_addr *saddr,
const struct in6_addr *daddr)
{

View File

@ -3,21 +3,16 @@
/dts-v1/; /dts-v1/;
#include "ipq8074-512m.dtsi" #include "ipq8074.dtsi"
#include "ipq8074-ac-cpu.dtsi" #include "ipq8074-hk-cpu.dtsi"
#include "ipq8074-ess.dtsi" #include "ipq8074-ess.dtsi"
#include "ipq8074-ac-nss.dtsi"
#include <dt-bindings/gpio/gpio.h> #include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ { / {
#address-cells = <2>;
#size-cells = <2>;
model = "QNAP 301w"; model = "QNAP 301w";
compatible = "qnap,301w", "qcom,ipq8074"; compatible = "qnap,301w", "qcom,ipq8074";
interrupt-parent = <&intc>;
aliases { aliases {
serial0 = &blsp1_uart5; serial0 = &blsp1_uart5;
@ -368,46 +363,46 @@
pinctrl-names = "default"; pinctrl-names = "default";
reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>;
ethernet-phy@0 { aqr113c_0: ethernet-phy@0 {
compatible ="ethernet-phy-ieee802.3-c45"; compatible ="ethernet-phy-ieee802.3-c45";
reg = <0>; reg = <0>;
reset-gpios = <&tlmm 59 GPIO_ACTIVE_LOW>; reset-gpios = <&tlmm 59 GPIO_ACTIVE_LOW>;
}; };
ethernet-phy@8 { aqr113c_8: ethernet-phy@8 {
compatible ="ethernet-phy-ieee802.3-c45"; compatible ="ethernet-phy-ieee802.3-c45";
reg = <8>; reg = <8>;
reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>;
}; };
ethernet-phy@16 { qca8075_16: ethernet-phy@16 {
reg = <16>; reg = <16>;
}; };
ethernet-phy@17 { qca8075_17: ethernet-phy@17 {
reg = <17>; reg = <17>;
}; };
ethernet-phy@18 { qca8075_18: ethernet-phy@18 {
reg = <18>; reg = <18>;
}; };
ethernet-phy@19 { qca8075_19: ethernet-phy@19 {
reg = <19>; reg = <19>;
}; };
}; };
&sdhc_1 { &sdhc_1 {
/* According to the stock dts from the QNAP gpl drop status = "okay";
* the emmc has a problem with the hs400 > hs200 speed switch.
* Therefore remove the mmc-hs400-1_8v property /* According to the stock dts from the QNAP gpl drop
*/ * the emmc has a problem with the hs400 > hs200 speed switch.
/delete-property/ mmc-hs400-1_8v; * Therefore remove the mmc-hs400-1_8v property
mmc-hs200-1_8v; */
mmc-ddr-1_8v; /delete-property/ mmc-hs400-1_8v;
vqmmc-supply = <&ldo11>; mmc-hs200-1_8v;
status = "okay"; mmc-ddr-1_8v;
vqmmc-supply = <&l11>;
}; };
&switch { &switch {
@ -739,10 +734,8 @@
reg = <0x3a001000 0x200>; reg = <0x3a001000 0x200>;
qcom,mactype = <0>; qcom,mactype = <0>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&qca8075_16>;
qcom,phy-mdio-addr = <16>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
dp2: dp2 { dp2: dp2 {
@ -752,10 +745,8 @@
reg = <0x3a001200 0x200>; reg = <0x3a001200 0x200>;
qcom,mactype = <0>; qcom,mactype = <0>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&qca8075_17>;
qcom,phy-mdio-addr = <17>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
dp3: dp3 { dp3: dp3 {
@ -765,10 +756,8 @@
reg = <0x3a001400 0x200>; reg = <0x3a001400 0x200>;
qcom,mactype = <0>; qcom,mactype = <0>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&qca8075_18>;
qcom,phy-mdio-addr = <18>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
dp4: dp4 { dp4: dp4 {
@ -778,10 +767,8 @@
reg = <0x3a001600 0x200>; reg = <0x3a001600 0x200>;
qcom,mactype = <0>; qcom,mactype = <0>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&qca8075_19>;
qcom,phy-mdio-addr = <19>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
dp5: dp5 { dp5: dp5 {
@ -791,10 +778,8 @@
reg = <0x3a001800 0x200>; reg = <0x3a001800 0x200>;
qcom,mactype = <1>; qcom,mactype = <1>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&aqr113c_8>;
qcom,phy-mdio-addr = <8>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
dp6: dp6 { dp6: dp6 {
@ -804,18 +789,13 @@
reg = <0x3a007000 0x3fff>; reg = <0x3a007000 0x3fff>;
qcom,mactype = <1>; qcom,mactype = <1>;
local-mac-address = [000000000000]; local-mac-address = [000000000000];
qcom,link-poll = <1>; phy-handle = <&aqr113c_0>;
qcom,phy-mdio-addr = <0>;
phy-mode = "sgmii"; phy-mode = "sgmii";
mdio-bus = <&mdio>;
}; };
}; };
&wifi { &wifi {
status = "okay"; status = "okay";
/* using board_id 0xff is intentionally
* as the stock firmware is also using this default board_id
*/
qcom,board_id = <0xff>;
qcom,ath11k-calibration-variant = "QNAP-301w"; qcom,ath11k-calibration-variant = "QNAP-301w";
}; };

View File

@ -254,5 +254,3 @@
}; };
}; };
}; };

View File

@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
#include "pmp8074.dtsi"
&soc { &soc {
apc_apm: apm@b111000 { apc_apm: apm@b111000 {
compatible = "qcom,ipq807x-apm"; compatible = "qcom,ipq807x-apm";

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
config QCOM_APM
bool "Qualcomm Technologies Inc platform specific APM driver"
help
Platform specific driver to manage the power source of
memory arrays. Interfaces with regulator drivers to ensure
SRAM Vmin requirements are met across different performance
levels.

View File

@ -1 +0,0 @@
obj-$(CONFIG_QCOM_APM) += apm.o

View File

@ -1,944 +0,0 @@
/*
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/of_device.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/power/qcom/apm.h>
/*
* VDD_APCC
* =============================================================
* | VDD_MX | |
* | ==========================|============= |
* ___|___ ___|___ ___|___ ___|___ ___|___ ___|___
* | | | | | | | | | | | |
* | APCC | | MX HS | | MX HS | | APCC | | MX HS | | APCC |
* | HS | | | | | | HS | | | | HS |
* |_______| |_______| |_______| |_______| |_______| |_______|
* |_________| |_________| |__________|
* | | |
* ______|_____ ______|_____ _______|_____
* | | | | | |
* | | | | | |
* | CPU MEM | | L2 MEM | | L3 MEM |
* | Arrays | | Arrays | | Arrays |
* | | | | | |
* |____________| |____________| |_____________|
*
*/
/* Register value definitions */
#define APCS_GFMUXA_SEL_VAL 0x13
#define APCS_GFMUXA_DESEL_VAL 0x03
#define MSM_APM_MX_MODE_VAL 0x00
#define MSM_APM_APCC_MODE_VAL 0x10
#define MSM_APM_MX_DONE_VAL 0x00
#define MSM_APM_APCC_DONE_VAL 0x03
#define MSM_APM_OVERRIDE_SEL_VAL 0xb0
#define MSM_APM_SEC_CLK_SEL_VAL 0x30
#define SPM_EVENT_SET_VAL 0x01
#define SPM_EVENT_CLEAR_VAL 0x00
/* Register bit mask definitions */
#define MSM_APM_CTL_STS_MASK 0x0f
/* Register offset definitions */
#define APCC_APM_MODE 0x00000098
#define APCC_APM_CTL_STS 0x000000a8
#define APCS_SPARE 0x00000068
#define APCS_VERSION 0x00000fd0
#define HMSS_VERSION_1P2 0x10020000
#define MSM_APM_SWITCH_TIMEOUT_US 10
#define SPM_WAKEUP_DELAY_US 2
#define SPM_EVENT_NUM 6
#define MSM_APM_DRIVER_NAME "qcom,msm-apm"
enum {
MSM8996_ID,
MSM8953_ID,
IPQ807x_ID,
};
struct msm_apm_ctrl_dev {
struct list_head list;
struct device *dev;
enum msm_apm_supply supply;
spinlock_t lock;
void __iomem *reg_base;
void __iomem *apcs_csr_base;
void __iomem **apcs_spm_events_addr;
void __iomem *apc0_pll_ctl_addr;
void __iomem *apc1_pll_ctl_addr;
u32 version;
struct dentry *debugfs;
u32 msm_id;
};
#if defined(CONFIG_DEBUG_FS)
static struct dentry *apm_debugfs_base;
#endif
static DEFINE_MUTEX(apm_ctrl_list_mutex);
static LIST_HEAD(apm_ctrl_list);
/*
* Get the resources associated with the APM controller from device tree
* and remap all I/O addresses that are relevant to this HW revision.
*/
static int msm_apm_ctrl_devm_ioremap(struct platform_device *pdev,
struct msm_apm_ctrl_dev *ctrl)
{
struct device *dev = &pdev->dev;
struct resource *res;
static const char *res_name[SPM_EVENT_NUM] = {
"apc0-l2-spm",
"apc1-l2-spm",
"apc0-cpu0-spm",
"apc0-cpu1-spm",
"apc1-cpu0-spm",
"apc1-cpu1-spm"
};
int i, ret = 0;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pm-apcc-glb");
if (!res) {
dev_err(dev, "Missing PM APCC Global register physical address");
return -EINVAL;
}
ctrl->reg_base = devm_ioremap(dev, res->start, resource_size(res));
if (!ctrl->reg_base) {
dev_err(dev, "Failed to map PM APCC Global registers\n");
return -ENOMEM;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "apcs-csr");
if (!res) {
dev_err(dev, "Missing APCS CSR physical base address");
return -EINVAL;
}
ctrl->apcs_csr_base = devm_ioremap(dev, res->start, resource_size(res));
if (!ctrl->apcs_csr_base) {
dev_err(dev, "Failed to map APCS CSR registers\n");
return -ENOMEM;
}
ctrl->version = readl_relaxed(ctrl->apcs_csr_base + APCS_VERSION);
if (ctrl->version >= HMSS_VERSION_1P2)
return ret;
ctrl->apcs_spm_events_addr = devm_kzalloc(&pdev->dev,
SPM_EVENT_NUM
* sizeof(void __iomem *),
GFP_KERNEL);
if (!ctrl->apcs_spm_events_addr) {
dev_err(dev, "Failed to allocate memory for APCS SPM event registers\n");
return -ENOMEM;
}
for (i = 0; i < SPM_EVENT_NUM; i++) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
res_name[i]);
if (!res) {
dev_err(dev, "Missing address for %s\n", res_name[i]);
ret = -EINVAL;
goto free_events;
}
ctrl->apcs_spm_events_addr[i] = devm_ioremap(dev, res->start,
resource_size(res));
if (!ctrl->apcs_spm_events_addr[i]) {
dev_err(dev, "Failed to map %s\n", res_name[i]);
ret = -ENOMEM;
goto free_events;
}
dev_dbg(dev, "%s event phys: %pa virt:0x%p\n", res_name[i],
&res->start, ctrl->apcs_spm_events_addr[i]);
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"apc0-pll-ctl");
if (!res) {
dev_err(dev, "Missing APC0 PLL CTL physical address\n");
ret = -EINVAL;
goto free_events;
}
ctrl->apc0_pll_ctl_addr = devm_ioremap(dev,
res->start,
resource_size(res));
if (!ctrl->apc0_pll_ctl_addr) {
dev_err(dev, "Failed to map APC0 PLL CTL register\n");
ret = -ENOMEM;
goto free_events;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"apc1-pll-ctl");
if (!res) {
dev_err(dev, "Missing APC1 PLL CTL physical address\n");
ret = -EINVAL;
goto free_events;
}
ctrl->apc1_pll_ctl_addr = devm_ioremap(dev,
res->start,
resource_size(res));
if (!ctrl->apc1_pll_ctl_addr) {
dev_err(dev, "Failed to map APC1 PLL CTL register\n");
ret = -ENOMEM;
goto free_events;
}
return ret;
free_events:
devm_kfree(dev, ctrl->apcs_spm_events_addr);
return ret;
}
/* 8953 register offset definition */
#define MSM8953_APM_DLY_CNTR 0x2ac
/* Register field shift definitions */
#define APM_CTL_SEL_SWITCH_DLY_SHIFT 0
#define APM_CTL_RESUME_CLK_DLY_SHIFT 8
#define APM_CTL_HALT_CLK_DLY_SHIFT 16
#define APM_CTL_POST_HALT_DLY_SHIFT 24
/* Register field mask definitions */
#define APM_CTL_SEL_SWITCH_DLY_MASK GENMASK(7, 0)
#define APM_CTL_RESUME_CLK_DLY_MASK GENMASK(15, 8)
#define APM_CTL_HALT_CLK_DLY_MASK GENMASK(23, 16)
#define APM_CTL_POST_HALT_DLY_MASK GENMASK(31, 24)
/*
* Get the resources associated with the msm8953 APM controller from
* device tree, remap all I/O addresses, and program the initial
* register configuration required for the 8953 APM controller device.
*/
static int msm8953_apm_ctrl_init(struct platform_device *pdev,
struct msm_apm_ctrl_dev *ctrl)
{
struct device *dev = &pdev->dev;
struct resource *res;
u32 delay_counter, val = 0, regval = 0;
int rc = 0;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pm-apcc-glb");
if (!res) {
dev_err(dev, "Missing PM APCC Global register physical address\n");
return -ENODEV;
}
ctrl->reg_base = devm_ioremap(dev, res->start, resource_size(res));
if (!ctrl->reg_base) {
dev_err(dev, "Failed to map PM APCC Global registers\n");
return -ENOMEM;
}
/*
* Initial APM register configuration required before starting
* APM HW controller.
*/
regval = readl_relaxed(ctrl->reg_base + MSM8953_APM_DLY_CNTR);
val = regval;
if (of_find_property(dev->of_node, "qcom,apm-post-halt-delay", NULL)) {
rc = of_property_read_u32(dev->of_node,
"qcom,apm-post-halt-delay", &delay_counter);
if (rc < 0) {
dev_err(dev, "apm-post-halt-delay read failed, rc = %d",
rc);
return rc;
}
val &= ~APM_CTL_POST_HALT_DLY_MASK;
val |= (delay_counter << APM_CTL_POST_HALT_DLY_SHIFT)
& APM_CTL_POST_HALT_DLY_MASK;
}
if (of_find_property(dev->of_node, "qcom,apm-halt-clk-delay", NULL)) {
rc = of_property_read_u32(dev->of_node,
"qcom,apm-halt-clk-delay", &delay_counter);
if (rc < 0) {
dev_err(dev, "apm-halt-clk-delay read failed, rc = %d",
rc);
return rc;
}
val &= ~APM_CTL_HALT_CLK_DLY_MASK;
val |= (delay_counter << APM_CTL_HALT_CLK_DLY_SHIFT)
& APM_CTL_HALT_CLK_DLY_MASK;
}
if (of_find_property(dev->of_node, "qcom,apm-resume-clk-delay", NULL)) {
rc = of_property_read_u32(dev->of_node,
"qcom,apm-resume-clk-delay", &delay_counter);
if (rc < 0) {
dev_err(dev, "apm-resume-clk-delay read failed, rc = %d",
rc);
return rc;
}
val &= ~APM_CTL_RESUME_CLK_DLY_MASK;
val |= (delay_counter << APM_CTL_RESUME_CLK_DLY_SHIFT)
& APM_CTL_RESUME_CLK_DLY_MASK;
}
if (of_find_property(dev->of_node, "qcom,apm-sel-switch-delay", NULL)) {
rc = of_property_read_u32(dev->of_node,
"qcom,apm-sel-switch-delay", &delay_counter);
if (rc < 0) {
dev_err(dev, "apm-sel-switch-delay read failed, rc = %d",
rc);
return rc;
}
val &= ~APM_CTL_SEL_SWITCH_DLY_MASK;
val |= (delay_counter << APM_CTL_SEL_SWITCH_DLY_SHIFT)
& APM_CTL_SEL_SWITCH_DLY_MASK;
}
if (val != regval) {
writel_relaxed(val, ctrl->reg_base + MSM8953_APM_DLY_CNTR);
/* make sure write completes before return */
mb();
}
return rc;
}
static int msm8996_apm_switch_to_mx(struct msm_apm_ctrl_dev *ctrl_dev)
{
int i, timeout = MSM_APM_SWITCH_TIMEOUT_US;
u32 regval;
int ret = 0;
unsigned long flags;
spin_lock_irqsave(&ctrl_dev->lock, flags);
/* Perform revision-specific programming steps */
if (ctrl_dev->version < HMSS_VERSION_1P2) {
/* Clear SPM events */
for (i = 0; i < SPM_EVENT_NUM; i++)
writel_relaxed(SPM_EVENT_CLEAR_VAL,
ctrl_dev->apcs_spm_events_addr[i]);
udelay(SPM_WAKEUP_DELAY_US);
/* Switch APC/CBF to GPLL0 clock */
writel_relaxed(APCS_GFMUXA_SEL_VAL,
ctrl_dev->apcs_csr_base + APCS_SPARE);
ndelay(200);
writel_relaxed(MSM_APM_OVERRIDE_SEL_VAL,
ctrl_dev->apc0_pll_ctl_addr);
ndelay(200);
writel_relaxed(MSM_APM_OVERRIDE_SEL_VAL,
ctrl_dev->apc1_pll_ctl_addr);
/* Ensure writes complete before proceeding */
mb();
}
/* Switch arrays to MX supply and wait for its completion */
writel_relaxed(MSM_APM_MX_MODE_VAL, ctrl_dev->reg_base +
APCC_APM_MODE);
/* Ensure write above completes before delaying */
mb();
while (timeout > 0) {
regval = readl_relaxed(ctrl_dev->reg_base + APCC_APM_CTL_STS);
if ((regval & MSM_APM_CTL_STS_MASK) ==
MSM_APM_MX_DONE_VAL)
break;
udelay(1);
timeout--;
}
if (timeout == 0) {
ret = -ETIMEDOUT;
dev_err(ctrl_dev->dev, "APCC to MX APM switch timed out. APCC_APM_CTL_STS=0x%x\n",
regval);
}
/* Perform revision-specific programming steps */
if (ctrl_dev->version < HMSS_VERSION_1P2) {
/* Switch APC/CBF clocks to original source */
writel_relaxed(APCS_GFMUXA_DESEL_VAL,
ctrl_dev->apcs_csr_base + APCS_SPARE);
ndelay(200);
writel_relaxed(MSM_APM_SEC_CLK_SEL_VAL,
ctrl_dev->apc0_pll_ctl_addr);
ndelay(200);
writel_relaxed(MSM_APM_SEC_CLK_SEL_VAL,
ctrl_dev->apc1_pll_ctl_addr);
/* Complete clock source switch before SPM event sequence */
mb();
/* Set SPM events */
for (i = 0; i < SPM_EVENT_NUM; i++)
writel_relaxed(SPM_EVENT_SET_VAL,
ctrl_dev->apcs_spm_events_addr[i]);
}
if (!ret) {
ctrl_dev->supply = MSM_APM_SUPPLY_MX;
dev_dbg(ctrl_dev->dev, "APM supply switched to MX\n");
}
spin_unlock_irqrestore(&ctrl_dev->lock, flags);
return ret;
}
static int msm8996_apm_switch_to_apcc(struct msm_apm_ctrl_dev *ctrl_dev)
{
int i, timeout = MSM_APM_SWITCH_TIMEOUT_US;
u32 regval;
int ret = 0;
unsigned long flags;
spin_lock_irqsave(&ctrl_dev->lock, flags);
/* Perform revision-specific programming steps */
if (ctrl_dev->version < HMSS_VERSION_1P2) {
/* Clear SPM events */
for (i = 0; i < SPM_EVENT_NUM; i++)
writel_relaxed(SPM_EVENT_CLEAR_VAL,
ctrl_dev->apcs_spm_events_addr[i]);
udelay(SPM_WAKEUP_DELAY_US);
/* Switch APC/CBF to GPLL0 clock */
writel_relaxed(APCS_GFMUXA_SEL_VAL,
ctrl_dev->apcs_csr_base + APCS_SPARE);
ndelay(200);
writel_relaxed(MSM_APM_OVERRIDE_SEL_VAL,
ctrl_dev->apc0_pll_ctl_addr);
ndelay(200);
writel_relaxed(MSM_APM_OVERRIDE_SEL_VAL,
ctrl_dev->apc1_pll_ctl_addr);
/* Ensure previous writes complete before proceeding */
mb();
}
/* Switch arrays to APCC supply and wait for its completion */
writel_relaxed(MSM_APM_APCC_MODE_VAL, ctrl_dev->reg_base +
APCC_APM_MODE);
/* Ensure write above completes before delaying */
mb();
while (timeout > 0) {
regval = readl_relaxed(ctrl_dev->reg_base + APCC_APM_CTL_STS);
if ((regval & MSM_APM_CTL_STS_MASK) ==
MSM_APM_APCC_DONE_VAL)
break;
udelay(1);
timeout--;
}
if (timeout == 0) {
ret = -ETIMEDOUT;
dev_err(ctrl_dev->dev, "MX to APCC APM switch timed out. APCC_APM_CTL_STS=0x%x\n",
regval);
}
/* Perform revision-specific programming steps */
if (ctrl_dev->version < HMSS_VERSION_1P2) {
/* Set SPM events */
for (i = 0; i < SPM_EVENT_NUM; i++)
writel_relaxed(SPM_EVENT_SET_VAL,
ctrl_dev->apcs_spm_events_addr[i]);
/* Complete SPM event sequence before clock source switch */
mb();
/* Switch APC/CBF clocks to original source */
writel_relaxed(APCS_GFMUXA_DESEL_VAL,
ctrl_dev->apcs_csr_base + APCS_SPARE);
ndelay(200);
writel_relaxed(MSM_APM_SEC_CLK_SEL_VAL,
ctrl_dev->apc0_pll_ctl_addr);
ndelay(200);
writel_relaxed(MSM_APM_SEC_CLK_SEL_VAL,
ctrl_dev->apc1_pll_ctl_addr);
}
if (!ret) {
ctrl_dev->supply = MSM_APM_SUPPLY_APCC;
dev_dbg(ctrl_dev->dev, "APM supply switched to APCC\n");
}
spin_unlock_irqrestore(&ctrl_dev->lock, flags);
return ret;
}
/* 8953 register value definitions */
#define MSM8953_APM_MX_MODE_VAL 0x00
#define MSM8953_APM_APCC_MODE_VAL 0x02
#define MSM8953_APM_MX_DONE_VAL 0x00
#define MSM8953_APM_APCC_DONE_VAL 0x03
/* 8953 register offset definitions */
#define MSM8953_APCC_APM_MODE 0x000002a8
#define MSM8953_APCC_APM_CTL_STS 0x000002b0
/* 8953 constants */
#define MSM8953_APM_SWITCH_TIMEOUT_US 500
/* Register bit mask definitions */
#define MSM8953_APM_CTL_STS_MASK 0x1f
static int msm8953_apm_switch_to_mx(struct msm_apm_ctrl_dev *ctrl_dev)
{
int timeout = MSM8953_APM_SWITCH_TIMEOUT_US;
u32 regval;
int ret = 0;
unsigned long flags;
spin_lock_irqsave(&ctrl_dev->lock, flags);
/* Switch arrays to MX supply and wait for its completion */
writel_relaxed(MSM8953_APM_MX_MODE_VAL, ctrl_dev->reg_base +
MSM8953_APCC_APM_MODE);
/* Ensure write above completes before delaying */
mb();
while (timeout > 0) {
regval = readl_relaxed(ctrl_dev->reg_base +
MSM8953_APCC_APM_CTL_STS);
if ((regval & MSM8953_APM_CTL_STS_MASK) ==
MSM8953_APM_MX_DONE_VAL)
break;
udelay(1);
timeout--;
}
if (timeout == 0) {
ret = -ETIMEDOUT;
dev_err(ctrl_dev->dev, "APCC to MX APM switch timed out. APCC_APM_CTL_STS=0x%x\n",
regval);
} else {
ctrl_dev->supply = MSM_APM_SUPPLY_MX;
dev_dbg(ctrl_dev->dev, "APM supply switched to MX\n");
}
spin_unlock_irqrestore(&ctrl_dev->lock, flags);
return ret;
}
static int msm8953_apm_switch_to_apcc(struct msm_apm_ctrl_dev *ctrl_dev)
{
int timeout = MSM8953_APM_SWITCH_TIMEOUT_US;
u32 regval;
int ret = 0;
unsigned long flags;
spin_lock_irqsave(&ctrl_dev->lock, flags);
/* Switch arrays to APCC supply and wait for its completion */
writel_relaxed(MSM8953_APM_APCC_MODE_VAL, ctrl_dev->reg_base +
MSM8953_APCC_APM_MODE);
/* Ensure write above completes before delaying */
mb();
while (timeout > 0) {
regval = readl_relaxed(ctrl_dev->reg_base +
MSM8953_APCC_APM_CTL_STS);
if ((regval & MSM8953_APM_CTL_STS_MASK) ==
MSM8953_APM_APCC_DONE_VAL)
break;
udelay(1);
timeout--;
}
if (timeout == 0) {
ret = -ETIMEDOUT;
dev_err(ctrl_dev->dev, "MX to APCC APM switch timed out. APCC_APM_CTL_STS=0x%x\n",
regval);
} else {
ctrl_dev->supply = MSM_APM_SUPPLY_APCC;
dev_dbg(ctrl_dev->dev, "APM supply switched to APCC\n");
}
spin_unlock_irqrestore(&ctrl_dev->lock, flags);
return ret;
}
static int msm_apm_switch_to_mx(struct msm_apm_ctrl_dev *ctrl_dev)
{
int ret = 0;
switch (ctrl_dev->msm_id) {
case MSM8996_ID:
ret = msm8996_apm_switch_to_mx(ctrl_dev);
break;
case MSM8953_ID:
case IPQ807x_ID:
ret = msm8953_apm_switch_to_mx(ctrl_dev);
break;
}
return ret;
}
static int msm_apm_switch_to_apcc(struct msm_apm_ctrl_dev *ctrl_dev)
{
int ret = 0;
switch (ctrl_dev->msm_id) {
case MSM8996_ID:
ret = msm8996_apm_switch_to_apcc(ctrl_dev);
break;
case MSM8953_ID:
case IPQ807x_ID:
ret = msm8953_apm_switch_to_apcc(ctrl_dev);
break;
}
return ret;
}
/**
* msm_apm_get_supply() - Returns the supply that is currently
* powering the memory arrays
* @ctrl_dev: Pointer to an MSM APM controller device
*
* Returns the supply currently selected by the APM.
*/
int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev)
{
return ctrl_dev->supply;
}
EXPORT_SYMBOL(msm_apm_get_supply);
/**
* msm_apm_set_supply() - Perform the necessary steps to switch the voltage
* source of the memory arrays to a given supply
* @ctrl_dev: Pointer to an MSM APM controller device
* @supply: Power rail to use as supply for the memory
* arrays
*
* Returns 0 on success, -ETIMEDOUT on APM switch timeout, or -EPERM if
* the supply is not supported.
*/
int msm_apm_set_supply(struct msm_apm_ctrl_dev *ctrl_dev,
enum msm_apm_supply supply)
{
int ret;
switch (supply) {
case MSM_APM_SUPPLY_APCC:
ret = msm_apm_switch_to_apcc(ctrl_dev);
break;
case MSM_APM_SUPPLY_MX:
ret = msm_apm_switch_to_mx(ctrl_dev);
break;
default:
ret = -EPERM;
break;
}
return ret;
}
EXPORT_SYMBOL(msm_apm_set_supply);
/**
* msm_apm_ctrl_dev_get() - get a handle to the MSM APM controller linked to
* the device in device tree
* @dev: Pointer to the device
*
* The device must specify "qcom,apm-ctrl" property in its device tree
* node which points to an MSM APM controller device node.
*
* Returns an MSM APM controller handle if successful or ERR_PTR on any error.
* If the APM controller device hasn't probed yet, ERR_PTR(-EPROBE_DEFER) is
* returned.
*/
struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev)
{
struct msm_apm_ctrl_dev *ctrl_dev = NULL;
struct msm_apm_ctrl_dev *dev_found = ERR_PTR(-EPROBE_DEFER);
struct device_node *ctrl_node;
if (!dev || !dev->of_node) {
pr_err("Invalid device node\n");
return ERR_PTR(-EINVAL);
}
ctrl_node = of_parse_phandle(dev->of_node, "qcom,apm-ctrl", 0);
if (!ctrl_node) {
pr_err("Could not find qcom,apm-ctrl property in %s\n",
dev->of_node->full_name);
return ERR_PTR(-ENXIO);
}
mutex_lock(&apm_ctrl_list_mutex);
list_for_each_entry(ctrl_dev, &apm_ctrl_list, list) {
if (ctrl_dev->dev && ctrl_dev->dev->of_node == ctrl_node) {
dev_found = ctrl_dev;
break;
}
}
mutex_unlock(&apm_ctrl_list_mutex);
of_node_put(ctrl_node);
return dev_found;
}
EXPORT_SYMBOL(msm_apm_ctrl_dev_get);
#if defined(CONFIG_DEBUG_FS)
static int apm_supply_dbg_open(struct inode *inode, struct file *filep)
{
filep->private_data = inode->i_private;
return 0;
}
static ssize_t apm_supply_dbg_read(struct file *filep, char __user *ubuf,
size_t count, loff_t *ppos)
{
struct msm_apm_ctrl_dev *ctrl_dev = filep->private_data;
char buf[10];
int len;
if (!ctrl_dev) {
pr_err("invalid apm ctrl handle\n");
return -ENODEV;
}
if (ctrl_dev->supply == MSM_APM_SUPPLY_APCC)
len = snprintf(buf, sizeof(buf), "APCC\n");
else if (ctrl_dev->supply == MSM_APM_SUPPLY_MX)
len = snprintf(buf, sizeof(buf), "MX\n");
else
len = snprintf(buf, sizeof(buf), "ERR\n");
return simple_read_from_buffer(ubuf, count, ppos, buf, len);
}
static const struct file_operations apm_supply_fops = {
.open = apm_supply_dbg_open,
.read = apm_supply_dbg_read,
};
static void apm_debugfs_base_init(void)
{
apm_debugfs_base = debugfs_create_dir("msm-apm", NULL);
if (IS_ERR_OR_NULL(apm_debugfs_base))
pr_err("msm-apm debugfs base directory creation failed\n");
}
static void apm_debugfs_init(struct msm_apm_ctrl_dev *ctrl_dev)
{
struct dentry *temp;
if (IS_ERR_OR_NULL(apm_debugfs_base)) {
pr_err("Base directory missing, cannot create apm debugfs nodes\n");
return;
}
ctrl_dev->debugfs = debugfs_create_dir(dev_name(ctrl_dev->dev),
apm_debugfs_base);
if (IS_ERR_OR_NULL(ctrl_dev->debugfs)) {
pr_err("%s debugfs directory creation failed\n",
dev_name(ctrl_dev->dev));
return;
}
temp = debugfs_create_file("supply", S_IRUGO, ctrl_dev->debugfs,
ctrl_dev, &apm_supply_fops);
if (IS_ERR_OR_NULL(temp)) {
pr_err("supply mode creation failed\n");
return;
}
}
static void apm_debugfs_deinit(struct msm_apm_ctrl_dev *ctrl_dev)
{
if (!IS_ERR_OR_NULL(ctrl_dev->debugfs))
debugfs_remove_recursive(ctrl_dev->debugfs);
}
static void apm_debugfs_base_remove(void)
{
debugfs_remove_recursive(apm_debugfs_base);
}
#else
static void apm_debugfs_base_init(void)
{}
static void apm_debugfs_init(struct msm_apm_ctrl_dev *ctrl_dev)
{}
static void apm_debugfs_deinit(struct msm_apm_ctrl_dev *ctrl_dev)
{}
static void apm_debugfs_base_remove(void)
{}
#endif
static struct of_device_id msm_apm_match_table[] = {
{
.compatible = "qcom,msm-apm",
.data = (void *)(uintptr_t)MSM8996_ID,
},
{
.compatible = "qcom,msm8953-apm",
.data = (void *)(uintptr_t)MSM8953_ID,
},
{
.compatible = "qcom,ipq807x-apm",
.data = (void *)(uintptr_t)IPQ807x_ID,
},
{}
};
static int msm_apm_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct msm_apm_ctrl_dev *ctrl;
const struct of_device_id *match;
int ret = 0;
dev_dbg(dev, "probing MSM Array Power Mux driver\n");
if (!dev->of_node) {
dev_err(dev, "Device tree node is missing\n");
return -ENODEV;
}
match = of_match_device(msm_apm_match_table, dev);
if (!match)
return -ENODEV;
ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
if (!ctrl) {
dev_err(dev, "MSM APM controller memory allocation failed\n");
return -ENOMEM;
}
INIT_LIST_HEAD(&ctrl->list);
spin_lock_init(&ctrl->lock);
ctrl->dev = dev;
ctrl->msm_id = (uintptr_t)match->data;
platform_set_drvdata(pdev, ctrl);
switch (ctrl->msm_id) {
case MSM8996_ID:
ret = msm_apm_ctrl_devm_ioremap(pdev, ctrl);
if (ret) {
dev_err(dev, "Failed to add APM controller device\n");
return ret;
}
break;
case MSM8953_ID:
case IPQ807x_ID:
ret = msm8953_apm_ctrl_init(pdev, ctrl);
if (ret) {
dev_err(dev, "Failed to initialize APM controller device: ret=%d\n",
ret);
return ret;
}
break;
default:
dev_err(dev, "unable to add APM controller device for msm_id:%d\n",
ctrl->msm_id);
return -ENODEV;
}
apm_debugfs_init(ctrl);
mutex_lock(&apm_ctrl_list_mutex);
list_add_tail(&ctrl->list, &apm_ctrl_list);
mutex_unlock(&apm_ctrl_list_mutex);
dev_dbg(dev, "MSM Array Power Mux driver probe successful");
return ret;
}
static int msm_apm_remove(struct platform_device *pdev)
{
struct msm_apm_ctrl_dev *ctrl_dev;
ctrl_dev = platform_get_drvdata(pdev);
if (ctrl_dev) {
mutex_lock(&apm_ctrl_list_mutex);
list_del(&ctrl_dev->list);
mutex_unlock(&apm_ctrl_list_mutex);
apm_debugfs_deinit(ctrl_dev);
}
return 0;
}
static struct platform_driver msm_apm_driver = {
.driver = {
.name = MSM_APM_DRIVER_NAME,
.of_match_table = msm_apm_match_table,
.owner = THIS_MODULE,
},
.probe = msm_apm_probe,
.remove = msm_apm_remove,
};
static int __init msm_apm_init(void)
{
apm_debugfs_base_init();
return platform_driver_register(&msm_apm_driver);
}
static void __exit msm_apm_exit(void)
{
platform_driver_unregister(&msm_apm_driver);
apm_debugfs_base_remove();
}
arch_initcall(msm_apm_init);
module_exit(msm_apm_exit);
MODULE_DESCRIPTION("MSM Array Power Mux driver");
MODULE_LICENSE("GPL v2");

View File

@ -1,695 +0,0 @@
/*
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/slab.h>
#include <linux/thermal.h>
#include "cpr3-regulator.h"
#define IPQ807x_NPU_FUSE_CORNERS 2
#define IPQ817x_NPU_FUSE_CORNERS 1
#define IPQ807x_NPU_FUSE_STEP_VOLT 8000
#define IPQ807x_NPU_VOLTAGE_FUSE_SIZE 6
#define IPQ807x_NPU_CPR_CLOCK_RATE 19200000
#define IPQ807x_NPU_CPR_TCSR_START 6
#define IPQ807x_NPU_CPR_TCSR_END 7
#define NPU_TSENS 5
u32 g_valid_npu_fuse_count = IPQ807x_NPU_FUSE_CORNERS;
/**
* struct cpr3_ipq807x_npu_fuses - NPU specific fuse data for IPQ807x
* @init_voltage: Initial (i.e. open-loop) voltage fuse parameter value
* for each fuse corner (raw, not converted to a voltage)
* This struct holds the values for all of the fuses read from memory.
*/
struct cpr3_ipq807x_npu_fuses {
u64 init_voltage[IPQ807x_NPU_FUSE_CORNERS];
};
/*
* Constants which define the name of each fuse corner.
*/
enum cpr3_ipq807x_npu_fuse_corner {
CPR3_IPQ807x_NPU_FUSE_CORNER_NOM = 0,
CPR3_IPQ807x_NPU_FUSE_CORNER_TURBO = 1,
};
static const char * const cpr3_ipq807x_npu_fuse_corner_name[] = {
[CPR3_IPQ807x_NPU_FUSE_CORNER_NOM] = "NOM",
[CPR3_IPQ807x_NPU_FUSE_CORNER_TURBO] = "TURBO",
};
/*
* IPQ807x NPU fuse parameter locations:
*
* Structs are organized with the following dimensions:
* Outer: 0 to 1 for fuse corners from lowest to highest corner
* Inner: large enough to hold the longest set of parameter segments which
* fully defines a fuse parameter, +1 (for NULL termination).
* Each segment corresponds to a contiguous group of bits from a
* single fuse row. These segments are concatentated together in
* order to form the full fuse parameter value. The segments for
* a given parameter may correspond to different fuse rows.
*/
static struct cpr3_fuse_param
ipq807x_npu_init_voltage_param[IPQ807x_NPU_FUSE_CORNERS][2] = {
{{73, 22, 27}, {} },
{{73, 16, 21}, {} },
};
/*
* Open loop voltage fuse reference voltages in microvolts for IPQ807x
*/
static int
ipq807x_npu_fuse_ref_volt [IPQ807x_NPU_FUSE_CORNERS] = {
912000,
992000,
};
/*
* IPQ9574 (Few parameters are changed, remaining are same as IPQ807x)
*/
#define IPQ9574_NPU_FUSE_CORNERS 2
#define IPQ9574_NPU_FUSE_STEP_VOLT 10000
#define IPQ9574_NPU_CPR_CLOCK_RATE 24000000
/*
* fues parameters for IPQ9574
*/
static struct cpr3_fuse_param
ipq9574_npu_init_voltage_param[IPQ9574_NPU_FUSE_CORNERS][2] = {
{{105, 12, 17}, {} },
{{105, 6, 11}, {} },
};
/*
* Open loop voltage fuse reference voltages in microvolts for IPQ9574
*/
static int
ipq9574_npu_fuse_ref_volt [IPQ9574_NPU_FUSE_CORNERS] = {
862500,
987500,
};
struct cpr3_controller *g_ctrl;
void cpr3_npu_temp_notify(int sensor, int temp, int low_notif)
{
u32 prev_sensor_state;
if (sensor != NPU_TSENS)
return;
prev_sensor_state = g_ctrl->cur_sensor_state;
if (low_notif)
g_ctrl->cur_sensor_state |= BIT(sensor);
else
g_ctrl->cur_sensor_state &= ~BIT(sensor);
if (!prev_sensor_state && g_ctrl->cur_sensor_state)
cpr3_handle_temp_open_loop_adjustment(g_ctrl, true);
else if (prev_sensor_state && !g_ctrl->cur_sensor_state)
cpr3_handle_temp_open_loop_adjustment(g_ctrl, false);
}
/**
* cpr3_ipq807x_npu_read_fuse_data() - load NPU specific fuse parameter values
* @vreg: Pointer to the CPR3 regulator
*
* This function allocates a cpr3_ipq807x_npu_fuses struct, fills it with
* values read out of hardware fuses, and finally copies common fuse values
* into the CPR3 regulator struct.
*
* Return: 0 on success, errno on failure
*/
static int cpr3_ipq807x_npu_read_fuse_data(struct cpr3_regulator *vreg)
{
void __iomem *base = vreg->thread->ctrl->fuse_base;
struct cpr3_ipq807x_npu_fuses *fuse;
int i, rc;
fuse = devm_kzalloc(vreg->thread->ctrl->dev, sizeof(*fuse), GFP_KERNEL);
if (!fuse)
return -ENOMEM;
for (i = 0; i < g_valid_npu_fuse_count; i++) {
rc = cpr3_read_fuse_param(base,
vreg->cpr3_regulator_data->init_voltage_param[i],
&fuse->init_voltage[i]);
if (rc) {
cpr3_err(vreg, "Unable to read fuse-corner %d initial voltage fuse, rc=%d\n",
i, rc);
return rc;
}
}
vreg->fuse_corner_count = g_valid_npu_fuse_count;
vreg->platform_fuses = fuse;
return 0;
}
/**
* cpr3_npu_parse_corner_data() - parse NPU corner data from device tree
* properties of the CPR3 regulator's device node
* @vreg: Pointer to the CPR3 regulator
*
* Return: 0 on success, errno on failure
*/
static int cpr3_npu_parse_corner_data(struct cpr3_regulator *vreg)
{
int rc;
rc = cpr3_parse_common_corner_data(vreg);
if (rc) {
cpr3_err(vreg, "error reading corner data, rc=%d\n", rc);
return rc;
}
return rc;
}
/**
* cpr3_ipq807x_npu_calculate_open_loop_voltages() - calculate the open-loop
* voltage for each corner of a CPR3 regulator
* @vreg: Pointer to the CPR3 regulator
* @temp_correction: Temperature based correction
*
* If open-loop voltage interpolation is allowed in device tree, then
* this function calculates the open-loop voltage for a given corner using
* linear interpolation. This interpolation is performed using the processor
* frequencies of the lower and higher Fmax corners along with their fused
* open-loop voltages.
*
* If open-loop voltage interpolation is not allowed, then this function uses
* the Fmax fused open-loop voltage for all of the corners associated with a
* given fuse corner.
*
* Return: 0 on success, errno on failure
*/
static int cpr3_ipq807x_npu_calculate_open_loop_voltages(
struct cpr3_regulator *vreg, bool temp_correction)
{
struct cpr3_ipq807x_npu_fuses *fuse = vreg->platform_fuses;
struct cpr3_controller *ctrl = vreg->thread->ctrl;
int i, j, rc = 0;
u64 freq_low, volt_low, freq_high, volt_high;
int *fuse_volt;
int *fmax_corner;
fuse_volt = kcalloc(vreg->fuse_corner_count, sizeof(*fuse_volt),
GFP_KERNEL);
fmax_corner = kcalloc(vreg->fuse_corner_count, sizeof(*fmax_corner),
GFP_KERNEL);
if (!fuse_volt || !fmax_corner) {
rc = -ENOMEM;
goto done;
}
for (i = 0; i < vreg->fuse_corner_count; i++) {
if (ctrl->cpr_global_setting == CPR_DISABLED)
fuse_volt[i] = vreg->cpr3_regulator_data->fuse_ref_volt[i];
else
fuse_volt[i] = cpr3_convert_open_loop_voltage_fuse(
vreg->cpr3_regulator_data->fuse_ref_volt[i],
vreg->cpr3_regulator_data->fuse_step_volt,
fuse->init_voltage[i],
IPQ807x_NPU_VOLTAGE_FUSE_SIZE);
/* Log fused open-loop voltage values for debugging purposes. */
cpr3_info(vreg, "fused %8s: open-loop=%7d uV\n",
cpr3_ipq807x_npu_fuse_corner_name[i],
fuse_volt[i]);
}
rc = cpr3_determine_part_type(vreg,
fuse_volt[CPR3_IPQ807x_NPU_FUSE_CORNER_TURBO]);
if (rc) {
cpr3_err(vreg,
"fused part type detection failed failed, rc=%d\n", rc);
goto done;
}
rc = cpr3_adjust_fused_open_loop_voltages(vreg, fuse_volt);
if (rc) {
cpr3_err(vreg,
"fused open-loop voltage adjustment failed, rc=%d\n",
rc);
goto done;
}
if (temp_correction) {
rc = cpr3_determine_temp_base_open_loop_correction(vreg,
fuse_volt);
if (rc) {
cpr3_err(vreg,
"temp open-loop voltage adj. failed, rc=%d\n",
rc);
goto done;
}
}
for (i = 1; i < vreg->fuse_corner_count; i++) {
if (fuse_volt[i] < fuse_volt[i - 1]) {
cpr3_info(vreg,
"fuse corner %d voltage=%d uV < fuse corner %d \
voltage=%d uV; overriding: fuse corner %d \
voltage=%d\n",
i, fuse_volt[i], i - 1, fuse_volt[i - 1],
i, fuse_volt[i - 1]);
fuse_volt[i] = fuse_volt[i - 1];
}
}
/* Determine highest corner mapped to each fuse corner */
j = vreg->fuse_corner_count - 1;
for (i = vreg->corner_count - 1; i >= 0; i--) {
if (vreg->corner[i].cpr_fuse_corner == j) {
fmax_corner[j] = i;
j--;
}
}
if (j >= 0) {
cpr3_err(vreg, "invalid fuse corner mapping\n");
rc = -EINVAL;
goto done;
}
/*
* Interpolation is not possible for corners mapped to the lowest fuse
* corner so use the fuse corner value directly.
*/
for (i = 0; i <= fmax_corner[0]; i++)
vreg->corner[i].open_loop_volt = fuse_volt[0];
/* Interpolate voltages for the higher fuse corners. */
for (i = 1; i < vreg->fuse_corner_count; i++) {
freq_low = vreg->corner[fmax_corner[i - 1]].proc_freq;
volt_low = fuse_volt[i - 1];
freq_high = vreg->corner[fmax_corner[i]].proc_freq;
volt_high = fuse_volt[i];
for (j = fmax_corner[i - 1] + 1; j <= fmax_corner[i]; j++)
vreg->corner[j].open_loop_volt = cpr3_interpolate(
freq_low, volt_low, freq_high, volt_high,
vreg->corner[j].proc_freq);
}
done:
if (rc == 0) {
cpr3_debug(vreg, "unadjusted per-corner open-loop voltages:\n");
for (i = 0; i < vreg->corner_count; i++)
cpr3_debug(vreg, "open-loop[%2d] = %d uV\n", i,
vreg->corner[i].open_loop_volt);
rc = cpr3_adjust_open_loop_voltages(vreg);
if (rc)
cpr3_err(vreg,
"open-loop voltage adjustment failed, rc=%d\n",
rc);
}
kfree(fuse_volt);
kfree(fmax_corner);
return rc;
}
/**
* cpr3_npu_print_settings() - print out NPU CPR configuration settings into
* the kernel log for debugging purposes
* @vreg: Pointer to the CPR3 regulator
*/
static void cpr3_npu_print_settings(struct cpr3_regulator *vreg)
{
struct cpr3_corner *corner;
int i;
cpr3_debug(vreg,
"Corner: Frequency (Hz), Fuse Corner, Floor (uV), \
Open-Loop (uV), Ceiling (uV)\n");
for (i = 0; i < vreg->corner_count; i++) {
corner = &vreg->corner[i];
cpr3_debug(vreg, "%3d: %10u, %2d, %7d, %7d, %7d\n",
i, corner->proc_freq, corner->cpr_fuse_corner,
corner->floor_volt, corner->open_loop_volt,
corner->ceiling_volt);
}
if (vreg->thread->ctrl->apm)
cpr3_debug(vreg, "APM threshold = %d uV, APM adjust = %d uV\n",
vreg->thread->ctrl->apm_threshold_volt,
vreg->thread->ctrl->apm_adj_volt);
}
/**
* cpr3_ipq807x_npu_calc_temp_based_ol_voltages() - Calculate the open loop
* voltages based on temperature based correction margins
* @vreg: Pointer to the CPR3 regulator
*/
static int
cpr3_ipq807x_npu_calc_temp_based_ol_voltages(struct cpr3_regulator *vreg,
bool temp_correction)
{
int rc, i;
rc = cpr3_ipq807x_npu_calculate_open_loop_voltages(vreg,
temp_correction);
if (rc) {
cpr3_err(vreg,
"unable to calculate open-loop voltages, rc=%d\n", rc);
return rc;
}
rc = cpr3_limit_open_loop_voltages(vreg);
if (rc) {
cpr3_err(vreg, "unable to limit open-loop voltages, rc=%d\n",
rc);
return rc;
}
cpr3_open_loop_voltage_as_ceiling(vreg);
rc = cpr3_limit_floor_voltages(vreg);
if (rc) {
cpr3_err(vreg, "unable to limit floor voltages, rc=%d\n", rc);
return rc;
}
for (i = 0; i < vreg->corner_count; i++) {
if (temp_correction)
vreg->corner[i].cold_temp_open_loop_volt =
vreg->corner[i].open_loop_volt;
else
vreg->corner[i].normal_temp_open_loop_volt =
vreg->corner[i].open_loop_volt;
}
cpr3_npu_print_settings(vreg);
return rc;
}
/**
* cpr3_npu_init_thread() - perform steps necessary to initialize the
* configuration data for a CPR3 thread
* @thread: Pointer to the CPR3 thread
*
* Return: 0 on success, errno on failure
*/
static int cpr3_npu_init_thread(struct cpr3_thread *thread)
{
int rc;
rc = cpr3_parse_common_thread_data(thread);
if (rc) {
cpr3_err(thread->ctrl,
"thread %u CPR thread data from DT- failed, rc=%d\n",
thread->thread_id, rc);
return rc;
}
return 0;
}
/**
* cpr3_npu_init_regulator() - perform all steps necessary to initialize the
* configuration data for a CPR3 regulator
* @vreg: Pointer to the CPR3 regulator
*
* Return: 0 on success, errno on failure
*/
static int cpr3_npu_init_regulator(struct cpr3_regulator *vreg)
{
struct cpr3_ipq807x_npu_fuses *fuse;
int rc, cold_temp = 0;
bool can_adj_cold_temp = cpr3_can_adjust_cold_temp(vreg);
rc = cpr3_ipq807x_npu_read_fuse_data(vreg);
if (rc) {
cpr3_err(vreg, "unable to read CPR fuse data, rc=%d\n", rc);
return rc;
}
fuse = vreg->platform_fuses;
rc = cpr3_npu_parse_corner_data(vreg);
if (rc) {
cpr3_err(vreg,
"Cannot read CPR corner data from DT, rc=%d\n", rc);
return rc;
}
rc = cpr3_mem_acc_init(vreg);
if (rc) {
if (rc != -EPROBE_DEFER)
cpr3_err(vreg,
"Cannot initialize mem-acc regulator settings, rc=%d\n",
rc);
return rc;
}
if (can_adj_cold_temp) {
rc = cpr3_ipq807x_npu_calc_temp_based_ol_voltages(vreg, true);
if (rc) {
cpr3_err(vreg,
"unable to calculate open-loop voltages, rc=%d\n", rc);
return rc;
}
}
rc = cpr3_ipq807x_npu_calc_temp_based_ol_voltages(vreg, false);
if (rc) {
cpr3_err(vreg,
"unable to calculate open-loop voltages, rc=%d\n", rc);
return rc;
}
if (can_adj_cold_temp) {
cpr3_info(vreg,
"Normal and Cold condition init done. Default to normal.\n");
rc = cpr3_get_cold_temp_threshold(vreg, &cold_temp);
if (rc) {
cpr3_err(vreg,
"Get cold temperature threshold failed, rc=%d\n", rc);
return rc;
}
register_low_temp_notif(NPU_TSENS, cold_temp,
cpr3_npu_temp_notify);
}
return rc;
}
/**
* cpr3_npu_init_controller() - perform NPU CPR3 controller specific
* initializations
* @ctrl: Pointer to the CPR3 controller
*
* Return: 0 on success, errno on failure
*/
static int cpr3_npu_init_controller(struct cpr3_controller *ctrl)
{
int rc;
rc = cpr3_parse_open_loop_common_ctrl_data(ctrl);
if (rc) {
if (rc != -EPROBE_DEFER)
cpr3_err(ctrl, "unable to parse common controller data, rc=%d\n",
rc);
return rc;
}
ctrl->ctrl_type = CPR_CTRL_TYPE_CPR3;
ctrl->supports_hw_closed_loop = false;
return 0;
}
static const struct cpr3_reg_data ipq807x_cpr_npu = {
.cpr_valid_fuse_count = IPQ807x_NPU_FUSE_CORNERS,
.init_voltage_param = ipq807x_npu_init_voltage_param,
.fuse_ref_volt = ipq807x_npu_fuse_ref_volt,
.fuse_step_volt = IPQ807x_NPU_FUSE_STEP_VOLT,
.cpr_clk_rate = IPQ807x_NPU_CPR_CLOCK_RATE,
};
static const struct cpr3_reg_data ipq817x_cpr_npu = {
.cpr_valid_fuse_count = IPQ817x_NPU_FUSE_CORNERS,
.init_voltage_param = ipq807x_npu_init_voltage_param,
.fuse_ref_volt = ipq807x_npu_fuse_ref_volt,
.fuse_step_volt = IPQ807x_NPU_FUSE_STEP_VOLT,
.cpr_clk_rate = IPQ807x_NPU_CPR_CLOCK_RATE,
};
static const struct cpr3_reg_data ipq9574_cpr_npu = {
.cpr_valid_fuse_count = IPQ9574_NPU_FUSE_CORNERS,
.init_voltage_param = ipq9574_npu_init_voltage_param,
.fuse_ref_volt = ipq9574_npu_fuse_ref_volt,
.fuse_step_volt = IPQ9574_NPU_FUSE_STEP_VOLT,
.cpr_clk_rate = IPQ9574_NPU_CPR_CLOCK_RATE,
};
static struct of_device_id cpr3_regulator_match_table[] = {
{
.compatible = "qcom,cpr3-ipq807x-npu-regulator",
.data = &ipq807x_cpr_npu
},
{
.compatible = "qcom,cpr3-ipq817x-npu-regulator",
.data = &ipq817x_cpr_npu
},
{
.compatible = "qcom,cpr3-ipq9574-npu-regulator",
.data = &ipq9574_cpr_npu
},
{}
};
static int cpr3_npu_regulator_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct cpr3_controller *ctrl;
int i, rc;
const struct of_device_id *match;
struct cpr3_reg_data *cpr_data;
if (!dev->of_node) {
dev_err(dev, "Device tree node is missing\n");
return -EINVAL;
}
ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL);
if (!ctrl)
return -ENOMEM;
g_ctrl = ctrl;
match = of_match_device(cpr3_regulator_match_table, &pdev->dev);
if (!match)
return -ENODEV;
cpr_data = (struct cpr3_reg_data *)match->data;
g_valid_npu_fuse_count = cpr_data->cpr_valid_fuse_count;
dev_info(dev, "NPU CPR valid fuse count: %d\n", g_valid_npu_fuse_count);
ctrl->cpr_clock_rate = cpr_data->cpr_clk_rate;
ctrl->dev = dev;
/* Set to false later if anything precludes CPR operation. */
ctrl->cpr_allowed_hw = true;
rc = of_property_read_string(dev->of_node, "qcom,cpr-ctrl-name",
&ctrl->name);
if (rc) {
cpr3_err(ctrl, "unable to read qcom,cpr-ctrl-name, rc=%d\n",
rc);
return rc;
}
rc = cpr3_map_fuse_base(ctrl, pdev);
if (rc) {
cpr3_err(ctrl, "could not map fuse base address\n");
return rc;
}
rc = cpr3_read_tcsr_setting(ctrl, pdev, IPQ807x_NPU_CPR_TCSR_START,
IPQ807x_NPU_CPR_TCSR_END);
if (rc) {
cpr3_err(ctrl, "could not read CPR tcsr rsetting\n");
return rc;
}
rc = cpr3_allocate_threads(ctrl, 0, 0);
if (rc) {
cpr3_err(ctrl, "failed to allocate CPR thread array, rc=%d\n",
rc);
return rc;
}
if (ctrl->thread_count != 1) {
cpr3_err(ctrl, "expected 1 thread but found %d\n",
ctrl->thread_count);
return -EINVAL;
}
rc = cpr3_npu_init_controller(ctrl);
if (rc) {
if (rc != -EPROBE_DEFER)
cpr3_err(ctrl, "failed to initialize CPR controller parameters, rc=%d\n",
rc);
return rc;
}
rc = cpr3_npu_init_thread(&ctrl->thread[0]);
if (rc) {
cpr3_err(ctrl, "thread initialization failed, rc=%d\n", rc);
return rc;
}
for (i = 0; i < ctrl->thread[0].vreg_count; i++) {
ctrl->thread[0].vreg[i].cpr3_regulator_data = cpr_data;
rc = cpr3_npu_init_regulator(&ctrl->thread[0].vreg[i]);
if (rc) {
cpr3_err(&ctrl->thread[0].vreg[i], "regulator initialization failed, rc=%d\n",
rc);
return rc;
}
}
platform_set_drvdata(pdev, ctrl);
return cpr3_open_loop_regulator_register(pdev, ctrl);
}
static int cpr3_npu_regulator_remove(struct platform_device *pdev)
{
struct cpr3_controller *ctrl = platform_get_drvdata(pdev);
return cpr3_open_loop_regulator_unregister(ctrl);
}
static struct platform_driver cpr3_npu_regulator_driver = {
.driver = {
.name = "qcom,cpr3-npu-regulator",
.of_match_table = cpr3_regulator_match_table,
.owner = THIS_MODULE,
},
.probe = cpr3_npu_regulator_probe,
.remove = cpr3_npu_regulator_remove,
};
static int cpr3_regulator_init(void)
{
return platform_driver_register(&cpr3_npu_regulator_driver);
}
arch_initcall(cpr3_regulator_init);
static void cpr3_regulator_exit(void)
{
platform_driver_unregister(&cpr3_npu_regulator_driver);
}
module_exit(cpr3_regulator_exit);
MODULE_DESCRIPTION("QCOM CPR3 NPU regulator driver");
MODULE_LICENSE("Dual BSD/GPLv2");
MODULE_ALIAS("platform:npu-ipq807x");

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
/*
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __LINUX_POWER_QCOM_APM_H__
#define __LINUX_POWER_QCOM_APM_H__
#include <linux/device.h>
#include <linux/err.h>
/**
* enum msm_apm_supply - supported power rails to supply memory arrays
* %MSM_APM_SUPPLY_APCC: to enable selection of VDD_APCC rail as supply
* %MSM_APM_SUPPLY_MX: to enable selection of VDD_MX rail as supply
*/
enum msm_apm_supply {
MSM_APM_SUPPLY_APCC,
MSM_APM_SUPPLY_MX,
};
/* Handle used to identify an APM controller device */
struct msm_apm_ctrl_dev;
#ifdef CONFIG_QCOM_APM
struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev);
int msm_apm_set_supply(struct msm_apm_ctrl_dev *ctrl_dev,
enum msm_apm_supply supply);
int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev);
#else
static inline struct msm_apm_ctrl_dev *msm_apm_ctrl_dev_get(struct device *dev)
{ return ERR_PTR(-EPERM); }
static inline int msm_apm_set_supply(struct msm_apm_ctrl_dev *ctrl_dev,
enum msm_apm_supply supply)
{ return -EPERM; }
static inline int msm_apm_get_supply(struct msm_apm_ctrl_dev *ctrl_dev)
{ return -EPERM; }
#endif
#endif

View File

@ -1,463 +0,0 @@
/* Copyright (c) 2009-2014, 2016, 2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _ARCH_ARM_MACH_MSM_SOCINFO_H_
#define _ARCH_ARM_MACH_MSM_SOCINFO_H_
#include <linux/of.h>
#define CPU_IPQ8074 323
#define CPU_IPQ8072 342
#define CPU_IPQ8076 343
#define CPU_IPQ8078 344
#define CPU_IPQ8070 375
#define CPU_IPQ8071 376
#define CPU_IPQ8072A 389
#define CPU_IPQ8074A 390
#define CPU_IPQ8076A 391
#define CPU_IPQ8078A 392
#define CPU_IPQ8070A 395
#define CPU_IPQ8071A 396
#define CPU_IPQ8172 397
#define CPU_IPQ8173 398
#define CPU_IPQ8174 399
#define CPU_IPQ6018 402
#define CPU_IPQ6028 403
#define CPU_IPQ6000 421
#define CPU_IPQ6010 422
#define CPU_IPQ6005 453
#define CPU_IPQ5010 446
#define CPU_IPQ5018 447
#define CPU_IPQ5028 448
#define CPU_IPQ5000 503
#define CPU_IPQ0509 504
#define CPU_IPQ0518 505
#define CPU_IPQ9514 510
#define CPU_IPQ9554 512
#define CPU_IPQ9570 513
#define CPU_IPQ9574 514
#define CPU_IPQ9550 511
#define CPU_IPQ9510 521
static inline int read_ipq_soc_version_major(void)
{
const int *prop;
prop = of_get_property(of_find_node_by_path("/"), "soc_version_major",
NULL);
if (!prop)
return -EINVAL;
return le32_to_cpu(*prop);
}
static inline int read_ipq_cpu_type(void)
{
const int *prop;
prop = of_get_property(of_find_node_by_path("/"), "cpu_type", NULL);
/*
* Return Default CPU type if "cpu_type" property is not found in DTSI
*/
if (!prop)
return CPU_IPQ8074;
return le32_to_cpu(*prop);
}
static inline int cpu_is_ipq8070(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8070;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8071(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8071;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8072(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8072;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8074(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8074;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8076(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8076;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8078(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8078;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8072a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8072A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8074a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8074A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8076a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8076A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8078a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8078A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8070a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8070A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8071a(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8071A;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8172(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8172;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8173(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8173;
#else
return 0;
#endif
}
static inline int cpu_is_ipq8174(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ8174;
#else
return 0;
#endif
}
static inline int cpu_is_ipq6018(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ6018;
#else
return 0;
#endif
}
static inline int cpu_is_ipq6028(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ6028;
#else
return 0;
#endif
}
static inline int cpu_is_ipq6000(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ6000;
#else
return 0;
#endif
}
static inline int cpu_is_ipq6010(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ6010;
#else
return 0;
#endif
}
static inline int cpu_is_ipq6005(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ6005;
#else
return 0;
#endif
}
static inline int cpu_is_ipq5010(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ5010;
#else
return 0;
#endif
}
static inline int cpu_is_ipq5018(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ5018;
#else
return 0;
#endif
}
static inline int cpu_is_ipq5028(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ5028;
#else
return 0;
#endif
}
static inline int cpu_is_ipq5000(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ5000;
#else
return 0;
#endif
}
static inline int cpu_is_ipq0509(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ0509;
#else
return 0;
#endif
}
static inline int cpu_is_ipq0518(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ0518;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9514(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9514;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9554(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9554;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9570(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9570;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9574(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9574;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9550(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9550;
#else
return 0;
#endif
}
static inline int cpu_is_ipq9510(void)
{
#ifdef CONFIG_ARCH_QCOM
return read_ipq_cpu_type() == CPU_IPQ9510;
#else
return 0;
#endif
}
static inline int cpu_is_ipq807x(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq8072() || cpu_is_ipq8074() ||
cpu_is_ipq8076() || cpu_is_ipq8078() ||
cpu_is_ipq8070() || cpu_is_ipq8071() ||
cpu_is_ipq8072a() || cpu_is_ipq8074a() ||
cpu_is_ipq8076a() || cpu_is_ipq8078a() ||
cpu_is_ipq8070a() || cpu_is_ipq8071a() ||
cpu_is_ipq8172() || cpu_is_ipq8173() ||
cpu_is_ipq8174();
#else
return 0;
#endif
}
static inline int cpu_is_ipq60xx(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq6018() || cpu_is_ipq6028() ||
cpu_is_ipq6000() || cpu_is_ipq6010() ||
cpu_is_ipq6005();
#else
return 0;
#endif
}
static inline int cpu_is_ipq50xx(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq5010() || cpu_is_ipq5018() ||
cpu_is_ipq5028() || cpu_is_ipq5000() ||
cpu_is_ipq0509() || cpu_is_ipq0518();
#else
return 0;
#endif
}
static inline int cpu_is_ipq95xx(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq9514() || cpu_is_ipq9554() ||
cpu_is_ipq9570() || cpu_is_ipq9574() ||
cpu_is_ipq9550() || cpu_is_ipq9510();
#else
return 0;
#endif
}
static inline int cpu_is_nss_crypto_enabled(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq807x() || cpu_is_ipq60xx() ||
cpu_is_ipq50xx() || cpu_is_ipq9570() ||
cpu_is_ipq9550() || cpu_is_ipq9574() ||
cpu_is_ipq9554();
#else
return 0;
#endif
}
static inline int cpu_is_internal_wifi_enabled(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq807x() || cpu_is_ipq60xx() ||
cpu_is_ipq50xx() || cpu_is_ipq9514() ||
cpu_is_ipq9554() || cpu_is_ipq9574();
#else
return 0;
#endif
}
static inline int cpu_is_uniphy1_enabled(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq807x() || cpu_is_ipq60xx() ||
cpu_is_ipq9554() || cpu_is_ipq9570() ||
cpu_is_ipq9574() || cpu_is_ipq9550();
#else
return 0;
#endif
}
static inline int cpu_is_uniphy2_enabled(void)
{
#ifdef CONFIG_ARCH_QCOM
return cpu_is_ipq807x() || cpu_is_ipq9570() ||
cpu_is_ipq9574();
#else
return 0;
#endif
}
#endif /* _ARCH_ARM_MACH_MSM_SOCINFO_H_ */

View File

@ -1,7 +1,7 @@
From 63750607afad67e57841689b01a9425822503e0c Mon Sep 17 00:00:00 2001 From 3f3f712b16c7d374cfb079ca83684f12fda7884c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Sun, 5 Sep 2021 18:58:16 +0200 Date: Sun, 5 Sep 2021 18:58:16 +0200
Subject: [PATCH] arm64: dts: qcom: ipq8074: add SPMI bus Subject: [PATCH 01/44] arm64: dts: qcom: ipq8074: add SPMI bus
IPQ8074 uses SPMI for communication with the PMIC, so IPQ8074 uses SPMI for communication with the PMIC, so
since its already supported add the DT node for it. since its already supported add the DT node for it.
@ -13,9 +13,11 @@ Link: https://lore.kernel.org/r/20210905165816.655275-1-robimarko@gmail.com
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 19 +++++++++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+) 1 file changed, 19 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 6b9ac0550490..c37de90616fa 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -293,6 +293,25 @@ @@ -293,6 +293,25 @@ gcc: gcc@1800000 {
#reset-cells = <0x1>; #reset-cells = <0x1>;
}; };
@ -41,3 +43,6 @@ Link: https://lore.kernel.org/r/20210905165816.655275-1-robimarko@gmail.com
sdhc_1: sdhci@7824900 { sdhc_1: sdhci@7824900 {
compatible = "qcom,sdhci-msm-v4"; compatible = "qcom,sdhci-msm-v4";
reg = <0x7824900 0x500>, <0x7824000 0x800>; reg = <0x7824900 0x500>, <0x7824000 0x800>;
--
2.37.2

View File

@ -0,0 +1,32 @@
From e5698ba1e94af28e5f54943bcd6de278efc84500 Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org>
Date: Tue, 31 Aug 2021 13:23:25 +0800
Subject: [PATCH 02/44] arm64: dts: qcom: Update BAM DMA node name per DT
schema
Follow dma-controller.yaml schema to use `dma-controller` as node name
of BAM DMA devices.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210831052325.21229-1-shawn.guo@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index c37de90616fa..5acbacecbf4f 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -212,7 +212,7 @@ prng: rng@e3000 {
status = "disabled";
};
- cryptobam: dma@704000 {
+ cryptobam: dma-controller@704000 {
compatible = "qcom,bam-v1.7.0";
reg = <0x00704000 0x20000>;
interrupts = <GIC_SPI 207 IRQ_TYPE_LEVEL_HIGH>;
--
2.37.2

View File

@ -1,7 +1,7 @@
From 9c0bd8e53774c38bd7859ad4af300a5062430925 Mon Sep 17 00:00:00 2001 From 187368d2936edad6342151ae1ac34d95dc2de2c1 Mon Sep 17 00:00:00 2001
From: Chukun Pan <amadeus@jmu.edu.cn> From: Chukun Pan <amadeus@jmu.edu.cn>
Date: Fri, 1 Oct 2021 22:54:21 +0800 Date: Fri, 1 Oct 2021 22:54:21 +0800
Subject: [PATCH] arm64: dts: qcom: ipq8074: Add QUP5 I2C node Subject: [PATCH 03/44] arm64: dts: qcom: ipq8074: Add QUP5 I2C node
Add node to support the QUP5 I2C controller inside of IPQ8074. Add node to support the QUP5 I2C controller inside of IPQ8074.
It is exactly the same as QUP2 controllers. It is exactly the same as QUP2 controllers.
@ -14,9 +14,11 @@ Link: https://lore.kernel.org/r/20211001145421.18302-1-amadeus@jmu.edu.cn
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 15 +++++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 15 +++++++++++++++
1 file changed, 15 insertions(+) 1 file changed, 15 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 5acbacecbf4f..9e700963a1e3 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -430,6 +430,21 @@ @@ -430,6 +430,21 @@ blsp1_i2c3: i2c@78b7000 {
status = "disabled"; status = "disabled";
}; };
@ -38,3 +40,6 @@ Link: https://lore.kernel.org/r/20211001145421.18302-1-amadeus@jmu.edu.cn
blsp1_i2c6: i2c@78ba000 { blsp1_i2c6: i2c@78ba000 {
compatible = "qcom,i2c-qup-v2.2.1"; compatible = "qcom,i2c-qup-v2.2.1";
#address-cells = <1>; #address-cells = <1>;
--
2.37.2

View File

@ -1,134 +0,0 @@
From 82d61e19fccbf2fe7c018765b3799791916e7f31 Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 29 Sep 2021 11:42:46 +0800
Subject: [PATCH] arm64: dts: qcom: msm8996: Move '#clock-cells' to QMP PHY
child node
'#clock-cells' is a required property of QMP PHY child node, not itself.
Move it to fix the dtbs_check warnings.
There are only '#clock-cells' removal from SM8350 QMP PHY nodes, because
child nodes already have the property.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210929034253.24570-4-shawn.guo@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
arch/arm64/boot/dts/qcom/msm8996.dtsi | 4 ++--
arch/arm64/boot/dts/qcom/msm8998.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sm8350.dtsi | 3 ---
4 files changed, 5 insertions(+), 8 deletions(-)
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -91,7 +91,6 @@
ssphy_1: phy@58000 {
compatible = "qcom,ipq8074-qmp-usb3-phy";
reg = <0x00058000 0x1c4>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -112,6 +111,7 @@
<0x00058800 0x1f8>, /* PCS */
<0x00058600 0x044>; /* PCS misc*/
#phy-cells = <0>;
+ #clock-cells = <1>;
clocks = <&gcc GCC_USB1_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb1_pipe_clk_src";
@@ -134,7 +134,6 @@
ssphy_0: phy@78000 {
compatible = "qcom,ipq8074-qmp-usb3-phy";
reg = <0x00078000 0x1c4>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -155,6 +154,7 @@
<0x00078800 0x1f8>, /* PCS */
<0x00078600 0x044>; /* PCS misc*/
#phy-cells = <0>;
+ #clock-cells = <1>;
clocks = <&gcc GCC_USB0_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb0_pipe_clk_src";
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -582,7 +582,6 @@
pcie_phy: phy@34000 {
compatible = "qcom,msm8996-qmp-pcie-phy";
reg = <0x00034000 0x488>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -604,6 +603,7 @@
<0x00035400 0x1dc>;
#phy-cells = <0>;
+ #clock-cells = <1>;
clock-output-names = "pcie_0_pipe_clk_src";
clocks = <&gcc GCC_PCIE_0_PIPE_CLK>;
clock-names = "pipe0";
@@ -2583,7 +2583,6 @@
usb3phy: phy@7410000 {
compatible = "qcom,msm8996-qmp-usb3-phy";
reg = <0x07410000 0x1c4>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -2604,6 +2603,7 @@
<0x07410600 0x1a8>;
#phy-cells = <0>;
+ #clock-cells = <1>;
clock-output-names = "usb3_phy_pipe_clk_src";
clocks = <&gcc GCC_USB3_PHY_PIPE_CLK>;
clock-names = "pipe0";
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -1985,7 +1985,6 @@
compatible = "qcom,msm8998-qmp-usb3-phy";
reg = <0x0c010000 0x18c>;
status = "disabled";
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -2006,6 +2005,7 @@
<0xc010600 0x128>,
<0xc010800 0x200>;
#phy-cells = <0>;
+ #clock-cells = <1>;
clocks = <&gcc GCC_USB3_PHY_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "usb3_phy_pipe_clk_src";
--- a/arch/arm64/boot/dts/qcom/sm8350.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi
@@ -1112,7 +1112,6 @@
reg = <0 0x01d87000 0 0xe10>;
#address-cells = <2>;
#size-cells = <2>;
- #clock-cells = <1>;
ranges;
clock-names = "ref",
"ref_aux";
@@ -1247,7 +1246,6 @@
<0 0x088e8000 0 0x20>;
reg-names = "reg-base", "dp_com";
status = "disabled";
- #clock-cells = <1>;
#address-cells = <2>;
#size-cells = <2>;
ranges;
@@ -1280,7 +1278,6 @@
compatible = "qcom,sm8350-qmp-usb3-uni-phy";
reg = <0 0x088eb000 0 0x200>;
status = "disabled";
- #clock-cells = <1>;
#address-cells = <2>;
#size-cells = <2>;
ranges;

View File

@ -1,273 +0,0 @@
From 1351512f29b4348e6b497f6343896c1033d409b4 Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 29 Sep 2021 11:42:47 +0800
Subject: [PATCH] arm64: dts: qcom: Correct QMP PHY child node name
Many child nodes of QMP PHY are named without following bindings schema
and causing dtbs_check warnings like below.
phy@1c06000: 'lane@1c06800' does not match any of the regexes: '^phy@[0-9a-f]+$'
arch/arm64/boot/dts/qcom/msm8998-asus-novago-tp370ql.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-hp-envy-x2.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-lenovo-miix-630.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-mtp.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-oneplus-dumpling.dt.yaml
Correct them to fix the warnings.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210929034253.24570-5-shawn.guo@linaro.org
---
arch/arm64/boot/dts/qcom/ipq6018.dtsi | 2 +-
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
arch/arm64/boot/dts/qcom/msm8996.dtsi | 10 +++++-----
arch/arm64/boot/dts/qcom/msm8998.dtsi | 6 +++---
arch/arm64/boot/dts/qcom/sdm845.dtsi | 10 +++++-----
arch/arm64/boot/dts/qcom/sm8150.dtsi | 6 +++---
arch/arm64/boot/dts/qcom/sm8250.dtsi | 10 +++++-----
arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +-
8 files changed, 25 insertions(+), 25 deletions(-)
--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi
@@ -401,7 +401,7 @@
reset-names = "phy",
"common";
- pcie_phy0: lane@84200 {
+ pcie_phy0: phy@84200 {
reg = <0x0 0x84200 0x0 0x16c>, /* Serdes Tx */
<0x0 0x84400 0x0 0x200>, /* Serdes Rx */
<0x0 0x84800 0x0 0x4f4>; /* PCS: Lane0, COM, PCIE */
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -105,7 +105,7 @@
reset-names = "phy","common";
status = "disabled";
- usb1_ssphy: lane@58200 {
+ usb1_ssphy: phy@58200 {
reg = <0x00058200 0x130>, /* Tx */
<0x00058400 0x200>, /* Rx */
<0x00058800 0x1f8>, /* PCS */
@@ -148,7 +148,7 @@
reset-names = "phy","common";
status = "disabled";
- usb0_ssphy: lane@78200 {
+ usb0_ssphy: phy@78200 {
reg = <0x00078200 0x130>, /* Tx */
<0x00078400 0x200>, /* Rx */
<0x00078800 0x1f8>, /* PCS */
--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi
@@ -597,7 +597,7 @@
reset-names = "phy", "common", "cfg";
status = "disabled";
- pciephy_0: lane@35000 {
+ pciephy_0: phy@35000 {
reg = <0x00035000 0x130>,
<0x00035200 0x200>,
<0x00035400 0x1dc>;
@@ -611,7 +611,7 @@
reset-names = "lane0";
};
- pciephy_1: lane@36000 {
+ pciephy_1: phy@36000 {
reg = <0x00036000 0x130>,
<0x00036200 0x200>,
<0x00036400 0x1dc>;
@@ -624,7 +624,7 @@
reset-names = "lane1";
};
- pciephy_2: lane@37000 {
+ pciephy_2: phy@37000 {
reg = <0x00037000 0x130>,
<0x00037200 0x200>,
<0x00037400 0x1dc>;
@@ -1743,7 +1743,7 @@
reset-names = "ufsphy";
status = "disabled";
- ufsphy_lane: lanes@627400 {
+ ufsphy_lane: phy@627400 {
reg = <0x627400 0x12c>,
<0x627600 0x200>,
<0x627c00 0x1b4>;
@@ -2597,7 +2597,7 @@
reset-names = "phy", "common";
status = "disabled";
- ssusb_phy_0: lane@7410200 {
+ ssusb_phy_0: phy@7410200 {
reg = <0x07410200 0x200>,
<0x07410400 0x130>,
<0x07410600 0x1a8>;
--- a/arch/arm64/boot/dts/qcom/msm8998.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8998.dtsi
@@ -994,7 +994,7 @@
vdda-phy-supply = <&vreg_l1a_0p875>;
vdda-pll-supply = <&vreg_l2a_1p2>;
- pciephy: lane@1c06800 {
+ pciephy: phy@1c06800 {
reg = <0x01c06200 0x128>, <0x01c06400 0x1fc>, <0x01c06800 0x20c>;
#phy-cells = <0>;
@@ -1066,7 +1066,7 @@
reset-names = "ufsphy";
resets = <&ufshc 0>;
- ufsphy_lanes: lanes@1da7400 {
+ ufsphy_lanes: phy@1da7400 {
reg = <0x01da7400 0x128>,
<0x01da7600 0x1fc>,
<0x01da7c00 0x1dc>,
@@ -1998,7 +1998,7 @@
<&gcc GCC_USB3PHY_PHY_BCR>;
reset-names = "phy", "common";
- usb1_ssphy: lane@c010200 {
+ usb1_ssphy: phy@c010200 {
reg = <0xc010200 0x128>,
<0xc010400 0x200>,
<0xc010c00 0x20c>,
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -2064,7 +2064,7 @@
status = "disabled";
- pcie0_lane: lanes@1c06200 {
+ pcie0_lane: phy@1c06200 {
reg = <0 0x01c06200 0 0x128>,
<0 0x01c06400 0 0x1fc>,
<0 0x01c06800 0 0x218>,
@@ -2174,7 +2174,7 @@
status = "disabled";
- pcie1_lane: lanes@1c06200 {
+ pcie1_lane: phy@1c06200 {
reg = <0 0x01c0a800 0 0x800>,
<0 0x01c0a800 0 0x800>,
<0 0x01c0b800 0 0x400>;
@@ -2302,7 +2302,7 @@
reset-names = "ufsphy";
status = "disabled";
- ufs_mem_phy_lanes: lanes@1d87400 {
+ ufs_mem_phy_lanes: phy@1d87400 {
reg = <0 0x01d87400 0 0x108>,
<0 0x01d87600 0 0x1e0>,
<0 0x01d87c00 0 0x1dc>,
@@ -3699,7 +3699,7 @@
<&gcc GCC_USB3_PHY_PRIM_BCR>;
reset-names = "phy", "common";
- usb_1_ssphy: lanes@88e9200 {
+ usb_1_ssphy: phy@88e9200 {
reg = <0 0x088e9200 0 0x128>,
<0 0x088e9400 0 0x200>,
<0 0x088e9c00 0 0x218>,
@@ -3732,7 +3732,7 @@
<&gcc GCC_USB3_PHY_SEC_BCR>;
reset-names = "phy", "common";
- usb_2_ssphy: lane@88eb200 {
+ usb_2_ssphy: phy@88eb200 {
reg = <0 0x088eb200 0 0x128>,
<0 0x088eb400 0 0x1fc>,
<0 0x088eb800 0 0x218>,
--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
@@ -1692,7 +1692,7 @@
reset-names = "ufsphy";
status = "disabled";
- ufs_mem_phy_lanes: lanes@1d87400 {
+ ufs_mem_phy_lanes: phy@1d87400 {
reg = <0 0x01d87400 0 0x108>,
<0 0x01d87600 0 0x1e0>,
<0 0x01d87c00 0 0x1dc>,
@@ -3010,7 +3010,7 @@
<&gcc GCC_USB3_PHY_PRIM_BCR>;
reset-names = "phy", "common";
- usb_1_ssphy: lanes@88e9200 {
+ usb_1_ssphy: phy@88e9200 {
reg = <0 0x088e9200 0 0x200>,
<0 0x088e9400 0 0x200>,
<0 0x088e9c00 0 0x218>,
@@ -3043,7 +3043,7 @@
<&gcc GCC_USB3_PHY_SEC_BCR>;
reset-names = "phy", "common";
- usb_2_ssphy: lane@88eb200 {
+ usb_2_ssphy: phy@88eb200 {
reg = <0 0x088eb200 0 0x200>,
<0 0x088eb400 0 0x200>,
<0 0x088eb800 0 0x800>,
--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
@@ -1463,7 +1463,7 @@
status = "disabled";
- pcie0_lane: lanes@1c06200 {
+ pcie0_lane: phy@1c06200 {
reg = <0 0x1c06200 0 0x170>, /* tx */
<0 0x1c06400 0 0x200>, /* rx */
<0 0x1c06800 0 0x1f0>, /* pcs */
@@ -1567,7 +1567,7 @@
status = "disabled";
- pcie1_lane: lanes@1c0e200 {
+ pcie1_lane: phy@1c0e200 {
reg = <0 0x1c0e200 0 0x170>, /* tx0 */
<0 0x1c0e400 0 0x200>, /* rx0 */
<0 0x1c0ea00 0 0x1f0>, /* pcs */
@@ -1673,7 +1673,7 @@
status = "disabled";
- pcie2_lane: lanes@1c16200 {
+ pcie2_lane: phy@1c16200 {
reg = <0 0x1c16200 0 0x170>, /* tx0 */
<0 0x1c16400 0 0x200>, /* rx0 */
<0 0x1c16a00 0 0x1f0>, /* pcs */
@@ -1750,7 +1750,7 @@
reset-names = "ufsphy";
status = "disabled";
- ufs_mem_phy_lanes: lanes@1d87400 {
+ ufs_mem_phy_lanes: phy@1d87400 {
reg = <0 0x01d87400 0 0x108>,
<0 0x01d87600 0 0x1e0>,
<0 0x01d87c00 0 0x1dc>,
@@ -2330,7 +2330,7 @@
<&gcc GCC_USB3_PHY_SEC_BCR>;
reset-names = "phy", "common";
- usb_2_ssphy: lanes@88eb200 {
+ usb_2_ssphy: phy@88eb200 {
reg = <0 0x088eb200 0 0x200>,
<0 0x088eb400 0 0x200>,
<0 0x088eb800 0 0x800>;
--- a/arch/arm64/boot/dts/qcom/sm8350.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi
@@ -1122,7 +1122,7 @@
reset-names = "ufsphy";
status = "disabled";
- ufs_mem_phy_lanes: lanes@1d87400 {
+ ufs_mem_phy_lanes: phy@1d87400 {
reg = <0 0x01d87400 0 0x108>,
<0 0x01d87600 0 0x1e0>,
<0 0x01d87c00 0 0x1dc>,

View File

@ -0,0 +1,58 @@
From 4ef751128de689e12e3eccb5d4e2562ef8b42758 Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 29 Sep 2021 11:42:46 +0800
Subject: [PATCH 04/44] arm64: dts: qcom: msm8996: Move '#clock-cells' to QMP
PHY child node
'#clock-cells' is a required property of QMP PHY child node, not itself.
Move it to fix the dtbs_check warnings.
There are only '#clock-cells' removal from SM8350 QMP PHY nodes, because
child nodes already have the property.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210929034253.24570-4-shawn.guo@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 9e700963a1e3..69ce2dd644ab 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -91,7 +91,6 @@ soc: soc {
ssphy_1: phy@58000 {
compatible = "qcom,ipq8074-qmp-usb3-phy";
reg = <0x00058000 0x1c4>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -112,6 +111,7 @@ usb1_ssphy: lane@58200 {
<0x00058800 0x1f8>, /* PCS */
<0x00058600 0x044>; /* PCS misc*/
#phy-cells = <0>;
+ #clock-cells = <1>;
clocks = <&gcc GCC_USB1_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb1_pipe_clk_src";
@@ -134,7 +134,6 @@ qusb_phy_1: phy@59000 {
ssphy_0: phy@78000 {
compatible = "qcom,ipq8074-qmp-usb3-phy";
reg = <0x00078000 0x1c4>;
- #clock-cells = <1>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
@@ -155,6 +154,7 @@ usb0_ssphy: lane@78200 {
<0x00078800 0x1f8>, /* PCS */
<0x00078600 0x044>; /* PCS misc*/
#phy-cells = <0>;
+ #clock-cells = <1>;
clocks = <&gcc GCC_USB0_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb0_pipe_clk_src";
--
2.37.2

View File

@ -0,0 +1,50 @@
From 616ad8e9f89e9f57597cf856697fe1c35cf84e5d Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 29 Sep 2021 11:42:47 +0800
Subject: [PATCH 05/44] arm64: dts: qcom: Correct QMP PHY child node name
Many child nodes of QMP PHY are named without following bindings schema
and causing dtbs_check warnings like below.
phy@1c06000: 'lane@1c06800' does not match any of the regexes: '^phy@[0-9a-f]+$'
arch/arm64/boot/dts/qcom/msm8998-asus-novago-tp370ql.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-hp-envy-x2.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-lenovo-miix-630.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-mtp.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-oneplus-cheeseburger.dt.yaml
arch/arm64/boot/dts/qcom/msm8998-oneplus-dumpling.dt.yaml
Correct them to fix the warnings.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210929034253.24570-5-shawn.guo@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 69ce2dd644ab..56c1b4cfc6ba 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -105,7 +105,7 @@ ssphy_1: phy@58000 {
reset-names = "phy","common";
status = "disabled";
- usb1_ssphy: lane@58200 {
+ usb1_ssphy: phy@58200 {
reg = <0x00058200 0x130>, /* Tx */
<0x00058400 0x200>, /* Rx */
<0x00058800 0x1f8>, /* PCS */
@@ -148,7 +148,7 @@ ssphy_0: phy@78000 {
reset-names = "phy","common";
status = "disabled";
- usb0_ssphy: lane@78200 {
+ usb0_ssphy: phy@78200 {
reg = <0x00078200 0x130>, /* Tx */
<0x00078400 0x200>, /* Rx */
<0x00078800 0x1f8>, /* PCS */
--
2.37.2

View File

@ -1,7 +1,7 @@
From 942bcd33ed455ad40b71a59901bd926bbf4a500e Mon Sep 17 00:00:00 2001 From 2a38228b9ac3f8cb4fdae411abbdd5226b687880 Mon Sep 17 00:00:00 2001
From: Shawn Guo <shawn.guo@linaro.org> From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 29 Sep 2021 11:42:51 +0800 Date: Wed, 29 Sep 2021 11:42:51 +0800
Subject: [PATCH] arm64: dts: qcom: Fix IPQ8074 PCIe PHY nodes Subject: [PATCH 06/44] arm64: dts: qcom: Fix IPQ8074 PCIe PHY nodes
IPQ8074 PCIe PHY nodes are broken in the many ways: IPQ8074 PCIe PHY nodes are broken in the many ways:
@ -19,9 +19,11 @@ Link: https://lore.kernel.org/r/20210929034253.24570-9-shawn.guo@linaro.org
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 46 +++++++++++++++++++++------ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 46 +++++++++++++++++++++------
1 file changed, 36 insertions(+), 10 deletions(-) 1 file changed, 36 insertions(+), 10 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 56c1b4cfc6ba..4512fcac0f9a 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -174,34 +174,60 @@ @@ -174,34 +174,60 @@ qusb_phy_0: phy@79000 {
status = "disabled"; status = "disabled";
}; };
@ -92,3 +94,6 @@ Link: https://lore.kernel.org/r/20210929034253.24570-9-shawn.guo@linaro.org
}; };
prng: rng@e3000 { prng: rng@e3000 {
--
2.37.2

View File

@ -1,7 +1,7 @@
From d201f67714a302b12ad3d78b982963342939629c Mon Sep 17 00:00:00 2001 From 9757a0d4e05b807074f6868ed594a9bf0111d74d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Thu, 7 Oct 2021 13:58:46 +0200 Date: Thu, 7 Oct 2021 13:58:46 +0200
Subject: [PATCH] arm64: dts: qcom: ipq8074: add MDIO bus Subject: [PATCH 07/44] arm64: dts: qcom: ipq8074: add MDIO bus
IPQ8074 uses an IPQ4019 compatible MDIO controller that is already IPQ8074 uses an IPQ4019 compatible MDIO controller that is already
supported in the kernel, so add the DT node in order to use it. supported in the kernel, so add the DT node in order to use it.
@ -13,9 +13,11 @@ Link: https://lore.kernel.org/r/20211007115846.26255-1-robimarko@gmail.com
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 12 ++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 12 ++++++++++++
1 file changed, 12 insertions(+) 1 file changed, 12 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 4512fcac0f9a..6ee54f89f973 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -230,6 +230,18 @@ @@ -230,6 +230,18 @@ pcie_phy1: phy@8e200 {
}; };
}; };
@ -34,3 +36,6 @@ Link: https://lore.kernel.org/r/20211007115846.26255-1-robimarko@gmail.com
prng: rng@e3000 { prng: rng@e3000 {
compatible = "qcom,prng-ee"; compatible = "qcom,prng-ee";
reg = <0x000e3000 0x1000>; reg = <0x000e3000 0x1000>;
--
2.37.2

View File

@ -1,7 +1,7 @@
From 36e21b500f0432e746cfdb3e14eb22761222511c Mon Sep 17 00:00:00 2001 From 00abf58f0ec5ce9dd947792f65e9d01284a4e9c8 Mon Sep 17 00:00:00 2001
From: Bjorn Andersson <bjorn.andersson@linaro.org> From: Bjorn Andersson <bjorn.andersson@linaro.org>
Date: Thu, 30 Sep 2021 11:21:10 -0700 Date: Thu, 30 Sep 2021 11:21:10 -0700
Subject: [PATCH] soc: qcom: smem: Support reserved-memory description Subject: [PATCH 08/44] soc: qcom: smem: Support reserved-memory description
Practically all modern Qualcomm platforms has a single reserved-memory Practically all modern Qualcomm platforms has a single reserved-memory
region for SMEM. So rather than having to describe SMEM in the form of a region for SMEM. So rather than having to describe SMEM in the form of a
@ -27,9 +27,11 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
drivers/soc/qcom/smem.c | 57 ++++++++++++++++++++++++++++------------- drivers/soc/qcom/smem.c | 57 ++++++++++++++++++++++++++++-------------
2 files changed, 40 insertions(+), 18 deletions(-) 2 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 74afbb7a4f5e..19ba8e4d4f8d 100644
--- a/drivers/of/platform.c --- a/drivers/of/platform.c
+++ b/drivers/of/platform.c +++ b/drivers/of/platform.c
@@ -509,6 +509,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_po @@ -509,6 +509,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_populate);
static const struct of_device_id reserved_mem_matches[] = { static const struct of_device_id reserved_mem_matches[] = {
{ .compatible = "qcom,rmtfs-mem" }, { .compatible = "qcom,rmtfs-mem" },
{ .compatible = "qcom,cmd-db" }, { .compatible = "qcom,cmd-db" },
@ -37,6 +39,8 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
{ .compatible = "ramoops" }, { .compatible = "ramoops" },
{ .compatible = "nvmem-rmem" }, { .compatible = "nvmem-rmem" },
{} {}
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 4fb5aeeb0843..c7e519bfdc8a 100644
--- a/drivers/soc/qcom/smem.c --- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
@ -47,7 +51,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/sizes.h> #include <linux/sizes.h>
#include <linux/slab.h> #include <linux/slab.h>
@@ -240,7 +241,7 @@ static const u8 SMEM_INFO_MAGIC[] = { 0x @@ -240,7 +241,7 @@ static const u8 SMEM_INFO_MAGIC[] = { 0x53, 0x49, 0x49, 0x49 }; /* SIII */
* @size: size of the memory region * @size: size of the memory region
*/ */
struct smem_region { struct smem_region {
@ -56,7 +60,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
void __iomem *virt_base; void __iomem *virt_base;
size_t size; size_t size;
}; };
@@ -499,7 +500,7 @@ static void *qcom_smem_get_global(struct @@ -499,7 +500,7 @@ static void *qcom_smem_get_global(struct qcom_smem *smem,
for (i = 0; i < smem->num_regions; i++) { for (i = 0; i < smem->num_regions; i++) {
region = &smem->regions[i]; region = &smem->regions[i];
@ -65,7 +69,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
if (size != NULL) if (size != NULL)
*size = le32_to_cpu(entry->size); *size = le32_to_cpu(entry->size);
return region->virt_base + le32_to_cpu(entry->offset); return region->virt_base + le32_to_cpu(entry->offset);
@@ -664,7 +665,7 @@ phys_addr_t qcom_smem_virt_to_phys(void @@ -664,7 +665,7 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
if (p < region->virt_base + region->size) { if (p < region->virt_base + region->size) {
u64 offset = p - region->virt_base; u64 offset = p - region->virt_base;
@ -74,7 +78,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
} }
} }
@@ -863,12 +864,12 @@ qcom_smem_enumerate_partitions(struct qc @@ -863,12 +864,12 @@ qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
return 0; return 0;
} }
@ -90,7 +94,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
int ret; int ret;
np = of_parse_phandle(dev->of_node, name, 0); np = of_parse_phandle(dev->of_node, name, 0);
@@ -881,13 +882,9 @@ static int qcom_smem_map_memory(struct q @@ -881,13 +882,9 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,
of_node_put(np); of_node_put(np);
if (ret) if (ret)
return ret; return ret;
@ -106,7 +110,7 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
return 0; return 0;
} }
@@ -895,12 +892,14 @@ static int qcom_smem_map_memory(struct q @@ -895,12 +892,14 @@ static int qcom_smem_map_memory(struct qcom_smem *smem, struct device *dev,
static int qcom_smem_probe(struct platform_device *pdev) static int qcom_smem_probe(struct platform_device *pdev)
{ {
struct smem_header *header; struct smem_header *header;
@ -121,17 +125,13 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
num_regions = 1; num_regions = 1;
if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL)) if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL))
@@ -914,13 +913,35 @@ static int qcom_smem_probe(struct platfo @@ -914,13 +913,35 @@ static int qcom_smem_probe(struct platform_device *pdev)
smem->dev = &pdev->dev; smem->dev = &pdev->dev;
smem->num_regions = num_regions; smem->num_regions = num_regions;
- ret = qcom_smem_map_memory(smem, &pdev->dev, "memory-region", 0); - ret = qcom_smem_map_memory(smem, &pdev->dev, "memory-region", 0);
- if (ret) - if (ret)
- return ret; - return ret;
-
- if (num_regions > 1 && (ret = qcom_smem_map_memory(smem, &pdev->dev,
- "qcom,rpm-msg-ram", 1)))
- return ret;
+ rmem = of_reserved_mem_lookup(pdev->dev.of_node); + rmem = of_reserved_mem_lookup(pdev->dev.of_node);
+ if (rmem) { + if (rmem) {
+ smem->regions[0].aux_base = rmem->base; + smem->regions[0].aux_base = rmem->base;
@ -145,7 +145,10 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
+ if (ret) + if (ret)
+ return ret; + return ret;
+ } + }
+
- if (num_regions > 1 && (ret = qcom_smem_map_memory(smem, &pdev->dev,
- "qcom,rpm-msg-ram", 1)))
- return ret;
+ if (num_regions > 1) { + if (num_regions > 1) {
+ ret = qcom_smem_resolve_mem(smem, "qcom,rpm-msg-ram", &smem->regions[1]); + ret = qcom_smem_resolve_mem(smem, "qcom,rpm-msg-ram", &smem->regions[1]);
+ if (ret) + if (ret)
@ -164,3 +167,6 @@ Link: https://lore.kernel.org/r/20210930182111.57353-4-bjorn.andersson@linaro.or
header = smem->regions[0].virt_base; header = smem->regions[0].virt_base;
if (le32_to_cpu(header->initialized) != 1 || if (le32_to_cpu(header->initialized) != 1 ||
--
2.37.2

View File

@ -1,19 +1,23 @@
From f63c96c02671c00871d180fb5b436e53f4847d3c Mon Sep 17 00:00:00 2001 From 0064ce4f52ed8fc010c1794114205daa9f598828 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Thu, 6 Jan 2022 22:25:12 +0100 Date: Thu, 6 Jan 2022 22:25:12 +0100
Subject: [PATCH] arm64: dts: ipq8074: add SMEM support Subject: [PATCH 09/44] arm64: dts: qcom: ipq8074: add SMEM support
IPQ8074 uses SMEM like other modern QCA SoC-s, so since its already IPQ8074 uses SMEM like other modern QCA SoC-s, so since its already
supported by the kernel add the required DT nodes. supported by the kernel add the required DT nodes.
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220106212512.1970828-1-robimarko@gmail.com
--- ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 20 ++++++++++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+) 1 file changed, 20 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 6ee54f89f973..954f85c460ed 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -76,6 +76,20 @@ @@ -76,6 +76,20 @@ psci {
method = "smc"; method = "smc";
}; };
@ -34,7 +38,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
firmware { firmware {
scm { scm {
compatible = "qcom,scm-ipq8074", "qcom,scm"; compatible = "qcom,scm-ipq8074", "qcom,scm";
@@ -331,6 +345,12 @@ @@ -331,6 +345,12 @@ gcc: gcc@1800000 {
#reset-cells = <0x1>; #reset-cells = <0x1>;
}; };
@ -47,3 +51,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
spmi_bus: spmi@200f000 { spmi_bus: spmi@200f000 {
compatible = "qcom,spmi-pmic-arb"; compatible = "qcom,spmi-pmic-arb";
reg = <0x0200f000 0x001000>, reg = <0x0200f000 0x001000>,
--
2.37.2

View File

@ -0,0 +1,35 @@
From d58eeedd46d47db44a5932f7d74efae881d54c9b Mon Sep 17 00:00:00 2001
From: Kathiravan T <quic_kathirav@quicinc.com>
Date: Fri, 7 Jan 2022 18:24:38 +0530
Subject: [PATCH 10/44] arm64: dts: qcom: ipq8074: add the reserved-memory node
On IPQ8074, 4MB of memory is needed for TZ. So mark that region
as reserved.
Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com>
[bjorn: Squash with existing reserved-memory node]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1641560078-860-1-git-send-email-quic_kathirav@quicinc.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 954f85c460ed..9e8e907290a4 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -88,6 +88,11 @@ smem@4ab00000 {
hwlocks = <&tcsr_mutex 0>;
};
+
+ memory@4ac00000 {
+ no-map;
+ reg = <0x0 0x4ac00000 0x0 0x00400000>;
+ };
};
firmware {
--
2.37.2

View File

@ -1,19 +1,23 @@
From 110bec39320cbfd23ac869af4aa231cda9c5f74a Mon Sep 17 00:00:00 2001 From 4f0959ded385c8ed518659aa08cedbd83ae0726a Mon Sep 17 00:00:00 2001
From: Kathiravan T <quic_kathirav@quicinc.com> From: Kathiravan T <quic_kathirav@quicinc.com>
Date: Tue, 8 Feb 2022 21:05:24 +0530 Date: Tue, 8 Feb 2022 21:05:24 +0530
Subject: [PATCH] arm64: dts: qcom: ipq8074: enable the GICv2m support Subject: [PATCH 11/44] arm64: dts: qcom: ipq8074: enable the GICv2m support
GIC used in the IPQ8074 SoCs has one instance of the GICv2m extension, GIC used in the IPQ8074 SoCs has one instance of the GICv2m extension,
which supports upto 32 MSI interrupts. Lets add support for the same. which supports upto 32 MSI interrupts. Lets add support for the same.
Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com> Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1644334525-11577-2-git-send-email-quic_kathirav@quicinc.com
--- ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 9 +++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 9 +++++++++
1 file changed, 9 insertions(+) 1 file changed, 9 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 9e8e907290a4..c98443d4798f 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -669,9 +669,18 @@ @@ -634,9 +634,18 @@ dwc_1: dwc3@8c00000 {
intc: interrupt-controller@b000000 { intc: interrupt-controller@b000000 {
compatible = "qcom,msm-qgic2"; compatible = "qcom,msm-qgic2";
@ -32,3 +36,6 @@ Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com>
}; };
timer { timer {
--
2.37.2

View File

@ -0,0 +1,31 @@
From 2e21d1f48dc0d0cdbd53ac33b9859c7cb575eecc Mon Sep 17 00:00:00 2001
From: Kathiravan T <quic_kathirav@quicinc.com>
Date: Wed, 2 Feb 2022 22:05:08 +0530
Subject: [PATCH 12/44] arm64: dts: qcom: ipq8074: drop the clock-frequency
property
Drop the clock-frequency property from the MMIO timer node, since it
is already configured by the bootloader.
Signed-off-by: Kathiravan T <quic_kathirav@quicinc.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1643819709-5410-2-git-send-email-quic_kathirav@quicinc.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index c98443d4798f..664fba3632b1 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -670,7 +670,6 @@ timer@b120000 {
ranges;
compatible = "arm,armv7-timer-mem";
reg = <0x0b120000 0x1000>;
- clock-frequency = <19200000>;
frame@b120000 {
frame-number = <0>;
--
2.37.2

View File

@ -0,0 +1,67 @@
From 4647475f588c85138ddf47a17305dd41834e1105 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Tue, 5 Apr 2022 08:34:43 +0200
Subject: [PATCH 13/44] arm64: dts: qcom: align dmas in I2C/SPI/UART with DT
schema
The DT schema expects dma channels in tx-rx order. No functional
change.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220405063451.12011-2-krzysztof.kozlowski@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 664fba3632b1..61fc121dce7b 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -471,8 +471,8 @@ blsp1_i2c2: i2c@78b6000 {
<&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
clock-names = "iface", "core";
clock-frequency = <400000>;
- dmas = <&blsp_dma 15>, <&blsp_dma 14>;
- dma-names = "rx", "tx";
+ dmas = <&blsp_dma 14>, <&blsp_dma 15>;
+ dma-names = "tx", "rx";
pinctrl-0 = <&i2c_0_pins>;
pinctrl-names = "default";
status = "disabled";
@@ -488,8 +488,8 @@ blsp1_i2c3: i2c@78b7000 {
<&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>;
clock-names = "iface", "core";
clock-frequency = <100000>;
- dmas = <&blsp_dma 17>, <&blsp_dma 16>;
- dma-names = "rx", "tx";
+ dmas = <&blsp_dma 16>, <&blsp_dma 17>;
+ dma-names = "tx", "rx";
status = "disabled";
};
@@ -503,8 +503,8 @@ blsp1_i2c5: i2c@78b9000 {
<&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>;
clock-names = "iface", "core";
clock-frequency = <400000>;
- dmas = <&blsp_dma 21>, <&blsp_dma 20>;
- dma-names = "rx", "tx";
+ dmas = <&blsp_dma 20>, <&blsp_dma 21>;
+ dma-names = "tx", "rx";
status = "disabled";
};
@@ -518,8 +518,8 @@ blsp1_i2c6: i2c@78ba000 {
<&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>;
clock-names = "iface", "core";
clock-frequency = <100000>;
- dmas = <&blsp_dma 23>, <&blsp_dma 22>;
- dma-names = "rx", "tx";
+ dmas = <&blsp_dma 22>, <&blsp_dma 23>;
+ dma-names = "tx", "rx";
status = "disabled";
};
--
2.37.2

View File

@ -0,0 +1,74 @@
From 553f1ea4128453cead2d38d5773ec6044c6e7626 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Tue, 5 Apr 2022 08:34:44 +0200
Subject: [PATCH 14/44] arm64: dts: qcom: align clocks in I2C/SPI with DT
schema
The DT schema expects clocks core-iface order. No functional change.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220405063451.12011-3-krzysztof.kozlowski@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 61fc121dce7b..e771ceea7453 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -467,9 +467,9 @@ blsp1_i2c2: i2c@78b6000 {
#size-cells = <0>;
reg = <0x078b6000 0x600>;
interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&gcc GCC_BLSP1_AHB_CLK>,
- <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
- clock-names = "iface", "core";
+ clocks = <&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>,
+ <&gcc GCC_BLSP1_AHB_CLK>;
+ clock-names = "core", "iface";
clock-frequency = <400000>;
dmas = <&blsp_dma 14>, <&blsp_dma 15>;
dma-names = "tx", "rx";
@@ -484,9 +484,9 @@ blsp1_i2c3: i2c@78b7000 {
#size-cells = <0>;
reg = <0x078b7000 0x600>;
interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&gcc GCC_BLSP1_AHB_CLK>,
- <&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>;
- clock-names = "iface", "core";
+ clocks = <&gcc GCC_BLSP1_QUP3_I2C_APPS_CLK>,
+ <&gcc GCC_BLSP1_AHB_CLK>;
+ clock-names = "core", "iface";
clock-frequency = <100000>;
dmas = <&blsp_dma 16>, <&blsp_dma 17>;
dma-names = "tx", "rx";
@@ -499,9 +499,9 @@ blsp1_i2c5: i2c@78b9000 {
#size-cells = <0>;
reg = <0x78b9000 0x600>;
interrupts = <GIC_SPI 299 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&gcc GCC_BLSP1_AHB_CLK>,
- <&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>;
- clock-names = "iface", "core";
+ clocks = <&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>,
+ <&gcc GCC_BLSP1_AHB_CLK>;
+ clock-names = "core", "iface";
clock-frequency = <400000>;
dmas = <&blsp_dma 20>, <&blsp_dma 21>;
dma-names = "tx", "rx";
@@ -514,9 +514,9 @@ blsp1_i2c6: i2c@78ba000 {
#size-cells = <0>;
reg = <0x078ba000 0x600>;
interrupts = <GIC_SPI 300 IRQ_TYPE_LEVEL_HIGH>;
- clocks = <&gcc GCC_BLSP1_AHB_CLK>,
- <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>;
- clock-names = "iface", "core";
+ clocks = <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>,
+ <&gcc GCC_BLSP1_AHB_CLK>;
+ clock-names = "core", "iface";
clock-frequency = <100000>;
dmas = <&blsp_dma 22>, <&blsp_dma 23>;
dma-names = "tx", "rx";
--
2.37.2

View File

@ -0,0 +1,42 @@
From 04e91eb95f7a0a9dceed2c1fcb47fbbe7f96ec52 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Wed, 4 May 2022 15:19:16 +0200
Subject: [PATCH 15/44] arm64: dts: qcom: correct DWC3 node names and unit
addresses
Align DWC3 USB node names with DT schema ("usb" is expected) and correct
the unit addresses to match the "reg" property. This also implies
overriding nodes by label, instead of full path.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220504131923.214367-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index e771ceea7453..51c3eb1bd393 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -578,7 +578,7 @@ usb_0: usb@8af8800 {
resets = <&gcc GCC_USB0_BCR>;
status = "disabled";
- dwc_0: dwc3@8a00000 {
+ dwc_0: usb@8a00000 {
compatible = "snps,dwc3";
reg = <0x8a00000 0xcd00>;
interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
@@ -618,7 +618,7 @@ usb_1: usb@8cf8800 {
resets = <&gcc GCC_USB1_BCR>;
status = "disabled";
- dwc_1: dwc3@8c00000 {
+ dwc_1: usb@8c00000 {
compatible = "snps,dwc3";
reg = <0x8c00000 0xcd00>;
interrupts = <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>;
--
2.37.2

View File

@ -0,0 +1,41 @@
From 65b572a6c5bad2c9f3c784ff42d4eddedcfd85cd Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Wed, 4 May 2022 15:19:17 +0200
Subject: [PATCH 16/44] arm64: dts: qcom: ipq8074: add dedicated
qcom,ipq8074-dwc3 compatible
Add dedicated compatible for DWC3 USB node name to allow more accurate
DT schema matching.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220504131923.214367-8-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 51c3eb1bd393..4d3ecb09de9c 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -553,7 +553,7 @@ qpic_nand: nand-controller@79b0000 {
};
usb_0: usb@8af8800 {
- compatible = "qcom,dwc3";
+ compatible = "qcom,ipq8074-dwc3", "qcom,dwc3";
reg = <0x08af8800 0x400>;
#address-cells = <1>;
#size-cells = <1>;
@@ -593,7 +593,7 @@ dwc_0: usb@8a00000 {
};
usb_1: usb@8cf8800 {
- compatible = "qcom,dwc3";
+ compatible = "qcom,ipq8074-dwc3", "qcom,dwc3";
reg = <0x08cf8800 0x400>;
#address-cells = <1>;
#size-cells = <1>;
--
2.37.2

View File

@ -0,0 +1,44 @@
From e8949160470080b4c24139cfb88accc25e589f70 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Wed, 4 May 2022 15:19:22 +0200
Subject: [PATCH 17/44] arm64: dts: qcom: align DWC3 USB clocks with DT schema
Align order of clocks and their names with Qualcomm DWC3 USB DT schema.
No functional impact expected.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220504131923.214367-13-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 4d3ecb09de9c..697f46e17903 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -563,8 +563,8 @@ usb_0: usb@8af8800 {
<&gcc GCC_USB0_MASTER_CLK>,
<&gcc GCC_USB0_SLEEP_CLK>,
<&gcc GCC_USB0_MOCK_UTMI_CLK>;
- clock-names = "sys_noc_axi",
- "master",
+ clock-names = "cfg_noc",
+ "core",
"sleep",
"mock_utmi";
@@ -603,8 +603,8 @@ usb_1: usb@8cf8800 {
<&gcc GCC_USB1_MASTER_CLK>,
<&gcc GCC_USB1_SLEEP_CLK>,
<&gcc GCC_USB1_MOCK_UTMI_CLK>;
- clock-names = "sys_noc_axi",
- "master",
+ clock-names = "cfg_noc",
+ "core",
"sleep",
"mock_utmi";
--
2.37.2

View File

@ -0,0 +1,41 @@
From af38dc1085f574d575c886c0800645c8b7d4b874 Mon Sep 17 00:00:00 2001
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Date: Thu, 26 May 2022 22:42:47 +0200
Subject: [PATCH 18/44] arm64: dts: qcom: adjust whitespace around '='
Fix whitespace coding style: use single space instead of tabs or
multiple spaces around '=' sign in property assignment. No functional
changes (same DTB).
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220526204248.832139-1-krzysztof.kozlowski@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 697f46e17903..6a4bcf3ef94e 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -119,7 +119,7 @@ ssphy_1: phy@58000 {
<&xo>;
clock-names = "aux", "cfg_ahb", "ref";
- resets = <&gcc GCC_USB1_PHY_BCR>,
+ resets = <&gcc GCC_USB1_PHY_BCR>,
<&gcc GCC_USB3PHY_1_PHY_BCR>;
reset-names = "phy","common";
status = "disabled";
@@ -162,7 +162,7 @@ ssphy_0: phy@78000 {
<&xo>;
clock-names = "aux", "cfg_ahb", "ref";
- resets = <&gcc GCC_USB0_PHY_BCR>,
+ resets = <&gcc GCC_USB0_PHY_BCR>,
<&gcc GCC_USB3PHY_0_PHY_BCR>;
reset-names = "phy","common";
status = "disabled";
--
2.37.2

View File

@ -0,0 +1,39 @@
From 0d7e4bd5d554ac7471724f80aa67b664f3539f47 Mon Sep 17 00:00:00 2001
From: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Date: Sun, 15 May 2022 03:24:19 +0530
Subject: [PATCH 19/44] arm64: dts: qcom: Fix sdhci node names - use 'mmc@'
Since the Qualcomm sdhci-msm device-tree binding has been converted
to yaml format, 'make dtbs_check' reports issues with
inconsistent 'sdhci@' convention used for specifying the
sdhci nodes. The generic mmc bindings expect 'mmc@' format
instead.
Fix the same.
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
[bjorn: Moved non-arm64 changes to separate commit]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220514215424.1007718-2-bhupesh.sharma@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 6a4bcf3ef94e..3658f41393e1 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -375,7 +375,7 @@ spmi_bus: spmi@200f000 {
cell-index = <0>;
};
- sdhc_1: sdhci@7824900 {
+ sdhc_1: mmc@7824900 {
compatible = "qcom,sdhci-msm-v4";
reg = <0x7824900 0x500>, <0x7824000 0x800>;
reg-names = "hc_mem", "core_mem";
--
2.37.2

View File

@ -0,0 +1,52 @@
From d923ec8397673773a3d22dc3ac0c5fccd22cd405 Mon Sep 17 00:00:00 2001
From: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Date: Sun, 15 May 2022 03:24:22 +0530
Subject: [PATCH 20/44] arm64: dts: qcom: Fix ordering of 'clocks' &
'clock-names' for sdhci nodes
Since the Qualcomm sdhci-msm device-tree binding has been converted
to yaml format, 'make dtbs_check' reports a number of issues with
ordering of 'clocks' & 'clock-names' for sdhci nodes:
arch/arm64/boot/dts/qcom/ipq8074-hk10-c2.dtb: sdhci@7824900:
clock-names:0: 'iface' was expected
arch/arm64/boot/dts/qcom/ipq8074-hk10-c2.dtb: sdhci@7824900:
clock-names:1: 'core' was expected
arch/arm64/boot/dts/qcom/ipq8074-hk10-c2.dtb: sdhci@7824900:
clock-names:2: 'xo' was expected
Fix the same by updating the offending 'dts' files.
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220514215424.1007718-5-bhupesh.sharma@linaro.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 3658f41393e1..cdeb6e3f9a92 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -384,10 +384,10 @@ sdhc_1: mmc@7824900 {
<GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "hc_irq", "pwr_irq";
- clocks = <&xo>,
- <&gcc GCC_SDCC1_AHB_CLK>,
- <&gcc GCC_SDCC1_APPS_CLK>;
- clock-names = "xo", "iface", "core";
+ clocks = <&gcc GCC_SDCC1_AHB_CLK>,
+ <&gcc GCC_SDCC1_APPS_CLK>,
+ <&xo>;
+ clock-names = "iface", "core", "xo";
max-frequency = <384000000>;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
--
2.37.2

View File

@ -0,0 +1,30 @@
From f56aefe67c7652d38293afa83333c9228a9fbc35 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 15 May 2022 23:00:41 +0200
Subject: [PATCH 21/44] dt-bindings: clock: qcom: ipq8074: add PPE crypto clock
Add binding for the PPE crypto clock in IPQ8074.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220515210048.483898-4-robimarko@gmail.com
---
include/dt-bindings/clock/qcom,gcc-ipq8074.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/dt-bindings/clock/qcom,gcc-ipq8074.h b/include/dt-bindings/clock/qcom,gcc-ipq8074.h
index 8e2bec1c91bf..5f0928785d7a 100644
--- a/include/dt-bindings/clock/qcom,gcc-ipq8074.h
+++ b/include/dt-bindings/clock/qcom,gcc-ipq8074.h
@@ -233,6 +233,7 @@
#define GCC_PCIE0_AXI_S_BRIDGE_CLK 224
#define GCC_PCIE0_RCHNG_CLK_SRC 225
#define GCC_PCIE0_RCHNG_CLK 226
+#define GCC_CRYPTO_PPE_CLK 227
#define GCC_BLSP1_BCR 0
#define GCC_BLSP1_QUP1_BCR 1
--
2.37.2

View File

@ -1,7 +1,7 @@
From f05295ef5e58a042f3a66490f6e75c6af83a329f Mon Sep 17 00:00:00 2001 From 3c47c458fdf4056d4682cf2474e5599d5a916b61 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Sun, 13 Mar 2022 12:46:28 +0100 Date: Sun, 15 May 2022 23:00:42 +0200
Subject: [PATCH] clk: qcom: ipq8074: add PPE crypto clock Subject: [PATCH 22/44] clk: qcom: ipq8074: add PPE crypto clock
The built-in PPE engine has a dedicated clock for the EIP-197 crypto The built-in PPE engine has a dedicated clock for the EIP-197 crypto
engine. engine.
@ -9,14 +9,17 @@ engine.
So, since the required clock currently missing add support for it. So, since the required clock currently missing add support for it.
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220515210048.483898-5-robimarko@gmail.com
--- ---
drivers/clk/qcom/gcc-ipq8074.c | 19 +++++++++++++++++++ drivers/clk/qcom/gcc-ipq8074.c | 19 +++++++++++++++++++
include/dt-bindings/clock/qcom,gcc-ipq8074.h | 1 + 1 file changed, 19 insertions(+)
2 files changed, 20 insertions(+)
diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c
index d6d5defb82c9..bbd8c8f0ed6f 100644
--- a/drivers/clk/qcom/gcc-ipq8074.c --- a/drivers/clk/qcom/gcc-ipq8074.c
+++ b/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c
@@ -3182,6 +3182,24 @@ static struct clk_branch gcc_nss_ptp_ref @@ -3183,6 +3183,24 @@ static struct clk_branch gcc_nss_ptp_ref_clk = {
}, },
}; };
@ -41,7 +44,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
static struct clk_branch gcc_nssnoc_ce_apb_clk = { static struct clk_branch gcc_nssnoc_ce_apb_clk = {
.halt_reg = 0x6830c, .halt_reg = 0x6830c,
.clkr = { .clkr = {
@@ -4644,6 +4662,7 @@ static struct clk_regmap *gcc_ipq8074_cl @@ -4655,6 +4673,7 @@ static struct clk_regmap *gcc_ipq8074_clks[] = {
[GCC_PCIE0_RCHNG_CLK_SRC] = &pcie0_rchng_clk_src.clkr, [GCC_PCIE0_RCHNG_CLK_SRC] = &pcie0_rchng_clk_src.clkr,
[GCC_PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr, [GCC_PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr,
[GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr, [GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr,
@ -49,13 +52,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
}; };
static const struct qcom_reset_map gcc_ipq8074_resets[] = { static const struct qcom_reset_map gcc_ipq8074_resets[] = {
--- a/include/dt-bindings/clock/qcom,gcc-ipq8074.h --
+++ b/include/dt-bindings/clock/qcom,gcc-ipq8074.h 2.37.2
@@ -233,6 +233,7 @@
#define GCC_PCIE0_AXI_S_BRIDGE_CLK 224
#define GCC_PCIE0_RCHNG_CLK_SRC 225
#define GCC_PCIE0_RCHNG_CLK 226
+#define GCC_CRYPTO_PPE_CLK 227
#define GCC_BLSP1_BCR 0
#define GCC_BLSP1_QUP1_BCR 1

View File

@ -0,0 +1,30 @@
From c0823201046e5a79823e3ff5fa4f0a9b5fcda14d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 15 May 2022 23:00:45 +0200
Subject: [PATCH 23/44] dt-bindings: clock: qcom: ipq8074: add USB GDSCs
Add bindings for the USB GDSCs found in IPQ8074 GCC.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220515210048.483898-8-robimarko@gmail.com
---
include/dt-bindings/clock/qcom,gcc-ipq8074.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/dt-bindings/clock/qcom,gcc-ipq8074.h b/include/dt-bindings/clock/qcom,gcc-ipq8074.h
index 5f0928785d7a..e4991d303708 100644
--- a/include/dt-bindings/clock/qcom,gcc-ipq8074.h
+++ b/include/dt-bindings/clock/qcom,gcc-ipq8074.h
@@ -368,4 +368,7 @@
#define GCC_PCIE1_AXI_MASTER_STICKY_ARES 130
#define GCC_PCIE0_AXI_SLAVE_STICKY_ARES 131
+#define USB0_GDSC 0
+#define USB1_GDSC 1
+
#endif
--
2.37.2

View File

@ -0,0 +1,86 @@
From 248fb3267c23749059baa231e21650a68771abef Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 15 May 2022 23:00:46 +0200
Subject: [PATCH 24/44] clk: qcom: ipq8074: add USB GDSCs
Add GDSC-s for each of the two USB controllers built-in the IPQ8074.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220515210048.483898-9-robimarko@gmail.com
---
drivers/clk/qcom/Kconfig | 1 +
drivers/clk/qcom/gcc-ipq8074.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
index 9ef007b3cf9b..3c84e34353a4 100644
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -166,6 +166,7 @@ config IPQ_LCC_806X
config IPQ_GCC_8074
tristate "IPQ8074 Global Clock Controller"
+ select QCOM_GDSC
help
Support for global clock controller on ipq8074 devices.
Say Y if you want to use peripheral devices such as UART, SPI,
diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c
index bbd8c8f0ed6f..42d185fe19c8 100644
--- a/drivers/clk/qcom/gcc-ipq8074.c
+++ b/drivers/clk/qcom/gcc-ipq8074.c
@@ -22,6 +22,7 @@
#include "clk-alpha-pll.h"
#include "clk-regmap-divider.h"
#include "clk-regmap-mux.h"
+#include "gdsc.h"
#include "reset.h"
enum {
@@ -4408,6 +4409,22 @@ static struct clk_branch gcc_pcie0_axi_s_bridge_clk = {
},
};
+static struct gdsc usb0_gdsc = {
+ .gdscr = 0x3e078,
+ .pd = {
+ .name = "usb0_gdsc",
+ },
+ .pwrsts = PWRSTS_OFF_ON,
+};
+
+static struct gdsc usb1_gdsc = {
+ .gdscr = 0x3f078,
+ .pd = {
+ .name = "usb1_gdsc",
+ },
+ .pwrsts = PWRSTS_OFF_ON,
+};
+
static const struct alpha_pll_config ubi32_pll_config = {
.l = 0x4e,
.config_ctl_val = 0x200d4aa8,
@@ -4811,6 +4828,11 @@ static const struct qcom_reset_map gcc_ipq8074_resets[] = {
[GCC_PCIE1_AXI_MASTER_STICKY_ARES] = { 0x76040, 6 },
};
+static struct gdsc *gcc_ipq8074_gdscs[] = {
+ [USB0_GDSC] = &usb0_gdsc,
+ [USB1_GDSC] = &usb1_gdsc,
+};
+
static const struct of_device_id gcc_ipq8074_match_table[] = {
{ .compatible = "qcom,gcc-ipq8074" },
{ }
@@ -4833,6 +4855,8 @@ static const struct qcom_cc_desc gcc_ipq8074_desc = {
.num_resets = ARRAY_SIZE(gcc_ipq8074_resets),
.clk_hws = gcc_ipq8074_hws,
.num_clk_hws = ARRAY_SIZE(gcc_ipq8074_hws),
+ .gdscs = gcc_ipq8074_gdscs,
+ .num_gdscs = ARRAY_SIZE(gcc_ipq8074_gdscs),
};
static int gcc_ipq8074_probe(struct platform_device *pdev)
--
2.37.2

View File

@ -0,0 +1,48 @@
From e8516c04110438230314ddbe94879ecb4a5db5df Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sun, 15 May 2022 23:00:48 +0200
Subject: [PATCH 25/44] arm64: dts: qcom: ipq8074: add USB power domains
Add USB power domains provided by GCC GDSCs.
Add the required #power-domain-cells to the GCC as well.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220515210048.483898-11-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index cdeb6e3f9a92..a6cb0dafcc17 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -347,6 +347,7 @@ gcc: gcc@1800000 {
compatible = "qcom,gcc-ipq8074";
reg = <0x01800000 0x80000>;
#clock-cells = <0x1>;
+ #power-domain-cells = <1>;
#reset-cells = <0x1>;
};
@@ -575,6 +576,8 @@ usb_0: usb@8af8800 {
<133330000>,
<19200000>;
+ power-domains = <&gcc USB0_GDSC>;
+
resets = <&gcc GCC_USB0_BCR>;
status = "disabled";
@@ -615,6 +618,8 @@ usb_1: usb@8cf8800 {
<133330000>,
<19200000>;
+ power-domains = <&gcc USB1_GDSC>;
+
resets = <&gcc GCC_USB1_BCR>;
status = "disabled";
--
2.37.2

View File

@ -0,0 +1,56 @@
From 510f246cf8f6af8c0d7a46d22448b812fd9a14a4 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 4 Jul 2022 13:33:18 +0200
Subject: [PATCH 26/44] arm64: dts: qcom: ipq8074: move ARMv8 timer out of SoC
node
The ARM timer is usually considered not part of SoC node, just like
other ARM designed blocks (PMU, PSCI). This fixes dtbs_check warning:
arch/arm64/boot/dts/qcom/ipq8072-ax9000.dtb: soc: timer: {'compatible': ['arm,armv8-timer'], 'interrupts': [[1, 2, 3848], [1, 3, 3848], [1, 4, 3848], [1, 1, 3848]]} should not be valid under {'type': 'object'}
From schema: dtschema/schemas/simple-bus.yaml
Signed-off-by: Robert Marko <robimarko@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
[bjorn: Moved node after "soc" for alphabetical ordering]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220704113318.623102-1-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index a6cb0dafcc17..3779563527fa 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -653,14 +653,6 @@ v2m@0 {
};
};
- timer {
- compatible = "arm,armv8-timer";
- interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
- <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
- <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
- <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
- };
-
watchdog: watchdog@b017000 {
compatible = "qcom,kpss-wdt";
reg = <0xb017000 0x1000>;
@@ -852,4 +844,12 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */
status = "disabled";
};
};
+
+ timer {
+ compatible = "arm,armv8-timer";
+ interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+ <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+ };
};
--
2.37.2

View File

@ -0,0 +1,32 @@
From 8cef5828706a1584b4dadf3f4b707a392bc8c231 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 4 Jul 2022 16:35:54 +0200
Subject: [PATCH 27/44] arm64: dts: qcom: ipq8074: add reset to SDHCI
Add reset to SDHCI controller so it can be reset to avoid timeout issues
after software reset due to bootloader set configuration.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@somainline.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220704143554.1180927-2-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 3779563527fa..c4f9bec9a39b 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -389,6 +389,7 @@ sdhc_1: mmc@7824900 {
<&gcc GCC_SDCC1_APPS_CLK>,
<&xo>;
clock-names = "iface", "core", "xo";
+ resets = <&gcc GCC_SDCC1_BCR>;
max-frequency = <384000000>;
mmc-ddr-1_8v;
mmc-hs200-1_8v;
--
2.37.2

View File

@ -0,0 +1,41 @@
From 2bf80b5de7c2598972af28adc09e8e667b528d11 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan+linaro@kernel.org>
Date: Tue, 5 Jul 2022 13:40:22 +0200
Subject: [PATCH 28/44] arm64: dts: qcom: ipq8074: drop USB PHY clock index
The QMP USB PHY provides a single clock so drop the redundant clock
index.
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220705114032.22787-5-johan+linaro@kernel.org
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index c4f9bec9a39b..edcb6a500175 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -130,7 +130,7 @@ usb1_ssphy: phy@58200 {
<0x00058800 0x1f8>, /* PCS */
<0x00058600 0x044>; /* PCS misc*/
#phy-cells = <0>;
- #clock-cells = <1>;
+ #clock-cells = <0>;
clocks = <&gcc GCC_USB1_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb1_pipe_clk_src";
@@ -173,7 +173,7 @@ usb0_ssphy: phy@78200 {
<0x00078800 0x1f8>, /* PCS */
<0x00078600 0x044>; /* PCS misc*/
#phy-cells = <0>;
- #clock-cells = <1>;
+ #clock-cells = <0>;
clocks = <&gcc GCC_USB0_PIPE_CLK>;
clock-names = "pipe0";
clock-output-names = "gcc_usb0_pipe_clk_src";
--
2.37.2

View File

@ -0,0 +1,42 @@
From 73ea147a5caa82c94486076186af2c7dc1894a97 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 7 Jul 2022 19:37:33 +0200
Subject: [PATCH 29/44] arm64: dts: qcom: ipq8074: add APCS node
APCS now has support for providing the APSS clocks as the child device
for IPQ8074.
So, add the required DT node for it as it will later be used as the CPU
clocksource.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
[bjorn: Sorted node based on address]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220707173733.404947-4-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index edcb6a500175..14487a39fb6c 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -662,6 +662,14 @@ watchdog: watchdog@b017000 {
timeout-sec = <30>;
};
+ apcs_glb: mailbox@b111000 {
+ compatible = "qcom,ipq8074-apcs-apps-global";
+ reg = <0x0b111000 0x6000>;
+
+ #clock-cells = <1>;
+ #mbox-cells = <1>;
+ };
+
timer@b120000 {
#address-cells = <1>;
#size-cells = <1>;
--
2.37.2

View File

@ -0,0 +1,64 @@
From 254bf23fe2e0c73d75a0bf4f37579e15433b75e0 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 8 Jul 2022 15:38:45 +0200
Subject: [PATCH 30/44] arm64: dts: qcom: ipq8074: add #size/address-cells to
DTSI
Add #size-cells and #address-cells to the SoC DTSI to avoid duplicating
the same properties in board DTS files.
Remove the mentioned properties from current board DTS files.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220708133846.599735-1-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074-hk01.dts | 2 --
arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi | 3 ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 3 +++
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
index cc08dc4eb56a..3308e37f6abb 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
+++ b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
@@ -5,8 +5,6 @@
#include "ipq8074.dtsi"
/ {
- #address-cells = <0x2>;
- #size-cells = <0x2>;
model = "Qualcomm Technologies, Inc. IPQ8074-HK01";
compatible = "qcom,ipq8074-hk01", "qcom,ipq8074";
interrupt-parent = <&intc>;
diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi b/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
index 07e670829676..0043cc23cf7d 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
@@ -7,9 +7,6 @@
#include "ipq8074.dtsi"
/ {
- #address-cells = <0x2>;
- #size-cells = <0x2>;
-
interrupt-parent = <&intc>;
aliases {
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 14487a39fb6c..e516d13b8f98 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -7,6 +7,9 @@
#include <dt-bindings/clock/qcom,gcc-ipq8074.h>
/ {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
model = "Qualcomm Technologies, Inc. IPQ8074";
compatible = "qcom,ipq8074";
--
2.37.2

View File

@ -0,0 +1,59 @@
From 520877b4d26ba4e6d08b5e9579f166ca2a934e81 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 8 Jul 2022 15:38:46 +0200
Subject: [PATCH 31/44] arm64: dts: qcom: ipq8074: add interrupt-parent to DTSI
Add interrupt-parent to the SoC DTSI to avoid duplicating it in each board
DTS file.
Remove interrupt-parent from existing board DTS files.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220708133846.599735-2-robimarko@gmail.com
---
arch/arm64/boot/dts/qcom/ipq8074-hk01.dts | 1 -
arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi | 2 --
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 1 +
3 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
index 3308e37f6abb..ef30053136e3 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
+++ b/arch/arm64/boot/dts/qcom/ipq8074-hk01.dts
@@ -7,7 +7,6 @@
/ {
model = "Qualcomm Technologies, Inc. IPQ8074-HK01";
compatible = "qcom,ipq8074-hk01", "qcom,ipq8074";
- interrupt-parent = <&intc>;
aliases {
serial0 = &blsp1_uart5;
diff --git a/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi b/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
index 0043cc23cf7d..c479a3fd0f40 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074-hk10.dtsi
@@ -7,8 +7,6 @@
#include "ipq8074.dtsi"
/ {
- interrupt-parent = <&intc>;
-
aliases {
serial0 = &blsp1_uart5;
};
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index e516d13b8f98..d53675fc1595 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -12,6 +12,7 @@ / {
model = "Qualcomm Technologies, Inc. IPQ8074";
compatible = "qcom,ipq8074";
+ interrupt-parent = <&intc>;
clocks {
sleep_clk: sleep_clk {
--
2.37.2

View File

@ -0,0 +1,63 @@
From 8928dcb644461e72608dbea26af4d072868ae41b Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 4 Jul 2022 23:23:54 +0200
Subject: [PATCH 32/44] regulator: qcom_spmi: add support for HT_P150
HT_P150 is a LDO PMOS regulator based on LV P150 using HFS430 layout
found in PMP8074 and PMS405 PMIC-s.
Both PMP8074 and PMS405 define the programmable range as 1.616V to 3.304V
but the actual MAX output voltage depends on the exact LDO in each of
the PMIC-s.
It has a max current of 150mA, voltage step of 8mV.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220704212402.1715182-4-robimarko@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/qcom_spmi-regulator.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 41424a3366d0..49e5fe168391 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -164,6 +164,7 @@ enum spmi_regulator_subtype {
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL3 = 0x0f,
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10,
SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a,
+ SPMI_REGULATOR_SUBTYPE_HT_P150 = 0x35,
};
enum spmi_common_regulator_registers {
@@ -544,6 +545,10 @@ static struct spmi_voltage_range hfs430_ranges[] = {
SPMI_VOLTAGE_RANGE(0, 320000, 320000, 2040000, 2040000, 8000),
};
+static struct spmi_voltage_range ht_p150_ranges[] = {
+ SPMI_VOLTAGE_RANGE(0, 1616000, 1616000, 3304000, 3304000, 8000),
+};
+
static DEFINE_SPMI_SET_POINTS(pldo);
static DEFINE_SPMI_SET_POINTS(nldo1);
static DEFINE_SPMI_SET_POINTS(nldo2);
@@ -564,6 +569,7 @@ static DEFINE_SPMI_SET_POINTS(nldo660);
static DEFINE_SPMI_SET_POINTS(ht_lvpldo);
static DEFINE_SPMI_SET_POINTS(ht_nldo);
static DEFINE_SPMI_SET_POINTS(hfs430);
+static DEFINE_SPMI_SET_POINTS(ht_p150);
static inline int spmi_vreg_read(struct spmi_regulator *vreg, u16 addr, u8 *buf,
int len)
@@ -1458,6 +1464,7 @@ static const struct regulator_ops spmi_hfs430_ops = {
static const struct spmi_regulator_mapping supported_regulators[] = {
/* type subtype dig_min dig_max ltype ops setpoints hpm_min */
+ SPMI_VREG(LDO, HT_P150, 0, INF, HFS430, hfs430, ht_p150, 10000),
SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000),
SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000),
SPMI_VREG(LDO, N300, 0, INF, LDO, ldo, nldo1, 10000),
--
2.37.2

View File

@ -0,0 +1,64 @@
From 2ba036ce8e99673073adc5ac62e7768a47725567 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 4 Jul 2022 23:23:55 +0200
Subject: [PATCH 33/44] regulator: qcom_spmi: add support for HT_P600
HT_P600 is a LDO PMOS regulator based on LV P600 using HFS430 layout
found in PMP8074 and PMS405 PMIC-s.
Both PMP8074 and PMS405 define the programmable range as 1.704 to 1.896V
but the actual MAX output voltage depends on the exact LDO in each of
the PMIC-s.
Their usual voltage that they are used is 1.8V.
It has a max current of 600mA, voltage step of 8mV.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220704212402.1715182-5-robimarko@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/qcom_spmi-regulator.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 49e5fe168391..828e97b873df 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -165,6 +165,7 @@ enum spmi_regulator_subtype {
SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10,
SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a,
SPMI_REGULATOR_SUBTYPE_HT_P150 = 0x35,
+ SPMI_REGULATOR_SUBTYPE_HT_P600 = 0x3d,
};
enum spmi_common_regulator_registers {
@@ -549,6 +550,10 @@ static struct spmi_voltage_range ht_p150_ranges[] = {
SPMI_VOLTAGE_RANGE(0, 1616000, 1616000, 3304000, 3304000, 8000),
};
+static struct spmi_voltage_range ht_p600_ranges[] = {
+ SPMI_VOLTAGE_RANGE(0, 1704000, 1704000, 1896000, 1896000, 8000),
+};
+
static DEFINE_SPMI_SET_POINTS(pldo);
static DEFINE_SPMI_SET_POINTS(nldo1);
static DEFINE_SPMI_SET_POINTS(nldo2);
@@ -570,6 +575,7 @@ static DEFINE_SPMI_SET_POINTS(ht_lvpldo);
static DEFINE_SPMI_SET_POINTS(ht_nldo);
static DEFINE_SPMI_SET_POINTS(hfs430);
static DEFINE_SPMI_SET_POINTS(ht_p150);
+static DEFINE_SPMI_SET_POINTS(ht_p600);
static inline int spmi_vreg_read(struct spmi_regulator *vreg, u16 addr, u8 *buf,
int len)
@@ -1464,6 +1470,7 @@ static const struct regulator_ops spmi_hfs430_ops = {
static const struct spmi_regulator_mapping supported_regulators[] = {
/* type subtype dig_min dig_max ltype ops setpoints hpm_min */
+ SPMI_VREG(LDO, HT_P600, 0, INF, HFS430, hfs430, ht_p600, 10000),
SPMI_VREG(LDO, HT_P150, 0, INF, HFS430, hfs430, ht_p150, 10000),
SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000),
SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000),
--
2.37.2

View File

@ -0,0 +1,74 @@
From 933b687758646242fc7410edb06da70fe7540cdc Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 4 Jul 2022 23:23:57 +0200
Subject: [PATCH 34/44] regulator: qcom_spmi: add support for PMP8074
regulators
PMP8074 is a companion PMIC for the Qualcomm IPQ8074 WiSoC-s.
It features 5 HF-SMPS and 13 LDO regulators.
HF-SMPS regulators are Buck HFS430 regulators.
L1, L2 and L3 are HT_N1200_ST subtype LDO regulators.
L4 is HT_N300_ST subtype LDO regulator.
L5 and L6 are HT_P600 subtype LDO regulators.
L7, L11, L12 and L13 are HT_P150 subtype LDO regulators.
L10 is HT_P50 subtype LDO regulator.
This commit adds support for all of the buck regulators and LDO-s except
for L10 as I dont have documentation on its output voltage range.
S3 is the CPU cluster voltage supply, S4 supplies the UBI32 NPU cores
and L11 is the SDIO/eMMC I/O voltage regulator required for high speeds.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220704212402.1715182-7-robimarko@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
drivers/regulator/qcom_spmi-regulator.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 828e97b873df..13521d47d589 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -2101,6 +2101,28 @@ static const struct spmi_regulator_data pm8005_regulators[] = {
{ }
};
+static const struct spmi_regulator_data pmp8074_regulators[] = {
+ { "s1", 0x1400, "vdd_s1"},
+ { "s2", 0x1700, "vdd_s2"},
+ { "s3", 0x1a00, "vdd_s3"},
+ { "s4", 0x1d00, "vdd_s4"},
+ { "s5", 0x2000, "vdd_s5"},
+ { "l1", 0x4000, "vdd_l1_l2"},
+ { "l2", 0x4100, "vdd_l1_l2"},
+ { "l3", 0x4200, "vdd_l3_l8"},
+ { "l4", 0x4300, "vdd_l4"},
+ { "l5", 0x4400, "vdd_l5_l6_l15"},
+ { "l6", 0x4500, "vdd_l5_l6_l15"},
+ { "l7", 0x4600, "vdd_l7"},
+ { "l8", 0x4700, "vdd_l3_l8"},
+ { "l9", 0x4800, "vdd_l9"},
+ /* l10 is currently unsupported HT_P50 */
+ { "l11", 0x4a00, "vdd_l10_l11_l12_l13"},
+ { "l12", 0x4b00, "vdd_l10_l11_l12_l13"},
+ { "l13", 0x4c00, "vdd_l10_l11_l12_l13"},
+ { }
+};
+
static const struct spmi_regulator_data pms405_regulators[] = {
{ "s3", 0x1a00, "vdd_s3"},
{ }
@@ -2117,6 +2139,7 @@ static const struct of_device_id qcom_spmi_regulator_match[] = {
{ .compatible = "qcom,pmi8994-regulators", .data = &pmi8994_regulators },
{ .compatible = "qcom,pm660-regulators", .data = &pm660_regulators },
{ .compatible = "qcom,pm660l-regulators", .data = &pm660l_regulators },
+ { .compatible = "qcom,pmp8074-regulators", .data = &pmp8074_regulators },
{ .compatible = "qcom,pms405-regulators", .data = &pms405_regulators },
{ }
};
--
2.37.2

View File

@ -0,0 +1,30 @@
From 55545dc54f015387dccfb3c8fe20115c5f21b8a7 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 11 Jul 2022 22:34:05 +0200
Subject: [PATCH 35/44] pinctrl: qcom-pmic-gpio: add support for PMP8074
PMP8074 has 12 GPIO-s with holes on GPIO1 and GPIO12.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220711203408.2949888-4-robimarko@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index b2562e893139..fe1d3b260e27 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -1167,6 +1167,8 @@ static const struct of_device_id pmic_gpio_of_match[] = {
{ .compatible = "qcom,pmi8998-gpio", .data = (void *) 14 },
{ .compatible = "qcom,pmk8350-gpio", .data = (void *) 4 },
{ .compatible = "qcom,pmm8155au-gpio", .data = (void *) 10 },
+ /* pmp8074 has 12 GPIOs with holes on 1 and 12 */
+ { .compatible = "qcom,pmp8074-gpio", .data = (void *) 12 },
{ .compatible = "qcom,pmr735a-gpio", .data = (void *) 4 },
{ .compatible = "qcom,pmr735b-gpio", .data = (void *) 4 },
/* pms405 has 12 GPIOs with holes on 1, 9, and 10 */
--
2.37.2

View File

@ -0,0 +1,65 @@
From f76d65737cff6f41f0fab7a46a742d89c08fd652 Mon Sep 17 00:00:00 2001
From: Bjorn Andersson <bjorn.andersson@linaro.org>
Date: Sun, 17 Oct 2021 09:12:16 -0700
Subject: [PATCH 36/44] mfd: qcom-spmi-pmic: Sort compatibles in the driver
Sort the compatibles in the driver, to make it easier to validate that
the DT binding and driver are in sync.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211017161218.2378176-2-bjorn.andersson@linaro.org
---
drivers/mfd/qcom-spmi-pmic.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index a35d5cf16faa..8be07102a468 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -40,27 +40,27 @@
#define PM660_SUBTYPE 0x1B
static const struct of_device_id pmic_spmi_id_table[] = {
- { .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
- { .compatible = "qcom,pm8941", .data = (void *)PM8941_SUBTYPE },
- { .compatible = "qcom,pm8841", .data = (void *)PM8841_SUBTYPE },
+ { .compatible = "qcom,pm660", .data = (void *)PM660_SUBTYPE },
+ { .compatible = "qcom,pm660l", .data = (void *)PM660L_SUBTYPE },
+ { .compatible = "qcom,pm8004", .data = (void *)PM8004_SUBTYPE },
+ { .compatible = "qcom,pm8005", .data = (void *)PM8005_SUBTYPE },
{ .compatible = "qcom,pm8019", .data = (void *)PM8019_SUBTYPE },
- { .compatible = "qcom,pm8226", .data = (void *)PM8226_SUBTYPE },
{ .compatible = "qcom,pm8110", .data = (void *)PM8110_SUBTYPE },
- { .compatible = "qcom,pma8084", .data = (void *)PMA8084_SUBTYPE },
- { .compatible = "qcom,pmi8962", .data = (void *)PMI8962_SUBTYPE },
- { .compatible = "qcom,pmd9635", .data = (void *)PMD9635_SUBTYPE },
- { .compatible = "qcom,pm8994", .data = (void *)PM8994_SUBTYPE },
- { .compatible = "qcom,pmi8994", .data = (void *)PMI8994_SUBTYPE },
- { .compatible = "qcom,pm8916", .data = (void *)PM8916_SUBTYPE },
- { .compatible = "qcom,pm8004", .data = (void *)PM8004_SUBTYPE },
+ { .compatible = "qcom,pm8226", .data = (void *)PM8226_SUBTYPE },
+ { .compatible = "qcom,pm8841", .data = (void *)PM8841_SUBTYPE },
{ .compatible = "qcom,pm8909", .data = (void *)PM8909_SUBTYPE },
+ { .compatible = "qcom,pm8916", .data = (void *)PM8916_SUBTYPE },
+ { .compatible = "qcom,pm8941", .data = (void *)PM8941_SUBTYPE },
{ .compatible = "qcom,pm8950", .data = (void *)PM8950_SUBTYPE },
- { .compatible = "qcom,pmi8950", .data = (void *)PMI8950_SUBTYPE },
+ { .compatible = "qcom,pm8994", .data = (void *)PM8994_SUBTYPE },
{ .compatible = "qcom,pm8998", .data = (void *)PM8998_SUBTYPE },
+ { .compatible = "qcom,pma8084", .data = (void *)PMA8084_SUBTYPE },
+ { .compatible = "qcom,pmd9635", .data = (void *)PMD9635_SUBTYPE },
+ { .compatible = "qcom,pmi8950", .data = (void *)PMI8950_SUBTYPE },
+ { .compatible = "qcom,pmi8962", .data = (void *)PMI8962_SUBTYPE },
+ { .compatible = "qcom,pmi8994", .data = (void *)PMI8994_SUBTYPE },
{ .compatible = "qcom,pmi8998", .data = (void *)PMI8998_SUBTYPE },
- { .compatible = "qcom,pm8005", .data = (void *)PM8005_SUBTYPE },
- { .compatible = "qcom,pm660l", .data = (void *)PM660L_SUBTYPE },
- { .compatible = "qcom,pm660", .data = (void *)PM660_SUBTYPE },
+ { .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
{ }
};
--
2.37.2

View File

@ -0,0 +1,71 @@
From b4f85660d09360b2ef9f04e51890fbf9935bf759 Mon Sep 17 00:00:00 2001
From: Bjorn Andersson <bjorn.andersson@linaro.org>
Date: Sun, 17 Oct 2021 09:12:18 -0700
Subject: [PATCH 37/44] mfd: qcom-spmi-pmic: Add missing PMICs supported by
socinfo
The Qualcomm socinfo driver has eight more PMICs described, add these to
the SPMI PMIC driver as well.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211017161218.2378176-4-bjorn.andersson@linaro.org
---
drivers/mfd/qcom-spmi-pmic.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index 8be07102a468..1cacc00aa6c9 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -31,6 +31,8 @@
#define PM8916_SUBTYPE 0x0b
#define PM8004_SUBTYPE 0x0c
#define PM8909_SUBTYPE 0x0d
+#define PM8028_SUBTYPE 0x0e
+#define PM8901_SUBTYPE 0x0f
#define PM8950_SUBTYPE 0x10
#define PMI8950_SUBTYPE 0x11
#define PM8998_SUBTYPE 0x14
@@ -38,6 +40,13 @@
#define PM8005_SUBTYPE 0x18
#define PM660L_SUBTYPE 0x1A
#define PM660_SUBTYPE 0x1B
+#define PM8150_SUBTYPE 0x1E
+#define PM8150L_SUBTYPE 0x1f
+#define PM8150B_SUBTYPE 0x20
+#define PMK8002_SUBTYPE 0x21
+#define PM8009_SUBTYPE 0x24
+#define PM8150C_SUBTYPE 0x26
+#define SMB2351_SUBTYPE 0x29
static const struct of_device_id pmic_spmi_id_table[] = {
{ .compatible = "qcom,pm660", .data = (void *)PM660_SUBTYPE },
@@ -45,9 +54,15 @@ static const struct of_device_id pmic_spmi_id_table[] = {
{ .compatible = "qcom,pm8004", .data = (void *)PM8004_SUBTYPE },
{ .compatible = "qcom,pm8005", .data = (void *)PM8005_SUBTYPE },
{ .compatible = "qcom,pm8019", .data = (void *)PM8019_SUBTYPE },
+ { .compatible = "qcom,pm8028", .data = (void *)PM8028_SUBTYPE },
{ .compatible = "qcom,pm8110", .data = (void *)PM8110_SUBTYPE },
+ { .compatible = "qcom,pm8150", .data = (void *)PM8150_SUBTYPE },
+ { .compatible = "qcom,pm8150b", .data = (void *)PM8150B_SUBTYPE },
+ { .compatible = "qcom,pm8150c", .data = (void *)PM8150C_SUBTYPE },
+ { .compatible = "qcom,pm8150l", .data = (void *)PM8150L_SUBTYPE },
{ .compatible = "qcom,pm8226", .data = (void *)PM8226_SUBTYPE },
{ .compatible = "qcom,pm8841", .data = (void *)PM8841_SUBTYPE },
+ { .compatible = "qcom,pm8901", .data = (void *)PM8901_SUBTYPE },
{ .compatible = "qcom,pm8909", .data = (void *)PM8909_SUBTYPE },
{ .compatible = "qcom,pm8916", .data = (void *)PM8916_SUBTYPE },
{ .compatible = "qcom,pm8941", .data = (void *)PM8941_SUBTYPE },
@@ -60,6 +75,8 @@ static const struct of_device_id pmic_spmi_id_table[] = {
{ .compatible = "qcom,pmi8962", .data = (void *)PMI8962_SUBTYPE },
{ .compatible = "qcom,pmi8994", .data = (void *)PMI8994_SUBTYPE },
{ .compatible = "qcom,pmi8998", .data = (void *)PMI8998_SUBTYPE },
+ { .compatible = "qcom,pmk8002", .data = (void *)PMK8002_SUBTYPE },
+ { .compatible = "qcom,smb2351", .data = (void *)SMB2351_SUBTYPE },
{ .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
{ }
};
--
2.37.2

View File

@ -0,0 +1,32 @@
From 1aa9a70ca9a1d3bb5139030fd9fc340d8525a7d7 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 19 Aug 2022 00:18:13 +0200
Subject: [PATCH 38/44] iio: adc: qcom-spmi-adc5: add ADC5_VREF_VADC to rev2
ADC5
Add support for ADC5_VREF_VADC channel to rev2 ADC5 channel list.
This channel measures the VADC reference LDO output.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Link: https://lore.kernel.org/r/20220818221815.346233-3-robimarko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
drivers/iio/adc/qcom-spmi-adc5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
index 87438d1e5c0b..7bd3745884f0 100644
--- a/drivers/iio/adc/qcom-spmi-adc5.c
+++ b/drivers/iio/adc/qcom-spmi-adc5.c
@@ -589,6 +589,8 @@ static const struct adc5_channels adc5_chans_rev2[ADC5_MAX_CHANNEL] = {
SCALE_HW_CALIB_DEFAULT)
[ADC5_1P25VREF] = ADC5_CHAN_VOLT("vref_1p25", 0,
SCALE_HW_CALIB_DEFAULT)
+ [ADC5_VREF_VADC] = ADC5_CHAN_VOLT("vref_vadc", 0,
+ SCALE_HW_CALIB_DEFAULT)
[ADC5_VPH_PWR] = ADC5_CHAN_VOLT("vph_pwr", 1,
SCALE_HW_CALIB_DEFAULT)
[ADC5_VBAT_SNS] = ADC5_CHAN_VOLT("vbat_sns", 1,
--
2.37.2

View File

@ -0,0 +1,52 @@
From 8454872e52992108308e44aa974b441558fa1fc9 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Tue, 23 Aug 2022 22:43:51 +0200
Subject: [PATCH 39/44] phy: qcom-qmp-pcie: make pipe clock rate configurable
IPQ8074 Gen3 PCIe PHY uses 250MHz as the pipe clock rate instead of 125MHz
like every other PCIe QMP PHY does, so make it configurable as part of the
qmp_phy_cfg.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220621195512.1760362-1-robimarko@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
drivers/phy/qualcomm/phy-qcom-qmp.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
index ed69d455ac0e..4a0e8dd9c97d 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -2842,6 +2842,9 @@ struct qmp_phy_cfg {
/* true, if PHY has secondary tx/rx lanes to be configured */
bool is_dual_lane_phy;
+ /* QMP PHY pipe clock interface rate */
+ unsigned long pipe_clock_rate;
+
/* true, if PCS block has no separate SW_RESET register */
bool no_pcs_sw_reset;
};
@@ -5138,8 +5141,15 @@ static int phy_pipe_clk_register(struct qcom_qmp *qmp, struct device_node *np)
init.ops = &clk_fixed_rate_ops;
- /* controllers using QMP phys use 125MHz pipe clock interface */
- fixed->fixed_rate = 125000000;
+ /*
+ * Controllers using QMP PHY-s use 125MHz pipe clock interface
+ * unless other frequency is specified in the PHY config.
+ */
+ if (qmp->phys[0]->cfg->pipe_clock_rate)
+ fixed->fixed_rate = qmp->phys[0]->cfg->pipe_clock_rate;
+ else
+ fixed->fixed_rate = 125000000;
+
fixed->hw.init = &init;
ret = devm_clk_hw_register(qmp->dev, &fixed->hw);
--
2.37.2

View File

@ -1,175 +1,26 @@
From 6fe752e3927ee9d9cad6ad197d5fe58c23a61935 Mon Sep 17 00:00:00 2001 From 6702bed8d48e29bd51c4b702b0baf18c5b1814c1 Mon Sep 17 00:00:00 2001
From: Sivaprakash Murugesan <sivaprak@codeaurora.org> From: Robert Marko <robimarko@gmail.com>
Date: Wed, 29 Jul 2020 21:00:04 +0530 Date: Tue, 23 Aug 2022 22:47:40 +0200
Subject: [PATCH] phy: qcom-qmp: Add IPQ8074 PCIe Gen3 QMP PHY support Subject: [PATCH 40/44] phy: qcom-qmp-pcie: add IPQ8074 PCIe Gen3 QMP PHY
support
IPQ8074 has two PCIe ports, One Gen2 and one Gen3 port. IPQ8074 has 2 different single lane PCIe PHY-s, one Gen2 and one Gen3.
Since support for Gen2 PHY is already available, add support for Gen2 one is already supported, so add the support for the Gen3 one.
PCIe Gen3 PHY. It uses the same register layout as IPQ6018.
Co-developed-by: Selvam Sathappan Periakaruppan <speriaka@codeaurora.org>
Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@codeaurora.org>
Signed-off-by: Sivaprakash Murugesan <sivaprak@codeaurora.org>
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220621195512.1760362-3-robimarko@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
--- ---
drivers/phy/qualcomm/phy-qcom-pcie3-qmp.h | 139 ++++++++++++++++++ drivers/phy/qualcomm/phy-qcom-qmp.c | 160 ++++++++++++++++++++++++++++
drivers/phy/qualcomm/phy-qcom-qmp.c | 171 +++++++++++++++++++++- 1 file changed, 160 insertions(+)
2 files changed, 308 insertions(+), 2 deletions(-)
create mode 100644 drivers/phy/qualcomm/phy-qcom-pcie3-qmp.h
--- /dev/null diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-pcie3-qmp.h index 4a0e8dd9c97d..0219a34f1047 100644
@@ -0,0 +1,139 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef PHY_QCOM_PCIE_H
+#define PHY_QCOM_PCIE_H
+
+/* QMP V2 PCIE PHY - Found in IPQ8074 gen3 port - QSERDES PLL registers */
+#define QSERDES_PLL_BG_TIMER 0x00c
+#define QSERDES_PLL_SSC_PER1 0x01c
+#define QSERDES_PLL_SSC_PER2 0x020
+#define QSERDES_PLL_SSC_STEP_SIZE1_MODE0 0x024
+#define QSERDES_PLL_SSC_STEP_SIZE2_MODE0 0x028
+#define QSERDES_PLL_SSC_STEP_SIZE1_MODE1 0x02c
+#define QSERDES_PLL_SSC_STEP_SIZE2_MODE1 0x030
+#define QSERDES_PLL_BIAS_EN_CLKBUFLR_EN 0x03c
+#define QSERDES_PLL_CLK_ENABLE1 0x040
+#define QSERDES_PLL_SYS_CLK_CTRL 0x044
+#define QSERDES_PLL_SYSCLK_BUF_ENABLE 0x048
+#define QSERDES_PLL_PLL_IVCO 0x050
+#define QSERDES_PLL_LOCK_CMP1_MODE0 0x054
+#define QSERDES_PLL_LOCK_CMP2_MODE0 0x058
+#define QSERDES_PLL_LOCK_CMP1_MODE1 0x060
+#define QSERDES_PLL_LOCK_CMP2_MODE1 0x064
+#define QSERDES_PLL_BG_TRIM 0x074
+#define QSERDES_PLL_CLK_EP_DIV_MODE0 0x078
+#define QSERDES_PLL_CLK_EP_DIV_MODE1 0x07c
+#define QSERDES_PLL_CP_CTRL_MODE0 0x080
+#define QSERDES_PLL_CP_CTRL_MODE1 0x084
+#define QSERDES_PLL_PLL_RCTRL_MODE0 0x088
+#define QSERDES_PLL_PLL_RCTRL_MODE1 0x08C
+#define QSERDES_PLL_PLL_CCTRL_MODE0 0x090
+#define QSERDES_PLL_PLL_CCTRL_MODE1 0x094
+#define QSERDES_PLL_BIAS_EN_CTRL_BY_PSM 0x0a4
+#define QSERDES_PLL_SYSCLK_EN_SEL 0x0a8
+#define QSERDES_PLL_RESETSM_CNTRL 0x0b0
+#define QSERDES_PLL_LOCK_CMP_EN 0x0c4
+#define QSERDES_PLL_DEC_START_MODE0 0x0cc
+#define QSERDES_PLL_DEC_START_MODE1 0x0d0
+#define QSERDES_PLL_DIV_FRAC_START1_MODE0 0x0d8
+#define QSERDES_PLL_DIV_FRAC_START2_MODE0 0x0dc
+#define QSERDES_PLL_DIV_FRAC_START3_MODE0 0x0e0
+#define QSERDES_PLL_DIV_FRAC_START1_MODE1 0x0e4
+#define QSERDES_PLL_DIV_FRAC_START2_MODE1 0x0e8
+#define QSERDES_PLL_DIV_FRAC_START3_MODE1 0x0eC
+#define QSERDES_PLL_INTEGLOOP_GAIN0_MODE0 0x100
+#define QSERDES_PLL_INTEGLOOP_GAIN1_MODE0 0x104
+#define QSERDES_PLL_INTEGLOOP_GAIN0_MODE1 0x108
+#define QSERDES_PLL_INTEGLOOP_GAIN1_MODE1 0x10c
+#define QSERDES_PLL_VCO_TUNE_MAP 0x120
+#define QSERDES_PLL_VCO_TUNE1_MODE0 0x124
+#define QSERDES_PLL_VCO_TUNE2_MODE0 0x128
+#define QSERDES_PLL_VCO_TUNE1_MODE1 0x12c
+#define QSERDES_PLL_VCO_TUNE2_MODE1 0x130
+#define QSERDES_PLL_VCO_TUNE_TIMER1 0x13c
+#define QSERDES_PLL_VCO_TUNE_TIMER2 0x140
+#define QSERDES_PLL_CLK_SELECT 0x16c
+#define QSERDES_PLL_HSCLK_SEL 0x170
+#define QSERDES_PLL_CORECLK_DIV 0x17c
+#define QSERDES_PLL_CORE_CLK_EN 0x184
+#define QSERDES_PLL_CMN_CONFIG 0x18c
+#define QSERDES_PLL_SVS_MODE_CLK_SEL 0x194
+#define QSERDES_PLL_CORECLK_DIV_MODE1 0x1b4
+
+/* QMP V2 PCIE PHY - Found in IPQ8074 gen3 port - - QSERDES TX registers */
+#define QSERDES_TX0_RES_CODE_LANE_OFFSET_TX 0x03c
+#define QSERDES_TX0_HIGHZ_DRVR_EN 0x058
+#define QSERDES_TX0_LANE_MODE_1 0x084
+#define QSERDES_TX0_RCV_DETECT_LVL_2 0x09c
+
+/* QMP V2 PCIE PHY - Found in IPQ8074 gen3 port - QSERDES RX registers */
+#define QSERDES_RX0_UCDR_FO_GAIN 0x008
+#define QSERDES_RX0_UCDR_SO_GAIN 0x014
+#define QSERDES_RX0_UCDR_SO_SATURATION_AND_ENABLE 0x034
+#define QSERDES_RX0_UCDR_PI_CONTROLS 0x044
+#define QSERDES_RX0_RX_EQU_ADAPTOR_CNTRL2 0x0ec
+#define QSERDES_RX0_RX_EQU_ADAPTOR_CNTRL3 0x0f0
+#define QSERDES_RX0_RX_EQU_ADAPTOR_CNTRL4 0x0f4
+#define QSERDES_RX0_RX_IDAC_TSETTLE_LOW 0x0f8
+#define QSERDES_RX0_RX_IDAC_TSETTLE_HIGH 0x0fc
+#define QSERDES_RX0_RX_EQ_OFFSET_ADAPTOR_CNTRL1 0x110
+#define QSERDES_RX0_RX_OFFSET_ADAPTOR_CNTRL2 0x114
+#define QSERDES_RX0_SIGDET_ENABLES 0x118
+#define QSERDES_RX0_SIGDET_CNTRL 0x11c
+#define QSERDES_RX0_SIGDET_DEGLITCH_CNTRL 0x124
+#define QSERDES_RX0_RX_MODE_00_LOW 0x170
+#define QSERDES_RX0_RX_MODE_00_HIGH 0x174
+#define QSERDES_RX0_RX_MODE_00_HIGH2 0x178
+#define QSERDES_RX0_RX_MODE_00_HIGH3 0x17c
+#define QSERDES_RX0_RX_MODE_00_HIGH4 0x180
+#define QSERDES_RX0_RX_MODE_01_LOW 0x184
+#define QSERDES_RX0_RX_MODE_01_HIGH 0x188
+#define QSERDES_RX0_RX_MODE_01_HIGH2 0x18c
+#define QSERDES_RX0_RX_MODE_01_HIGH3 0x190
+#define QSERDES_RX0_RX_MODE_01_HIGH4 0x194
+#define QSERDES_RX0_RX_MODE_10_LOW 0x198
+#define QSERDES_RX0_RX_MODE_10_HIGH 0x19c
+#define QSERDES_RX0_RX_MODE_10_HIGH2 0x1a0
+#define QSERDES_RX0_RX_MODE_10_HIGH3 0x1a4
+#define QSERDES_RX0_RX_MODE_10_HIGH4 0x1a8
+#define QSERDES_RX0_DFE_EN_TIMER 0x1b4
+
+/* QMP V2 PCIE PHY - Found in IPQ8074 gen3 port - PCS registers */
+
+#define PCS_COM_FLL_CNTRL1 0x098
+#define PCS_COM_FLL_CNTRL2 0x09c
+#define PCS_COM_FLL_CNT_VAL_L 0x0a0
+#define PCS_COM_FLL_CNT_VAL_H_TOL 0x0a4
+#define PCS_COM_FLL_MAN_CODE 0x0a8
+#define PCS_COM_REFGEN_REQ_CONFIG1 0x0dc
+#define PCS_COM_G12S1_TXDEEMPH_M3P5DB 0x16c
+#define PCS_COM_RX_SIGDET_LVL 0x188
+#define PCS_COM_P2U3_WAKEUP_DLY_TIME_AUXCLK_L 0x1a4
+#define PCS_COM_P2U3_WAKEUP_DLY_TIME_AUXCLK_H 0x1a8
+#define PCS_COM_RX_DCC_CAL_CONFIG 0x1d8
+#define PCS_COM_EQ_CONFIG5 0x1ec
+
+/* QMP V2 PCIE PHY - Found in IPQ8074 gen3 port - PCS Misc registers */
+
+#define PCS_PCIE_POWER_STATE_CONFIG2 0x40c
+#define PCS_PCIE_POWER_STATE_CONFIG4 0x414
+#define PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x41c
+#define PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L 0x440
+#define PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_H 0x444
+#define PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L 0x448
+#define PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_H 0x44c
+#define PCS_PCIE_OSC_DTCT_CONFIG2 0x45c
+#define PCS_PCIE_OSC_DTCT_MODE2_CONFIG2 0x478
+#define PCS_PCIE_OSC_DTCT_MODE2_CONFIG4 0x480
+#define PCS_PCIE_OSC_DTCT_MODE2_CONFIG5 0x484
+#define PCS_PCIE_OSC_DTCT_ACTIONS 0x490
+#define PCS_PCIE_EQ_CONFIG1 0x4a0
+#define PCS_PCIE_EQ_CONFIG2 0x4a4
+#define PCS_PCIE_PRESET_P10_PRE 0x4bc
+#define PCS_PCIE_PRESET_P10_POST 0x4e0
+
+#endif
--- a/drivers/phy/qualcomm/phy-qcom-qmp.c --- a/drivers/phy/qualcomm/phy-qcom-qmp.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
@@ -23,6 +23,7 @@ @@ -812,6 +812,133 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_pcs_tbl[] = {
#include <dt-bindings/phy/phy.h>
#include "phy-qcom-qmp.h"
+#include "phy-qcom-pcie3-qmp.h"
/* QPHY_SW_RESET bit */
#define SW_RESET BIT(0)
@@ -812,6 +813,132 @@ static const struct qmp_phy_init_tbl ipq
QMP_PHY_INIT_CFG_L(QPHY_START_CTRL, 0x3), QMP_PHY_INIT_CFG_L(QPHY_START_CTRL, 0x3),
}; };
@ -299,10 +150,11 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ QMP_PHY_INIT_CFG(PCS_COM_RX_SIGDET_LVL, 0xaa), + QMP_PHY_INIT_CFG(PCS_COM_RX_SIGDET_LVL, 0xaa),
+ QMP_PHY_INIT_CFG(PCS_COM_REFGEN_REQ_CONFIG1, 0x0d), + QMP_PHY_INIT_CFG(PCS_COM_REFGEN_REQ_CONFIG1, 0x0d),
+}; +};
+
static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = { static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = {
QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14),
QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30),
@@ -3194,6 +3321,36 @@ static const struct qmp_phy_cfg ipq6018_ @@ -3167,6 +3294,36 @@ static const struct qmp_phy_cfg ipq8074_pciephy_cfg = {
.pwrdn_delay_max = 1005, /* us */ .pwrdn_delay_max = 1005, /* us */
}; };
@ -324,46 +176,31 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), + .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l),
+ .vreg_list = NULL, + .vreg_list = NULL,
+ .num_vregs = 0, + .num_vregs = 0,
+ .regs = qmp_v4_usb3phy_regs_layout, + .regs = ipq_pciephy_gen3_regs_layout,
+ +
+ .start_ctrl = SERDES_START | PCS_START, + .start_ctrl = SERDES_START | PCS_START,
+ .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL,
+ +
+ .has_phy_com_ctrl = false,
+ .has_lane_rst = false,
+ .has_pwrdn_delay = true, + .has_pwrdn_delay = true,
+ .pwrdn_delay_min = 995, /* us */ + .pwrdn_delay_min = 995, /* us */
+ .pwrdn_delay_max = 1005, /* us */ + .pwrdn_delay_max = 1005, /* us */
+
+ .pipe_clock_rate = 250000000,
+}; +};
+ +
static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = { static const struct qmp_phy_cfg ipq6018_pciephy_cfg = {
.type = PHY_TYPE_PCIE, .type = PHY_TYPE_PCIE,
.nlanes = 1, .nlanes = 1,
@@ -5138,8 +5295,15 @@ static int phy_pipe_clk_register(struct @@ -5542,6 +5699,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = {
init.ops = &clk_fixed_rate_ops;
- /* controllers using QMP phys use 125MHz pipe clock interface */
- fixed->fixed_rate = 125000000;
+ /*
+ * controllers using QMP phys use 125MHz pipe clock interface unless
+ * other frequency is specified in dts
+ */
+ ret = of_property_read_u32(np, "clock-output-rate",
+ (u32 *)&fixed->fixed_rate);
+ if (ret)
+ fixed->fixed_rate = 125000000;
+
fixed->hw.init = &init;
ret = devm_clk_hw_register(qmp->dev, &fixed->hw);
@@ -5539,6 +5703,9 @@ static const struct of_device_id qcom_qm
.compatible = "qcom,ipq6018-qmp-usb3-phy",
.data = &ipq8074_usb3phy_cfg,
}, { }, {
+ .compatible = "qcom,ipq8074-qmp-pcie-gen3-phy", .compatible = "qcom,ipq8074-qmp-pcie-phy",
+ .data = &ipq8074_pciephy_gen3_cfg, .data = &ipq8074_pciephy_cfg,
+ }, { + }, {
.compatible = "qcom,sc7180-qmp-usb3-phy", + .compatible = "qcom,ipq8074-qmp-gen3-pcie-phy",
.data = &sc7180_usb3phy_cfg, + .data = &ipq8074_pciephy_gen3_cfg,
}, { }, {
.compatible = "qcom,ipq6018-qmp-pcie-phy",
.data = &ipq6018_pciephy_cfg,
--
2.37.2

View File

@ -1,7 +1,7 @@
From adfde5bbb4afd5e47371b74a0a4c9ec02fcc8d58 Mon Sep 17 00:00:00 2001 From 70835efbc6c9dbc4e652aa60a250ecb1a2160a9b Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Sun, 5 Sep 2021 19:11:31 +0200 Date: Sun, 5 Sep 2021 19:11:31 +0200
Subject: [PATCH] soc: qcom: socinfo: Add IPQ8074 family ID-s Subject: [PATCH 41/44] soc: qcom: socinfo: Add IPQ8074 family ID-s
IPQ8074 family SoC ID-s are missing, so lets add them based on IPQ8074 family SoC ID-s are missing, so lets add them based on
the downstream driver. the downstream driver.
@ -14,6 +14,8 @@ Link: https://lore.kernel.org/r/20210905171131.660885-1-robimarko@gmail.com
drivers/soc/qcom/socinfo.c | 12 ++++++++++++ drivers/soc/qcom/socinfo.c | 12 ++++++++++++
1 file changed, 12 insertions(+) 1 file changed, 12 insertions(+)
diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index 5beb452f2401..302a6a895c2f 100644
--- a/drivers/soc/qcom/socinfo.c --- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c +++ b/drivers/soc/qcom/socinfo.c
@@ -281,19 +281,31 @@ static const struct soc_id soc_id[] = { @@ -281,19 +281,31 @@ static const struct soc_id soc_id[] = {
@ -48,3 +50,6 @@ Link: https://lore.kernel.org/r/20210905171131.660885-1-robimarko@gmail.com
{ 402, "IPQ6018" }, { 402, "IPQ6018" },
{ 403, "IPQ6028" }, { 403, "IPQ6028" },
{ 421, "IPQ6000" }, { 421, "IPQ6000" },
--
2.37.2

View File

@ -1,8 +1,8 @@
From dae5693368998da74d3a460da739677c02c9c6af Mon Sep 17 00:00:00 2001 From 66dafdaad281e0a0eb2045ffb1f8dcf72e25989f Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch.siach@siklu.com> From: Baruch Siach <baruch.siach@siklu.com>
Date: Mon, 7 Feb 2022 16:51:24 +0200 Date: Mon, 7 Feb 2022 16:51:24 +0200
Subject: [PATCH] PCI: dwc: tegra: move GEN3_RELATED DBI register to common Subject: [PATCH 42/44] PCI: dwc: tegra: move GEN3_RELATED DBI register to
header common header
These are common dwc macros that will be used for other platforms. These are common dwc macros that will be used for other platforms.
@ -13,6 +13,8 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
drivers/pci/controller/dwc/pcie-tegra194.c | 6 ------ drivers/pci/controller/dwc/pcie-tegra194.c | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-) 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 7d6e9b7576be..ea87809ee298 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h --- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -74,6 +74,12 @@ @@ -74,6 +74,12 @@
@ -28,6 +30,8 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
#define PCIE_PORT_MULTI_LANE_CTRL 0x8C0 #define PCIE_PORT_MULTI_LANE_CTRL 0x8C0
#define PORT_MLTI_UPCFG_SUPPORT BIT(7) #define PORT_MLTI_UPCFG_SUPPORT BIT(7)
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index bdd84765e646..1381b00702fa 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c --- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -193,12 +193,6 @@ @@ -193,12 +193,6 @@
@ -43,3 +47,6 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
#define PORT_LOGIC_AMBA_ERROR_RESPONSE_DEFAULT 0x8D0 #define PORT_LOGIC_AMBA_ERROR_RESPONSE_DEFAULT 0x8D0
#define AMBA_ERROR_RESPONSE_CRS_SHIFT 3 #define AMBA_ERROR_RESPONSE_CRS_SHIFT 3
#define AMBA_ERROR_RESPONSE_CRS_MASK GENMASK(1, 0) #define AMBA_ERROR_RESPONSE_CRS_MASK GENMASK(1, 0)
--
2.37.2

View File

@ -1,7 +1,8 @@
From 70261569da66997eb4c6057b136af417ed06716e Mon Sep 17 00:00:00 2001 From 55299da8c17f23249497ee8868a5a268c6e3fbcc Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch.siach@siklu.com> From: Baruch Siach <baruch.siach@siklu.com>
Date: Mon, 7 Feb 2022 16:51:25 +0200 Date: Mon, 7 Feb 2022 16:51:25 +0200
Subject: [PATCH] PCI: qcom: Define slot capabilities using PCI_EXP_SLTCAP_* Subject: [PATCH 43/44] PCI: qcom: Define slot capabilities using
PCI_EXP_SLTCAP_*
The PCIE_CAP_LINK1_VAL macro actually defines slot capabilities. Use The PCIE_CAP_LINK1_VAL macro actually defines slot capabilities. Use
PCI_EXP_SLTCAP_* macros to spell its value, and rename it to better PCI_EXP_SLTCAP_* macros to spell its value, and rename it to better
@ -12,6 +13,8 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
drivers/pci/controller/dwc/pcie-qcom.c | 15 +++++++++++++-- drivers/pci/controller/dwc/pcie-qcom.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-) 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 4c599699e3c8..f49de615c9c4 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -69,7 +69,18 @@ @@ -69,7 +69,18 @@
@ -34,7 +37,7 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
#define PCIE20_PARF_Q2A_FLUSH 0x1AC #define PCIE20_PARF_Q2A_FLUSH 0x1AC
@@ -1102,7 +1113,7 @@ static int qcom_pcie_init_2_3_3(struct q @@ -1125,7 +1136,7 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND); writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND);
writel(DBI_RO_WR_EN, pci->dbi_base + PCIE20_MISC_CONTROL_1_REG); writel(DBI_RO_WR_EN, pci->dbi_base + PCIE20_MISC_CONTROL_1_REG);
@ -43,3 +46,6 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP); val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
val &= ~PCI_EXP_LNKCAP_ASPMS; val &= ~PCI_EXP_LNKCAP_ASPMS;
--
2.37.2

View File

@ -1,7 +1,7 @@
From 5d15adca10588019810505a07ed3f6758e4413be Mon Sep 17 00:00:00 2001 From b9d02fcefdf166671356a08dd621429e63541b22 Mon Sep 17 00:00:00 2001
From: Selvam Sathappan Periakaruppan <speriaka@codeaurora.org> From: Selvam Sathappan Periakaruppan <speriaka@codeaurora.org>
Date: Thu, 10 Feb 2022 18:02:47 +0100 Date: Thu, 10 Feb 2022 18:02:47 +0100
Subject: [PATCH] PCI: qcom: Add IPQ60xx support Subject: [PATCH 44/44] PCI: qcom: Add IPQ60xx support
IPQ60xx series of SoCs have one port of PCIe gen 3. Add support for that IPQ60xx series of SoCs have one port of PCIe gen 3. Add support for that
platform. platform.
@ -21,6 +21,8 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
drivers/pci/controller/dwc/pcie-qcom.c | 135 +++++++++++++++++++ drivers/pci/controller/dwc/pcie-qcom.c | 135 +++++++++++++++++++
2 files changed, 136 insertions(+) 2 files changed, 136 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index ea87809ee298..279c3778a13b 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h --- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -76,6 +76,7 @@ @@ -76,6 +76,7 @@
@ -31,6 +33,8 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
#define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16) #define GEN3_RELATED_OFF_GEN3_EQ_DISABLE BIT(16)
#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24 #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT 24
#define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24) #define GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK GENMASK(25, 24)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index f49de615c9c4..f50de3408add 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -52,6 +52,10 @@ @@ -52,6 +52,10 @@
@ -64,7 +68,7 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
}; };
struct qcom_pcie; struct qcom_pcie;
@@ -1271,6 +1281,121 @@ static void qcom_pcie_post_deinit_2_7_0( @@ -1276,6 +1286,121 @@ static void qcom_pcie_post_deinit_2_7_0(struct qcom_pcie *pcie)
clk_disable_unprepare(res->pipe_clk); clk_disable_unprepare(res->pipe_clk);
} }
@ -186,7 +190,7 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
static int qcom_pcie_link_up(struct dw_pcie *pci) static int qcom_pcie_link_up(struct dw_pcie *pci)
{ {
u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
@@ -1461,6 +1586,15 @@ static const struct qcom_pcie_ops ops_1_ @@ -1467,6 +1592,15 @@ static const struct qcom_pcie_ops ops_1_9_0 = {
.config_sid = qcom_pcie_config_sid_sm8250, .config_sid = qcom_pcie_config_sid_sm8250,
}; };
@ -202,7 +206,7 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
static const struct dw_pcie_ops dw_pcie_ops = { static const struct dw_pcie_ops dw_pcie_ops = {
.link_up = qcom_pcie_link_up, .link_up = qcom_pcie_link_up,
.start_link = qcom_pcie_start_link, .start_link = qcom_pcie_start_link,
@@ -1559,6 +1693,7 @@ static const struct of_device_id qcom_pc @@ -1565,6 +1699,7 @@ static const struct of_device_id qcom_pcie_match[] = {
{ .compatible = "qcom,pcie-qcs404", .data = &ops_2_4_0 }, { .compatible = "qcom,pcie-qcs404", .data = &ops_2_4_0 },
{ .compatible = "qcom,pcie-sdm845", .data = &ops_2_7_0 }, { .compatible = "qcom,pcie-sdm845", .data = &ops_2_7_0 },
{ .compatible = "qcom,pcie-sm8250", .data = &ops_1_9_0 }, { .compatible = "qcom,pcie-sm8250", .data = &ops_1_9_0 },
@ -210,3 +214,6 @@ Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
{ } { }
}; };
--
2.37.2

View File

@ -1,7 +1,7 @@
From 030e9812dc18de9ce9f1143cc6c84918608befca Mon Sep 17 00:00:00 2001 From 9fbfce710333c5ee674a5cad4cbb12ea5f969769 Mon Sep 17 00:00:00 2001
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org> From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Date: Mon, 3 Jan 2022 03:03:16 +0000 Date: Mon, 3 Jan 2022 03:03:16 +0000
Subject: [PATCH 2/2] mtd: parsers: qcom: Don't print error message on Subject: [PATCH] mtd: parsers: qcom: Don't print error message on
-EPROBE_DEFER -EPROBE_DEFER
Its possible for the main smem driver to not be loaded by the time we come Its possible for the main smem driver to not be loaded by the time we come
@ -18,9 +18,11 @@ Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-3-bryan.odonoghue@l
drivers/mtd/parsers/qcomsmempart.c | 3 ++- drivers/mtd/parsers/qcomsmempart.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-) 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/parsers/qcomsmempart.c b/drivers/mtd/parsers/qcomsmempart.c
index 32ddfea70142..4311b89d8df0 100644
--- a/drivers/mtd/parsers/qcomsmempart.c --- a/drivers/mtd/parsers/qcomsmempart.c
+++ b/drivers/mtd/parsers/qcomsmempart.c +++ b/drivers/mtd/parsers/qcomsmempart.c
@@ -75,7 +75,8 @@ static int parse_qcomsmem_part(struct mt @@ -75,7 +75,8 @@ static int parse_qcomsmem_part(struct mtd_info *mtd,
pr_debug("Parsing partition table info from SMEM\n"); pr_debug("Parsing partition table info from SMEM\n");
ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len); ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len);
if (IS_ERR(ptable)) { if (IS_ERR(ptable)) {
@ -30,3 +32,6 @@ Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-3-bryan.odonoghue@l
return PTR_ERR(ptable); return PTR_ERR(ptable);
} }
--
2.37.2

View File

@ -1,7 +1,7 @@
From 4b6d5caa1747bbe0eca15d4d20f028748c544cd0 Mon Sep 17 00:00:00 2001 From 2dc8319c43ccc511a38f441ab4f7aa120af9a9fb Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Wed, 22 Dec 2021 12:23:34 +0100 Date: Wed, 22 Dec 2021 12:23:34 +0100
Subject: [PATCH] arm64: dts: ipq8074: add reserved memory nodes Subject: [PATCH 100/137] arm64: dts: ipq8074: add reserved memory nodes
IPQ8074 has multiple reserved memory ranges, if they are not defined IPQ8074 has multiple reserved memory ranges, if they are not defined
then weird things tend to happen, board hangs and resets when PCI or then weird things tend to happen, board hangs and resets when PCI or
@ -14,12 +14,14 @@ devices with lower ammounts can override the Q6 node.
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
--- ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 40 +++++++++++++++++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 35 +++++++++++++++++++++++++++
1 file changed, 40 insertions(+) 1 file changed, 35 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index d53675fc1595..5985dfff073d 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -81,6 +81,31 @@ @@ -85,6 +85,26 @@ reserved-memory {
#size-cells = <2>; #size-cells = <2>;
ranges; ranges;
@ -42,18 +44,13 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ no-map; + no-map;
+ reg = <0x0 0x4aa00000 0x0 0x00100000>; + reg = <0x0 0x4aa00000 0x0 0x00100000>;
+ }; + };
+
+ tz@4ac00000 {
+ no-map;
+ reg = <0x0 0x4ac00000 0x0 0x00400000>;
+ };
+ +
smem@4ab00000 { smem@4ab00000 {
compatible = "qcom,smem"; compatible = "qcom,smem";
reg = <0x0 0x4ab00000 0x0 0x00100000>; reg = <0x0 0x4ab00000 0x0 0x00100000>;
@@ -88,6 +113,21 @@ @@ -97,6 +117,21 @@ memory@4ac00000 {
no-map;
hwlocks = <&tcsr_mutex 0>; reg = <0x0 0x4ac00000 0x0 0x00400000>;
}; };
+ +
+ q6_region: wcnss@4b000000 { + q6_region: wcnss@4b000000 {
@ -73,3 +70,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
}; };
firmware { firmware {
--
2.37.2

View File

@ -0,0 +1,56 @@
From 9d38e110e23ce0b858ccd67a8a819dc187529a33 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Fri, 8 Jul 2022 23:24:25 +0200
Subject: [PATCH 101/137] clk: qcom: clk-rcg2: add rcg2 mux ops
An RCG may act as a mux that switch between 2 parents.
This is the case on IPQ6018 and IPQ8074 where the APCS core clk that feeds
the CPU cluster clock just switches between XO and the PLL that feeds it.
Add the required ops to add support for this special configuration and use
the generic mux function to determine the rate.
This way we dont have to keep a essentially dummy frequency table to use
RCG2 as a mux.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/clk/qcom/clk-rcg.h | 1 +
drivers/clk/qcom/clk-rcg2.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h
index 99efcc7f8d88..248115a018bc 100644
--- a/drivers/clk/qcom/clk-rcg.h
+++ b/drivers/clk/qcom/clk-rcg.h
@@ -164,6 +164,7 @@ struct clk_rcg2_gfx3d {
extern const struct clk_ops clk_rcg2_ops;
extern const struct clk_ops clk_rcg2_floor_ops;
+extern const struct clk_ops clk_rcg2_mux_closest_ops;
extern const struct clk_ops clk_edp_pixel_ops;
extern const struct clk_ops clk_byte_ops;
extern const struct clk_ops clk_byte2_ops;
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
index c3823cc32edc..fdbbda1f2ba4 100644
--- a/drivers/clk/qcom/clk-rcg2.c
+++ b/drivers/clk/qcom/clk-rcg2.c
@@ -477,6 +477,13 @@ const struct clk_ops clk_rcg2_floor_ops = {
};
EXPORT_SYMBOL_GPL(clk_rcg2_floor_ops);
+const struct clk_ops clk_rcg2_mux_closest_ops = {
+ .determine_rate = __clk_mux_determine_rate_closest,
+ .get_parent = clk_rcg2_get_parent,
+ .set_parent = clk_rcg2_set_parent,
+};
+EXPORT_SYMBOL_GPL(clk_rcg2_mux_closest_ops);
+
struct frac_entry {
int num;
int den;
--
2.37.2

View File

@ -0,0 +1,66 @@
From d2b31da4eae2175ff86f28f596b54abde08d382f Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sat, 9 Jul 2022 00:18:45 +0200
Subject: [PATCH 102/137] clk: qcom: apss-ipq6018: fix apcs_alias0_clk_src
While working on IPQ8074 APSS driver it was discovered that IPQ6018 and
IPQ8074 use almost the same PLL and APSS clocks, however APSS driver is
currently broken.
More precisely apcs_alias0_clk_src is broken, it was added as regmap_mux
clock.
However after debugging why it was always stuck at 800Mhz, it was figured
out that its not regmap_mux compatible at all.
It is a simple mux but it uses RCG2 register layout and control bits, so
utilize the new clk_rcg2_mux_closest_ops to correctly drive it while not
having to provide a dummy frequency table.
While we are here, use ARRAY_SIZE for number of parents.
Tested on IPQ6018-CP01-C1 reference board and multiple IPQ8074 boards.
Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller")
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/clk/qcom/apss-ipq6018.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c
index d78ff2f310bf..be952d417ded 100644
--- a/drivers/clk/qcom/apss-ipq6018.c
+++ b/drivers/clk/qcom/apss-ipq6018.c
@@ -16,7 +16,7 @@
#include "clk-regmap.h"
#include "clk-branch.h"
#include "clk-alpha-pll.h"
-#include "clk-regmap-mux.h"
+#include "clk-rcg.h"
enum {
P_XO,
@@ -33,16 +33,15 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = {
{ P_APSS_PLL_EARLY, 5 },
};
-static struct clk_regmap_mux apcs_alias0_clk_src = {
- .reg = 0x0050,
- .width = 3,
- .shift = 7,
+static struct clk_rcg2 apcs_alias0_clk_src = {
+ .cmd_rcgr = 0x0050,
+ .hid_width = 5,
.parent_map = parents_apcs_alias0_clk_src_map,
.clkr.hw.init = &(struct clk_init_data){
.name = "apcs_alias0_clk_src",
.parent_data = parents_apcs_alias0_clk_src,
- .num_parents = 2,
- .ops = &clk_regmap_mux_closest_ops,
+ .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src),
+ .ops = &clk_rcg2_mux_closest_ops,
.flags = CLK_SET_RATE_PARENT,
},
};
--
2.37.2

View File

@ -0,0 +1,36 @@
From 4f9fcc72d6b5d64f8591f179f222154139eb1c72 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sat, 9 Jul 2022 00:26:54 +0200
Subject: [PATCH 103/137] clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as
critical
While fixing up the driver I noticed that my IPQ8074 board was hanging
after CPUFreq switched the frequency during boot, WDT would eventually
reset it.
So mark apcs_alias0_core_clk as critical since its the clock feeding the
CPU cluster and must never be disabled.
Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller")
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/clk/qcom/apss-ipq6018.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c
index be952d417ded..f2f502e2d5a4 100644
--- a/drivers/clk/qcom/apss-ipq6018.c
+++ b/drivers/clk/qcom/apss-ipq6018.c
@@ -56,7 +56,7 @@ static struct clk_branch apcs_alias0_core_clk = {
.parent_hws = (const struct clk_hw *[]){
&apcs_alias0_clk_src.clkr.hw },
.num_parents = 1,
- .flags = CLK_SET_RATE_PARENT,
+ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
.ops = &clk_branch2_ops,
},
},
--
2.37.2

View File

@ -0,0 +1,73 @@
From 8878f39722eeacbb40babe82ad763d8d20214018 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Sat, 9 Jul 2022 00:32:04 +0200
Subject: [PATCH 104/137] clk: qcom: apss-ipq-pll: use OF match data for Alpha
PLL config
Convert the driver to use OF match data for providing the Alpha PLL config
per compatible.
This is required for IPQ8074 support since it uses a different Alpha PLL
config.
While we are here rename "ipq_pll_config" to "ipq6018_pll_config" to make
it clear that it is for IPQ6018 only.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/clk/qcom/apss-ipq-pll.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c
index bef7899ad0d6..ba77749b16c4 100644
--- a/drivers/clk/qcom/apss-ipq-pll.c
+++ b/drivers/clk/qcom/apss-ipq-pll.c
@@ -2,6 +2,7 @@
// Copyright (c) 2018, The Linux Foundation. All rights reserved.
#include <linux/clk-provider.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -36,7 +37,7 @@ static struct clk_alpha_pll ipq_pll = {
},
};
-static const struct alpha_pll_config ipq_pll_config = {
+static const struct alpha_pll_config ipq6018_pll_config = {
.l = 0x37,
.config_ctl_val = 0x04141200,
.config_ctl_hi_val = 0x0,
@@ -54,6 +55,7 @@ static const struct regmap_config ipq_pll_regmap_config = {
static int apss_ipq_pll_probe(struct platform_device *pdev)
{
+ const struct alpha_pll_config *ipq_pll_config;
struct device *dev = &pdev->dev;
struct regmap *regmap;
void __iomem *base;
@@ -67,7 +69,11 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
- clk_alpha_pll_configure(&ipq_pll, regmap, &ipq_pll_config);
+ ipq_pll_config = of_device_get_match_data(&pdev->dev);
+ if (!ipq_pll_config)
+ return -ENODEV;
+
+ clk_alpha_pll_configure(&ipq_pll, regmap, ipq_pll_config);
ret = devm_clk_register_regmap(dev, &ipq_pll.clkr);
if (ret)
@@ -78,7 +84,7 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
}
static const struct of_device_id apss_ipq_pll_match_table[] = {
- { .compatible = "qcom,ipq6018-a53pll" },
+ { .compatible = "qcom,ipq6018-a53pll", .data = &ipq6018_pll_config },
{ }
};
MODULE_DEVICE_TABLE(of, apss_ipq_pll_match_table);
--
2.37.2

View File

@ -0,0 +1,43 @@
From 426edd7e45e9eaf18c433739ceeb51e6f2f8e190 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 11 Jul 2022 22:40:52 +0200
Subject: [PATCH 105/137] clk: qcom: apss-ipq-pll: update IPQ6018 Alpha PLL
config
Update the IPQ6018 Alpha PLL config to the latest one from the downstream
5.4 kernel[1].
This one should match the production SoC-s.
Tested on IPQ6018 CP01-C1 reference board.
[1] https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/blob/NHSS.QSDK.12.1.r4/drivers/clk/qcom/apss-ipq-pll.c#L41
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/clk/qcom/apss-ipq-pll.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c
index ba77749b16c4..a4016f3854c2 100644
--- a/drivers/clk/qcom/apss-ipq-pll.c
+++ b/drivers/clk/qcom/apss-ipq-pll.c
@@ -39,10 +39,14 @@ static struct clk_alpha_pll ipq_pll = {
static const struct alpha_pll_config ipq6018_pll_config = {
.l = 0x37,
- .config_ctl_val = 0x04141200,
- .config_ctl_hi_val = 0x0,
+ .config_ctl_val = 0x240d4828,
+ .config_ctl_hi_val = 0x6,
.early_output_mask = BIT(3),
+ .aux2_output_mask = BIT(2),
+ .aux_output_mask = BIT(1),
.main_output_mask = BIT(0),
+ .test_ctl_val = 0x1c0000C0,
+ .test_ctl_hi_val = 0x4000,
};
static const struct regmap_config ipq_pll_regmap_config = {
--
2.37.2

View File

@ -0,0 +1,56 @@
From c633afe32123157370f21aeaf3d705ca584fc754 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Mon, 11 Jul 2022 14:23:08 +0200
Subject: [PATCH 106/137] clk: qcom: apss-ipq-pll: add support for IPQ8074
Add support for IPQ8074 since it uses the same PLL setup, however it uses
slightly different Alpha PLL config.
Alpha PLL config was obtained by dumping PLL registers from a running
device.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v2:
* Drop hardcoded compatible check for IPQ6018 to do the PLL config and
utilize match data provided by previous commit
* Add IPQ8074 Alpha PLL config using match data
* Update commit description to reflect changes
---
drivers/clk/qcom/apss-ipq-pll.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c
index a4016f3854c2..a5aea27eb867 100644
--- a/drivers/clk/qcom/apss-ipq-pll.c
+++ b/drivers/clk/qcom/apss-ipq-pll.c
@@ -49,6 +49,18 @@ static const struct alpha_pll_config ipq6018_pll_config = {
.test_ctl_hi_val = 0x4000,
};
+static const struct alpha_pll_config ipq8074_pll_config = {
+ .l = 0x48,
+ .config_ctl_val = 0x200d4828,
+ .config_ctl_hi_val = 0x6,
+ .early_output_mask = BIT(3),
+ .aux2_output_mask = BIT(2),
+ .aux_output_mask = BIT(1),
+ .main_output_mask = BIT(0),
+ .test_ctl_val = 0x1c000000,
+ .test_ctl_hi_val = 0x4000,
+};
+
static const struct regmap_config ipq_pll_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
@@ -89,6 +101,7 @@ static int apss_ipq_pll_probe(struct platform_device *pdev)
static const struct of_device_id apss_ipq_pll_match_table[] = {
{ .compatible = "qcom,ipq6018-a53pll", .data = &ipq6018_pll_config },
+ { .compatible = "qcom,ipq8074-a53pll", .data = &ipq8074_pll_config },
{ }
};
MODULE_DEVICE_TABLE(of, apss_ipq_pll_match_table);
--
2.37.2

View File

@ -0,0 +1,36 @@
From f3d524334069e69554eaecd8adf75284dff7c9d9 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 18 Aug 2022 23:15:43 +0200
Subject: [PATCH 107/137] arm64: dts: qcom: ipq8074: correct APCS register
space size
APCS DTS addition that was merged, was not supposed to get merged as it
was part of patch series that was superseded by 2 more patch series
that resolved issues with this one and greatly simplified things.
Since it already got merged, start by correcting the register space
size as APCS will not be providing regmap for PLL and it will conflict
with the standalone A53 PLL node.
Fixes: 50ed9fffec3a ("arm64: dts: qcom: ipq8074: add APCS node")
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 5985dfff073d..5b62d7590fc6 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -703,7 +703,7 @@ watchdog: watchdog@b017000 {
apcs_glb: mailbox@b111000 {
compatible = "qcom,ipq8074-apcs-apps-global";
- reg = <0x0b111000 0x6000>;
+ reg = <0x0b111000 0x1000>;
#clock-cells = <1>;
#mbox-cells = <1>;
--
2.37.2

View File

@ -0,0 +1,35 @@
From be028f5f79b8af6ea16ffeea486e216acdf80789 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 18 Aug 2022 23:21:06 +0200
Subject: [PATCH 108/137] arm64: dts: qcom: ipq8074: add A53 PLL node
Add the required node for A53 PLL which will be used to provide the CPU
clock via APCS for APSS scaling.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 5b62d7590fc6..bace14b742a1 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -709,6 +709,14 @@ apcs_glb: mailbox@b111000 {
#mbox-cells = <1>;
};
+ a53pll: clock@b116000 {
+ compatible = "qcom,ipq8074-a53pll";
+ reg = <0x0b116000 0x40>;
+ #clock-cells = <0>;
+ clocks = <&xo>;
+ clock-names = "xo";
+ };
+
timer@b120000 {
#address-cells = <1>;
#size-cells = <1>;
--
2.37.2

View File

@ -0,0 +1,55 @@
From ded0538937e9edf8b217d2082fd30af3bf7bd10b Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Tue, 28 Dec 2021 20:59:18 +0100
Subject: [PATCH 109/137] mailbox: qcom-apcs-ipc: add IPQ8074 APSS clock
support
IPQ8074 has the APSS clock controller utilizing the same register space as
the APCS, so provide access to the APSS utilizing a child device like
IPQ6018.
IPQ6018 and IPQ8074 use the same controller and driver, so just utilize
IPQ6018 match data for IPQ8074.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
Changes in v7:
* Dont max_register modifications
* Drop custom IPQ8074 match data and use IPQ6018 one as they share the
controller and driver
Changes in v5:
* Use lower case hex for max_register
* Update the APSS clock name to match the new one without commas
---
drivers/mailbox/qcom-apcs-ipc-mailbox.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mailbox/qcom-apcs-ipc-mailbox.c b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
index 82ccfaf14b24..0d8d1b17ba45 100644
--- a/drivers/mailbox/qcom-apcs-ipc-mailbox.c
+++ b/drivers/mailbox/qcom-apcs-ipc-mailbox.c
@@ -33,10 +33,6 @@ static const struct qcom_apcs_ipc_data ipq6018_apcs_data = {
.offset = 8, .clk_name = "qcom,apss-ipq6018-clk"
};
-static const struct qcom_apcs_ipc_data ipq8074_apcs_data = {
- .offset = 8, .clk_name = NULL
-};
-
static const struct qcom_apcs_ipc_data msm8916_apcs_data = {
.offset = 8, .clk_name = "qcom-apcs-msm8916-clk"
};
@@ -160,7 +156,7 @@ static int qcom_apcs_ipc_remove(struct platform_device *pdev)
/* .data is the offset of the ipc register within the global block */
static const struct of_device_id qcom_apcs_ipc_of_match[] = {
{ .compatible = "qcom,ipq6018-apcs-apps-global", .data = &ipq6018_apcs_data },
- { .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq8074_apcs_data },
+ { .compatible = "qcom,ipq8074-apcs-apps-global", .data = &ipq6018_apcs_data },
{ .compatible = "qcom,msm8916-apcs-kpss-global", .data = &msm8916_apcs_data },
{ .compatible = "qcom,msm8939-apcs-kpss-global", .data = &msm8916_apcs_data },
{ .compatible = "qcom,msm8953-apcs-kpss-global", .data = &msm8994_apcs_data },
--
2.37.2

View File

@ -0,0 +1,34 @@
From 0a36a586424feabf9ce9436379f9d061b7844155 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 18 Aug 2022 23:25:00 +0200
Subject: [PATCH 110/137] arm64: dts: qcom: ipq8074: add clocks to APCS
APCS now has support for providing the APSS clocks as the child device
for IPQ8074.
So, add the A53 PLL and XO clocks in order to use APCS as the CPU
clocksource for APSS scaling.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index bace14b742a1..7d4ff7d8a239 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -704,8 +704,9 @@ watchdog: watchdog@b017000 {
apcs_glb: mailbox@b111000 {
compatible = "qcom,ipq8074-apcs-apps-global";
reg = <0x0b111000 0x1000>;
-
#clock-cells = <1>;
+ clocks = <&a53pll>, <&xo>;
+ clock-names = "pll", "xo";
#mbox-cells = <1>;
};
--
2.37.2

View File

@ -1,7 +1,7 @@
From 4e93203281f4b0c82bf36afd5f316e37991d6456 Mon Sep 17 00:00:00 2001 From f086c5659cd54946b618ae4c695a8c05096f267a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Mon, 20 Dec 2021 15:01:36 +0100 Date: Mon, 20 Dec 2021 15:01:36 +0100
Subject: [PATCH] PCI: qcom: add IPQ8074 Gen3 support Subject: [PATCH 111/137] PCI: qcom: add IPQ8074 Gen3 support
IPQ8074 has one Gen2 and one Gen3 port, Gen3 port is the same one as IPQ8074 has one Gen2 and one Gen3 port, Gen3 port is the same one as
in IPQ6018, so reuse the support but just add the missing clocks. in IPQ6018, so reuse the support but just add the missing clocks.
@ -11,6 +11,8 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++++--- drivers/pci/controller/dwc/pcie-qcom.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-) 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index f50de3408add..5aec3510b5c9 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c --- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -184,7 +184,7 @@ struct qcom_pcie_resources_2_7_0 { @@ -184,7 +184,7 @@ struct qcom_pcie_resources_2_7_0 {
@ -22,7 +24,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
struct reset_control *rst; struct reset_control *rst;
}; };
@@ -1291,8 +1291,10 @@ static int qcom_pcie_get_resources_2_9_0 @@ -1296,8 +1296,10 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie)
res->clks[0].id = "iface"; res->clks[0].id = "iface";
res->clks[1].id = "axi_m"; res->clks[1].id = "axi_m";
res->clks[2].id = "axi_s"; res->clks[2].id = "axi_s";
@ -35,7 +37,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks);
if (ret < 0) if (ret < 0)
@@ -1694,6 +1696,7 @@ static const struct of_device_id qcom_pc @@ -1700,6 +1702,7 @@ static const struct of_device_id qcom_pcie_match[] = {
{ .compatible = "qcom,pcie-sdm845", .data = &ops_2_7_0 }, { .compatible = "qcom,pcie-sdm845", .data = &ops_2_7_0 },
{ .compatible = "qcom,pcie-sm8250", .data = &ops_1_9_0 }, { .compatible = "qcom,pcie-sm8250", .data = &ops_1_9_0 },
{ .compatible = "qcom,pcie-ipq6018", .data = &ops_2_9_0 }, { .compatible = "qcom,pcie-ipq6018", .data = &ops_2_9_0 },
@ -43,3 +45,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
{ } { }
}; };
--
2.37.2

View File

@ -1,7 +1,7 @@
From 9e280276de874970d03cdc124d8bfa7afbb6aef1 Mon Sep 17 00:00:00 2001 From 184c9b73285f05ebc013205d54ed11cd968cb38e Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Mon, 20 Dec 2021 15:08:04 +0100 Date: Mon, 20 Dec 2021 15:08:04 +0100
Subject: [PATCH] arm64: dts: ipq8074: fix PCI related DT nodes Subject: [PATCH 112/137] arm64: dts: ipq8074: fix PCI related DT nodes
Currently present PCI PHY and PCI controller nodes are not working Currently present PCI PHY and PCI controller nodes are not working
and are incorrect for the v2 of IPQ8074 which is the only version and are incorrect for the v2 of IPQ8074 which is the only version
@ -11,12 +11,14 @@ So, correct the PCI related nodes.
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
--- ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 73 +++++++++++++++------------ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 93 +++++++++++++++------------
1 file changed, 42 insertions(+), 31 deletions(-) 1 file changed, 52 insertions(+), 41 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 7d4ff7d8a239..019c8e302273 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -228,9 +228,9 @@ @@ -232,59 +232,61 @@ qusb_phy_0: phy@79000 {
status = "disabled"; status = "disabled";
}; };
@ -24,13 +26,24 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
- compatible = "qcom,ipq8074-qmp-pcie-phy"; - compatible = "qcom,ipq8074-qmp-pcie-phy";
- reg = <0x00086000 0x1000>; - reg = <0x00086000 0x1000>;
+ pcie_qmp0: phy@84000 { + pcie_qmp0: phy@84000 {
+ compatible = "qcom,ipq8074-qmp-pcie-gen3-phy"; + compatible = "qcom,ipq8074-qmp-gen3-pcie-phy";
+ reg = <0x00084000 0x1bc>; + reg = <0x00084000 0x1bc>;
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; ranges;
@@ -244,21 +244,22 @@
"common"; clocks = <&gcc GCC_PCIE0_AUX_CLK>,
- <&gcc GCC_PCIE0_AHB_CLK>;
+ <&gcc GCC_PCIE0_AHB_CLK>;
clock-names = "aux", "cfg_ahb";
+
resets = <&gcc GCC_PCIE0_PHY_BCR>,
- <&gcc GCC_PCIE0PHY_PHY_BCR>;
- reset-names = "phy",
- "common";
+ <&gcc GCC_PCIE0PHY_PHY_BCR>;
+ reset-names = "phy", "common";
+
status = "disabled"; status = "disabled";
- pcie_phy0: phy@86200 { - pcie_phy0: phy@86200 {
@ -45,8 +58,8 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#clock-cells = <0>; #clock-cells = <0>;
clocks = <&gcc GCC_PCIE0_PIPE_CLK>; clocks = <&gcc GCC_PCIE0_PIPE_CLK>;
clock-names = "pipe0"; clock-names = "pipe0";
clock-output-names = "pcie_0_pipe_clk"; - clock-output-names = "pcie_0_pipe_clk";
+ clock-output-rate = <250000000>; + clock-output-names = "gcc_pcie0_pipe_clk_src";
}; };
}; };
@ -57,7 +70,19 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
ranges; ranges;
@@ -273,14 +274,15 @@
clocks = <&gcc GCC_PCIE1_AUX_CLK>,
- <&gcc GCC_PCIE1_AHB_CLK>;
+ <&gcc GCC_PCIE1_AHB_CLK>;
clock-names = "aux", "cfg_ahb";
+
resets = <&gcc GCC_PCIE1_PHY_BCR>,
- <&gcc GCC_PCIE1PHY_PHY_BCR>;
- reset-names = "phy",
- "common";
+ <&gcc GCC_PCIE1PHY_PHY_BCR>;
+ reset-names = "phy", "common";
+
status = "disabled"; status = "disabled";
pcie_phy1: phy@8e200 { pcie_phy1: phy@8e200 {
@ -70,12 +95,12 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#clock-cells = <0>; #clock-cells = <0>;
clocks = <&gcc GCC_PCIE1_PIPE_CLK>; clocks = <&gcc GCC_PCIE1_PIPE_CLK>;
clock-names = "pipe0"; clock-names = "pipe0";
clock-output-names = "pcie_1_pipe_clk"; - clock-output-names = "pcie_1_pipe_clk";
+ clock-output-rate = <125000000>; + clock-output-names = "gcc_pcie1_pipe_clk_src";
}; };
}; };
@@ -676,7 +678,7 @@ @@ -686,7 +688,7 @@ intc: interrupt-controller@b000000 {
reg = <0x0b000000 0x1000>, <0x0b002000 0x1000>; reg = <0x0b000000 0x1000>, <0x0b002000 0x1000>;
ranges = <0 0xb00a000 0xffd>; ranges = <0 0xb00a000 0xffd>;
@ -84,7 +109,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
compatible = "arm,gic-v2m-frame"; compatible = "arm,gic-v2m-frame";
msi-controller; msi-controller;
reg = <0x0 0xffd>; reg = <0x0 0xffd>;
@@ -769,6 +771,7 @@ @@ -787,6 +789,7 @@ pcie1: pci@10000000 {
linux,pci-domain = <1>; linux,pci-domain = <1>;
bus-range = <0x00 0xff>; bus-range = <0x00 0xff>;
num-lanes = <1>; num-lanes = <1>;
@ -92,7 +117,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#address-cells = <3>; #address-cells = <3>;
#size-cells = <2>; #size-cells = <2>;
@@ -776,12 +779,12 @@ @@ -794,12 +797,12 @@ pcie1: pci@10000000 {
phy-names = "pciephy"; phy-names = "pciephy";
ranges = <0x81000000 0 0x10200000 0x10200000 ranges = <0x81000000 0 0x10200000 0x10200000
@ -110,7 +135,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>; interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &intc 0 142 interrupt-map = <0 0 0 1 &intc 0 142
@@ -821,16 +824,18 @@ @@ -839,16 +842,18 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */
}; };
pcie0: pci@20000000 { pcie0: pci@20000000 {
@ -135,7 +160,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#address-cells = <3>; #address-cells = <3>;
#size-cells = <2>; #size-cells = <2>;
@@ -838,12 +843,12 @@ @@ -856,12 +861,12 @@ pcie0: pci@20000000 {
phy-names = "pciephy"; phy-names = "pciephy";
ranges = <0x81000000 0 0x20200000 0x20200000 ranges = <0x81000000 0 0x20200000 0x20200000
@ -153,7 +178,7 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>; interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &intc 0 75 interrupt-map = <0 0 0 1 &intc 0 75
@@ -859,27 +864,33 @@ @@ -877,27 +882,33 @@ IRQ_TYPE_LEVEL_HIGH>, /* int_c */
<&gcc GCC_PCIE0_AXI_M_CLK>, <&gcc GCC_PCIE0_AXI_M_CLK>,
<&gcc GCC_PCIE0_AXI_S_CLK>, <&gcc GCC_PCIE0_AXI_S_CLK>,
<&gcc GCC_PCIE0_AHB_CLK>, <&gcc GCC_PCIE0_AHB_CLK>,
@ -191,3 +216,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
status = "disabled"; status = "disabled";
}; };
}; };
--
2.37.2

View File

@ -1,7 +1,7 @@
From ddc957c5eee78cf41d04040b6de3e3437830b473 Mon Sep 17 00:00:00 2001 From 84e13a5267e43bb0a6a1f764211fda7769dc9cbe Mon Sep 17 00:00:00 2001
From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org> From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Date: Sat, 30 Jan 2021 10:50:05 +0530 Date: Sat, 30 Jan 2021 10:50:05 +0530
Subject: [PATCH] remoteproc: qcom: Add PRNG proxy clock Subject: [PATCH 113/137] remoteproc: qcom: Add PRNG proxy clock
PRNG clock is needed by the secure PIL, support for the same PRNG clock is needed by the secure PIL, support for the same
is added in subsequent patches. is added in subsequent patches.
@ -13,6 +13,8 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
drivers/remoteproc/qcom_q6v5_wcss.c | 65 +++++++++++++++++++++-------- drivers/remoteproc/qcom_q6v5_wcss.c | 65 +++++++++++++++++++++--------
1 file changed, 47 insertions(+), 18 deletions(-) 1 file changed, 47 insertions(+), 18 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index 20d50ec7eff1..0e5484020296 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c --- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -91,19 +91,6 @@ enum { @@ -91,19 +91,6 @@ enum {
@ -65,7 +67,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
static int q6v5_wcss_reset(struct q6v5_wcss *wcss) static int q6v5_wcss_reset(struct q6v5_wcss *wcss)
{ {
int ret; int ret;
@@ -240,6 +243,12 @@ static int q6v5_wcss_start(struct rproc @@ -240,6 +243,12 @@ static int q6v5_wcss_start(struct rproc *rproc)
struct q6v5_wcss *wcss = rproc->priv; struct q6v5_wcss *wcss = rproc->priv;
int ret; int ret;
@ -78,7 +80,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
qcom_q6v5_prepare(&wcss->q6v5); qcom_q6v5_prepare(&wcss->q6v5);
/* Release Q6 and WCSS reset */ /* Release Q6 and WCSS reset */
@@ -732,6 +741,7 @@ static int q6v5_wcss_stop(struct rproc * @@ -732,6 +741,7 @@ static int q6v5_wcss_stop(struct rproc *rproc)
return ret; return ret;
} }
@ -86,7 +88,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
qcom_q6v5_unprepare(&wcss->q6v5); qcom_q6v5_unprepare(&wcss->q6v5);
return 0; return 0;
@@ -896,7 +906,21 @@ static int q6v5_alloc_memory_region(stru @@ -896,7 +906,21 @@ static int q6v5_alloc_memory_region(struct q6v5_wcss *wcss)
return 0; return 0;
} }
@ -109,7 +111,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
{ {
int ret; int ret;
@@ -986,7 +1010,7 @@ static int q6v5_wcss_init_clock(struct q @@ -986,7 +1010,7 @@ static int q6v5_wcss_init_clock(struct q6v5_wcss *wcss)
return 0; return 0;
} }
@ -118,7 +120,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
{ {
wcss->cx_supply = devm_regulator_get(wcss->dev, "cx"); wcss->cx_supply = devm_regulator_get(wcss->dev, "cx");
if (IS_ERR(wcss->cx_supply)) if (IS_ERR(wcss->cx_supply))
@@ -1030,12 +1054,14 @@ static int q6v5_wcss_probe(struct platfo @@ -1030,12 +1054,14 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
if (ret) if (ret)
goto free_rproc; goto free_rproc;
@ -136,7 +138,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
if (ret) if (ret)
goto free_rproc; goto free_rproc;
} }
@@ -1082,6 +1108,7 @@ static int q6v5_wcss_remove(struct platf @@ -1082,6 +1108,7 @@ static int q6v5_wcss_remove(struct platform_device *pdev)
} }
static const struct wcss_data wcss_ipq8074_res_init = { static const struct wcss_data wcss_ipq8074_res_init = {
@ -144,7 +146,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
.firmware_name = "IPQ8074/q6_fw.mdt", .firmware_name = "IPQ8074/q6_fw.mdt",
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
.aon_reset_required = true, .aon_reset_required = true,
@@ -1091,6 +1118,8 @@ static const struct wcss_data wcss_ipq80 @@ -1091,6 +1118,8 @@ static const struct wcss_data wcss_ipq8074_res_init = {
}; };
static const struct wcss_data wcss_qcs404_res_init = { static const struct wcss_data wcss_qcs404_res_init = {
@ -153,3 +155,6 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
.firmware_name = "wcnss.mdt", .firmware_name = "wcnss.mdt",
.version = WCSS_QCS404, .version = WCSS_QCS404,
--
2.37.2

View File

@ -1,7 +1,7 @@
From 3151bf7eb1350e3dd8a51424942d7365673a6e25 Mon Sep 17 00:00:00 2001 From cb3b9e284104fd7fe4aa92a37df005577aed2c40 Mon Sep 17 00:00:00 2001
From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org> From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Date: Sat, 30 Jan 2021 10:50:06 +0530 Date: Sat, 30 Jan 2021 10:50:06 +0530
Subject: [PATCH] remoteproc: qcom: Add secure PIL support Subject: [PATCH 114/137] remoteproc: qcom: Add secure PIL support
IPQ8074 uses secure PIL. Hence, adding the support for the same. IPQ8074 uses secure PIL. Hence, adding the support for the same.
@ -12,6 +12,8 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
drivers/remoteproc/qcom_q6v5_wcss.c | 43 +++++++++++++++++++++++++++-- drivers/remoteproc/qcom_q6v5_wcss.c | 43 +++++++++++++++++++++++++++--
1 file changed, 40 insertions(+), 3 deletions(-) 1 file changed, 40 insertions(+), 3 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index 0e5484020296..7d173b7816b8 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c --- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
@ -48,7 +50,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
}; };
static int q6v5_wcss_reset(struct q6v5_wcss *wcss) static int q6v5_wcss_reset(struct q6v5_wcss *wcss)
@@ -251,6 +257,15 @@ static int q6v5_wcss_start(struct rproc @@ -251,6 +257,15 @@ static int q6v5_wcss_start(struct rproc *rproc)
qcom_q6v5_prepare(&wcss->q6v5); qcom_q6v5_prepare(&wcss->q6v5);
@ -64,7 +66,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
/* Release Q6 and WCSS reset */ /* Release Q6 and WCSS reset */
ret = reset_control_deassert(wcss->wcss_reset); ret = reset_control_deassert(wcss->wcss_reset);
if (ret) { if (ret) {
@@ -285,6 +300,7 @@ static int q6v5_wcss_start(struct rproc @@ -285,6 +300,7 @@ static int q6v5_wcss_start(struct rproc *rproc)
if (ret) if (ret)
goto wcss_q6_reset; goto wcss_q6_reset;
@ -72,7 +74,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
ret = qcom_q6v5_wait_for_start(&wcss->q6v5, 5 * HZ); ret = qcom_q6v5_wait_for_start(&wcss->q6v5, 5 * HZ);
if (ret == -ETIMEDOUT) if (ret == -ETIMEDOUT)
dev_err(wcss->dev, "start timed out\n"); dev_err(wcss->dev, "start timed out\n");
@@ -717,6 +733,15 @@ static int q6v5_wcss_stop(struct rproc * @@ -717,6 +733,15 @@ static int q6v5_wcss_stop(struct rproc *rproc)
struct q6v5_wcss *wcss = rproc->priv; struct q6v5_wcss *wcss = rproc->priv;
int ret; int ret;
@ -88,7 +90,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
/* WCSS powerdown */ /* WCSS powerdown */
if (wcss->requires_force_stop) { if (wcss->requires_force_stop) {
ret = qcom_q6v5_request_stop(&wcss->q6v5, NULL); ret = qcom_q6v5_request_stop(&wcss->q6v5, NULL);
@@ -741,6 +766,7 @@ static int q6v5_wcss_stop(struct rproc * @@ -741,6 +766,7 @@ static int q6v5_wcss_stop(struct rproc *rproc)
return ret; return ret;
} }
@ -96,7 +98,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
clk_disable_unprepare(wcss->prng_clk); clk_disable_unprepare(wcss->prng_clk);
qcom_q6v5_unprepare(&wcss->q6v5); qcom_q6v5_unprepare(&wcss->q6v5);
@@ -764,9 +790,15 @@ static int q6v5_wcss_load(struct rproc * @@ -764,9 +790,15 @@ static int q6v5_wcss_load(struct rproc *rproc, const struct firmware *fw)
struct q6v5_wcss *wcss = rproc->priv; struct q6v5_wcss *wcss = rproc->priv;
int ret; int ret;
@ -115,7 +117,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
if (ret) if (ret)
return ret; return ret;
@@ -1032,6 +1064,9 @@ static int q6v5_wcss_probe(struct platfo @@ -1032,6 +1064,9 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
if (!desc) if (!desc)
return -EINVAL; return -EINVAL;
@ -125,7 +127,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
rproc = rproc_alloc(&pdev->dev, pdev->name, desc->ops, rproc = rproc_alloc(&pdev->dev, pdev->name, desc->ops,
desc->firmware_name, sizeof(*wcss)); desc->firmware_name, sizeof(*wcss));
if (!rproc) { if (!rproc) {
@@ -1045,6 +1080,7 @@ static int q6v5_wcss_probe(struct platfo @@ -1045,6 +1080,7 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
wcss->version = desc->version; wcss->version = desc->version;
wcss->requires_force_stop = desc->requires_force_stop; wcss->requires_force_stop = desc->requires_force_stop;
@ -133,7 +135,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
ret = q6v5_wcss_init_mmio(wcss, pdev); ret = q6v5_wcss_init_mmio(wcss, pdev);
if (ret) if (ret)
@@ -1115,6 +1151,7 @@ static const struct wcss_data wcss_ipq80 @@ -1115,6 +1151,7 @@ static const struct wcss_data wcss_ipq8074_res_init = {
.wcss_q6_reset_required = true, .wcss_q6_reset_required = true,
.ops = &q6v5_wcss_ipq8074_ops, .ops = &q6v5_wcss_ipq8074_ops,
.requires_force_stop = true, .requires_force_stop = true,
@ -141,3 +143,6 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
}; };
static const struct wcss_data wcss_qcs404_res_init = { static const struct wcss_data wcss_qcs404_res_init = {
--
2.37.2

View File

@ -1,7 +1,8 @@
From 0915eaecd5e06227c9e4e3a4a931c45942e7b4ed Mon Sep 17 00:00:00 2001 From bcb2c37f265924ac43642f1f97c964dd546b3cb5 Mon Sep 17 00:00:00 2001
From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org> From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Date: Sat, 30 Jan 2021 10:50:07 +0530 Date: Sat, 30 Jan 2021 10:50:07 +0530
Subject: [PATCH] remoteproc: qcom: Add support for split q6 + m3 wlan firmware Subject: [PATCH 115/137] remoteproc: qcom: Add support for split q6 + m3 wlan
firmware
IPQ8074 supports split firmware for q6 and m3 as well. IPQ8074 supports split firmware for q6 and m3 as well.
So add support for loading the m3 firmware before q6. So add support for loading the m3 firmware before q6.
@ -15,6 +16,8 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
drivers/remoteproc/qcom_q6v5_wcss.c | 33 +++++++++++++++++++++++++---- drivers/remoteproc/qcom_q6v5_wcss.c | 33 +++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-) 1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index 7d173b7816b8..60ed0c046693 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c --- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -139,6 +139,7 @@ struct q6v5_wcss { @@ -139,6 +139,7 @@ struct q6v5_wcss {
@ -35,7 +38,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
unsigned int crash_reason_smem; unsigned int crash_reason_smem;
u32 version; u32 version;
bool aon_reset_required; bool aon_reset_required;
@@ -788,8 +790,29 @@ static void *q6v5_wcss_da_to_va(struct r @@ -788,8 +790,29 @@ static void *q6v5_wcss_da_to_va(struct rproc *rproc, u64 da, size_t len, bool *i
static int q6v5_wcss_load(struct rproc *rproc, const struct firmware *fw) static int q6v5_wcss_load(struct rproc *rproc, const struct firmware *fw)
{ {
struct q6v5_wcss *wcss = rproc->priv; struct q6v5_wcss *wcss = rproc->priv;
@ -65,7 +68,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
if (wcss->need_mem_protection) if (wcss->need_mem_protection)
ret = qcom_mdt_load(wcss->dev, fw, rproc->firmware, ret = qcom_mdt_load(wcss->dev, fw, rproc->firmware,
WCNSS_PAS_ID, wcss->mem_region, WCNSS_PAS_ID, wcss->mem_region,
@@ -1068,7 +1091,7 @@ static int q6v5_wcss_probe(struct platfo @@ -1068,7 +1091,7 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
rproc = rproc_alloc(&pdev->dev, pdev->name, desc->ops, rproc = rproc_alloc(&pdev->dev, pdev->name, desc->ops,
@ -74,7 +77,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
if (!rproc) { if (!rproc) {
dev_err(&pdev->dev, "failed to allocate rproc\n"); dev_err(&pdev->dev, "failed to allocate rproc\n");
return -ENOMEM; return -ENOMEM;
@@ -1081,6 +1104,7 @@ static int q6v5_wcss_probe(struct platfo @@ -1081,6 +1104,7 @@ static int q6v5_wcss_probe(struct platform_device *pdev)
wcss->version = desc->version; wcss->version = desc->version;
wcss->requires_force_stop = desc->requires_force_stop; wcss->requires_force_stop = desc->requires_force_stop;
wcss->need_mem_protection = desc->need_mem_protection; wcss->need_mem_protection = desc->need_mem_protection;
@ -82,7 +85,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
ret = q6v5_wcss_init_mmio(wcss, pdev); ret = q6v5_wcss_init_mmio(wcss, pdev);
if (ret) if (ret)
@@ -1145,7 +1169,8 @@ static int q6v5_wcss_remove(struct platf @@ -1145,7 +1169,8 @@ static int q6v5_wcss_remove(struct platform_device *pdev)
static const struct wcss_data wcss_ipq8074_res_init = { static const struct wcss_data wcss_ipq8074_res_init = {
.init_clock = ipq8074_init_clock, .init_clock = ipq8074_init_clock,
@ -92,7 +95,7 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
.aon_reset_required = true, .aon_reset_required = true,
.wcss_q6_reset_required = true, .wcss_q6_reset_required = true,
@@ -1158,7 +1183,7 @@ static const struct wcss_data wcss_qcs40 @@ -1158,7 +1183,7 @@ static const struct wcss_data wcss_qcs404_res_init = {
.init_clock = qcs404_init_clock, .init_clock = qcs404_init_clock,
.init_regulator = qcs404_init_regulator, .init_regulator = qcs404_init_regulator,
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
@ -101,3 +104,6 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
.version = WCSS_QCS404, .version = WCSS_QCS404,
.aon_reset_required = false, .aon_reset_required = false,
.wcss_q6_reset_required = false, .wcss_q6_reset_required = false,
--
2.37.2

View File

@ -1,7 +1,7 @@
From a0774816e1e76c47fe47a4e0fa7e0a84811dd62f Mon Sep 17 00:00:00 2001 From 5b717749ce49853f495ebac227c72013622b0810 Mon Sep 17 00:00:00 2001
From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org> From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Date: Sat, 30 Jan 2021 10:50:08 +0530 Date: Sat, 30 Jan 2021 10:50:08 +0530
Subject: [PATCH] remoteproc: qcom: Add ssr subdevice identifier Subject: [PATCH 116/137] remoteproc: qcom: Add ssr subdevice identifier
Add name for ssr subdevice on IPQ8074 SoC. Add name for ssr subdevice on IPQ8074 SoC.
@ -12,9 +12,11 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
drivers/remoteproc/qcom_q6v5_wcss.c | 1 + drivers/remoteproc/qcom_q6v5_wcss.c | 1 +
1 file changed, 1 insertion(+) 1 file changed, 1 insertion(+)
diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index 60ed0c046693..e32efdc660d2 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c --- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -1174,6 +1174,7 @@ static const struct wcss_data wcss_ipq80 @@ -1174,6 +1174,7 @@ static const struct wcss_data wcss_ipq8074_res_init = {
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
.aon_reset_required = true, .aon_reset_required = true,
.wcss_q6_reset_required = true, .wcss_q6_reset_required = true,
@ -22,3 +24,6 @@ Signed-off-by: Nikhil Prakash V <nprakash@codeaurora.org>
.ops = &q6v5_wcss_ipq8074_ops, .ops = &q6v5_wcss_ipq8074_ops,
.requires_force_stop = true, .requires_force_stop = true,
.need_mem_protection = true, .need_mem_protection = true,
--
2.37.2

View File

@ -1,7 +1,8 @@
From e99af92362058cfec70569057c1b15da9a1acb5f Mon Sep 17 00:00:00 2001 From 3bc5b97ecbb003e413ae76b332b0ccdba05ef6bc Mon Sep 17 00:00:00 2001
From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org> From: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
Date: Sat, 30 Jan 2021 10:50:09 +0530 Date: Sat, 30 Jan 2021 10:50:09 +0530
Subject: [PATCH] remoteproc: qcom: Update regmap offsets for halt register Subject: [PATCH 117/137] remoteproc: qcom: Update regmap offsets for halt
register
Fixed issue in reading halt-regs parameter from device-tree. Fixed issue in reading halt-regs parameter from device-tree.
@ -11,6 +12,8 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
drivers/remoteproc/qcom_q6v5_wcss.c | 22 ++++++++++++++-------- drivers/remoteproc/qcom_q6v5_wcss.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-) 1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5_wcss.c b/drivers/remoteproc/qcom_q6v5_wcss.c
index e32efdc660d2..16fc5a33adaf 100644
--- a/drivers/remoteproc/qcom_q6v5_wcss.c --- a/drivers/remoteproc/qcom_q6v5_wcss.c
+++ b/drivers/remoteproc/qcom_q6v5_wcss.c +++ b/drivers/remoteproc/qcom_q6v5_wcss.c
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
@ -30,7 +33,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
const char *ssr_name; const char *ssr_name;
const char *sysmon_name; const char *sysmon_name;
int ssctl_id; int ssctl_id;
@@ -874,10 +875,13 @@ static int q6v5_wcss_init_reset(struct q @@ -874,10 +875,13 @@ static int q6v5_wcss_init_reset(struct q6v5_wcss *wcss,
} }
} }
@ -48,7 +51,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
} }
return 0; return 0;
@@ -925,9 +929,9 @@ static int q6v5_wcss_init_mmio(struct q6 @@ -925,9 +929,9 @@ static int q6v5_wcss_init_mmio(struct q6v5_wcss *wcss,
return -EINVAL; return -EINVAL;
} }
@ -61,7 +64,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
return 0; return 0;
} }
@@ -1174,6 +1178,7 @@ static const struct wcss_data wcss_ipq80 @@ -1174,6 +1178,7 @@ static const struct wcss_data wcss_ipq8074_res_init = {
.crash_reason_smem = WCSS_CRASH_REASON, .crash_reason_smem = WCSS_CRASH_REASON,
.aon_reset_required = true, .aon_reset_required = true,
.wcss_q6_reset_required = true, .wcss_q6_reset_required = true,
@ -69,7 +72,7 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
.ssr_name = "q6wcss", .ssr_name = "q6wcss",
.ops = &q6v5_wcss_ipq8074_ops, .ops = &q6v5_wcss_ipq8074_ops,
.requires_force_stop = true, .requires_force_stop = true,
@@ -1188,6 +1193,7 @@ static const struct wcss_data wcss_qcs40 @@ -1188,6 +1193,7 @@ static const struct wcss_data wcss_qcs404_res_init = {
.version = WCSS_QCS404, .version = WCSS_QCS404,
.aon_reset_required = false, .aon_reset_required = false,
.wcss_q6_reset_required = false, .wcss_q6_reset_required = false,
@ -77,3 +80,6 @@ Signed-off-by: Sricharan R <sricharan@codeaurora.org>
.ssr_name = "mpss", .ssr_name = "mpss",
.sysmon_name = "wcnss", .sysmon_name = "wcnss",
.ssctl_id = 0x12, .ssctl_id = 0x12,
--
2.37.2

View File

@ -0,0 +1,153 @@
From 24a47e4619d90266188d26be04c0c29854294f06 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 28 Apr 2022 14:58:16 +0200
Subject: [PATCH 118/137] drivers: thermal: tsens: Add support for combined
interrupt
Despite using tsens v2.3 IP, IPQ8074 and IPQ6018 only have one IRQ for
signaling both up/low and critical trips.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v7:
* Rebase to apply on next-20220818
Changes in v6:
* Check critical IRQ handler return, simplify up/low return
---
drivers/thermal/qcom/tsens-8960.c | 1 +
drivers/thermal/qcom/tsens-v0_1.c | 1 +
drivers/thermal/qcom/tsens-v1.c | 1 +
drivers/thermal/qcom/tsens-v2.c | 1 +
drivers/thermal/qcom/tsens.c | 38 ++++++++++++++++++++++++++-----
drivers/thermal/qcom/tsens.h | 2 ++
6 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c
index 67c1748cdf73..ee584e5b07e5 100644
--- a/drivers/thermal/qcom/tsens-8960.c
+++ b/drivers/thermal/qcom/tsens-8960.c
@@ -269,6 +269,7 @@ static const struct tsens_ops ops_8960 = {
static struct tsens_features tsens_8960_feat = {
.ver_major = VER_0,
.crit_int = 0,
+ .combo_int = 0,
.adc = 1,
.srot_split = 0,
.max_sensors = 11,
diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index f136cb350238..6effb822bf3c 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -539,6 +539,7 @@ static int calibrate_9607(struct tsens_priv *priv)
static struct tsens_features tsens_v0_1_feat = {
.ver_major = VER_0_1,
.crit_int = 0,
+ .combo_int = 0,
.adc = 1,
.srot_split = 1,
.max_sensors = 11,
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
index 573e261ccca7..a4f561a6e582 100644
--- a/drivers/thermal/qcom/tsens-v1.c
+++ b/drivers/thermal/qcom/tsens-v1.c
@@ -302,6 +302,7 @@ static int calibrate_8976(struct tsens_priv *priv)
static struct tsens_features tsens_v1_feat = {
.ver_major = VER_1_X,
.crit_int = 0,
+ .combo_int = 0,
.adc = 1,
.srot_split = 1,
.max_sensors = 11,
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index b293ed32174b..129cdb247381 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -31,6 +31,7 @@
static struct tsens_features tsens_v2_feat = {
.ver_major = VER_2_X,
.crit_int = 1,
+ .combo_int = 0,
.adc = 0,
.srot_split = 1,
.max_sensors = 16,
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 99a8d9f3e03c..11172afbc5da 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -531,6 +531,27 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
return IRQ_HANDLED;
}
+/**
+ * tsens_combined_irq_thread - Threaded interrupt handler for combined interrupts
+ * @irq: irq number
+ * @data: tsens controller private data
+ *
+ * Handle the combined interrupt as if it were 2 separate interrupts, so call the
+ * critical handler first and then the up/low one.
+ *
+ * Return: IRQ_HANDLED
+ */
+static irqreturn_t tsens_combined_irq_thread(int irq, void *data)
+{
+ irqreturn_t ret;
+
+ ret = tsens_critical_irq_thread(irq, data);
+ if (ret != IRQ_HANDLED)
+ return ret;
+
+ return tsens_irq_thread(irq, data);
+}
+
static int tsens_set_trips(void *_sensor, int low, int high)
{
struct tsens_sensor *s = _sensor;
@@ -1075,13 +1096,18 @@ static int tsens_register(struct tsens_priv *priv)
tsens_mC_to_hw(priv->sensor, 0));
}
- ret = tsens_register_irq(priv, "uplow", tsens_irq_thread);
- if (ret < 0)
- return ret;
+ if (priv->feat->combo_int) {
+ ret = tsens_register_irq(priv, "combined",
+ tsens_combined_irq_thread);
+ } else {
+ ret = tsens_register_irq(priv, "uplow", tsens_irq_thread);
+ if (ret < 0)
+ return ret;
- if (priv->feat->crit_int)
- ret = tsens_register_irq(priv, "critical",
- tsens_critical_irq_thread);
+ if (priv->feat->crit_int)
+ ret = tsens_register_irq(priv, "critical",
+ tsens_critical_irq_thread);
+ }
return ret;
}
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index 1471a2c00f15..4614177944d6 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -495,6 +495,7 @@ enum regfield_ids {
* struct tsens_features - Features supported by the IP
* @ver_major: Major number of IP version
* @crit_int: does the IP support critical interrupts?
+ * @combo_int: does the IP use one IRQ for up, low and critical thresholds?
* @adc: do the sensors only output adc code (instead of temperature)?
* @srot_split: does the IP neatly splits the register space into SROT and TM,
* with SROT only being available to secure boot firmware?
@@ -504,6 +505,7 @@ enum regfield_ids {
struct tsens_features {
unsigned int ver_major;
unsigned int crit_int:1;
+ unsigned int combo_int:1;
unsigned int adc:1;
unsigned int srot_split:1;
unsigned int has_watchdog:1;
--
2.37.2

View File

@ -0,0 +1,115 @@
From f035a370b770831f1c4a5d5b5b4387391ee3f71a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 28 Apr 2022 19:06:29 +0200
Subject: [PATCH 119/137] drivers: thermal: tsens: allow configuring min and
max trips
IPQ8074 and IPQ6018 dont support negative trip temperatures and support
up to 204 degrees C as the max trip temperature.
So, instead of always setting the -40 as min and 120 degrees C as max
allow it to be configured as part of the features.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/thermal/qcom/tsens-8960.c | 2 ++
drivers/thermal/qcom/tsens-v0_1.c | 2 ++
drivers/thermal/qcom/tsens-v1.c | 2 ++
drivers/thermal/qcom/tsens-v2.c | 2 ++
drivers/thermal/qcom/tsens.c | 4 ++--
drivers/thermal/qcom/tsens.h | 4 ++++
6 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/qcom/tsens-8960.c b/drivers/thermal/qcom/tsens-8960.c
index ee584e5b07e5..4585904fb380 100644
--- a/drivers/thermal/qcom/tsens-8960.c
+++ b/drivers/thermal/qcom/tsens-8960.c
@@ -273,6 +273,8 @@ static struct tsens_features tsens_8960_feat = {
.adc = 1,
.srot_split = 0,
.max_sensors = 11,
+ .trip_min_temp = -40000,
+ .trip_max_temp = 120000,
};
struct tsens_plat_data data_8960 = {
diff --git a/drivers/thermal/qcom/tsens-v0_1.c b/drivers/thermal/qcom/tsens-v0_1.c
index 6effb822bf3c..2c203ff374e6 100644
--- a/drivers/thermal/qcom/tsens-v0_1.c
+++ b/drivers/thermal/qcom/tsens-v0_1.c
@@ -543,6 +543,8 @@ static struct tsens_features tsens_v0_1_feat = {
.adc = 1,
.srot_split = 1,
.max_sensors = 11,
+ .trip_min_temp = -40000,
+ .trip_max_temp = 120000,
};
static const struct reg_field tsens_v0_1_regfields[MAX_REGFIELDS] = {
diff --git a/drivers/thermal/qcom/tsens-v1.c b/drivers/thermal/qcom/tsens-v1.c
index a4f561a6e582..1d7f8a80bd13 100644
--- a/drivers/thermal/qcom/tsens-v1.c
+++ b/drivers/thermal/qcom/tsens-v1.c
@@ -306,6 +306,8 @@ static struct tsens_features tsens_v1_feat = {
.adc = 1,
.srot_split = 1,
.max_sensors = 11,
+ .trip_min_temp = -40000,
+ .trip_max_temp = 120000,
};
static const struct reg_field tsens_v1_regfields[MAX_REGFIELDS] = {
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index 129cdb247381..9babc69bfd22 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -35,6 +35,8 @@ static struct tsens_features tsens_v2_feat = {
.adc = 0,
.srot_split = 1,
.max_sensors = 16,
+ .trip_min_temp = -40000,
+ .trip_max_temp = 120000,
};
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 11172afbc5da..e11861581970 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -572,8 +572,8 @@ static int tsens_set_trips(void *_sensor, int low, int high)
dev_dbg(dev, "[%u] %s: proposed thresholds: (%d:%d)\n",
hw_id, __func__, low, high);
- cl_high = clamp_val(high, -40000, 120000);
- cl_low = clamp_val(low, -40000, 120000);
+ cl_high = clamp_val(high, priv->feat->trip_min_temp, priv->feat->trip_max_temp);
+ cl_low = clamp_val(low, priv->feat->trip_min_temp, priv->feat->trip_max_temp);
high_val = tsens_mC_to_hw(s, cl_high);
low_val = tsens_mC_to_hw(s, cl_low);
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index 4614177944d6..747004476347 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -501,6 +501,8 @@ enum regfield_ids {
* with SROT only being available to secure boot firmware?
* @has_watchdog: does this IP support watchdog functionality?
* @max_sensors: maximum sensors supported by this version of the IP
+ * @trip_min_temp: minimum trip temperature supported by this version of the IP
+ * @trip_max_temp: maximum trip temperature supported by this version of the IP
*/
struct tsens_features {
unsigned int ver_major;
@@ -510,6 +512,8 @@ struct tsens_features {
unsigned int srot_split:1;
unsigned int has_watchdog:1;
unsigned int max_sensors;
+ int trip_min_temp;
+ int trip_max_temp;
};
/**
--
2.37.2

View File

@ -0,0 +1,81 @@
From ffc91d0fc802e58f44c7f888f44643847b6dfa3a Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 28 Apr 2022 20:26:13 +0200
Subject: [PATCH 120/137] drivers: thermal: tsens: add IPQ8074 support
Qualcomm IPQ8074 uses tsens v2.3 IP, however unlike other tsens v2 IP
it only has one IRQ, that is used for up/low as well as critical.
It also does not support negative trip temperatures.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
drivers/thermal/qcom/tsens-v2.c | 17 +++++++++++++++++
drivers/thermal/qcom/tsens.c | 3 +++
drivers/thermal/qcom/tsens.h | 2 +-
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/tsens-v2.c b/drivers/thermal/qcom/tsens-v2.c
index 9babc69bfd22..29a61d2d6ca3 100644
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -39,6 +39,17 @@ static struct tsens_features tsens_v2_feat = {
.trip_max_temp = 120000,
};
+static struct tsens_features ipq8074_feat = {
+ .ver_major = VER_2_X,
+ .crit_int = 1,
+ .combo_int = 1,
+ .adc = 0,
+ .srot_split = 1,
+ .max_sensors = 16,
+ .trip_min_temp = 0,
+ .trip_max_temp = 204000,
+};
+
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
/* ----- SROT ------ */
/* VERSION */
@@ -104,6 +115,12 @@ struct tsens_plat_data data_tsens_v2 = {
.fields = tsens_v2_regfields,
};
+struct tsens_plat_data data_ipq8074 = {
+ .ops = &ops_generic_v2,
+ .feat = &ipq8074_feat,
+ .fields = tsens_v2_regfields,
+};
+
/* Kept around for backward compatibility with old msm8996.dtsi */
struct tsens_plat_data data_8996 = {
.num_sensors = 13,
diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index e11861581970..60b65bd2e7a3 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -990,6 +990,9 @@ static const struct of_device_id tsens_table[] = {
{
.compatible = "qcom,ipq8064-tsens",
.data = &data_8960,
+ }, {
+ .compatible = "qcom,ipq8074-tsens",
+ .data = &data_ipq8074,
}, {
.compatible = "qcom,mdm9607-tsens",
.data = &data_9607,
diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h
index 747004476347..8dd990d944ad 100644
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -599,6 +599,6 @@ extern struct tsens_plat_data data_8916, data_8939, data_8974, data_9607;
extern struct tsens_plat_data data_tsens_v1, data_8976;
/* TSENS v2 targets */
-extern struct tsens_plat_data data_8996, data_tsens_v2;
+extern struct tsens_plat_data data_8996, data_ipq8074, data_tsens_v2;
#endif /* __QCOM_TSENS_H__ */
--
2.37.2

View File

@ -1,7 +1,7 @@
From bf718a63d90b0921064892fa0e4dcf3db5233b1a Mon Sep 17 00:00:00 2001 From 1cdc1eaed3ea5b2cab82dee4c72c3cea23356ca6 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com> From: Robert Marko <robimarko@gmail.com>
Date: Fri, 24 Dec 2021 20:33:59 +0100 Date: Fri, 24 Dec 2021 20:33:59 +0100
Subject: [PATCH] arm64: dts: ipq8074: add thermal nodes Subject: [PATCH 121/137] arm64: dts: ipq8074: add thermal nodes
IPQ8074 has a tsens v2.3.0 peripheral which monitors IPQ8074 has a tsens v2.3.0 peripheral which monitors
temperatures around the various subsystems on the temperatures around the various subsystems on the
@ -12,13 +12,18 @@ CPU cooling will come in later patches after CPU frequency
scaling is supported. scaling is supported.
Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v5:
* Rebase to apply on next-20220708
--- ---
arch/arm64/boot/dts/qcom/ipq8074.dtsi | 96 +++++++++++++++++++++++++++ arch/arm64/boot/dts/qcom/ipq8074.dtsi | 96 +++++++++++++++++++++++++++
1 file changed, 96 insertions(+) 1 file changed, 96 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
index 019c8e302273..9707136f08e1 100644
--- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi
+++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi
@@ -332,6 +332,16 @@ @@ -310,6 +310,16 @@ prng: rng@e3000 {
status = "disabled"; status = "disabled";
}; };
@ -27,17 +32,17 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ reg = <0x4a9000 0x1000>, /* TM */ + reg = <0x4a9000 0x1000>, /* TM */
+ <0x4a8000 0x1000>; /* SROT */ + <0x4a8000 0x1000>; /* SROT */
+ interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "uplow"; + interrupt-names = "combined";
+ #qcom,sensors = <16>; + #qcom,sensors = <16>;
+ #thermal-sensor-cells = <1>; + #thermal-sensor-cells = <1>;
+ }; + };
+ +
cryptobam: dma@704000 { cryptobam: dma-controller@704000 {
compatible = "qcom,bam-v1.7.0"; compatible = "qcom,bam-v1.7.0";
reg = <0x00704000 0x20000>; reg = <0x00704000 0x20000>;
@@ -1093,4 +1103,90 @@ @@ -920,4 +930,90 @@ timer {
status = "disabled"; <GIC_PPI 4 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
}; <GIC_PPI 1 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
}; };
+ +
+ thermal-zones { + thermal-zones {
@ -126,3 +131,6 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
+ }; + };
+ }; + };
}; };
--
2.37.2

View File

@ -1,99 +0,0 @@
From b7bf74840dcffd209d4fc26a6d16d669bcda8f1d Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Fri, 20 Nov 2020 13:52:43 +0100
Subject: [PATCH] thermal: qcom: tsens: Add IPQ8074 support
Qualcomm IPQ807x SoC-s use tsens v2.3.0 IP, but they
only have one interrupt and not a dedicated critical interrupt.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/thermal/qcom/tsens-v2.c | 14 ++++++++++++++
drivers/thermal/qcom/tsens.c | 27 ++++++++++++++++++---------
drivers/thermal/qcom/tsens.h | 2 +-
3 files changed, 33 insertions(+), 10 deletions(-)
--- a/drivers/thermal/qcom/tsens-v2.c
+++ b/drivers/thermal/qcom/tsens-v2.c
@@ -36,6 +36,14 @@ static struct tsens_features tsens_v2_fe
.max_sensors = 16,
};
+static struct tsens_features tsens_ipq8074_feat = {
+ .ver_major = VER_2_X,
+ .crit_int = 0,
+ .adc = 0,
+ .srot_split = 1,
+ .max_sensors = 16,
+};
+
static const struct reg_field tsens_v2_regfields[MAX_REGFIELDS] = {
/* ----- SROT ------ */
/* VERSION */
@@ -101,6 +109,12 @@ struct tsens_plat_data data_tsens_v2 = {
.fields = tsens_v2_regfields,
};
+struct tsens_plat_data data_tsens_ipq8074 = {
+ .ops = &ops_generic_v2,
+ .feat = &tsens_ipq8074_feat,
+ .fields = tsens_v2_regfields,
+};
+
/* Kept around for backward compatibility with old msm8996.dtsi */
struct tsens_plat_data data_8996 = {
.num_sensors = 13,
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -325,16 +325,22 @@ static int tsens_read_irq_state(struct t
ret = regmap_field_read(priv->rf[LOW_INT_MASK_0 + hw_id], &d->low_irq_mask);
if (ret)
return ret;
- ret = regmap_field_read(priv->rf[CRIT_INT_CLEAR_0 + hw_id],
- &d->crit_irq_clear);
- if (ret)
- return ret;
- ret = regmap_field_read(priv->rf[CRIT_INT_MASK_0 + hw_id],
- &d->crit_irq_mask);
- if (ret)
- return ret;
+ if (priv->feat->crit_int) {
+ ret = regmap_field_read(priv->rf[CRIT_INT_CLEAR_0 + hw_id],
+ &d->crit_irq_clear);
+ if (ret)
+ return ret;
+ ret = regmap_field_read(priv->rf[CRIT_INT_MASK_0 + hw_id],
+ &d->crit_irq_mask);
+ if (ret)
+ return ret;
- d->crit_thresh = tsens_hw_to_mC(s, CRIT_THRESH_0 + hw_id);
+ d->crit_thresh = tsens_hw_to_mC(s, CRIT_THRESH_0 + hw_id);
+ } else {
+ d->crit_irq_clear = 0;
+ d->crit_irq_mask = 0;
+ d->crit_thresh = 0;
+ }
} else {
/* No mask register on older TSENS */
d->up_irq_mask = 0;
@@ -993,6 +999,9 @@ static const struct of_device_id tsens_t
}, {
.compatible = "qcom,tsens-v2",
.data = &data_tsens_v2,
+ }, {
+ .compatible = "qcom,ipq8074-tsens",
+ .data = &data_tsens_ipq8074,
},
{}
};
--- a/drivers/thermal/qcom/tsens.h
+++ b/drivers/thermal/qcom/tsens.h
@@ -593,6 +593,6 @@ extern struct tsens_plat_data data_8916,
extern struct tsens_plat_data data_tsens_v1, data_8976;
/* TSENS v2 targets */
-extern struct tsens_plat_data data_8996, data_tsens_v2;
+extern struct tsens_plat_data data_8996, data_tsens_v2, data_tsens_ipq8074;
#endif /* __QCOM_TSENS_H__ */

View File

@ -0,0 +1,30 @@
From 0d176e7d075fb7deeb1b137fec56304a402f2f25 Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 19 May 2022 14:51:53 +0200
Subject: [PATCH 122/137] mfd: qcom-spmi-pmic: add support for PMP8074
Add support for PMP8074 PMIC which is a companion PMIC for the Qualcomm
IPQ8074 SoC-s.
It shares the same subtype identifier as PM8901.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/mfd/qcom-spmi-pmic.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index 1cacc00aa6c9..664de43df690 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -76,6 +76,7 @@ static const struct of_device_id pmic_spmi_id_table[] = {
{ .compatible = "qcom,pmi8994", .data = (void *)PMI8994_SUBTYPE },
{ .compatible = "qcom,pmi8998", .data = (void *)PMI8998_SUBTYPE },
{ .compatible = "qcom,pmk8002", .data = (void *)PMK8002_SUBTYPE },
+ { .compatible = "qcom,pmp8074", .data = (void *)PM8901_SUBTYPE },
{ .compatible = "qcom,smb2351", .data = (void *)SMB2351_SUBTYPE },
{ .compatible = "qcom,spmi-pmic", .data = (void *)COMMON_SUBTYPE },
{ }
--
2.37.2

View File

@ -0,0 +1,164 @@
From 2abf33c722b4ade9438dc91a652f294ada68a50e Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Wed, 18 May 2022 16:36:42 +0200
Subject: [PATCH 123/137] arm64: dts: qcom: add PMP8074 DTSI
PMP8074 is a companion PMIC to the Qualcomm IPQ8074 series that is
controlled via SPMI.
Add DTSI for it providing GPIO, regulator, RTC and VADC support.
RTC is disabled by default as there is no built-in battery so it will
loose time unless board vendor added a battery, so make it optional.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
Changes in v7:
* Dual license with BSD-3-Clause
* Use "-" instead of underscores in node names
Changes in v6:
* Add RTC and GPIO nodes
Changes in v5:
* Remove #address-cells and #size-cells as they are not required for
regulator subnodes
---
arch/arm64/boot/dts/qcom/pmp8074.dtsi | 125 ++++++++++++++++++++++++++
1 file changed, 125 insertions(+)
create mode 100644 arch/arm64/boot/dts/qcom/pmp8074.dtsi
diff --git a/arch/arm64/boot/dts/qcom/pmp8074.dtsi b/arch/arm64/boot/dts/qcom/pmp8074.dtsi
new file mode 100644
index 000000000000..ceb2e6358b3d
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/pmp8074.dtsi
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
+
+#include <dt-bindings/spmi/spmi.h>
+#include <dt-bindings/iio/qcom,spmi-vadc.h>
+
+&spmi_bus {
+ pmic@0 {
+ compatible = "qcom,pmp8074", "qcom,spmi-pmic";
+ reg = <0x0 SPMI_USID>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pmp8074_adc: adc@3100 {
+ compatible = "qcom,spmi-adc-rev2";
+ reg = <0x3100>;
+ interrupts = <0x0 0x31 0x0 IRQ_TYPE_EDGE_RISING>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ #io-channel-cells = <1>;
+
+ ref-gnd@0 {
+ reg = <ADC5_REF_GND>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ vref-1p25@1 {
+ reg = <ADC5_1P25VREF>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ vref-vadc@2 {
+ reg = <ADC5_VREF_VADC>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ pmic_die: die-temp@6 {
+ reg = <ADC5_DIE_TEMP>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ xo_therm: xo-temp@76 {
+ reg = <ADC5_XO_THERM_100K_PU>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ pa_therm1: thermistor1@77 {
+ reg = <ADC5_AMUX_THM1_100K_PU>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ pa_therm2: thermistor2@78 {
+ reg = <ADC5_AMUX_THM2_100K_PU>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ pa_therm3: thermistor3@79 {
+ reg = <ADC5_AMUX_THM3_100K_PU>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ qcom,pre-scaling = <1 1>;
+ };
+
+ vph-pwr@131 {
+ reg = <ADC5_VPH_PWR>;
+ qcom,pre-scaling = <1 3>;
+ };
+ };
+
+ pmp8074_rtc: rtc@6000 {
+ compatible = "qcom,pm8941-rtc";
+ reg = <0x6000>;
+ reg-names = "rtc", "alarm";
+ interrupts = <0x0 0x61 0x1 IRQ_TYPE_NONE>;
+ allow-set-time;
+ status = "disabled";
+ };
+
+ pmp8074_gpios: gpio@c000 {
+ compatible = "qcom,pmp8074-gpio", "qcom,spmi-gpio";
+ reg = <0xc000>;
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-ranges = <&pmp8074_gpios 0 0 12>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+ };
+
+ pmic@1 {
+ compatible = "qcom,pmp8074", "qcom,spmi-pmic";
+ reg = <0x1 SPMI_USID>;
+
+ regulators {
+ compatible = "qcom,pmp8074-regulators";
+
+ s3: s3 {
+ regulator-name = "vdd_s3";
+ regulator-min-microvolt = <592000>;
+ regulator-max-microvolt = <1064000>;
+ regulator-always-on;
+ regulator-boot-on;
+ };
+
+ s4: s4 {
+ regulator-name = "vdd_s4";
+ regulator-min-microvolt = <712000>;
+ regulator-max-microvolt = <992000>;
+ regulator-always-on;
+ regulator-boot-on;
+ };
+
+ l11: l11 {
+ regulator-name = "l11";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <3300000>;
+ };
+ };
+ };
+};
--
2.37.2

Some files were not shown because too many files have changed in this diff Show More