From patchwork Tue Dec 10 22:11:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Belisko Marek X-Patchwork-Id: 3320571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BBE29C0D4A for ; Tue, 10 Dec 2013 22:12:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6753320690 for ; Tue, 10 Dec 2013 22:12:43 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 391762068F for ; Tue, 10 Dec 2013 22:12:42 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqVXb-0005Uz-3D; Tue, 10 Dec 2013 22:12:31 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqVXY-0007e7-RF; Tue, 10 Dec 2013 22:12:28 +0000 Received: from mail-oa0-f48.google.com ([209.85.219.48]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VqVXV-0007d4-DM for linux-arm-kernel@lists.infradead.org; Tue, 10 Dec 2013 22:12:26 +0000 Received: by mail-oa0-f48.google.com with SMTP id l6so6304303oag.35 for ; Tue, 10 Dec 2013 14:12:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6lTkBAKOo8CB2mn/qNDOl5Ohgq8BuoTdq5KfUechyS0=; b=IDgz0OIz2vtW2jvXVfaVkVZITE0CUuKq+JT/+93IWuk7+Pl8EzoE7AN2tEQ+HuVagU k4Xqia1J5odcmv0V6m6O/scIByxUAYemNm1Ap93hPhyCgVYr2ktDKjs7OmHJJw9ullQe 22WlKgB+vjeRyBTc8kTxel03Nl7knueygs31XJf+jSnh4In88Jp0863gUhyHIAUZsJdT 9ZqTwIzFFkIcAzVnxXAKODN07v0NAYL6HfPTejkgo00bDEqYZXy0u3Y8WABCThW5DEcr YA6XPca6r7u/cfxzxtXoTFL/LZuKF+u3bCNM0BDaoJAikdBexr82Zns3ZH2eZYbBZ0Hj jK9w== MIME-Version: 1.0 X-Received: by 10.182.144.136 with SMTP id sm8mr3283880obb.63.1386713517085; Tue, 10 Dec 2013 14:11:57 -0800 (PST) Received: by 10.60.60.131 with HTTP; Tue, 10 Dec 2013 14:11:57 -0800 (PST) In-Reply-To: <20131111233152.GR15154@atomide.com> References: <1381784555-18344-1-git-send-email-marek@goldelico.com> <1381784555-18344-2-git-send-email-marek@goldelico.com> <20131111164917.GN15154@atomide.com> <20131111233152.GR15154@atomide.com> Date: Tue, 10 Dec 2013 23:11:57 +0100 Message-ID: Subject: Re: [PATCH 1/3] arm: omap2: Export devconf1 bypass and acbias. From: Belisko Marek To: Tony Lindgren X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131210_171225_514247_550B1FB1 X-CRM114-Status: GOOD ( 35.65 ) X-Spam-Score: -2.7 (--) Cc: linux-fbdev@vger.kernel.org, Russell King - ARM Linux , NeilBrown , "Dr. H. Nikolaus Schaller" , LKML , Tomi Valkeinen , "linux-omap@vger.kernel.org" , Jean-Christophe PLAGNIOL-VILLARD , linux-arm-kernel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Tony, On Tue, Nov 12, 2013 at 12:31 AM, Tony Lindgren wrote: > * Belisko Marek [131111 14:01]: >> Hi Tony, >> >> On Mon, Nov 11, 2013 at 5:49 PM, Tony Lindgren wrote: >> > * Marek Belisko [131014 14:11]: >> >> devconf1 reg access is localized only in mach-omap2 and we need to export >> >> updating of devconf1 from omapdss venc driver (bypass and acbias bits). >> >> Add simple api call which update only necessary bits. >> > ... >> > >> >> +void update_bypass_acbias(bool bypass, bool acbias) >> >> +{ >> >> +#ifdef CONFIG_ARCH_OMAP3 >> >> + int val = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1); >> >> + >> >> + if (bypass) >> >> + val |= OMAP2_TVOUTBYPASS; >> >> + else >> >> + val &= ~OMAP2_TVOUTBYPASS; >> >> + >> >> + if (acbias) >> >> + val |= OMAP2_TVACEN; >> >> + else >> >> + val &= ~OMAP2_TVACEN; >> >> + >> >> + omap_ctrl_writel(val, OMAP343X_CONTROL_DEVCONF1); >> >> +#endif >> > >> > If this is truly a pinmux, you could already access this >> > using pinctrl-single,bits device tree driver. >> > >> > But I guess that won't work yet, so it's best to set this >> > up as a separate driver like we've done for the USB PHY >> > registers. >> >> Can you please point me to that driver directly? I cannot see benefit >> of new driver as as it will be only dummy driver >> with export_symbol_gpl of upper function. Can it sit then in dss >> directory or somewhere else? Thanks. > > You can take a look at drivers/usb/phy/phy-omap-control.c. > > Then there's a device tree using example for control_devconf0 in > Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt. > > Looks like CONTROL_DEVCONF1 contains a bunch of misc registers, > and arch/arm/mach-omap2/hsmmc.c seems to be tinkering with it too. > > It would be best to set it up as omap-ctrl.c driver under drivers > somewhere with few functions exported for DSS and MMC drivers. I create small dummy driver based on phy-omap-control which can be used but before sending patch (with more updates) I would like to get some feedback if my direction is correct. I use that driver with platform device in board file with proper resources and it works fine. It could be easily added also DT bindings. Also you mention somewhere in drivers (but I think misc isn't right place for that). Any opinion on that? Thanks for feedback. > > The reason why it should be a separate driver is that the system > control module can live a separate runtime PM life from the > drivers using the CONTROL_DEVCONF register bits. > > Regards, > > Tony BR, marek diff --git a/drivers/misc/omap-ctrl.c b/drivers/misc/omap-ctrl.c new file mode 100644 index 0000000..ca2e576 --- /dev/null +++ b/drivers/misc/omap-ctrl.c @@ -0,0 +1,84 @@ +/* + * omap-ctrl.c - The part of omap control module. + * + * Copyright (C) 2013 Goldelico GmbH + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Author: Marek Belisko + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include + +static u32 __iomem *devconf1; + +void omap_ctrl_tvoutbypass(int on) +{ + int val = readl(devconf1); + + if (on) + val |= BIT(18); + else + val &= ~BIT(18); + + writel(val, devconf1); +} +EXPORT_SYMBOL_GPL(omap_ctrl_tvoutbypass); + + +void omap_ctrl_acen(int on) +{ + int val = readl(devconf1); + + if (on) + val |= BIT(11); + else + val &= ~BIT(11); + + writel(val, devconf1); +} +EXPORT_SYMBOL_GPL(omap_ctrl_acen); + + +static int omap_ctrl_probe(struct platform_device *pdev) +{ + struct resource *res; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "devconf1"); + devconf1 = devm_ioremap_resource( + &pdev->dev, res); + if (IS_ERR(devconf1)) + return PTR_ERR(devconf1); + + return 0; +} + +struct platform_driver omap_ctrl_driver = { + .probe = omap_ctrl_probe, + .driver = { + .name = "omap-ctrl", + .owner = THIS_MODULE, + }, +}; + +static int __init omap_ctrl_init(void) +{ + return platform_driver_register(&omap_ctrl_driver); +} +subsys_initcall(omap_ctrl_init); + +static void __exit omap_ctrl_exit(void) +{ + platform_driver_unregister(&omap_ctrl_driver); +}