Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753438AbaLAMRH (ORCPT ); Mon, 1 Dec 2014 07:17:07 -0500 Received: from mail-qc0-f179.google.com ([209.85.216.179]:53999 "EHLO mail-qc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347AbaLAMRD (ORCPT ); Mon, 1 Dec 2014 07:17:03 -0500 Date: Mon, 1 Dec 2014 12:16:54 +0000 From: Lee Jones To: micky_ching@realsil.com.cn Cc: sameo@linux.intel.com, chris@printf.net, ulf.hansson@linaro.org, devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, gregkh@linuxfoundation.org, dan.carpenter@oracle.com, rogerable@realtek.com, wei_wang@realsil.com.cn Subject: Re: [PATCH 1/2] mfd: rtsx: add func to split u32 into register Message-ID: <20141201121654.GF15845@x1> References: <51dde5250305623c420e78fa555800ef8fef0a09.1417056337.git.micky_ching@realsil.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <51dde5250305623c420e78fa555800ef8fef0a09.1417056337.git.micky_ching@realsil.com.cn> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Nov 2014, micky_ching@realsil.com.cn wrote: > From: Micky Ching > > Add helper function to write u32 to registers, if we want to put u32 > value to 4 continuous register, this can help us reduce tedious work. > > Signed-off-by: Micky Ching > --- > include/linux/mfd/rtsx_pci.h | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) Okay, I'm happy that Dan is now satisfied. Can I take this patch, or does patch 2 depend on it? > diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h > index 74346d5..bf45ea2 100644 > --- a/include/linux/mfd/rtsx_pci.h > +++ b/include/linux/mfd/rtsx_pci.h > @@ -967,4 +967,19 @@ static inline u8 *rtsx_pci_get_cmd_data(struct rtsx_pcr *pcr) > return (u8 *)(pcr->host_cmds_ptr); > } > > +static inline void rtsx_pci_write_be32(struct rtsx_pcr *pcr, u16 reg, u32 val) > +{ > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val >> 24); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 16); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 8); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val); > +} > + > +static inline void rtsx_pci_write_le32(struct rtsx_pcr *pcr, u16 reg, u32 val) > +{ > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg, 0xFF, val); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 1, 0xFF, val >> 8); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 2, 0xFF, val >> 16); > + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, reg + 3, 0xFF, val >> 24); > +} > #endif -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/