Commit Graph

58 Commits

Author SHA1 Message Date
Ruslan Bukin
30b72b6871 Move arm's devmap to some generic place, so it can be used
by other architectures.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D6091
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-04-26 11:53:37 +00:00
Justin Hibbits
f8fd3fb518 Fix the resource_list_print_type() calls to use uintmax_t.
Missed a bunch from r297000.
2016-03-22 22:25:08 +00:00
Justin Hibbits
7915adb560 Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.
This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with:	jhb
Suggested by:	marcel
2016-02-20 01:32:58 +00:00
Justin Hibbits
2dd1bdf183 Convert rman to use rman_res_t instead of u_long
Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources.  For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by:	Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075
2016-01-27 02:23:54 +00:00
Warner Losh
8046b4f5b5 We don't need at91_bs_tag. arm_base_bs_tag works now that we have
better dynamic device mapping that didn't exit when we started this
port. Remove it, since everything works w/o it.
2016-01-16 05:47:34 +00:00
Ian Lepore
05ca38474e Use explicit initializer style, fill in missing functions. 2015-01-21 03:28:07 +00:00
Ian Lepore
110e70ba1d For some reason, all the arm bus_space functions that work with uint16
values have armv4 in the name.  There's nothing armv4-special about them,
so just use the same sort of names as all the other functions.
2015-01-21 02:56:13 +00:00
Ian Lepore
4098ccafa4 Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses.

The bus_space struct contains a private data pointer (poorly named bs_cookie,
now renamed to bs_privdata) which is used only by a few old armv4 xscale
implementations.  The bus_space functions were all defined to take this
value as the first parameter instead of the bus_space_tag_t, requiring all
the inline macro and function expansions to dereference the tag to pass it
to another function, which never uses it.  Now all the functions take the tag
as the first parameter and retrieve the privdata if they need it.

Also fix a couple bus_space_unmap() implementations that were calling
kva_free() instead of pmap_unmapdev().

Discussed with:	   cognet
2015-01-21 01:06:08 +00:00
Andrew Turner
b8fd1e31d9 Unify interrupts bit definition and usage. While here remove PSR_C_bit.
Submitted by:	Svatopluk Kraus <onwahe at gmail.com>,
		Michal Meloun <meloun at miracle.cz>
Differential Revision: https://reviews.freebsd.org/D754
2014-09-10 15:25:15 +00:00
Warner Losh
9fedbe51c6 Add AIC to at91sam9260 support, now that it is needed for multipass to
work. This gets my AT91SAM9260-based boards almost booting with
current in multi pass. The MCI driver is broken, but it is equally
broken before multi-pass.
2014-08-14 04:21:31 +00:00
Warner Losh
49fa38e888 Move AIC related stuff to own file. 2014-03-08 06:06:50 +00:00
Warner Losh
ebb61891fb Properly round on unmapping. 2014-03-08 06:06:42 +00:00
Warner Losh
4587b6e9fd Switch to using PAs rather than VAs for the addresses we map for
devices. This is a nop, except for what's reported by atmelbus for the
resources.

It would be nice if we could dymanically allocated these things, but
the pmap_mapdev panics if we don't keep the static mappings, so we
still need to play the carefully allocate VA space between all
supported SoC game.

User's with their own devices may need to make adjustments.
2014-01-31 15:38:05 +00:00
Warner Losh
8b1bf92acc When mapping an address, the bsh needs the same offset we do for other
things.
2014-01-31 01:18:34 +00:00
Warner Losh
a500a7ce91 Bus space handles need to be the VA of the requested resource, not the
rounded page VA. Correct so the DBGU device can be mapped for FDT
console since it isn't on a page boundary.
2014-01-25 21:52:19 +00:00
Warner Losh
6f4f8f233c Set the SoC name for the atmelbus name. 2013-12-30 18:10:04 +00:00
Ian Lepore
3110e7eed8 Move remaining code and data related to static device mapping into the
new devmap.[ch] files.  Emphasize the MD nature of these things by using
the prefix arm_devmap_ on the function and type names (already a few of
these things found their way into MI code, hopefully it will be harder to
do by accident in the future).
2013-11-04 22:45:26 +00:00
Nathan Whitehorn
87cb964b92 Fix typo. Sorry! 2013-10-29 23:55:17 +00:00
Nathan Whitehorn
cd43f427f6 A last BUS_PROBE_NOWILDCARD. Move setting the postfilter function into the
attach function probe shouldn't actually set anything up but just bid
on the device.
2013-10-29 14:44:36 +00:00
Jeff Roberson
5df87b21d3 Replace kernel virtual address space allocation with vmem. This provides
transparent layering and better fragmentation.

 - Normalize functions that allocate memory to use kmem_*
 - Those that allocate address space are named kva_*
 - Those that operate on maps are named kmap_*
 - Implement recursive allocation handling for kmem_arena in vmem.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	EMC / Isilon Storage Division
2013-08-07 06:21:20 +00:00
Oleksandr Tymoshenko
86bce74937 Move unmask IRQ function call up to nexus device level.
FDT-enabled targets were broken after r238043 that relies
on device up the hierarchy to properly setup interrupt.
nexus device for ARM platforms did job only partially:
setting handler but not unmasking interrupt. Unmasking
was performed by platform code.

Reviewed by:	andrew@
2012-07-17 03:18:12 +00:00
Warner Losh
097047f652 Fix whitespace divot. 2012-07-12 13:54:24 +00:00
Warner Losh
a68d1f48b9 Complete the transition away from newbus to populate the children to
the linker set of CPU modules.  The newbus method, although clever,
had many flaws: it didn't really support multiple SoC, many of the
comments about order were just wrong, and it did a few things far too
late to be useful.  delay and cpu_reset now work much earlier in the
boot process.
2012-07-12 13:45:58 +00:00
Warner Losh
7f6eecf580 Create the children devices for the SoC in atmelarm bus node, not in
the identify routine of the CPU.
2012-07-12 04:23:11 +00:00
Warner Losh
0fb8b6b070 Export the interrupt status vector via soc_data. Set the interrupt
priorities in the AIC in the atmelarm driver before attaching the
children.  Delete redunant copies of the code.
2012-07-12 02:58:45 +00:00
Warner Losh
d67febb24f Remove a useless bit of indirection. On all Atmel ARM products, irq 1
is the system IRQ, so use the define for it and get on with life.
2012-07-10 15:02:29 +00:00
Warner Losh
19f4a07329 Collapse all copies of at91_add_child into at91.c. They were
logically identical before today, and actually identical after today's
changes.
2012-07-10 04:17:49 +00:00
Warner Losh
6a7be52dbe Strip trailing whitespace before other changes. 2012-06-13 04:52:19 +00:00
Warner Losh
73a4b7a9d8 Enhance the Atmel SoC chip identification routines to account for more
SoC variants.  Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate.  The following SoCs/SoC families are recognized:
	at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
	at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
	at91sam9x5
and the following variations are also recognized:
	at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
	at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
	at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.

# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
Warner Losh
c414207ab0 Compute the master clock frequency, so we no longer need to have it
compiled into the kernel.  This allows us to boot the same kernel on
machines with different master clock frequencies, so long as we can
determine the main clock frequency accurately.  Cleanup the pmc clock
init function so it can be called in early boot so we can use the
serial port just after we call cninit.

# We have two calls to at91_pmc_clock_init for reasons unknown, that will
# be fixed later -- it is harmless for now.
2012-05-29 03:23:18 +00:00
Warner Losh
32f648079f Be a little less magical, not that these values are likely to change... 2012-05-21 07:47:57 +00:00
Kevin Lo
a32376dd76 Check the return value of BUS_SETUP_INTR()
Reviewed by:	imp
2011-10-27 10:21:40 +00:00
Olivier Houchard
4ad6106939 if_ate.c:
* Support for sam9 "EMAC" controller.
    * Support for rmii interface to phy.

at91.c & at91sam9.c:

    * Eliminate separate at91sam9.c file.
    * Add new devices to at91sam9_devs table.

at91_machdep.c & at at91sam9_machdep.c:

    * Automatic chip type determination.
    * Remove compile time chip dependencies.
    * Eliminate separate at91sam9_machdep.c file.

at91_pmc.c:

    * Corrected support for all of the sam926? and sam9g20 chips.
    * Remove compile time chip dependencies.

My apologies to Greg for taking so long to take care of it.
2010-10-06 22:25:21 +00:00
Marcel Moolenaar
272489fe59 Pass the previously returned IRQ back to arm_get_next_irq() so that
the implementation can guarantee forward progress in the event of
a stuck interrupt or interrupt storm. This is especially critical
for fast interrupt handlers, as they can cause a hard hang in that
case. When first called, arm_get_next_irq() is passed -1.

Obtained from:	Juniper Networks, Inc.
2009-06-09 18:18:41 +00:00
Warner Losh
940672949e Fix name for driver to assign to the SPI device. 2009-05-15 04:49:20 +00:00
Stanislav Sedov
f3bdbeccf7 - Add the driver for AT91RM9200 CompactFlash controller. The driver
operates in the common memory mode and use polling mode to control
  the status of operations as I don't have any board with interrupt
  line routed yet. I'll add the GPIO interrupt driven mode as soon
  as I get one.
2009-04-22 23:54:41 +00:00
Warner Losh
5d5516e7b7 Store at91_master_clock in a global variable as opposed to a compile
time constant.  This allows us to potentially change it at runtime or
autodetect it early in the boot (the latter being much more likely to
have a good outcome).
2009-01-22 21:54:26 +00:00
Warner Losh
82645a84eb Tweak the disclaimer section of the license to match COPYRIGHT, for
better or worse.  Ok'd by folks that have additional copyrights to the
files in cases where there's joint authorship.
2008-11-25 00:13:26 +00:00
Stanislav Sedov
e06d0e0a92 - Add stream bus_space operations.
Reviewed by:	cognet
Approved by:	kib (mentor, implicit)
MFC after:	1 week
2008-10-26 22:53:59 +00:00
Stanislav Sedov
baf7d37113 - Add a missing NULL-pointer check.
Reviewed by:	cognet
Approved by:	kib (mentor, implicit)
MFC after:	3 days
2008-10-26 22:52:57 +00:00
Warner Losh
e704206e27 Kill vestiges of the special case code we once had in place for usb
memory allocation.  It was change to include the range in the normal
memory area, so these ifdef'd out special cases are no longer useful
to keep around.
2008-09-05 22:27:10 +00:00
Warner Losh
5d8e2080ac Add IRQ line for usb device. I'm not 100% sure this is the right
place to add this connection, since the interrupt is for a GPIO pin,
but since we have no alternative at the moment...

Submitted by:	Hans Petter Selasky
2008-08-19 22:15:14 +00:00
Olivier Houchard
e19357d3a5 On the AT91, we need to write on the EOI register after we handle an
interrupt. So, add a new function pointer, arm_post_filter, which defaults
to NULL, and which will be used as the post_filter arg for
intr_event_create(). Set it properly for the AT91, so that it boots again.

Reported by:	hps
2008-04-20 23:29:06 +00:00
Warner Losh
1981bc3b8a Actually program the interrupt controller for priorities. As we
support more AT91 platforms, we'll need to move this into some
platform init routine.
2007-12-19 17:34:17 +00:00
Kevin Lo
5497f4c53e Use M_NOWAIT instead of M_WAITOK to cause malloc() to return NULL
Reviewed by: imp
2007-12-17 05:08:54 +00:00
Paolo Pisati
856e1ae84c o substitute INTR_FAST with FILTER in a panic message.
o wrap a BUS_SETUP_INTR() line at 80.
2007-03-06 10:55:57 +00:00
Paolo Pisati
23b5f6dc07 Fix attach of at91_pio() after bus_setup_intr() modification.
Reported and tested by: Krassimir Slavchev
2007-02-25 14:34:59 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Warner Losh
111bcda150 MFp4: Tweak descriptions in preparation for porting to other members of
the AT91 arm9 family.
2006-11-20 06:27:15 +00:00
Sam Leffler
faad47108d change bus space unmap protoype
Reviewed by:	cognet, imp
MFC After:	1 month
2006-11-19 23:47:51 +00:00