sifive.c (bf1842996aaa726bf3d108b41f366b88680acbe6) sifive.c (0aaf78182b721991a594ad8f8fe96d806e75db5a)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * SiFive UART driver
4 * Copyright (C) 2018 Paul Walmsley <paul@pwsan.com>
5 * Copyright (C) 2018-2019 SiFive
6 *
7 * Based partially on:
8 * - drivers/tty/serial/pxa.c

--- 388 unchanged lines hidden (view full) ---

397 *
398 * Receive up to an RX FIFO's worth of bytes from the SiFive UART referred
399 * to by @ssp and pass them up to the Linux serial layer.
400 *
401 * Context: Expects ssp->port.lock to be held by caller.
402 */
403static void __ssp_receive_chars(struct sifive_serial_port *ssp)
404{
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * SiFive UART driver
4 * Copyright (C) 2018 Paul Walmsley <paul@pwsan.com>
5 * Copyright (C) 2018-2019 SiFive
6 *
7 * Based partially on:
8 * - drivers/tty/serial/pxa.c

--- 388 unchanged lines hidden (view full) ---

397 *
398 * Receive up to an RX FIFO's worth of bytes from the SiFive UART referred
399 * to by @ssp and pass them up to the Linux serial layer.
400 *
401 * Context: Expects ssp->port.lock to be held by caller.
402 */
403static void __ssp_receive_chars(struct sifive_serial_port *ssp)
404{
405 unsigned char ch;
406 char is_empty;
407 int c;
405 char is_empty;
406 int c;
407 u8 ch;
408
409 for (c = SIFIVE_RX_FIFO_DEPTH; c > 0; --c) {
410 ch = __ssp_receive_char(ssp, &is_empty);
411 if (is_empty)
412 break;
413
414 ssp->port.icount.rx++;
415 uart_insert_char(&ssp->port, 0, 0, ch, TTY_NORMAL);

--- 496 unchanged lines hidden (view full) ---

912 struct clk *clk;
913 void __iomem *base;
914 int irq, id, r;
915
916 irq = platform_get_irq(pdev, 0);
917 if (irq < 0)
918 return -EPROBE_DEFER;
919
408
409 for (c = SIFIVE_RX_FIFO_DEPTH; c > 0; --c) {
410 ch = __ssp_receive_char(ssp, &is_empty);
411 if (is_empty)
412 break;
413
414 ssp->port.icount.rx++;
415 uart_insert_char(&ssp->port, 0, 0, ch, TTY_NORMAL);

--- 496 unchanged lines hidden (view full) ---

912 struct clk *clk;
913 void __iomem *base;
914 int irq, id, r;
915
916 irq = platform_get_irq(pdev, 0);
917 if (irq < 0)
918 return -EPROBE_DEFER;
919
920 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
921 base = devm_ioremap_resource(&pdev->dev, mem);
922 if (IS_ERR(base)) {
923 dev_err(&pdev->dev, "could not acquire device memory\n");
920 base = devm_platform_get_and_ioremap_resource(pdev, 0, &mem);
921 if (IS_ERR(base))
924 return PTR_ERR(base);
922 return PTR_ERR(base);
925 }
926
927 clk = devm_clk_get_enabled(&pdev->dev, NULL);
928 if (IS_ERR(clk)) {
929 dev_err(&pdev->dev, "unable to find controller clock\n");
930 return PTR_ERR(clk);
931 }
932
933 id = of_alias_get_id(pdev->dev.of_node, "serial");

--- 95 unchanged lines hidden (view full) ---

1029};
1030MODULE_DEVICE_TABLE(of, sifive_serial_of_match);
1031
1032static struct platform_driver sifive_serial_platform_driver = {
1033 .probe = sifive_serial_probe,
1034 .remove = sifive_serial_remove,
1035 .driver = {
1036 .name = SIFIVE_SERIAL_NAME,
923
924 clk = devm_clk_get_enabled(&pdev->dev, NULL);
925 if (IS_ERR(clk)) {
926 dev_err(&pdev->dev, "unable to find controller clock\n");
927 return PTR_ERR(clk);
928 }
929
930 id = of_alias_get_id(pdev->dev.of_node, "serial");

--- 95 unchanged lines hidden (view full) ---

1026};
1027MODULE_DEVICE_TABLE(of, sifive_serial_of_match);
1028
1029static struct platform_driver sifive_serial_platform_driver = {
1030 .probe = sifive_serial_probe,
1031 .remove = sifive_serial_remove,
1032 .driver = {
1033 .name = SIFIVE_SERIAL_NAME,
1037 .of_match_table = of_match_ptr(sifive_serial_of_match),
1034 .of_match_table = sifive_serial_of_match,
1038 },
1039};
1040
1041static int __init sifive_serial_init(void)
1042{
1043 int r;
1044
1045 r = uart_register_driver(&sifive_serial_uart_driver);

--- 27 unchanged lines hidden ---
1035 },
1036};
1037
1038static int __init sifive_serial_init(void)
1039{
1040 int r;
1041
1042 r = uart_register_driver(&sifive_serial_uart_driver);

--- 27 unchanged lines hidden ---