Commit graph

2418 commits

Author SHA1 Message Date
Warner Losh ebb61891fb Properly round on unmapping. 2014-03-08 06:06:42 +00:00
Warner Losh 1dd7152066 Make at91_soc_id() public. 2014-03-08 05:03:56 +00:00
Warner Losh e6d5c85a54 Add commented out dts for sam9260ek as well as early printf support. 2014-03-08 03:22:25 +00:00
Warner Losh 59c993d121 Move all the files named foo/common.c to foo/foo_common.c, as
appropriate for each of the 'foo' in the tree. This will allow us to
compile them together (although symbol conflicts prevent us from doing
that today, this just fixes the file name collision).
2014-03-08 00:14:40 +00:00
Ian Lepore 6f5f9035f7 Strip arm/conf/DEFAULTS down to just items that are mandatory for running
the architecture.  Move the other contents into each of the individual
config files.

Requested by:	imp
2014-03-07 21:36:49 +00:00
Ian Lepore f995847ae7 Fix the arm sys_sigreturn(): its argument is a struct ucontext, not a
struct sigframe containing the struct ucontext.

The signal trampoline return code on the other hand DOES have just a
struct sigframe on the stack to work with, so have it get a pointer to
the ucontext out of there to pass along to sys_sigreturn.

In other words, make everything work right whether sys_sigreturn is
invoked from the trampoline or from userland code calling sigreturn(2).

Submitted by:	Takashi Komatsu <komatsu.taka@jp.panasonic.com>
Reviewed by:	cognet
2014-03-07 20:32:45 +00:00
Ruslan Bukin bcec4b54f3 - Export panel info to DTS
- Reset all the layers before setup first one
- Enable display
2014-03-07 16:14:51 +00:00
Ruslan Bukin 0c94becea6 Add driver for Port control and interrupts (PORT).
PORT is responsible for external interrupts management,
so move IRQ lines from GPIO driver.
2014-03-07 07:06:36 +00:00
Ian Lepore e8a3a237fc Add option TMPFS to arm/conf/DEFAULTS, remove it from the few configs
that have it individually.  Concensus on freebsd-arm@ is that it should
be included in all ARM kernels.
2014-03-07 00:25:23 +00:00
Olivier Houchard 5b4e50ae33 When calculating the MPU freq, make sure not to overflow by using a uint64_t.
PR:	arm/187223
Submitted by:	Svatopluk Kraus <onwahe@gmail.com>
2014-03-06 21:07:13 +00:00
Ian Lepore a51a3eecfa Use the standard __used macro instead of a bare __attribute__.
Submitted by:	bde
2014-03-03 14:37:18 +00:00
Ganbold Tsagaankhuu 4023a1ad5e Add EMAC and SRAM controller entries to FDT.
Add EMAC device to kernel config files and
enable EMAC, SRAM drivers for build.

Approved by:	stas (mentor)
2014-03-03 11:36:39 +00:00
Ganbold Tsagaankhuu 0baf1f6506 Add EMAC 10/100 Ethernet controller driver for A10/A20.
It is available mostly in A10 devices like Hackberry, Marsboard,
Mele A1000, A2000, A100 HTPC, cubieboard1 and A20 device
like cubieboard2.
TX performance can be improved using both channels 0 and 1.
RX performance is poor and needs improvement with the assistance of
external DMA controller in case there is bulk TCP receiver.

Reviewed by:	yongari@
Approved by:	stas (mentor)
2014-03-03 11:32:55 +00:00
Ganbold Tsagaankhuu 37c5dfcd0d Add Static Random Access Memory controller driver for A10/A20.
A10/A20's SRAM is used by devices, such as CPU, EMAC,
for extra fast memory or as cache.

Approved by:	stas (mentor)
2014-03-03 11:24:47 +00:00
Ganbold Tsagaankhuu 79690a92d0 Add gpio and clock bits for A10/A20's EMAC ethernet controller driver, such as:
- EMAC gpio configuration
- EMAC clock activation

Approved by:	stas (mentor)
2014-03-03 11:00:52 +00:00
Ian Lepore 45b1c8bbda Add __attribute__((used)) so that the delay implementation doesn't get
optimized away as unreferenced, causing linker errors when trying to
resolve the weak reference to the missing function.
2014-03-02 21:25:32 +00:00
Ian Lepore f5a477a34b Add a tunable to set the number of active cores, and enable SMP by default. 2014-03-02 19:46:03 +00:00
Warner Losh 4b3c970b83 tcb device for fdt 2014-02-28 03:00:28 +00:00
Warner Losh 1341ea85f2 shdwc device for fdt 2014-02-28 03:00:25 +00:00
Warner Losh 089fd56d90 Add device node for SDRAMC device. Currently just claims device's
resources.
2014-02-28 02:59:51 +00:00
Ian Lepore 6afdadfd93 Add an armv7 implementation of cpu_sleep(). The arm11/armv6 implementation
we've been using was actually just spinning due to ARM having redefined
the old 'wait for interrupt' operation via the system coprocessor as a nop
and replacing it with a WFI instruction.
2014-02-28 00:41:55 +00:00
Ian Lepore f85153fec4 Add some rudimentary voltage control to go with the rudimentary frequency
control.  If we have to scale back the frequency due to temperature, it
will help to lower the voltage as well.
2014-02-28 00:26:57 +00:00
Ian Lepore f7bcea1a3c Supply a DELAY() implementation via weak linkage, so that SoC-specific
code can supply a better implementation.  A SoC with variable CPU frequency
is likely to use a fixed-frequency timer for DELAY() (but still use the
mpcore private timers as eventtimers).

Also remove spaces from the eventtimer and timecounter names.
2014-02-28 00:23:04 +00:00
Ian Lepore e63cfcf56e All our current ARM multi-core systems have all cores in one package with
a shared L2 cache, reflect that in the common cpu_topo() routine.
2014-02-28 00:17:03 +00:00
Ian Lepore a78ec80526 Initialize the Low Power Mode bits to keep the ARM cores running during WFI. 2014-02-27 22:55:33 +00:00
Ruslan Bukin 9e04ee7729 Do not setup interrupt handler (polling is used). 2014-02-27 18:13:07 +00:00
Ruslan Bukin 6c68693129 Add driver for Inter-Integrated Circuit (I2C). 2014-02-27 09:59:15 +00:00
Warner Losh b331ba445e Style(9) nit: Use tab here. 2014-02-27 08:19:19 +00:00
Ian Lepore f0455d6562 Replace many pasted identical definitions of cpu_initclocks() with a common
implementation in arm/machdep.c.  Most arm platforms either don't need to
do anything, or just need to call the standard eventtimer init routines.
A generic implementation that does that is now provided via weak linkage.
Any platform that needs to do something different can provide a its own
implementation to override the generic one.
2014-02-26 22:06:10 +00:00
Ian Lepore f3549ad525 Minor tweaks to the imx GPT timer...
- Don't use spaces or dots in the eventtimer or timecounter names.
   They turn into sysctl node names, and it's just confusing.
 - Use comparator #3 instead of #1 for one-shot events.  There's an
   extra 1-cycle penalty in the hardware for accessing the registers
   for comparator 1, no point in paying that penalty.
 - Lower the quality of the eventtimer from 1000 to 800, because the
   device can't support PERCPU timers and some other device in the system
   may be able to provide that.
2014-02-26 18:29:14 +00:00
Ruslan Bukin ee270bbca3 - Pin configuration is a complete iomux register now and includes
drive strength, pull mode, mux mode, speed, etc.
- Add i2c devices to the tree
- Add IPG clock
2014-02-25 17:02:11 +00:00
Ian Lepore f32801f42b Invalidate the SCU cache tag ram on all 4 cores, not just 1-3. I misread
Juergen's original code, it was doing all 4 cores.  Also remove the L2
cache invalidate operation, this code runs before L2 is activated.
2014-02-25 15:22:40 +00:00
Ruslan Bukin 9516467e96 Add support for Quartz Module.
Quartz is a tiny module utilized Freescale VF6xx
system-on-chip and development kit produced by
Device Solutions.

Quartz is available in a form of LGA (38x38x2mm)
or as a module with high-density connectors.

Sponsored by:	Device Solutions
2014-02-24 19:32:15 +00:00
Ian Lepore 1f22526981 Add the bits needed to run SMP on imx6.
The 'option SMP' isn't added to the kernel config yet; people wanting to
test this have to opt-in for now.
2014-02-24 03:51:31 +00:00
Ian Lepore 1cf228d34b Invalidate caches immediately upon entry to init_secondary(). Also set
the Bufferable bit in the PDE entries of the secondary processor startup
pagetables.

The caches really need to be invalidated even earlier than this, but this
is a big step in the right direction.  The invalidate needs to happen
before the MMU is enabled, which means it has to be called from asm code
that's running with physical addressing.  Fixing that will be handled in
a future change.
2014-02-24 03:47:39 +00:00
Ian Lepore 4b7fcd31e1 Add a new cache maintenance function, idcache_inv_all, to the table, and
implementations for each of the chips we support.  Most chips up through
armv6 can use the armv4 implementation which has a single coprocessor
opcode for this operation.  The rather more complex armv7 implementation
comes from netbsd.
2014-02-24 01:41:58 +00:00
Ian Lepore 02ba95fe77 Add an ident line. 2014-02-24 01:17:23 +00:00
Ian Lepore 08616fa793 Actually set the proper bit to indicate TTB shared memory.
Submitted by:	Juergan Weiss
2014-02-23 23:06:50 +00:00
Ian Lepore b7c1fc50a4 If the L2 cache type is PIPT, pass a physical address for a flush.
While this is technically more correct, I don't think it much matters,
because the only thing in the tree that calls cpu_flush_dcache() is md(4)
and I'm > 99% sure it's bogus that it does so; md has no ability to do
anything that can perturb data cache coherency.
2014-02-23 22:52:48 +00:00
Ian Lepore aab6f7ed9a Move the declaration for mpentry() into a header file instead of pasting
it into a bunch of different .c files.  Remove declarations for the unused
mptramp() function from everywhere except AramadaXP (and I think it's
really not used there either, because the code that references it appears
to be insanely does-nothing in nature).
2014-02-23 22:35:18 +00:00
Ian Lepore a75a785aef Eliminate an unused-var warning by wrapping #if 0 around some tables of
values that were probably entered "for completeness" from a datasheet, and
for all I know may be useful/necessary some day.
2014-02-23 22:29:59 +00:00
Ian Lepore d39e0a0f50 Fix a typo _IMX51_TZICRREG_H_ -> _IMX51_TZICREG_H_ (extra R) 2014-02-23 21:13:04 +00:00
Ian Lepore b6028530bd Don't force bootverbose on anymore, it can be set from ubldr now. 2014-02-23 01:49:01 +00:00
Ian Lepore bcab32ab01 Create a generic IMX6 kernel config. This is based on the existing
WANDBOARD.common config, but with the freescale-specific optons and devices
all together at the bottom now.  In addition to reformatting and shuffling
lines around, two new options are added because they're now known to work,
VFP and FREEBSD_BOOT_LOADER.

This config does not include any static DTB, it requires that u-boot
provide a DTB (or a custom kernel config can compile one in).

This will supercede all the existing WANDBOARD* configs, but those will
be left around for a while to help people transition their customized
configs to include this new one instead.
2014-02-23 01:48:07 +00:00
Ian Lepore 9780433dcd Add the FREEBSD_BOOT_LOADER option so that a loaded DTB passed in from
ubldr will actually get used.
2014-02-23 01:37:29 +00:00
Ian Lepore 86a5575402 Add basic cpu frequency control and temperature monitoring to imx6_anatop.
The temperature monitor device is enabled to sample the die temperature at
16hz.  The temperature is published via sysctl.  A callout routine at 10hz
monitors the temperature and throttles back the cpu if the temperature
goes over a user-settable throttle point (by default 10C less than the
critical high-point temperature for the chip).  The hardware is supposed
to be able to deliver an interrupt when the temperature exceeds a settable
limit, but the interrupt never arrives so for now a callout does the job.

At attach time we read the maximum cpu frequency the chip is allowed to run
at and the cpu is set to run at that speed.  It's reported at attach time.
A sysctl variable reports the current speed when queried.

New sysctl values:

  dev.imx6_anatop.0.cpu_mhz: 984
  dev.imx6_anatop.0.temperature: 37.9C
  dev.imx6_anatop.0.throttle_temperature: 95.0C

Steven Lawrance did the initial heavy lifting on this, but I changed
enough stuff that I'm the one to blame if anything breaks.

Submitted by:	Steven Lawrance <stl@koffein.net>
2014-02-21 06:00:06 +00:00
Warner Losh 40a4c9d72e Remove bogus blank line. 2014-02-21 05:17:30 +00:00
Ian Lepore 8df34dd25b Add early printf support, wrapped in #if 0 because it's only rarely needed. 2014-02-20 14:29:59 +00:00
Ian Lepore 4af6e44409 Give the fdt helper routines static linkage since no global definition
of them is provided anywhere.  (gcc was nice enough to warn about this,
clang didn't for some reason.)
2014-02-17 20:04:57 +00:00
John Hay f37fafddd6 Make it possible to use the env kernel config file option for AVILA
and CAMBRIA boards that does not use loader to load the kernel. This
is basically how it was done for i386. This way tunables can also be
set. For example in config file:

env "/conf/AVILA.env"

And in AVILA.env:

vfs.unmapped_buf_allowed=0

MFC after:	2 weeks
2014-02-17 11:05:57 +00:00
Ruslan Bukin 0beadc3c1c - Decrease buffer size.
- Handle eDMA interrupt on running channel only.
2014-02-16 19:21:44 +00:00
Ruslan Bukin 586a16c431 Add driver for Synchronous Audio Interface (SAI).
SAI supports full-duplex serial interfaces with frame
synchronization such as I2S, AC97, TDM, and codec/DSP
interfaces.
2014-02-16 16:49:54 +00:00
Ian Lepore 49624653d5 Oops, remove some dregs of debugging. 2014-02-16 03:30:22 +00:00
Ian Lepore f3639674b5 Make it possible to access the ocotp registers before the ocotp device
is attached, by establishing a temporary mapping of the registers when
necessary.  This is a temporary measure to keep progress moving; in the
long run we need better control over the order in which devices attach
(better than "the order they appear in the fdt dts source").
2014-02-16 03:09:39 +00:00
Ian Lepore b6e466340b Sweep up a couple crumbs left over from the imx6->fsl renaming. 2014-02-15 21:59:00 +00:00
Ian Lepore 350badf9db It turns out Freescale cleverly made the ocotp device compatible across
several different families of SoCs, so move it to the freescale directory
and prefix everything with fsl rather than imx6.
2014-02-15 21:21:57 +00:00
Ian Lepore f1887a86aa Convert the "R1B fix" from a busy-loop in the interrupt handler to a callout. 2014-02-15 17:55:35 +00:00
Ian Lepore 844a97cdc2 Add a driver to provide access to imx6 on-chip one-time-programmble data.
Submitted by:	Steven Lawrance <stl@koffein.net>
2014-02-15 17:19:55 +00:00
Zbigniew Bodek bccb7a02b5 Handle pmap_enter() on already promoted mappings for ARMv6/v7
Attempt to demote the superpage if trying to pmap_enter() on
one. Panic only when the particular superpage should
no longer exist for that pmap and address.
2014-02-15 13:27:45 +00:00
Zbigniew Bodek 6720dd234f Remove spurious assertion from pmap_extract_locked() on ARM
The condition under assertion is no longer valid since
superpages support is operating on section mappings.
2014-02-15 13:24:58 +00:00
Zbigniew Bodek 6be8284c66 Avoid redundant superpage promotion attempts on ARM
Because pmap_enter_locked() is called from few different functions
some redundancy in superpage promotion attempts can be observed.
Hence, avoid promotion in pmap_enter_object() (if the object can
be mapped by superpage it will be handled by pmap_enter_object()
itself) and also do not waste time in pmap_enter_quick().
From now on the promotion will be performed only in pmap_enter().
2014-02-15 13:22:37 +00:00
Zbigniew Bodek bdd635e646 Fix superpage promotion on ARM with respect to RO/RW and wired attributes
It was possible to create RW superpage mapping even if
the base pages were RO due to wrong setting of the prot
flag passed to pmap_map_section().
Promotion attempt should be canceled in case of attributes
mismatch between any two base pages. Since we still use
pv_flags to maintain permission to write (PVF_WRITE) and
wired status (PVF_WIRED) for a page, it is also necessary
to take those variables into account.
2014-02-15 13:20:17 +00:00
Zbigniew Bodek a7bd28f2cb Ensure proper TLB invalidation on superpage promotion and demotion on ARM
Base pages within newly created superpage need to be invalidated so that
new mapping is "visible" immediately after creation.
2014-02-15 13:17:51 +00:00
Zbigniew Bodek 807c947a43 Always clear L1 PTE descriptor when removing superpage on ARM
Invalidate L1 PTE regardles of existance of the corresponding
l2_bucket. This is relevant when superpage is entered via
pmap_enter_object() and will fix crash on entering page
in place of not properly removed superpage.
2014-02-15 13:13:00 +00:00
Christian Brueffer d01195e3a9 Correct the order of arguments to mtx_init().
PR:		186701
Submitted by:	Takanori Sawada <tak.swd at gmail.com>
MFC after:	2 weeks
2014-02-14 11:18:15 +00:00
Andrew Turner 7cbd3dd68b Allow the kernel to be loaded at any 1MiB address. This requirement is
because we use the 1MiB section maps as they only need a single pagetable.

To allow this we only use pc relative loads to ensure we only load from
physical addresses until we are running from a known virtual address.

As a side effect any data from before or 64MiB after the kernel needs to
be mapped in to be used. This should not be an issue for kernels loaded
with ubldr as it places this data just after the kernel. It will be a
problem when loading directly from anything using the Linux ABI that
places the ATAG data outside this range, for example U-Boot.
2014-02-13 21:30:54 +00:00
Ian Lepore f688503cc4 Remove a couple obsolete function declarations. 2014-02-13 19:14:23 +00:00
Luiz Otavio O Souza 62564a0858 Make the gpioled(4) work out of the box on BBB.
Add gpioled(4) to BEAGLEBONE kernel and add the description of the four
on-board leds of beaglebone-black to its DTS file.

Approved by:	adrian (mentor, implicit)
2014-02-13 18:51:37 +00:00
Luiz Otavio O Souza 8c705c2c30 Allow the use of the OFW GPIO bus for ti_gpio and bcm2835_gpio. With this
change the gpio children can be described as directly connected to the GPIO
controller without the need of describing the OFW GPIO bus itself on the
DTS file.

With this commit the OFW GPIO bus is fully functional on BBB and RPi.

GPIO controllers which want to use the OFW GPIO bus will need similar
changes.

Approved by:	adrian (mentor, implicit)
2014-02-13 18:42:23 +00:00
Warner Losh fd420f84dd Honor the disabled status by only grabbing resources and returning
when running under FDT.
2014-02-13 16:50:08 +00:00
Warner Losh 88bc24ff35 Fix board ID too... 2014-02-13 15:47:41 +00:00
Warner Losh 2956b2b069 Fix board name. 2014-02-13 15:46:08 +00:00
Ruslan Bukin 896fc918b1 Add function for configuring PLL4 (Audio) clock frequency output. 2014-02-13 06:38:01 +00:00
Ian Lepore 1d650ff3a8 Add handling of standard "non-removable" property, and also some workaround
code so that if card detect is wired to a gpio pin, for now we just treat
it the same as non-removable (because there isn't a gpio driver yet).
2014-02-13 03:45:33 +00:00
Ian Lepore 1744bacc7b Write translation code for the SDHCI_PRESENT_STATE register. Freescale
moved some bits around in their version of the register, adjust things
so that the sdhci code sees the standard layout.
2014-02-13 02:38:16 +00:00
Ian Lepore 28ea625437 Use the same logic as the x86 platforms to avoid trying perform fault fixup
while in a critical section or while holding a non-sleepable lock.

Reviewed by:	cognet
2014-02-12 20:09:27 +00:00
Ian Lepore 255a0cc653 Use the right symbols for determining arm architecture. Include the
necessary header file which has the new FAULT_WNR symbol defined in it.
2014-02-12 19:59:30 +00:00
Ian Lepore bcaa399985 On armv6 and later, use the WriteNotRead bit of the fault status register
to decide what protections are required by the faulting access.  The old
code disassembled the faulting instruction, and there are a lot of new
instructions that aren't handled.  The old code is still used for armv4/5
which doesn't have the WNR bit)
2014-02-12 18:55:26 +00:00
Warner Losh ff9a07fa97 Convert two while(1); statements into proper panics. Soon, kernels
with early printf support will print this info... For kernels without,
the observed behavior will be the same as it is now...
2014-02-12 03:19:35 +00:00
Ian Lepore 42c8459bed Rework the EARLY_PRINTF mechanism. Instead of defining a special eprintf()
routine, now a platform can provide a pointer to an early_putc() routine
which is used instead of cn_putc().  Control can be handed off from early
printf support to standard console support by NULLing out the pointer
during standard console init.

This leverages all the existing error reporting that uses printf calls,
such as panic() which can now be usefully employed even in early
platform init code (useful at least to those who maintain that code and
build kernels with EARLY_PRINTF defined).

Reviewed by:	imp, eadler
2014-02-12 00:53:38 +00:00
Warner Losh 360bd8ad2b Swap PA and VA so they are in the right registers... 2014-02-11 22:09:03 +00:00
Ian Lepore 7233ddb0cb Check in the "real" board_tsc4370 file in place of the stubbed out one.
Real means the one TSC / Symmetricom / Microsemi actually uses on their 4370
and other rm9200 boards.  This code demonstrates a variety of useful things
board init code can do, including adjusting the master clock frequency.
2014-02-11 21:13:37 +00:00
Ruslan Bukin ebc7703641 Disable debugging by default. 2014-02-11 20:14:54 +00:00
Ian Lepore 65f04a3da5 Update legacy platforms to use new arm_physmem helper routines. 2014-02-09 22:10:14 +00:00
Ian Lepore 46aa33b2ac If someone tries to boot a generic ATMEL kernel that has no board_init()
routine compiled in, print a friendly error message about it rather than
mysteriously hanging while trying to init 4GB of nonexistant ram.
2014-02-09 21:21:10 +00:00
Warner Losh 1ef5f6a006 Add FDT attachment. 2014-02-09 21:02:46 +00:00
Warner Losh c6053263cc FDT attachment... 2014-02-09 21:01:53 +00:00
Warner Losh 3526a97bba Add TWI attachment for FDT. We're only matching the SAMG20 device for
now, others to follow.
2014-02-09 21:01:10 +00:00
Warner Losh bf5c70c929 Add FDT attachment. 2014-02-09 21:00:22 +00:00
Warner Losh 22a484c9d5 Add FDT attachment. Flag lost functionality with FDT_HACKS so we can
find it later.
2014-02-09 20:59:46 +00:00
Warner Losh bc259c9157 Add FDT attachment. 2014-02-09 20:58:03 +00:00
Warner Losh 4da9131d2a Add FDT attachment, plus minor code shuffle. 2014-02-09 20:57:26 +00:00
Warner Losh 210c0e4c87 Add FDT attachment. 2014-02-09 20:56:39 +00:00
Warner Losh bad391b21c Add FDT matching code. 2014-02-09 20:55:49 +00:00
Ian Lepore 342322bb36 Add some extra debugging output when DEBUG is defined. 2014-02-09 20:20:49 +00:00
Ian Lepore c884902d1f Fix the exclude-region clipping logic for the edge-trim case. 2014-02-09 20:19:41 +00:00
Andrew Turner b2478843a9 Pass the pagetable used from locore.S to initarm to allow it to map data
in as required.
2014-02-09 15:54:31 +00:00
Ian Lepore 73ab448c43 No need to set physmem in each initarm() instance anymore, it's handled
in common code now.
2014-02-09 14:46:50 +00:00
Ian Lepore d215d5c662 Use vm_paddr_t, not vm_offset_t, when dealing with physical addresses.
Pointed out by:	alc
2014-02-09 14:35:44 +00:00
Andrew Turner 321d79fdca Remove the now unused MMU_INIT macro. 2014-02-09 12:52:39 +00:00