Commit graph

2418 commits

Author SHA1 Message Date
Ruslan Bukin 657fae63fc Add support for keyboard used in Samsung Chromebook (ARM machine)
Support covers device drivers for:
- Interrupt Combiner
- gpio/pad, External Interrupts Controller (pad)
- I2C Interface
- Chrome Embedded Controller
- Chrome Keyboard

Also:
- Use new gpio dev class in EHCI driver
- Expand device tree information
2014-03-30 15:22:36 +00:00
Ruslan Bukin a3fcf1f8d9 Add lowercase postfix, so SoC-common file will be ignored by tinderbox. 2014-03-30 14:57:00 +00:00
Ruslan Bukin 1a59c06c73 Directly call kmem_alloc_contig to allocate framebuffer memory
and pass VM_MEMATTR_UNCACHEABLE (no-cache, no-buffer).
This fixes screen refreshing problem when data is updated too slowly.

Discussed with:	ian
2014-03-30 14:42:53 +00:00
Ruslan Bukin 89eecf5b97 - Merge SoC-common parts
- Enable iicbus device
2014-03-30 14:25:14 +00:00
Andrew Turner d4f9011c2e VFP fixes/cleanups for ARM11:
* Save the required VFP registers on context switch. If the exception bit
   is set we need to save and restore the FPINST register, and if the fp2v
   bit is also set we need to save and restore FPINST2.
 * Move saving and restoring the floating point control registers to C.
 * Clear the fpexc exception and fp2v flags on a floating-point exception.
 * Signal a SIGFPE if the fpexc exception flag is set on an undefined
   instruction. This is how the ARM core signals to software there is a
   floating-point exception.
2014-03-29 14:35:36 +00:00
Andrew Turner 2819cfdf3f Initialise fpscr to a sane value when we create the pcb. This sets NaNs to
be the default NaN and for denormalised numbers to be flushed to zero.
2014-03-29 14:17:04 +00:00
Andrew Turner 4797432ff7 Add more flags for the fpexc register from the ARM1176JZF-S Manual 2014-03-29 10:11:19 +00:00
Ganbold Tsagaankhuu fe47fb7b1c Switch to my freebsd.org emal address in copyright.
Approved by:	stas (mentor)
2014-03-25 08:31:47 +00:00
Ganbold Tsagaankhuu 7717df1279 Add code for enabling second CPU core for A20 SoC.
Enable SMP on Cubieboard2.

Approved by:	stas (mentor)
2014-03-25 01:34:39 +00:00
Luiz Otavio O Souza 855feb6867 Adds the ADC driver for TI AM3xxx SoC family.
The ADC has a 12bit resolution and its raw output can be read via sysctl(8)
interface.

The driver allows the setup of ADC clock, samples average and open delay
(the number of clock cycles to wait before start the conversion).

The TSC_ADC module is set in the general purpose mode (no touchscreen
support).

Tested on Beaglebone-black.

Written based on AM335x TRM.

Reviewed by:	rpaulo
Approved by:	adrian (mentor)
Tested by:	me, Brian J. McGovern, Sulev-Madis Silber (ketas)
2014-03-24 20:06:27 +00:00
Andrew Turner c9ccb0bb6b Move an else case that was missed in r263676 2014-03-24 08:24:32 +00:00
Andrew Turner 24456bdb9c Reorder the pmap macros so "ARM_MMU_V6 + ARM_MMU_V7" is first. As they are
identical this allows us to build for both v6 and v7 together.
2014-03-23 21:08:18 +00:00
Andrew Turner 0f6e287159 Simplify how we build MACHINE_ARCH. There are 3 options that may be set
however only arm, armeb, armv6, and soon armv6hf will be used.
2014-03-22 15:59:18 +00:00
Bryan Drewery 44f1c91610 Rename global cnt to vm_cnt to avoid shadowing.
To reduce the diff struct pcu.cnt field was not renamed, so
PCPU_OP(cnt.field) is still used. pc_cnt and pcpu are also used in
kvm(3) and vmstat(8). The goal was to not affect externally used KPI.

Bump __FreeBSD_version_ in case some out-of-tree module/code relies on the
the global cnt variable.

Exp-run revealed no ports using it directly.

No objection from:	arch@
Sponsored by:	EMC / Isilon Storage Division
2014-03-22 10:26:09 +00:00
Ruslan Bukin 755ddc51e8 Rename mct and ehci drivers files to match common naming. 2014-03-20 17:53:56 +00:00
Ruslan Bukin 17aa09fc89 Remove printf's. 2014-03-20 17:33:01 +00:00
Ruslan Bukin 5637e3c775 Add support for Samsung Chromebook (ARM Cortex A15 machine). 2014-03-20 17:10:01 +00:00
Ruslan Bukin c93bcd0b2c Add driver for Display Controller. 2014-03-20 17:07:14 +00:00
Ruslan Bukin d74318a415 - Add display-related and clk devices to the tree
- Prevent resources intersection with EHCI driver
2014-03-20 17:03:44 +00:00
Ruslan Bukin d924f929b8 Disable debugging by default. 2014-03-20 17:01:21 +00:00
Warner Losh d4f95c889d In kernel config files, it is supposed to be 'options<space><tab>' not
'options<tab><tab>', per long standing (but recently not so strictly
enforced) convention.
2014-03-18 14:41:18 +00:00
Ian Lepore 0a3c453277 Use armv7 TLB flush code, not arm11, for cortex-a processors.
The armv7 architecture uses a unified TLB model for maintenence ops even
if separate instruction and data TLBs are implemented in hardware.  That
means that there's no distinction between the 'I' and 'D' flavors of flush,
they all use the same 'ID' implementation.  On the other hand, there is a
difference between SMP and UP on armv7, but not on arm11, so use the armv7
routines for cortex-a processors.
2014-03-16 20:39:39 +00:00
Ian Lepore 312c48ff18 Use the same terminology as the ARM docs in comments. No functional changes. 2014-03-16 20:34:45 +00:00
Warner Losh 2299abfac5 Make all the comments '# ' and align to same column. This fixes the
rampently incosnsitent usage which made cut and paste from one file
to another look ugly.
2014-03-16 15:22:46 +00:00
Robert Watson 4a14441044 Update kernel inclusions of capability.h to use capsicum.h instead; some
further refinement is required as some device drivers intended to be
portable over FreeBSD versions rely on __FreeBSD_version to decide whether
to include capability.h.

MFC after:	3 weeks
2014-03-16 10:55:57 +00:00
Warner Losh 2d84578fc4 Fix wandboard to include tmpfs, mbr and bsd labels.
PR: 187606
Submitted by: Takanori Sawada
2014-03-15 16:59:57 +00:00
Warner Losh 22b8ff24b5 Delete stray clause 3 (Advertising clause) and renumber while i'm
here.

Approved by: alc@
2014-03-11 23:41:35 +00:00
Ian Lepore 6d51b77398 Remove #include <machine/asmacros.h> from files that don't need it. 2014-03-11 22:47:04 +00:00
Ian Lepore 0da5fed4eb Remove the unreferenced DATA() macro. That leaves only GET_CURTHREAD_PTR()
which was added by cognet in 2012, so remove the no-longer-applicable
license stuff that referred to all the old contents, and put in a
standard 2-clause BSD license (to cover the 6 lines of useful code left
in here).
2014-03-11 22:41:34 +00:00
Warner Losh f04f687753 Remove clause 3 (advertising clause), per regent's letter. 2014-03-11 17:08:45 +00:00
Ian Lepore b77b13a20e Use panic rather than printf to "handle" an arm26 address exception
(should never happen on arm32).  Pass the right arguments to panic for
the reset exception (which also should never happen).
2014-03-11 16:53:03 +00:00
Ian Lepore afb4370aeb No functional changes. Rewrite comments, use tabs consistantly, reorder
some of the functions so that similar things are grouped together.
2014-03-11 16:48:46 +00:00
Ian Lepore bfd2258ed0 Remove some unnecessary indirection and jump right to the handler functions. 2014-03-11 15:46:03 +00:00
Ian Lepore b997b038a3 Revert r262994 for now, it fails to boot on armv5. 2014-03-11 04:25:12 +00:00
Ian Lepore 9b051e27e0 Now that the PUSHFRAME and PULLFRAME macros are used only in the swi
entry/exit code, they don't need to be macros.  Now they're just inline
code, and rewritten to use shorter instruction sequences.
2014-03-11 03:19:43 +00:00
Ian Lepore ad15dc0f1b Arrange for arm fork_trampoline() to return to userland via the standard
swi_exit code in exception.S instead of having its own inline expansion
of the DO_AST and PULLFRAME macros.  That means that now all references
to the PUSH/PULLFRAME and DO_AST macros are localized to exception.S,
so move the macros themselves into there and remove them from asmacros.h
2014-03-10 22:52:32 +00:00
Ian Lepore 3130601c78 Change the way the asm GET_CURTHREAD_PTR() macro is defined so that code
using it doesn't have to have an "AST_LOCALS" macro somewhere in the file.
2014-03-10 22:38:07 +00:00
Ian Lepore 0e255c3294 Move the exception vector table (so-called "page0" data) into exception.S
and eliminate vectors.S.  All low-level exception handling is now
consolidated into exception.S.

Along with moving the default FIQ handler, change it to disable FIQs
before returning.  An FIQ should never happen, but if it does, it's got
to be disabled as part of ignoring it.

In general, we have hand-wavy support for FIQs that probably hasn't been
used for 10 years and probably doesn't work (almost certainly doesn't
work for SMP because it only updates the vector on the current cpu).  This
change doesn't really make the overall situation any better or worse.
2014-03-10 19:36:26 +00:00
Ian Lepore 5e4e1d4995 Eliminate irq_dispatch.S. Move the data items it contained into arm/intr.c
and the functionality it provided into arm/exception.S.  Rename the main
irq handling routine from arm_handler_execute() to arm_irq_handler() to
make it more congruent with how other exception handlers are named, and
also update its signature to reflect what has long been reality: it is
passed just a trapframe pointer, no interrupt number argument.
2014-03-10 18:10:09 +00:00
Ian Lepore cd309dac82 Make the default exception handler vectors point to where I thought they
were already pointing: the default handlers (not a panic that says there
is no default handler).
2014-03-10 01:34:38 +00:00
Ian Lepore a297028904 Remove all traces of support for ARM chips prior to the arm9 series. We
never actually ran on these chips (other than using SA1 support in an
emulator to do the early porting to FreeBSD long long ago).  The clutter
and complexity of some of this code keeps getting in the way of other
maintenance, so it's time to go.
2014-03-09 21:12:31 +00:00
Ian Lepore 510ccb2fd4 The arm exception entry points currently vector through a function pointer
to the actual handler routine.  All the pointers are static-intialized to
the only handlers available, and yet various platform-specific inits still
set those pointers (to the values they're already initialized to).  Begin
to drain the swamp by removing all the redundant external declarations and
runtime setting of the pointers that's scattered around various places.
2014-03-09 18:08:27 +00:00
Ian Lepore 4ce4252794 Make undefined exception entry MPSAFE.
The old code used static storage to preserve a couple registers while
setting up the trapframe for the main handler.  Doing so was the last
leftover crumbs from the days when a low-level debugger was hooked into
the exception entry code.

Now the exception entry sequence is essentially the same as for the
other exceptions, which still involves needlessly indirecting through
a function pointer which points to the same code on every platform.
Removing that indirection will be handled as a separate cleanup.

This work is based on an analysis by Juergen Weiss.
2014-03-09 15:36:56 +00:00
Ian Lepore 9309212899 When a thread begins life it doesn't own the VFP hardware state on any cpu. 2014-03-09 14:54:05 +00:00
Ian Lepore 7a797a2408 Always call vfp_discard() on thread death, not just when the VFP is
enabled.  In vfp_discard(), if the state in the VFP hardware belongs to
the thread which is dying, NULL out pcpu fpcurthread to indicate the
state currently in the hardware belongs to nobody.

Submitted by:	Juergen Weiss
Pointy hat to:	me
2014-03-09 14:24:05 +00:00
Ian Lepore f00519b613 Remove all dregs of a per-thread undefined-exception-mode stack. This is
a leftover from the days when a low-level debugger had hooks in the
undefined exception vector and needed stack space to function.  These days
it effectively isn't used because we switch immediately to the svc32 mode
stack on exception entry.  For that, the single undef mode stack per core
that gets set up at init time works fine.

The stack wasn't necessary but it was harmful, because the space for it
was carved out of the normal per-thread svc32 stack, in effect cutting
that 8K stack in half.  If svc32 mode used more than 4k of stack space it
wandered down into the undef mode stack, and then an undef exception would
overwrite a couple words on the stack while switching to svc32 mode,
corrupting the scv32 stack.  Having another stack abut the bottom of the
svc32 stack also effectively mooted the guard page below the stack.

This work is based on analysis and patches submitted by Juergen Weiss.
2014-03-09 03:49:06 +00:00
Ian Lepore ba1c2daad4 Rework the VFP code that handles demand-based save and restore of state.
The old code was full of complexity that would only matter if the
kernel itself used the VFP hardware.  Now that's reduced to either killing
the userland process or panicking the kernel on an illegal VFP instruction.

This removes most of the complexity from the assembler code, reducing it
to just calling the save code if the outgoing thread used the VFP.

The routine that stores the VFP state now takes a flag that indicates
whether the hardware should be disabled after saving state.  Right now it
always is, but this makes the code ready to be used by get/set_mcontext()
(doing so will be addressed in a future commit).

Remove the arm-specific pc_vfpcthread from struct pcpu and use the MI
field pc_fpcurthread instead.

Reviewed by:	cognet
2014-03-09 03:00:03 +00:00
Warner Losh 9d6f987b13 Remove bogus define that causes compile errors. Most of the defines
for SAM9X are going away soonish anyway (once FDT works), but until
then...
2014-03-09 02:28:30 +00:00
Ian Lepore 8310d0d914 Follow r262916 with one more config file that references a renamed common.c 2014-03-09 01:52:21 +00:00
Warner Losh 49fa38e888 Move AIC related stuff to own file. 2014-03-08 06:06:50 +00:00