Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp371663pxh; Tue, 9 Nov 2021 12:06:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfyXPAexthUUPMxeKfSL720j42nkUEg97qB1PhJw7gXrzezMCJoDRfKyRSRZVmVvXM/FvJ X-Received: by 2002:a5d:8152:: with SMTP id f18mr6818090ioo.135.1636488377307; Tue, 09 Nov 2021 12:06:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636488377; cv=none; d=google.com; s=arc-20160816; b=Crvsq4HkYtPI4V2Ajy6jDFT58UJX+EqxRMSljMR+MrM/LWSksj8dbLXSAAZe15c9+H jT3Y44tU/v3VtXl9kiktdP2DVLtYqckWx1OH3lmZd2ENnhj9M6HD35buf7PL75ejfL13 JhEBQ0Nd0GdPnoaS12OgV2SR7o2RfdaQYl1B10CCgCTGrUx3iRW+Ak1u7WT9aSsTBVka mYBwRnaezf5BKYbFv7hRvVUxjR55mJS5frgL+3FPG2QYfemfEYjAq1yyqZLpoX5aROBH rgRjEZiKHfIRPbVA6mq2jSPWPMklRbBl3tsZfXBPQACJRD/N0Qry3o6r/0DkswNTl4qP Gqxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=7YbG2hfMz6xW/PCCxdMREuP3ECE7JRXSaX6c5e8BiT4=; b=l11RmsmWN7SLBaB2drhn2FIypJY6azRGsvTj8UXVwA2pyCn9sWPcInU+hGPJgMN0wR HdeNzkOsSD4hy/sRYfSsGJhzG+TP8BiPH7KUzDKHE4XsJOX9/T8D8BQhru9v8//l1p/9 MsbgekekJJZDDs01ljPsRPIfxUL2mDywnGdqFpWf8a5vROdb2t0hkJgWUyUaJEkfZG0Q I4ebC2hk7wpjXtxxbiiD6OHg/ZqOGPG7qArQfPLgZLMC33kweG8QQUNwypZLNsLokacn NcOgob5eGzf2uqbHIsEESpa9jG91ueiviSzgJWDZvxlUkBuaEoXaSWKn64d0qIurBjt4 tRzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VQAKOd3F; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g124si26294163jab.72.2021.11.09.12.05.58; Tue, 09 Nov 2021 12:06:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VQAKOd3F; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245125AbhKIJxr (ORCPT + 99 others); Tue, 9 Nov 2021 04:53:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245074AbhKIJxh (ORCPT ); Tue, 9 Nov 2021 04:53:37 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7B9C061764; Tue, 9 Nov 2021 01:50:51 -0800 (PST) From: Martin Kaistra DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1636451450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7YbG2hfMz6xW/PCCxdMREuP3ECE7JRXSaX6c5e8BiT4=; b=VQAKOd3FX8ayXWNWBddYNpGSWuEsHVO4+pJfdRXsv2nYwmgu8LiTmGLMjslL2E7BUTbJNh dUcbW88NEmkxLLzUkEuOaJSq14zz2PDxzx03f737prjsXQnESEc8dwM3eP1aX6TyO9stmx szdKtDMQJH6/NEr40C+wlCPjQCbDSk/iJsvu9mrDBHUh4kI5f8WC3N7mDq6a7GSJyBSWcG TEZjnSEH6VVhKaJoTE/pAKp1gh0Rqe5HPeOnxwf0ngWyywSc2u30R+LZCXCWGZrnpU3SaO cKnVtRMWp7jbVV2dSaOXX7GE5Q1cuYzhQvR9OGwgZb3e/4096aCKupWU5d7k1w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1636451450; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7YbG2hfMz6xW/PCCxdMREuP3ECE7JRXSaX6c5e8BiT4=; b=U7NWNeeJLgWaTYKHm46ULD0N/00omlOgkZpUPCpdXqAort78/KTRotlpt3pPZAYV1rJvXl o6lNPCgiRMVOulAg== To: Florian Fainelli , Andrew Lunn , Vivien Didelot Cc: martin.kaistra@linutronix.de, Richard Cochran , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , John Stultz , Thomas Gleixner , Stephen Boyd , Russell King , Marc Kleine-Budde , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 2/7] net: dsa: b53: Move struct b53_device to include/linux/dsa/b53.h Date: Tue, 9 Nov 2021 10:50:04 +0100 Message-Id: <20211109095013.27829-3-martin.kaistra@linutronix.de> In-Reply-To: <20211109095013.27829-1-martin.kaistra@linutronix.de> References: <20211109095013.27829-1-martin.kaistra@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to access the b53 structs from net/dsa/tag_brcm.c move the definitions from drivers/net/dsa/b53/b53_priv.h to the new file include/linux/dsa/b53.h. Signed-off-by: Martin Kaistra --- drivers/net/dsa/b53/b53_priv.h | 90 +---------------------------- include/linux/dsa/b53.h | 100 +++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 89 deletions(-) create mode 100644 include/linux/dsa/b53.h diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h index 579da74ada64..1652e489b737 100644 --- a/drivers/net/dsa/b53/b53_priv.h +++ b/drivers/net/dsa/b53/b53_priv.h @@ -23,44 +23,13 @@ #include #include #include -#include +#include #include "b53_regs.h" -struct b53_device; struct net_device; struct phylink_link_state; -struct b53_io_ops { - int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value); - int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value); - int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value); - int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value); - int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value); - int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value); - int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value); - int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value); - int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value); - int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value); - int (*phy_read16)(struct b53_device *dev, int addr, int reg, u16 *value); - int (*phy_write16)(struct b53_device *dev, int addr, int reg, u16 value); - int (*irq_enable)(struct b53_device *dev, int port); - void (*irq_disable)(struct b53_device *dev, int port); - u8 (*serdes_map_lane)(struct b53_device *dev, int port); - int (*serdes_link_state)(struct b53_device *dev, int port, - struct phylink_link_state *state); - void (*serdes_config)(struct b53_device *dev, int port, - unsigned int mode, - const struct phylink_link_state *state); - void (*serdes_an_restart)(struct b53_device *dev, int port); - void (*serdes_link_set)(struct b53_device *dev, int port, - unsigned int mode, phy_interface_t interface, - bool link_up); - void (*serdes_phylink_validate)(struct b53_device *dev, int port, - unsigned long *supported, - struct phylink_link_state *state); -}; - #define B53_INVALID_LANE 0xff enum { @@ -89,63 +58,6 @@ enum { #define B53_N_PORTS 9 #define B53_N_PORTS_25 6 -struct b53_port { - u16 vlan_ctl_mask; - struct ethtool_eee eee; -}; - -struct b53_vlan { - u16 members; - u16 untag; - bool valid; -}; - -struct b53_device { - struct dsa_switch *ds; - struct b53_platform_data *pdata; - const char *name; - - struct mutex reg_mutex; - struct mutex stats_mutex; - struct mutex arl_mutex; - const struct b53_io_ops *ops; - - /* chip specific data */ - u32 chip_id; - u8 core_rev; - u8 vta_regs[3]; - u8 duplex_reg; - u8 jumbo_pm_reg; - u8 jumbo_size_reg; - int reset_gpio; - u8 num_arl_bins; - u16 num_arl_buckets; - enum dsa_tag_protocol tag_protocol; - - /* used ports mask */ - u16 enabled_ports; - unsigned int imp_port; - - /* connect specific data */ - u8 current_page; - struct device *dev; - u8 serdes_lane; - - /* Master MDIO bus we got probed from */ - struct mii_bus *bus; - - void *priv; - - /* run time configuration */ - bool enable_jumbo; - - unsigned int num_vlans; - struct b53_vlan *vlans; - bool vlan_enabled; - unsigned int num_ports; - struct b53_port *ports; -}; - #define b53_for_each_port(dev, i) \ for (i = 0; i < B53_N_PORTS; i++) \ if (dev->enabled_ports & BIT(i)) diff --git a/include/linux/dsa/b53.h b/include/linux/dsa/b53.h new file mode 100644 index 000000000000..af782a1da362 --- /dev/null +++ b/include/linux/dsa/b53.h @@ -0,0 +1,100 @@ +/* SPDX-License-Identifier: ISC */ +/* + * Copyright (C) 2011-2013 Jonas Gorski + * + * Included by drivers/net/dsa/b53/b53_priv.h and net/dsa/tag_brcm.c + */ + +#include + +struct b53_device; +struct phylink_link_state; + +struct b53_io_ops { + int (*read8)(struct b53_device *dev, u8 page, u8 reg, u8 *value); + int (*read16)(struct b53_device *dev, u8 page, u8 reg, u16 *value); + int (*read32)(struct b53_device *dev, u8 page, u8 reg, u32 *value); + int (*read48)(struct b53_device *dev, u8 page, u8 reg, u64 *value); + int (*read64)(struct b53_device *dev, u8 page, u8 reg, u64 *value); + int (*write8)(struct b53_device *dev, u8 page, u8 reg, u8 value); + int (*write16)(struct b53_device *dev, u8 page, u8 reg, u16 value); + int (*write32)(struct b53_device *dev, u8 page, u8 reg, u32 value); + int (*write48)(struct b53_device *dev, u8 page, u8 reg, u64 value); + int (*write64)(struct b53_device *dev, u8 page, u8 reg, u64 value); + int (*phy_read16)(struct b53_device *dev, int addr, int reg, + u16 *value); + int (*phy_write16)(struct b53_device *dev, int addr, int reg, + u16 value); + int (*irq_enable)(struct b53_device *dev, int port); + void (*irq_disable)(struct b53_device *dev, int port); + u8 (*serdes_map_lane)(struct b53_device *dev, int port); + int (*serdes_link_state)(struct b53_device *dev, int port, + struct phylink_link_state *state); + void (*serdes_config)(struct b53_device *dev, int port, + unsigned int mode, + const struct phylink_link_state *state); + void (*serdes_an_restart)(struct b53_device *dev, int port); + void (*serdes_link_set)(struct b53_device *dev, int port, + unsigned int mode, phy_interface_t interface, + bool link_up); + void (*serdes_phylink_validate)(struct b53_device *dev, int port, + unsigned long *supported, + struct phylink_link_state *state); +}; + +struct b53_port { + u16 vlan_ctl_mask; + struct ethtool_eee eee; +}; + +struct b53_vlan { + u16 members; + u16 untag; + bool valid; +}; + +struct b53_device { + struct dsa_switch *ds; + struct b53_platform_data *pdata; + const char *name; + + struct mutex reg_mutex; + struct mutex stats_mutex; + struct mutex arl_mutex; + const struct b53_io_ops *ops; + + /* chip specific data */ + u32 chip_id; + u8 core_rev; + u8 vta_regs[3]; + u8 duplex_reg; + u8 jumbo_pm_reg; + u8 jumbo_size_reg; + int reset_gpio; + u8 num_arl_bins; + u16 num_arl_buckets; + enum dsa_tag_protocol tag_protocol; + + /* used ports mask */ + u16 enabled_ports; + unsigned int imp_port; + + /* connect specific data */ + u8 current_page; + struct device *dev; + u8 serdes_lane; + + /* Master MDIO bus we got probed from */ + struct mii_bus *bus; + + void *priv; + + /* run time configuration */ + bool enable_jumbo; + + unsigned int num_vlans; + struct b53_vlan *vlans; + bool vlan_enabled; + unsigned int num_ports; + struct b53_port *ports; +}; -- 2.20.1