From patchwork Wed Oct 26 01:26:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 686837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3t3XSD5CTQz9t0Z for ; Wed, 26 Oct 2016 12:27:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=HTyfa0rb; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 81ADBA75C9; Wed, 26 Oct 2016 03:26:54 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cc8v68pnXwoy; Wed, 26 Oct 2016 03:26:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F18C7A75CF; Wed, 26 Oct 2016 03:26:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B6C51A759A for ; Wed, 26 Oct 2016 03:26:38 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tfb4YlR8OEaa for ; Wed, 26 Oct 2016 03:26:38 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by theia.denx.de (Postfix) with ESMTPS id 66B7DA7597 for ; Wed, 26 Oct 2016 03:26:31 +0200 (CEST) Received: by mail-pf0-f196.google.com with SMTP id n85so1961319pfi.3 for ; Tue, 25 Oct 2016 18:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dVxFAWxbPHtiEOPMiewBL+7i2bf1bpzF8+tRTr6t1a8=; b=HTyfa0rbr2w8vAxKVjZWrTY0B3MBy0x2JHIcLGSPWJYRrZe9Tb5a1IVRxYe9Ghjsu6 vEkKnJL+cTWJ5cYJjWKlqr9y8l8OcQKTp3tzGkrloNEGNmys94hNM686uDRMn3pBcYMn NwFHtVBPUU3UutCG2gDw25cRj4KgdhvbOTKA7MqT+lHjYlPkAk04y9GkePifNsDpgVRQ xwM7WpYomDOtN3jAvTLK2UG/+DNFLS6MmnRsky3jl6FghUHNZeygHgF3xqsYdVmCa6D8 Xf+a8MTeJAHEEJHIcKNT04DWfW4K0Y9puxTy4hKQplZegw+hBRJ1Jg2dM6Usk0ksSYGI 9CuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dVxFAWxbPHtiEOPMiewBL+7i2bf1bpzF8+tRTr6t1a8=; b=CPeKCk6iYCK4nt6X9zbyrw/aIdQnILFBRQzvNJ4OvtPFBEJnN1zVbDPimsuxzg9R9e Uw6pUVDFvq5z5hnpwWTiJ4+u1Cp4Kc3U4b1N4MCdT/RSaZw/49RA1jZGA/JOI+dQG/8v oqOzbIicfFVDBayqxevfMzKAS5A0juRINvvUuK3Ltq+aRNp/XJw7j+nu68AUGZGd2d+8 9s4YSkG04ygahPMO/d/mIaDCSPodO5wbj9mVMSbge01576ABOIzPw4SI4RDLmDN+vnKS KcRdJfIZ9z3dLGDjP6NrFf990Cwj0NEHlClJBtCdn/gNByuucTDk3rHTkxvKOJ8M9xgf 9ojw== X-Gm-Message-State: ABUngvf5PH9ppjnmBH07U+zs4eg/MolLXElDrhvfAJpxLyYwMiWkzIEfMrzvIzWq4UmaSw== X-Received: by 10.99.127.12 with SMTP id a12mr10993523pgd.33.1477445190193; Tue, 25 Oct 2016 18:26:30 -0700 (PDT) Received: from chrisp-dl.atlnz.lc ([2001:df5:b000:22:a4a7:b31:c210:ddc6]) by smtp.gmail.com with ESMTPSA id ij5sm36231958pab.2.2016.10.25.18.26.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 18:26:29 -0700 (PDT) From: Chris Packham To: u-boot@lists.denx.de Date: Wed, 26 Oct 2016 14:26:04 +1300 Message-Id: <20161026012612.9479-3-judge.packham@gmail.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161026012612.9479-1-judge.packham@gmail.com> References: <20161026012612.9479-1-judge.packham@gmail.com> Cc: Luka Perkov , Scott Wood , Scott Wood , Stefan Roese , Chris Packham Subject: [U-Boot] [RFC PATCH v2 02/10] mtd: nand: pxa3xx_nand: use nand_to_mtd() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Don't store struct mtd_info in struct pxa3xx_nand_host. Instead use the one that is already part of struct nand_chip. This brings us in line with current U-boot and Linux conventions. Signed-off-by: Chris Packham --- Changes in v2: - Drop irrelevant Cc from commit message drivers/mtd/nand/pxa3xx_nand.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 8d7f7a845a9d..a5b9332456ec 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -147,7 +147,6 @@ enum pxa3xx_nand_variant { struct pxa3xx_nand_host { struct nand_chip chip; - struct mtd_info *mtd; void *info_data; /* page size of attached chip */ @@ -380,16 +379,17 @@ static int pxa3xx_nand_init_timings(struct pxa3xx_nand_host *host) struct nand_chip *chip = &host->chip; struct pxa3xx_nand_info *info = host->info_data; const struct pxa3xx_nand_flash *f = NULL; + struct mtd_info *mtd = nand_to_mtd(&host->chip); int mode, id, ntypes, i; mode = onfi_get_async_timing_mode(chip); if (mode == ONFI_TIMING_MODE_UNKNOWN) { ntypes = ARRAY_SIZE(builtin_flash_types); - chip->cmdfunc(host->mtd, NAND_CMD_READID, 0x00, -1); + chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); - id = chip->read_byte(host->mtd); - id |= chip->read_byte(host->mtd) << 0x8; + id = chip->read_byte(mtd); + id |= chip->read_byte(mtd) << 0x8; for (i = 0; i < ntypes; i++) { f = &builtin_flash_types[i]; @@ -682,7 +682,7 @@ static void set_command_address(struct pxa3xx_nand_info *info, static void prepare_start_command(struct pxa3xx_nand_info *info, int command) { struct pxa3xx_nand_host *host = info->host[info->cs]; - struct mtd_info *mtd = host->mtd; + struct mtd_info *mtd = nand_to_mtd(&host->chip); /* reset data and oob column point to handle data */ info->buf_start = 0; @@ -733,7 +733,7 @@ static int prepare_set_command(struct pxa3xx_nand_info *info, int command, struct mtd_info *mtd; host = info->host[info->cs]; - mtd = host->mtd; + mtd = nand_to_mtd(&host->chip); addr_cycle = 0; exec_cmd = 1; @@ -1220,7 +1220,7 @@ static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this) static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info) { struct pxa3xx_nand_host *host = info->host[info->cs]; - struct mtd_info *mtd = host->mtd; + struct mtd_info *mtd = nand_to_mtd(&host->chip); struct nand_chip *chip = mtd_to_nand(mtd); info->reg_ndcr |= (host->col_addr_cycles == 2) ? NDCR_RA_START : 0; @@ -1272,7 +1272,7 @@ static int pxa3xx_nand_sensing(struct pxa3xx_nand_host *host) const struct nand_sdr_timings *timings; int ret; - mtd = info->host[info->cs]->mtd; + mtd = nand_to_mtd(&info->host[info->cs]->chip); chip = mtd_to_nand(mtd); /* configure default flash values */ @@ -1493,7 +1493,6 @@ static int alloc_nand_resource(struct pxa3xx_nand_info *info) mtd = nand_to_mtd(chip); host = (struct pxa3xx_nand_host *)chip; info->host[cs] = host; - host->mtd = mtd; host->cs = cs; host->info_data = info; host->read_id_bytes = 4; @@ -1568,7 +1567,7 @@ static int pxa3xx_nand_probe(struct pxa3xx_nand_info *info) probe_success = 0; for (cs = 0; cs < pdata->num_cs; cs++) { - struct mtd_info *mtd = info->host[cs]->mtd; + struct mtd_info *mtd = nand_to_mtd(&info->host[cs]->chip); /* * The mtd name matches the one used in 'mtdparts' kernel