mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
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
This commit is contained in:
parent
3d2a63f5ac
commit
06d8b1ed6e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=281074
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
||||
|
@ -50,5 +50,7 @@ SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data );
|
||||
#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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user