From patchwork Tue Apr 9 22:39:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2418221 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2E5CE3FC71 for ; Tue, 9 Apr 2013 22:40:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933158Ab3DIWku (ORCPT ); Tue, 9 Apr 2013 18:40:50 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:33274 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765335Ab3DIWku (ORCPT ); Tue, 9 Apr 2013 18:40:50 -0400 Received: by mail-la0-f51.google.com with SMTP id fo12so2070156lab.38 for ; Tue, 09 Apr 2013 15:40:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:cc:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=ySsmq2kJTfkmeEkC3fihPu8xFh/wFp2mkukZAnYgZiQ=; b=YzrMTQDB4e22hAFxMotNiedPW+fwOwpX09v6UdLnAN63T9foZ98f3kzEGbnyziuFby fpGrxhjB6LXtkeY3q/KHrvgy1smOgZAlXaMgNXXLkhoctRH8Jo5l0Lc9RZVcKxKxNPo6 FVNqsSTIFq99sgCniPcjibUJj4wWVd+e0eyQN1cl9ra4hjflgFQlpwYBDFukuaMYzrtT a1ZetvBUUM0plvBhjCiCMFcy2IHJWDua+OlGX3NeqSDd2bbCK1QZcMZYmHoCpUhSFoPs pCbgpC2gvj52k70yD/jA6pkL1mVkt/GIwkZ13Hs6WfYwiUn0EKuOvO54ASBsaa2rbhcV Funw== X-Received: by 10.112.88.9 with SMTP id bc9mr15925lbb.22.1365547248475; Tue, 09 Apr 2013 15:40:48 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-87-206.pppoe.mtu-net.ru. [91.79.87.206]) by mx.google.com with ESMTPS id jh4sm13652234lab.7.2013.04.09.15.40.46 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Apr 2013 15:40:47 -0700 (PDT) To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com Subject: [PATCH v3 9/9] rcar-phy: handle platform data Cc: linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Wed, 10 Apr 2013 02:39:47 +0400 MIME-Version: 1.0 Message-Id: <201304100239.47852.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQkKtwoEVlFKs8YZKfjrgT2zCRPaR0Poz87s+Ay7DWh6Ua45cU82mMnhbfQ91N5THWFgRlHa Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Set the USBPCTRL0 register from the passed platform data in rcar_usb_phy_init(); don't reset it to 0 in rcar_usb_phy_shutdown() anymore as that does not make sense. Also, don't allow the driver's probe to succeed when the platform data are not supplied with a device. The patch has been tested on the Marzen and BOCK-W boards. Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto Acked-by: Simon Horman --- Changes since version 2: - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. drivers/usb/phy/rcar-phy.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: renesas/drivers/usb/phy/rcar-phy.c =================================================================== --- renesas.orig/drivers/usb/phy/rcar-phy.c +++ renesas/drivers/usb/phy/rcar-phy.c @@ -1,8 +1,9 @@ /* * Renesas R-Car USB phy driver * - * Copyright (C) 2012 Renesas Solutions Corp. + * Copyright (C) 2012-2013 Renesas Solutions Corp. * Kuninori Morimoto + * Copyright (C) 2013 Cogent Embedded, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -11,10 +12,11 @@ #include #include -#include #include #include #include +#include +#include /* REGS block */ #define USBPCTRL0 0x00 @@ -55,6 +57,7 @@ static int rcar_usb_phy_init(struct usb_ { struct rcar_usb_phy_priv *priv = usb_phy_to_priv(phy); struct device *dev = phy->dev; + struct rcar_phy_platform_data *pdata = dev->platform_data; void __iomem *reg0 = priv->reg0; int i; u32 val; @@ -90,7 +93,7 @@ static int rcar_usb_phy_init(struct usb_ iowrite32(PHY_ENB | PLL_ENB | PHY_RST, (reg0 + USBPCTRL1)); /* set platform specific port settings */ - iowrite32(0x00000000, (reg0 + USBPCTRL0)); + iowrite32(pdata->usbpctrl0, (reg0 + USBPCTRL0)); /* * Bus alignment settings @@ -117,10 +120,8 @@ static void rcar_usb_phy_shutdown(struct spin_lock_irqsave(&priv->lock, flags); - if (priv->counter-- == 1) { /* last user */ - iowrite32(0x00000000, (reg0 + USBPCTRL0)); + if (priv->counter-- == 1) /* last user */ iowrite32(0x00000000, (reg0 + USBPCTRL1)); - } spin_unlock_irqrestore(&priv->lock, flags); } @@ -133,6 +134,11 @@ static int rcar_usb_phy_probe(struct pla void __iomem *reg0; int ret; + if (!pdev->dev.platform_data) { + dev_err(dev, "No platform data\n"); + return -EINVAL; + } + res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res0) { dev_err(dev, "Not enough platform resources\n");