uart_cpu_fdt.c (265973) | uart_cpu_fdt.c (265998) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Semihalf under sponsorship from 6 * the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 The FreeBSD Foundation 3 * All rights reserved. 4 * 5 * This software was developed by Semihalf under sponsorship from 6 * the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: stable/10/sys/dev/uart/uart_cpu_fdt.c 265973 2014-05-13 19:09:00Z ian $"); | 31__FBSDID("$FreeBSD: stable/10/sys/dev/uart/uart_cpu_fdt.c 265998 2014-05-14 01:16:05Z ian $"); |
32 33#include "opt_platform.h" 34 35#include <sys/param.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/systm.h> --- 97 unchanged lines hidden (view full) --- 137 return (0); 138 139 if (devtype != UART_DEV_CONSOLE) 140 return (ENXIO); 141 142 /* 143 * Retrieve /chosen/std{in,out}. 144 */ | 32 33#include "opt_platform.h" 34 35#include <sys/param.h> 36#include <sys/bus.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/systm.h> --- 97 unchanged lines hidden (view full) --- 137 return (0); 138 139 if (devtype != UART_DEV_CONSOLE) 140 return (ENXIO); 141 142 /* 143 * Retrieve /chosen/std{in,out}. 144 */ |
145 if ((chosen = OF_finddevice("/chosen")) == -1) 146 return (ENXIO); 147 for (name = propnames; *name != NULL; name++) { 148 if (phandle_chosen_propdev(chosen, *name, &node) == 0) 149 break; | 145 node = -1; 146 if ((chosen = OF_finddevice("/chosen")) != -1) { 147 for (name = propnames; *name != NULL; name++) { 148 if (phandle_chosen_propdev(chosen, *name, &node) == 0) 149 break; 150 } |
150 } | 151 } |
151 if (*name == NULL) | 152 if (chosen == -1 || *name == NULL) 153 node = OF_finddevice("serial0"); /* Last ditch */ 154 155 if (node == -1) /* Can't find anything */ |
152 return (ENXIO); | 156 return (ENXIO); |
157 |
|
153 /* 154 * Retrieve serial attributes. 155 */ 156 uart_fdt_get_shift(node, &shift); 157 158 if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) 159 br = 0; 160 br = fdt32_to_cpu(br); --- 35 unchanged lines hidden --- | 158 /* 159 * Retrieve serial attributes. 160 */ 161 uart_fdt_get_shift(node, &shift); 162 163 if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) 164 br = 0; 165 br = fdt32_to_cpu(br); --- 35 unchanged lines hidden --- |