Commit Graph

99 Commits

Author SHA1 Message Date
Ian Lepore
8d99c2a062 Pending interrupt status is cleared by writing to the ISR, not the data reg.
MFC after:	1 week
2014-07-10 14:06:18 +00:00
Ian Lepore
1e3d53c687 Use named constant rather than '0' to access the reset controller register. 2014-07-08 14:35:09 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Ruslan Bukin
b9402e3d56 Add very basic driver for 12-bit Analog to Digital Converter (ADC). 2014-06-15 12:08:33 +00:00
Ruslan Bukin
2aaaabd4c1 Add a driver for Serial Peripheral Interface (SPI). 2014-06-11 10:03:06 +00:00
Kevin Lo
6ed1354934 Remove extra semicolons. 2014-06-06 16:37:42 +00:00
Andrew Turner
27521ff8e4 Add the start of the ARM platform code. This is based on the PowerPC
platform code, it is expected these will be merged in the future when the
ARM code is more complete.

Until more boards can be tested only use this with the Raspberry Pi and
rrename the functions on the other SoCs.

Reviewed by:	ian@
2014-05-17 11:27:36 +00:00
Ruslan Bukin
3d0bf6b1d0 Fix return value. Should be logic one or zero. 2014-05-15 10:06:59 +00:00
Ruslan Bukin
876ac29ddc Fix typo. 2014-05-14 14:19:57 +00:00
Ian Lepore
95da66135d Enable PL310 power-saving modes and tune the cache ram latencies for imx6. 2014-05-06 14:26:24 +00:00
Ian Lepore
88b3694bd9 Move duplicated code to print l2 cache config into the common code. 2014-04-27 23:47:38 +00:00
Ian Lepore
a7fa939bb3 Stop calling imx51_ccm_foo() clock functions from imx6 code. Instead
define a few imx_ccm_foo() functions that are implemented by the imx51 or
imx6 ccm code.  Of course, the imx6 ccm code is still more a wish than
reality, so for now its implementations just return hard-coded numbers.
2014-04-26 16:48:09 +00:00
Rui Paulo
9e63671c57 Updates to i.MX53:
* Define support for the SDHCI driver, although it doesn't work yet
* Fix the memory mappings for IPU [1]

Reviewed by:	ray [1]
2014-04-08 04:05:04 +00:00
Rui Paulo
87c6502bba Follow files.imx51 and add vt support. 2014-04-05 23:16:51 +00:00
Ian Lepore
453efe588d Flag several sysctl variables as tunables. 2014-04-04 15:31:57 +00:00
Ian Lepore
0140748043 Rework the cpu frequency management code for imx6.
This adds the concept of "operating points," combinations of frequency
and voltage at which the cpu is known to work correctly.  Some day these
should come from FDT data, but for now the table is hard-coded.

This also allows tuning the min and max operating frequencies.  The min
frequency is what the thermal management code will slow down to if the
core temperature gets too high.  The max frequency is what gets used if
the temperature is okay.

Normally the max cannot be set higher than the value burned into the
ocotp fuses as the chip's rated max, but there is now a new sysctl+tunable
cpu_overclock_enable; when set to non-zero it allows raising the frequency
above the ocotp value: USE WITH CARE!  (At least one of my imx6 boards
has a cpu whose ocotp values never got set correctly; they claim a max
of 792mhz, but the physical markings on the chip say it's good to 1ghz.)

Because all these values affect the entire SoC, there is a new sysctl
node, hw.imx6, where all these values live.  The values that are currently
under dev.imx6_anatop.0 should probably move to hw.imx6 too, because
"anatop" doesn't even mean anything to me, let alone to an end user.
2014-04-02 21:34:48 +00:00
Ian Lepore
a3ff7ef69c Switch imx6 to using the mpcore per-cpu event timers, but continue to use
the GPT timer, which is fixed-frequency, as a timecounter.
2014-04-02 21:06:43 +00:00
Ian Lepore
647c8464a6 Don't call sdhci_init_slot() until after handling the FDT properties
related to detecting card presence.  This actually makes no difference
now, but will when we get support for gpio-based card detection.
2014-04-02 19:06:53 +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
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
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
f5a477a34b Add a tunable to set the number of active cores, and enable SMP by default. 2014-03-02 19:46:03 +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
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
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
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
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
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
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
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
Ian Lepore
f688503cc4 Remove a couple obsolete function declarations. 2014-02-13 19:14:23 +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