From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from APC01-HK2-obe.outbound.protection.outlook.com (APC01-HK2-obe.outbound.protection.outlook.com [40.92.255.97]) by mx.groups.io with SMTP id smtpd.web12.8171.1594980196475057391 for ; Fri, 17 Jul 2020 03:03:17 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=kIoapGG1; spf=pass (domain: outlook.com, ip: 40.92.255.97, mailfrom: vinxue@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GAah4pIPoUUdtV8z103QiFS9twPNwPz7mNQ6ujyQ0AmLfEBdAL85UMhzaelUK9IlHLr1Bpxerjld9PCMOCz5nVdgVBOm1PfwGqpBLhDeN71ap7PTLuf2z0Dvlp/4ZZETE5WzXNzqto22LnUHAo6CbG9ukBQeqNYvnK7zucWbnytwf7lWqETKBXkHOg1WgFDD6KK/DYrgdoG5pP3WjNFaou1xEoSGDmCgIekXEHhZbpE6DrIYsNxnq1HaM5RSIj8ayA/h3SDIT+6ki5LxE5yAgJcAD6/ICZv3bo/ewLcbsEAs2hunkgLwWfzgFAWJvlAQHqxHc8OQjpONItWYfTtAOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rngmwAG9h6o9T9kDine/SitkGnZ3Og6IWjZFx7XE+Zo=; b=Bgc3NMTEvDzf5nkrQiBvy/MjKA9rnlxtvAVJzGIy9GFXpX7ggsbdv4p39IIH0XyEfshB1FrLeHQNZq3pJGv9CCgMP3i/PTuSz16n0457gK29Fxk9I/AwhHAqhmM+y3954st0wmfNg8Q5jOBz2UTqLlXqM5qxoF0BIaY3fCiTHrK6xNXawjxSQlh8hU92kdDZpejmO3hew+4BUG4gjf4KE00bx+qQSlHsSorXuIkAJmmOxokzYTDv+rWdF7KJBMx6cAjW4PjFaxFNuGKbvNDjHuGl5XyZ2VFtF+AdMUxr7ooKvJu6cXrsfvcViacb/Y0ZyQf9+CUG3e+O71fMDjOJ+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rngmwAG9h6o9T9kDine/SitkGnZ3Og6IWjZFx7XE+Zo=; b=kIoapGG17J8sOxtrBAyb5/8xnG+IXInd7Vp/sAP6RhnJIZmr1CaFUihKDKarR2EvcryUwib3FhoDUw62xoc0uazgcaQ1MzK/JjY1Vkv/rsJBFSa2JCPQq5Aqcm4jiYGh8d4fWKkbbPqkT4oIDRd9vfT7j7ZVRlJAHCrNdKciEEipCvkOlGFTrvfWShMZqTYYtm6Ssha1vTV7MsrrBHz+5MMVt3Cu4jofjeq9Wz6vkKeHqWkJ7v4OBlwgkfNeO4WSvFqyKGnZRWlsI67VKyCFJsZk3r/5pCDMg2COyDbXBH4zrd8CTYVoQcORkMvnAiEPS59jafNkaDeWGUGaz6evhw== Received: from SG2APC01FT037.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebd::45) by SG2APC01HT182.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebd::468) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18; Fri, 17 Jul 2020 10:03:12 +0000 Received: from SL2PR03MB4442.apcprd03.prod.outlook.com (2a01:111:e400:7ebd::53) by SG2APC01FT037.mail.protection.outlook.com (2a01:111:e400:7ebd::367) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Fri, 17 Jul 2020 10:03:12 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:F93CE4C66759C3648C8397B8D50168E08818644347869B55D248A1CECAC7DFD9;UpperCasedChecksum:3CA7DD407A8732D05AEE58A06B6F37E908D4501C391B81BDED5678B628FE121D;SizeAsReceived:7589;Count:49 Received: from SL2PR03MB4442.apcprd03.prod.outlook.com ([fe80::6887:4d23:2904:f332]) by SL2PR03MB4442.apcprd03.prod.outlook.com ([fe80::6887:4d23:2904:f332%7]) with mapi id 15.20.3195.020; Fri, 17 Jul 2020 10:03:12 +0000 From: Vin Xue To: devel@edk2.groups.io CC: Vin Xue , Ard Biesheuvel , Leif Lindholm Subject: [edk2-platforms PATCH 3/5] Silicon/Synopsys/DesignWare: Remove platform specific init code. Date: Fri, 17 Jul 2020 18:02:01 +0800 Message-ID: X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20200717100203.724-1-vinxue@outlook.com> References: <20200717100203.724-1-vinxue@outlook.com> X-ClientProxiedBy: HK2PR02CA0134.apcprd02.prod.outlook.com (2603:1096:202:16::18) To SL2PR03MB4442.apcprd03.prod.outlook.com (2603:1096:100:5b::18) Return-Path: vinxue@outlook.com X-Microsoft-Original-Message-ID: <20200717100203.724-3-vinxue@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from SHA-D10WENXIXUE.amd.com (58.247.170.242) by HK2PR02CA0134.apcprd02.prod.outlook.com (2603:1096:202:16::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Fri, 17 Jul 2020 10:03:12 +0000 X-Mailer: git-send-email 2.27.0.windows.1 X-Microsoft-Original-Message-ID: <20200717100203.724-3-vinxue@outlook.com> X-TMN: [IjaEfj/fLvcTR5YA9bD6U8AX9N48Fi3+] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4ff6bb06-ca98-412b-bbb5-08d82a389dbc X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEs2/OlovTS5GRrq1qJdtrxnsDD/vY6moKcb1NN8zdmEMD/fZbJ1HlGxDcsmmr63VV4dd2i2H23EfZRRH5t8P5+k3ySq++SD/5JvvrmqilNm6O9IY4pIBv/OD9k3Uy1spwn3JF0hXp0YN8DCRTecSJNSq188XiCOtErchJgj7tbT7EfuoYOnaECTjC7TTt0ji2Tu6C1Utn0B9sFatfkak9LOQn3jNwXo76r1tbJMPexPy903fsw8fArs2mAOkySkoL3mEm53VzC4KQDbcfi/eEcXKkt5odS3C/zfNzJ79FemM61qT/xcBHq+KNXIAmrMcGeQUHmRQiYwWWZST6PsAmfYuXtD/RAhs4z/U9oNUoA9zG/gAwRYZllXEGAW7ddXu4p7oolaRh3U5iirgrSwC9y/n4twC1O3BRM2YE5/1os9s7cNoC3tWayQRUgclPVjXoeYlTc8186XiOGKo2+39AHc9BdEV+vWCBVYBSXGvqPs+1if5uWOgOJVb/KI4hXoIOl9+EvP+lr7OPpizbea/Jmtbnp5mAs9IUUL/GP19tn1Ni5RxFTMhTcWh6UlSWu47NfJkoh9oIeA0faRppPpWX1bHAWzbGqxK2CiqYcX2PdXheMTCL5Qi1J/zV9axVz2Ou3Xo/7bP0m6PRwzr3ghbqU0yJzPLCroR7kzBSU1SyB/VdrEVcwKSmvhRUM1up0t6vhF37UF2/ozPdJS7HHMX0/I/N0/pQAx10PctdTMhP6FcxvfbnQWabxuc969QCnMupndfmSpyloIhrEe2TqfS8HJ X-MS-TrafficTypeDiagnostic: SG2APC01HT182: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mw+lKntcf87d9eF8RQe8OmEk1DdDxF1DVxV7R4PrGCNWCVwzqlh9gMefkuVx9PqohQ5SVKQk0mKj0smdewRj45Jqk2x/FTfgaYeOVVudZ+knxQbL5620o4zXv/ezB+hkynnfzWwZb59c3HtzrrglpSteE8KifGygBFTgTiaK6IiOpFXyYhDxcKrkYuNYPG516UZ8tb+xs25ruqwPgr7kfQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:SL2PR03MB4442.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: HhTY7dT/P8K80BayOmIR4C0deNnFF1xSWVVGkdFD5J9e0GDlFIpFg9U57pPP0UEo2KmynOgQDt+JqT8j/I4pvLcr+y2auOVZWdoBHU1ckdizRb9OUQvx0gIT/0KMvJ3JCx3gSczYA8tP2Ylw2pHvkw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ff6bb06-ca98-412b-bbb5-08d82a389dbc X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2020 10:03:12.7511 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: SG2APC01FT037.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2APC01HT182 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Remove platform specific init code for device mode enable. The code is different for different silicon vendor. Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Vin Xue --- .../Drivers/UsbDeviceDxe/UsbDeviceDxe.c | 18 ----- .../Drivers/UsbDeviceDxe/UsbDeviceDxe.h | 8 ++- .../Drivers/UsbDeviceDxe/UsbDeviceDxe.inf | 4 -- .../Drivers/UsbDeviceDxe/UsbDeviceMode.c | 23 ------ .../Drivers/UsbDeviceDxe/UsbFuncIo.c | 71 +------------------ .../Drivers/UsbDeviceDxe/UsbFuncIo.h | 2 - .../Drivers/UsbDeviceDxe/UsbIoNode.h | 1 - 7 files changed, 6 insertions(+), 121 deletions(-) diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.= c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.c index 32fcbb1824..cf5b87f5d7 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.c @@ -25,25 +25,7 @@ PlatformSpecificInit ( VOID ) { - UINTN XhciPciMmBase; - EFI_PHYSICAL_ADDRESS XhciMemBaseAddress; =20 - XhciPciMmBase =3D MmPciAddress ( - 0, - 0, - PCI_DEVICE_NUMBER_XHCI, - PCI_FUNCTION_NUMBER_XHCI, - 0 - ); - - - XhciMemBaseAddress =3D MmioRead32 ((UINTN) (XhciPciMmBase + R_XHCI_MEM_B= ASE)) & B_XHCI_MEM_BASE_BA; - DEBUG ((DEBUG_INFO, "XhciPciMmBase=3D%x, XhciMemBaseAddress=3D%x\n", Xhc= iPciMmBase, XhciMemBaseAddress)); - - MmioWrite32 ((UINTN)(XhciMemBaseAddress + R_XHCI_MEM_DUAL_ROLE_CFG0), 0x= 1310800); - - PmicUSBSwitchControl (TRUE);//conduction USB switch. - return; } =20 =20 diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.= h b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.h index 2cdf553d37..ea2f2bdc7f 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.h +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.h @@ -9,15 +9,15 @@ #define __USB_DEVICE_DXE_H__ =20 #include +#include #include #include -#include #include #include +#include #include #include -#include -#include +#include #include "UsbFuncIo.h" #include "UsbDeviceMode.h" =20 @@ -28,6 +28,8 @@ #define USBFUIO_CONTEXT_FROM_PROTOCOL(a) CR (a, USB_XDCI_DEV_CONTEXT, Us= bFunIoProtocol, EFI_USB_DEV_SIGNATURE) #define USBUSBD_CONTEXT_FROM_PROTOCOL(a) CR (a, USB_XDCI_DEV_CONTEXT, Us= bDevModeProtocol, EFI_USB_DEV_SIGNATURE) =20 +#define R_OTG_BAR0 0x10 // BAR 0 +#define B_OTG_BAR0_BA 0xFFE00000 // Base Address =20 typedef struct _USB_FUIO_EVENT_NODE USB_FUIO_EVENT_NODE; =20 diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.= inf b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf index 92baaa9a0a..a5fbe2336a 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf @@ -33,20 +33,16 @@ =20 [Packages] MdePkg/MdePkg.dec - BroxtonSiPkg/BroxtonSiPkg.dec - BroxtonPlatformPkg/PlatformPkg.dec =20 [LibraryClasses] BaseMemoryLib DebugLib DevicePathLib MemoryAllocationLib - TimerLib PcdLib UefiBootServicesTableLib UefiDriverEntryPoint UefiLib - PmicLib =20 [Protocols] gEfiUsbDeviceModeProtocolGuid diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceMode= .c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceMode.c index 8e6da670fd..1a0248fa6a 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceMode.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceMode.c @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include "XdciUtility.h" #include "UsbDeviceMode.h" #include "UsbDeviceDxe.h" @@ -50,28 +48,7 @@ BOOLEAN mXdciRun =3D FALSE; STATIC VOID XhciSwitchSwid(BOOLEAN enable) { - UINTN XhciPciMmBase; - EFI_PHYSICAL_ADDRESS XhciMemBaseAddress; - UINT32 DualRoleCfg0; - UINT32 DualRoleCfg1; - - XhciPciMmBase =3D MmPciAddress (0, 0, PCI_DEVICE_NUMBER_XHCI, PCI_FUNCTI= ON_NUMBER_XHCI, 0); - XhciMemBaseAddress =3D MmioRead32 ((UINTN) (XhciPciMmBase + R_XHCI_MEM_B= ASE)) & B_XHCI_MEM_BASE_BA; - DEBUG ((DEBUG_INFO, "XhciPciMmBase=3D%x, XhciMemBaseAddress=3D%x\n", Xhc= iPciMmBase, XhciMemBaseAddress)); - - DualRoleCfg0 =3D MmioRead32 ((UINTN)(XhciMemBaseAddress + R_XHCI_MEM_DUA= L_ROLE_CFG0)); - if (enable) { - DualRoleCfg0 =3D DualRoleCfg0 | (1 << 24) | (1 << 21) | (1 << 20); - DEBUG ((DEBUG_INFO, "DualRoleCfg0 : Set SW ID : 0x%x \n", DualRoleCfg0= )); - } - else { - DualRoleCfg0 =3D DualRoleCfg0 & ~(1 << 24) & ~(1 << 21) & ~(1 << 20); - DEBUG ((DEBUG_INFO, "DualRoleCfg0 : Clear SW ID : 0x%x \n", DualRoleCf= g0)); - } - MmioWrite32 ((UINTN)(XhciMemBaseAddress + R_XHCI_MEM_DUAL_ROLE_CFG0), Du= alRoleCfg0); =20 - DualRoleCfg1 =3D MmioRead32 ((UINTN)(XhciMemBaseAddress + R_XHCI_MEM_DUA= L_ROLE_CFG1)); - DEBUG ((DEBUG_INFO, "DualRoleCfg1 : 0x%x \n", DualRoleCfg1)); } =20 VOID diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c b= /Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c index 566e23ec69..d4eea39e6d 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c @@ -107,76 +107,7 @@ DetectPort ( OUT EFI_USBFN_PORT_TYPE *PortType ) { - USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - EFI_STATUS Status; - UINT8 Value8; - - DEBUG ((USB_FUIO_DEBUG_INFO, "DetectPort - Entry\n")); - - UsbFuncIoDevPtr =3D USBFUIO_CONTEXT_FROM_PROTOCOL (This); - - // - // USBSRCDETRSLT Bit[5:2] - // Result of USB HW Source Detection algorithm - // Power-Domain: VRTC - // Result of USB HW Source Detection algorithm : - // 0000 =3D Not determined - // 0001 =3D SDP Attached - // 0010 =3D DCP Attached - // 0011 =3D CDP Attached - // 0100 =3D ACA Attached - // 0101 =3D SE1 Attached - // 0110 =3D MHL Attached - // 0111 =3D Floating D+/D- Attached - // 1000 =3D Other Attached - // 1001 =3D DCP detected by ext. USB PHY - // 1010-1111 =3D Rsvd - // Reset: 0000B - // - - Value8 =3DPmicRead8 (0x5E, 0X29); - if ((Value8 & 0x03) !=3D 0x02) { - *PortType =3D EfiUsbUnknownPort; - Status =3D EFI_NOT_READY; - goto out; - } - - Value8 =3D Value8 >> 2 & 0x0f; - Status =3D EFI_SUCCESS; - switch (Value8) { - case 1: - *PortType =3D EfiUsbStandardDownstreamPort; - break; - case 2: - *PortType =3D EfiUsbDedicatedChargingPort; - break; - case 3: - *PortType =3D EfiUsbChargingDownstreamPort; - break; - - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - *PortType =3D EfiUsbUnknownPort; - break; - case 0: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - *PortType =3D EfiUsbUnknownPort; - Status =3D EFI_NOT_READY; - break; - } - -out: - DEBUG ((USB_FUIO_DEBUG_INFO, "DetectPort - Exit\n")); - return EFI_SUCCESS; + return EFI_UNSUPPORTED; } =20 =20 diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.h b= /Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.h index 6bfd17fa69..3a95b931c2 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.h +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.h @@ -11,10 +11,8 @@ #include #include #include -#include #include #include -#include #include #include #include "UsbIoNode.h" diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbIoNode.h b= /Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbIoNode.h index 850653f9d6..0b416ec7a7 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbIoNode.h +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbIoNode.h @@ -11,7 +11,6 @@ #include #include #include -#include =20 #define USB_DEBUG_MEM_NODE_INFO EFI_D_INIT #define USB_DEBUG_MEM_NODE_ERROR EFI_D_ERROR --=20 2.27.0.windows.1