Received: by 10.223.176.46 with SMTP id f43csp262099wra; Thu, 25 Jan 2018 21:37:13 -0800 (PST) X-Google-Smtp-Source: AH8x227jRDQ2aus1wTrJACUAUTM/WWoVhfGhj6wTk+amhx+4u1tcTbftorKowW9cVf0MnjwT4TX6 X-Received: by 2002:a17:902:5582:: with SMTP id g2-v6mr14031702pli.349.1516945033623; Thu, 25 Jan 2018 21:37:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516945033; cv=none; d=google.com; s=arc-20160816; b=gAS5JnSFB2vr/Erp58W66mXx3VYIrk/nEBp317SG7z6YasDuRkqavNXNFjSU98+rF5 I6uBpP77chINkcAexErnvOVpJpOvALD5paStdgWz290hpbgOto1P+mVeDvag3SbRQbaf ukJDpSNrWvJs0Q7AH+x5uNRs1v2K/7MNQSY+nJebWzugrUGTF3bva8MozjOYHjdu+S+2 mBVPvitL2dYzyM8OZTZZzr9Dve/MsUUzHvkuGe4jRvUlQ+KQ3TDl72mxHOfZPya4efuC 1oW1f0pZ16eXQv29tkMovTvVv3o3zPKx3HyW3PZgbpgznHwwVKlzQR7bJG92DNaBkUCn O4ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=baKz9Wj22RG0mTqsfX7OYLDDu9CW81pVE1O9qDq0A+4=; b=HQTYLxGwC1SrwU8HFlzBm3I7JYvEnGpKkMvpMXABZdxn5z5V2UKc8QGlgVQXUv5nEZ IuFKv6lfD4Sgjyf4gddCmpugxN6IUQDJalJ6xF56fUTEnLOAtqULeFGN1oDnhdkRiNDO EypdyclSeF+ugboO5ejCAZhpssunmvDyqwVNRuUsrQzlztrQxFsqD2HnbNUnZ5dcPCAG TTrm19HOYiZsI+9SL6L3jfTE4bO4+ARIIeD6E9r8PXaGQxJg+4NmomTxcYe8I92XIj9p 7UKsByuxO4i+VU5s5+21d5Ktj5+0srB2fQgaz/3qPBPQUBS+bB92siWUfkhQ7XV+yCRK dIjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si2517138pgq.169.2018.01.25.21.36.30; Thu, 25 Jan 2018 21:37:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbeAZFd1 (ORCPT + 99 others); Fri, 26 Jan 2018 00:33:27 -0500 Received: from mga11.intel.com ([192.55.52.93]:30008 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbeAZFd0 (ORCPT ); Fri, 26 Jan 2018 00:33:26 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 21:33:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,415,1511856000"; d="scan'208";a="12730595" Received: from haiyuewa-mobl1.ccr.corp.intel.com (HELO [10.254.215.59]) ([10.254.215.59]) by orsmga007.jf.intel.com with ESMTP; 25 Jan 2018 21:33:23 -0800 Subject: Re: [PATCH arm/aspeed/ast2500 v2] ipmi: add an Aspeed KCS IPMI BMC driver To: Andy Shevchenko , minyard@acm.org, joel@jms.id.au, avifishman70@gmail.com, openbmc@lists.ozlabs.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <1516810009-16353-1-git-send-email-haiyue.wang@linux.intel.com> <1516813514.7000.1235.camel@linux.intel.com> From: "Wang, Haiyue" Message-ID: <793dbcc0-4d28-cddb-c5eb-bf491dff4d92@linux.intel.com> Date: Fri, 26 Jan 2018 13:33:22 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1516813514.7000.1235.camel@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-01-25 01:05, Andy Shevchenko wrote: > On Thu, 2018-01-25 at 00:06 +0800, Haiyue Wang wrote: >> The KCS (Keyboard Controller Style) interface is used to perform in- >> band >> IPMI communication between a server host and its BMC (BaseBoard >> Management >> Controllers). >> >> >> +config ASPEED_KCS_IPMI_BMC >> + depends on ARCH_ASPEED || COMPILE_TEST >> + depends on IPMI_KCS_BMC >> + select REGMAP_MMIO >> + tristate "Aspeed KCS IPMI BMC driver" >> + help >> + Provides a driver for the KCS (Keyboard Controller Style) >> IPMI >> + interface found on Aspeed SOCs (AST2400 and AST2500). >> + >> + The driver implements the BMC side of the KCS contorller, >> it >> + provides the access of KCS IO space for BMC side. >> +static inline u8 read_data(struct kcs_bmc *kcs_bmc) >> +{ >> + return kcs_bmc->io_inputb(kcs_bmc, kcs_bmc->ioreg.idr); >> +} >> + >> +static inline void write_data(struct kcs_bmc *kcs_bmc, u8 data) >> +{ >> + kcs_bmc->io_outputb(kcs_bmc, kcs_bmc->ioreg.odr, data); >> +} >> + >> +static inline u8 read_status(struct kcs_bmc *kcs_bmc) >> +{ >> + return kcs_bmc->io_inputb(kcs_bmc, kcs_bmc->ioreg.str); >> +} >> + >> +static inline void write_status(struct kcs_bmc *kcs_bmc, u8 data) >> +{ >> + kcs_bmc->io_outputb(kcs_bmc, kcs_bmc->ioreg.str, data); >> +} >> + >> +static void update_status_bits(struct kcs_bmc *kcs_bmc, u8 mask, u8 >> val) >> +{ >> + u8 tmp; >> + >> + tmp = read_status(kcs_bmc); >> + >> + tmp &= ~mask; >> + tmp |= val & mask; >> + >> + write_status(kcs_bmc, tmp); >> +} > Shouldn't be above some kind of regmap API? It is KCS spec defined IO access for hidden the low level, if the low level supports regmap, such as in kcs_bmc_aspeed.c, aspeed_kcs_inb & aspeed_kcs_outb. > >> +/* Different phases of the KCS BMC module */ >> +enum kcs_phases { >> + /* BMC should not be expecting nor sending any data. */ >> + KCS_PHASE_IDLE, > Perhaps kernel-doc? Code + inline comments should be better than kernel-doc ? Or move it out like : /* The interface for checksum offload between the stack and networking drivers  * is as follows...  *  * A. IP checksum related features  *  * Drivers advertise checksum offload capabilities in the features of a device.  * From the stack's point of view these are capabilities offered by the driver,  * a driver typically only advertises features that it is capable of offloading  * to its device.  *  * The checksum related features are:  *  *    NETIF_F_HW_CSUM    - The driver (or its device) is able to compute one  *              IP (one's complement) checksum for any combination  *              of protocols or protocol layering. The checksum is  *              computed and set in a packet per the CHECKSUM_PARTIAL  *              interface (see below).  *  *    NETIF_F_IP_CSUM - Driver (device) is only able to checksum plain  *              TCP or UDP packets over IPv4. These are specifically  *              unencapsulated packets of the form IPv4|TCP or  *              IPv4|UDP where the Protocol field in the IPv4 header  *              is TCP or UDP. The IPv4 header may contain IP options  *              This feature cannot be set in features for a device  *              with NETIF_F_HW_CSUM also set. This feature is being  *              DEPRECATED (see below). >> +}; > >> +/* IPMI 2.0 - 9.5, KCS Interface Registers */ >> +struct kcs_ioreg { >> + u32 idr; /* Input Data Register */ >> + u32 odr; /* Output Data Register */ >> + u32 str; /* Status Register */ > kernel-doc >> +}; >> + >> +static inline void *kcs_bmc_priv(const struct kcs_bmc *kcs_bmc) >> +{ >> + return kcs_bmc->priv; >> +} >> + >> +extern int kcs_bmc_handle_event(struct kcs_bmc *kcs_bmc); >> +extern struct kcs_bmc *kcs_bmc_alloc(struct device *dev, int >> sizeof_priv, >> + u32 channel); > Drop extern. After dropping extern, it truly passed compilation, have any special reason to drop 'extern' ? I saw in kernel still use extern like : extern void printk_nmi_init(void); >> +#endif > Next one could be reviewed when you split this patch to two. Got it!