Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932784Ab3HGK12 (ORCPT ); Wed, 7 Aug 2013 06:27:28 -0400 Received: from mail2.gnudd.com ([213.203.150.91]:56437 "EHLO mail.gnudd.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932662Ab3HGK1Z (ORCPT ); Wed, 7 Aug 2013 06:27:25 -0400 Date: Wed, 7 Aug 2013 12:20:48 +0200 From: Davide Ciminaghi To: linux-kernel@vger.kernel.org Cc: rubini@gnudd.com, Giancarlo Asnaghi , x86@kernel.org, "H. Peter Anvin" , Ingo Molnar , Russell King , Thomas Gleixner , devicetree@vger.kernel.org Subject: [PATCH 19/26] x86 STA2X11 platform: create sta2x11-clock-regs device Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: GnuDD, Device Drivers, Embedded Systems, Courses References: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2478 Lines: 69 This patch creates a virtual platform device each time the apb-soc-regs and sctl devices have been probed for a given sta2x11 instance. This will trigger clock registration for such instance. Signed-off-by: Davide Ciminaghi Acked-by: Giancarlo Asnaghi --- arch/x86/include/asm/sta2x11.h | 1 + arch/x86/platform/sta2x11/sta2x11.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/sta2x11.h b/arch/x86/include/asm/sta2x11.h index 31fc648..3c5dee4 100644 --- a/arch/x86/include/asm/sta2x11.h +++ b/arch/x86/include/asm/sta2x11.h @@ -78,6 +78,7 @@ struct sta2x11_instance_data *sta2x11_dev_to_instance(struct device *dev) #define STA2X11_APBREG_NAME "sta2x11-apbreg" #define STA2X11_APB_SOC_REGS_NAME "sta2x11-apb-soc-regs" #define STA2X11_VIC_NAME "sta2x11-vic" +#define STA2X11_CLOCK_REGS_NAME "sta2x11-clock-regs" /* CAN and MLB */ #define APBREG_BSR 0x00 /* Bridge Status Reg */ diff --git a/arch/x86/platform/sta2x11/sta2x11.c b/arch/x86/platform/sta2x11/sta2x11.c index 1f1d1af..57ed10d 100644 --- a/arch/x86/platform/sta2x11/sta2x11.c +++ b/arch/x86/platform/sta2x11/sta2x11.c @@ -243,6 +243,20 @@ struct sta2x11_instance_data *sta2x11_node_to_instance(struct device_node *n) } EXPORT_SYMBOL(sta2x11_node_to_instance); +static int create_clk_dev(struct sta2x11_instance_data *instance) +{ + int stat; + struct platform_device *cpd = + platform_device_alloc(STA2X11_CLOCK_REGS_NAME, instance->id); + if (!cpd) + return -ENOMEM; + + cpd->dev.platform_data = instance; + stat = platform_device_add(cpd); + if (stat < 0) + platform_device_put(cpd); + return stat; +} /* Common probe for the four platform devices */ static int sta2x11_platform_probe(struct platform_device *dev, @@ -312,6 +326,13 @@ static int sta2x11_platform_probe(struct platform_device *dev, } *dst = platform_drv_data; + /* + * When both sctl and apb_soc_regs have been probed, we're ready for + * creating the "sta2x11-clock-regs" platform device + */ + if (instance->sctl && instance->apb_soc_regs) + create_clk_dev(instance); + platform_set_drvdata(dev, platform_drv_data); return 0; } -- 1.7.7.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/