From patchwork Thu May 1 09:56:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29476 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED78C203F3 for ; Thu, 1 May 2014 09:58:16 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id vb8sf15321621obc.11 for ; Thu, 01 May 2014 02:58:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=i8w3LFbNVjcxRtjRVgYpkM3btDfqenBJAvLUrhR9dG8=; b=SC8t0T44IpCAumSljpJ9Xp8p/fXvo9SgfWLIgBPbfulBoNQr20tq7pO/8hTmtJHh73 GFZpvFyeBDmkflllZXCvKGHE9Omq7F7+RjORkTPOJ7e3NX/o8ylLYl/viJjzNP36ZB0h crxrr5l4zrgiRm2KefQNgwYPER6bMC+xBVNNTIzUixwa4br3lWgq4o1cjZoUUZsPFhBm OCcOaySLD9iP8zpNABQ8rTeOZ7ZYovnBXJTQsqb2QEuTPASwDp0sgsiv3y+88gtp3HGi rVfbEvByboImWYnoW8CZYL0LzJ2fvH1paLDvbYMs4hUBvKOodHyD6mOmdRfrFRDSnGLY sp6w== X-Gm-Message-State: ALoCoQnZTOv3qeQk3qMZhVFpYCCzdZZp24WKbF2kE+SK1GfOpBPKWOKWLV/U3wDksILiJ6TBpaif X-Received: by 10.182.128.234 with SMTP id nr10mr5368707obb.0.1398938296531; Thu, 01 May 2014 02:58:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.229 with SMTP id n92ls994618qgd.9.gmail; Thu, 01 May 2014 02:58:16 -0700 (PDT) X-Received: by 10.58.74.38 with SMTP id q6mr8021665vev.7.1398938296402; Thu, 01 May 2014 02:58:16 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id si3si5964086vcb.136.2014.05.01.02.58.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:16 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so3579923veb.8 for ; Thu, 01 May 2014 02:58:16 -0700 (PDT) X-Received: by 10.52.255.99 with SMTP id ap3mr6744311vdd.19.1398938296339; Thu, 01 May 2014 02:58:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12959vcb; Thu, 1 May 2014 02:58:15 -0700 (PDT) X-Received: by 10.194.60.4 with SMTP id d4mr8280641wjr.28.1398938295520; Thu, 01 May 2014 02:58:15 -0700 (PDT) Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) by mx.google.com with ESMTPS id r2si571992wiz.79.2014.05.01.02.58.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:15 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=74.125.82.174; Received: by mail-we0-f174.google.com with SMTP id k48so2911598wev.33 for ; Thu, 01 May 2014 02:58:15 -0700 (PDT) X-Received: by 10.180.84.129 with SMTP id z1mr1554667wiy.8.1398938295117; Thu, 01 May 2014 02:58:15 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.58.13 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:58:14 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones Subject: [PATCH 33/47] mtd: nand: stm_nand_bch: read and write raw (FLEX) Date: Thu, 1 May 2014 10:56:40 +0100 Message-Id: <1398938214-17847-34-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Once the correct READ/WRITE(SEQIN) commands and address locations have been sent to the Controller, these calls are able to read/write the requested information from the FLEX_DATA register. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index aba4bc5..32d2211 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -754,6 +754,41 @@ static void flex_addr(struct nandi_controller *nandi, writel(addr, nandi->base + NANDHAM_FLEX_ADD); } +static int flex_read_raw(struct nandi_controller *nandi, + uint32_t page_addr, + uint32_t col_addr, + uint8_t *buf, uint32_t len) +{ + dev_dbg(nandi->dev, "%s %u bytes at [0x%06x,0x%04x]\n", + __func__, len, page_addr, col_addr); + + BUG_ON(len & 0x3); + BUG_ON((unsigned long)buf & 0x3); + + emiss_nandi_select(STM_NANDI_HAMMING); + nandi_enable_interrupts(nandi, NAND_INT_RBN); + reinit_completion(&nandi->rbn_completed); + + writel(FLEX_DATA_CFG_BEATS_4 | FLEX_DATA_CFG_CSN, + nandi->base + NANDHAM_FLEX_DATAREAD_CONFIG); + + flex_cmd(nandi, NAND_CMD_READ0); + flex_addr(nandi, col_addr, 2); + flex_addr(nandi, page_addr, nandi->extra_addr ? 3 : 2); + flex_cmd(nandi, NAND_CMD_READSTART); + + flex_wait_rbn(nandi); + + readsl(nandi->base + NANDHAM_FLEX_DATA, buf, len / 4); + + nandi_disable_interrupts(nandi, NAND_INT_RBN); + + writel(FLEX_DATA_CFG_BEATS_1 | FLEX_DATA_CFG_CSN, + nandi->base + NANDHAM_FLEX_DATAREAD_CONFIG); + + return 0; +} + /* * Bad Block Tables/Bad Block Markers */