46 Commits

Author SHA1 Message Date
ian
e58449eb7b MFC r262409, r262411, r262413, r262420, r262426, r262427, r262440, r262456,
r262482, r262483, r262531,

  Move the declaration for mpentry() into a header file instead of pasting
  it into a bunch of different .c files.

  If the L2 cache type is PIPT, pass a physical address for a flush.

  Actually set the proper bit to indicate TTB shared memory.

  Add a new cache maintenance function, idcache_inv_all, to the table, and
  implementations for each of the chips we support.

  Invalidate caches immediately upon entry to init_secondary().  Also set
  the Bufferable bit in the PDE entries of the secondary processor startup
  pagetables.

  Add the bits needed to run SMP on imx6.

  Invalidate the SCU cache tag ram on all 4 cores, not just 1-3.

  Minor tweaks to the imx GPT timer

  Vybrid enhancements...
  - 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
  - Add support for Quartz Module.
  - 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-05-16 00:14:50 +00:00
ian
56c3d6e841 MFC r261982, r261987, r262123, r262244, r262278, r262280, r262353, r262354,
r262355, r262419,

  Add Vybrid driver for Synchronous Audio Interface (SAI).

  Decrease SAI buffer size. Handle eDMA interrupt on running channel only.

  Give the physmem fdt helper routines static linkage since no global
  definition of them is provided anywhere.

  Add imx6 early printf support, wrapped in #if 0 because it's rarely needed.

  Add basic cpu frequency control and temperature monitoring to imx6_anatop.

  Add the FREEBSD_BOOT_LOADER option so that a loaded DTB passed in from
  ubldr will actually get used.

  Create a generic IMX6 kernel config, then fix it to have an ident line.

  Don't force imx6 bootverbose on anymore, it can be set from ubldr now.
2014-05-15 22:50:06 +00:00
ian
dbea31deb0 MFC r261938, r261939, r261940, r261944, r261945, r261946, r261947, r261956, r261957, r261983, r261094,
r261955, r261958,

  Add a driver to provide access to imx6 on-chip one-time-programmble data.

  Make it possible to access the ocotp registers before the ocotp device
  is attached, by establishing a temporary mapping of the registers when
  necessary.

  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.

  Convert the imx6 sdhci "R1B fix" from a busy-loop in the interrupt handler
  to a callout.

  Increase the wait time for acquiring the SD bus from 10 to 250ms.

  If no compatible cards were found after probing the SD bus, say so.

  Add timeout logic to sdhci, separate from the timeouts done by the hardware.

  After a timeout, reset the controller using SDHCI_RESET_CMD|SDHCI_RESET_DATA
  rather than SDHCI_RESET_ALL; the latter turns off clocks and power, removing
  any possibility of recovering from the error.

  Add a helper routine to depth-search the device tree for a node with a
  matching 'compatible' property.
2014-05-15 22:35:04 +00:00
ian
2adbcd85c2 MFC r261803, r261808, r261814, r261815, r261816, r261817, r261818, r261826,
r261848, r261855

  On armv6 and later, use the WriteNotRead bit of the fault status register
  to decide what protections are required by the faulting access.

  Use the right symbols for determining arm architecture.  Include the
  necessary header file which has the new FAULT_WNR symbol defined in it.

  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.

  Add function for configuring Vybrid PLL4 (Audio) clock frequency output.

  imx6 changes ...

  - Fix the definition of the SDHCI_STATE_DAT and SDHCI_STATE_CMD fields,
    and add SDHCI_RETUNE_REQUEST.  None of these are actually used in the
    code yet.

  - 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.

  - Add standard non-removable and cd-gpios properties to the usdhc
    devices.  That generates references to gpio devices, so uncomment them
    even though there isn't a gpio driver to do anything with them yet.

  - 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).

  - Enable both sdcard slots, but not the sdio-based wifi that we don't
    yet have a driver for.

  - Remove a couple obsolete function declarations.
2014-05-15 22:03:24 +00:00
ian
c287c5d530 MFC r261616, r261639
Remove FreeBSD 6 support from atmel usb controllers.

  Add Vybrid drivers for:
  - Enhanced Direct Memory Access Controller (eDMA)
  - Direct Memory Access Multiplexer (DMAMUX)
2014-05-15 18:38:19 +00:00
loos
aa8cf03563 MFC r259270
After r266105 ofw_iicbuc.c will be built by default for any kernel which
includes options 'iicbus' and 'fdt'.  Remove the (now) unnecessary entries.
2014-05-15 18:18:53 +00:00
ian
1e3130abad MFC r261423, r261424, r261516, r261513, r261562, r261563, r261564, r261565,
r261596, r261606

  Add the imx sdhci controller.

  Move Open Firmware device root on PowerPC, ARM, and MIPS systems to
  a sub-node of nexus (ofwbus) rather than direct attach under nexus. This
  fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier.
  SPARC is unchanged.

  Add the missing ')' at end of sentence.  Reword it to use a more common idiom.

  Pass the kernel physical address to initarm through the boot param struct.

  Make functions only used in vfp.c static, and remove vfp_enable.

  Fix __syscall on armeb EABI. As it returns a 64-bit value it needs to
  place 32-bit data in r1, not r0. 64-bit data is already packed correctly.

  Use abp_physaddr for the physical address over KERNPHYSADDR. This helps us
  remove the need to load the kernel at a fixed address.

  Remove references to PHYSADDR where it's used only in debugging output.

  Dynamically generate the page table. This will allow us to detect the
  physical address we are loaded at to change the mapping.
2014-05-15 17:30:16 +00:00
ian
36cb581eae MFC r261411, r261413, r261416:
Add support for Colibri VF50 Evaluation Board.

  Add driver for Display Control Unit (DCU4).

  Add prototype for tcon_bypass() used by dcu4.
  Add register definition.
2014-05-15 16:23:24 +00:00
ian
20a269e6c7 MFC r261410
Follow r261352 by updating all drivers which are children of simplebus
  to check the status property in their probe routines.
2014-05-15 16:11:06 +00:00
ian
69ca53fdd2 MFC r261406, r261409: enhance Vybrid support...
o Expand device tree information
  o Export iomuxc (pins) configuration to DTS
  o Allow devices to assign clocks in DTS
  o Split kernel configuration to chip common and board specific parts.
2014-05-15 15:43:33 +00:00
ian
25ba02d795 MFC r261252, r261279, r261304, r261305, r261322, r261336, r261337, r261338,
r261353

  Fix the name of the dts file for the HL201...

  When mapping an address, the bsh needs the same offset we do for other things.

  Add explicit depends on bus_if.h and device_if.h to avoid a
  chicken and egg problem in some compilation environments.

  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.

  Comment cleanups.  Move things around for diff reduction against FDT work.
2014-05-15 02:41:23 +00:00
ian
adcb9fbee8 MFC r259728, r260752
Add Freescale i.MX515 vt(9) driver.
2014-05-14 20:38:05 +00:00
ian
f6194d9105 MFC r256839, r256948, r256950, r257299, r257414, r258057, r259090
Add configuration for the Freescale i.MX53 Quick Start Board.

  Add the Raspberry Pi BSC (I2C compliant) controller driver.

  Add Radxa Rock board (by radxa.com) support.

  Digi-CCWMX53: enable ffec and uart, USB.

  Add support for Freescale Vybrid Family VF600

  Move and rename dwc otg driver to more generic one as it appears to work
  for rk3188 SoC based board too.
2014-05-14 20:11:20 +00:00
ian
057c745287 MFC r257738, r259202, r258410, r260288, r260292, r260294, r260320, r260323,
r260326, r260327, r260331, r260333, r260340, r260371, r260372, r260373,
    r260374, r260375

  Add common bus_space tag definition shared for most supported ARMv6/v7 SoCs.
  Correct license statements to reflect the fact that these files were all
  derived from sys/arm/mv/bus_space.c.

  In pmap_unmapdev(), remember the size, and use that as an argument to
  kva_free(), or we'd end up always passing it a size of 0

  In pmap_mapdev(), first check whether a static mapping exists,

  Convert TI static device mapping to use the new arm_devmap_add_entry(),

  Use the common armv6 fdt_bus_tag defintion for tegra instead of a local copy.

  Eliminate use of fdt_immr_addr(), it's not needed for tegra

  Convert lpc from using fdt_immr style to arm_devmap_add_entry() to make
  static device mappings.

  Retire machine/fdt.h as a header used by MI code, as its function is now
  obsolete. This involves the following pieces:
  - Remove it entirely on PowerPC, where it is not used by MD code either
  - Remove all references to machine/fdt.h in non-architecture-specific code
    (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
    non-arch-specific).
  - Fix code relying on header pollution from machine/fdt.h includes
  - Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
    requests to its parent (nexus). This allows x86 FDT devices to allocate
    both memory and IO requests and removes the last notionally MI use of
    fdtbus_bs_tag.
  - On those architectures that retain a machine/fdt.h, unused bits like
    FDT_MAP_IRQ and FDT_INTR_MAX have been removed.

  Add #include <machine/fdt.h> to a few files that used to get it via pollution

  Enable the mv cesa security/crypto device by providing the required property
  in the dts source, and adding the right devices to the kernel config.

  Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,
  related to setting up static device mappings.  Since it was only used by
  arm/mv/mv_pci.c, it's now just static functions within that file, plus
  one public function that gets called only from arm/mv/mv_machdep.c.

  Switch RPi to using arm_devmap_add_entry() to set up static device mapping.

  Allow 'no static device mappings' to potentially work.

  Don't try to find a static mapping before calling pmap_mapdev(), that logic
  is now part of pmap_mapdev() and doesn't need to be duplicated here.

 Switch a10 to using arm_devmap_add_entry() to set up static device mapping.
2014-05-14 19:18:58 +00:00
ian
14106897a1 MFC r257702, r257745, r257746, r257747, r257751, r257791, r257793,
r257794, r257795, r257992

  Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiring
  fdtbus in most cases.

  Make OF_nextprop() work correctly for FDT by using the libfdt
  fdt_next_property_offset() API.

  Do not panic if pmap_mincore() is called.

  An addendum: it is possible, though of questionable utility, for a node
  to have no properties at all.
  Add definition for the Atheros 8021 gigabit PHY.

  Consolidate Apple firmware hacks and improve them by switching on the
  presence of mac-io devices in the tree, which uniquely identifies Apple
  hardware.

  Allow OF_decode_addr() to also be able to map resources on big-endian
  devices.

  Make tsec work with the device tree present on the RB800.

  Be more flexible about which compatible strings to accept.  This brings up
  the PCI Express bus on the RB800 using the firmware device tree.

  Rename the "bare" platform "mpc85xx", which is what it actually is, and
  add actual platform probing based on PVR.
2014-05-14 01:53:20 +00:00
dim
d46bcdadc4 MFC r262393 (by ian):
Fix a typo _IMX51_TZICRREG_H_ -> _IMX51_TZICREG_H_ (extra R)
2014-03-20 23:48:18 +00:00
eadler
ec294fd7f5 MFC r258779,r258780,r258787,r258822:
Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

Similar to the (1 << 31) case it is not defined to do (2 << 30).

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.
2014-02-04 03:36:42 +00:00
ian
2c66a0246a MFC r257924:
Apparently with "const uint32_t foo = 0x60;" gcc doesn't consider 'foo'
  to be a constant integer suitable for use in a case label, so use #defines.
2013-12-14 00:23:43 +00:00
ian
f1d49f684d MFC r257669, r257672, r257673, r257676, r257678:
Call initarm_lastaddr() later in the init sequence, after establishing
  static device mappings, rather than as the first of the initializations
  that a platform can hook into.  This allows a platform to allocate KVA
  from the top of the address space downwards for things like static device
  mapping, and return the final "last usable address" result after that and
  other early init work is done.

  Because some platforms were doing work in initarm_lastaddr() that needs to
  be done early, add a new initarm_early_init() routine and move the early
  init code to that routine on those platforms.

  Make PTE_DEVICE a synonym for PTE_NOCACHE on armv4, to make it easier to
  share the same code on both architectures.

  Add new helper routines for arm static device mapping.  The new code
  allocates kva space from the top down for the device mappings and builds
  entries in an internal table which is automatically used later by
  arm_devmap_bootstrap().  The platform code just calls the new
  arm_devmap_add_entry() function as many times as it needs to (up to 32
  entries allowed; most platforms use 2 or 3 at most).

  Remove imx local devmap code and use the essentially identical common
  code that got moved from imx_machdep.c to arm/devmap.c.
2013-12-14 00:16:08 +00:00
ian
eae48ec05e MFC r257648, r257649, r257660:
Begin reducing code duplication in arm pmap.c and pmap-v6.c by factoring
  out common code related to mapping device memory into a new devmap.c file.

  Remove the growing duplication of code that used pmap_devmap_find_pa() and
  then did some math with the returned results to generate a virtual address,
  and likewise in reverse to get a physical address.  Now there are a pair
  of functions, arm_devmap_vtop() and arm_devmap_ptov(), to do that.  The
  bus_space_map() implementations are rewritten in terms of these.

  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-12-13 23:56:53 +00:00
ian
4c517a4890 MFC r257595: Comments and style(9) only, no functional changes. 2013-12-13 22:51:09 +00:00
ian
bf69534180 MFC r257561:
Bugfix:  the attach routine needs to use the same table of fdt compat
  strings that the probe routine used.
2013-12-13 22:50:12 +00:00
ian
a10cf699d1 MFC r257557: Add a missing register definition. 2013-12-13 22:49:18 +00:00
ian
ec4b958426 MFC r257483, r257486, r257489:
Add the Soc- / machine-dependent parts of imx6 support.
  Add dts source for imx6 SoCs and for Wandboard boards.
  Add kernel config for Wandboard.
2013-12-13 22:41:57 +00:00
ian
c48d670c8a MFC r257476, r257478:
Revamp the SoC identity numbering scheme to be more in line with the way
  Freescale numbers the chips in the ID registers.

  Add definitions for the register and data that describes the SoC type.
2013-12-13 22:30:21 +00:00
ian
3a53055ae2 MFC r257454: Add sdhci driver glue for imx family SoCs. 2013-12-13 22:28:19 +00:00
ian
3e4a60e997 MFC r257453: Add stubbed-out imx6 support for clocks and power management. 2013-12-13 22:27:26 +00:00
ian
bbdd01b151 MFC r257452: Add support for the USB PHY on imx6 SoCs. 2013-12-13 22:26:10 +00:00
ian
0c80ffaa7f MFC r257418:
Don't iterate through the bits of the pending interrupt register if the
  whole register is zero.  Most of the registers will be zero most of the time.
2013-12-13 22:22:54 +00:00
ian
806c36728f MFC r257413:
Reset the timer interrupt status register at the top rather than bottom of
  the interrupt handler.  If the event callback starts a new short timeout,
  the timer can fire before returning from the event callback, and clearing
  the interrupt status after that loses the interrupt and hangs until the
  counter wraps.  Fixing all of this removes the need for the do-nothing
  loop at the top of the handler which really just waited for the counter to
  roll over and reach the one-shot count again.

  Also add a missing return(0) in the periodic timer start case.
2013-12-13 22:21:49 +00:00
ian
26cb2d5903 MFC r257407:
Expand the list of compatible devices this driver works with.  Increase
  the target frequency from 1 to 10 MHz because these SoCs are plenty fast
  enough to benefit from the extra event timer resolution.
2013-12-13 22:21:04 +00:00
ian
378834fde5 MFC r257383, r257384:
Add some bare-bones support for enabling usb and usbphy clocks.

Add a "no-op" USB PHY driver for imx-family SoCs.
2013-12-13 22:12:37 +00:00
ian
c44e255e08 MFC r257199, r257200, r257217:
Remove all #include <machine/pmap.h> from arm code.  It's already
  included by vm/pmap.h, which is a prerequisite for arm/machine/pmap.h
  so there's no reason to ever include it directly.

  Remove #include <machine/frame.h> from all the arm code that doesn't
  really need it.  That would be almost everywhere it was included.  Add
  it in a couple files that really do need it and were previously getting
  it by accident via another header.

  Remove the last dregs of trapframe_t.  It turns out only arm was using
  this type, so remove it to make arm code more consistant with other
  platforms.
2013-12-13 20:43:11 +00:00
ian
c34a108500 MFC r257197:
Maximize available kva space by doing static device mapping from the top
  of the address space downwards, and then returning the lowest mapped
  device address from initarm_lastaddr().  Premap most of the device's
  on-chip peripherals.
2013-12-13 18:26:22 +00:00
ian
fb7e8e2d67 MFC r256806, r256919, r257167:
Add a driver for the Freescale Fast Ethernet Controller found on various
  Freescale SoCs including the i.MX series.  This also works for the newer
  SoCs with the ENET gigabit controller, but doesn't use any of the new
  hardware features other than enabling gigabit speed.

  Mask out non-address bits in the mac address register, for proper
  detection of an all-zeroes address.  Also remove a misplaced return.

  Switch to using ofw_bus_search_compatible() table-driven compat lookup.
  Add compat strings for Freescale Vybrid family SoCs.
2013-12-13 17:28:08 +00:00
ian
8f39a8efa7 MFC r256804:
Switch to using the standard uart console driver instead of the special
  driver for early boot debugging.
2013-12-13 17:10:23 +00:00
ian
4d06787a45 MFC r256774:
Clock divisors 0-3 correspond to dividing by 1-4, so add 1 before dividing.
2013-12-13 17:03:32 +00:00
rpaulo
16cb93231c Revert accidental commit. 2013-09-02 17:07:46 +00:00
rpaulo
d8615bd83a Initial support for the Digi ConnectCore(c) i.MX53 / Wi-i.MX53 boards.
There are many drivers missing, but we can reach single user mode now.

Hardware graciously donated by Douglas Beattie.
2013-09-01 20:15:35 +00:00
ian
ddc35de90b Rename imx_machdep.c to imx51_machdep.c, because it contains hardware
addresses which are specific to the imx51 chips.
2013-08-13 21:12:28 +00:00
ian
14fc3cda65 Add imx6 compatibility and make the driver work for any clock frequency.
There are still a couple references to imx51 ccm driver functions that will
need to be changed after an imx6 ccm driver is written.

Reviewed by:	ray
2013-08-13 13:14:13 +00:00
ian
22800b9326 Tweak the imx debug console code so that it works with multiple SoCs.
Instead of hard-coding the uart register addresses for the imx51, use
a variable that defaults to the imx51 address.  When debugging another
imx-family SoC, the variable can be set early in initarm() to provide
full console/printf support for debugging early boot.
2013-08-03 13:31:10 +00:00
ian
0b4cdd16b0 Rename the existing std.imx and imx.files to std.imx51 and files.imx51, to
pave the way for adding imx6 support.
2013-07-28 17:37:30 +00:00
ray
ed41ecad2b Update copyright date. 2013-05-08 09:42:50 +00:00
dim
6a5be05861 Fix undefined behaviour in several gpio_pin_setflags() routines (under
sys/arm and sys/mips), squelching the clang 3.3 warnings about this.

Noticed by:	tinderbox and many irate spectators
Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
PR:		kern/177759
MFC after:	3 days
2013-04-13 21:21:13 +00:00
ray
a88f1a3d13 Integrate Efika MX project back to home.
Sponsored by:	The FreeBSD Foundation
2013-03-20 15:39:27 +00:00