From patchwork Mon Feb 23 14:41:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 442561 X-Patchwork-Delegate: jogo@openwrt.org 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 BCE841400B7 for ; Tue, 24 Feb 2015 01:41:51 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 2A11328BC9B; Mon, 23 Feb 2015 15:41:29 +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,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 8AD5528A676 for ; Mon, 23 Feb 2015 15:41:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-wi0-f181.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 23 Feb 2015 15:41:21 +0100 (CET) Received: by mail-wi0-f181.google.com with SMTP id r20so17496232wiv.2 for ; Mon, 23 Feb 2015 06:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=0/evJTVK474gFaIFeCmWMFxYnwM2h/nOYbIKe+fgBnE=; b=cn4Ofvao8f2FNc9ORCP9upVkFZ+Yf0dV/WotUPvVuAE5FUinNZ8VDB0UD77oM1dahp OgLpXNN2HP5Y6iKf4yD+VAr+EUT+SRleZesRj3lLfijDU/QjDcARhTBMRkc5b5gmL7ff h3h1OYm3KMf9/y7rOkSSOy+f3Vf6IaT/842Ph3iOXjFtjsp/eUZVSD6bEritRUG3Hmsj 3nRR6bDmxeylYmvD2BfxS/8VL4AUmVv7ow61AxM/Cj/93U779Qzmc22dFyn+0YPhKM1v CCdFW9dKuNyT/iygeVm7FD1EmRf5uStHvfhsYvhakyC7xp1PZZUJlWeEYvGxJa9YdHjv JnhQ== X-Received: by 10.194.8.2 with SMTP id n2mr22707088wja.46.1424702489036; Mon, 23 Feb 2015 06:41:29 -0800 (PST) Received: from orion.local ([194.105.29.179]) by mx.google.com with ESMTPSA id v5sm16160978wiw.24.2015.02.23.06.41.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Feb 2015 06:41:26 -0800 (PST) From: Alexandru Ardelean X-Google-Original-From: Alexandru Ardelean To: openwrt-devel@lists.openwrt.org Date: Mon, 23 Feb 2015 16:41:01 +0200 Message-Id: <1424702463-10012-1-git-send-email-aa@ocedo.com> X-Mailer: git-send-email 2.1.2 Subject: [OpenWrt-Devel] [PATCH 1/3] b53: add b53_mac_array_to_u64() utility function 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: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: Alexandru Ardelean Converts an MAC array of u8 to a u64 value. Signed-off-by: Alexandru Ardelean --- target/linux/generic/files/drivers/net/phy/b53/b53_regs.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h index ba50915..4379c58 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h @@ -20,6 +20,16 @@ #ifndef __B53_REGS_H #define __B53_REGS_H +/* Utility function for converting u8 arrays into u64 values to be written with b53_write */ +static inline u64 b53_mac_array_to_u64(const u8 *u8_arr) { + u64 mac = (*(const u64 *)u8_arr); +#ifdef __BIG_ENDIAN + return (mac >> 16); +#else + return (mac << 16); +#endif +} + /* Management Port (SMP) Page offsets */ #define B53_CTRL_PAGE 0x00 /* Control */ #define B53_STAT_PAGE 0x01 /* Status */