Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch add support i.MX6 and NITROGEN6X evaluation board
details: https://anonhg.NetBSD.org/src/rev/1134a3f7c123
branches: trunk
changeset: 332505:1134a3f7c123
user: ryo <ryo%NetBSD.org@localhost>
date: Thu Sep 25 05:05:28 2014 +0000
description:
add support i.MX6 and NITROGEN6X evaluation board
diffstat:
sys/arch/arm/imx/files.imx6 | 125 +-
sys/arch/arm/imx/if_enet.c | 2069 +++++++++++++++++++++++++
sys/arch/arm/imx/if_enetreg.h | 301 +++
sys/arch/arm/imx/imx6_ahcisata.c | 326 +++
sys/arch/arm/imx/imx6_ahcisatareg.h | 76 +
sys/arch/arm/imx/imx6_axi.c | 159 +
sys/arch/arm/imx/imx6_board.c | 188 ++
sys/arch/arm/imx/imx6_ccm.c | 730 ++++++++
sys/arch/arm/imx/imx6_ccmreg.h | 298 +++
sys/arch/arm/imx/imx6_ccmvar.h | 70 +
sys/arch/arm/imx/imx6_clock.c | 131 +
sys/arch/arm/imx/imx6_gpio.c | 117 +
sys/arch/arm/imx/imx6_intr.h | 44 +-
sys/arch/arm/imx/imx6_iomux.c | 202 ++
sys/arch/arm/imx/imx6_iomuxreg.h | 721 ++++++++
sys/arch/arm/imx/imx6_mmdcreg.h | 212 ++
sys/arch/arm/imx/imx6_ocotp.c | 125 +
sys/arch/arm/imx/imx6_ocotpreg.h | 80 +
sys/arch/arm/imx/imx6_ocotpvar.h | 34 +
sys/arch/arm/imx/imx6_reg.h | 86 +-
sys/arch/arm/imx/imx6_srcreg.h | 100 +
sys/arch/arm/imx/imx6_uart.c | 62 +
sys/arch/arm/imx/imx6_usb.c | 112 +
sys/arch/arm/imx/imx6_usbreg.h | 112 +
sys/arch/arm/imx/imx6_usdhc.c | 155 +
sys/arch/arm/imx/imx6_wdog.c | 63 +
sys/arch/arm/imx/imx6var.h | 76 +
sys/arch/arm/imx/imxgpio.c | 9 +-
sys/arch/arm/imx/imxuart.c | 13 +-
sys/arch/arm/imx/imxusb.c | 11 +-
sys/arch/arm/imx/imxwdog.c | 7 +-
sys/arch/arm/imx/imxwdogreg.h | 23 +-
sys/arch/evbarm/conf/NITROGEN6X | 427 +++++
sys/arch/evbarm/conf/files.nitrogen6 | 16 +
sys/arch/evbarm/conf/mk.nitrogen6 | 23 +
sys/arch/evbarm/conf/std.nitrogen6 | 37 +
sys/arch/evbarm/nitrogen6/genassym.cf | 63 +
sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c | 280 +++
sys/arch/evbarm/nitrogen6/nitrogen6_start.S | 355 ++++
sys/arch/evbarm/nitrogen6/nitrogen6_usb.c | 215 ++
sys/arch/evbarm/nitrogen6/platform.h | 57 +
41 files changed, 8161 insertions(+), 149 deletions(-)
diffs (truncated from 8722 to 300 lines):
diff -r 57382007ac33 -r 1134a3f7c123 sys/arch/arm/imx/files.imx6
--- a/sys/arch/arm/imx/files.imx6 Thu Sep 25 04:59:15 2014 +0000
+++ b/sys/arch/arm/imx/files.imx6 Thu Sep 25 05:05:28 2014 +0000
@@ -1,105 +1,90 @@
-# $NetBSD: files.imx6,v 1.1 2012/09/01 00:07:32 matt Exp $
+# $NetBSD: files.imx6,v 1.2 2014/09/25 05:05:28 ryo Exp $
#
# Configuration info for the Freescale i.MX6
#
+include "arch/arm/pic/files.pic"
+include "arch/arm/cortex/files.cortex"
+
defparam opt_imx.h MEMSIZE
defflag opt_imx.h IMX6
+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/imx_dma.c bus_dma_generic needs-flag
+file arch/arm/imx/imx6_board.c
+
# iMX6 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/imx6_axi.c axi
+file arch/arm/imx/imx6_axi.c axi
+
+# iMX6 Clock Control Module
+device imxccm
+attach imxccm at axi
+file arch/arm/imx/imx6_ccm.c imxccm needs-flag
+defflag opt_imx6clk.h IMXCCMDEBUG
# iMX6 Enhanced Periodic Interrupt Timer
device imxclock
attach imxclock at axi
-file arch/arm/imx/imxclock.c
-file arch/arm/imx/imx6_clock.c
-
-# Clock Control Module
-device imxccm
-attach imxccm at axi
-file arch/arm/imx/imx6_ccm.c imxccm needs-flag
+file arch/arm/imx/imxclock.c imxclock
+file arch/arm/imx/imx6_clock.c imxclock
-# frequency of external low frequency clock
-# typically 32000, 32768, or 38400.
-defparam opt_imx6clk.h IMX6_CKIL_FREQ
+# iMX6 On-Chip OTP Controller
+device imxocotp
+attach imxocotp at axi
+file arch/arm/imx/imx6_ocotp.c imxocotp needs-flag
-# frequency of on-chip oscillator. typically 24000000.
-defparam opt_imx6clk.h IMX6_OSC_FREQ
-
-# following parameters are used when imxccm is not configured in the kernel.
-defparam opt_imx6clk.h IMX6_AHBCLK_FREQ
-defparam opt_imx6clk.h IMX6_IPGCLK_FREQ
+# Watchdog
+device imxwdog: sysmon_wdog
+attach imxwdog at axi
+file arch/arm/imx/imx6_wdog.c imxwdog
+file arch/arm/imx/imxwdog.c imxwdog
# iMX GPIO
-#device imxgpio: gpiobus
+device imxgpio: gpiobus
attach imxgpio at axi
-#file arch/arm/imx/imxgpio.c imxgpio needs-flag
-#file arch/arm/imx/imx6_gpio.c imxgpio
-
-# iMX IOMUX
-#device imxiomux : bus_space_generic
-#attach imxiomux at axi
-#file arch/arm/imx/imx6_iomux.c imxiomux
+file arch/arm/imx/imxgpio.c imxgpio needs-flag
+file arch/arm/imx/imx6_gpio.c imxgpio
+defflag opt_imxgpio.h IMX_GPIO_INTR_SPLIT
-# IPU v3 controller
-#device ipu : bus_dma_generic, wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation, vcons
-#file arch/arm/imx/imx6_ipuv3.c ipu needs-flag
-#defflag opt_imx6_ipuv3.h IMXIPUCONSOLE
-#defparam opt_imx6_ipuv3.h IPUV3_DEBUG
-
-# iMX M3IF - Multi Master Memory Interface
-# iMX ESDCTL/MDDRC - Enhanced SDRAM/LPDDR memory controller
-# iMX PCMCIA - PCMCIA memory controller
-# iMX NANDFC - NAND Flash memory controller
-# iMX WEIM - Wireless External Interface Module
+# iMX6 IOMUX
+device imxiomux
+attach imxiomux at axi
+file arch/arm/imx/imx6_iomux.c imxiomux
# iMX UART
device imxuart
attach imxuart at axi
file arch/arm/imx/imxuart.c imxuart needs-flag
file arch/arm/imx/imx6_uart.c imxuart
-defflag opt_imxuart.h IMXUARTCONSOLE
-
-# USB controller
-# attach of this driver need to be specified in paltform configuration
-device imxusbc { unit, irq } : bus_dma_generic
-file arch/arm/imx/imx6_usb.c imxusbc
+defflag opt_imxuart.h IMXUARTCONSOLE
-attach ehci at imxusbc with imxehci
-file arch/arm/imx/imxusb.c imxehci
-
-# attach wdc at ahb with wdc_ahb : bus_dma_generic
-# file arch/arm/imx/wdc_axi.c wdc_axi
-
-# SD host controller for SD/MMC
-attach sdhc at axi with sdhc_axi
-file arch/arm/imx/imx6_esdhc.c sdhc_axi
+# iMX6 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
-# iic Controler
-# device imxi2c: i2cbus
-# file arch/arm/imx/imx6_i2c.c imxi2c
+# USB Controller
+# attach of this driver need to be specified in paltform configuration
+device imxusbc { unit, irq } : bus_dma_generic
+file arch/arm/imx/imx6_usb.c imxusbc
-# attach imxi2c at aips with imxi2c_aips
-# file arch/arm/imx/imxi2c_aips.c imxi2c_aips
+attach ehci at imxusbc with imxehci
+file arch/arm/imx/imxusb.c imxehci
-# spi bus controlloer
-# device imxspi: spibus
-# file arch/arm/imx/imx6_spi.c imxspi
+# uSDHC
+attach sdhc at axi with sdhc_axi
+file arch/arm/imx/imx6_usdhc.c sdhc_axi
-# Smart Direct Memory Access Controller
-# device imxsdma: dmover_service, bus_dma_generic
-# attach imxsdma at ahb
-# file arch/arm/imx/imxsdma.c imxsdma
-# file arch/arm/imx/imxsdmaprog.c imxsdma
-
-# iis sound Controller (SSI module)
-# device imxi2s {} : bus_dma_generic
-# file arch/arm/imx/imx6_i2s.c imxi2s needs-flag
+# iMX6 SATA Controllers (AHCI)
+attach ahcisata at axi with imx6_ahcisata
+file arch/arm/imx/imx6_ahcisata.c imx6_ahcisata
diff -r 57382007ac33 -r 1134a3f7c123 sys/arch/arm/imx/if_enet.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/imx/if_enet.c Thu Sep 25 05:05:28 2014 +0000
@@ -0,0 +1,2069 @@
+/* $NetBSD: if_enet.c,v 1.1 2014/09/25 05:05:28 ryo Exp $ */
+
+/*
+ * Copyright (c) 2014 Ryo Shimizu <ryo%nerv.org@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * i.MX6 10/100/1000-Mbps ethernet MAC (ENET)
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.1 2014/09/25 05:05:28 ryo Exp $");
+
+#include "imxocotp.h"
+#include "imxccm.h"
+#include "vlan.h"
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/mbuf.h>
+#include <sys/device.h>
+#include <sys/sockio.h>
+#include <sys/kernel.h>
+#include <sys/rnd.h>
+
+#include <lib/libkern/libkern.h>
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+#include <net/bpf.h>
+#include <net/if_vlanvar.h>
+
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+#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"
+
+#undef DEBUG_ENET
+#undef ENET_EVENT_COUNTER
+
+#ifdef DEBUG_ENET
+int enet_debug = 0;
+# define DEVICE_DPRINTF(args...) \
+ do { if (enet_debug) device_printf(sc->sc_dev, args); } while (0)
+#else
+# define DEVICE_DPRINTF(args...)
+#endif
+
+
+#define RXDESC_MAXBUFSIZE 0x07f0
+ /* iMX6 ENET not work greather than 0x0800... */
+
+#undef ENET_SUPPORT_JUMBO /* JUMBO FRAME SUPPORT is unstable */
+#ifdef ENET_SUPPORT_JUMBO
+# define ENET_MAX_PKT_LEN 4034 /* MAX FIFO LEN */
+#else
+# define ENET_MAX_PKT_LEN 1522
+#endif
+#define ENET_DEFAULT_PKT_LEN 1522 /* including VLAN tag */
+#define MTU2FRAMESIZE(n) \
+ ((n) + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN)
+
+
+#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] */
Home |
Main Index |
Thread Index |
Old Index