From patchwork Sat Dec 15 05:39:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 1882171 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 23EEC40079 for ; Sat, 15 Dec 2012 05:46:52 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TjkW6-00050C-EK; Sat, 15 Dec 2012 05:42:30 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TjkW1-0004zu-1K for linux-arm-kernel@lists.infradead.org; Sat, 15 Dec 2012 05:42:27 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi1so2631093pad.36 for ; Fri, 14 Dec 2012 21:42:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=uOAptiquKg/VHPe/FV05YcNZ2NDv0Zv4yDofeLcB9f8=; b=lKeNTqs+qsOPSfxrk73VQfKHHPrCdoXkuzPitJiG8y7rqm26NFNUYabhmOLad8i5Xm nJy4rx6pSJ08ghTIkwRW6f5ikPM12KiQZzzvFRvtg5ILPOLyfIW+QzWdgjeTkP1YNmBJ T1fWWYOtw/Xb/P7F4PcTqe5rr4gb4fWugiJJ83cXcx/MYenXhLma4F/ucsXQC/SF3ohE frtm/ue3ojiSF4+PEJQN0zBqji66TGdsEeDkh9BEQedWBTubeOEEQloMk2nacqk4BHpe pVX3hAO/MYM2rCllK0GmmCT7zr/UUzuSsrUFZm9yaP4nQpNeDtMlA+Dbk44IavGqMA80 iZgg== Received: by 10.68.197.8 with SMTP id iq8mr22198158pbc.56.1355550143293; Fri, 14 Dec 2012 21:42:23 -0800 (PST) Received: from localhost.localdomain ([60.2.93.13]) by mx.google.com with ESMTPS id ip8sm4155514pbc.36.2012.12.14.21.42.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 21:42:22 -0800 (PST) From: Barry Song <21cnbao@gmail.com> To: arnd@arndb.de, rob.herring@calxeda.com, marc.zyngier@arm.com, pawel.moll@arm.com, will.deacon@arm.com, linux@arm.linux.org.uk Subject: [PATCH] arm: vexpress: hook platform_data to clcd_pl11x by amba bus_notify Date: Sat, 15 Dec 2012 13:39:24 +0800 Message-Id: <1355549964-12893-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.7.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121215_004225_260614_1CB81F0A X-CRM114-Status: GOOD ( 17.06 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (21cnbao[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: workgroup.linux@csr.com, linux-arm-kernel@lists.infradead.org, Barry Song X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Barry Song when using dtb to boot v2p-ca9, clcd probe will fail due to missed the platform_data: clcd-pl11x: probe of 10020000.clcd failed with error -22 this patch hooks the platform_data to clcd and make lcd of v2p-ca9 can work while booting vexpress by DTB. Tested on qemu by "qemu-system-arm -M vexpress-a9 -m 512M -kernel zImage -dtb ./vexpress-v2p-ca9.dtb" Signed-off-by: Barry Song --- arch/arm/mach-vexpress/ct-ca9x4.c | 30 +++++++++++++++++++++ arch/arm/mach-vexpress/include/mach/motherboard.h | 1 + arch/arm/mach-vexpress/v2m.c | 10 +++++++ 3 files changed, 41 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c index 4f471fa..92b03e7 100644 --- a/arch/arm/mach-vexpress/ct-ca9x4.c +++ b/arch/arm/mach-vexpress/ct-ca9x4.c @@ -111,6 +111,35 @@ static struct amba_device *ct_ca9x4_amba_devs[] __initdata = { &gpio_device, }; +static int ct_ca9x4_of_amba_notify(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct device *dev = data; + + /* We are only intereted in device addition */ + if (action != BUS_NOTIFY_ADD_DEVICE) + return 0; + + if (!of_find_compatible_node(NULL, NULL, "arm,vexpress,v2p-ca9")) + return 0; + + if (of_device_is_compatible(dev->of_node, "arm,pl111")) + dev->platform_data = &ct_ca9x4_clcd_data; + + return 0; +} + +static struct notifier_block ct_ca9x4_amba_nb = { + .notifier_call = ct_ca9x4_of_amba_notify, +}; + +static void ct_ca9x4_register_bus_nb(void) +{ + /* Register callbacks on OF amba device addition/removal + * to handle linking them to the right platform_data + */ + bus_register_notifier(&amba_bustype, &ct_ca9x4_amba_nb); +} static struct v2m_osc ct_osc1 = { .osc = 1, @@ -211,6 +240,7 @@ struct ct_desc ct_ca9x4_desc __initdata = { .map_io = ct_ca9x4_map_io, .init_irq = ct_ca9x4_init_irq, .init_tile = ct_ca9x4_init, + .bus_notifer = ct_ca9x4_register_bus_nb, #ifdef CONFIG_SMP .init_cpu_map = ct_ca9x4_init_cpu_map, .smp_enable = ct_ca9x4_smp_enable, diff --git a/arch/arm/mach-vexpress/include/mach/motherboard.h b/arch/arm/mach-vexpress/include/mach/motherboard.h index 1e388c7..f88982b 100644 --- a/arch/arm/mach-vexpress/include/mach/motherboard.h +++ b/arch/arm/mach-vexpress/include/mach/motherboard.h @@ -141,6 +141,7 @@ struct ct_desc { void (*init_early)(void); void (*init_irq)(void); void (*init_tile)(void); + void (*bus_notifer)(void); #ifdef CONFIG_SMP void (*init_cpu_map)(void); void (*smp_enable)(unsigned int); diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index 560e0df..e9147f8 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -431,6 +431,8 @@ static void __init v2m_clk_init(void) clk = v2m_osc_register("mb:osc1", &v2m_mb_osc1); for (i = 0; i < ARRAY_SIZE(v2m_osc1_periphs); i++) WARN_ON(clk_register_clkdev(clk, NULL, v2m_osc1_periphs[i])); + if (of_find_compatible_node(NULL, NULL, "arm,vexpress,v2p-ca9")) + WARN_ON(clk_register_clkdev(clk, NULL, "10020000.clcd")); clk = clk_register_fixed_rate(NULL, "mb:osc2", NULL, CLK_IS_ROOT, 24000000); @@ -651,7 +653,15 @@ static struct of_dev_auxdata v2m_dt_auxdata_lookup[] __initdata = { static void __init v2m_dt_init(void) { + int i; + l2x0_of_init(0x00400000, 0xfe0fffff); + + /* some devices need to hook platform_data */ + for (i = 0; i < ARRAY_SIZE(ct_descs); i++) + if (ct_descs[i]->bus_notifer) + ct_descs[i]->bus_notifer(); + of_platform_populate(NULL, of_default_bus_match_table, v2m_dt_auxdata_lookup, NULL); pm_power_off = v2m_power_off;