From patchwork Wed Mar 23 15:09:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shivamurthy Shastri X-Patchwork-Id: 64239 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp88237lbc; Wed, 23 Mar 2016 08:10:30 -0700 (PDT) X-Received: by 10.66.234.104 with SMTP id ud8mr5021744pac.143.1458745830015; Wed, 23 Mar 2016 08:10:30 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id ey12si4850519pac.203.2016.03.23.08.10.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Mar 2016 08:10:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 07F9C1A1E53; Wed, 23 Mar 2016 08:10:54 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 55A311A1DF6 for ; Wed, 23 Mar 2016 08:10:52 -0700 (PDT) Received: by mail-pf0-x230.google.com with SMTP id n5so31855379pfn.2 for ; Wed, 23 Mar 2016 08:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ca2JTMDn+gWC+HVQlF37npP3wE2rV97IAMGvQZeAPGM=; b=O/Aek1EJ7b0ptkcwBInvqqNxNlwwSX1lRk1F9SI+J6lKZIl14gaioFljkeMn36LpQg 1xea9ODI7EactNbbunx13NM/YxQYxOP/LVDoCdqtlTQY5A2QfnZdTNCtjT7tS0YYbzea ZsZnAz41Rawz1VhecIQXTpqsZz5hvQeeILTRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ca2JTMDn+gWC+HVQlF37npP3wE2rV97IAMGvQZeAPGM=; b=kSh2FIObClD0IjBJViwcp5HjtJsz4m1sQtL4iFOhRgyzccRGHNeLdzvu+2qQyvXpaA 0C7amY3kF5h++2JZfRCBOkjdWBXWJRyaywrNSRgzdQ93vyRG+/gQVjkaNEN/7aAJwwlr JoEDTRu2KbO3GKJhAzW8POgpz+8CdMxKiuACW/obqKg37Oysil+lob6dIEMyc4uVzmRM U9aWEdt7gMYEdDqtHJreYMFA7lyp60zR849H2UDuJi+X01wbLAWSD+zXwUkJmND3yvzG LDLY1GlI6PzJwdnB4dhDytQ7sOMxif8fP5pdthNNwHHS35t8i/CYUv7vmnCjtlPXAwn2 TLlQ== X-Gm-Message-State: AD7BkJJLRgOw1do2KIAcuehcs8W9oK11bzBN+K19P/qGw72219J9D7sW+gbvZwnb/0bSIh6u X-Received: by 10.66.249.41 with SMTP id yr9mr5069198pac.86.1458745827427; Wed, 23 Mar 2016 08:10:27 -0700 (PDT) Received: from localhost.localdomain ([106.51.27.177]) by smtp.gmail.com with ESMTPSA id sj4sm4932321pab.43.2016.03.23.08.10.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 08:10:26 -0700 (PDT) From: Shivamurthy Shastri To: ruiyu.ni@intel.com Date: Wed, 23 Mar 2016 20:39:27 +0530 Message-Id: <1458745767-22873-1-git-send-email-shivamurthy.shastri@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D0D991D8E@SHSMSX103.ccr.corp.intel.com> References: <734D49CCEBEEF84792F5B80ED585239D0D991D8E@SHSMSX103.ccr.corp.intel.com> Subject: [edk2] [PATCH v2] OptionRomPkg: Ax88772b: support for multiple dongles and chips X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: fathi.boudra@linaro.org, edk2-devel@lists.01.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Driver code is modified to support multiple ethernet dongles, which uses similar ASIX chips. Also, it can be used for multiple ASIX chips with similar register map. Enabled support for Apple Ethernet Adapter Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Shivamurthy Shastri --- .../Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h | 16 ++++++++--- .../Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c | 33 +++++++++++++--------- 2 files changed, 32 insertions(+), 17 deletions(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h index ab75ec2..286bdab 100644 --- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h +++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/Ax88772.h @@ -141,9 +141,6 @@ #define DEV_SIGNATURE SIGNATURE_32 ('A','X','8','8') ///< Signature of data structures in memory -#define VENDOR_ID 0x0B95 ///< Vendor ID for Asix -#define PRODUCT_ID 0x772B ///< Product ID for the AX88772 USB 10/100 Ethernet controller - #define RESET_MSEC 1000 ///< Reset duration #define PHY_RESET_MSEC 500 ///< PHY reset duration @@ -297,12 +294,23 @@ #define AN_10_HDX 0x0020 ///< 1 = 10BASE-T support #define AN_CSMA_CD 0x0001 ///< 1 = IEEE 802.3 CSMA/CD support - +// asix_flags defines +#define FLAG_NONE 0 +#define FLAG_TYPE_AX88172 BIT0 +#define FLAG_TYPE_AX88772 BIT1 +#define FLAG_TYPE_AX88772B BIT2 +#define FLAG_EEPROM_MAC BIT3 // initial mac address in eeprom //------------------------------------------------------------------------------ // Data Types //------------------------------------------------------------------------------ +typedef struct { + UINT16 VendorId; + UINT16 ProductId; + INT32 Flags; +}ASIX_DONGLE; + /** Ethernet header layout diff --git a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c index 3b73040..5aed2ec 100644 --- a/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c +++ b/OptionRomPkg/Bus/Usb/UsbNetworking/Ax88772b/DriverBinding.c @@ -14,6 +14,13 @@ #include "Ax88772.h" +ASIX_DONGLE ASIX_DONGLES[] = { + { 0x05AC, 0x1402, FLAG_TYPE_AX88772 }, // Apple USB Ethernet Adapter + // ASIX 88772B + { 0x0B95, 0x772B, FLAG_TYPE_AX88772B | FLAG_EEPROM_MAC }, + { 0x0000, 0x0000, FLAG_NONE } // END - Do not remove +}; + /** Verify the controller type @@ -36,6 +43,8 @@ DriverSupported ( EFI_USB_DEVICE_DESCRIPTOR Device; EFI_USB_IO_PROTOCOL * pUsbIo; EFI_STATUS Status; + UINT32 Index; + // // Connect to the USB stack // @@ -60,19 +69,17 @@ DriverSupported ( else { // // Validate the adapter - // - if ( VENDOR_ID == Device.IdVendor ) { - - if (PRODUCT_ID == Device.IdProduct) { - DEBUG ((EFI_D_INFO, "Found the AX88772B\r\n")); - } - else { - Status = EFI_UNSUPPORTED; - } - } - else { - Status = EFI_UNSUPPORTED; - } + // + for (Index = 0; ASIX_DONGLES[Index].VendorId != 0; Index++) { + if (ASIX_DONGLES[Index].VendorId == Device.IdVendor && + ASIX_DONGLES[Index].ProductId == Device.IdProduct) { + DEBUG ((EFI_D_INFO, "Found the AX88772B\r\n")); + break; + } + } + + if (ASIX_DONGLES[Index].VendorId == 0) + Status = EFI_UNSUPPORTED; } //