PERFORCE change 162627 for review
Sylvestre Gallon
syl at FreeBSD.org
Sun May 24 07:30:36 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=162627
Change 162627 by syl at syl_rincewind on 2009/05/24 07:30:23
Implement SoC file for at91sam9261ek.
Import header for sam9261 registers and pio.
Add AT91SAM9261EK config file.
Affected files ...
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91_pio_sam9261.h#1 add
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/at91sam9261reg.h#1 add
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/board_at91sam9261ek.c#2 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/files.at91#3 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91rm9200.c#4 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91sam9261.c#3 edit
.. //depot/projects/soc2009/syl_usb/src/sys/arm/at91/std.at91sam9261ek#1 add
.. //depot/projects/soc2009/syl_usb/src/sys/arm/conf/AT91SAM9261EK#1 add
Differences ...
==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/board_at91sam9261ek.c#2 (text+ko) ====
@@ -1,0 +1,36 @@
+/*-
+ * Copyright (c) 2009 Sylvestre Gallon. 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 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 AUTHOR 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/cdefs.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <arm/at91/at91board.h>
+
+long
+board_init(void)
+{
+ return (at91_ramsize());
+}
==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/files.at91#3 (text) ====
@@ -22,7 +22,7 @@
# All the SoC we support
#
arm/at91/soc_at91rm9200.c optional at91rm9200
-arm/at91/soc_ar91sam9261.c optional at91sam9261
+arm/at91/soc_at91sam9261.c optional at91sam9261
#
# All the boards we support
#
@@ -30,4 +30,4 @@
arm/at91/board_hl200.c optional at91_board_hl200
arm/at91/board_kb920x.c optional at91_board_kb920x
arm/at91/board_tsc4370.c optional at91_board_tsc4370
-arm/at91/board_at91sam9261ek optional at91_board_at91sam9261ek
+arm/at91/board_at91sam9261ek.c optional at91_board_at91sam9261ek
==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91rm9200.c#4 (text+ko) ====
@@ -275,9 +275,6 @@
{ 0, 0, 0, 0, 0 }
};
-/*
- * Attach stuff SoC dependant.
- */
void
soc_attach(struct at91_softc *sc)
{
==== //depot/projects/soc2009/syl_usb/src/sys/arm/at91/soc_at91sam9261.c#3 (text+ko) ====
@@ -23,10 +23,165 @@
* SUCH DAMAGE.
*/
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+
+#include <arm/at91/at91sam9261reg.h>
+#include <arm/at91/at91var.h>
+
/*
* Need to calcul the master clock instead of fixing an
* hard coded value.
*/
+uint32_t at91_master_clock = 198656000/2;
-uint32_t at91_master_clock = 198656000/2;
+/* Static device mappings. */
+const struct pmap_devmap at91_devmap[] = {
+ /*
+ * Map the on-board devices VA == PA so that we can access them
+ * with the MMU on or off.
+ */
+ {
+ /*
+ * This at least maps the interrupt controller, the UART
+ * and the timer. Other devices should use newbus to
+ * map their memory anyway.
+ */
+ 0xdff00000,
+ 0xfff00000,
+ 0x100000,
+ VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE,
+ },
+ /*
+ * We can't just map the OHCI registers VA == PA, because
+ * AT91RM92_OHCI_BASE belongs to the userland address space.
+ * We could just choose a different virtual address, but a better
+ * solution would probably be to just use pmap_mapdev() to allocate
+ * KVA, as we don't need the OHCI controller before the vm
+ * initialization is done. However, the AT91 resource allocation
+ * system doesn't know how to use pmap_mapdev() yet.
+ */
+ {
+ /*
+ * Add the ohci controller, and anything else that might be
+ * on this chip select for a VA/PA mapping.
+ */
+ AT91SAM9261_OHCI_BASE,
+ AT91SAM9261_OHCI_PA_BASE,
+ AT91SAM9261_OHCI_SIZE,
+ VM_PROT_READ|VM_PROT_WRITE,
+ PTE_NOCACHE,
+ },
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }
+};
+
+/*
+ * Standard priority levels for the system. 0 is lowest and 7 is highest.
+ * These values are the ones Atmel uses for its Linux port, which differ
+ * a little form the ones that are in the standard distribution. Also,
+ * the ones marked with 'TWEEK' are different based on experience.
+ */
+
+int at91_irq_prio[32] =
+{
+ 7, /* Advanced Interrupt Controller (FIQ) */
+ 7, /* System Peripherals */
+ 1, /* Parallel IO Controller A */
+ 1, /* Parallel IO Controller B */
+ 1, /* Parallel IO Controller C */
+ 0,
+ 5, /* USART 0 */
+ 5, /* USART 1 */
+ 5, /* USART 2 */
+ 0, /* Multimedia Card Interface */
+ 2, /* USB Device Port */
+ 6, /* Two-Wire Interface */
+ 5, /* Serial Peripheral Interface 0 */
+ 5, /* Serial Peripheral Interface 1 */
+ 4, /* Serial Synchronous Controller 0 */
+ 4, /* Serial Synchronous Controller 1 */
+ 4, /* Serial Synchronous Controller 2 */
+ 0, /* Timer Counter 0 */
+ 0, /* Timer Counter 1 */
+ 0, /* Timer Counter 2 */
+ 2, /* USB Host Port */
+ 3, /* LCD Controller */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, /* Advanced Interface Controller (IRQ0) */
+ 0, /* Advanced Interface Controller (IRQ1) */
+ 0 /* Advanced Interrupt Controller (IRQ2) */
+};
+
+struct cpu_devs at91_devs[] =
+{
+ /* PIO need to be check */
+ {
+ "at91_udp", 0,
+ AT91SAM9261_BASE + AT91SAM9261_UDP_BASE, AT91SAM9261_UDP_SIZE,
+ AT91SAM9261_IRQ_UDP, AT91SAM9261_IRQ_PIOB
+ },
+ {
+ "ohci", 0,
+ AT91SAM9261_OHCI_BASE, AT91SAM9261_OHCI_SIZE,
+ AT91SAM9261_IRQ_UHP
+ },
+ { 0, 0, 0, 0, 0 }
+};
+
+void
+soc_attach(struct at91_softc *sc)
+{
+ if (rman_manage_region(&sc->sc_mem_rman, AT91SAM9261_OHCI_BASE,
+ AT91SAM9261_OHCI_BASE + AT91SAM9261_OHCI_SIZE - 1) != 0)
+ panic("at91_attach: failed to set up ohci memory");
+}
+
+/*
+ * Accessor for BASE SYS_BASE SYS_SIZE and IRQ_SYSTEM
+ */
+
+uint32_t
+at91_sys_base(void)
+{
+ return (AT91SAM9261_SYS_BASE);
+}
+
+uint32_t
+at91_sys_size(void)
+{
+ return (AT91SAM9261_SYS_SIZE);
+}
+
+uint32_t
+at91_base(void)
+{
+ return (AT91SAM9261_BASE);
+}
+
+uint32_t
+at91_irq_sys(void)
+{
+ return (AT91SAM9261_IRQ_SYSTEM);
+}
+uint32_t
+at91_sdramc_base(void)
+{
+ return (AT91SAM9261_SDRAMC_BASE);
+}
More information about the p4-projects
mailing list