From patchwork Thu Apr 4 23:13:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2395431 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 7B42C3FD1A for ; Thu, 4 Apr 2013 23:14:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765001Ab3DDXOS (ORCPT ); Thu, 4 Apr 2013 19:14:18 -0400 Received: from mail-lb0-f169.google.com ([209.85.217.169]:46510 "EHLO mail-lb0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764718Ab3DDXOR (ORCPT ); Thu, 4 Apr 2013 19:14:17 -0400 Received: by mail-lb0-f169.google.com with SMTP id p11so3254609lbi.0 for ; Thu, 04 Apr 2013 16:14:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:from:organization:cc:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=sVZWFalHyFvHdcrL6VvqRk/rjO54ScJAlP6yRVSOO2g=; b=l/ktY5Hn7UQSYFYVyNfcDhSpqP/BcK6F03c28APKXnhA/coJFKpXJx1KTIgcg7eJc7 10MODvqT3KqpexWeHCpKy+reLGW/eRf32mzvJ2XQwDbIa/WrkfYgsqJjHfV9vrqVKPeF MDGJMvK0SKFLALW8bqbh2FbES1nPqXaXMP6F2o3yXJ38suqXpRstN/GiiRjpA4PMWuDF AWtM3mMz1waqIxXLQwquifnINJCt7Gny6oq8vLriDokyl7cAVc5cOZT3c1eqgSPMs3XL NKj/8CnvCb5Wcb7pOuVpu9JN2+PVJJ/mPOxvZBnV/gxu0e+DnyS2w6BSAIYloNM7DZcI GeWg== X-Received: by 10.112.130.201 with SMTP id og9mr4636160lbb.65.1365117256300; Thu, 04 Apr 2013 16:14:16 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-100-82.pppoe.mtu-net.ru. [91.79.100.82]) by mx.google.com with ESMTPS id i3sm4622171lbn.0.2013.04.04.16.14.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 04 Apr 2013 16:14:15 -0700 (PDT) To: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com Subject: [PATCH 8/8] rcar-phy: handle platform data From: Sergei Shtylyov Organization: Cogent Embedded Cc: linux-sh@vger.kernel.org Date: Fri, 5 Apr 2013 03:13:03 +0400 MIME-Version: 1.0 Message-Id: <201304050313.03609.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnsmTbGkQ1dMoAtvLIdql8sBy+TodkpVrGl0N2lGrujQaCz4NaMltLhIE4Ploid2k8y+3UQ 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. Signed-off-by: Sergei Shtylyov --- 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");