Commit Graph

40 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
c9fabc7afc Use OF_prop_free instead of direct call to free(9)
Reviewed by:	ganbold
2016-05-18 23:41:58 +00:00
Pedro F. Giffuni
255eff3b0d sys/arm: Minor spelling fixes.
Only affects comments: no functional change.
2016-05-04 15:48:59 +00:00
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
Pedro F. Giffuni
33495e5daf Use our nitems() macro when param.h is available.
Replacements specific to arm, mips, pc98, powerpc and sparc64.

Discussed in:	freebsd-current
2016-04-20 15:45:55 +00:00
Andrew Turner
59c3cb81c1 Rename ARM_INTRNG and MIPS_INTRNG to INTRNG. This will help with machine
independent code that needs to know about INTRNG such as PCI drivers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-04-15 16:05:41 +00:00
Pedro F. Giffuni
74b8d63dcc Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
2016-04-10 23:07:00 +00:00
Ian Lepore
dec4873723 Fix fallout from r292180 (Dec 2015)... ensure that every driver which has
a DRIVER_MODULE() referencing mmc_driver has a MODULE_DEPEND() on mmc.  This
is because the kernel linker only searches for symbols in dependent modules,
so loading sdhci_pci (and other bus-flavors of sdhci) would fail when mmc
was not compiled into the kernel (even if you hand-loaded mmc first).

(Thanks to jilles@ for providing the vital clue about the kernel linker.)
2016-03-21 00:52:24 +00:00
Andrew Turner
7133fe0f33 Almost all copies of platform_mp_init_secondary just called
intr_pic_init_secondary. Replace them with a direct call. On BCM2836
and ARMADA XP we need to add this function, but it can be empty.

Reviewed by:	ian, imp
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5460
2016-02-26 16:04:47 +00:00
Andrew Turner
3210b87554 Remove platform_mp_probe as it's almost identical on most ARM SoCs, and
slightly wrong on the others. We should just check if mp_ncpus is set to
more than one CPU as we may wish to run on a single core even when SMP is
available.

Reviewed by:	ian
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5458
2016-02-26 15:54:34 +00:00
Andrew Turner
243b36c321 Remove platform_ipi_send, it's an unneeded as all implementations are
identical.

Sponsored by:	 ABT Systems Ltd
2016-02-25 20:48:23 +00:00
Svatopluk Kraus
7758916f44 Move ARM_L2_PIPT option to std.armv6 for all armv6 platforms.
Only L2 PIPT cache is supported for __ARM_ARCH >= 6.

In fact, this is just a pure proclamation as this option is used
only in armv4 specific files now.
2016-02-22 11:47:28 +00:00
Andrew Turner
647a3bac7e Stop defining fdt_pic_table when building for ARM_INTRNG. 2016-02-11 11:49:27 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Adrian Chadd
2b3ad18853 [intrng] Migrate the intrng code from sys/arm/arm to sys/kern/subr_intr.c.
The ci20 port (by kan@) is going to reuse almost all of the intrng code
since the SoC in question looks suspiciously like someone took an ARM
SoC design and replaced the ARM core with a MIPS core.

* migrate out the code;
* rename ARM_ -> INTR_;
* rename arm_ -> intr_;
* move the interrupt flush routine from intr.c / intrng.c into
  arm/machdep_intr.c - removing the code duplication and removing
  the ARM specific bits from here.

Thanks to the Star Wars: The Force Awakens premiere line for allowing
me a couple hours of quiet time to finish the universe builds.

Tested:

* make universe

TODO:

* The structure definitions in subr_intr.c still includes machine/intr.h
  which requires one duplicates all of the intrng definitions in
  the platform code (which kan has done, and I think we don't have to.)

  Instead I should break out the generic things (function declarations,
  common intr structures, etc) into a separate header.

* Kan has requested I make the PIC based IPI stuff optional.
2015-12-18 05:43:59 +00:00
Ian Lepore
3f62727443 Move the DRIVER_MODULE() statements that declare mmc(4) to be a child of
the various bridge drivers out of dev/mmc.c and into the bridge drivers.

Requested by:	   jhb (almost two years ago; better late than never)
2015-12-14 01:09:25 +00:00
Ganbold Tsagaankhuu
f4459b9645 Add glue driver for Amlogic Meson Gigabit Ethernet Controller
and enable it for Odroid C1 board.
Together with r291676 change, dwc(4) can receive packets now.
2015-12-03 09:37:20 +00:00
Andrew Turner
210d6af74d Move more bus_space_* files to be built by files.arm. This leaves the
definition in a file.* file under sys/arm/arm in the few cases we need it
for non-fdt platforms.

Sponsored by:	ABT Systems Ltd
2015-11-21 15:30:08 +00:00
Andrew Turner
09f449399b Remove pl310.c from the SoC std.* files, it's in files.arm
Sponsored by:	ABT Systems Ltd
2015-11-20 16:43:21 +00:00
Ganbold Tsagaankhuu
ba27fc087c Include "opt_platform.h" to fix kernel build for amlogic devices. 2015-10-20 13:47:36 +00:00
Ian Lepore
7ce00ee7b4 Rename arm_init_secondary_ic() -> arm_pic_init_secondary(). The latter is
the name the function will have when the new ARM_INTRNG code is integrated,
and doing this rename first will make it easier to toggle the new interrupt
handling code on/off with a config option for debugging.
2015-10-18 16:54:34 +00:00
Luiz Otavio O Souza
5df539274f Add alternate descriptors support for if_dwc.
This also adds a newbus interface that allows a SoC to override the
following settings:

 - if_dwc specific SoC initialization;
 - if_dwc descriptor type;
 - if_dwc MII clock.

This seems to be an old version of the hardware descriptors but it is
still in use in a few SoCs (namely Allwinner A20 and Amlogic at least).

Tested on Cubieboard2 and Banana pi.

Tested for regressions on Altera Cyclone by br@ (old version).

Obtained from:	NetBSD
2015-09-20 14:13:29 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Ganbold Tsagaankhuu
c9254c8540 Add missing break statement.
Submitted by:	  John Wehle
2015-05-21 07:35:20 +00:00
Ganbold Tsagaankhuu
3c17c95097 Add driver for usbclock generator for earlier amlogic chip.
Differential Revision:	https://reviews.freebsd.org/D2590
Submitted by:		John Wehle
2015-05-21 07:23:50 +00:00
Ganbold Tsagaankhuu
e39d48908b Remove unnecessary break statements.
Submitted by:	   John Wehle
2015-05-21 07:09:01 +00:00
Ganbold Tsagaankhuu
37da2ff61a The RTC initialization values are based on the SoC which can be
determined at runtime so there's no need to set the values in
each DTS.
Tested on YYHD18 (aml8726-m3), VSATV102 (aml8726-m6), and
ODROIDC1 (aml8726-m8b).

Differential Revision:	https://reviews.freebsd.org/D2588
Submitted by:		John Wehle
2015-05-21 07:01:08 +00:00
Andrew Turner
a6ffc42f7a Clean up the Amlogic interrupt controller driver to handle the case where
we have both the Amlogic pic and a GIC. This may be the case in some
configurations.

Differential Revision:	https://reviews.freebsd.org/D2432
Submitted by:	John Wehle <john@feith.com>
2015-05-18 11:04:07 +00:00
Ganbold Tsagaankhuu
e4bc6b4c01 Disable WPI in case of aml8726-m3.
The aml8726-m3 SoC is identified as a Cortex A9-r2 rev 4 CPU and
it hangs sometimes during the boot when WFI is used by the kernel.

Differential Revision:	  https://reviews.freebsd.org/D2473
Submitted by:		  John Wehle
Suggested by:		  ian@
2015-05-12 08:53:54 +00:00
Andrew Turner
ace157c3a9 Use the new gic option on all configs that need it. 2015-05-10 12:13:27 +00:00
Ganbold Tsagaankhuu
bd14d14fcd This follows the gic and ti/aintc code by adding additional barriers to the
Amlogic pic driver.

Differential Revision:	https://reviews.freebsd.org/D2472
Submitted by:		John Wehle
2015-05-08 04:38:01 +00:00
Ganbold Tsagaankhuu
c1e22c8ece This patch adds support for the extended baud rate register
available on the aml8726-m6 (and later) SoC which allows for
lower speeds.

Differential Revision:	https://reviews.freebsd.org/D2433
Submitted by:	John Wehle
2015-05-06 01:07:59 +00:00
Ganbold Tsagaankhuu
033d737ab5 Update Amlogic MMC driver:
1) Advertise the actual min / max speeds the hardware is capable
       of supporting given the reference clock used by the board.

  2) Rather than attempting to extend the hardware's timeout register
       in software (the hardware doesn't have sufficient bits to directly
            support long timeouts), simply implement the same timeout approach
	         used in the SDXC driver.

  3) Set the timeout for a linked command (e.g. STOP TRANSMISSION) based
       on the previous multiblock read / write.

The changes have been smoke tested on both the ODROID-C1 and the VSATV102-M6
using the following cards:

* PQI 2GB microSD
* SanDisk 2GB microSD
* PQI 8GB SDHC (not a microSD so only tested on the ATV-102)
* PNY 8GB microSDHC
* SanDisk Ultra 32GB microSDHC

Submitted by:  John Wehle
2015-04-28 08:27:44 +00:00
Andrew Turner
442938a94f Remove the need for board specific std files on aml8726 by moving the
options they set to the main kernel config.
2015-04-23 20:53:29 +00:00
Andrew Turner
4ca6cef0b5 Move KERNVIRTADDR to the common std.aml8726. 2015-04-23 20:43:24 +00:00
Andrew Turner
7a26ccdd87 - Move files selected in files.smp to files.aml8726 and remove it.
- Remove a redundant file from files.aml8726
2015-04-23 20:39:40 +00:00
Andrew Turner
405ada37fb Add support for the uart classes to set their default register shift value.
This is needed with the pl011 driver. Before this change it would default
to a shift of 0, however the hardware places the registers at 4-byte
addresses meaning the value should be 2.

This patch fixes this for the pl011 when configured using the fdt. The
other drivers have a default value of 0 to keep this a no-op.

MFC after:	1 week
2015-04-11 17:16:23 +00:00
Ganbold Tsagaankhuu
c119629dd0 This modifies several FreeBSD drivers to use the GNU approach to
supply clk81 information.  It also changes the hardware strings
in some of the drivers to match what's present in the GNU files.

Submitted by:  John Wehle
Reviewed by:   imp
2015-04-11 08:34:41 +00:00
Ganbold Tsagaankhuu
5254cb2676 This modifies several FreeBSD drivers to use the hardware strings
present in the GNU dts files.

Submitted by:  John Wehle
Reviewed by:   imp
2015-04-11 08:30:37 +00:00
Andrew Turner
087af50ab8 Include vm/pmap.h for pmap_kextract. 2015-04-04 23:03:11 +00:00
Ganbold Tsagaankhuu
562246dff8 Add necessary changes to support various Amlogic SoC devices
specially aml8726-m6 and aml8726-m8b SoC based devices.
aml8726-m6 SoC exist in devices such as Visson ATV-102.
Hardkernel ODROID-C1 board has aml8726-m8b SoC.

The following support is included:
  Basic machdep code
  SMP
  Interrupt controller
  Clock control driver (aka gate)
  Pinctrl
  Timer
  Real time clock
  UART
  GPIO
  I2C
  SD controller
  SDXC controller
  USB
  Watchdog
  Random number generator
  PLL / Clock frequency measurement
  Frame buffer

Submitted by:   John Wehle
Approved by:    stas (mentor)
2015-03-31 11:50:46 +00:00