Source-Changes-HG archive

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

[src/trunk]: src Add initial support for Freescale i.MX7 SoC and



details:   https://anonhg.NetBSD.org/src/rev/bbf5eb893548
branches:  trunk
changeset: 345290:bbf5eb893548
user:      ryo <ryo%NetBSD.org@localhost>
date:      Tue May 17 06:44:45 2016 +0000

description:
Add initial support for Freescale i.MX7 SoC and
Atmark Techno Armadillo-IoT G3 boards.

Contributed by Internet Initiative Japan Inc.

diffstat:

 etc/etc.evbarm/Makefile.inc                   |     4 +-
 sys/arch/arm/imx/files.imx6                   |     4 +-
 sys/arch/arm/imx/files.imx7                   |    99 +
 sys/arch/arm/imx/if_enet.c                    |   259 +-
 sys/arch/arm/imx/if_enet_imx6.c               |   109 +
 sys/arch/arm/imx/if_enet_imx7.c               |   169 +
 sys/arch/arm/imx/if_enetreg.h                 |    47 +-
 sys/arch/arm/imx/if_enetvar.h                 |   135 +
 sys/arch/arm/imx/imx6_reg.h                   |     3 +-
 sys/arch/arm/imx/imx6_snvs.c                  |   172 +-
 sys/arch/arm/imx/imx7_axi.c                   |   158 +
 sys/arch/arm/imx/imx7_board.c                 |   244 +
 sys/arch/arm/imx/imx7_ccm.c                   |  1543 +++++++
 sys/arch/arm/imx/imx7_ccmreg.h                |  5257 +++++++++++++++++++++++++
 sys/arch/arm/imx/imx7_ccmvar.h                |   159 +
 sys/arch/arm/imx/imx7_gpcreg.h                |   160 +
 sys/arch/arm/imx/imx7_gpio.c                  |   113 +
 sys/arch/arm/imx/imx7_intr.h                  |   169 +
 sys/arch/arm/imx/imx7_iomux.c                 |   188 +
 sys/arch/arm/imx/imx7_iomuxreg.h              |   614 ++
 sys/arch/arm/imx/imx7_ocotp.c                 |   124 +
 sys/arch/arm/imx/imx7_ocotpreg.h              |   112 +
 sys/arch/arm/imx/imx7_ocotpvar.h              |    34 +
 sys/arch/arm/imx/imx7_snvs.c                  |    69 +
 sys/arch/arm/imx/imx7_srcreg.h                |    76 +
 sys/arch/arm/imx/imx7_uart.c                  |    71 +
 sys/arch/arm/imx/imx7_usb.c                   |   241 +
 sys/arch/arm/imx/imx7_usbreg.h                |   106 +
 sys/arch/arm/imx/imx7_usdhc.c                 |   222 +
 sys/arch/arm/imx/imx7_wdog.c                  |    65 +
 sys/arch/arm/imx/imx7reg.h                    |   202 +
 sys/arch/arm/imx/imx7var.h                    |   140 +
 sys/arch/arm/imx/imxsnvs.c                    |   195 +
 sys/arch/arm/imx/imxsnvsreg.h                 |    88 +
 sys/arch/arm/imx/imxsnvsvar.h                 |    38 +
 sys/arch/arm/imx/imxusb.c                     |    18 +-
 sys/arch/arm/imx/imxusbreg.h                  |     5 +-
 sys/arch/arm/imx/imxusbvar.h                  |     6 +-
 sys/arch/evbarm/conf/ARMADILLO-IOT-G3         |   420 +
 sys/arch/evbarm/conf/ARMADILLO-IOT-G3_INSTALL |    11 +
 sys/arch/evbarm/conf/files.imx7               |    13 +
 sys/arch/evbarm/conf/mk.imx7                  |    33 +
 sys/arch/evbarm/conf/std.imx7                 |    35 +
 sys/arch/evbarm/imx7/genassym.cf              |    59 +
 sys/arch/evbarm/imx7/imx7_ioconfig.c          |   284 +
 sys/arch/evbarm/imx7/imx7_machdep.c           |   304 +
 sys/arch/evbarm/imx7/imx7_start.S             |   328 +
 sys/arch/evbarm/imx7/platform.h               |    59 +
 48 files changed, 12594 insertions(+), 370 deletions(-)

diffs (truncated from 13516 to 300 lines):

diff -r 7650791fd993 -r bbf5eb893548 etc/etc.evbarm/Makefile.inc
--- a/etc/etc.evbarm/Makefile.inc       Tue May 17 03:27:02 2016 +0000
+++ b/etc/etc.evbarm/Makefile.inc       Tue May 17 06:44:45 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.79 2015/12/13 23:02:56 jmcneill Exp $
+#      $NetBSD: Makefile.inc,v 1.80 2016/05/17 06:44:45 ryo Exp $
 #
 #      etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -105,6 +105,8 @@
 #EVBARM_BOARDS.armv7+=         IGEPV2
 EVBARM_BOARDS.armv7+=          TEGRA
 EVBARM_BOARDS.armv7hf+=                TEGRA
+EVBARM_BOARDS.armv7+=          ARMADILLO-IOT-G3
+EVBARM_BOARDS.armv7hf+=                ARMADILLO-IOT-G3
 EVBARM_BOARDS.armv7+=          KOBO
 EVBARM_BOARDS.armv7hf+=        KOBO
 EVBARM_BOARDS.armv7+=          MIRABOX
diff -r 7650791fd993 -r bbf5eb893548 sys/arch/arm/imx/files.imx6
--- a/sys/arch/arm/imx/files.imx6       Tue May 17 03:27:02 2016 +0000
+++ b/sys/arch/arm/imx/files.imx6       Tue May 17 06:44:45 2016 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx6,v 1.6 2015/12/31 12:14:01 ryo Exp $
+#      $NetBSD: files.imx6,v 1.7 2016/05/17 06:44:45 ryo Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -78,6 +78,7 @@
 device enet: ether, ifnet, arp, mii, bus_dma_generic
 attach enet at axi
 file   arch/arm/imx/if_enet.c                  enet
+file   arch/arm/imx/if_enet_imx6.c             enet
 
 # USB Controller
 # attach of this driver need to be specified in paltform configuration
@@ -98,5 +99,6 @@
 # iMX6 Secure Non-Volatile Storage (SNVS)
 device imxsnvs
 attach imxsnvs at axi
+file   arch/arm/imx/imxsnvs.c                  imxsnvs
 file   arch/arm/imx/imx6_snvs.c                imxsnvs
 
diff -r 7650791fd993 -r bbf5eb893548 sys/arch/arm/imx/files.imx7
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/imx/files.imx7       Tue May 17 06:44:45 2016 +0000
@@ -0,0 +1,99 @@
+#      $NetBSD: files.imx7,v 1.1 2016/05/17 06:44:45 ryo Exp $
+#
+# Configuration info for the Freescale i.MX7
+#
+
+include "arch/arm/pic/files.pic"
+include "arch/arm/cortex/files.cortex"
+
+defparam opt_imx.h                             MEMSIZE
+defflag opt_imx.h                              IMX7
+
+file   arch/arm/arm32/arm32_boot.c
+file   arch/arm/arm32/arm32_kvminit.c
+file   arch/arm/arm32/arm32_reboot.c
+file   arch/arm/arm32/irq_dispatch.S
+
+define bus_dma_generic
+
+file   arch/arm/imx/imx_space.c
+file   arch/arm/imx/imx_dma.c                  bus_dma_generic needs-flag
+file   arch/arm/imx/imx7_board.c
+
+
+# iMX7 AXI/AHB bus interface and SoC domains
+device axi { [addr=-1], [size=0], [irq=-1], [irqbase=-1]} : bus_space_generic
+attach axi at mainbus
+file   arch/arm/imx/imx7_axi.c                 axi
+
+# iMX7 Clock Control Module
+device imxccm
+attach imxccm at axi
+file   arch/arm/imx/imx7_ccm.c                 imxccm  needs-flag
+
+# iMX7 Enhanced Periodic Interrupt Timer
+device imxclock
+attach imxclock at axi
+file   arch/arm/imx/imxclock.c                 imxclock
+file   arch/arm/imx/imx7_clock.c               imxclock
+
+# iMX7 On-Chip OTP Controller
+device imxocotp
+attach imxocotp at axi
+file   arch/arm/imx/imx7_ocotp.c               imxocotp        needs-flag
+
+# Watchdog
+device imxwdog: sysmon_wdog
+attach imxwdog at axi
+file   arch/arm/imx/imx7_wdog.c                imxwdog
+file   arch/arm/imx/imxwdog.c                  imxwdog
+
+# iMX GPIO
+device imxgpio: gpiobus
+attach imxgpio at axi
+file   arch/arm/imx/imxgpio.c                  imxgpio needs-flag
+file   arch/arm/imx/imx7_gpio.c                imxgpio
+defflag opt_imxgpio.h                          IMX_GPIO_INTR_SPLIT
+
+# iMX7 IOMUX
+device imxiomux
+attach imxiomux at axi
+file   arch/arm/imx/imx7_iomux.c               imxiomux
+
+# iMX iic Controler
+device imxi2c: motoi2c, i2cbus, i2cexec
+attach imxi2c at axi
+file   arch/arm/imx/imxi2c.c                   imxi2c
+file   arch/arm/imx/imx7_i2c.c                 imxi2c
+
+# iMX UART
+device imxuart
+attach imxuart at axi
+file   arch/arm/imx/imxuart.c                  imxuart needs-flag
+file   arch/arm/imx/imx7_uart.c                imxuart
+defflag opt_imxuart.h                          IMXUARTCONSOLE
+
+# iMX7 10/100/1000-Mbps Ethernet MAC(ENET)
+device enet: ether, ifnet, arp, mii, bus_dma_generic
+attach enet at axi
+file   arch/arm/imx/if_enet.c                  enet
+file   arch/arm/imx/if_enet_imx7.c             enet
+
+# USB Controller
+device imxusbc { unit, irq } : bus_dma_generic
+attach imxusbc at axi with imxusbc_axi
+file   arch/arm/imx/imx7_usb.c                 imxusbc
+
+attach ehci at imxusbc with imxehci
+file   arch/arm/imx/imxusb.c                   imxehci
+
+# uSDHC
+attach sdhc at axi with sdhc_axi
+file   arch/arm/imx/imx7_usdhc.c               sdhc_axi
+
+# iMX7 Secure Non-Volatile Storage (SNVS)
+device imxsnvs
+attach imxsnvs at axi
+file   arch/arm/imx/imxsnvs.c                  imxsnvs
+file   arch/arm/imx/imx7_snvs.c                imxsnvs
+
diff -r 7650791fd993 -r bbf5eb893548 sys/arch/arm/imx/if_enet.c
--- a/sys/arch/arm/imx/if_enet.c        Tue May 17 03:27:02 2016 +0000
+++ b/sys/arch/arm/imx/if_enet.c        Tue May 17 06:44:45 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_enet.c,v 1.5 2016/02/09 08:32:08 ozaki-r Exp $      */
+/*     $NetBSD: if_enet.c,v 1.6 2016/05/17 06:44:45 ryo Exp $  */
 
 /*
  * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,14 +27,12 @@
  */
 
 /*
- * i.MX6 10/100/1000-Mbps ethernet MAC (ENET)
+ * i.MX6,7 10/100/1000-Mbps ethernet MAC (ENET)
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.5 2016/02/09 08:32:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.6 2016/05/17 06:44:45 ryo Exp $");
 
-#include "imxocotp.h"
-#include "imxccm.h"
 #include "vlan.h"
 
 #include <sys/param.h>
@@ -61,18 +59,14 @@
 #include <dev/mii/mii.h>
 #include <dev/mii/miivar.h>
 
-#include <arm/imx/imx6var.h>
-#include <arm/imx/imx6_reg.h>
-#include <arm/imx/imx6_ocotpreg.h>
-#include <arm/imx/imx6_ocotpvar.h>
-#include <arm/imx/imx6_ccmreg.h>
-#include <arm/imx/imx6_ccmvar.h>
 #include <arm/imx/if_enetreg.h>
-#include "locators.h"
+#include <arm/imx/if_enetvar.h>
 
 #undef DEBUG_ENET
 #undef ENET_EVENT_COUNTER
 
+#define ENET_TICK      hz
+
 #ifdef DEBUG_ENET
 int enet_debug = 0;
 # define DEVICE_DPRINTF(args...)       \
@@ -83,7 +77,7 @@
 
 
 #define RXDESC_MAXBUFSIZE      0x07f0
-                               /* iMX6 ENET not work greather than 0x0800... */
+                               /* ENET does not work greather than 0x0800... */
 
 #undef ENET_SUPPORT_JUMBO      /* JUMBO FRAME SUPPORT is unstable */
 #ifdef ENET_SUPPORT_JUMBO
@@ -97,94 +91,9 @@
 
 
 #define ENET_MAX_PKT_NSEGS     64
-#define ENET_TX_RING_CNT       256     /* must be 2^n */
-#define ENET_RX_RING_CNT       256     /* must be 2^n */
 
-#define ENET_TX_NEXTIDX(idx)   (((idx) + 1) & (ENET_TX_RING_CNT - 1))
-#define ENET_RX_NEXTIDX(idx)   (((idx) + 1) & (ENET_RX_RING_CNT - 1))
-
-struct enet_txsoft {
-       struct mbuf *txs_mbuf;          /* head of our mbuf chain */
-       bus_dmamap_t txs_dmamap;        /* our DMA map */
-};
-
-struct enet_rxsoft {
-       struct mbuf *rxs_mbuf;          /* head of our mbuf chain */
-       bus_dmamap_t rxs_dmamap;        /* our DMA map */
-};
-
-struct enet_softc {
-       device_t sc_dev;
-
-       bus_addr_t sc_addr;
-       bus_space_tag_t sc_iot;
-       bus_space_handle_t sc_ioh;
-       bus_dma_tag_t sc_dmat;
-
-       /* interrupts */
-       void *sc_ih;
-       callout_t sc_tick_ch;
-       bool sc_stopping;
-
-       /* TX */
-       struct enet_txdesc *sc_txdesc_ring;     /* [ENET_TX_RING_CNT] */
-       bus_dmamap_t sc_txdesc_dmamap;
-       struct enet_rxdesc *sc_rxdesc_ring;     /* [ENET_RX_RING_CNT] */
-       bus_dmamap_t sc_rxdesc_dmamap;
-       struct enet_txsoft sc_txsoft[ENET_TX_RING_CNT];
-       int sc_tx_considx;
-       int sc_tx_prodidx;
-       int sc_tx_free;
-
-       /* RX */
-       struct enet_rxsoft sc_rxsoft[ENET_RX_RING_CNT];
-       int sc_rx_readidx;
-
-       /* misc */
-       int sc_if_flags;                        /* local copy of if_flags */
-       int sc_flowflags;                       /* 802.3x flow control flags */
-       struct ethercom sc_ethercom;            /* interface info */
-       struct mii_data sc_mii;
-       uint8_t sc_enaddr[ETHER_ADDR_LEN];
-       krndsource_t sc_rnd_source;
-
-#ifdef ENET_EVENT_COUNTER
-       struct evcnt sc_ev_t_drop;
-       struct evcnt sc_ev_t_packets;
-       struct evcnt sc_ev_t_bc_pkt;
-       struct evcnt sc_ev_t_mc_pkt;
-       struct evcnt sc_ev_t_crc_align;
-       struct evcnt sc_ev_t_undersize;
-       struct evcnt sc_ev_t_oversize;
-       struct evcnt sc_ev_t_frag;
-       struct evcnt sc_ev_t_jab;
-       struct evcnt sc_ev_t_col;
-       struct evcnt sc_ev_t_p64;
-       struct evcnt sc_ev_t_p65to127n;
-       struct evcnt sc_ev_t_p128to255n;
-       struct evcnt sc_ev_t_p256to511;
-       struct evcnt sc_ev_t_p512to1023;
-       struct evcnt sc_ev_t_p1024to2047;
-       struct evcnt sc_ev_t_p_gte2048;
-       struct evcnt sc_ev_t_octets;
-       struct evcnt sc_ev_r_packets;
-       struct evcnt sc_ev_r_bc_pkt;
-       struct evcnt sc_ev_r_mc_pkt;
-       struct evcnt sc_ev_r_crc_align;
-       struct evcnt sc_ev_r_undersize;
-       struct evcnt sc_ev_r_oversize;
-       struct evcnt sc_ev_r_frag;
-       struct evcnt sc_ev_r_jab;
-       struct evcnt sc_ev_r_p64;
-       struct evcnt sc_ev_r_p65to127;
-       struct evcnt sc_ev_r_p128to255;
-       struct evcnt sc_ev_r_p256to511;
-       struct evcnt sc_ev_r_p512to1023;
-       struct evcnt sc_ev_r_p1024to2047;
-       struct evcnt sc_ev_r_p_gte2048;
-       struct evcnt sc_ev_r_octets;
-#endif /* ENET_EVENT_COUNTER */
-};
+#define ENET_TX_NEXTIDX(idx)   (((idx) >= (ENET_TX_RING_CNT - 1)) ? 0 : ((idx) + 1))
+#define ENET_RX_NEXTIDX(idx)   (((idx) >= (ENET_RX_RING_CNT - 1)) ? 0 : ((idx) + 1))
 
 #define TXDESC_WRITEOUT(idx)                                   \
        bus_dmamap_sync(sc->sc_dmat, sc->sc_txdesc_dmamap,      \
@@ -216,8 +125,6 @@



Home | Main Index | Thread Index | Old Index