From patchwork Fri Mar 13 02:19:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Ryazanov X-Patchwork-Id: 449754 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 89D051400B7 for ; Fri, 13 Mar 2015 13:29:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=SvOV88TA; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 1C21228C176; Fri, 13 Mar 2015 03:23:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 3778B28BE95 for ; Fri, 13 Mar 2015 03:19:49 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-lb0-f182.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 13 Mar 2015 03:19:41 +0100 (CET) Received: by lbiw7 with SMTP id w7so19956797lbi.7 for ; Thu, 12 Mar 2015 19:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=bp5BzUjhuKVI6U1tLyDFYe6ATP5e51FZ2e2uFqteWok=; b=SvOV88TAsxD+cM+VfvrunfPyxUp2g8F2bV6KeALVAHn00zxU4Aadk9HQarfeRibrsx P5osYHB1LdM9/+0NiGMYo84PNsAw2nddVOajSTm1r1A5SYeM2vk/yyn0oO32F5EgBeEV JT+gnu1fCB+CPk+m5DxZVofLPdKcnEmpGiBexU4ion1yw2GRoT5I1I4XqcHNstLGP26Y 0Zdb06u8QDi4fW9M1sTcnxGSH82duJsXD1HAaJDYI2SKK0fQQ+r5EqR6AotK/scWEnSq lnnWsIUMAb9aNljvtoQt6RUJlyl8cMYvXKxoUgZPV6YK0zIvUHj2X5eNTfAEUh3fTax5 1hrg== X-Received: by 10.112.239.1 with SMTP id vo1mr41511907lbc.110.1426213192269; Thu, 12 Mar 2015 19:19:52 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by mx.google.com with ESMTPSA id ao5sm107290lac.48.2015.03.12.19.19.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Mar 2015 19:19:51 -0700 (PDT) From: Sergey Ryazanov To: OpenWrt Development List Date: Fri, 13 Mar 2015 05:19:16 +0300 Message-Id: <1426213178-5239-12-git-send-email-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1426213178-5239-1-git-send-email-ryazanov.s.a@gmail.com> References: <1426213178-5239-1-git-send-email-ryazanov.s.a@gmail.com> Subject: [OpenWrt-Devel] [PATCH 11/33] atheros: v3.18: rework early initialization X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Do not use prom_init() callback, do memory initialization in plat_mem_setup() callback and move serial port configuration to arch_initcall stage. Signed-off-by: Sergey Ryazanov --- target/linux/atheros/patches-3.18/100-board.patch | 71 +++++++++++----------- .../atheros/patches-3.18/105-ar2315_pci.patch | 20 ++---- 2 files changed, 40 insertions(+), 51 deletions(-) diff --git a/target/linux/atheros/patches-3.18/100-board.patch b/target/linux/atheros/patches-3.18/100-board.patch index 1e39990..2099514 100644 --- a/target/linux/atheros/patches-3.18/100-board.patch +++ b/target/linux/atheros/patches-3.18/100-board.patch @@ -314,7 +314,7 @@ +} --- /dev/null +++ b/arch/mips/ath25/prom.c -@@ -0,0 +1,40 @@ +@@ -0,0 +1,26 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive @@ -332,24 +332,10 @@ + */ + +#include -+#include -+#include -+#include -+#include -+#include -+ +#include -+#include -+#include "ar5312.h" -+#include "ar2315.h" -+#include "devices.h" + +void __init prom_init(void) +{ -+ if (is_ar5312()) -+ ar5312_prom_init(); -+ else -+ ar2315_prom_init(); +} + +void __init prom_free_prom_memory(void) @@ -1486,7 +1472,7 @@ +#endif /* __ASM_MACH_ATH25_AR5312_REGS_H */ --- /dev/null +++ b/arch/mips/ath25/ar5312.c -@@ -0,0 +1,450 @@ +@@ -0,0 +1,449 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive @@ -1904,8 +1890,7 @@ + mips_hpt_frequency = ar5312_cpu_frequency() / 2; +} + -+void __init -+ar5312_prom_init(void) ++void __init ar5312_plat_mem_setup(void) +{ + u32 memsize, memcfg, bank0AC, bank1AC; + u32 devid; @@ -1923,20 +1908,20 @@ + devid >>= AR5312_REV_WMAC_MIN_S; + devid &= AR5312_REV_CHIP; + ath25_board.devid = (u16)devid; -+} + -+void __init ar5312_plat_mem_setup(void) -+{ + /* Clear any lingering AHB errors */ + ar231x_read_reg(AR5312_PROCADDR); + ar231x_read_reg(AR5312_DMAADDR); + ar231x_write_reg(AR5312_WD_CTRL, AR5312_WD_CTRL_IGNORE_EXPIRATION); + + _machine_restart = ar5312_restart; ++} ++ ++void __init ar5312_arch_init(void) ++{ + ath25_serial_setup(AR5312_UART0, AR5312_MISC_IRQ_UART0, + ar5312_sys_frequency()); +} -+ --- /dev/null +++ b/arch/mips/ath25/ar2315.c @@ -0,0 +1,401 @@ @@ -2294,10 +2279,11 @@ + mips_hpt_frequency = ar2315_cpu_frequency() / 2; +} + -+void __init -+ar2315_prom_init(void) ++void __init ar2315_plat_mem_setup(void) +{ -+ u32 memsize, memcfg, devid; ++ u32 memsize, memcfg; ++ u32 devid; ++ u32 config; + + memcfg = ar231x_read_reg(AR2315_MEM_CFG); + memsize = 1 + ((memcfg & SDRAM_DATA_WIDTH_M) >> SDRAM_DATA_WIDTH_S); @@ -2324,11 +2310,6 @@ + break; + } + ath25_board.devid = devid; -+} -+ -+void __init ar2315_plat_mem_setup(void) -+{ -+ u32 config; + + /* Clear any lingering AHB errors */ + config = read_c0_config(); @@ -2338,6 +2319,10 @@ + ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION); + + _machine_restart = ar2315_restart; ++} ++ ++void __init ar2315_arch_init(void) ++{ + ath25_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0, + ar2315_apb_frequency()); +} @@ -2352,8 +2337,8 @@ +void ar2315_arch_init_irq(void); +void ar2315_init_devices(void); +void ar2315_plat_time_init(void); -+void ar2315_prom_init(void); +void ar2315_plat_mem_setup(void); ++void ar2315_arch_init(void); + +#else + @@ -2369,11 +2354,11 @@ +{ +} + -+static inline void ar2315_prom_init(void) ++static inline void ar2315_plat_mem_setup(void) +{ +} + -+static inline void ar2315_plat_mem_setup(void) ++static inline void ar2315_arch_init(void) +{ +} + @@ -2391,8 +2376,8 @@ +void ar5312_arch_init_irq(void); +void ar5312_init_devices(void); +void ar5312_plat_time_init(void); -+void ar5312_prom_init(void); +void ar5312_plat_mem_setup(void); ++void ar5312_arch_init(void); + +#else + @@ -2408,11 +2393,11 @@ +{ +} + -+static inline void ar5312_prom_init(void) ++static inline void ar5312_plat_mem_setup(void) +{ +} + -+static inline void ar5312_plat_mem_setup(void) ++static inline void ar5312_arch_init(void) +{ +} + @@ -2504,7 +2489,7 @@ +#endif --- /dev/null +++ b/arch/mips/ath25/devices.c -@@ -0,0 +1,180 @@ +@@ -0,0 +1,192 @@ +#include +#include +#include @@ -2685,3 +2670,15 @@ +} + +device_initcall(ath25_register_devices); ++ ++static int __init ath25_arch_init(void) ++{ ++ if (is_ar5312()) ++ ar5312_arch_init(); ++ else ++ ar2315_arch_init(); ++ ++ return 0; ++} ++ ++arch_initcall(ath25_arch_init); diff --git a/target/linux/atheros/patches-3.18/105-ar2315_pci.patch b/target/linux/atheros/patches-3.18/105-ar2315_pci.patch index 6a370f4..2a4d7ab 100644 --- a/target/linux/atheros/patches-3.18/105-ar2315_pci.patch +++ b/target/linux/atheros/patches-3.18/105-ar2315_pci.patch @@ -382,22 +382,14 @@ else if (pending & CAUSEF_IP2) do_IRQ(AR2315_IRQ_MISC_INTRS); else if (pending & CAUSEF_IP7) -@@ -428,3 +432,18 @@ void __init ar2315_plat_mem_setup(void) +@@ -427,4 +431,10 @@ void __init ar2315_arch_init(void) + { ath25_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0, ar2315_apb_frequency()); - } + +#ifdef CONFIG_PCI_AR2315 -+static int __init ar2315_pci_init(void) -+{ -+ struct platform_device *pdev; -+ -+ if (!is_ar2315() || ath25_soc != ATH25_SOC_AR2315) -+ return -ENODEV; -+ -+ pdev = platform_device_register_simple("ar2315-pci", -1, NULL, 0); -+ -+ return pdev ? 0 : -ENODEV; -+} -+arch_initcall(ar2315_pci_init); ++ if (ath25_soc == ATH25_SOC_AR2315) { ++ platform_device_register_simple("ar2315-pci", -1, NULL, 0); ++ } +#endif + }