Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/85xx: Add QE common init function

Define a QE init function in common file, and avoid
the same codes being duplicated in board files.

Signed-off-by: Xie Xiaobo <X.Xie@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>

authored by

Xie Xiaobo and committed by
Scott Wood
72c916ae 3d73eb69

+48 -50
+38
arch/powerpc/platforms/85xx/common.c
··· 9 9 #include <linux/of_irq.h> 10 10 #include <linux/of_platform.h> 11 11 12 + #include <asm/qe.h> 12 13 #include <sysdev/cpm2_pic.h> 13 14 14 15 #include "mpc85xx.h" ··· 81 80 cpm2_pic_init(np); 82 81 of_node_put(np); 83 82 irq_set_chained_handler(irq, cpm2_cascade); 83 + } 84 + #endif 85 + 86 + #ifdef CONFIG_QUICC_ENGINE 87 + void __init mpc85xx_qe_init(void) 88 + { 89 + struct device_node *np; 90 + 91 + np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 92 + if (!np) { 93 + np = of_find_node_by_name(NULL, "qe"); 94 + if (!np) { 95 + pr_err("%s: Could not find Quicc Engine node\n", 96 + __func__); 97 + return; 98 + } 99 + } 100 + 101 + if (!of_device_is_available(np)) { 102 + of_node_put(np); 103 + return; 104 + } 105 + 106 + qe_reset(); 107 + of_node_put(np); 108 + 109 + np = of_find_node_by_name(NULL, "par_io"); 110 + if (np) { 111 + struct device_node *ucc; 112 + 113 + par_io_init(np); 114 + of_node_put(np); 115 + 116 + for_each_node_by_name(ucc, "ucc") 117 + par_io_of_config(ucc); 118 + 119 + } 84 120 } 85 121 #endif
+6
arch/powerpc/platforms/85xx/mpc85xx.h
··· 8 8 static inline void __init mpc85xx_cpm2_pic_init(void) {} 9 9 #endif /* CONFIG_CPM2 */ 10 10 11 + #ifdef CONFIG_QUICC_ENGINE 12 + extern void mpc85xx_qe_init(void); 13 + #else 14 + static inline void __init mpc85xx_qe_init(void) {} 15 + #endif 16 + 11 17 #endif
+2 -27
arch/powerpc/platforms/85xx/mpc85xx_mds.c
··· 1 1 /* 2 - * Copyright (C) 2006-2010, 2012 Freescale Semiconductor, Inc. 2 + * Copyright (C) 2006-2010, 2012-2013 Freescale Semiconductor, Inc. 3 3 * All rights reserved. 4 4 * 5 5 * Author: Andy Fleming <afleming@freescale.com> ··· 238 238 { 239 239 struct device_node *np; 240 240 241 - np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 242 - if (!np) { 243 - np = of_find_node_by_name(NULL, "qe"); 244 - if (!np) 245 - return; 246 - } 247 - 248 - if (!of_device_is_available(np)) { 249 - of_node_put(np); 250 - return; 251 - } 252 - 253 - qe_reset(); 254 - of_node_put(np); 255 - 256 - np = of_find_node_by_name(NULL, "par_io"); 257 - if (np) { 258 - struct device_node *ucc; 259 - 260 - par_io_init(np); 261 - of_node_put(np); 262 - 263 - for_each_node_by_name(ucc, "ucc") 264 - par_io_of_config(ucc); 265 - } 266 - 241 + mpc85xx_qe_init(); 267 242 mpc85xx_mds_reset_ucc_phys(); 268 243 269 244 if (machine_is(p1021_mds)) {
+2 -23
arch/powerpc/platforms/85xx/mpc85xx_rdb.c
··· 1 1 /* 2 2 * MPC85xx RDB Board Setup 3 3 * 4 - * Copyright 2009,2012 Freescale Semiconductor Inc. 4 + * Copyright 2009,2012-2013 Freescale Semiconductor Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it 7 7 * under the terms of the GNU General Public License as published by the ··· 98 98 fsl_pci_assign_primary(); 99 99 100 100 #ifdef CONFIG_QUICC_ENGINE 101 - np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 102 - if (!np) { 103 - pr_err("%s: Could not find Quicc Engine node\n", __func__); 104 - goto qe_fail; 105 - } 106 - 107 - qe_reset(); 108 - of_node_put(np); 109 - 110 - np = of_find_node_by_name(NULL, "par_io"); 111 - if (np) { 112 - struct device_node *ucc; 113 - 114 - par_io_init(np); 115 - of_node_put(np); 116 - 117 - for_each_node_by_name(ucc, "ucc") 118 - par_io_of_config(ucc); 119 - 120 - } 101 + mpc85xx_qe_init(); 121 102 #if defined(CONFIG_UCC_GETH) || defined(CONFIG_SERIAL_QE) 122 103 if (machine_is(p1025_rdb)) { 123 104 ··· 129 148 130 149 } 131 150 #endif 132 - 133 - qe_fail: 134 151 #endif /* CONFIG_QUICC_ENGINE */ 135 152 136 153 printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");