From patchwork Tue Oct 21 11:07:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arun Kumar K X-Patchwork-Id: 26498 X-Patchwork-Delegate: kamil@wypas.org Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1XgXIS-0002Y2-3e; Tue, 21 Oct 2014 13:08:12 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-6) with esmtp id 1XgXIQ-0004W4-3r; Tue, 21 Oct 2014 13:08:12 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932339AbaJULH6 (ORCPT + 1 other); Tue, 21 Oct 2014 07:07:58 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:37525 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932323AbaJULH4 (ORCPT ); Tue, 21 Oct 2014 07:07:56 -0400 Received: by mail-pa0-f51.google.com with SMTP id lj1so1173113pab.38 for ; Tue, 21 Oct 2014 04:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9sYQ2kThoyBSfilgBS7PcImvxUG3M+Vcyy4vn1H8eBQ=; b=Fer6nWI4Sm47TJuaD+1JkF3u8fT9M9E8AxNEaWmZjAjij2jPM6Iore6NZKGWJ3BM/c YrjbbzBgoCQuiUlxDS/CWtvi91UdIBNg+RKYNWzdQljzzJCcqXrxxRlMIJ4UZKYOsAvc 92ruoShC1id4sMjmWqHSH6KMm7oLZSWtLa9FSgRaPtaRYnYNlE5Y4lZ3vX0g0/uaN6ud O500Lo9Pz906v6wZUdedNV1LgtbePRZQGftcLmJp4A8tBqvCzej/PqROwZCJqHXAiGLo h+/YLMR6xIrCU2reTIEGvsTJrYYvefuB1U83EKqRitiym9jk/NB6UfT4EgV7ZprrKFbY +Xbg== X-Received: by 10.70.93.104 with SMTP id ct8mr34170229pdb.72.1413889676373; Tue, 21 Oct 2014 04:07:56 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id s9sm11680849pdp.1.2014.10.21.04.07.52 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 04:07:55 -0700 (PDT) From: Arun Kumar K To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: k.debski@samsung.com, wuchengli@chromium.org, posciak@chromium.org, arun.m@samsung.com, ihf@chromium.org, prathyush.k@samsung.com, kiran@chromium.org, arunkk.samsung@gmail.com Subject: [PATCH v3 08/13] [media] s5p-mfc: modify mfc wakeup sequence for V8 Date: Tue, 21 Oct 2014 16:37:02 +0530 Message-Id: <1413889627-8431-9-git-send-email-arun.kk@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1413889627-8431-1-git-send-email-arun.kk@samsung.com> References: <1413889627-8431-1-git-send-email-arun.kk@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.10.21.110025 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, FROM_NAME_PHRASE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' From: Arun Mankuzhi From MFC V8, the MFC wakeup sequence has changed. MFC wakeup command has to be sent after the host receives firmware load complete status from risc. Signed-off-by: Arun Mankuzhi Signed-off-by: Kiran AVND Signed-off-by: Arun Kumar K --- drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c | 78 +++++++++++++++++++------ 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c index 0d3661b..7c3eaa5 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c @@ -353,6 +353,58 @@ int s5p_mfc_sleep(struct s5p_mfc_dev *dev) return ret; } +static int s5p_mfc_v8_wait_wakeup(struct s5p_mfc_dev *dev) +{ + int ret; + + /* Release reset signal to the RISC */ + dev->risc_on = 1; + mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); + + if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_FW_STATUS_RET)) { + mfc_err("Failed to reset MFCV8\n"); + return -EIO; + } + mfc_debug(2, "Write command to wakeup MFCV8\n"); + ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); + if (ret) { + mfc_err("Failed to send command to MFCV8 - timeout\n"); + return ret; + } + + if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { + mfc_err("Failed to wakeup MFC\n"); + return -EIO; + } + return ret; +} + +static int s5p_mfc_wait_wakeup(struct s5p_mfc_dev *dev) +{ + int ret; + + /* Send MFC wakeup command */ + ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); + if (ret) { + mfc_err("Failed to send command to MFC - timeout\n"); + return ret; + } + + /* Release reset signal to the RISC */ + if (IS_MFCV6_PLUS(dev)) { + dev->risc_on = 1; + mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); + } else { + mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); + } + + if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { + mfc_err("Failed to wakeup MFC\n"); + return -EIO; + } + return ret; +} + int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) { int ret; @@ -365,6 +417,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) ret = s5p_mfc_reset(dev); if (ret) { mfc_err("Failed to reset MFC - timeout\n"); + s5p_mfc_clock_off(); return ret; } mfc_debug(2, "Done MFC reset..\n"); @@ -373,25 +426,16 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev) /* 2. Initialize registers of channel I/F */ s5p_mfc_clear_cmds(dev); s5p_mfc_clean_dev_int_flags(dev); - /* 3. Initialize firmware */ - ret = s5p_mfc_hw_call(dev->mfc_cmds, wakeup_cmd, dev); - if (ret) { - mfc_err("Failed to send command to MFC - timeout\n"); - return ret; - } - /* 4. Release reset signal to the RISC */ - if (IS_MFCV6_PLUS(dev)) { - dev->risc_on = 1; - mfc_write(dev, 0x1, S5P_FIMV_RISC_ON_V6); - } + /* 3. Send MFC wakeup command and wait for completion*/ + if (IS_MFCV8(dev)) + ret = s5p_mfc_v8_wait_wakeup(dev); else - mfc_write(dev, 0x3ff, S5P_FIMV_SW_RESET); - mfc_debug(2, "Ok, now will write a command to wakeup the system\n"); - if (s5p_mfc_wait_for_done_dev(dev, S5P_MFC_R2H_CMD_WAKEUP_RET)) { - mfc_err("Failed to load firmware\n"); - return -EIO; - } + ret = s5p_mfc_wait_wakeup(dev); + s5p_mfc_clock_off(); + if (ret) + return ret; + dev->int_cond = 0; if (dev->int_err != 0 || dev->int_type != S5P_MFC_R2H_CMD_WAKEUP_RET) {