From patchwork Sun Jan 18 23:40:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 430274 X-Patchwork-Delegate: wigyori@uid0.hu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 22341140272 for ; Mon, 19 Jan 2015 10:40:23 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 879F328BE66; Mon, 19 Jan 2015 00:37:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 4FE6628BE33 for ; Mon, 19 Jan 2015 00:37:19 +0100 (CET) X-policyd-weight: using cached result; rate:hard: -7.6 Received: from fudo.makrotopia.org (fudo.makrotopia.org [5.135.190.93]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 19 Jan 2015 00:37:19 +0100 (CET) Received: from local by fudo.makrotopia.org with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1YCzRR-000595-AQ; Mon, 19 Jan 2015 00:39:37 +0100 Date: Mon, 19 Jan 2015 00:40:42 +0100 From: Daniel Golle To: openwrt-devel@lists.openwrt.org Message-ID: <20150118234038.GA4989@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [OpenWrt-Devel] [PATCH 8/8] sunxi: workaround switch being uninitialized on netifd startup X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" The BCM53125 switch on Lamobo R1 is powered down and counters are not zero'ed when netifd comes up and tries to initialize the switch. Take interface up and reset counters in preinit for that board. Signed-off-by: Daniel Golle --- .../linux/sunxi/base-files/lib/preinit/02_b53_hack.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh diff --git a/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh new file mode 100644 index 0000000..84070de --- /dev/null +++ b/target/linux/sunxi/base-files/lib/preinit/02_b53_hack.sh @@ -0,0 +1,17 @@ +#!/bin/sh +. /lib/sunxi.sh + +do_b53_hack() { + # hack: enable switch on Lamobo R1 and reset counters + case "$( sunxi_board_name )" in + "lamobo-r1") + ifconfig eth0 up + sleep 1 + swconfig dev switch0 set reset 1 + swconfig dev switch0 set reset_mib 1 + swconfig dev switch0 set apply 1 + ;; + esac +} + +boot_hook_add preinit_main do_b53_hack