Source-Changes-HG archive

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

[src/trunk]: src/sys/arch iMX233/OLinuXino changes from Petri Laskso.



details:   https://anonhg.NetBSD.org/src/rev/533010811206
branches:  trunk
changeset: 790422:533010811206
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Oct 07 17:36:40 2013 +0000

description:
iMX233/OLinuXino changes from Petri Laskso.
See http://mail-index.netbsd.org/port-arm/2013/10/07/msg002042.html

diffstat:

 sys/arch/arm/imx/files.imx23                              |   49 +-
 sys/arch/arm/imx/imx23_ahb.c                              |  142 ++
 sys/arch/arm/imx/imx23_clkctrl.c                          |  151 +++
 sys/arch/arm/imx/imx23_clkctrlreg.h                       |    3 +-
 sys/arch/arm/imx/imx23_clkctrlvar.h                       |   37 +
 sys/arch/arm/imx/imx23_digctl.c                           |  193 +++
 sys/arch/arm/imx/imx23_digctlreg.h                        |    3 +-
 sys/arch/arm/imx/imx23_digctlvar.h                        |   37 +
 sys/arch/arm/imx/imx23_pinctrl.c                          |  608 ++++++++++++
 sys/arch/arm/imx/imx23_pinctrlreg.h                       |   82 +-
 sys/arch/arm/imx/imx23_pinctrlvar.h                       |   37 +
 sys/arch/arm/imx/imx23_powerreg.h                         |    3 +-
 sys/arch/arm/imx/imx23_space.c                            |    5 +-
 sys/arch/arm/imx/imx23_ssp.c                              |    7 +-
 sys/arch/arm/imx/imx23_timrot.c                           |    6 +-
 sys/arch/arm/imx/imx23_usb.c                              |  154 +++
 sys/arch/arm/imx/imx23_usbphy.c                           |  203 ++++
 sys/arch/arm/imx/imx23_usbphyreg.h                        |  216 ++++
 sys/arch/arm/imx/imx23var.h                               |   17 +-
 sys/arch/arm/imx/imxusb.c                                 |   10 +-
 sys/arch/evbarm/conf/IMX23_OLINUXINO                      |   62 +-
 sys/arch/evbarm/conf/IMX23_OLINUXINO_INSTALL              |   10 +
 sys/arch/evbarm/conf/files.imx23_olinuxino                |    5 +-
 sys/arch/evbarm/conf/mk.imx23_olinuxino                   |   12 +-
 sys/arch/evbarm/conf/std.imx23_olinuxino                  |    5 +-
 sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c |  679 ++++---------
 sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_start.S   |   47 +-
 sys/arch/evbarm/stand/bootimx23/Makefile                  |    8 +-
 sys/arch/evbarm/stand/bootimx23/bootimx23.bd              |   10 +-
 sys/arch/evbarm/stand/bootimx23/bootimx23.c               |  172 +++
 sys/arch/evbarm/stand/bootimx23/clock_prep.c              |  305 ++---
 sys/arch/evbarm/stand/bootimx23/common.c                  |   71 +-
 sys/arch/evbarm/stand/bootimx23/common.h                  |   28 +-
 sys/arch/evbarm/stand/bootimx23/emi_prep.c                |  148 +-
 sys/arch/evbarm/stand/bootimx23/pinctrl_prep.c            |  555 ++---------
 sys/arch/evbarm/stand/bootimx23/power_prep.c              |  481 ++++++---
 36 files changed, 3143 insertions(+), 1418 deletions(-)

diffs (truncated from 5354 to 300 lines):

diff -r ece93773b229 -r 533010811206 sys/arch/arm/imx/files.imx23
--- a/sys/arch/arm/imx/files.imx23      Mon Oct 07 15:17:24 2013 +0000
+++ b/sys/arch/arm/imx/files.imx23      Mon Oct 07 17:36:40 2013 +0000
@@ -1,10 +1,11 @@
-# $Id: files.imx23,v 1.1 2012/11/20 19:06:12 jkunz Exp $
+# $Id: files.imx23,v 1.2 2013/10/07 17:36:40 matt Exp $
 #
 # Freescale i.MX23 applications processor configuration info.
 #
 
-file   arch/arm/imx/imx23_space.c      apbh|apbx
-file   arch/arm/imx/imx23_dma.c        apbh|apbx
+file   arch/arm/arm32/irq_dispatch.S   icoll
+file   arch/arm/imx/imx23_space.c      ahb|apbh|apbx
+file   arch/arm/imx/imx23_dma.c        ahb|apbh|apbx
 
 # APBH bus interface
 device apbh {addr=0, size=0, irq=-1} : bus_space_generic
@@ -16,18 +17,27 @@
 attach apbx at mainbus
 file   arch/arm/imx/imx23_apbx.c       apbx
 
+# AHB bus interface
+device  ahb {addr=0, size=0, irq=-1} : bus_space_generic
+attach  ahb at mainbus
+file    arch/arm/imx/imx23_ahb.c       ahb
+
 # Interrupt controller
 include "arch/arm/pic/files.pic"
 device icoll: pic, pic_splfuncs
 attach icoll at apbh
 file   arch/arm/imx/imx23_icoll.c      icoll
-file   arch/arm/arm32/irq_dispatch.S
 
-# Synchronous serial port (for SD/MMC)
+# Synchronous Serial Port (for SD/MMC)
 device ssp: sdmmcbus
 attach ssp at apbh
 file   arch/arm/imx/imx23_ssp.c        ssp
 
+# Power control
+#device        power
+#attach        power at apbx
+#file  arch/arm/imx/imx23_power.c      power
+
 # PL011 Debug console
 attach plcom at apbx with imx23plcom
 file   arch/arm/imx/imx23_plcom.c      imx23plcom
@@ -41,3 +51,32 @@
 device apbdma
 attach apbdma at apbh, apbx
 file   arch/arm/imx/imx23_apbdma.c     apbdma
+
+# USB PHY
+device usbphy
+attach usbphy at apbx
+file   arch/arm/imx/imx23_usbphy.c     usbphy
+
+# Digital Control
+device digctl
+attach digctl at apbh
+file   arch/arm/imx/imx23_digctl.c     digctl
+
+# PIN Control
+device pinctrl: gpiobus
+attach pinctrl at apbh
+file   arch/arm/imx/imx23_pinctrl.c    pinctrl
+
+# Clock Control
+device clkctrl
+attach clkctrl at apbx
+file   arch/arm/imx/imx23_clkctrl.c    clkctrl
+
+# USB host controller
+device imxusbc {unit, irq} : bus_space_generic
+attach imxusbc at ahb
+file   arch/arm/imx/imx23_usb.c        imxusbc
+
+# EHCI
+attach ehci at imxusbc with imxehci
+file   arch/arm/imx/imxusb.c           imxehci
diff -r ece93773b229 -r 533010811206 sys/arch/arm/imx/imx23_ahb.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/imx/imx23_ahb.c      Mon Oct 07 17:36:40 2013 +0000
@@ -0,0 +1,142 @@
+/* $Id: imx23_ahb.c,v 1.1 2013/10/07 17:36:40 matt Exp $ */
+
+/*
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Petri Laakso.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+
+#include <arm/mainbus/mainbus.h>
+
+#include <arm/imx/imx23var.h>
+
+#include "locators.h"
+
+static int     ahb_match(device_t, cfdata_t, void *);
+static void    ahb_attach(device_t, device_t, void *);
+static int     ahb_detach(device_t, int);
+static int     ahb_activate(device_t, enum devact);
+
+static int     ahb_search_cb(device_t, cfdata_t, const int *, void *);
+static int     ahb_print(void *,const char *);
+
+CFATTACH_DECL3_NEW(ahb,
+       sizeof(struct ahb_softc),
+       ahb_match,
+       ahb_attach,
+       ahb_detach,
+       ahb_activate,
+       NULL,
+       NULL,
+       0);
+
+static int
+ahb_match(device_t parent, cfdata_t match, void *aux)
+{
+       struct mainbus_attach_args *mb = aux;
+
+       if ((mb->mb_iobase == AHB_BASE) && (mb->mb_iosize == AHB_SIZE))
+               return 1;
+
+       return 0;
+}
+
+static void
+ahb_attach(device_t parent, device_t self, void *aux)
+{
+       struct ahb_attach_args aa;
+       static int ahb_attached = 0;
+
+       if (ahb_attached)
+               return;
+
+       aa.aa_iot = &imx23_bus_space;
+       aa.aa_dmat = &imx23_bus_dma_tag;
+
+       aprint_normal("\n");
+
+       config_search_ia(ahb_search_cb, self, "ahb", &aa);
+
+       ahb_attached = 1;
+
+       return;
+}
+
+static int
+ahb_detach(device_t self, int flags)
+{
+       return 0;
+}
+
+static int
+ahb_activate(device_t self, enum devact act)
+{
+       return EOPNOTSUPP;
+}
+
+/*
+ * config_search_ia() callback function.
+ */
+static int
+ahb_search_cb(device_t parent, cfdata_t cf, const int *locs, void *aux)
+{
+       struct apb_attach_args *aa = aux;
+
+       aa->aa_name = cf->cf_name;
+       aa->aa_addr = cf->cf_loc[AHBCF_ADDR];
+       aa->aa_size = cf->cf_loc[AHBCF_SIZE];
+       aa->aa_irq = cf->cf_loc[AHBCF_IRQ];
+
+       if (config_match(parent, cf, aux) > 0)
+               config_attach(parent, cf, aux, ahb_print);
+
+       return 0;
+}
+
+/*
+ * Called from config_attach()
+ */
+static int
+ahb_print(void *aux, const char *name __unused)
+{
+       struct apb_attach_args *aa = aux;
+
+       if (aa->aa_addr != AHBCF_ADDR_DEFAULT) {
+               aprint_normal(" addr 0x%lx", aa->aa_addr);
+               if (aa->aa_size > AHBCF_SIZE_DEFAULT)
+                       aprint_normal("-0x%lx", aa->aa_addr + aa->aa_size-1);
+       }
+
+       if (aa->aa_irq != AHBCF_IRQ_DEFAULT)
+               aprint_normal(" irq %d", aa->aa_irq);
+       
+       return UNCONF;
+}
diff -r ece93773b229 -r 533010811206 sys/arch/arm/imx/imx23_clkctrl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/imx/imx23_clkctrl.c  Mon Oct 07 17:36:40 2013 +0000
@@ -0,0 +1,151 @@
+/* $Id: imx23_clkctrl.c,v 1.1 2013/10/07 17:36:40 matt Exp $ */
+
+/*
+* Copyright (c) 2013 The NetBSD Foundation, Inc.
+* All rights reserved.
+*
+* This code is derived from software contributed to The NetBSD Foundation
+* by Petri Laakso.
+*
+* 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+* ``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 FOUNDATION OR CONTRIBUTORS
+* 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.
+*/
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/bus.h>
+#include <sys/cdefs.h>
+#include <sys/device.h>
+#include <sys/errno.h>
+
+#include <arm/imx/imx23_clkctrlreg.h>
+#include <arm/imx/imx23_clkctrlvar.h>
+#include <arm/imx/imx23var.h>
+
+typedef struct clkctrl_softc {
+       device_t sc_dev;
+       bus_space_tag_t sc_iot;
+       bus_space_handle_t sc_hdl;
+} *clkctrl_softc_t;
+
+static int     clkctrl_match(device_t, cfdata_t, void *);
+static void    clkctrl_attach(device_t, device_t, void *);
+static int     clkctrl_activate(device_t, enum devact);
+
+static void     clkctrl_init(struct clkctrl_softc *);
+
+static clkctrl_softc_t _sc = NULL;
+
+CFATTACH_DECL3_NEW(clkctrl,
+        sizeof(struct clkctrl_softc),
+        clkctrl_match,
+        clkctrl_attach,
+        NULL,
+        clkctrl_activate,
+        NULL,
+        NULL,
+        0
+);
+
+#define CLKCTRL_RD(sc, reg)                                                 \
+        bus_space_read_4(sc->sc_iot, sc->sc_hdl, (reg))



Home | Main Index | Thread Index | Old Index