Received: by 10.192.165.148 with SMTP id m20csp183571imm; Thu, 26 Apr 2018 18:59:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoweZ3oERh7NFvUkFaNYPCKbUUUpMd60aEGyRIA+bh2iP7gebWIyDhfJZQCCZrq+oRFcari X-Received: by 2002:a63:344c:: with SMTP id b73-v6mr408363pga.258.1524794367042; Thu, 26 Apr 2018 18:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524794367; cv=none; d=google.com; s=arc-20160816; b=o6N8v8X818hrv44Tvml3zsMyD1bqFzfL/0pSglFQDu0SgTB96CMu/ylCtOs34sRdV1 PkTBsSyJwyFZ0AdeeQiZOM3SW5H9toQvazfpHxJ/7QexsfeK/v6XEpbhb4e5yeyf3RaP duvygUPOV7ui+l31g5hKLVaOtX2Ws0KhWJf7mGpi9USpYpfIUv6qR6YUQ761GLnY+ya1 Dngp2YqWxexAPt99RIE8DyU799qlHgu6unLFcZQdHNM7LBi/7nki1ZdzpUL6WTWB4ALW gqsGRsyfpQkr1+vtFflOvQ9JhZard8Vmr8TxbHd2lte0JYkvRDC9ZiuUxV6gvTiNFone 0xUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wX5VLssfXzGcSCHeCbXIdyNqOWBwxKOSYobPal4pLc4=; b=XW5okJWyHcd8hST1/7EpEE4CpUqbcxfD5ykDT0CeXGeGK4BhB4xAKPKnvV08Gij6Jh vy1yx96rQQYEJVbR0g9tCscV4qaBoCDgG6rlAQWUhbWPBAsKS76XDBVbhOmMazAcuLfH oYc4AnDXMTnz0zIdmJ7bMy0dVa4YWIDb5lSQ4MdqQwEg/L5hG3ztBTJ9FYYWrPEA/P9u aRSqkfQ15p5bHvTe2wykn0a0UbtaNLQA5INiCoKzcE8trj2wuXQezoEVYcQktOcM+NLQ 66niG63ZF4vuH0CzSS7iUs8uxBuHXXIRvuukqKXd+RDsOFfDmqW/J0axHSSTn3ydJTix 0U4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12-v6si232132plo.264.2018.04.26.18.59.12; Thu, 26 Apr 2018 18:59:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932324AbeD0B5r (ORCPT + 99 others); Thu, 26 Apr 2018 21:57:47 -0400 Received: from mail.savoirfairelinux.com ([208.88.110.44]:43980 "EHLO mail.savoirfairelinux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757046AbeD0B5o (ORCPT ); Thu, 26 Apr 2018 21:57:44 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 3187C9C336F; Thu, 26 Apr 2018 21:57:44 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id PL_jSeo73l65; Thu, 26 Apr 2018 21:57:43 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 9975E9C3302; Thu, 26 Apr 2018 21:57:43 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Uf_4dGCy_oWt; Thu, 26 Apr 2018 21:57:43 -0400 (EDT) Received: from weeman.lan (modemcable249.105-163-184.mc.videotron.ca [184.163.105.249]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id 4F94D9C316F; Thu, 26 Apr 2018 21:57:43 -0400 (EDT) From: Vivien Didelot To: netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com Subject: [PATCH net-next 1/3] net: dsa: mv88e6xxx: move trunk setup Date: Thu, 26 Apr 2018 21:56:44 -0400 Message-Id: <20180427015646.24946-2-vivien.didelot@savoirfairelinux.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427015646.24946-1-vivien.didelot@savoirfairelinux.com> References: <20180427015646.24946-1-vivien.didelot@savoirfairelinux.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the trunking setup out of Global 2 specific setup into the top level mv88e6xxx_setup function. Note that the 88E6390 family calls this LAG instead of Trunk and supports 32 possible ID routing vectors, with LAG ID bit 4 being placed in Global 2 register 0x1D... We don't need Trunk (or LAG) IDs for the moment, thus keep it simple. Signed-off-by: Vivien Didelot --- drivers/net/dsa/mv88e6xxx/chip.c | 13 +++++++++++++ drivers/net/dsa/mv88e6xxx/global2.c | 7 +------ drivers/net/dsa/mv88e6xxx/global2.h | 7 +++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 3d2091099f7f..379edaf79aca 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -1020,6 +1020,15 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, dev_err(ds->dev, "p%d: failed to update state\n", port); } +static int mv88e6xxx_trunk_setup(struct mv88e6xxx_chip *chip) +{ + /* Clear all trunk masks and mapping */ + if (chip->info->global2_addr) + return mv88e6xxx_g2_trunk_clear(chip); + + return 0; +} + static int mv88e6xxx_pot_setup(struct mv88e6xxx_chip *chip) { if (chip->info->ops->pot_clear) @@ -2233,6 +2242,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds) if (err) goto unlock; + err = mv88e6xxx_trunk_setup(chip); + if (err) + goto unlock; + /* Setup PTP Hardware Clock and timestamping */ if (chip->info->ptp_support) { err = mv88e6xxx_ptp_setup(chip); diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c index 0ce627fded48..3f24763aedc5 100644 --- a/drivers/net/dsa/mv88e6xxx/global2.c +++ b/drivers/net/dsa/mv88e6xxx/global2.c @@ -174,7 +174,7 @@ static int mv88e6xxx_g2_trunk_mapping_write(struct mv88e6xxx_chip *chip, int id, return mv88e6xxx_g2_update(chip, MV88E6XXX_G2_TRUNK_MAPPING, val); } -static int mv88e6xxx_g2_clear_trunk(struct mv88e6xxx_chip *chip) +int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip) { const u16 port_mask = BIT(mv88e6xxx_num_ports(chip)) - 1; int i, err; @@ -1159,10 +1159,5 @@ int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) if (err) return err; - /* Clear all trunk masks and mapping. */ - err = mv88e6xxx_g2_clear_trunk(chip); - if (err) - return err; - return 0; } diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h index 520ec70d32e8..7bd4ab31a93e 100644 --- a/drivers/net/dsa/mv88e6xxx/global2.h +++ b/drivers/net/dsa/mv88e6xxx/global2.h @@ -327,6 +327,8 @@ int mv88e6352_g2_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip); +int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip); + extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops; extern const struct mv88e6xxx_irq_ops mv88e6390_watchdog_ops; @@ -495,6 +497,11 @@ static inline int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip, return -EOPNOTSUPP; } +static inline int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip) +{ + return -EOPNOTSUPP; +} + #endif /* CONFIG_NET_DSA_MV88E6XXX_GLOBAL2 */ #endif /* _MV88E6XXX_GLOBAL2_H */ -- 2.17.0