Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1777744iog; Thu, 16 Jun 2022 13:40:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sETqwfJ7rUGAIGi5FQrq2Ukfnr8oqfYtzYy3pNDcurdIukZtu2fUPgc+NUW8+wggy4LGNb X-Received: by 2002:a63:3f05:0:b0:40c:25d6:6126 with SMTP id m5-20020a633f05000000b0040c25d66126mr3575112pga.347.1655412037043; Thu, 16 Jun 2022 13:40:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655412037; cv=none; d=google.com; s=arc-20160816; b=Yzajv+jZvoLytcwf/v9lQoxH6iULCND7pDFmbXROQ0UEjeX5hq6YSnvxKkl3bC9a4l 3ZJaPY3LbuyZ5PItkFzYmkj0tTHNCfUXz/kBh22M38IGhUgs1ZUc5wg8bA+194Z1bf4l tBr7JjQ3uLe7zfDpF/66XK+H9NhU+MfSodQ4EaTLu1IHE78RDy55PYqxQg6TOW4s30Y0 fV8nl8IK+Z+rbKrPe9Rl/ELafEPc27BN/I7RfQ6liHarozAkf52xC23cM3u8PKT6WYVX 7K36LfQjokxrvxMDRlg9IND6oexN+m2LDcrzl8JYMLDzW9PXdll+zplwzshhz4/qJo6t Mnpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/t8qIAMAbLyqlKfiO03Wg2ka1KPYsbME17+T/Mq38zc=; b=Zqa+etj9oBp0AtLmpj5pCcD3xFb7qIYV+1nA/Bba64GtsBOg2Ln8keXPL3pMRsyIqw 2LvTY7hAqbP+WgZhphHXgJWamVHfYyv7DVgP5tdz2DSUCmy0jwZmTWxEzitPCkZRJP0Y DoqWsQWzlfHoF3lXmNHGnN7JaGpRMrvwogHmyfQOep/fgOaTi8fxxB1QgZXyb8l3Diee hwnepLP3f0+LronSUQWhYFA3ftJTej0HV4y1E9xaSVb4OA/xthX01P9BVhflguEWEv+i aeB4GQ+6u6xXSTyEU9QCSCytkvQZqxik8yE90fMOKZhyBSPcFbINDY/Dya/GOLJxwtFV +6KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ad8YADGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x1-20020a631701000000b003fd9b4436c8si3834303pgl.254.2022.06.16.13.40.24; Thu, 16 Jun 2022 13:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ad8YADGn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378681AbiFPU3n (ORCPT + 99 others); Thu, 16 Jun 2022 16:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378680AbiFPU3i (ORCPT ); Thu, 16 Jun 2022 16:29:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 600D95DE56; Thu, 16 Jun 2022 13:29:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7F726B825C6; Thu, 16 Jun 2022 20:29:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6149CC34114; Thu, 16 Jun 2022 20:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655411368; bh=kTJqaZh9D0KEgjXW0Y0EXJOrai2Wo9fwvtWAQlG13c8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Ad8YADGn9RLcnFI6kfXZqIvKgEWC1N0Gx6JD++XyRllYdV9VsJ9JeEY53lD89X4o3 oQVAq7UCz1NMbl2IBIVlni2iXv2zSmX24ueoZxa6brr/FKBLv2iYdZEKzA2jR4T1Vo tkq7+Avyj1fJ0ridkAz6yfSUYIg9/m/urFaaQ0JQDXHIbx8eMrezLOvgoatmoKn6O3 sm1URj8sbVNCB/gmOCJI6iFYZIRcqs1vBZHibMJZRf6GIXuhi36qxz88jbhm8+bJS8 UrmpMNQuGYMF34Ev/K7/uvA7dCWOpQP5fNzlKYqwe+KsFjUUDkUVugmY2W5yjkbphq ZI9QOl40CTJOg== Date: Fri, 17 Jun 2022 01:59:26 +0530 From: Manivannan Sadhasivam To: Christian Marangi Cc: Andy Gross , Bjorn Andersson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 1/3] mtd: nand: raw: qcom_nandc: reorder qcom_nand_host struct Message-ID: <20220616202926.GC2889@thinkpad> References: <20220616001835.24393-1-ansuelsmth@gmail.com> <20220616001835.24393-2-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220616001835.24393-2-ansuelsmth@gmail.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 16, 2022 at 02:18:33AM +0200, Christian Marangi wrote: > Reorder structs in nandc driver to save holes. > > Signed-off-by: Christian Marangi Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > drivers/mtd/nand/raw/qcom_nandc.c | 107 +++++++++++++++++------------- > 1 file changed, 62 insertions(+), 45 deletions(-) > > diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c > index 1a77542c6d67..f2990d721733 100644 > --- a/drivers/mtd/nand/raw/qcom_nandc.c > +++ b/drivers/mtd/nand/raw/qcom_nandc.c > @@ -238,6 +238,9 @@ nandc_set_reg(chip, reg, \ > * @bam_ce - the array of BAM command elements > * @cmd_sgl - sgl for NAND BAM command pipe > * @data_sgl - sgl for NAND BAM consumer/producer pipe > + * @last_data_desc - last DMA desc in data channel (tx/rx). > + * @last_cmd_desc - last DMA desc in command channel. > + * @txn_done - completion for NAND transfer. > * @bam_ce_pos - the index in bam_ce which is available for next sgl > * @bam_ce_start - the index in bam_ce which marks the start position ce > * for current sgl. It will be used for size calculation > @@ -250,14 +253,14 @@ nandc_set_reg(chip, reg, \ > * @rx_sgl_start - start index in data sgl for rx. > * @wait_second_completion - wait for second DMA desc completion before making > * the NAND transfer completion. > - * @txn_done - completion for NAND transfer. > - * @last_data_desc - last DMA desc in data channel (tx/rx). > - * @last_cmd_desc - last DMA desc in command channel. > */ > struct bam_transaction { > struct bam_cmd_element *bam_ce; > struct scatterlist *cmd_sgl; > struct scatterlist *data_sgl; > + struct dma_async_tx_descriptor *last_data_desc; > + struct dma_async_tx_descriptor *last_cmd_desc; > + struct completion txn_done; > u32 bam_ce_pos; > u32 bam_ce_start; > u32 cmd_sgl_pos; > @@ -267,25 +270,23 @@ struct bam_transaction { > u32 rx_sgl_pos; > u32 rx_sgl_start; > bool wait_second_completion; > - struct completion txn_done; > - struct dma_async_tx_descriptor *last_data_desc; > - struct dma_async_tx_descriptor *last_cmd_desc; > }; > > /* > * This data type corresponds to the nand dma descriptor > + * @dma_desc - low level DMA engine descriptor > * @list - list for desc_info > - * @dir - DMA transfer direction > + * > * @adm_sgl - sgl which will be used for single sgl dma descriptor. Only used by > * ADM > * @bam_sgl - sgl which will be used for dma descriptor. Only used by BAM > * @sgl_cnt - number of SGL in bam_sgl. Only used by BAM > - * @dma_desc - low level DMA engine descriptor > + * @dir - DMA transfer direction > */ > struct desc_info { > + struct dma_async_tx_descriptor *dma_desc; > struct list_head node; > > - enum dma_data_direction dir; > union { > struct scatterlist adm_sgl; > struct { > @@ -293,7 +294,7 @@ struct desc_info { > int sgl_cnt; > }; > }; > - struct dma_async_tx_descriptor *dma_desc; > + enum dma_data_direction dir; > }; > > /* > @@ -337,52 +338,64 @@ struct nandc_regs { > /* > * NAND controller data struct > * > - * @controller: base controller structure > - * @host_list: list containing all the chips attached to the > - * controller > * @dev: parent device > + * > * @base: MMIO base > - * @base_phys: physical base address of controller registers > - * @base_dma: dma base address of controller registers > + * > * @core_clk: controller clock > * @aon_clk: another controller clock > * > + * @regs: a contiguous chunk of memory for DMA register > + * writes. contains the register values to be > + * written to controller > + * > + * @props: properties of current NAND controller, > + * initialized via DT match data > + * > + * @controller: base controller structure > + * @host_list: list containing all the chips attached to the > + * controller > + * > * @chan: dma channel > * @cmd_crci: ADM DMA CRCI for command flow control > * @data_crci: ADM DMA CRCI for data flow control > + * > * @desc_list: DMA descriptor list (list of desc_infos) > * > * @data_buffer: our local DMA buffer for page read/writes, > * used when we can't use the buffer provided > * by upper layers directly > - * @buf_size/count/start: markers for chip->legacy.read_buf/write_buf > - * functions > * @reg_read_buf: local buffer for reading back registers via DMA > + * > + * @base_phys: physical base address of controller registers > + * @base_dma: dma base address of controller registers > * @reg_read_dma: contains dma address for register read buffer > - * @reg_read_pos: marker for data read in reg_read_buf > * > - * @regs: a contiguous chunk of memory for DMA register > - * writes. contains the register values to be > - * written to controller > - * @cmd1/vld: some fixed controller register values > - * @props: properties of current NAND controller, > - * initialized via DT match data > + * @buf_size/count/start: markers for chip->legacy.read_buf/write_buf > + * functions > * @max_cwperpage: maximum QPIC codewords required. calculated > * from all connected NAND devices pagesize > + * > + * @reg_read_pos: marker for data read in reg_read_buf > + * > + * @cmd1/vld: some fixed controller register values > */ > struct qcom_nand_controller { > - struct nand_controller controller; > - struct list_head host_list; > - > struct device *dev; > > void __iomem *base; > - phys_addr_t base_phys; > - dma_addr_t base_dma; > > struct clk *core_clk; > struct clk *aon_clk; > > + struct nandc_regs *regs; > + struct bam_transaction *bam_txn; > + > + const struct qcom_nandc_props *props; > + > + struct nand_controller controller; > + struct list_head host_list; > + > union { > /* will be used only by QPIC for BAM DMA */ > struct { > @@ -400,22 +413,22 @@ struct qcom_nand_controller { > }; > > struct list_head desc_list; > - struct bam_transaction *bam_txn; > > u8 *data_buffer; > + __le32 *reg_read_buf; > + > + phys_addr_t base_phys; > + dma_addr_t base_dma; > + dma_addr_t reg_read_dma; > + > int buf_size; > int buf_count; > int buf_start; > unsigned int max_cwperpage; > > - __le32 *reg_read_buf; > - dma_addr_t reg_read_dma; > int reg_read_pos; > > - struct nandc_regs *regs; > - > u32 cmd1, vld; > - const struct qcom_nandc_props *props; > }; > > /* > @@ -431,19 +444,21 @@ struct qcom_nand_controller { > * and reserved bytes > * @cw_data: the number of bytes within a codeword protected > * by ECC > - * @use_ecc: request the controller to use ECC for the > - * upcoming read/write > - * @bch_enabled: flag to tell whether BCH ECC mode is used > * @ecc_bytes_hw: ECC bytes used by controller hardware for this > * chip > - * @status: value to be returned if NAND_CMD_STATUS command > - * is executed > + * > * @last_command: keeps track of last command on this chip. used > * for reading correct status > * > * @cfg0, cfg1, cfg0_raw..: NANDc register configurations needed for > * ecc/non-ecc mode for the current nand flash > * device > + * > + * @status: value to be returned if NAND_CMD_STATUS command > + * is executed > + * @use_ecc: request the controller to use ECC for the > + * upcoming read/write > + * @bch_enabled: flag to tell whether BCH ECC mode is used > */ > struct qcom_nand_host { > struct nand_chip chip; > @@ -452,12 +467,10 @@ struct qcom_nand_host { > int cs; > int cw_size; > int cw_data; > - bool use_ecc; > - bool bch_enabled; > int ecc_bytes_hw; > int spare_bytes; > int bbm_size; > - u8 status; > + > int last_command; > > u32 cfg0, cfg1; > @@ -466,23 +479,27 @@ struct qcom_nand_host { > u32 ecc_bch_cfg; > u32 clrflashstatus; > u32 clrreadstatus; > + > + u8 status; > + bool use_ecc; > + bool bch_enabled; > }; > > /* > * This data type corresponds to the NAND controller properties which varies > * among different NAND controllers. > * @ecc_modes - ecc mode for NAND > + * @dev_cmd_reg_start - NAND_DEV_CMD_* registers starting offset > * @is_bam - whether NAND controller is using BAM > * @is_qpic - whether NAND CTRL is part of qpic IP > * @qpic_v2 - flag to indicate QPIC IP version 2 > - * @dev_cmd_reg_start - NAND_DEV_CMD_* registers starting offset > */ > struct qcom_nandc_props { > u32 ecc_modes; > + u32 dev_cmd_reg_start; > bool is_bam; > bool is_qpic; > bool qpic_v2; > - u32 dev_cmd_reg_start; > }; > > /* Frees the BAM transaction memory */ > -- > 2.36.1 > -- மணிவண்ணன் சதாசிவம்