* linux-next: manual merge of the akpm tree with the bpf tree
From: Stephen Rothwell @ 2019-02-12 6:14 UTC (permalink / raw)
To: Andrew Morton, Daniel Borkmann, Alexei Starovoitov, Networking
Cc: Linux Next Mailing List, Linux Kernel Mailing List,
Davidlohr Bueso
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
Hi all,
Today's linux-next merge of the akpm tree got a conflict in:
net/xdp/xdp_umem.c
between commit:
e451eb510684 ("xsk: share the mmap_sem for page pinning")
from the bpf tree and patch:
"net/xdp/xdp_umem.c: do not use mmap_sem"
from the akpm tree.
I fixed it up (I dropped the akpm tree patch) and can carry the fix as
necessary. This is now fixed as far as linux-next is concerned, but any
non trivial conflicts should be mentioned to your upstream maintainer
when your tree is submitted for merging. You may also want to consider
cooperating with the maintainer of the conflicting tree to minimise any
particularly complex conflicts.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* [Patch net] team: avoid complex list operations in team_nl_cmd_options_set()
From: Cong Wang @ 2019-02-12 5:59 UTC (permalink / raw)
To: netdev
Cc: Cong Wang, syzbot+4d4af685432dc0e56c91,
syzbot+68ee510075cf64260cc4, Jiri Pirko, Paolo Abeni
The current opt_inst_list operations inside team_nl_cmd_options_set()
is too complex to track:
LIST_HEAD(opt_inst_list);
nla_for_each_nested(...) {
list_for_each_entry(opt_inst, &team->option_inst_list, list) {
if (__team_option_inst_tmp_find(&opt_inst_list, opt_inst))
continue;
list_add(&opt_inst->tmp_list, &opt_inst_list);
}
}
team_nl_send_event_options_get(team, &opt_inst_list);
as while we retrieve 'opt_inst' from team->option_inst_list, it could
be added to the local 'opt_inst_list' for multiple times. The
__team_option_inst_tmp_find() doesn't work, as the setter
team_mode_option_set() still calls team->ops.exit() which uses
->tmp_list too in __team_options_change_check().
Simplify the list operations by moving the 'opt_inst_list' and
team_nl_send_event_options_get() into the nla_for_each_nested() loop so
that it can be guranteed that we won't insert a same list entry for
multiple times. Therefore, __team_option_inst_tmp_find() can be removed
too.
Fixes: 4fb0534fb7bb ("team: avoid adding twice the same option to the event list")
Fixes: 2fcdb2c9e659 ("team: allow to send multiple set events in one message")
Reported-by: syzbot+4d4af685432dc0e56c91@syzkaller.appspotmail.com
Reported-by: syzbot+68ee510075cf64260cc4@syzkaller.appspotmail.com
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
drivers/net/team/team.c | 27 +++++----------------------
1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index afd9d25d1992..958f1cf67282 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -256,17 +256,6 @@ static void __team_option_inst_mark_removed_port(struct team *team,
}
}
-static bool __team_option_inst_tmp_find(const struct list_head *opts,
- const struct team_option_inst *needle)
-{
- struct team_option_inst *opt_inst;
-
- list_for_each_entry(opt_inst, opts, tmp_list)
- if (opt_inst == needle)
- return true;
- return false;
-}
-
static int __team_options_register(struct team *team,
const struct team_option *option,
size_t option_count)
@@ -2460,7 +2449,6 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
int err = 0;
int i;
struct nlattr *nl_option;
- LIST_HEAD(opt_inst_list);
rtnl_lock();
@@ -2480,6 +2468,7 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
struct nlattr *opt_attrs[TEAM_ATTR_OPTION_MAX + 1];
struct nlattr *attr;
struct nlattr *attr_data;
+ LIST_HEAD(opt_inst_list);
enum team_option_type opt_type;
int opt_port_ifindex = 0; /* != 0 for per-port options */
u32 opt_array_index = 0;
@@ -2584,23 +2573,17 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
if (err)
goto team_put;
opt_inst->changed = true;
-
- /* dumb/evil user-space can send us duplicate opt,
- * keep only the last one
- */
- if (__team_option_inst_tmp_find(&opt_inst_list,
- opt_inst))
- continue;
-
list_add(&opt_inst->tmp_list, &opt_inst_list);
}
if (!opt_found) {
err = -ENOENT;
goto team_put;
}
- }
- err = team_nl_send_event_options_get(team, &opt_inst_list);
+ err = team_nl_send_event_options_get(team, &opt_inst_list);
+ if (err)
+ break;
+ }
team_put:
team_nl_team_put(team);
--
2.20.1
^ permalink raw reply related
* Re: [PATCH net-next 1/1] flow_offload: Fix flow action infrastructure
From: David Miller @ 2019-02-12 5:31 UTC (permalink / raw)
To: elibr; +Cc: netdev, roid, pablo, jiri, saeedm
In-Reply-To: <20190211075259.39058-1-elibr@mellanox.com>
From: Eli Britstein <elibr@mellanox.com>
Date: Mon, 11 Feb 2019 09:52:59 +0200
> Implementation of macro "flow_action_for_each" introduced in
> commit e3ab786b42535 ("flow_offload: add flow action infrastructure")
> and used in commit 738678817573c ("drivers: net: use flow action
> infrastructure") iterated the first item twice and did not reach the
> last one. Fix it.
>
> Fixes: e3ab786b42535 ("flow_offload: add flow action infrastructure")
> Fixes: 738678817573c ("drivers: net: use flow action infrastructure")
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] Documentation: fix some freescale dpio-driver.rst warnings
From: David Miller @ 2019-02-12 5:29 UTC (permalink / raw)
To: rdunlap
Cc: netdev, stuyoder, laurentiu.tudor, ruxandra.radulescu,
madalin.bucur, linux-doc
In-Reply-To: <99c9792a-7218-76d9-9b53-8477afa69f79@infradead.org>
From: Randy Dunlap <rdunlap@infradead.org>
Date: Sun, 10 Feb 2019 22:32:42 -0800
> From: Randy Dunlap <rdunlap@infradead.org>
>
> Fix markup warnings for one list by using correct list syntax.
> Fix markup warnings for another list by using blank lines before the
> list.
>
> Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst:30: WARNING: Unexpected indentation.
> Documentation/networking/device_drivers/freescale/dpaa2/dpio-driver.rst:143: WARNING: Unexpected indentation.
>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Applied, thanks.
^ permalink raw reply
* Re: [net] tipc: fix link session and re-establish issues
From: David Miller @ 2019-02-12 5:26 UTC (permalink / raw)
To: tuong.t.lien; +Cc: jon.maloy, ying.xue, netdev, tipc-discussion
In-Reply-To: <20190211062943.4864-1-tuong.t.lien@dektech.com.au>
From: Tuong Lien <tuong.t.lien@dektech.com.au>
Date: Mon, 11 Feb 2019 13:29:43 +0700
> When a link endpoint is re-created (e.g. after a node reboot or
> interface reset), the link session number is varied by random, the peer
> endpoint will be synced with this new session number before the link is
> re-established.
>
> However, there is a shortcoming in this mechanism that can lead to the
> link never re-established or faced with a failure then. It happens when
> the peer endpoint is ready in ESTABLISHING state, the 'peer_session' as
> well as the 'in_session' flag have been set, but suddenly this link
> endpoint leaves. When it comes back with a random session number, there
> are two situations possible:
>
> 1/ If the random session number is larger than (or equal to) the
> previous one, the peer endpoint will be updated with this new session
> upon receipt of a RESET_MSG from this endpoint, and the link can be re-
> established as normal. Otherwise, all the RESET_MSGs from this endpoint
> will be rejected by the peer. In turn, when this link endpoint receives
> one ACTIVATE_MSG from the peer, it will move to ESTABLISHED and start
> to send STATE_MSGs, but again these messages will be dropped by the
> peer due to wrong session.
> The peer link endpoint can still become ESTABLISHED after receiving a
> traffic message from this endpoint (e.g. a BCAST_PROTOCOL or
> NAME_DISTRIBUTOR), but since all the STATE_MSGs are invalid, the link
> will be forced down sooner or later!
>
> Even in case the random session number is larger than the previous one,
> it can be that the ACTIVATE_MSG from the peer arrives first, and this
> link endpoint moves quickly to ESTABLISHED without sending out any
> RESET_MSG yet. Consequently, the peer link will not be updated with the
> new session number, and the same link failure scenario as above will
> happen.
>
> 2/ Another situation can be that, the peer link endpoint was reset due
> to any reasons in the meantime, its link state was set to RESET from
> ESTABLISHING but still in session, i.e. the 'in_session' flag is not
> reset...
> Now, if the random session number from this endpoint is less than the
> previous one, all the RESET_MSGs from this endpoint will be rejected by
> the peer. In the other direction, when this link endpoint receives a
> RESET_MSG from the peer, it moves to ESTABLISHING and starts to send
> ACTIVATE_MSGs, but all these messages will be rejected by the peer too.
> As a result, the link cannot be re-established but gets stuck with this
> link endpoint in state ESTABLISHING and the peer in RESET!
>
> Solution:
> ===========
>
> This link endpoint should not go directly to ESTABLISHED when getting
> ACTIVATE_MSG from the peer which may belong to the old session if the
> link was re-created. To ensure the session to be correct before the
> link is re-established, the peer endpoint in ESTABLISHING state will
> send back the last session number in ACTIVATE_MSG for a verification at
> this endpoint. Then, if needed, a new and more appropriate session
> number will be regenerated to force a re-synch first.
>
> In addition, when a link in ESTABLISHING state is reset, its state will
> move to RESET according to the link FSM, along with resetting the
> 'in_session' flag (and the other data) as a normal link reset, it will
> also be deleted if requested.
>
> The solution is backward compatible.
>
> Acked-by: Jon Maloy <jon.maloy@ericsson.com>
> Acked-by: Ying Xue <ying.xue@windriver.com>
> Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Applied.
^ permalink raw reply
* Re: [PATCH bpf-next 4/4] selftests/bpf: Test static data relocation
From: Alexei Starovoitov @ 2019-02-12 5:01 UTC (permalink / raw)
To: Joe Stringer; +Cc: bpf, netdev, daniel, ast
In-Reply-To: <20190212004729.535-5-joe@wand.net.nz>
On Mon, Feb 11, 2019 at 04:47:29PM -0800, Joe Stringer wrote:
> Add tests for libbpf relocation of static variable references into the
> .data and .bss sections of the ELF.
>
> Signed-off-by: Joe Stringer <joe@wand.net.nz>
...
> +#define __fetch(x) (__u32)(&(x))
> +
> +static __u32 static_bss = 0; /* Reloc reference to .bss section */
> +static __u32 static_data = 42; /* Reloc reference to .data section */
> +
> +/**
> + * Load a u32 value from a static variable into a map, for the userland test
> + * program to validate.
> + */
> +SEC("static_data_load")
> +int load_static_data(struct __sk_buff *skb)
> +{
> + __u32 key, value;
> +
> + key = 0;
> + value = __fetch(static_bss);
If we proceed with this approach we will not be able to add support
for normal 'value = static_bss;' C code in the future.
Let's figure out the way to do it right from the start.
Support for global and static variables is must have feature to add asap,
but let's not cut the corner like this.
We did such hacks in the past and every time it came back to bite us.
^ permalink raw reply
* Re: [PATCH bpf-next v9 7/7] selftests: bpf: add test_lwt_ip_encap selftest
From: Alexei Starovoitov @ 2019-02-12 4:41 UTC (permalink / raw)
To: David Ahern
Cc: Peter Oskolkov, Alexei Starovoitov, Daniel Borkmann,
Network Development, Peter Oskolkov, Willem de Bruijn
In-Reply-To: <da9a2e62-a83f-f192-5c29-03d73317f2e5@gmail.com>
On Mon, Feb 11, 2019 at 8:40 PM David Ahern <dsahern@gmail.com> wrote:
>
> On 2/11/19 9:39 PM, Alexei Starovoitov wrote:
> > This needs one more rebase on top of Jiong's makefile changes.
> > Other than this it looks great.
> > Thanks!
>
> needs more than that. just sent comments about patch 5.
yep. just saw your comment. agree.
^ permalink raw reply
* Re: [PATCH bpf-next v9 7/7] selftests: bpf: add test_lwt_ip_encap selftest
From: David Ahern @ 2019-02-12 4:40 UTC (permalink / raw)
To: Alexei Starovoitov, Peter Oskolkov
Cc: Alexei Starovoitov, Daniel Borkmann, netdev, Peter Oskolkov,
Willem de Bruijn
In-Reply-To: <20190212043938.xln5tkoerpovvkcl@ast-mbp>
On 2/11/19 9:39 PM, Alexei Starovoitov wrote:
> This needs one more rebase on top of Jiong's makefile changes.
> Other than this it looks great.
> Thanks!
needs more than that. just sent comments about patch 5.
^ permalink raw reply
* Re: [PATCH net-next v2 0/5] devlink: minor tweaks to reported device info
From: David Miller @ 2019-02-12 4:40 UTC (permalink / raw)
To: jakub.kicinski; +Cc: jiri, netdev, oss-drivers
In-Reply-To: <20190211033531.12928-1-jakub.kicinski@netronome.com>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Sun, 10 Feb 2019 19:35:26 -0800
> This series contains two minor touch ups for devlink code. First
> || is corrected to && in the ethtool compat code. Next patch
> decreases the stack allocation size.
>
> On the nfp side after further discussions with the manufacturing
> team we decided to realign the serial number contents slightly and
> rename one of the other fields from "vendor" to "mfr", short for
> "manufacture".
>
> v2: - add patch 3 - move board maker as a generic attribute.
Series applied, thanks Jakub.
^ permalink raw reply
* Re: [PATCH bpf-next v9 5/7] bpf: add handling of BPF_LWT_REROUTE to lwt_bpf.c
From: David Ahern @ 2019-02-12 4:39 UTC (permalink / raw)
To: Peter Oskolkov, Alexei Starovoitov, Daniel Borkmann, netdev
Cc: Peter Oskolkov, Willem de Bruijn
In-Reply-To: <20190212004249.219268-6-posk@google.com>
On 2/11/19 5:42 PM, Peter Oskolkov wrote:
> @@ -88,6 +90,35 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt,
> return ret;
> }
>
> +static int bpf_lwt_input_reroute(struct sk_buff *skb)
> +{
> + int err = -EINVAL;
> +
> + if (skb->protocol == htons(ETH_P_IP)) {
> + struct iphdr *iph = ip_hdr(skb);
> +
> + err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
> + iph->tos, skb_dst(skb)->dev);
> + } else if (skb->protocol == htons(ETH_P_IPV6)) {
> +#if IS_ENABLED(CONFIG_IPV6)
> + err = ipv6_stub->ipv6_route_input(skb);
> +#else
> + pr_warn_once("BPF_LWT_REROUTE input: IPV6 not available\n");
> +#endif
The stub defines ipv6_route_input when IPv6 is not enabled.
addrconf_core.o is compiled in if NET is enabled irregardless of
CONFIG_IPV6. ie., you don't need the IS_ENABLED check here.
If a bpf program pushes a v6 header the stub returns -EAFNOSUPPORT based
on patch 4.
> + } else {
> + pr_warn_once("BPF_LWT_REROUTE input: unsupported proto %d\n",
> + skb->protocol);
You don't need a warn on here; just return -EAFNOSUPPORT.
> + }
> +
> + if (err)
> + goto err;
> + return dst_input(skb);
> +
> +err:
> + kfree_skb(skb);
> + return err;
> +}
> +
> static int bpf_input(struct sk_buff *skb)
> {
> struct dst_entry *dst = skb_dst(skb);
> @@ -99,6 +130,8 @@ static int bpf_input(struct sk_buff *skb)
> ret = run_lwt_bpf(skb, &bpf->in, dst, NO_REDIRECT);
> if (ret < 0)
> return ret;
> + if (ret == BPF_LWT_REROUTE)
> + return bpf_lwt_input_reroute(skb);
> }
>
> if (unlikely(!dst->lwtstate->orig_input)) {
> @@ -148,6 +181,95 @@ static int xmit_check_hhlen(struct sk_buff *skb)
> return 0;
> }
>
> +static int bpf_lwt_xmit_reroute(struct sk_buff *skb)
> +{
> + struct net_device *l3mdev = l3mdev_master_dev_rcu(skb_dst(skb)->dev);
> + int oif = l3mdev ? l3mdev->ifindex : 0;
> + struct dst_entry *dst = NULL;
> + struct sock *sk;
> + struct net *net;
> + bool ipv4;
> + int err;
> +
> + if (skb->protocol == htons(ETH_P_IP)) {
> + ipv4 = true;
> + } else if (skb->protocol == htons(ETH_P_IPV6)) {
> + ipv4 = false;
> + } else {
> + pr_warn_once("BPF_LWT_REROUTE xmit: unsupported proto %d\n",
> + skb->protocol);
same here - no warn on.
> + return -EINVAL;
> + }
> +
> + sk = sk_to_full_sk(skb->sk);
> + if (sk) {
> + if (sk->sk_bound_dev_if)
> + oif = sk->sk_bound_dev_if;
> + net = sock_net(sk);
> + } else {
> + net = dev_net(skb_dst(skb)->dev);
> + }
> +
> + if (ipv4) {
> + struct iphdr *iph = ip_hdr(skb);
> + struct flowi4 fl4 = {};
> + struct rtable *rt;
> +
> + fl4.flowi4_oif = oif;
> + fl4.flowi4_mark = skb->mark;
> + fl4.flowi4_uid = sock_net_uid(net, sk);
> + fl4.flowi4_tos = RT_TOS(iph->tos);
> + fl4.flowi4_flags = FLOWI_FLAG_ANYSRC;
> + fl4.flowi4_proto = iph->protocol;
> + fl4.daddr = iph->daddr;
> + fl4.saddr = iph->saddr;
> +
> + rt = ip_route_output_key(net, &fl4);
> + if (IS_ERR(rt) || rt->dst.error)
> + return -EINVAL;
> + dst = &rt->dst;
> + } else {
> +#if IS_ENABLED(CONFIG_IPV6)
> + struct ipv6hdr *iph6 = ipv6_hdr(skb);
> + struct flowi6 fl6 = {};
> +
> + fl6.flowi6_oif = oif;
> + fl6.flowi6_mark = skb->mark;
> + fl6.flowi6_uid = sock_net_uid(net, sk);
> + fl6.flowlabel = ip6_flowinfo(iph6);
> + fl6.flowi6_proto = iph6->nexthdr;
> + fl6.daddr = iph6->daddr;
> + fl6.saddr = iph6->saddr;
> +
> + err = ipv6_stub->ipv6_dst_lookup(net, skb->sk, &dst, &fl6);
> + if (err || IS_ERR(dst) || dst->error)
> + return -EINVAL;
> +#else
> + pr_warn_once("BPF_LWT_REROUTE xmit: IPV6 not available\n");
> + return -EINVAL;
> +#endif
No #if .. #endif needed. The stub handles it.
^ permalink raw reply
* Re: [PATCH bpf-next v9 7/7] selftests: bpf: add test_lwt_ip_encap selftest
From: Alexei Starovoitov @ 2019-02-12 4:39 UTC (permalink / raw)
To: Peter Oskolkov
Cc: Alexei Starovoitov, Daniel Borkmann, netdev, Peter Oskolkov,
David Ahern, Willem de Bruijn
In-Reply-To: <20190212004249.219268-8-posk@google.com>
On Mon, Feb 11, 2019 at 04:42:49PM -0800, Peter Oskolkov wrote:
> This patch adds a bpf self-test to cover BPF_LWT_ENCAP_IP mode
> in bpf_lwt_push_encap.
>
> Covered:
> - encapping in LWT_IN and LWT_XMIT
> - IPv4 and IPv6
>
> A follow-up patch will add GSO and VRF-enabled tests.
>
> Signed-off-by: Peter Oskolkov <posk@google.com>
> ---
> tools/testing/selftests/bpf/Makefile | 5 +-
> .../testing/selftests/bpf/test_lwt_ip_encap.c | 85 +++++
> .../selftests/bpf/test_lwt_ip_encap.sh | 311 ++++++++++++++++++
> 3 files changed, 399 insertions(+), 2 deletions(-)
> create mode 100644 tools/testing/selftests/bpf/test_lwt_ip_encap.c
> create mode 100755 tools/testing/selftests/bpf/test_lwt_ip_encap.sh
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index c7e1e3255448..3ebd41a0c253 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -36,7 +36,7 @@ BPF_OBJ_FILES = \
> get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
> test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
> xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
> - test_sock_fields_kern.o
> + test_sock_fields_kern.o test_lwt_ip_encap.o
This needs one more rebase on top of Jiong's makefile changes.
Other than this it looks great.
Thanks!
^ permalink raw reply
* Re: [PATCH v2] net: fix IPv6 prefix route residue
From: David Miller @ 2019-02-12 4:38 UTC (permalink / raw)
To: liuzhiqiang26
Cc: kuznet, yoshfuji, 0xeffeff, edumazet, netdev, mingfangsen,
zhangwenhao8, wangxiaogang3, zhoukang7, dsahern, thaller,
maowenan
In-Reply-To: <131bd64c-1484-39c3-d813-dde47ff4198c@huawei.com>
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Date: Mon, 11 Feb 2019 10:57:46 +0800
> From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
>
> Follow those steps:
> # ip addr add 2001:123::1/32 dev eth0
> # ip addr add 2001:123:456::2/64 dev eth0
> # ip addr del 2001:123::1/32 dev eth0
> # ip addr del 2001:123:456::2/64 dev eth0
> and then prefix route of 2001:123::1/32 will still exist.
>
> This is because ipv6_prefix_equal in check_cleanup_prefix_route
> func does not check whether two IPv6 addresses have the same
> prefix length. If the prefix of one address starts with another
> shorter address prefix, even though their prefix lengths are
> different, the return value of ipv6_prefix_equal is true.
>
> Here I add a check of whether two addresses have the same prefix
> to decide whether their prefixes are equal.
>
> Fixes: 5b84efecb7d9 ("ipv6 addrconf: don't cleanup prefix route
> for IFA_F_NOPREFIXROUTE")
> Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
> Reported-by: Wenhao Zhang <zhangwenhao8@huawei.com>
Applied and queued up for -stable.
Please do not split up long Fixes: tag lines, keep the entire tag on
one line only.
I fixed it up for you this time.
Thanks.
^ permalink raw reply
* Re: [PATCH bpf-next v2 0/4] selftests: bpf: improve bpf object file rules
From: Alexei Starovoitov @ 2019-02-12 4:34 UTC (permalink / raw)
To: Jiong Wang; +Cc: daniel, netdev, oss-drivers
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>
On Mon, Feb 11, 2019 at 12:01:17PM +0000, Jiong Wang wrote:
> This set improves bpf object file related rules in selftests Makefile.
> - tell git to ignore the build dir "alu32".
> - extend sub-register mode compilation to all bpf object files to give
> LLVM compiler bpf back-end more exercise.
> - auto-generate bpf kernel object file list.
> - relax sub-register mode compilation criteria.
>
> v1 -> v2:
> - rename "kern_progs" to "progs". (Alexei)
> - spin a new patch to remove build server kernel requirement for
> sub-register mode compilation (Alexei)
> - rebase on top of KaFai’s latest "test_sock_fields" patch set.
Looks great. Both test_progs and test_progs_32 are passing for me.
Applied to bpf-next. Thanks!
^ permalink raw reply
* [v3, 7/9] ptp: add QorIQ PTP support for ENETC
From: Yangbo Lu @ 2019-02-12 4:24 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
This patch is to add QorIQ PTP support for ENETC.
ENETC PTP driver which is a PCI driver for same
1588 timer IP block will reuse QorIQ PTP driver.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Chanbges for v2:
- None.
Chanbges for v3:
- None.
---
drivers/ptp/Kconfig | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index aeb4a8b..7fe1863 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -43,7 +43,7 @@ config PTP_1588_CLOCK_DTE
config PTP_1588_CLOCK_QORIQ
tristate "Freescale QorIQ 1588 timer as PTP clock"
- depends on GIANFAR || FSL_DPAA_ETH
+ depends on GIANFAR || FSL_DPAA_ETH || FSL_ENETC || FSL_ENETC_VF
depends on PTP_1588_CLOCK
default y
help
--
1.7.1
^ permalink raw reply related
* [v3, 4/9] ptp_qoriq: add little enadian support
From: Yangbo Lu @ 2019-02-12 4:23 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
There is QorIQ 1588 timer IP block on the new ENETC Ethernet
controller. However it uses little endian mode which is different
with before. This patch is to add little endian support for the
driver by using "little-endian" dts node property.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- Rebased.
---
drivers/ptp/ptp_qoriq.c | 69 ++++++++++++++++++++++-----------------
drivers/ptp/ptp_qoriq_debugfs.c | 12 +++---
include/linux/fsl/ptp_qoriq.h | 21 ++++++++---
3 files changed, 60 insertions(+), 42 deletions(-)
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index db4f929..ed4dc39 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -43,8 +43,8 @@ static u64 tmr_cnt_read(struct ptp_qoriq *ptp_qoriq)
u64 ns;
u32 lo, hi;
- lo = qoriq_read(®s->ctrl_regs->tmr_cnt_l);
- hi = qoriq_read(®s->ctrl_regs->tmr_cnt_h);
+ lo = ptp_qoriq->read(®s->ctrl_regs->tmr_cnt_l);
+ hi = ptp_qoriq->read(®s->ctrl_regs->tmr_cnt_h);
ns = ((u64) hi) << 32;
ns |= lo;
return ns;
@@ -57,8 +57,8 @@ static void tmr_cnt_write(struct ptp_qoriq *ptp_qoriq, u64 ns)
u32 hi = ns >> 32;
u32 lo = ns & 0xffffffff;
- qoriq_write(®s->ctrl_regs->tmr_cnt_l, lo);
- qoriq_write(®s->ctrl_regs->tmr_cnt_h, hi);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_cnt_l, lo);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_cnt_h, hi);
}
/* Caller must hold ptp_qoriq->lock. */
@@ -73,8 +73,8 @@ static void set_alarm(struct ptp_qoriq *ptp_qoriq)
ns -= ptp_qoriq->tclk_period;
hi = ns >> 32;
lo = ns & 0xffffffff;
- qoriq_write(®s->alarm_regs->tmr_alarm1_l, lo);
- qoriq_write(®s->alarm_regs->tmr_alarm1_h, hi);
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm1_l, lo);
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm1_h, hi);
}
/* Caller must hold ptp_qoriq->lock. */
@@ -83,8 +83,8 @@ static void set_fipers(struct ptp_qoriq *ptp_qoriq)
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
set_alarm(ptp_qoriq);
- qoriq_write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
- qoriq_write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
+ ptp_qoriq->write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
+ ptp_qoriq->write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
}
static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
@@ -115,8 +115,8 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
event.index = index;
do {
- lo = qoriq_read(reg_etts_l);
- hi = qoriq_read(reg_etts_h);
+ lo = ptp_qoriq->read(reg_etts_l);
+ hi = ptp_qoriq->read(reg_etts_h);
if (update_event) {
event.timestamp = ((u64) hi) << 32;
@@ -124,7 +124,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
ptp_clock_event(ptp_qoriq->clock, &event);
}
- stat = qoriq_read(®s->ctrl_regs->tmr_stat);
+ stat = ptp_qoriq->read(®s->ctrl_regs->tmr_stat);
} while (ptp_qoriq->extts_fifo_support && (stat & valid));
return 0;
@@ -144,8 +144,8 @@ irqreturn_t ptp_qoriq_isr(int irq, void *priv)
spin_lock(&ptp_qoriq->lock);
- val = qoriq_read(®s->ctrl_regs->tmr_tevent);
- mask = qoriq_read(®s->ctrl_regs->tmr_temask);
+ val = ptp_qoriq->read(®s->ctrl_regs->tmr_tevent);
+ mask = ptp_qoriq->read(®s->ctrl_regs->tmr_temask);
spin_unlock(&ptp_qoriq->lock);
@@ -173,14 +173,14 @@ irqreturn_t ptp_qoriq_isr(int irq, void *priv)
ns = ptp_qoriq->alarm_value + ptp_qoriq->alarm_interval;
hi = ns >> 32;
lo = ns & 0xffffffff;
- qoriq_write(®s->alarm_regs->tmr_alarm2_l, lo);
- qoriq_write(®s->alarm_regs->tmr_alarm2_h, hi);
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm2_l, lo);
+ ptp_qoriq->write(®s->alarm_regs->tmr_alarm2_h, hi);
ptp_qoriq->alarm_value = ns;
} else {
spin_lock(&ptp_qoriq->lock);
- mask = qoriq_read(®s->ctrl_regs->tmr_temask);
+ mask = ptp_qoriq->read(®s->ctrl_regs->tmr_temask);
mask &= ~ALM2EN;
- qoriq_write(®s->ctrl_regs->tmr_temask, mask);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_temask, mask);
spin_unlock(&ptp_qoriq->lock);
ptp_qoriq->alarm_value = 0;
ptp_qoriq->alarm_interval = 0;
@@ -194,7 +194,7 @@ irqreturn_t ptp_qoriq_isr(int irq, void *priv)
}
if (ack) {
- qoriq_write(®s->ctrl_regs->tmr_tevent, ack);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_tevent, ack);
return IRQ_HANDLED;
} else
return IRQ_NONE;
@@ -229,7 +229,7 @@ int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
tmr_add = neg_adj ? tmr_add - diff : tmr_add + diff;
- qoriq_write(®s->ctrl_regs->tmr_add, tmr_add);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_add, tmr_add);
return 0;
}
@@ -326,15 +326,15 @@ int ptp_qoriq_enable(struct ptp_clock_info *ptp,
spin_lock_irqsave(&ptp_qoriq->lock, flags);
- mask = qoriq_read(®s->ctrl_regs->tmr_temask);
+ mask = ptp_qoriq->read(®s->ctrl_regs->tmr_temask);
if (on) {
mask |= bit;
- qoriq_write(®s->ctrl_regs->tmr_tevent, bit);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_tevent, bit);
} else {
mask &= ~bit;
}
- qoriq_write(®s->ctrl_regs->tmr_temask, mask);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_temask, mask);
spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
@@ -496,6 +496,14 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
return -ENODEV;
}
+ if (of_property_read_bool(node, "little-endian")) {
+ ptp_qoriq->read = qoriq_read_le;
+ ptp_qoriq->write = qoriq_write_le;
+ } else {
+ ptp_qoriq->read = qoriq_read_be;
+ ptp_qoriq->write = qoriq_write_be;
+ }
+
if (of_device_is_compatible(node, "fsl,fman-ptp-timer")) {
ptp_qoriq->regs.ctrl_regs = base + FMAN_CTRL_REGS_OFFSET;
ptp_qoriq->regs.alarm_regs = base + FMAN_ALARM_REGS_OFFSET;
@@ -519,13 +527,14 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
spin_lock_irqsave(&ptp_qoriq->lock, flags);
regs = &ptp_qoriq->regs;
- qoriq_write(®s->ctrl_regs->tmr_ctrl, tmr_ctrl);
- qoriq_write(®s->ctrl_regs->tmr_add, ptp_qoriq->tmr_add);
- qoriq_write(®s->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
- qoriq_write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
- qoriq_write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_ctrl, tmr_ctrl);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_add, ptp_qoriq->tmr_add);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
+ ptp_qoriq->write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
+ ptp_qoriq->write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
set_alarm(ptp_qoriq);
- qoriq_write(®s->ctrl_regs->tmr_ctrl, tmr_ctrl|FIPERST|RTPE|TE|FRD);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_ctrl,
+ tmr_ctrl|FIPERST|RTPE|TE|FRD);
spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
@@ -543,8 +552,8 @@ void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq)
{
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
- qoriq_write(®s->ctrl_regs->tmr_temask, 0);
- qoriq_write(®s->ctrl_regs->tmr_ctrl, 0);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_temask, 0);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_ctrl, 0);
ptp_qoriq_remove_debugfs(ptp_qoriq);
ptp_clock_unregister(ptp_qoriq->clock);
diff --git a/drivers/ptp/ptp_qoriq_debugfs.c b/drivers/ptp/ptp_qoriq_debugfs.c
index 3a70daf..e8dddce 100644
--- a/drivers/ptp/ptp_qoriq_debugfs.c
+++ b/drivers/ptp/ptp_qoriq_debugfs.c
@@ -11,7 +11,7 @@ static int ptp_qoriq_fiper1_lpbk_get(void *data, u64 *val)
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
- ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
+ ctrl = ptp_qoriq->read(®s->ctrl_regs->tmr_ctrl);
*val = ctrl & PP1L ? 1 : 0;
return 0;
@@ -23,13 +23,13 @@ static int ptp_qoriq_fiper1_lpbk_set(void *data, u64 val)
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
- ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
+ ctrl = ptp_qoriq->read(®s->ctrl_regs->tmr_ctrl);
if (val == 0)
ctrl &= ~PP1L;
else
ctrl |= PP1L;
- qoriq_write(®s->ctrl_regs->tmr_ctrl, ctrl);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_ctrl, ctrl);
return 0;
}
@@ -42,7 +42,7 @@ static int ptp_qoriq_fiper2_lpbk_get(void *data, u64 *val)
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
- ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
+ ctrl = ptp_qoriq->read(®s->ctrl_regs->tmr_ctrl);
*val = ctrl & PP2L ? 1 : 0;
return 0;
@@ -54,13 +54,13 @@ static int ptp_qoriq_fiper2_lpbk_set(void *data, u64 val)
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
- ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
+ ctrl = ptp_qoriq->read(®s->ctrl_regs->tmr_ctrl);
if (val == 0)
ctrl &= ~PP2L;
else
ctrl |= PP2L;
- qoriq_write(®s->ctrl_regs->tmr_ctrl, ctrl);
+ ptp_qoriq->write(®s->ctrl_regs->tmr_ctrl, ctrl);
return 0;
}
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 757aec3..1f8bb6a 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -157,21 +157,30 @@ struct ptp_qoriq {
u32 cksel;
u32 tmr_fiper1;
u32 tmr_fiper2;
+ u32 (*read)(unsigned __iomem *addr);
+ void (*write)(unsigned __iomem *addr, u32 val);
};
-static inline u32 qoriq_read(unsigned __iomem *addr)
+static inline u32 qoriq_read_be(unsigned __iomem *addr)
{
- u32 val;
-
- val = ioread32be(addr);
- return val;
+ return ioread32be(addr);
}
-static inline void qoriq_write(unsigned __iomem *addr, u32 val)
+static inline void qoriq_write_be(unsigned __iomem *addr, u32 val)
{
iowrite32be(val, addr);
}
+static inline u32 qoriq_read_le(unsigned __iomem *addr)
+{
+ return ioread32(addr);
+}
+
+static inline void qoriq_write_le(unsigned __iomem *addr, u32 val)
+{
+ iowrite32(val, addr);
+}
+
irqreturn_t ptp_qoriq_isr(int irq, void *priv);
int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
const struct ptp_clock_info caps);
--
1.7.1
^ permalink raw reply related
* [v3, 6/9] ptp_qoriq: fix register memory map
From: Yangbo Lu @ 2019-02-12 4:24 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
The 1588 timer on eTSEC Ethernet controller uses different
register memory map with DPAA Ethernet controller.
Now the new ENETC Ethernet controller uses same reigster
memory map with DPAA. To support ENETC, let's use register
memory map of DPAA/ENETC in default.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- None.
---
drivers/ptp/ptp_qoriq.c | 11 ++++++-----
include/linux/fsl/ptp_qoriq.h | 16 ++++++++--------
2 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index ed4dc39..42d3654 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -504,11 +504,12 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
ptp_qoriq->write = qoriq_write_be;
}
- if (of_device_is_compatible(node, "fsl,fman-ptp-timer")) {
- ptp_qoriq->regs.ctrl_regs = base + FMAN_CTRL_REGS_OFFSET;
- ptp_qoriq->regs.alarm_regs = base + FMAN_ALARM_REGS_OFFSET;
- ptp_qoriq->regs.fiper_regs = base + FMAN_FIPER_REGS_OFFSET;
- ptp_qoriq->regs.etts_regs = base + FMAN_ETTS_REGS_OFFSET;
+ /* The eTSEC uses differnt memory map with DPAA/ENETC */
+ if (of_device_is_compatible(node, "fsl,etsec-ptp")) {
+ ptp_qoriq->regs.ctrl_regs = base + ETSEC_CTRL_REGS_OFFSET;
+ ptp_qoriq->regs.alarm_regs = base + ETSEC_ALARM_REGS_OFFSET;
+ ptp_qoriq->regs.fiper_regs = base + ETSEC_FIPER_REGS_OFFSET;
+ ptp_qoriq->regs.etts_regs = base + ETSEC_ETTS_REGS_OFFSET;
} else {
ptp_qoriq->regs.ctrl_regs = base + CTRL_REGS_OFFSET;
ptp_qoriq->regs.alarm_regs = base + ALARM_REGS_OFFSET;
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 1f8bb6a..f127adb 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -58,15 +58,15 @@ struct ptp_qoriq_registers {
};
/* Offset definitions for the four register groups */
-#define CTRL_REGS_OFFSET 0x0
-#define ALARM_REGS_OFFSET 0x40
-#define FIPER_REGS_OFFSET 0x80
-#define ETTS_REGS_OFFSET 0xa0
-
-#define FMAN_CTRL_REGS_OFFSET 0x80
-#define FMAN_ALARM_REGS_OFFSET 0xb8
-#define FMAN_FIPER_REGS_OFFSET 0xd0
-#define FMAN_ETTS_REGS_OFFSET 0xe0
+#define ETSEC_CTRL_REGS_OFFSET 0x0
+#define ETSEC_ALARM_REGS_OFFSET 0x40
+#define ETSEC_FIPER_REGS_OFFSET 0x80
+#define ETSEC_ETTS_REGS_OFFSET 0xa0
+
+#define CTRL_REGS_OFFSET 0x80
+#define ALARM_REGS_OFFSET 0xb8
+#define FIPER_REGS_OFFSET 0xd0
+#define ETTS_REGS_OFFSET 0xe0
/* Bit definitions for the TMR_CTRL register */
--
1.7.1
^ permalink raw reply related
* [v3, 9/9] MAINTAINERS: add enetc_ptp driver into QorIQ PTP list
From: Yangbo Lu @ 2019-02-12 4:24 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
This patch to add enetc_ptp driver into QorIQ PTP list
for maintaining.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- None.
---
MAINTAINERS | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 604bca2..d6a8475 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6104,6 +6104,7 @@ FREESCALE QORIQ PTP CLOCK DRIVER
M: Yangbo Lu <yangbo.lu@nxp.com>
L: netdev@vger.kernel.org
S: Maintained
+F: drivers/net/ethernet/freescale/enetc/enetc_ptp.c
F: drivers/ptp/ptp_qoriq.c
F: drivers/ptp/ptp_qoriq_debugfs.c
F: include/linux/fsl/ptp_qoriq.h
--
1.7.1
^ permalink raw reply related
* [v3, 8/9] enetc: add PTP clock driver
From: Yangbo Lu @ 2019-02-12 4:24 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
This patch is to add PTP clock driver for ENETC.
The driver reused QorIQ PTP clock driver.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- Converted to use ptp_qoriq_free().
---
drivers/net/ethernet/freescale/enetc/Kconfig | 12 ++
drivers/net/ethernet/freescale/enetc/Makefile | 3 +
drivers/net/ethernet/freescale/enetc/enetc_hw.h | 5 +-
drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 144 ++++++++++++++++++++++
4 files changed, 162 insertions(+), 2 deletions(-)
create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_ptp.c
diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
index f9dd26f..8429f5c 100644
--- a/drivers/net/ethernet/freescale/enetc/Kconfig
+++ b/drivers/net/ethernet/freescale/enetc/Kconfig
@@ -17,3 +17,15 @@ config FSL_ENETC_VF
virtual function (VF) devices enabled by the ENETC PF driver.
If compiled as module (M), the module name is fsl-enetc-vf.
+
+config FSL_ENETC_PTP_CLOCK
+ tristate "ENETC PTP clock driver"
+ depends on PTP_1588_CLOCK_QORIQ && (FSL_ENETC || FSL_ENETC_VF)
+ default y
+ help
+ This driver adds support for using the ENETC 1588 timer
+ as a PTP clock. This clock is only useful if your PTP
+ programs are getting hardware time stamps on the PTP Ethernet
+ packets using the SO_TIMESTAMPING API.
+
+ If compiled as module (M), the module name is fsl-enetc-ptp.
diff --git a/drivers/net/ethernet/freescale/enetc/Makefile b/drivers/net/ethernet/freescale/enetc/Makefile
index 9529b01..6976602 100644
--- a/drivers/net/ethernet/freescale/enetc/Makefile
+++ b/drivers/net/ethernet/freescale/enetc/Makefile
@@ -13,3 +13,6 @@ fsl-enetc-vf-$(CONFIG_FSL_ENETC_VF) += enetc.o enetc_cbdr.o \
enetc_ethtool.o
fsl-enetc-vf-objs := enetc_vf.o $(fsl-enetc-vf-y)
endif
+
+obj-$(CONFIG_FSL_ENETC_PTP_CLOCK) += fsl-enetc-ptp.o
+fsl-enetc-ptp-$(CONFIG_FSL_ENETC_PTP_CLOCK) += enetc_ptp.o
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
index efa0b1a..df8eb88 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
@@ -4,8 +4,9 @@
#include <linux/bitops.h>
/* ENETC device IDs */
-#define ENETC_DEV_ID_PF 0xe100
-#define ENETC_DEV_ID_VF 0xef00
+#define ENETC_DEV_ID_PF 0xe100
+#define ENETC_DEV_ID_VF 0xef00
+#define ENETC_DEV_ID_PTP 0xee02
/* ENETC register block BAR */
#define ENETC_BAR_REGS 0
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_ptp.c b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
new file mode 100644
index 0000000..dc2f58a
--- /dev/null
+++ b/drivers/net/ethernet/freescale/enetc/enetc_ptp.c
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
+/* Copyright 2019 NXP */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/fsl/ptp_qoriq.h>
+
+#include "enetc.h"
+
+static struct ptp_clock_info enetc_ptp_caps = {
+ .owner = THIS_MODULE,
+ .name = "ENETC PTP clock",
+ .max_adj = 512000,
+ .n_alarm = 0,
+ .n_ext_ts = 2,
+ .n_per_out = 0,
+ .n_pins = 0,
+ .pps = 1,
+ .adjfine = ptp_qoriq_adjfine,
+ .adjtime = ptp_qoriq_adjtime,
+ .gettime64 = ptp_qoriq_gettime,
+ .settime64 = ptp_qoriq_settime,
+ .enable = ptp_qoriq_enable,
+};
+
+static int enetc_ptp_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ struct ptp_qoriq *ptp_qoriq;
+ void __iomem *base;
+ int err, len, n;
+
+ if (pdev->dev.of_node && !of_device_is_available(pdev->dev.of_node)) {
+ dev_info(&pdev->dev, "device is disabled, skipping\n");
+ return -ENODEV;
+ }
+
+ err = pci_enable_device_mem(pdev);
+ if (err) {
+ dev_err(&pdev->dev, "device enable failed\n");
+ return err;
+ }
+
+ /* set up for high or low dma */
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (err) {
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+ if (err) {
+ dev_err(&pdev->dev,
+ "DMA configuration failed: 0x%x\n", err);
+ goto err_dma;
+ }
+ }
+
+ err = pci_request_mem_regions(pdev, KBUILD_MODNAME);
+ if (err) {
+ dev_err(&pdev->dev, "pci_request_regions failed err=%d\n", err);
+ goto err_pci_mem_reg;
+ }
+
+ pci_set_master(pdev);
+
+ ptp_qoriq = kzalloc(sizeof(*ptp_qoriq), GFP_KERNEL);
+ if (!ptp_qoriq) {
+ err = -ENOMEM;
+ goto err_alloc_ptp;
+ }
+
+ len = pci_resource_len(pdev, ENETC_BAR_REGS);
+
+ base = ioremap(pci_resource_start(pdev, ENETC_BAR_REGS), len);
+ if (!base) {
+ err = -ENXIO;
+ dev_err(&pdev->dev, "ioremap() failed\n");
+ goto err_ioremap;
+ }
+
+ /* Allocate 1 interrupt */
+ n = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_MSIX);
+ if (n != 1) {
+ err = -EPERM;
+ goto err_irq;
+ }
+
+ ptp_qoriq->irq = pci_irq_vector(pdev, 0);
+
+ err = request_irq(ptp_qoriq->irq, ptp_qoriq_isr, 0, DRIVER, ptp_qoriq);
+ if (err) {
+ dev_err(&pdev->dev, "request_irq() failed!\n");
+ goto err_irq;
+ }
+
+ ptp_qoriq->dev = &pdev->dev;
+
+ err = ptp_qoriq_init(ptp_qoriq, base, enetc_ptp_caps);
+ if (err)
+ goto err_no_clock;
+
+ pci_set_drvdata(pdev, ptp_qoriq);
+
+ return 0;
+
+err_no_clock:
+ free_irq(ptp_qoriq->irq, ptp_qoriq);
+err_irq:
+ iounmap(base);
+err_ioremap:
+ kfree(ptp_qoriq);
+err_alloc_ptp:
+ pci_release_mem_regions(pdev);
+err_pci_mem_reg:
+err_dma:
+ pci_disable_device(pdev);
+
+ return err;
+}
+
+static void enetc_ptp_remove(struct pci_dev *pdev)
+{
+ struct ptp_qoriq *ptp_qoriq = pci_get_drvdata(pdev);
+
+ ptp_qoriq_free(ptp_qoriq);
+ kfree(ptp_qoriq);
+
+ pci_release_mem_regions(pdev);
+ pci_disable_device(pdev);
+}
+
+static const struct pci_device_id enetc_ptp_id_table[] = {
+ { PCI_DEVICE(PCI_VENDOR_ID_FREESCALE, ENETC_DEV_ID_PTP) },
+ { 0, } /* End of table. */
+};
+MODULE_DEVICE_TABLE(pci, enetc_ptp_id_table);
+
+static struct pci_driver enetc_ptp_driver = {
+ .name = KBUILD_MODNAME,
+ .id_table = enetc_ptp_id_table,
+ .probe = enetc_ptp_probe,
+ .remove = enetc_ptp_remove,
+};
+module_pci_driver(enetc_ptp_driver);
+
+MODULE_DESCRIPTION("ENETC PTP clock driver");
+MODULE_LICENSE("Dual BSD/GPL");
--
1.7.1
^ permalink raw reply related
* [v3, 1/9] ptp_qoriq: make structure/function names more consistent
From: Yangbo Lu @ 2019-02-12 4:23 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
Strings containing "ptp_qoriq" or "qoriq_ptp" which were used for
structure/function names were complained by users. Let's just use
the unique "ptp_qoriq" to make these names more consistent.
This patch is just to unify the names using "ptp_qoriq". It hasn't
changed any functions.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- Fixed build issue in gianfar/dpaa ethtool driver.
Changes for v3:
- None.
---
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +-
drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
drivers/ptp/ptp_qoriq.c | 288 ++++++++++----------
drivers/ptp/ptp_qoriq_debugfs.c | 36 ++--
include/linux/fsl/ptp_qoriq.h | 14 +-
5 files changed, 171 insertions(+), 171 deletions(-)
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index 6249711..bdee441 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -501,7 +501,7 @@ static int dpaa_get_ts_info(struct net_device *net_dev,
struct device_node *mac_node = dev->of_node;
struct device_node *fman_node = NULL, *ptp_node = NULL;
struct platform_device *ptp_dev = NULL;
- struct qoriq_ptp *ptp = NULL;
+ struct ptp_qoriq *ptp = NULL;
info->phc_index = -1;
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 241325c..27ed995 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -1492,7 +1492,7 @@ static int gfar_get_ts_info(struct net_device *dev,
struct gfar_private *priv = netdev_priv(dev);
struct platform_device *ptp_dev;
struct device_node *ptp_node;
- struct qoriq_ptp *ptp = NULL;
+ struct ptp_qoriq *ptp = NULL;
info->phc_index = -1;
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 43416b2..8c10d0f 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -37,10 +37,10 @@
* Register access functions
*/
-/* Caller must hold qoriq_ptp->lock. */
-static u64 tmr_cnt_read(struct qoriq_ptp *qoriq_ptp)
+/* Caller must hold ptp_qoriq->lock. */
+static u64 tmr_cnt_read(struct ptp_qoriq *ptp_qoriq)
{
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u64 ns;
u32 lo, hi;
@@ -51,10 +51,10 @@ static u64 tmr_cnt_read(struct qoriq_ptp *qoriq_ptp)
return ns;
}
-/* Caller must hold qoriq_ptp->lock. */
-static void tmr_cnt_write(struct qoriq_ptp *qoriq_ptp, u64 ns)
+/* Caller must hold ptp_qoriq->lock. */
+static void tmr_cnt_write(struct ptp_qoriq *ptp_qoriq, u64 ns)
{
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 hi = ns >> 32;
u32 lo = ns & 0xffffffff;
@@ -62,36 +62,36 @@ static void tmr_cnt_write(struct qoriq_ptp *qoriq_ptp, u64 ns)
qoriq_write(®s->ctrl_regs->tmr_cnt_h, hi);
}
-/* Caller must hold qoriq_ptp->lock. */
-static void set_alarm(struct qoriq_ptp *qoriq_ptp)
+/* Caller must hold ptp_qoriq->lock. */
+static void set_alarm(struct ptp_qoriq *ptp_qoriq)
{
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u64 ns;
u32 lo, hi;
- ns = tmr_cnt_read(qoriq_ptp) + 1500000000ULL;
+ ns = tmr_cnt_read(ptp_qoriq) + 1500000000ULL;
ns = div_u64(ns, 1000000000UL) * 1000000000ULL;
- ns -= qoriq_ptp->tclk_period;
+ ns -= ptp_qoriq->tclk_period;
hi = ns >> 32;
lo = ns & 0xffffffff;
qoriq_write(®s->alarm_regs->tmr_alarm1_l, lo);
qoriq_write(®s->alarm_regs->tmr_alarm1_h, hi);
}
-/* Caller must hold qoriq_ptp->lock. */
-static void set_fipers(struct qoriq_ptp *qoriq_ptp)
+/* Caller must hold ptp_qoriq->lock. */
+static void set_fipers(struct ptp_qoriq *ptp_qoriq)
{
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
- set_alarm(qoriq_ptp);
- qoriq_write(®s->fiper_regs->tmr_fiper1, qoriq_ptp->tmr_fiper1);
- qoriq_write(®s->fiper_regs->tmr_fiper2, qoriq_ptp->tmr_fiper2);
+ set_alarm(ptp_qoriq);
+ qoriq_write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
+ qoriq_write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
}
-static int extts_clean_up(struct qoriq_ptp *qoriq_ptp, int index,
+static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
bool update_event)
{
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
struct ptp_clock_event event;
void __iomem *reg_etts_l;
void __iomem *reg_etts_h;
@@ -122,11 +122,11 @@ static int extts_clean_up(struct qoriq_ptp *qoriq_ptp, int index,
if (update_event) {
event.timestamp = ((u64) hi) << 32;
event.timestamp |= lo;
- ptp_clock_event(qoriq_ptp->clock, &event);
+ ptp_clock_event(ptp_qoriq->clock, &event);
}
stat = qoriq_read(®s->ctrl_regs->tmr_stat);
- } while (qoriq_ptp->extts_fifo_support && (stat & valid));
+ } while (ptp_qoriq->extts_fifo_support && (stat & valid));
return 0;
}
@@ -137,61 +137,61 @@ static int extts_clean_up(struct qoriq_ptp *qoriq_ptp, int index,
static irqreturn_t isr(int irq, void *priv)
{
- struct qoriq_ptp *qoriq_ptp = priv;
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = priv;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
struct ptp_clock_event event;
u64 ns;
u32 ack = 0, lo, hi, mask, val, irqs;
- spin_lock(&qoriq_ptp->lock);
+ spin_lock(&ptp_qoriq->lock);
val = qoriq_read(®s->ctrl_regs->tmr_tevent);
mask = qoriq_read(®s->ctrl_regs->tmr_temask);
- spin_unlock(&qoriq_ptp->lock);
+ spin_unlock(&ptp_qoriq->lock);
irqs = val & mask;
if (irqs & ETS1) {
ack |= ETS1;
- extts_clean_up(qoriq_ptp, 0, true);
+ extts_clean_up(ptp_qoriq, 0, true);
}
if (irqs & ETS2) {
ack |= ETS2;
- extts_clean_up(qoriq_ptp, 1, true);
+ extts_clean_up(ptp_qoriq, 1, true);
}
if (irqs & ALM2) {
ack |= ALM2;
- if (qoriq_ptp->alarm_value) {
+ if (ptp_qoriq->alarm_value) {
event.type = PTP_CLOCK_ALARM;
event.index = 0;
- event.timestamp = qoriq_ptp->alarm_value;
- ptp_clock_event(qoriq_ptp->clock, &event);
+ event.timestamp = ptp_qoriq->alarm_value;
+ ptp_clock_event(ptp_qoriq->clock, &event);
}
- if (qoriq_ptp->alarm_interval) {
- ns = qoriq_ptp->alarm_value + qoriq_ptp->alarm_interval;
+ if (ptp_qoriq->alarm_interval) {
+ ns = ptp_qoriq->alarm_value + ptp_qoriq->alarm_interval;
hi = ns >> 32;
lo = ns & 0xffffffff;
qoriq_write(®s->alarm_regs->tmr_alarm2_l, lo);
qoriq_write(®s->alarm_regs->tmr_alarm2_h, hi);
- qoriq_ptp->alarm_value = ns;
+ ptp_qoriq->alarm_value = ns;
} else {
- spin_lock(&qoriq_ptp->lock);
+ spin_lock(&ptp_qoriq->lock);
mask = qoriq_read(®s->ctrl_regs->tmr_temask);
mask &= ~ALM2EN;
qoriq_write(®s->ctrl_regs->tmr_temask, mask);
- spin_unlock(&qoriq_ptp->lock);
- qoriq_ptp->alarm_value = 0;
- qoriq_ptp->alarm_interval = 0;
+ spin_unlock(&ptp_qoriq->lock);
+ ptp_qoriq->alarm_value = 0;
+ ptp_qoriq->alarm_interval = 0;
}
}
if (irqs & PP1) {
ack |= PP1;
event.type = PTP_CLOCK_PPS;
- ptp_clock_event(qoriq_ptp->clock, &event);
+ ptp_clock_event(ptp_qoriq->clock, &event);
}
if (ack) {
@@ -210,14 +210,14 @@ static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
u64 adj, diff;
u32 tmr_add;
int neg_adj = 0;
- struct qoriq_ptp *qoriq_ptp = container_of(ptp, struct qoriq_ptp, caps);
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
if (scaled_ppm < 0) {
neg_adj = 1;
scaled_ppm = -scaled_ppm;
}
- tmr_add = qoriq_ptp->tmr_add;
+ tmr_add = ptp_qoriq->tmr_add;
adj = tmr_add;
/* calculate diff as adj*(scaled_ppm/65536)/1000000
@@ -238,16 +238,16 @@ static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
s64 now;
unsigned long flags;
- struct qoriq_ptp *qoriq_ptp = container_of(ptp, struct qoriq_ptp, caps);
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
- spin_lock_irqsave(&qoriq_ptp->lock, flags);
+ spin_lock_irqsave(&ptp_qoriq->lock, flags);
- now = tmr_cnt_read(qoriq_ptp);
+ now = tmr_cnt_read(ptp_qoriq);
now += delta;
- tmr_cnt_write(qoriq_ptp, now);
- set_fipers(qoriq_ptp);
+ tmr_cnt_write(ptp_qoriq, now);
+ set_fipers(ptp_qoriq);
- spin_unlock_irqrestore(&qoriq_ptp->lock, flags);
+ spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
}
@@ -257,13 +257,13 @@ static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,
{
u64 ns;
unsigned long flags;
- struct qoriq_ptp *qoriq_ptp = container_of(ptp, struct qoriq_ptp, caps);
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
- spin_lock_irqsave(&qoriq_ptp->lock, flags);
+ spin_lock_irqsave(&ptp_qoriq->lock, flags);
- ns = tmr_cnt_read(qoriq_ptp);
+ ns = tmr_cnt_read(ptp_qoriq);
- spin_unlock_irqrestore(&qoriq_ptp->lock, flags);
+ spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
*ts = ns_to_timespec64(ns);
@@ -275,16 +275,16 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
{
u64 ns;
unsigned long flags;
- struct qoriq_ptp *qoriq_ptp = container_of(ptp, struct qoriq_ptp, caps);
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
ns = timespec64_to_ns(ts);
- spin_lock_irqsave(&qoriq_ptp->lock, flags);
+ spin_lock_irqsave(&ptp_qoriq->lock, flags);
- tmr_cnt_write(qoriq_ptp, ns);
- set_fipers(qoriq_ptp);
+ tmr_cnt_write(ptp_qoriq, ns);
+ set_fipers(ptp_qoriq);
- spin_unlock_irqrestore(&qoriq_ptp->lock, flags);
+ spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
}
@@ -292,8 +292,8 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{
- struct qoriq_ptp *qoriq_ptp = container_of(ptp, struct qoriq_ptp, caps);
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
unsigned long flags;
u32 bit, mask = 0;
@@ -311,7 +311,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
}
if (on)
- extts_clean_up(qoriq_ptp, rq->extts.index, false);
+ extts_clean_up(ptp_qoriq, rq->extts.index, false);
break;
case PTP_CLK_REQ_PPS:
@@ -321,7 +321,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
return -EOPNOTSUPP;
}
- spin_lock_irqsave(&qoriq_ptp->lock, flags);
+ spin_lock_irqsave(&ptp_qoriq->lock, flags);
mask = qoriq_read(®s->ctrl_regs->tmr_temask);
if (on) {
@@ -333,7 +333,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
qoriq_write(®s->ctrl_regs->tmr_temask, mask);
- spin_unlock_irqrestore(&qoriq_ptp->lock, flags);
+ spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
}
@@ -354,7 +354,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
};
/**
- * qoriq_ptp_nominal_freq - calculate nominal frequency according to
+ * ptp_qoriq_nominal_freq - calculate nominal frequency according to
* reference clock frequency
*
* @clk_src: reference clock frequency
@@ -365,7 +365,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
*
* Return the nominal frequency
*/
-static u32 qoriq_ptp_nominal_freq(u32 clk_src)
+static u32 ptp_qoriq_nominal_freq(u32 clk_src)
{
u32 remainder = 0;
@@ -385,9 +385,9 @@ static u32 qoriq_ptp_nominal_freq(u32 clk_src)
}
/**
- * qoriq_ptp_auto_config - calculate a set of default configurations
+ * ptp_qoriq_auto_config - calculate a set of default configurations
*
- * @qoriq_ptp: pointer to qoriq_ptp
+ * @ptp_qoriq: pointer to ptp_qoriq
* @node: pointer to device_node
*
* If below dts properties are not provided, this function will be
@@ -401,7 +401,7 @@ static u32 qoriq_ptp_nominal_freq(u32 clk_src)
*
* Return 0 if success
*/
-static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
+static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
struct device_node *node)
{
struct clk *clk;
@@ -411,7 +411,7 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
u32 remainder = 0;
u32 clk_src = 0;
- qoriq_ptp->cksel = DEFAULT_CKSEL;
+ ptp_qoriq->cksel = DEFAULT_CKSEL;
clk = of_clk_get(node, 0);
if (!IS_ERR(clk)) {
@@ -424,12 +424,12 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
return -EINVAL;
}
- nominal_freq = qoriq_ptp_nominal_freq(clk_src);
+ nominal_freq = ptp_qoriq_nominal_freq(clk_src);
if (!nominal_freq)
return -EINVAL;
- qoriq_ptp->tclk_period = 1000000000UL / nominal_freq;
- qoriq_ptp->tmr_prsc = DEFAULT_TMR_PRSC;
+ ptp_qoriq->tclk_period = 1000000000UL / nominal_freq;
+ ptp_qoriq->tmr_prsc = DEFAULT_TMR_PRSC;
/* Calculate initial frequency compensation value for TMR_ADD register.
* freq_comp = ceil(2^32 / freq_ratio)
@@ -440,171 +440,171 @@ static int qoriq_ptp_auto_config(struct qoriq_ptp *qoriq_ptp,
if (remainder)
freq_comp++;
- qoriq_ptp->tmr_add = freq_comp;
- qoriq_ptp->tmr_fiper1 = DEFAULT_FIPER1_PERIOD - qoriq_ptp->tclk_period;
- qoriq_ptp->tmr_fiper2 = DEFAULT_FIPER2_PERIOD - qoriq_ptp->tclk_period;
+ ptp_qoriq->tmr_add = freq_comp;
+ ptp_qoriq->tmr_fiper1 = DEFAULT_FIPER1_PERIOD - ptp_qoriq->tclk_period;
+ ptp_qoriq->tmr_fiper2 = DEFAULT_FIPER2_PERIOD - ptp_qoriq->tclk_period;
/* max_adj = 1000000000 * (freq_ratio - 1.0) - 1
* freq_ratio = reference_clock_freq / nominal_freq
*/
max_adj = 1000000000ULL * (clk_src - nominal_freq);
max_adj = div_u64(max_adj, nominal_freq) - 1;
- qoriq_ptp->caps.max_adj = max_adj;
+ ptp_qoriq->caps.max_adj = max_adj;
return 0;
}
-static int qoriq_ptp_probe(struct platform_device *dev)
+static int ptp_qoriq_probe(struct platform_device *dev)
{
struct device_node *node = dev->dev.of_node;
- struct qoriq_ptp *qoriq_ptp;
- struct qoriq_ptp_registers *regs;
+ struct ptp_qoriq *ptp_qoriq;
+ struct ptp_qoriq_registers *regs;
struct timespec64 now;
int err = -ENOMEM;
u32 tmr_ctrl;
unsigned long flags;
void __iomem *base;
- qoriq_ptp = kzalloc(sizeof(*qoriq_ptp), GFP_KERNEL);
- if (!qoriq_ptp)
+ ptp_qoriq = kzalloc(sizeof(*ptp_qoriq), GFP_KERNEL);
+ if (!ptp_qoriq)
goto no_memory;
err = -EINVAL;
- qoriq_ptp->dev = &dev->dev;
- qoriq_ptp->caps = ptp_qoriq_caps;
+ ptp_qoriq->dev = &dev->dev;
+ ptp_qoriq->caps = ptp_qoriq_caps;
- if (of_property_read_u32(node, "fsl,cksel", &qoriq_ptp->cksel))
- qoriq_ptp->cksel = DEFAULT_CKSEL;
+ if (of_property_read_u32(node, "fsl,cksel", &ptp_qoriq->cksel))
+ ptp_qoriq->cksel = DEFAULT_CKSEL;
if (of_property_read_bool(node, "fsl,extts-fifo"))
- qoriq_ptp->extts_fifo_support = true;
+ ptp_qoriq->extts_fifo_support = true;
else
- qoriq_ptp->extts_fifo_support = false;
+ ptp_qoriq->extts_fifo_support = false;
if (of_property_read_u32(node,
- "fsl,tclk-period", &qoriq_ptp->tclk_period) ||
+ "fsl,tclk-period", &ptp_qoriq->tclk_period) ||
of_property_read_u32(node,
- "fsl,tmr-prsc", &qoriq_ptp->tmr_prsc) ||
+ "fsl,tmr-prsc", &ptp_qoriq->tmr_prsc) ||
of_property_read_u32(node,
- "fsl,tmr-add", &qoriq_ptp->tmr_add) ||
+ "fsl,tmr-add", &ptp_qoriq->tmr_add) ||
of_property_read_u32(node,
- "fsl,tmr-fiper1", &qoriq_ptp->tmr_fiper1) ||
+ "fsl,tmr-fiper1", &ptp_qoriq->tmr_fiper1) ||
of_property_read_u32(node,
- "fsl,tmr-fiper2", &qoriq_ptp->tmr_fiper2) ||
+ "fsl,tmr-fiper2", &ptp_qoriq->tmr_fiper2) ||
of_property_read_u32(node,
- "fsl,max-adj", &qoriq_ptp->caps.max_adj)) {
+ "fsl,max-adj", &ptp_qoriq->caps.max_adj)) {
pr_warn("device tree node missing required elements, try automatic configuration\n");
- if (qoriq_ptp_auto_config(qoriq_ptp, node))
+ if (ptp_qoriq_auto_config(ptp_qoriq, node))
goto no_config;
}
err = -ENODEV;
- qoriq_ptp->irq = platform_get_irq(dev, 0);
+ ptp_qoriq->irq = platform_get_irq(dev, 0);
- if (qoriq_ptp->irq < 0) {
+ if (ptp_qoriq->irq < 0) {
pr_err("irq not in device tree\n");
goto no_node;
}
- if (request_irq(qoriq_ptp->irq, isr, IRQF_SHARED, DRIVER, qoriq_ptp)) {
+ if (request_irq(ptp_qoriq->irq, isr, IRQF_SHARED, DRIVER, ptp_qoriq)) {
pr_err("request_irq failed\n");
goto no_node;
}
- qoriq_ptp->rsrc = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!qoriq_ptp->rsrc) {
+ ptp_qoriq->rsrc = platform_get_resource(dev, IORESOURCE_MEM, 0);
+ if (!ptp_qoriq->rsrc) {
pr_err("no resource\n");
goto no_resource;
}
- if (request_resource(&iomem_resource, qoriq_ptp->rsrc)) {
+ if (request_resource(&iomem_resource, ptp_qoriq->rsrc)) {
pr_err("resource busy\n");
goto no_resource;
}
- spin_lock_init(&qoriq_ptp->lock);
+ spin_lock_init(&ptp_qoriq->lock);
- base = ioremap(qoriq_ptp->rsrc->start,
- resource_size(qoriq_ptp->rsrc));
+ base = ioremap(ptp_qoriq->rsrc->start,
+ resource_size(ptp_qoriq->rsrc));
if (!base) {
pr_err("ioremap ptp registers failed\n");
goto no_ioremap;
}
- qoriq_ptp->base = base;
+ ptp_qoriq->base = base;
if (of_device_is_compatible(node, "fsl,fman-ptp-timer")) {
- qoriq_ptp->regs.ctrl_regs = base + FMAN_CTRL_REGS_OFFSET;
- qoriq_ptp->regs.alarm_regs = base + FMAN_ALARM_REGS_OFFSET;
- qoriq_ptp->regs.fiper_regs = base + FMAN_FIPER_REGS_OFFSET;
- qoriq_ptp->regs.etts_regs = base + FMAN_ETTS_REGS_OFFSET;
+ ptp_qoriq->regs.ctrl_regs = base + FMAN_CTRL_REGS_OFFSET;
+ ptp_qoriq->regs.alarm_regs = base + FMAN_ALARM_REGS_OFFSET;
+ ptp_qoriq->regs.fiper_regs = base + FMAN_FIPER_REGS_OFFSET;
+ ptp_qoriq->regs.etts_regs = base + FMAN_ETTS_REGS_OFFSET;
} else {
- qoriq_ptp->regs.ctrl_regs = base + CTRL_REGS_OFFSET;
- qoriq_ptp->regs.alarm_regs = base + ALARM_REGS_OFFSET;
- qoriq_ptp->regs.fiper_regs = base + FIPER_REGS_OFFSET;
- qoriq_ptp->regs.etts_regs = base + ETTS_REGS_OFFSET;
+ ptp_qoriq->regs.ctrl_regs = base + CTRL_REGS_OFFSET;
+ ptp_qoriq->regs.alarm_regs = base + ALARM_REGS_OFFSET;
+ ptp_qoriq->regs.fiper_regs = base + FIPER_REGS_OFFSET;
+ ptp_qoriq->regs.etts_regs = base + ETTS_REGS_OFFSET;
}
ktime_get_real_ts64(&now);
- ptp_qoriq_settime(&qoriq_ptp->caps, &now);
+ ptp_qoriq_settime(&ptp_qoriq->caps, &now);
tmr_ctrl =
- (qoriq_ptp->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT |
- (qoriq_ptp->cksel & CKSEL_MASK) << CKSEL_SHIFT;
+ (ptp_qoriq->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT |
+ (ptp_qoriq->cksel & CKSEL_MASK) << CKSEL_SHIFT;
- spin_lock_irqsave(&qoriq_ptp->lock, flags);
+ spin_lock_irqsave(&ptp_qoriq->lock, flags);
- regs = &qoriq_ptp->regs;
+ regs = &ptp_qoriq->regs;
qoriq_write(®s->ctrl_regs->tmr_ctrl, tmr_ctrl);
- qoriq_write(®s->ctrl_regs->tmr_add, qoriq_ptp->tmr_add);
- qoriq_write(®s->ctrl_regs->tmr_prsc, qoriq_ptp->tmr_prsc);
- qoriq_write(®s->fiper_regs->tmr_fiper1, qoriq_ptp->tmr_fiper1);
- qoriq_write(®s->fiper_regs->tmr_fiper2, qoriq_ptp->tmr_fiper2);
- set_alarm(qoriq_ptp);
+ qoriq_write(®s->ctrl_regs->tmr_add, ptp_qoriq->tmr_add);
+ qoriq_write(®s->ctrl_regs->tmr_prsc, ptp_qoriq->tmr_prsc);
+ qoriq_write(®s->fiper_regs->tmr_fiper1, ptp_qoriq->tmr_fiper1);
+ qoriq_write(®s->fiper_regs->tmr_fiper2, ptp_qoriq->tmr_fiper2);
+ set_alarm(ptp_qoriq);
qoriq_write(®s->ctrl_regs->tmr_ctrl, tmr_ctrl|FIPERST|RTPE|TE|FRD);
- spin_unlock_irqrestore(&qoriq_ptp->lock, flags);
+ spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
- qoriq_ptp->clock = ptp_clock_register(&qoriq_ptp->caps, &dev->dev);
- if (IS_ERR(qoriq_ptp->clock)) {
- err = PTR_ERR(qoriq_ptp->clock);
+ ptp_qoriq->clock = ptp_clock_register(&ptp_qoriq->caps, &dev->dev);
+ if (IS_ERR(ptp_qoriq->clock)) {
+ err = PTR_ERR(ptp_qoriq->clock);
goto no_clock;
}
- qoriq_ptp->phc_index = ptp_clock_index(qoriq_ptp->clock);
+ ptp_qoriq->phc_index = ptp_clock_index(ptp_qoriq->clock);
- ptp_qoriq_create_debugfs(qoriq_ptp);
- platform_set_drvdata(dev, qoriq_ptp);
+ ptp_qoriq_create_debugfs(ptp_qoriq);
+ platform_set_drvdata(dev, ptp_qoriq);
return 0;
no_clock:
- iounmap(qoriq_ptp->base);
+ iounmap(ptp_qoriq->base);
no_ioremap:
- release_resource(qoriq_ptp->rsrc);
+ release_resource(ptp_qoriq->rsrc);
no_resource:
- free_irq(qoriq_ptp->irq, qoriq_ptp);
+ free_irq(ptp_qoriq->irq, ptp_qoriq);
no_config:
no_node:
- kfree(qoriq_ptp);
+ kfree(ptp_qoriq);
no_memory:
return err;
}
-static int qoriq_ptp_remove(struct platform_device *dev)
+static int ptp_qoriq_remove(struct platform_device *dev)
{
- struct qoriq_ptp *qoriq_ptp = platform_get_drvdata(dev);
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = platform_get_drvdata(dev);
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
qoriq_write(®s->ctrl_regs->tmr_temask, 0);
qoriq_write(®s->ctrl_regs->tmr_ctrl, 0);
- ptp_qoriq_remove_debugfs(qoriq_ptp);
- ptp_clock_unregister(qoriq_ptp->clock);
- iounmap(qoriq_ptp->base);
- release_resource(qoriq_ptp->rsrc);
- free_irq(qoriq_ptp->irq, qoriq_ptp);
- kfree(qoriq_ptp);
+ ptp_qoriq_remove_debugfs(ptp_qoriq);
+ ptp_clock_unregister(ptp_qoriq->clock);
+ iounmap(ptp_qoriq->base);
+ release_resource(ptp_qoriq->rsrc);
+ free_irq(ptp_qoriq->irq, ptp_qoriq);
+ kfree(ptp_qoriq);
return 0;
}
@@ -616,16 +616,16 @@ static int qoriq_ptp_remove(struct platform_device *dev)
};
MODULE_DEVICE_TABLE(of, match_table);
-static struct platform_driver qoriq_ptp_driver = {
+static struct platform_driver ptp_qoriq_driver = {
.driver = {
.name = "ptp_qoriq",
.of_match_table = match_table,
},
- .probe = qoriq_ptp_probe,
- .remove = qoriq_ptp_remove,
+ .probe = ptp_qoriq_probe,
+ .remove = ptp_qoriq_remove,
};
-module_platform_driver(qoriq_ptp_driver);
+module_platform_driver(ptp_qoriq_driver);
MODULE_AUTHOR("Richard Cochran <richardcochran@gmail.com>");
MODULE_DESCRIPTION("PTP clock for Freescale QorIQ 1588 timer");
diff --git a/drivers/ptp/ptp_qoriq_debugfs.c b/drivers/ptp/ptp_qoriq_debugfs.c
index 9705950..3a70daf 100644
--- a/drivers/ptp/ptp_qoriq_debugfs.c
+++ b/drivers/ptp/ptp_qoriq_debugfs.c
@@ -7,8 +7,8 @@
static int ptp_qoriq_fiper1_lpbk_get(void *data, u64 *val)
{
- struct qoriq_ptp *qoriq_ptp = data;
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = data;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
@@ -19,8 +19,8 @@ static int ptp_qoriq_fiper1_lpbk_get(void *data, u64 *val)
static int ptp_qoriq_fiper1_lpbk_set(void *data, u64 val)
{
- struct qoriq_ptp *qoriq_ptp = data;
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = data;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
@@ -38,8 +38,8 @@ static int ptp_qoriq_fiper1_lpbk_set(void *data, u64 val)
static int ptp_qoriq_fiper2_lpbk_get(void *data, u64 *val)
{
- struct qoriq_ptp *qoriq_ptp = data;
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = data;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
@@ -50,8 +50,8 @@ static int ptp_qoriq_fiper2_lpbk_get(void *data, u64 *val)
static int ptp_qoriq_fiper2_lpbk_set(void *data, u64 val)
{
- struct qoriq_ptp *qoriq_ptp = data;
- struct qoriq_ptp_registers *regs = &qoriq_ptp->regs;
+ struct ptp_qoriq *ptp_qoriq = data;
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
u32 ctrl;
ctrl = qoriq_read(®s->ctrl_regs->tmr_ctrl);
@@ -67,35 +67,35 @@ static int ptp_qoriq_fiper2_lpbk_set(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(ptp_qoriq_fiper2_fops, ptp_qoriq_fiper2_lpbk_get,
ptp_qoriq_fiper2_lpbk_set, "%llu\n");
-void ptp_qoriq_create_debugfs(struct qoriq_ptp *qoriq_ptp)
+void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq)
{
struct dentry *root;
- root = debugfs_create_dir(dev_name(qoriq_ptp->dev), NULL);
+ root = debugfs_create_dir(dev_name(ptp_qoriq->dev), NULL);
if (IS_ERR(root))
return;
if (!root)
goto err_root;
- qoriq_ptp->debugfs_root = root;
+ ptp_qoriq->debugfs_root = root;
if (!debugfs_create_file_unsafe("fiper1-loopback", 0600, root,
- qoriq_ptp, &ptp_qoriq_fiper1_fops))
+ ptp_qoriq, &ptp_qoriq_fiper1_fops))
goto err_node;
if (!debugfs_create_file_unsafe("fiper2-loopback", 0600, root,
- qoriq_ptp, &ptp_qoriq_fiper2_fops))
+ ptp_qoriq, &ptp_qoriq_fiper2_fops))
goto err_node;
return;
err_node:
debugfs_remove_recursive(root);
- qoriq_ptp->debugfs_root = NULL;
+ ptp_qoriq->debugfs_root = NULL;
err_root:
- dev_err(qoriq_ptp->dev, "failed to initialize debugfs\n");
+ dev_err(ptp_qoriq->dev, "failed to initialize debugfs\n");
}
-void ptp_qoriq_remove_debugfs(struct qoriq_ptp *qoriq_ptp)
+void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq)
{
- debugfs_remove_recursive(qoriq_ptp->debugfs_root);
- qoriq_ptp->debugfs_root = NULL;
+ debugfs_remove_recursive(ptp_qoriq->debugfs_root);
+ ptp_qoriq->debugfs_root = NULL;
}
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 94e9797..c2a32d9 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -49,7 +49,7 @@ struct etts_regs {
u32 tmr_etts2_l; /* Timestamp of general purpose external trigger */
};
-struct qoriq_ptp_registers {
+struct ptp_qoriq_registers {
struct ctrl_regs __iomem *ctrl_regs;
struct alarm_regs __iomem *alarm_regs;
struct fiper_regs __iomem *fiper_regs;
@@ -136,9 +136,9 @@ struct qoriq_ptp_registers {
#define DEFAULT_FIPER1_PERIOD 1000000000
#define DEFAULT_FIPER2_PERIOD 100000
-struct qoriq_ptp {
+struct ptp_qoriq {
void __iomem *base;
- struct qoriq_ptp_registers regs;
+ struct ptp_qoriq_registers regs;
spinlock_t lock; /* protects regs */
struct ptp_clock *clock;
struct ptp_clock_info caps;
@@ -172,12 +172,12 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val)
}
#ifdef CONFIG_DEBUG_FS
-void ptp_qoriq_create_debugfs(struct qoriq_ptp *qoriq_ptp);
-void ptp_qoriq_remove_debugfs(struct qoriq_ptp *qoriq_ptp);
+void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
+void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);
#else
-static inline void ptp_qoriq_create_debugfs(struct qoriq_ptp *qoriq_ptp)
+static inline void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq)
{ }
-static inline void ptp_qoriq_remove_debugfs(struct qoriq_ptp *qoriq_ptp)
+static inline void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq)
{ }
#endif
--
1.7.1
^ permalink raw reply related
* [v3, 3/9] ptp_qoriq: convert to use ptp_qoriq_init/free
From: Yangbo Lu @ 2019-02-12 4:23 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
Moved QorIQ PTP clock initialization/free into new functions
ptp_qoriq_init()/ptp_qoriq_free(). These functions could also
be reused by ENETC PTP drvier which is a PCI driver for same
1588 timer IP block.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- Added ptp_qoriq_free().
---
drivers/ptp/ptp_qoriq.c | 144 ++++++++++++++++++++++-------------------
include/linux/fsl/ptp_qoriq.h | 3 +
2 files changed, 80 insertions(+), 67 deletions(-)
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 1f3e73e..db4f929 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -458,25 +458,17 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
return 0;
}
-static int ptp_qoriq_probe(struct platform_device *dev)
+int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
+ const struct ptp_clock_info caps)
{
- struct device_node *node = dev->dev.of_node;
- struct ptp_qoriq *ptp_qoriq;
+ struct device_node *node = ptp_qoriq->dev->of_node;
struct ptp_qoriq_registers *regs;
struct timespec64 now;
- int err = -ENOMEM;
- u32 tmr_ctrl;
unsigned long flags;
- void __iomem *base;
-
- ptp_qoriq = kzalloc(sizeof(*ptp_qoriq), GFP_KERNEL);
- if (!ptp_qoriq)
- goto no_memory;
-
- err = -EINVAL;
+ u32 tmr_ctrl;
- ptp_qoriq->dev = &dev->dev;
- ptp_qoriq->caps = ptp_qoriq_caps;
+ ptp_qoriq->base = base;
+ ptp_qoriq->caps = caps;
if (of_property_read_u32(node, "fsl,cksel", &ptp_qoriq->cksel))
ptp_qoriq->cksel = DEFAULT_CKSEL;
@@ -501,44 +493,9 @@ static int ptp_qoriq_probe(struct platform_device *dev)
pr_warn("device tree node missing required elements, try automatic configuration\n");
if (ptp_qoriq_auto_config(ptp_qoriq, node))
- goto no_config;
+ return -ENODEV;
}
- err = -ENODEV;
-
- ptp_qoriq->irq = platform_get_irq(dev, 0);
-
- if (ptp_qoriq->irq < 0) {
- pr_err("irq not in device tree\n");
- goto no_node;
- }
- if (request_irq(ptp_qoriq->irq, ptp_qoriq_isr, IRQF_SHARED,
- DRIVER, ptp_qoriq)) {
- pr_err("request_irq failed\n");
- goto no_node;
- }
-
- ptp_qoriq->rsrc = platform_get_resource(dev, IORESOURCE_MEM, 0);
- if (!ptp_qoriq->rsrc) {
- pr_err("no resource\n");
- goto no_resource;
- }
- if (request_resource(&iomem_resource, ptp_qoriq->rsrc)) {
- pr_err("resource busy\n");
- goto no_resource;
- }
-
- spin_lock_init(&ptp_qoriq->lock);
-
- base = ioremap(ptp_qoriq->rsrc->start,
- resource_size(ptp_qoriq->rsrc));
- if (!base) {
- pr_err("ioremap ptp registers failed\n");
- goto no_ioremap;
- }
-
- ptp_qoriq->base = base;
-
if (of_device_is_compatible(node, "fsl,fman-ptp-timer")) {
ptp_qoriq->regs.ctrl_regs = base + FMAN_CTRL_REGS_OFFSET;
ptp_qoriq->regs.alarm_regs = base + FMAN_ALARM_REGS_OFFSET;
@@ -558,6 +515,7 @@ static int ptp_qoriq_probe(struct platform_device *dev)
(ptp_qoriq->tclk_period & TCLK_PERIOD_MASK) << TCLK_PERIOD_SHIFT |
(ptp_qoriq->cksel & CKSEL_MASK) << CKSEL_SHIFT;
+ spin_lock_init(&ptp_qoriq->lock);
spin_lock_irqsave(&ptp_qoriq->lock, flags);
regs = &ptp_qoriq->regs;
@@ -571,16 +529,77 @@ static int ptp_qoriq_probe(struct platform_device *dev)
spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
- ptp_qoriq->clock = ptp_clock_register(&ptp_qoriq->caps, &dev->dev);
- if (IS_ERR(ptp_qoriq->clock)) {
- err = PTR_ERR(ptp_qoriq->clock);
- goto no_clock;
- }
- ptp_qoriq->phc_index = ptp_clock_index(ptp_qoriq->clock);
+ ptp_qoriq->clock = ptp_clock_register(&ptp_qoriq->caps, ptp_qoriq->dev);
+ if (IS_ERR(ptp_qoriq->clock))
+ return PTR_ERR(ptp_qoriq->clock);
+ ptp_qoriq->phc_index = ptp_clock_index(ptp_qoriq->clock);
ptp_qoriq_create_debugfs(ptp_qoriq);
- platform_set_drvdata(dev, ptp_qoriq);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ptp_qoriq_init);
+
+void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq)
+{
+ struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
+
+ qoriq_write(®s->ctrl_regs->tmr_temask, 0);
+ qoriq_write(®s->ctrl_regs->tmr_ctrl, 0);
+
+ ptp_qoriq_remove_debugfs(ptp_qoriq);
+ ptp_clock_unregister(ptp_qoriq->clock);
+ iounmap(ptp_qoriq->base);
+ free_irq(ptp_qoriq->irq, ptp_qoriq);
+}
+EXPORT_SYMBOL_GPL(ptp_qoriq_free);
+
+static int ptp_qoriq_probe(struct platform_device *dev)
+{
+ struct ptp_qoriq *ptp_qoriq;
+ int err = -ENOMEM;
+ void __iomem *base;
+ ptp_qoriq = kzalloc(sizeof(*ptp_qoriq), GFP_KERNEL);
+ if (!ptp_qoriq)
+ goto no_memory;
+
+ ptp_qoriq->dev = &dev->dev;
+
+ err = -ENODEV;
+
+ ptp_qoriq->irq = platform_get_irq(dev, 0);
+ if (ptp_qoriq->irq < 0) {
+ pr_err("irq not in device tree\n");
+ goto no_node;
+ }
+ if (request_irq(ptp_qoriq->irq, ptp_qoriq_isr, IRQF_SHARED,
+ DRIVER, ptp_qoriq)) {
+ pr_err("request_irq failed\n");
+ goto no_node;
+ }
+
+ ptp_qoriq->rsrc = platform_get_resource(dev, IORESOURCE_MEM, 0);
+ if (!ptp_qoriq->rsrc) {
+ pr_err("no resource\n");
+ goto no_resource;
+ }
+ if (request_resource(&iomem_resource, ptp_qoriq->rsrc)) {
+ pr_err("resource busy\n");
+ goto no_resource;
+ }
+
+ base = ioremap(ptp_qoriq->rsrc->start,
+ resource_size(ptp_qoriq->rsrc));
+ if (!base) {
+ pr_err("ioremap ptp registers failed\n");
+ goto no_ioremap;
+ }
+
+ err = ptp_qoriq_init(ptp_qoriq, base, ptp_qoriq_caps);
+ if (err)
+ goto no_clock;
+
+ platform_set_drvdata(dev, ptp_qoriq);
return 0;
no_clock:
@@ -589,7 +608,6 @@ static int ptp_qoriq_probe(struct platform_device *dev)
release_resource(ptp_qoriq->rsrc);
no_resource:
free_irq(ptp_qoriq->irq, ptp_qoriq);
-no_config:
no_node:
kfree(ptp_qoriq);
no_memory:
@@ -599,18 +617,10 @@ static int ptp_qoriq_probe(struct platform_device *dev)
static int ptp_qoriq_remove(struct platform_device *dev)
{
struct ptp_qoriq *ptp_qoriq = platform_get_drvdata(dev);
- struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
- qoriq_write(®s->ctrl_regs->tmr_temask, 0);
- qoriq_write(®s->ctrl_regs->tmr_ctrl, 0);
-
- ptp_qoriq_remove_debugfs(ptp_qoriq);
- ptp_clock_unregister(ptp_qoriq->clock);
- iounmap(ptp_qoriq->base);
+ ptp_qoriq_free(ptp_qoriq);
release_resource(ptp_qoriq->rsrc);
- free_irq(ptp_qoriq->irq, ptp_qoriq);
kfree(ptp_qoriq);
-
return 0;
}
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index 75e6f05..757aec3 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -173,6 +173,9 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val)
}
irqreturn_t ptp_qoriq_isr(int irq, void *priv);
+int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
+ const struct ptp_clock_info caps);
+void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq);
int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
--
1.7.1
^ permalink raw reply related
* [v3, 5/9] dt-binding: ptp_qoriq: add little-endian support
From: Yangbo Lu @ 2019-02-12 4:24 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
Specify "little-endian" property if the 1588 timer IP block
is little-endian mode. The default endian mode is big-endian.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- None.
---
.../devicetree/bindings/ptp/ptp-qoriq.txt | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt b/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
index 8e7f855..454c937 100644
--- a/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
+++ b/Documentation/devicetree/bindings/ptp/ptp-qoriq.txt
@@ -19,6 +19,9 @@ Clock Properties:
- fsl,max-adj Maximum frequency adjustment in parts per billion.
- fsl,extts-fifo The presence of this property indicates hardware
support for the external trigger stamp FIFO.
+ - little-endian The presence of this property indicates the 1588 timer
+ IP block is little-endian mode. The default endian mode
+ is big-endian.
These properties set the operational parameters for the PTP
clock. You must choose these carefully for the clock to work right.
--
1.7.1
^ permalink raw reply related
* [v3, 2/9] ptp_qoriq: make ptp operations global
From: Yangbo Lu @ 2019-02-12 4:23 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
In-Reply-To: <20190212042404.15575-1-yangbo.lu@nxp.com>
This patch is to make functions of ptp operations global,
so that ENETC PTP driver which is a PCI driver for same
1588 timer IP block could reuse them.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
Changes for v2:
- None.
Changes for v3:
- None.
---
drivers/ptp/ptp_qoriq.c | 27 ++++++++++++++++-----------
include/linux/fsl/ptp_qoriq.h | 9 +++++++++
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/drivers/ptp/ptp_qoriq.c b/drivers/ptp/ptp_qoriq.c
index 8c10d0f..1f3e73e 100644
--- a/drivers/ptp/ptp_qoriq.c
+++ b/drivers/ptp/ptp_qoriq.c
@@ -22,7 +22,6 @@
#include <linux/device.h>
#include <linux/hrtimer.h>
-#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -135,7 +134,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
* Interrupt service routine
*/
-static irqreturn_t isr(int irq, void *priv)
+irqreturn_t ptp_qoriq_isr(int irq, void *priv)
{
struct ptp_qoriq *ptp_qoriq = priv;
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
@@ -200,12 +199,13 @@ static irqreturn_t isr(int irq, void *priv)
} else
return IRQ_NONE;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_isr);
/*
* PTP clock operations
*/
-static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
+int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
u64 adj, diff;
u32 tmr_add;
@@ -233,8 +233,9 @@ static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
return 0;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_adjfine);
-static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
+int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
s64 now;
unsigned long flags;
@@ -251,9 +252,9 @@ static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
return 0;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_adjtime);
-static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,
- struct timespec64 *ts)
+int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
u64 ns;
unsigned long flags;
@@ -269,9 +270,10 @@ static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,
return 0;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_gettime);
-static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
- const struct timespec64 *ts)
+int ptp_qoriq_settime(struct ptp_clock_info *ptp,
+ const struct timespec64 *ts)
{
u64 ns;
unsigned long flags;
@@ -288,9 +290,10 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
return 0;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_settime);
-static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
- struct ptp_clock_request *rq, int on)
+int ptp_qoriq_enable(struct ptp_clock_info *ptp,
+ struct ptp_clock_request *rq, int on)
{
struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
@@ -336,6 +339,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
}
+EXPORT_SYMBOL_GPL(ptp_qoriq_enable);
static const struct ptp_clock_info ptp_qoriq_caps = {
.owner = THIS_MODULE,
@@ -508,7 +512,8 @@ static int ptp_qoriq_probe(struct platform_device *dev)
pr_err("irq not in device tree\n");
goto no_node;
}
- if (request_irq(ptp_qoriq->irq, isr, IRQF_SHARED, DRIVER, ptp_qoriq)) {
+ if (request_irq(ptp_qoriq->irq, ptp_qoriq_isr, IRQF_SHARED,
+ DRIVER, ptp_qoriq)) {
pr_err("request_irq failed\n");
goto no_node;
}
diff --git a/include/linux/fsl/ptp_qoriq.h b/include/linux/fsl/ptp_qoriq.h
index c2a32d9..75e6f05 100644
--- a/include/linux/fsl/ptp_qoriq.h
+++ b/include/linux/fsl/ptp_qoriq.h
@@ -7,6 +7,7 @@
#define __PTP_QORIQ_H__
#include <linux/io.h>
+#include <linux/interrupt.h>
#include <linux/ptp_clock_kernel.h>
/*
@@ -171,6 +172,14 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val)
iowrite32be(val, addr);
}
+irqreturn_t ptp_qoriq_isr(int irq, void *priv);
+int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
+int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
+int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
+int ptp_qoriq_settime(struct ptp_clock_info *ptp,
+ const struct timespec64 *ts);
+int ptp_qoriq_enable(struct ptp_clock_info *ptp,
+ struct ptp_clock_request *rq, int on);
#ifdef CONFIG_DEBUG_FS
void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);
--
1.7.1
^ permalink raw reply related
* [v3, 0/9] Add ENETC PTP clock driver
From: Yangbo Lu @ 2019-02-12 4:23 UTC (permalink / raw)
To: netdev, devicetree
Cc: David S . Miller, Richard Cochran, Rob Herring, Claudiu Manoil,
Yangbo Lu
There is same QorIQ 1588 timer IP block on the new ENETC Ethernet
controller with eTSEC/DPAA Ethernet controllers. However it's
different endianness (little-endian) and using PCI driver.
To support ENETC PTP driver, ptp_qoriq driver needed to be
reworked to make functions global for reusing, to add little-
endian support, to add ENETC memory map support, and to add
ENETC dependency for ptp_qoriq driver.
In addition, although ENETC PTP driver is a PCI driver, the dts
node still could be used. Currently the ls1028a dtsi which is
the only platform by now using ENETC is not complete, so there
is still dependency for ENETC PTP node upstreaming. This will
be done in the near future. The hardware timestamping support
for ENETC is done but needs to be reworked with new method in
internal git tree, and will be sent out soon.
Yangbo Lu (9):
ptp_qoriq: make structure/function names more consistent
ptp_qoriq: make ptp operations global
ptp_qoriq: convert to use ptp_qoriq_init/free
ptp_qoriq: add little enadian support
dt-binding: ptp_qoriq: add little-endian support
ptp_qoriq: fix register memory map
ptp: add QorIQ PTP support for ENETC
enetc: add PTP clock driver
MAINTAINERS: add enetc_ptp driver into QorIQ PTP list
.../devicetree/bindings/ptp/ptp-qoriq.txt | 3 +
MAINTAINERS | 1 +
drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 2 +-
drivers/net/ethernet/freescale/enetc/Kconfig | 12 +
drivers/net/ethernet/freescale/enetc/Makefile | 3 +
drivers/net/ethernet/freescale/enetc/enetc_hw.h | 5 +-
drivers/net/ethernet/freescale/enetc/enetc_ptp.c | 144 +++++++
drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
drivers/ptp/Kconfig | 2 +-
drivers/ptp/ptp_qoriq.c | 437 +++++++++++---------
drivers/ptp/ptp_qoriq_debugfs.c | 48 ++--
include/linux/fsl/ptp_qoriq.h | 63 ++-
12 files changed, 466 insertions(+), 256 deletions(-)
create mode 100644 drivers/net/ethernet/freescale/enetc/enetc_ptp.c
^ permalink raw reply
* RE: [v2, 0/9] Add ENETC PTP clock driver
From: Y.b. Lu @ 2019-02-12 4:02 UTC (permalink / raw)
To: David Miller
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
richardcochran@gmail.com, robh+dt@kernel.org, Claudiu Manoil
In-Reply-To: <20190203.121144.623666032377925349.davem@davemloft.net>
Hi David,
> -----Original Message-----
> From: David Miller <davem@davemloft.net>
> Sent: Monday, February 4, 2019 4:12 AM
> To: Y.b. Lu <yangbo.lu@nxp.com>
> Cc: netdev@vger.kernel.org; devicetree@vger.kernel.org;
> richardcochran@gmail.com; robh+dt@kernel.org; Claudiu Manoil
> <claudiu.manoil@nxp.com>
> Subject: Re: [v2, 0/9] Add ENETC PTP clock driver
>
> From: David Miller <davem@davemloft.net>
> Date: Sun, 03 Feb 2019 11:39:21 -0800 (PST)
>
> > From: Yangbo Lu <yangbo.lu@nxp.com>
> > Date: Sat, 2 Feb 2019 10:56:58 +0800
> >
> >> There is same QorIQ 1588 timer IP block on the new ENETC Ethernet
> >> controller with eTSEC/DPAA Ethernet controllers. However it's
> >> different endianness (little-endian) and using PCI driver.
> >>
> >> To support ENETC PTP driver, ptp_qoriq driver needed to be reworked
> >> to make functions global for reusing, to add little- endian support,
> >> to add ENETC memory map support, and to add ENETC dependency for
> >> ptp_qoriq driver.
> >>
> >> In addition, although ENETC PTP driver is a PCI driver, the dts node
> >> still could be used. Currently the ls1028a dtsi which is the only
> >> platform by now using ENETC is not complete, so there is still
> >> dependency for ENETC PTP node upstreaming. This will be done in the
> >> near future. The hardware timestamping support for ENETC is done but
> >> needs to be reworked with new method in internal git tree, and will
> >> be sent out soon.
> >
> > Series applied.
>
> Once AGAIN, I had to revert:
>
> [davem@localhost net-next]$ make -s -j8
> ERROR: "ptp_qoriq_remove_debugfs"
> [drivers/net/ethernet/freescale/enetc/fsl-enetc-ptp.ko] undefined!
> make[1]: *** [scripts/Makefile.modpost:92: __modpost] Error 1
> make: *** [Makefile:1262: modules] Error 2
>
> Please do an allmodconfig build and don't resubmit this until it all passes.
[Y.b. Lu] Oh.. Sorry for the trouble.
Just come back from Chinese Spring Festival holiday. Let me fix the issue and send out new version after testing.
Thanks a lot for your patience :)
>
> Thank you.
^ permalink raw reply
* Re: [PATCH net] dsa: mv88e6xxx: Ensure all pending interrupts are handled prior to exit
From: Andrew Lunn @ 2019-02-12 3:58 UTC (permalink / raw)
To: John David Anglin, Heiner Kallweit
Cc: Russell King, Vivien Didelot, Florian Fainelli, netdev
In-Reply-To: <2b6bbb4c-1346-461b-ff7a-cb96b4142f7a@bell.net>
> > Hi David
> >
> > I just tested this on one of my boards. It loops endlessly:
> >
> > [ 47.173396] mv88e6xxx_g1_irq_thread_work: c881 a8 80
> > [ 47.182108] mv88e6xxx_g1_irq_thread_work: c881 a8 80
> > [ 47.190820] mv88e6xxx_g1_irq_thread_work: c881 a8 80
> > [ 47.199535] mv88e6xxx_g1_irq_thread_work: c881 a8 80
> > [ 47.208254] mv88e6xxx_g1_irq_thread_work: c881 a8 80
> >
> > These are reg, ctl1, reg & ctl1.
> >
> > So there is an unhandled device interrupt.
Hi Heiner
Your patch Fixes: 2b3e88ea6528 ("net: phy: improve phy state
checking") is causing me problems with interrupts for the Marvell
switches.
That change means we don't check the PHY device if it caused an
interrupt when its state is less than UP.
What i'm seeing is that the PHY is interrupting pretty early on after
a reboot when the previous boot had the interface up.
[ 10.125702] Marvell 88E6390 mv88e6xxx-0:02: phy_start_interrupts
[ 10.162798] Marvell 88E6390 mv88e6xxx-0:02: phy_enable_interrupts
[ 10.168931] Marvell 88E6390 mv88e6xxx-0:02: marvell_ack_interrupt
[ 10.180164] Marvell 88E6390 mv88e6xxx-0:02: marvell_config_intr 1
a little later it interrupts:
[ 12.999717] mv88e6xxx_g1_irq_thread_fn
[ 13.007253] mv88e6xxx_g2_irq_thread_fn: 4 811c 4
[ 13.012015] libphy: __phy_is_started: phydev->state 1 PHY_UP 3
[ 13.017941] Marvell 88E6390 mv88e6xxx-0:02: phy_interrupt: phy_is_started(phydev) 0
The current code just causes it to be ignored. So the interrupts fires
again, and again...
If i change to code to call into the PHY driver and let it handle the
interrupts, things keep running. A little bit later the interface is
configured up:
[ 15.921326] mv88e6085 gpio-0:00 red: configuring for phy/gmii link mode
[ 15.928693] libphy: __phy_is_started: phydev->state 3 PHY_UP 3
[ 15.929442] IPv6: ADDRCONF(NETDEV_UP): red: link is not ready
[ 15.935596] Marvell 88E6390 mv88e6xxx-0:02: m88e6390_config_aneg
[ 15.935608] Marvell 88E6390 mv88e6xxx-0:02: m88e6390_errata
[ 16.071364] Marvell 88E6390 mv88e6xxx-0:02: m88e1510_config_aneg
[ 16.112362] Marvell 88E6390 mv88e6xxx-0:02: m88e1318_config_aneg
[ 16.151245] Marvell 88E6390 mv88e6xxx-0:02: m88e1121_config_aneg
[ 16.368206] Marvell 88E6390 mv88e6xxx-0:02: PHY state change UP -> NOLINK
and after another interrupt the link goes up.
[ 19.519840] mv88e6xxx_g1_irq_thread_fn
[ 19.528546] mv88e6xxx_g2_irq_thread_fn: 4 811c 4
[ 19.534152] libphy: __phy_is_started: phydev->state 5 PHY_UP 3
[ 19.540030] Marvell 88E6390 mv88e6xxx-0:02: phy_interrupt: phy_is_started(phydev) 1
[ 19.547721] Marvell 88E6390 mv88e6xxx-0:02: m88e1121_did_interrupt
[ 19.559829] Marvell 88E6390 mv88e6xxx-0:02: marvell_ack_interrupt
[ 19.590753] Marvell 88E6390 mv88e6xxx-0:02: marvell_read_status
[ 19.596712] Marvell 88E6390 mv88e6xxx-0:02: marvell_update_link
[ 19.628387] Marvell 88E6390 mv88e6xxx-0:02: PHY state change NOLINK -> RUNNING
[ 19.628453] mv88e6085 gpio-0:00 red: Link is Up - 1Gbps/Full - flow control off
[ 19.635920] IPv6: ADDRCONF(NETDEV_CHANGE): red: link becomes ready
I don't yet know why the first interrupt happens, before we configure
auto-neg, etc. But it is not too unreasonable. We have configured
interrupts, so it could be reporting link down etc.
So i think we might need to revert part of this change, call into the
driver so long as the PHY is not in state PHY_HALTED.
What do you think?
Andrew
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox