From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 D793A202E5E60 for ; Fri, 17 Nov 2017 09:01:37 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id o88so2682796wrb.6 for ; Fri, 17 Nov 2017 09:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sfiPVsBdf254jFB04VxtaPbMmdG9tNShxclrXHInqFE=; b=hvohGncFkN0Bl1C0rvaP+FHQD0yl4pNedeDV8NHA1he5AopmBNHvgm3x32dY6VvPVG HZRT6B7ngRswvkH14wd9HVnElxDK7epTmJIau1jLw1fewCHvrqx+tnJ/GF1aqaeLit1W WMalBOHDVQg8mVrvhiTVD07SgzeQN/+aR+3YE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sfiPVsBdf254jFB04VxtaPbMmdG9tNShxclrXHInqFE=; b=bkn6kuD7ZKC1rEd+xcxFCe27/6Nb2hE5oT/Jwri79O6Vd9YzFoSK43dJUxnV7l+wLZ BkVLOkdx2K1TyeElzkRWmyZJSmy7D1VmZ0N2AXBr0pbN8WdKNIHFVkXwt/xJMDoXQK/x N7cDivnvNMgb8iXg03heuV/2PeU2tdGSOFnzGA1LEpcSoaXypSQ61SNukhFsKfTOP50J jX7q+koPVFzDa99x873i5pwmqiq0/73jQ3ygZkcNF2LH+NOFJV6AJeqMYj+/bB7ZxV/G ff7+F507qlBTw/ceZEE/MDR4pwieEEagPXWDlMZfZhvR5lTXE7oKCqeBHmXaVwOm4SGH NxkQ== X-Gm-Message-State: AJaThX714xHnzysu/92kk2HuvdaGWDF3LBJ736s6XC7+12YnnJf4k+9A 6XYbDZCMyYo4qvU4hGT4btWtlA== X-Google-Smtp-Source: AGs4zMZ3CDBjOsIpo2uqGVJpB3uF8M7fPwvX7sZcN2NxEt4Ae6E+1+EZy51IZcLTHgW/MuNBtfM0VA== X-Received: by 10.223.164.206 with SMTP id h14mr4727035wrb.221.1510938347065; Fri, 17 Nov 2017 09:05:47 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id k5sm4589149wmg.21.2017.11.17.09.05.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Nov 2017 09:05:45 -0800 (PST) Date: Fri, 17 Nov 2017 17:05:44 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, daniel.thompson@linaro.org, masami.hiramatsu@linaro.org, methavanitpong.pipat@socionext.com, masahisa.kojima@linaro.org Message-ID: <20171117170544.qkq3i7vszortjola@bivouac.eciton.net> References: <20171110142127.12018-1-ard.biesheuvel@linaro.org> <20171110142127.12018-32-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20171110142127.12018-32-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms v4 31/34] Silicon/Socionext: implement I2C master protocol for SynQuacer I2C X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Nov 2017 17:01:38 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 10, 2017 at 02:21:24PM +0000, Ard Biesheuvel wrote: > Add a driver that produces the I2C master protocol on top of the I2C > controllers that are implemented in the SynQuacer Socionext SoC. Note > that this supports two modes simultaneously: I2C controllers that are > only usable at boot time, and usable via the I2C protocol stack, and > I2C controllers that are dedicated for the RTC or other runtime > components. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel > --- > Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/ComponentName.c | 185 ++++++ > Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c | 238 ++++++++ > Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c | 586 ++++++++++++++++++++ > Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h | 162 ++++++ > Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.inf | 59 ++ > Silicon/Socionext/SynQuacer/SynQuacer.dec | 5 + > 6 files changed, 1235 insertions(+) > > diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c > new file mode 100644 > index 000000000000..22e53408f419 > --- /dev/null > +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/DriverBinding.c > @@ -0,0 +1,238 @@ > +/** @file > + > + Copyright (c) 2017, Linaro Ltd. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the BSD > + License which accompanies this distribution. The full text of the license may > + be found at http://opensource.org/licenses/bsd-license.php. > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#include "SynQuacerI2cDxe.h" > + > +/** > + Tests to see if this driver supports a given controller. > + > + @param This[in] A pointer to the EFI_DRIVER_BINDING_PROTOCOL > + instance. > + @param ControllerHandle[in] The handle of the controller to test. > + @param RemainingDevicePath[in] The remaining device path. > + (Ignored - this is not a bus driver.) > + > + @retval EFI_SUCCESS The driver supports this controller. > + @retval EFI_ALREADY_STARTED The device specified by ControllerHandle is > + already being managed by the driver specified > + by This. > + @retval EFI_UNSUPPORTED The device specified by ControllerHandle is > + not supported by the driver specified by This. > + > +**/ > +EFI_STATUS > +EFIAPI > +SynQuacerI2cDriverBindingSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath > + ) > +{ > + NON_DISCOVERABLE_DEVICE *Dev; > + EFI_STATUS Status; > + > + // > + // Connect to the USB stack USB? > diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c > new file mode 100644 > index 000000000000..0a2d0528e0a7 > --- /dev/null > +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.c > @@ -0,0 +1,586 @@ > +/** @file > + > + Copyright (c) 2017, Linaro, Ltd. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the BSD License > + which accompanies this distribution. The full text of the license may be found at > + http://opensource.org/licenses/bsd-license.php > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#include "SynQuacerI2cDxe.h" > + > +#define __DEBUG(x) do { if (!EfiAtRuntime()) DEBUG (x); } while (0) Not a huge fan of using __ for this. Can you call it BOOTTIME_DEBUG? (This also sounds like a generically useful thing.) > diff --git a/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h > new file mode 100644 > index 000000000000..8c3d7ef67103 > --- /dev/null > +++ b/Silicon/Socionext/SynQuacer/Drivers/SynQuacerI2cDxe/SynQuacerI2cDxe.h > @@ -0,0 +1,162 @@ > +/** @file > + > + Copyright (c) 2017, Linaro, Ltd. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the BSD License > + which accompanies this distribution. The full text of the license may be found at > + http://opensource.org/licenses/bsd-license.php > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef __SYNQUACER_I2C_DXE_H__ > +#define __SYNQUACER_I2C_DXE_H__ > + > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +extern EFI_COMPONENT_NAME2_PROTOCOL gSynQuacerI2cDriverComponentName2; > + > +#define SYNQUACER_I2C_SIGNATURE SIGNATURE_32 ('S', 'I', '2', 'C') > +#define SYNQUACER_I2C_FROM_THIS(a) CR (a, SYNQUACER_I2C_MASTER, \ Could we do a ((a), please? I know this is always meant to be taken on the This pointer, but it just looks syntactically buggy. / Leif