Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch - Move CFATTACH_DECL_NEW() from common uart driver.



details:   https://anonhg.NetBSD.org/src/rev/e6bc54c13d7b
branches:  trunk
changeset: 356185:e6bc54c13d7b
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Fri Sep 08 05:29:12 2017 +0000

description:
- Move CFATTACH_DECL_NEW() from common uart driver.
- Rename : imxuart_cons_attach() -> imxuart_cnattach()

diffstat:

 sys/arch/arm/imx/files.imx31                  |    6 +-
 sys/arch/arm/imx/files.imx51                  |    6 +-
 sys/arch/arm/imx/files.imx6                   |    6 +-
 sys/arch/arm/imx/files.imx7                   |    6 +-
 sys/arch/arm/imx/imx31_uart.c                 |   11 +-
 sys/arch/arm/imx/imx51_uart.c                 |   14 +-
 sys/arch/arm/imx/imx6_uart.c                  |   12 +-
 sys/arch/arm/imx/imx7_uart.c                  |   14 +-
 sys/arch/arm/imx/imxuart.c                    |  137 +++----------------------
 sys/arch/arm/imx/imxuartvar.h                 |  115 +++++++++++++++++++++-
 sys/arch/evbarm/imx7/imx7_machdep.c           |    6 +-
 sys/arch/evbarm/kobo/kobo_machdep.c           |    6 +-
 sys/arch/evbarm/netwalker/netwalker_machdep.c |    6 +-
 sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c |    6 +-
 14 files changed, 190 insertions(+), 161 deletions(-)

diffs (truncated from 685 to 300 lines):

diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/files.imx31
--- a/sys/arch/arm/imx/files.imx31      Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/files.imx31      Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx31,v 1.7 2011/03/11 03:16:13 bsh Exp $
+#      $NetBSD: files.imx31,v 1.8 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX31
 #
@@ -62,9 +62,9 @@
 
 # iMX UART
 device imxuart
-attach imxuart at aips
+attach imxuart at aips with imx31_uart
 file   arch/arm/imx/imxuart.c                  imxuart needs-flag
-file   arch/arm/imx/imx31_uart.c               imxuart
+file   arch/arm/imx/imx31_uart.c               imx31_uart
 defflag        opt_imxuart.h                           IMXUARTCONSOLE
 
 attach ehci at ahb with ehci_ahb : bus_dma_generic
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/files.imx51
--- a/sys/arch/arm/imx/files.imx51      Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/files.imx51      Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx51,v 1.16 2017/08/18 21:45:25 jakllsch Exp $
+#      $NetBSD: files.imx51,v 1.17 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -94,9 +94,9 @@
 
 # iMX UART
 device imxuart
-attach imxuart at axi
+attach imxuart at axi with imx51_uart
 file   arch/arm/imx/imxuart.c                  imxuart needs-flag
-file   arch/arm/imx/imx51_uart.c               imxuart
+file   arch/arm/imx/imx51_uart.c               imx51_uart
 defflag        opt_imxuart.h                           IMXUARTCONSOLE
 
 # USB controller
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/files.imx6
--- a/sys/arch/arm/imx/files.imx6       Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/files.imx6       Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx6,v 1.10 2017/08/18 21:45:25 jakllsch Exp $
+#      $NetBSD: files.imx6,v 1.11 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -74,9 +74,9 @@
 
 # iMX UART
 device imxuart
-attach imxuart at axi
+attach imxuart at axi with imx6_uart
 file   arch/arm/imx/imxuart.c                  imxuart needs-flag
-file   arch/arm/imx/imx6_uart.c                imxuart
+file   arch/arm/imx/imx6_uart.c                imx6_uart
 defflag opt_imxuart.h                          IMXUARTCONSOLE
 
 # iMX6 10/100/1000-Mbps Ethernet MAC(ENET)
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/files.imx7
--- a/sys/arch/arm/imx/files.imx7       Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/files.imx7       Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx7,v 1.4 2017/08/18 21:45:25 jakllsch Exp $
+#      $NetBSD: files.imx7,v 1.5 2017/09/08 05:29:12 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX7
 #
@@ -69,9 +69,9 @@
 
 # iMX UART
 device imxuart
-attach imxuart at axi
+attach imxuart at axi with imx7_uart
 file   arch/arm/imx/imxuart.c                  imxuart needs-flag
-file   arch/arm/imx/imx7_uart.c                imxuart
+file   arch/arm/imx/imx7_uart.c                imx7_uart
 defflag opt_imxuart.h                          IMXUARTCONSOLE
 
 # iMX7 10/100/1000-Mbps Ethernet MAC(ENET)
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/imx31_uart.c
--- a/sys/arch/arm/imx/imx31_uart.c     Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/imx31_uart.c     Fri Sep 08 05:29:12 2017 +0000
@@ -34,9 +34,14 @@
 #include <arm/imx/imxuartreg.h>
 #include <arm/imx/imxuartvar.h>
 
+static int imx31_uart_match(device_t, struct cfdata *, void *);
+static void imx31_uart_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(imx31_uart, sizeof(struct imxuart_softc),
+    imx31_uart_match, imx31_uart_attach, NULL, NULL);
 
 int
-imxuart_match(device_t parent, struct cfdata *cf, void *aux)
+imx31_uart_match(device_t parent, struct cfdata *cf, void *aux)
 {
        struct aips_attach_args * const aipsa = aux;
 
@@ -53,11 +58,11 @@
 }
 
 void
-imxuart_attach(device_t parent, device_t self, void *aux)
+imx31_uart_attach(device_t parent, device_t self, void *aux)
 {
        struct aips_attach_args * aa = aux;
 
-       imxuart_attach_common(parent, self, 
+       imxuart_attach_common(parent, self,
            aa->aipsa_memt, aa->aipsa_addr, aa->aipsa_size, aa->aipsa_intr, 0);
 }
 
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/imx51_uart.c
--- a/sys/arch/arm/imx/imx51_uart.c     Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/imx51_uart.c     Fri Sep 08 05:29:12 2017 +0000
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx51_uart.c,v 1.3 2014/07/25 07:49:56 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_uart.c,v 1.4 2017/09/08 05:29:12 hkenken Exp $");
 
 #include "opt_imx.h"
 #include "opt_imxuart.h"
@@ -39,8 +39,14 @@
 #include <arm/imx/imxuartreg.h>
 #include <arm/imx/imxuartvar.h>
 
+static int imx51_uart_match(device_t, struct cfdata *, void *);
+static void imx51_uart_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(imx51_uart, sizeof(struct imxuart_softc),
+    imx51_uart_match, imx51_uart_attach, NULL, NULL);
+
 int
-imxuart_match(device_t parent, struct cfdata *cf, void *aux)
+imx51_uart_match(device_t parent, struct cfdata *cf, void *aux)
 {
        struct axi_attach_args * const aa = aux;
 
@@ -55,11 +61,11 @@
 }
 
 void
-imxuart_attach(device_t parent, device_t self, void *aux)
+imx51_uart_attach(device_t parent, device_t self, void *aux)
 {
        struct axi_attach_args * aa = aux;
 
-       imxuart_attach_common(parent, self, 
+       imxuart_attach_common(parent, self,
            aa->aa_iot, aa->aa_addr, aa->aa_size, aa->aa_irq, 0);
 }
 
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/imx6_uart.c
--- a/sys/arch/arm/imx/imx6_uart.c      Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/imx6_uart.c      Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imx6_uart.c,v 1.2 2017/06/09 18:14:59 ryo Exp $        */
+/*     $NetBSD: imx6_uart.c,v 1.3 2017/09/08 05:29:12 hkenken Exp $    */
 
 /*
  * Copyright (c) 2013 Genetec Corporation.  All rights reserved.
@@ -35,8 +35,14 @@
 #include <arm/imx/imxuartreg.h>
 #include <arm/imx/imxuartvar.h>
 
+static int imx6_uart_match(device_t, struct cfdata *, void *);
+static void imx6_uart_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(imx6_uart, sizeof(struct imxuart_softc),
+    imx6_uart_match, imx6_uart_attach, NULL, NULL);
+
 int
-imxuart_match(device_t parent, struct cfdata *cf, void *aux)
+imx6_uart_match(device_t parent, struct cfdata *cf, void *aux)
 {
        struct axi_attach_args * const aa = aux;
 
@@ -58,7 +64,7 @@
 }
 
 void
-imxuart_attach(device_t parent, device_t self, void *aux)
+imx6_uart_attach(device_t parent, device_t self, void *aux)
 {
        struct axi_attach_args * aa = aux;
 
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/imx7_uart.c
--- a/sys/arch/arm/imx/imx7_uart.c      Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/imx7_uart.c      Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imx7_uart.c,v 1.1 2016/05/17 06:44:45 ryo Exp $        */
+/*     $NetBSD: imx7_uart.c,v 1.2 2017/09/08 05:29:12 hkenken Exp $    */
 
 /*
  * Copyright (c) 2013 Genetec Corporation.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx7_uart.c,v 1.1 2016/05/17 06:44:45 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx7_uart.c,v 1.2 2017/09/08 05:29:12 hkenken Exp $");
 
 #include "opt_imxuart.h"
 
@@ -41,9 +41,15 @@
 #include <arm/imx/imxuartreg.h>
 #include <arm/imx/imxuartvar.h>
 
+static int imx7_uart_match(device_t, struct cfdata *, void *);
+static void imx7_uart_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(imx7_uart, sizeof(struct imxuart_softc),
+    imx7_uart_match, imx7_uart_attach, NULL, NULL);
+
 /* ARGSUSED */
 int
-imxuart_match(device_t parent __unused, struct cfdata *cf __unused, void *aux)
+imx7_uart_match(device_t parent __unused, struct cfdata *cf __unused, void *aux)
 {
        struct axi_attach_args * const aa = aux;
 
@@ -62,7 +68,7 @@
 }
 
 void
-imxuart_attach(device_t parent, device_t self, void *aux)
+imx7_uart_attach(device_t parent, device_t self, void *aux)
 {
        struct axi_attach_args * aa = aux;
 
diff -r e45f5f93bf34 -r e6bc54c13d7b sys/arch/arm/imx/imxuart.c
--- a/sys/arch/arm/imx/imxuart.c        Thu Sep 07 23:19:45 2017 +0000
+++ b/sys/arch/arm/imx/imxuart.c        Fri Sep 08 05:29:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imxuart.c,v 1.19 2015/07/30 04:39:42 ryo Exp $ */
+/* $NetBSD: imxuart.c,v 1.20 2017/09/08 05:29:12 hkenken Exp $ */
 
 /*
  * Copyright (c) 2009, 2010  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.19 2015/07/30 04:39:42 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.20 2017/09/08 05:29:12 hkenken Exp $");
 
 #include "opt_imxuart.h"
 #include "opt_ddb.h"
@@ -106,7 +106,6 @@
 #include "opt_multiprocessor.h"
 #include "opt_ntp.h"
 #include "opt_imxuart.h"
-#include "opt_imx.h"
 
 #ifdef RND_COM
 #include <sys/rndsource.h>
@@ -165,115 +164,6 @@
 #define        IMXUART_RING_SIZE       2048
 #endif
 
-typedef struct imxuart_softc {
-       device_t        sc_dev;
-
-       struct imxuart_regs {
-               bus_space_tag_t         ur_iot;
-               bus_space_handle_t      ur_ioh;
-               bus_addr_t              ur_iobase;
-#if 0
-               bus_size_t              ur_nports;
-               bus_size_t              ur_map[16];
-#endif
-       } sc_regs;
-
-#define        sc_bt   sc_regs.ur_iot
-#define        sc_bh   sc_regs.ur_ioh
-
-       uint32_t                sc_intrspec_enb;
-       uint32_t        sc_ucr2_d;      /* target value for UCR2 */
-       uint32_t        sc_ucr[4];      /* cached value of UCRn */
-#define        sc_ucr1 sc_ucr[0]
-#define        sc_ucr2 sc_ucr[1]
-#define        sc_ucr3 sc_ucr[2]
-#define        sc_ucr4 sc_ucr[3]
-
-       uint                    sc_init_cnt;
-
-       bus_addr_t              sc_addr;
-       bus_size_t              sc_size;
-       int                     sc_intr;
-
-       u_char  sc_hwflags;
-/* Hardware flag masks */
-#define        IMXUART_HW_FLOW         __BIT(0)



Home | Main Index | Thread Index | Old Index