Nios2: Add Altera UART driver
PATCH 1/1 Nios2: Add Altera UART driver
From: Franck JULLIEN <[email protected]>
--- drivers/serial/Kconfig | 5 ++ drivers/serial/Makefile | 25 +++++----- drivers/serial/serial_altera.c | 97 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 drivers/serial/serial_altera.c
drivers/serial/Kconfig +5 -0
@@ -43,6 +43,11 @@ config DRIVER_SERIAL_BLACKFIN default y bool "Blackfin serial driver" +config DRIVER_SERIAL_ALTERA + depends on NIOS2 + default y + bool "Altera serial driver" + config DRIVER_SERIAL_NS16550 default n bool "NS16550 serial driver"
drivers/serial/Makefile +13 -12
@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o +obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.o
drivers/serial/serial_altera.c new file +97 -0
97 lines not on this page · raw message
Signature · 7 lines
1.7.0.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 1 line · On 04/03/2011 12:25 PM, [email protected] wrote:
From: Franck JULLIEN <[email protected]>
Please add your S-o-b to the driver. See Documentation/SubmittingPatches in a Linux-kernel tree.
See comments inline.
Quoted 47 lines
--- drivers/serial/Kconfig | 5 ++ drivers/serial/Makefile | 25 +++++----- drivers/serial/serial_altera.c | 97 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 drivers/serial/serial_altera.cdrivers/serial/Kconfig +5
-0@@ -43,6 +43,11 @@ config DRIVER_SERIAL_BLACKFIN default y bool "Blackfin serial driver" +config DRIVER_SERIAL_ALTERA + depends on NIOS2 + default y + bool "Altera serial driver" + config DRIVER_SERIAL_NS16550 default n bool "NS16550 serial driver"drivers/serial/Makefile +3
-12@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o
drivers/serial/Makefile line 19
Quoted 10 lines
drivers/serial/Makefile +10
-0+obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o +obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.o
Why do you reformat the whole file? Please don't do that.
Quoted 28 lines
drivers/serial/serial_altera.c new file +22
-0@@ -0,0 +1,97 @@ +/* +* (C) Copyright 2011, Franck JULLIEN, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ +
drivers/serial/serial_altera.c line 32
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+#include <common.h> +#include <driver.h> +#include <init.h> +#include <malloc.h> +#include <asm/io.h> +#include <asm/nios2-io.h> + +static int altera_serial_setbaudrate (struct console_device *cdev,int baudrate) +{ +volatile struct nios_uart * uart = (struct nios_uart *)cdev->dev->map_base;
^
please remove this space.
no volatiles please.
Quoted 4 lines
drivers/serial/serial_altera.c new file +4
-0+unsigned div; + + div = (CPU_FREQ / baudrate) -1 ; +writel (div, &uart->divisor);
drivers/serial/serial_altera.c line 46
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ +return 0 ; +} + +static void altera_serial_putc (struct console_device *cdev,char c) +{ +volatile struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base; + +if (c =='\n' ) +altera_serial_putc (cdev,'\r' );
Why this? Only the at91rm9200 driver does this and I don't know why....
drivers/serial/serial_altera.c line 54
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+ +while ((readl (&uart->status) &NIOS_UART_TRDY ) ==0 ); +writel (c, &uart->txdata); +} + +static int altera_serial_tstc (struct console_device *cdev) +{ +volatile struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
No volatiles
drivers/serial/serial_altera.c line 61
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ +return readl (&uart->status) &NIOS_UART_RRDY ; +} + +static int altera_serial_getc (struct console_device *cdev) +{ +volatile struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
dito
drivers/serial/serial_altera.c line 63
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+ +while (altera_serial_tstc (cdev) ==0 );
please add a comment, or at least an empty line after while
drivers/serial/serial_altera.c line 71
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+return readl (&uart->rxdata) &0x000000FF ; +} + +static int altera_serial_probe (struct device_d *dev) +{ +struct console_device *cdev; + + cdev =malloc (sizeof (struct console_device ));
malloc can fail, use xmalloc instead
Quoted 5 lines
drivers/serial/serial_altera.c new file +5
-0+ dev->type_data = cdev; + cdev->dev = dev; + cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ; + cdev->tstc = altera_serial_tstc; + cdev->putc = altera_serial_putc;
drivers/serial/serial_altera.c line 86
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ cdev->getc = altera_serial_getc; + cdev->setbrg = altera_serial_setbaudrate; + +console_register (cdev); + +return 0 ; +} + +static struct driver_d altera_serial_driver = { + .name ="altera_serial" ,
^^
one space is enough
drivers/serial/serial_altera.c line 93
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ .probe = altera_serial_probe, +}; + +static int altera_serial_init (void ) +{ +register_driver (&altera_serial_driver); +return 0 ;
I think return register_driver(); is preferred.
drivers/serial/serial_altera.c line 97
Quoted 4 lines
drivers/serial/serial_altera.c new file +4
-0+} + +console_initcall (altera_serial_init); +
cheers, Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hello Marc,
2011/4/3 Marc Kleine-Budde <[email protected]>
Quoted 7 lines · On 04/03/2011 12:25 PM, [email protected] wrote:
Quoted 1 line
From: Franck JULLIEN <[email protected]>
Please add your S-o-b to the driver. See
Documentation/SubmittingPatchesin a Linux-kernel tree.
Ok I will.
Quoted 53 lines
See comments inline.
Quoted 5 lines
--- drivers/serial/Kconfig | 5 ++ drivers/serial/Makefile | 25 +++++----- drivers/serial/serial_altera.c | 97++++++++++++++++++++++++++++++++++++++++
Quoted 46 lines
3 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 drivers/serial/serial_altera.cdrivers/serial/Kconfig +5
-0@@ -43,6 +43,11 @@ config DRIVER_SERIAL_BLACKFIN default y bool "Blackfin serial driver" +config DRIVER_SERIAL_ALTERA + depends on NIOS2 + default y + bool "Altera serial driver" + config DRIVER_SERIAL_NS16550 default n bool "NS16550 serial driver"drivers/serial/Makefile +7
-12@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o
Quoted 9 lines
drivers/serial/Makefile line 19
Quoted 6 lines
drivers/serial/Makefile +6
-0+obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.oWhy do you reformat the whole file? Please don't do that.
Because there is a mix between tabs and spaces before the "+= ....". I think it's better to have spaces here in order
to maintain alignment no matter what the tab size is. Tell me if you're agree, if not, I'll just put my new line at the bottom..... :)
Quoted 39 lines
Review
Quoted 2 lines
(quoted diff) +0
-0
b/drivers/serial/serial_altera.cQuoted 25 lines
new file mode 100644
index 0000000..03e48d1drivers/serial/serial_altera.c new file +20
-0@@ -0,0 +1,97 @@ +/* +* (C) Copyright 2011, Franck JULLIEN, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA drivers/serial/serial_altera.c line 30
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+*/ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <malloc.h> +#include <asm/io.h> +#include <asm/nios2-io.h> + +static int altera_serial_setbaudrate(struct console_device *cdev, intbaudrate)
Quoted 8 lines
drivers/serial/serial_altera.c line 32
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+{ + volatile struct nios_uart * uart = (struct nios_uart*)cdev->dev->map_base; ^please remove this space.
Damn, I used the checkpatch script though, should have seen it....
Quoted 3 lines
no volatiles please.
Yeah I know but last time I removed those volatile, the driver didn't work anymore ?!? I've done a test after I read your reply and it works without so I'll remove them.
Quoted 12 lines
drivers/serial/serial_altera.c
Quoted 11 lines
drivers/serial/serial_altera.c new file +11
-0+unsigned div; + + div = (CPU_FREQ / baudrate) -1 ; +writel (div, &uart->divisor); + +return 0 ; +} + +static void altera_serial_putc (struct console_device *cdev,char c) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
Quoted 7 lines
drivers/serial/serial_altera.c line 46
Quoted 3 lines
drivers/serial/serial_altera.c new file +3
-0+ +if (c =='\n' ) +altera_serial_putc (cdev,'\r' );Why this? Only the at91rm9200 driver does this and I don't know why....
Because I copied it from U-Boot :) Removed.
Quoted 21 lines
drivers/serial/serial_altera.c
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+ +while ((readl (&uart->status) &NIOS_UART_TRDY ) ==0 ); +writel (c, &uart->txdata); +} + +static int altera_serial_tstc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
No volatiles
drivers/serial/serial_altera.c
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ +return readl (&uart->status) &NIOS_UART_RRDY ; +} + +static int altera_serial_getc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
dito
Quoted 5 lines
drivers/serial/serial_altera.c line 63
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+ +while (altera_serial_tstc (cdev) ==0 );please add a comment, or at least an empty line after while
Do you guys put the semi colon on the next line also ?
Quoted 12 lines
drivers/serial/serial_altera.c line 71
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+return readl (&uart->rxdata) &0x000000FF ; +} + +static int altera_serial_probe (struct device_d *dev) +{ +struct console_device *cdev; + + cdev =malloc (sizeof (struct console_device ));malloc can fail, use xmalloc instead
Done.
Quoted 16 lines
Quoted 5 lines
drivers/serial/serial_altera.c new file +5
-0+ dev->type_data = cdev; + cdev->dev = dev; + cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ; + cdev->tstc = altera_serial_tstc; + cdev->putc = altera_serial_putc;drivers/serial/serial_altera.c line 86
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ cdev->getc = altera_serial_getc; + cdev->setbrg = altera_serial_setbaudrate; + +console_register (cdev); + +return 0 ; +} + +static struct driver_d altera_serial_driver = { + .name ="altera_serial" ,^^
Quoted 3 lines
one space is enough
Copied from blackfin :) Patch it ?
Quoted 11 lines
drivers/serial/serial_altera.c line 93
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ .probe = altera_serial_probe, +}; + +static int altera_serial_init (void ) +{ +register_driver (&altera_serial_driver); +return 0 ;I think return
register_driver(); is preferred.
Copied from blackfin :) Patch it ?
Quoted 7 lines
drivers/serial/serial_altera.c line 97
Quoted 4 lines
drivers/serial/serial_altera.c new file +4
-0+} + +console_initcall (altera_serial_init); +cheers, Marc
Quoted 7 lines
--
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Do you want me to patch files each time I see a wrong coding style in the code ? Because I'm so focused
on that since I'm working on the nios2 port (and since I display tabs and white spaces in my favorite editor :))
that I can see coding style mistakes in a lot of files :) (for example, leading spaces in serial_imx line 222, 228,
245, 313,.... checkpatch gives 9 errors and 44 warnings on this file).
Regards,
Franck.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
A message that is not in the archive (sent off-list or not yet received): [email protected]
2011/4/3 Franck JULLIEN <[email protected]>
Quoted 171 lines
2011/4/3 Franck JULLIEN <[email protected]>
Quoted 135 lines
Hello Marc,
2011/4/3 Marc Kleine-Budde <[email protected]>
Quoted 7 lines · On 04/03/2011 12:25 PM, [email protected] wrote:
Quoted 1 line
From: Franck JULLIEN <[email protected]>
Please add your S-o-b to the driver. See
Documentation/SubmittingPatchesin a Linux-kernel tree.Ok I will.
Quoted 53 lines
See comments inline.
Quoted 5 lines
--- drivers/serial/Kconfig | 5 ++ drivers/serial/Makefile | 25 +++++----- drivers/serial/serial_altera.c | 97++++++++++++++++++++++++++++++++++++++++
Quoted 46 lines
3 files changed, 115 insertions(+), 12 deletions(-) create mode 100644 drivers/serial/serial_altera.cdrivers/serial/Kconfig +5
-0@@ -43,6 +43,11 @@ config DRIVER_SERIAL_BLACKFIN default y bool "Blackfin serial driver" +config DRIVER_SERIAL_ALTERA + depends on NIOS2 + default y + bool "Altera serial driver" + config DRIVER_SERIAL_NS16550 default n bool "NS16550 serial driver"drivers/serial/Makefile +7
-12@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.oQuoted 9 lines
drivers/serial/Makefile line 19
Quoted 6 lines
drivers/serial/Makefile +6
-0+obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.oWhy do you reformat the whole file? Please don't do that.
Because there is a mix between tabs and spaces before the "+= ....". I think it's better to have spaces here in order
to maintain alignment no matter what the tab size is. Tell me if you're agree, if not, I'll just put my new line at the bottom..... :)Quoted 39 lines
Review
Quoted 2 lines
(quoted diff) +0
-0
b/drivers/serial/serial_altera.cQuoted 25 lines
new file mode 100644
index 0000000..03e48d1drivers/serial/serial_altera.c new file +20
-0@@ -0,0 +1,97 @@ +/* +* (C) Copyright 2011, Franck JULLIEN, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA drivers/serial/serial_altera.c line 30
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+*/ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <malloc.h> +#include <asm/io.h> +#include <asm/nios2-io.h> + +static int altera_serial_setbaudrate(struct console_device *cdev, intbaudrate)
Quoted 8 lines
drivers/serial/serial_altera.c line 32
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+{ + volatile struct nios_uart * uart = (struct nios_uart*)cdev->dev->map_base; ^please remove this space.
Damn, I used the checkpatch script though, should have seen it....
Quoted 9 lines
Quoted 3 lines
no volatiles please.
Yeah I know but last time I removed those volatile, the driver didn't work anymore ?!? I've done a test after I read your reply and it works without so I'll remove them.
In
Documentation/volatile-considered-harmful.txt, one can read:There are still a few rare situations where volatile makes sense in the kernel:
- The above-mentioned accessor functions might use volatile on architectures where direct I/O memory access does work.
Essentially,
each accessor call becomes a little critical section on its own
and
ensures that the access happens as expected by the programmer.(......)
- Pointers to data structures in coherent memory which might be
modified
by I/O devices can, sometimes, legitimately be volatile. A ring
buffer
used by a network adapter, where that adapter changes pointers to indicate which descriptors have been processed, is an example of
this
type of situation.
Quoted 3 lines
So is it that bad to use volatile ?
Ok, never mind, if we use readw, readl,...... the volatile is implicit.
Quoted 138 lines
Quoted 138 lines
Quoted 18 lines
Quoted 7 lines
drivers/serial/serial_altera.c new file +1
-0+unsigned div;drivers/serial/serial_altera.c
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ + div = (CPU_FREQ / baudrate) -1 ; +writel (div, &uart->divisor); + +return 0 ; +} + +static void altera_serial_putc (struct console_device *cdev,char c) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
Quoted 7 lines
drivers/serial/serial_altera.c line 46
Quoted 3 lines
drivers/serial/serial_altera.c new file +3
-0+ +if (c =='\n' ) +altera_serial_putc (cdev,'\r' );Why this? Only the at91rm9200 driver does this and I don't know why....
Because I copied it from U-Boot :) Removed.
Quoted 22 lines
drivers/serial/serial_altera.c
Quoted 9 lines
drivers/serial/serial_altera.c new file +8
-0+ +while ((readl (&uart->status) &NIOS_UART_TRDY ) ==0 ); +writel (c, &uart->txdata); +} + +static int altera_serial_tstc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
No volatiles
drivers/serial/serial_altera.c
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ +return readl (&uart->status) &NIOS_UART_RRDY ; +} + +static int altera_serial_getc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
ditoQuoted 5 lines
drivers/serial/serial_altera.c
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+ +while (altera_serial_tstc (cdev) ==0 );please add a comment, or at least an empty line after while
Do you guys put the semi colon on the next line also ?
Quoted 13 lines
drivers/serial/serial_altera.c line 71
Quoted 9 lines
drivers/serial/serial_altera.c new file +8
-0+return readl (&uart->rxdata) &0x000000FF ; +} + +static int altera_serial_probe (struct device_d *dev) +{ +struct console_device *cdev; + + cdev =malloc (sizeof (struct console_device ));malloc can fail, use xmalloc instead
Done.
Quoted 17 lines
Quoted 6 lines
drivers/serial/serial_altera.c new file +5
-0+ dev->type_data = cdev; + cdev->dev = dev; + cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ; + cdev->tstc = altera_serial_tstc; + cdev->putc = altera_serial_putc;drivers/serial/serial_altera.c line 86
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ cdev->getc = altera_serial_getc; + cdev->setbrg = altera_serial_setbaudrate; + +console_register (cdev); + +return 0 ; +} + +static struct driver_d altera_serial_driver = { + .name ="altera_serial" ,^^Quoted 3 lines
one space is enough
Copied from blackfin :) Patch it ?
Quoted 12 lines
drivers/serial/serial_altera.c line 93
Quoted 8 lines
drivers/serial/serial_altera.c new file +7
-0+ .probe = altera_serial_probe, +}; + +static int altera_serial_init (void ) +{ +register_driver (&altera_serial_driver); +return 0 ;I think return
register_driver(); is preferred.Copied from blackfin :) Patch it ?
Quoted 7 lines
drivers/serial/serial_altera.c line 97
Quoted 4 lines
drivers/serial/serial_altera.c new file +4
-0+} + +console_initcall (altera_serial_init); +cheers, Marc
Quoted 7 lines
--
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |Do you want me to patch files each time I see a wrong coding style in the code ? Because I'm so focused
on that since I'm working on the nios2 port (and since I display tabs and white spaces in my favorite editor :))
that I can see coding style mistakes in a lot of files :) (for example, leading spaces inserial_imxline 222, 228,
245, 313,.... checkpatch gives 9 errors and 44 warnings on this file).
Quoted 5 lines
Quoted 3 lines
Regards,
Franck.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
On 04/03/2011 04:02 PM, Franck JULLIEN wrote:
[...]
Quoted 37 lines
Quoted 26 lines
Quoted 26 lines
index 9f0e12b..8067b74 100644
drivers/serial/Makefile +7
-12@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.oQuoted 9 lines
drivers/serial/Makefile line 19
Quoted 6 lines
drivers/serial/Makefile +6
-0+obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.oWhy do you reformat the whole file? Please don't do that.
Quoted 4 lines
Because there is a mix between tabs and spaces before the "+= ....". I think it's better to have spaces here in order
to maintain alignment no matter what the tab size is. Tell me if you're agree, if not, I'll just put my new line at the bottom..... :)
The tab size is 8 by definition. I see that AMBA_PL011 does it different, but the other indent with tabs.
Quoted 49 lines
Quoted 38 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/serial/serial_altera.cQuoted 25 lines
new file mode 100644
index 0000000..03e48d1drivers/serial/serial_altera.c new file +20
-0@@ -0,0 +1,97 @@ +/* +* (C) Copyright 2011, Franck JULLIEN, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA drivers/serial/serial_altera.c line 30
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+*/ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <malloc.h> +#include <asm/io.h> +#include <asm/nios2-io.h> + +static int altera_serial_setbaudrate(struct console_device *cdev, intbaudrate)
Quoted 8 lines
drivers/serial/serial_altera.c line 32
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+{ + volatile struct nios_uart * uart = (struct nios_uart*)cdev->dev->map_base; ^please remove this space.
Damn, I used the checkpatch script though, should have seen it....
Quoted 7 lines
Quoted 3 lines
no volatiles please.
Yeah I know but last time I removed those volatile, the driver didn't work anymore ?!? I've done a test after I read your reply and it works without so I'll remove them.
You've found the answer yourself :) We don't do pointer derefs to iomem in C but use readl/writel instead.
Quoted 47 lines
Quoted 15 lines
Quoted 4 lines
drivers/serial/serial_altera.c new file +1
-0+unsigned div;drivers/serial/serial_altera.c
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ + div = (CPU_FREQ / baudrate) -1 ; +writel (div, &uart->divisor); + +return 0 ; +} + +static void altera_serial_putc (struct console_device *cdev,char c) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
Quoted 7 lines
drivers/serial/serial_altera.c line 46
Quoted 3 lines
drivers/serial/serial_altera.c new file +3
-0+ +if (c =='\n' ) +altera_serial_putc (cdev,'\r' );Why this? Only the at91rm9200 driver does this and I don't know why....
Because I copied it from U-Boot :) Removed.
Quoted 21 lines
drivers/serial/serial_altera.c
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+ +while ((readl (&uart->status) &NIOS_UART_TRDY ) ==0 ); +writel (c, &uart->txdata); +} + +static int altera_serial_tstc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
No volatiles
drivers/serial/serial_altera.c
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ +return readl (&uart->status) &NIOS_UART_RRDY ; +} + +static int altera_serial_getc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
dito
Quoted 6 lines
Quoted 5 lines
drivers/serial/serial_altera.c line 63
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+ +while (altera_serial_tstc (cdev) ==0 );please add a comment, or at least an empty line after while
Do you guys put the semi colon on the next line also ?
Don't know.
Quoted 34 lines
Quoted 12 lines
drivers/serial/serial_altera.c line 71
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+return readl (&uart->rxdata) &0x000000FF ; +} + +static int altera_serial_probe (struct device_d *dev) +{ +struct console_device *cdev; + + cdev =malloc (sizeof (struct console_device ));malloc can fail, use xmalloc instead
Done.
Quoted 16 lines
Quoted 5 lines
drivers/serial/serial_altera.c new file +5
-0+ dev->type_data = cdev; + cdev->dev = dev; + cdev->f_caps =CONSOLE_STDIN |CONSOLE_STDOUT |CONSOLE_STDERR ; + cdev->tstc = altera_serial_tstc; + cdev->putc = altera_serial_putc;drivers/serial/serial_altera.c line 86
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ cdev->getc = altera_serial_getc; + cdev->setbrg = altera_serial_setbaudrate; + +console_register (cdev); + +return 0 ; +} + +static struct driver_d altera_serial_driver = { + .name ="altera_serial" ,^^Quoted 3 lines
one space is enough
Quoted 1 line
Copied from blackfin :) Patch it ?
see below
Quoted 15 lines
Quoted 14 lines
drivers/serial/serial_altera.c line 93
Quoted 10 lines
drivers/serial/serial_altera.c new file +7
-0+ .probe = altera_serial_probe, +}; + +static int altera_serial_init (void ) +{ +register_driver (&altera_serial_driver); +return 0 ;I think return
register_driver(); is preferred.
Quoted 1 line
Copied from blackfin :) Patch it ?
dito
Quoted 16 lines
Quoted 9 lines
drivers/serial/serial_altera.c line 97
Quoted 6 lines
drivers/serial/serial_altera.c new file +4
-0+} + +console_initcall (altera_serial_init); +cheers, Marc
Quoted 7 lines
--
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
Quoted 7 lines
Do you want me to patch files each time I see a wrong coding style in the code ? Because I'm so focused
on that since I'm working on the nios2 port (and since I display tabs and white spaces in my favorite editor :))
that I can see coding style mistakes in a lot of files :) (for example, leading spaces inserial_imxline 222, 228,
245, 313,.... checkpatch gives 9 errors and 44 warnings on this file).
Just fixing the coding style because it's bad is usually not done, because "git blame" will tell you about the coding style fixer not about the coder of that line.
The rule of thumb is: Don't introduce new code with bad style. If you touch code fixing the style in a separate patch before you bring in your changes is usually accepted.
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 156 lines · Marc Kleine-Budde
On 04/03/2011 04:02 PM, Franck JULLIEN wrote:
[...]
Quoted 37 lines
Quoted 26 lines
Quoted 26 lines
index 9f0e12b..8067b74 100644
drivers/serial/Makefile +7
-12@@ -4,15 +4,16 @@ # serial_max3100.o # serial_pl010.o # serial_xuartlite.o -obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o -obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o -obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o -obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o -obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o -obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o -obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.o -obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o -obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o -obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o -obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o -obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ARM_DCC) += arm_dcc.o +obj-$(CONFIG_SERIAL_AMBA_PL011) += amba-pl011.o +obj-$(CONFIG_DRIVER_SERIAL_IMX) += serial_imx.o +obj-$(CONFIG_DRIVER_SERIAL_STM378X) += stm-serial.o +obj-$(CONFIG_DRIVER_SERIAL_ATMEL) += atmel.o +obj-$(CONFIG_DRIVER_SERIAL_NETX) += serial_netx.o +obj-$(CONFIG_DRIVER_SERIAL_LINUX_COMSOLE) += linux_console.oQuoted 9 lines
drivers/serial/Makefile line 19
Quoted 6 lines
drivers/serial/Makefile +6
-0+obj-$(CONFIG_DRIVER_SERIAL_MPC5XXX) += serial_mpc5xxx.o +obj-$(CONFIG_DRIVER_SERIAL_BLACKFIN) += serial_blackfin.o +obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o +obj-$(CONFIG_DRIVER_SERIAL_PL010) += serial_pl010.o +obj-$(CONFIG_DRIVER_SERIAL_S3C24X0) += serial_s3c24x0.o +obj-$(CONFIG_DRIVER_SERIAL_ALTERA) += serial_altera.oWhy do you reformat the whole file? Please don't do that.
Quoted 4 lines
Because there is a mix between tabs and spaces before the "+= ....". I think it's better to have spaces here in order
to maintain alignment no matter what the tab size is. Tell me if you're agree, if not, I'll just put my new line at the bottom..... :)The tab size is 8 by definition. I see that
AMBA_PL011does it different, but the other indent with tabs.Quoted 49 lines
Quoted 38 lines
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/serial/serial_altera.cQuoted 25 lines
new file mode 100644
index 0000000..03e48d1drivers/serial/serial_altera.c new file +20
-0@@ -0,0 +1,97 @@ +/* +* (C) Copyright 2011, Franck JULLIEN, <[email protected]> +* +* See file CREDITS for list of people who contributed to this +* project. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA drivers/serial/serial_altera.c line 30
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+*/ + +#include <common.h> +#include <driver.h> +#include <init.h> +#include <malloc.h> +#include <asm/io.h> +#include <asm/nios2-io.h> + +static int altera_serial_setbaudrate(struct console_device *cdev, intbaudrate)
Quoted 8 lines
drivers/serial/serial_altera.c line 32
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+{ + volatile struct nios_uart * uart = (struct nios_uart*)cdev->dev->map_base; ^please remove this space.
Damn, I used the checkpatch script though, should have seen it....
Quoted 7 lines
Quoted 3 lines
no volatiles please.
Yeah I know but last time I removed those volatile, the driver didn't work anymore ?!? I've done a test after I read your reply and it works without so I'll remove them.
You've found the answer yourself :) We don't do pointer derefs to iomem in C but use readl/writel instead.
Quoted 47 lines
Quoted 15 lines
Quoted 4 lines
drivers/serial/serial_altera.c new file +1
-0+unsigned div;drivers/serial/serial_altera.c
Quoted 10 lines
drivers/serial/serial_altera.c new file +10
-0+ + div = (CPU_FREQ / baudrate) -1 ; +writel (div, &uart->divisor); + +return 0 ; +} + +static void altera_serial_putc (struct console_device *cdev,char c) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
Quoted 7 lines
drivers/serial/serial_altera.c line 46
Quoted 3 lines
drivers/serial/serial_altera.c new file +3
-0+ +if (c =='\n' ) +altera_serial_putc (cdev,'\r' );Why this? Only the at91rm9200 driver does this and I don't know why....
Because I copied it from U-Boot :) Removed.
Quoted 21 lines
drivers/serial/serial_altera.c
Quoted 8 lines
drivers/serial/serial_altera.c new file +8
-0+ +while ((readl (&uart->status) &NIOS_UART_TRDY ) ==0 ); +writel (c, &uart->txdata); +} + +static int altera_serial_tstc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
No volatiles
drivers/serial/serial_altera.c
Quoted 7 lines
drivers/serial/serial_altera.c new file +7
-0+ +return readl (&uart->status) &NIOS_UART_RRDY ; +} + +static int altera_serial_getc (struct console_device *cdev) +{ + volatile struct nios_uart *uart = (struct nios_uart*)cdev->dev->map_base;
dito
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
drivers/serial/serial_altera.c line 63
Quoted 2 lines
drivers/serial/serial_altera.c new file +2
-0+ +while (altera_serial_tstc (cdev) ==0 );please add a comment, or at least an empty line after while
Do you guys put the semi colon on the next line also ?
Don't know.
Usually not.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox