Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/uart/uart_dev_ns8250.c
Show All 20 Lines | |||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
*/ | */ | ||||
#include "opt_acpi.h" | |||||
#include "opt_platform.h" | #include "opt_platform.h" | ||||
#include "opt_uart.h" | #include "opt_uart.h" | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
Show All 12 Lines | |||||
#include <dev/uart/uart.h> | #include <dev/uart/uart.h> | ||||
#include <dev/uart/uart_cpu.h> | #include <dev/uart/uart_cpu.h> | ||||
#ifdef FDT | #ifdef FDT | ||||
#include <dev/uart/uart_cpu_fdt.h> | #include <dev/uart/uart_cpu_fdt.h> | ||||
#endif | #endif | ||||
#include <dev/uart/uart_bus.h> | #include <dev/uart/uart_bus.h> | ||||
#include <dev/uart/uart_dev_ns8250.h> | #include <dev/uart/uart_dev_ns8250.h> | ||||
#include <dev/uart/uart_ppstypes.h> | #include <dev/uart/uart_ppstypes.h> | ||||
#ifdef DEV_ACPI | |||||
#include <dev/uart/uart_cpu_acpi.h> | |||||
#include <isa/isavar.h> | |||||
imp: You can and should delete this. It's not needed. | |||||
Not Done Inline Actionswhy is this line still there? I don't think it's needed... imp: why is this line still there? I don't think it's needed... | |||||
#include <contrib/dev/acpica/include/acpi.h> | |||||
#include <contrib/dev/acpica/include/accommon.h> | |||||
#include <contrib/dev/acpica/include/actables.h> | |||||
#endif | |||||
#include <dev/ic/ns16550.h> | #include <dev/ic/ns16550.h> | ||||
#include "uart_if.h" | #include "uart_if.h" | ||||
#define DEFAULT_RCLK 1843200 | #define DEFAULT_RCLK 1843200 | ||||
/* | /* | ||||
Done Inline ActionsSpurious? jhb: Spurious? | |||||
* Set the default baudrate tolerance to 3.0%. | * Set the default baudrate tolerance to 3.0%. | ||||
* | * | ||||
* Some embedded boards have odd reference clocks (eg 25MHz) | * Some embedded boards have odd reference clocks (eg 25MHz) | ||||
* and we need to handle higher variances in the target baud rate. | * and we need to handle higher variances in the target baud rate. | ||||
*/ | */ | ||||
#ifndef UART_DEV_TOLERANCE_PCT | #ifndef UART_DEV_TOLERANCE_PCT | ||||
#define UART_DEV_TOLERANCE_PCT 30 | #define UART_DEV_TOLERANCE_PCT 30 | ||||
#endif /* UART_DEV_TOLERANCE_PCT */ | #endif /* UART_DEV_TOLERANCE_PCT */ | ||||
▲ Show 20 Lines • Show All 325 Lines • ▼ Show 20 Lines | struct uart_class uart_ns8250_class = { | ||||
"ns8250", | "ns8250", | ||||
ns8250_methods, | ns8250_methods, | ||||
sizeof(struct ns8250_softc), | sizeof(struct ns8250_softc), | ||||
.uc_ops = &uart_ns8250_ops, | .uc_ops = &uart_ns8250_ops, | ||||
.uc_range = 8, | .uc_range = 8, | ||||
.uc_rclk = DEFAULT_RCLK, | .uc_rclk = DEFAULT_RCLK, | ||||
.uc_rshift = 0 | .uc_rshift = 0 | ||||
}; | }; | ||||
#ifdef DEV_ACPI | |||||
Not Done Inline ActionsYea, I don't like this and the FDT data, but it's not terrible and fixing it is kinda beyond the scope. imp: Yea, I don't like this and the FDT data, but it's not terrible and fixing it is kinda beyond… | |||||
static int | |||||
snps_bus_attach(struct uart_softc *sc) | |||||
{ | |||||
sc->sc_bas.busy_detect = 1; | |||||
return ns8250_bus_attach(sc); | |||||
} | |||||
static kobj_method_t snps_methods[] = { | |||||
KOBJMETHOD(uart_attach, snps_bus_attach), | |||||
KOBJMETHOD(uart_detach, ns8250_bus_detach), | |||||
KOBJMETHOD(uart_flush, ns8250_bus_flush), | |||||
KOBJMETHOD(uart_getsig, ns8250_bus_getsig), | |||||
KOBJMETHOD(uart_ioctl, ns8250_bus_ioctl), | |||||
KOBJMETHOD(uart_ipend, ns8250_bus_ipend), | |||||
KOBJMETHOD(uart_param, ns8250_bus_param), | |||||
KOBJMETHOD(uart_probe, ns8250_bus_probe), | |||||
KOBJMETHOD(uart_receive, ns8250_bus_receive), | |||||
KOBJMETHOD(uart_setsig, ns8250_bus_setsig), | |||||
KOBJMETHOD(uart_transmit, ns8250_bus_transmit), | |||||
KOBJMETHOD(uart_grab, ns8250_bus_grab), | |||||
KOBJMETHOD(uart_ungrab, ns8250_bus_ungrab), | |||||
{ 0, 0 } | |||||
}; | |||||
andrewUnsubmitted Done Inline ActionsWhy is this in the ns8250 driver and not in uart_dev_snps.c? andrew: Why is this in the ns8250 driver and not in `uart_dev_snps.c`? | |||||
mmacyAuthorUnsubmitted Done Inline Actionsmmacy: There's nothing of value to x86 in uart_dev_snps.c apart from this table. Literally _all_ the… | |||||
static struct uart_class uart_snps_class = { | |||||
"snps", | |||||
snps_methods, | |||||
sizeof(struct ns8250_softc), | |||||
.uc_ops = &uart_ns8250_ops, | |||||
.uc_range = 8, | |||||
.uc_rclk = DEFAULT_RCLK, | |||||
.uc_rshift = 0 | |||||
}; | |||||
rajeshaspUnsubmitted Done Inline ActionsCan we use the above SNPS elements from uart_dev_snps.c (by including that file in Makefile)? Or is it done, because it is part of uart_snps driver? rajeshasp: Can we use the above SNPS elements from uart_dev_snps.c (by including that file in Makefile)? | |||||
static struct acpi_uart_compat_data acpi_compat_data[] = { | |||||
{"AMD0020", &uart_snps_class, 0, 2, 0, 48000000, "AMD / Synopsys Designware UART"}, | |||||
Not Done Inline ActionsThe whitespace for this table looks a bit odd as if there's a mix of tabs and spaces perhaps? jhb: The whitespace for this table looks a bit odd as if there's a mix of tabs and spaces perhaps? | |||||
{"AMDI0020", &uart_snps_class, 0, 2, 0, 48000000, "AMD / Synopsys Designware UART"}, | |||||
{"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, "Standard PC COM port"}, | |||||
{"PNP0501", &uart_ns8250_class, 0, 0, 0, 0, "16550A-compatible COM port"}, | |||||
{"PNP0502", &uart_ns8250_class, 0, 0, 0, 0, "Multiport serial device (non-intelligent 16550)"}, | |||||
{"PNP0510", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, | |||||
{"PNP0511", &uart_ns8250_class, 0, 0, 0, 0, "Generic IRDA-compatible device"}, | |||||
{"WACF004", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen"}, | |||||
{"WACF00E", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet PC Screen 00e"}, | |||||
{"FUJ02E5", &uart_ns8250_class, 0, 0, 0, 0, "Wacom Tablet at FuS Lifebook T"}, | |||||
{NULL, NULL, 0, 0 , 0, 0, NULL}, | |||||
}; | |||||
UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data); | |||||
#endif | |||||
#ifdef FDT | #ifdef FDT | ||||
Done Inline ActionsCan probably drop this? Maybe add a name field to acpi_uart_compat_data for the description strings that is then used with device_set_desc() during probe? jhb: Can probably drop this? Maybe add a name field to acpi_uart_compat_data for the description… | |||||
static struct ofw_compat_data compat_data[] = { | static struct ofw_compat_data compat_data[] = { | ||||
{"ns16550", (uintptr_t)&uart_ns8250_class}, | {"ns16550", (uintptr_t)&uart_ns8250_class}, | ||||
{"ns16550a", (uintptr_t)&uart_ns8250_class}, | {"ns16550a", (uintptr_t)&uart_ns8250_class}, | ||||
{NULL, (uintptr_t)NULL}, | {NULL, (uintptr_t)NULL}, | ||||
}; | }; | ||||
UART_FDT_CLASS_AND_DEVICE(compat_data); | UART_FDT_CLASS_AND_DEVICE(compat_data); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 645 Lines • Show Last 20 Lines |
You can and should delete this. It's not needed.