From owner-svn-src-head@FreeBSD.ORG Sat Apr 4 09:57:54 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D12E2BE; Sat, 4 Apr 2015 09:57:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2BFC176; Sat, 4 Apr 2015 09:57:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t349vrtk050348; Sat, 4 Apr 2015 09:57:53 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t349vrSl050344; Sat, 4 Apr 2015 09:57:53 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201504040957.t349vrSl050344@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sat, 4 Apr 2015 09:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281074 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2015 09:57:54 -0000 Author: andrew Date: Sat Apr 4 09:57:52 2015 New Revision: 281074 URL: https://svnweb.freebsd.org/changeset/base/281074 Log: Remove the extra copy of uart_fdt_get_clock and uart_fdt_get_shift. While here also use OF_getencprop in uart_fdt_get_clock. Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/uart/uart_bus_fdt.c head/sys/dev/uart/uart_cpu_fdt.c head/sys/dev/uart/uart_cpu_fdt.h Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Sat Apr 4 09:21:56 2015 (r281073) +++ head/sys/dev/uart/uart_bus_fdt.c Sat Apr 4 09:57:52 2015 (r281074) @@ -63,38 +63,6 @@ static driver_t uart_fdt_driver = { sizeof(struct uart_softc), }; -static int -uart_fdt_get_clock(phandle_t node, pcell_t *cell) -{ - pcell_t clock; - - /* - * clock-frequency is a FreeBSD-specific hack. Make its presence optional. - */ - if ((OF_getprop(node, "clock-frequency", &clock, - sizeof(clock))) <= 0) - clock = 0; - - if (clock == 0) - /* Try to retrieve parent 'bus-frequency' */ - /* XXX this should go to simple-bus fixup or so */ - if ((OF_getprop(OF_parent(node), "bus-frequency", &clock, - sizeof(clock))) <= 0) - clock = 0; - - *cell = fdt32_to_cpu(clock); - return (0); -} - -static int -uart_fdt_get_shift(phandle_t node, pcell_t *cell) -{ - - if ((OF_getencprop(node, "reg-shift", cell, sizeof(*cell))) <= 0) - *cell = 0; - return (0); -} - static uintptr_t uart_fdt_find_device(device_t dev) { Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Sat Apr 4 09:21:56 2015 (r281073) +++ head/sys/dev/uart/uart_cpu_fdt.c Sat Apr 4 09:57:52 2015 (r281074) @@ -58,28 +58,27 @@ __FBSDID("$FreeBSD$"); bus_space_tag_t uart_bus_space_io; bus_space_tag_t uart_bus_space_mem; -static int +int uart_fdt_get_clock(phandle_t node, pcell_t *cell) { pcell_t clock; /* clock-frequency is a FreeBSD-only extention. */ - if ((OF_getprop(node, "clock-frequency", &clock, + if ((OF_getencprop(node, "clock-frequency", &clock, sizeof(clock))) <= 0) clock = 0; if (clock == 0) /* Try to retrieve parent 'bus-frequency' */ /* XXX this should go to simple-bus fixup or so */ - if ((OF_getprop(OF_parent(node), "bus-frequency", &clock, + if ((OF_getencprop(OF_parent(node), "bus-frequency", &clock, sizeof(clock))) <= 0) clock = 0; - *cell = fdt32_to_cpu(clock); return (0); } -static int +int uart_fdt_get_shift(phandle_t node, pcell_t *cell) { Modified: head/sys/dev/uart/uart_cpu_fdt.h ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.h Sat Apr 4 09:21:56 2015 (r281073) +++ head/sys/dev/uart/uart_cpu_fdt.h Sat Apr 4 09:57:52 2015 (r281074) @@ -50,5 +50,7 @@ SET_DECLARE(uart_fdt_class_set, struct o #define UART_FDT_CLASS(data) \ DATA_SET(uart_fdt_class_set, data) +int uart_fdt_get_clock(phandle_t node, pcell_t *cell); +int uart_fdt_get_shift(phandle_t node, pcell_t *cell); #endif /* _DEV_UART_CPU_FDT_H_ */