From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 2FF19AC14E9 for ; Wed, 14 Feb 2024 12:44:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=p9YRv6V5RuvR0MI/j+M2V6E+nkqB0HlA8QKY0hOcKQw=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1707914649; v=1; b=xax7/aRJzqYYTYTUUIEIw+VtvchzaeAcQI5qgWLftd9SSNfc9ds8KJ09Bg2wkPuwoBrVDNjJ 1jIaW/bdCpsWdYf8pVIHCBOZjXipOVM6usNhrP+yxkrA9wTxahqUmjDBteimKTi6I/npROm+4dM vocuGwNxyu29dgoSSjHnnZj0= X-Received: by 127.0.0.2 with SMTP id PhC3YY7687511xAWny8h95md; Wed, 14 Feb 2024 04:44:09 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.40233.1707914649243640588 for ; Wed, 14 Feb 2024 04:44:09 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF1CCDA7; Wed, 14 Feb 2024 04:44:49 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4498F3F5A1; Wed, 14 Feb 2024 04:44:07 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Thomas Abraham , Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Pierre Gondois Subject: [edk2-devel] [PATCH 3/3] Platform/ARM: Remove CTA15-A7 support Date: Wed, 14 Feb 2024 13:43:48 +0100 Message-Id: <20240214124348.310345-4-Pierre.Gondois@arm.com> In-Reply-To: <20240214124348.310345-1-Pierre.Gondois@arm.com> References: <20240214124348.310345-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: mPhcL4pwFZ1moycpkzRAR0B1x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="xax7/aRJ"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Pierre Gondois Remove CTA15-A7 support, its associated libraries and files. This effort was started by: https://edk2.groups.io/g/devel/message/115378 Signed-off-by: Pierre Gondois --- Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 7 +- .../Drivers/Isp1761UsbDxe/Isp1761UsbDxe.c | 636 ------------------ .../Drivers/Isp1761UsbDxe/Isp1761UsbDxe.h | 123 ---- .../Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf | 46 -- .../ArmVExpressLibRTSM/Arm/RTSMHelper.S | 91 --- .../ArmVExpressLibRTSM/ArmVExpressLib.inf | 3 - 6 files changed, 1 insertion(+), 905 deletions(-) delete mode 100644 Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp176= 1UsbDxe.c delete mode 100644 Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp176= 1UsbDxe.h delete mode 100644 Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp176= 1UsbDxe.inf delete mode 100644 Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/A= rm/RTSMHelper.S diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc b/Platform/ARM/= VExpressPkg/ArmVExpress.dsc.inc index 9c9e1f79c886..9f51e05af561 100644 --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc @@ -256,7 +256,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] !endif VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolic= yLibRuntimeDxe.inf =20 -[LibraryClasses.ARM, LibraryClasses.AARCH64] +[LibraryClasses.AARCH64] # # It is not possible to prevent the ARM compiler for generic intrinsic= functions. # This library provides the instrinsic functions generate by a given c= ompiler. @@ -480,8 +480,3 @@ [Components.common] !if $(INCLUDE_TFTP_COMMAND) =3D=3D TRUE ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf !endif - -[Components.ARM] - - # ISP1761 USB OTG Controller - Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf diff --git a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe= .c b/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.c deleted file mode 100644 index c23c0ecf737d..000000000000 --- a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.c +++ /dev/null @@ -1,636 +0,0 @@ -/** @file - - WARNING: - This driver fails to follow the UEFI driver model without a good - reason, and only remains in the tree because it is still used by - a small number of platforms. It will be removed when no longer used. - New platforms should not use it, and no one should use this as - reference code for developing new drivers. - - Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include - -#include - -#include - -#include "Isp1761UsbDxe.h" - -/* - Driver for using the NXP ISP1761 as a USB Peripheral controller. - Doesn't use USB OTG - just sets it in Pure Peripheral mode. - - The ISP1582 datasheet has a little more info on the Peripheral control= ler - registers than the ISP1761 datasheet - - We don't do string descriptors. They're optional. - We currently assume the device has one configuration, one interface, o= ne IN - endpoint, and one OUT endpoint (plus the default control endpoint). - - In fact, this driver is the minimum required to implement fastboot. -*/ - -// TODO Make sure the controller isn't sending empty packets when it sho= uldn't -// (check behaviour in cases when Buffer Length isn't explicitly set) - -// ISP1582 Datasheet: -// "Data transfers preceding the status stage must first be fully -// completed before the STATUS bit can be set." -// This variable stores whether some control data has been pended in the= EP0TX -// Tx buffer, so that when an EP0TX interrupt is received we can set the= STATUS -// bit to go to the Status stage of the control transfer. -STATIC BOOLEAN mControlTxPending =3D FALSE; - -STATIC USB_DEVICE_DESCRIPTOR *mDeviceDescriptor; - -// The config descriptor, interface descriptor, and endpoint descriptors= in a -// buffer (in that order) -STATIC VOID *mDescriptors; -// Convenience pointers to those descriptors inside the buffer: -STATIC USB_INTERFACE_DESCRIPTOR *mInterfaceDescriptor; -STATIC USB_CONFIG_DESCRIPTOR *mConfigDescriptor; -STATIC USB_ENDPOINT_DESCRIPTOR *mEndpointDescriptors; - -STATIC USB_DEVICE_RX_CALLBACK mDataReceivedCallback; -STATIC USB_DEVICE_TX_CALLBACK mDataSentCallback; - -// The time between interrupt polls, in units of 100 nanoseconds -// 10 Microseconds -#define ISP1761_INTERRUPT_POLL_PERIOD 10000 - -STATIC -VOID -SelectEndpoint ( - IN UINT8 Endpoint - ) -{ - // The DMA Endpoint Index must not point to the same as the - // Endpoint Index Register. - WRITE_REG32 (ISP1761_DMA_ENDPOINT_INDEX, ((Endpoint + 2) % ISP1761_NUM= _ENDPOINTS)); - WRITE_REG32 (ISP1761_ENDPOINT_INDEX, Endpoint); -} - -// Enable going to the Data stage of a control transfer -STATIC -VOID -DataStageEnable ( - IN UINT8 Endpoint - ) -{ - SelectEndpoint (Endpoint); - WRITE_REG32 (ISP1761_CTRL_FUNCTION, ISP1761_CTRL_FUNCTION_DSEN); -} - -// Go to the Status stage of a successful control transfer -STATIC -VOID -StatusAcknowledge ( - IN UINT8 Endpoint -) -{ - SelectEndpoint (Endpoint); - WRITE_REG32 (ISP1761_CTRL_FUNCTION, ISP1761_CTRL_FUNCTION_STATUS); -} - -// Read the FIFO for the endpoint indexed by Endpoint, into the buffer p= ointed -// at by Buffer, whose size is *Size bytes. -// -// If *Size is less than the number of bytes in the FIFO, return EFI_BUF= FER_TOO_SMALL -// -// Update *Size with the number of bytes of data in the FIFO. -STATIC -EFI_STATUS -ReadEndpointBuffer ( - IN UINT8 Endpoint, - IN OUT UINTN *Size, - IN OUT VOID *Buffer - ) -{ - UINT16 NumBytesAvailable; - UINT32 Val32; - UINTN Index; - UINTN NumBytesRead; - - SelectEndpoint (Endpoint); - - NumBytesAvailable =3D READ_REG16 (ISP1761_BUFFER_LENGTH); - - if (NumBytesAvailable > *Size) { - *Size =3D NumBytesAvailable; - return EFI_BUFFER_TOO_SMALL; - } - *Size =3D NumBytesAvailable; - - /* -- NB! -- - The datasheet says the Data Port is 16 bits but it actually appears = to - be 32 bits. - */ - - // Read 32-bit chunks - for (Index =3D 0; Index < NumBytesAvailable / 4; Index++) { - ((UINT32 *) Buffer)[Index] =3D READ_REG32 (ISP1761_DATA_PORT); - } - - // Read remaining bytes - - // Round NumBytesAvailable down to nearest power of 4 - NumBytesRead =3D NumBytesAvailable & (~0x3); - if (NumBytesRead !=3D NumBytesAvailable) { - Val32 =3D READ_REG32 (ISP1761_DATA_PORT); - // Copy each required byte of 32-bit word into buffer - for (Index =3D 0; Index < NumBytesAvailable % 4; Index++) { - ((UINT8 *) Buffer)[NumBytesRead + Index] =3D Val32 >> (Index * 8); - } - } - return EFI_SUCCESS; -} - -/* - Write an endpoint buffer. Parameters: - Endpoint Endpoint index (see Endpoint Index Register in datashe= et) - MaxPacketSize The MaxPacketSize this endpoint is configured for - Size The size of the Buffer - Buffer The data - - Assumes MaxPacketSize is a multiple of 4. - (It seems that all valid values for MaxPacketSize _are_ multiples of 4= ) -*/ -STATIC -EFI_STATUS -WriteEndpointBuffer ( - IN UINT8 Endpoint, - IN UINTN MaxPacketSize, - IN UINTN Size, - IN CONST VOID *Buffer - ) -{ - UINTN Index; - UINT32 *DwordBuffer; - - DwordBuffer =3D (UINT32 *) Buffer; - SelectEndpoint (Endpoint); - - /* -- NB! -- - The datasheet says the Data Port is 16 bits but it actually appears = to - be 32 bits. - */ - - // Write packets of size MaxPacketSize - while (Size > MaxPacketSize) { - for (Index =3D 0; Index < MaxPacketSize / 4; Index++) { - WRITE_REG32 (ISP1761_DATA_PORT, DwordBuffer[Index]); - } - Size -=3D MaxPacketSize; - DwordBuffer +=3D (MaxPacketSize / sizeof (UINT32)); - } - - // Write remaining data - - if (Size > 0) { - WRITE_REG32 (ISP1761_BUFFER_LENGTH, Size); - - while (Size > 4) { - WRITE_REG32 (ISP1761_DATA_PORT, DwordBuffer[0]); - Size -=3D 4; - DwordBuffer++; - } - - if (Size > 0) { - WRITE_REG32 (ISP1761_DATA_PORT, DwordBuffer[0]); - } - } - - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -HandleGetDescriptor ( - IN USB_DEVICE_REQUEST *Request - ) -{ - EFI_STATUS Status; - UINT8 DescriptorType; - UINTN ResponseSize; - VOID *ResponseData; - - ResponseSize =3D 0; - ResponseData =3D NULL; - Status =3D EFI_SUCCESS; - - // Pretty confused if bmRequestType is anything but this: - ASSERT (Request->RequestType =3D=3D USB_DEV_GET_DESCRIPTOR_REQ_TYPE); - - // Choose the response - DescriptorType =3D Request->Value >> 8; - switch (DescriptorType) { - case USB_DESC_TYPE_DEVICE: - DEBUG ((EFI_D_INFO, "USB: Got a request for device descriptor\n")); - ResponseSize =3D sizeof (USB_DEVICE_DESCRIPTOR); - ResponseData =3D mDeviceDescriptor; - break; - case USB_DESC_TYPE_CONFIG: - DEBUG ((EFI_D_INFO, "USB: Got a request for config descriptor\n")); - ResponseSize =3D mConfigDescriptor->TotalLength; - ResponseData =3D mDescriptors; - break; - case USB_DESC_TYPE_STRING: - DEBUG ((EFI_D_INFO, "USB: Got a request for String descriptor %d\n",= Request->Value & 0xFF)); - break; - default: - DEBUG ((EFI_D_INFO, "USB: Didn't understand request for descriptor 0= x%04x\n", Request->Value)); - Status =3D EFI_NOT_FOUND; - break; - } - - // Send the response - if (ResponseData) { - ASSERT (ResponseSize !=3D 0); - - if (Request->Length < ResponseSize) { - // Truncate response - ResponseSize =3D Request->Length; - } else if (Request->Length > ResponseSize) { - DEBUG ((EFI_D_INFO, "USB: Info: ResponseSize < wLength\n")); - } - - DataStageEnable (ISP1761_EP0TX); - Status =3D WriteEndpointBuffer ( - ISP1761_EP0TX, - MAX_PACKET_SIZE_CONTROL, - ResponseSize, - ResponseData - ); - if (!EFI_ERROR (Status)) { - // Setting this value should cause us to go to the Status stage on= the - // next EP0TX interrupt - mControlTxPending =3D TRUE; - } - } - - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -HandleSetAddress ( - IN USB_DEVICE_REQUEST *Request - ) -{ - // Pretty confused if bmRequestType is anything but this: - ASSERT (Request->RequestType =3D=3D USB_DEV_SET_ADDRESS_REQ_TYPE); - // USB Spec: "The USB device does not change its device address until = after - // the Status stage of this request is completed successfully." - // ISP1582 datasheet: "The new device address is activated when the - // device receives an acknowledgment from the host for the empty packe= t - // token". (StatusAcknowledge causes an empty packet to be sent). - // So, we write the Address register _before_ acking the SET_ADDRESS. - DEBUG ((EFI_D_INFO, "USB: Setting address to %d\n", Request->Value)); - WRITE_REG32 (ISP1761_ADDRESS, Request->Value | ISP1761_ADDRESS_DEVEN); - StatusAcknowledge (ISP1761_EP0TX); - - return EFI_SUCCESS; -} - -// Move the device to the Configured state. -// (This code only supports one configuration for a device, so the confi= guration -// index is ignored) -STATIC -EFI_STATUS -HandleSetConfiguration ( - IN USB_DEVICE_REQUEST *Request - ) -{ - USB_ENDPOINT_DESCRIPTOR *EPDesc; - UINTN Index; - UINT8 EndpointIndex; - - ASSERT (Request->RequestType =3D=3D USB_DEV_SET_CONFIGURATION_REQ_TYPE= ); - DEBUG ((EFI_D_INFO, "USB: Setting configuration.\n")); - - // Configure endpoints - for (Index =3D 0; Index < mInterfaceDescriptor->NumEndpoints; Index++)= { - EPDesc =3D &mEndpointDescriptors[Index]; - - // To simplify for now, assume endpoints aren't "sparse", and are in= order. - ASSERT ((EPDesc->EndpointAddress & 0xF) =3D=3D ((Index / 2) + 1)); - - // Convert from USB endpoint index to ISP1761 endpoint Index - // USB: Endpoint number is bits [3:0], IN/OUT is bit [7] - // ISP1761: Endpoint number is bits [4:1], IN/OUT is bit [0] - EndpointIndex =3D ((EPDesc->EndpointAddress & 0xF) << 1) | - ((EPDesc->EndpointAddress & BIT7) >> 7); - SelectEndpoint (EndpointIndex); - // Set endpoint type (Bulk/Isochronous/Interrupt) - WRITE_REG32 (ISP1761_ENDPOINT_MAX_PACKET_SIZE, EPDesc->MaxPacketSize= ); - // Hardware foible (bug?): Although the datasheet seems to suggest i= t should - // automatically be set to MaxPacketSize, the Buffer Length register= appears - // to be reset to 0, which causes an empty packet to be sent in resp= onse to - // the first IN token of the session. The NOEMPKT field of the Endpo= int Type - // register sounds like it might fix this problem, but it doesn't - // (it's "applicable only in the DMA mode"). - WRITE_REG32 (ISP1761_BUFFER_LENGTH, EPDesc->MaxPacketSize); - WRITE_REG32 (ISP1761_ENDPOINT_TYPE, (EPDesc->Attributes & 0x3) | - ISP1761_ENDPOINT_TYPE_ENABLE); - } - - StatusAcknowledge (ISP1761_EP0TX); - return EFI_SUCCESS; -} - -STATIC -EFI_STATUS -HandleDeviceRequest ( - IN USB_DEVICE_REQUEST *Request - ) -{ - EFI_STATUS Status; - - Status =3D EFI_SUCCESS; - - switch (Request->Request) { - case USB_DEV_GET_DESCRIPTOR: - Status =3D HandleGetDescriptor (Request); - break; - case USB_DEV_SET_ADDRESS: - Status =3D HandleSetAddress (Request); - break; - case USB_DEV_SET_CONFIGURATION: - Status =3D HandleSetConfiguration (Request); - break; - default: - DEBUG ((EFI_D_ERROR, - "Didn't understand RequestType 0x%x Request 0x%x\n", - Request->RequestType, Request->Request)); - Status =3D EFI_INVALID_PARAMETER; - break; - } - - return Status; -} - -// Instead of actually registering interrupt handlers, we poll the contr= oller's -// interrupt source register in this function. -STATIC -VOID -CheckInterrupts ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - UINT32 DcInterrupts; - UINTN NumBytes; - UINTN MoreBytes; - UINT8 Packet[512]; - VOID *DataPacket; - UINT32 HandledInterrupts; - UINT32 UnhandledInterrupts; - EFI_STATUS Status; - - // Set bits in HandledInterrupts to mark the interrupt source handled. - HandledInterrupts =3D 0; - - WRITE_REG32 (ISP1761_DEVICE_UNLOCK, ISP1761_DEVICE_UNLOCK_MAGIC); - - DcInterrupts =3D READ_REG32 (ISP1761_DC_INTERRUPT); - if (DcInterrupts & ISP1761_DC_INTERRUPT_SUSP) { - DEBUG ((EFI_D_INFO, "USB: Suspend\n")); - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_SUSP; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_RESUME) { - DEBUG ((EFI_D_INFO, "USB: Resume\n")); - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_RESUME; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_EP0SETUP) { - NumBytes =3D 512; - ReadEndpointBuffer (0x20, &NumBytes, &Packet); - ASSERT (NumBytes =3D=3D 8); - HandleDeviceRequest ((USB_DEVICE_REQUEST *) Packet); - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_EP0SETUP; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_EP0RX) { - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_EP0RX; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_EP0TX) { - if (mControlTxPending) { - // We previously put some data in the Control Endpoint's IN (Tx) F= IFO. - // We assume that that data has now been sent in response to the I= N token - // that triggered this interrupt. We can therefore go to the Statu= s stage - // of the control transfer. - StatusAcknowledge (ISP1761_EP0TX); - mControlTxPending =3D FALSE; - } - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_EP0TX; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_EP1RX) { - NumBytes =3D 512; - DataPacket =3D AllocatePool (NumBytes); - Status =3D ReadEndpointBuffer (ISP1761_EP1RX, &NumBytes, DataPacket)= ; - if (EFI_ERROR (Status) || NumBytes =3D=3D 0) { - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_ERROR, "Couldn't read EP1RX data: %r\n", Status)); - } - FreePool (DataPacket); - } else { - // Signal this event again so we poll again ASAP - gBS->SignalEvent (Event); - mDataReceivedCallback (NumBytes, DataPacket); - } - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_EP1RX; - } - if (DcInterrupts & ISP1761_DC_INTERRUPT_EP1TX) { - mDataSentCallback (1); - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_EP1TX; - } - if (DcInterrupts & (ISP1761_DC_INTERRUPT_SOF | ISP1761_DC_INTERRUPT_PS= OF)) { - // Don't care about SOFs or pseudo-SOFs - HandledInterrupts |=3D (ISP1761_DC_INTERRUPT_SOF | ISP1761_DC_INTERR= UPT_PSOF); - } - if (ISP1761_DC_INTERRUPT_BRESET) { - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_BRESET; - } - if (ISP1761_DC_INTERRUPT_HS_STAT) { - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_HS_STAT; - } - if (ISP1761_DC_INTERRUPT_VBUS) { - HandledInterrupts |=3D ISP1761_DC_INTERRUPT_VBUS; - } - - UnhandledInterrupts =3D DcInterrupts & (~HandledInterrupts) & ISP1761_= DC_INTERRUPT_MASK; - if (UnhandledInterrupts) { - DEBUG ((EFI_D_ERROR, "USB: Unhandled DC Interrupts: 0x%08x\n", - UnhandledInterrupts)); - } - - // Check if we received any more data while we were handling the inter= rupt. - SelectEndpoint (ISP1761_EP1RX); - MoreBytes =3D READ_REG16 (ISP1761_BUFFER_LENGTH); - if (MoreBytes) { - HandledInterrupts &=3D ~ISP1761_DC_INTERRUPT_EP1RX; - } - - WRITE_REG32 (ISP1761_DC_INTERRUPT, HandledInterrupts); -} - -EFI_STATUS -Isp1761PeriphSend ( - IN UINT8 EndpointIndex, - IN UINTN Size, - IN CONST VOID *Buffer - ) -{ - return WriteEndpointBuffer ( - (EndpointIndex << 1) | 0x1, //Convert to ISP1761 endpoint inde= x, Tx - MAX_PACKET_SIZE_BULK, - Size, - Buffer - ); -} - -EFI_STATUS -EFIAPI -Isp1761PeriphStart ( - IN USB_DEVICE_DESCRIPTOR *DeviceDescriptor, - IN VOID **Descriptors, - IN USB_DEVICE_RX_CALLBACK RxCallback, - IN USB_DEVICE_TX_CALLBACK TxCallback - ) -{ - UINT16 OtgStatus; - UINT8 *Ptr; - EFI_STATUS Status; - EFI_EVENT TimerEvent; - - ASSERT (DeviceDescriptor !=3D NULL); - ASSERT (Descriptors[0] !=3D NULL); - ASSERT (RxCallback !=3D NULL); - ASSERT (TxCallback !=3D NULL); - - WRITE_REG32 (ISP1761_DEVICE_UNLOCK, ISP1761_DEVICE_UNLOCK_MAGIC); - - WRITE_REG32 (ISP1761_SW_RESET_REG, ISP1761_SW_RESET_ALL); - while (READ_REG32 (ISP1761_SW_RESET_REG) & ISP1761_SW_RESET_ALL) { - //busy wait - } - WRITE_REG32 (ISP1761_MODE, ISP1761_MODE_SFRESET); - while (READ_REG32 (ISP1761_MODE) & ISP1761_MODE_SFRESET) { - //busy wait - } - DEBUG ((EFI_D_INFO, "USB: Software reset done\n")); - - WRITE_REG32 (ISP1761_DC_INTERRUPT_ENABLE, 0x03FFFFFF); - WRITE_REG32 (ISP1761_OTG_INTERRUPT_ENABLE_RISE, 0x07FF); - - WRITE_REG8 (ISP1761_ADDRESS, ISP1761_ADDRESS_DEVEN); - WRITE_REG8 (ISP1761_MODE, ISP1761_MODE_WKUPCS | ISP1761_MODE_CLKAON); - - // Use port 1 as peripheral controller (magic - disagrees with datashe= et) - WRITE_REG32 (ISP1761_OTG_CTRL_SET, 0xffff0000); - WRITE_REG32 (ISP1761_OTG_CTRL_SET, 0x000014d1); - - OtgStatus =3D READ_REG16 (ISP1761_OTG_STATUS); - if ((OtgStatus & ISP1761_OTG_STATUS_B_SESS_END) !=3D 0) { - DEBUG ((EFI_D_ERROR, "USB: Vbus not powered.\n")); - } - if ((OtgStatus & ISP1761_OTG_STATUS_A_B_SESS_VLD) =3D=3D 0) { - DEBUG ((EFI_D_ERROR, "USB: Session not valid.\n")); - } - - // Configure Control endpoints - SelectEndpoint (0x20); - WRITE_REG32 (ISP1761_ENDPOINT_MAX_PACKET_SIZE, MAX_PACKET_SIZE_CONTROL= ); - WRITE_REG32 (ISP1761_ENDPOINT_TYPE, ISP1761_ENDPOINT_TYPE_ENABLE); - SelectEndpoint (0x0); - WRITE_REG32 (ISP1761_ENDPOINT_MAX_PACKET_SIZE, MAX_PACKET_SIZE_CONTROL= ); - WRITE_REG32 (ISP1761_ENDPOINT_TYPE, ISP1761_ENDPOINT_TYPE_ENABLE); - SelectEndpoint (0x1); - WRITE_REG32 (ISP1761_ENDPOINT_MAX_PACKET_SIZE, MAX_PACKET_SIZE_CONTROL= ); - WRITE_REG32 (ISP1761_ENDPOINT_TYPE, ISP1761_ENDPOINT_TYPE_ENABLE); - - // Interrupt on all ACK and NAK - WRITE_REG32 (ISP1761_INTERRUPT_CONFIG, ISP1761_INTERRUPT_CONFIG_ACK_ON= LY); - - mDeviceDescriptor =3D DeviceDescriptor; - mDescriptors =3D Descriptors[0]; - - // Right now we just support one configuration - ASSERT (mDeviceDescriptor->NumConfigurations =3D=3D 1); - // ... and one interface - mConfigDescriptor =3D (USB_CONFIG_DESCRIPTOR *)mDescriptors; - ASSERT (mConfigDescriptor->NumInterfaces =3D=3D 1); - - Ptr =3D ((UINT8 *) mDescriptors) + sizeof (USB_CONFIG_DESCRIPTOR); - mInterfaceDescriptor =3D (USB_INTERFACE_DESCRIPTOR *) Ptr; - Ptr +=3D sizeof (USB_INTERFACE_DESCRIPTOR); - - mEndpointDescriptors =3D (USB_ENDPOINT_DESCRIPTOR *) Ptr; - - mDataReceivedCallback =3D RxCallback; - mDataSentCallback =3D TxCallback; - - // Register a timer event so CheckInterrupts gets called periodically - Status =3D gBS->CreateEvent ( - EVT_TIMER | EVT_NOTIFY_SIGNAL, - TPL_CALLBACK, - CheckInterrupts, - NULL, - &TimerEvent - ); - ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status)) { - return Status; - } - - Status =3D gBS->SetTimer ( - TimerEvent, - TimerPeriodic, - ISP1761_INTERRUPT_POLL_PERIOD - ); - ASSERT_EFI_ERROR (Status); - - return Status; -} - -USB_DEVICE_PROTOCOL mUsbDevice =3D { - Isp1761PeriphStart, - Isp1761PeriphSend -}; - - -EFI_STATUS -EFIAPI -Isp1761PeriphEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - UINT32 DeviceId; - EFI_HANDLE Handle; - - DeviceId =3D READ_REG32 (ISP1761_DEVICE_ID); - - if (DeviceId !=3D ISP1761_DEVICE_ID_VAL) { - DEBUG ((EFI_D_ERROR, - "ERROR: Read incorrect device ID for ISP1761: 0x%08x, expected 0x%= 08x\n", - DeviceId , ISP1761_DEVICE_ID_VAL - )); - return EFI_DEVICE_ERROR; - } - - Handle =3D NULL; - return gBS->InstallProtocolInterface ( - &Handle, - &gUsbDeviceProtocolGuid, - EFI_NATIVE_INTERFACE, - &mUsbDevice - ); -} diff --git a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe= .h b/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.h deleted file mode 100644 index f7155d48d8ad..000000000000 --- a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.h +++ /dev/null @@ -1,123 +0,0 @@ -/** @file - - WARNING: - This driver fails to follow the UEFI driver model without a good - reason, and only remains in the tree because it is still used by - a small number of platforms. It will be removed when no longer used. - New platforms should not use it, and no one should use this as - reference code for developing new drivers. - - Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
- - SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#ifndef __ISP1761_USB_DXE_H__ -#define __ISP1761_USB_DXE_H__ - -#define ISP1761_USB_BASE FixedPcdGet32 (PcdIsp1761BaseAddress) - -#define READ_REG32(Offset) MmioRead32 (ISP1761_USB_BASE + Offset) -#define READ_REG16(Offset) (UINT16) READ_REG32 (Offset) -#define WRITE_REG32(Offset, Val) MmioWrite32 (ISP1761_USB_BASE + Offset= , Val) -#define WRITE_REG16(Offset, Val) MmioWrite32 (ISP1761_USB_BASE + Offset= , (UINT32) Val) -#define WRITE_REG8(Offset, Val) MmioWrite32 (ISP1761_USB_BASE + Offset= , (UINT32) Val) - -// Max packet size in bytes (For Full Speed USB 64 is the only valid val= ue) -#define MAX_PACKET_SIZE_CONTROL 64 - -#define MAX_PACKET_SIZE_BULK 512 - -// 8 Endpoints, in and out. Don't count the Endpoint 0 setup buffer -#define ISP1761_NUM_ENDPOINTS 16 - -// Endpoint Indexes -#define ISP1761_EP0SETUP 0x20 -#define ISP1761_EP0RX 0x00 -#define ISP1761_EP0TX 0x01 -#define ISP1761_EP1RX 0x02 -#define ISP1761_EP1TX 0x03 - -// DcInterrupt bits -#define ISP1761_DC_INTERRUPT_BRESET BIT0 -#define ISP1761_DC_INTERRUPT_SOF BIT1 -#define ISP1761_DC_INTERRUPT_PSOF BIT2 -#define ISP1761_DC_INTERRUPT_SUSP BIT3 -#define ISP1761_DC_INTERRUPT_RESUME BIT4 -#define ISP1761_DC_INTERRUPT_HS_STAT BIT5 -#define ISP1761_DC_INTERRUPT_DMA BIT6 -#define ISP1761_DC_INTERRUPT_VBUS BIT7 -#define ISP1761_DC_INTERRUPT_EP0SETUP BIT8 -#define ISP1761_DC_INTERRUPT_EP0RX BIT10 -#define ISP1761_DC_INTERRUPT_EP0TX BIT11 -#define ISP1761_DC_INTERRUPT_EP1RX BIT12 -#define ISP1761_DC_INTERRUPT_EP1TX BIT13 -// All valid peripheral controller interrupts -#define ISP1761_DC_INTERRUPT_MASK 0x003FFFDFF - -#define ISP1761_ADDRESS 0x200 -#define ISP1761_ADDRESS_DEVEN BIT7 - -#define ISP1761_MODE 0x20C -#define ISP1761_MODE_DATA_BUS_WIDTH BIT8 -#define ISP1761_MODE_CLKAON BIT7 -#define ISP1761_MODE_SFRESET BIT4 -#define ISP1761_MODE_WKUPCS BIT2 - -#define ISP1761_ENDPOINT_MAX_PACKET_SIZE 0x204 - -#define ISP1761_ENDPOINT_TYPE 0x208 -#define ISP1761_ENDPOINT_TYPE_NOEMPKT BIT4 -#define ISP1761_ENDPOINT_TYPE_ENABLE BIT3 - -#define ISP1761_INTERRUPT_CONFIG 0x210 -// Interrupt config value to only interrupt on ACK of IN and OUT tokens -#define ISP1761_INTERRUPT_CONFIG_ACK_ONLY BIT2 | BIT5 | BIT6 - -#define ISP1761_DC_INTERRUPT 0x218 -#define ISP1761_DC_INTERRUPT_ENABLE 0x214 - -#define ISP1761_CTRL_FUNCTION 0x228 -#define ISP1761_CTRL_FUNCTION_VENDP BIT3 -#define ISP1761_CTRL_FUNCTION_DSEN BIT2 -#define ISP1761_CTRL_FUNCTION_STATUS BIT1 - -#define ISP1761_DEVICE_UNLOCK 0x27C -#define ISP1761_DEVICE_UNLOCK_MAGIC 0xAA37 - -#define ISP1761_SW_RESET_REG 0x30C -#define ISP1761_SW_RESET_ALL BIT0 - -#define ISP1761_DEVICE_ID 0x370 - -#define ISP1761_OTG_CTRL_SET 0x374 -#define ISP1761_OTG_CTRL_CLR OTG_CTRL_SET + 2 -#define ISP1761_OTG_CTRL_OTG_DISABLE BIT10 -#define ISP1761_OTG_CTRL_VBUS_CHRG BIT6 -#define ISP1761_OTG_CTRL_VBUS_DISCHRG BIT5 -#define ISP1761_OTG_CTRL_DM_PULLDOWN BIT2 -#define ISP1761_OTG_CTRL_DP_PULLDOWN BIT1 -#define ISP1761_OTG_CTRL_DP_PULLUP BIT0 - -#define ISP1761_OTG_STATUS 0x378 -#define ISP1761_OTG_STATUS_B_SESS_END BIT7 -#define ISP1761_OTG_STATUS_A_B_SESS_VLD BIT1 - -#define ISP1761_OTG_INTERRUPT_LATCH_SET 0x37C -#define ISP1761_OTG_INTERRUPT_LATCH_CLR 0x37E -#define ISP1761_OTG_INTERRUPT_ENABLE_RISE 0x384 - -#define ISP1761_DMA_ENDPOINT_INDEX 0x258 - -#define ISP1761_ENDPOINT_INDEX 0x22c -#define ISP1761_DATA_PORT 0x220 -#define ISP1761_BUFFER_LENGTH 0x21c - -// Device ID Values -#define PHILLIPS_VENDOR_ID_VAL 0x04cc -#define ISP1761_PRODUCT_ID_VAL 0x1761 -#define ISP1761_DEVICE_ID_VAL ((ISP1761_PRODUCT_ID_VAL << 16) |\ - PHILLIPS_VENDOR_ID_VAL) - -#endif //ifndef __ISP1761_USB_DXE_H__ diff --git a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe= .inf b/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf deleted file mode 100644 index 40efb73f5db9..000000000000 --- a/Platform/ARM/VExpressPkg/Drivers/Isp1761UsbDxe/Isp1761UsbDxe.inf +++ /dev/null @@ -1,46 +0,0 @@ -#/** @file -# -# WARNING: -# This driver fails to follow the UEFI driver model without a good -# reason, and only remains in the tree because it is still used by -# a small number of platforms. It will be removed when no longer used. -# New platforms should not use it, and no one should use this as -# reference code for developing new drivers. -# -# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
-# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# -#**/ - -[Defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D Isp1761PeriphDxe - FILE_GUID =3D 72d78ea6-4dee-11e3-8100-f3842a48d0a= 0 - MODULE_TYPE =3D UEFI_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D Isp1761PeriphEntryPoint - -[Sources.common] - Isp1761UsbDxe.c - -[LibraryClasses] - DebugLib - IoLib - MemoryAllocationLib - UefiBootServicesTableLib - UefiDriverEntryPoint - -[Protocols] - gEfiDriverBindingProtocolGuid - gUsbDeviceProtocolGuid - -[Packages] - EmbeddedPkg/EmbeddedPkg.dec - MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec - Platform/ARM/VExpressPkg/ArmVExpressPkg.dec - -[Pcd] - gArmVExpressTokenSpaceGuid.PcdIsp1761BaseAddress diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSM= Helper.S b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHe= lper.S deleted file mode 100644 index 08eb9ad091d8..000000000000 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/Arm/RTSMHelper.= S +++ /dev/null @@ -1,91 +0,0 @@ -# -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. -# -# SPDX-License-Identifier: BSD-2-Clause-Patent -# -# - -#include -#include - -#include - -ASM_FUNC(ArmPlatformPeiBootAction) - bx lr - -# IN None -# OUT r0 =3D SCU Base Address -ASM_FUNC(ArmGetScuBaseAddress) - # Read Configuration Base Address Register. ArmCBar cannot be called t= o get - # the Configuration BAR as a stack is not necessary setup. The SCU is = at the - # offset 0x0000 from the Private Memory Region. - mrc p15, 4, r0, c15, c0, 0 - bx lr - -//UINTN -//ArmPlatformGetPrimaryCoreMpId ( -// VOID -// ); -ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) - MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore)) - bx lr - -# IN None -# OUT r0 =3D number of cores present in the system -ASM_FUNC(ArmGetCpuCountPerCluster) - stmfd SP!, {r1-r2} - - # Read CP15 MIDR - mrc p15, 0, r1, c0, c0, 0 - - # Check if the CPU is A15 - mov r1, r1, LSR #4 - MOV32 (r0, ARM_CPU_TYPE_MASK) - and r1, r1, r0 - - MOV32 (r0, ARM_CPU_TYPE_A15) - cmp r1, r0 - beq _Read_cp15_reg - -_CPU_is_not_A15: - mov r2, lr @ Save link register - bl ArmGetScuBaseAddress @ Read SCU Base Address - mov lr, r2 @ Restore link register val - ldr r0, [r0, #A9_SCU_CONFIG_OFFSET] @ Read SCU Config reg to get= CPU count - b _Return - -_Read_cp15_reg: - mrc p15, 1, r0, c9, c0, 2 @ Read C9 register of CP15 to g= et CPU count - lsr r0, #24 - -_Return: - and r0, r0, #3 - # Add '1' to the number of CPU on the Cluster - add r0, r0, #1 - ldmfd SP!, {r1-r2} - bx lr - -//UINTN -//ArmPlatformIsPrimaryCore ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformIsPrimaryCore) - MOV32 (r1, FixedPcdGet32 (PcdArmPrimaryCoreMask)) - and r0, r0, r1 - MOV32 (r1, FixedPcdGet32 (PcdArmPrimaryCore)) - cmp r0, r1 - moveq r0, #1 - movne r0, #0 - bx lr - -//UINTN -//ArmPlatformGetCorePosition ( -// IN UINTN MpId -// ); -ASM_FUNC(ArmPlatformGetCorePosition) - and r1, r0, #ARM_CORE_MASK - and r0, r0, #ARM_CLUSTER_MASK - add r0, r1, r0, LSR #7 - bx lr - -ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpr= essLib.inf b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpr= essLib.inf index 94572861b398..8e6baa8dd8ba 100644 --- a/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.= inf +++ b/Platform/ARM/VExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLib.= inf @@ -32,9 +32,6 @@ [Sources.common] RTSM.c RTSMMem.c =20 -[Sources.ARM] - Arm/RTSMHelper.S - [Sources.AARCH64] AArch64/RTSMHelper.S =20 --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115452): https://edk2.groups.io/g/devel/message/115452 Mute This Topic: https://groups.io/mt/104351724/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-