Commit Graph

424 Commits

Author SHA1 Message Date
Andrew Turner
8fcbb32311 Add MULTIDELAY support to the am335x dmtimer. This will be useful for
testing Cortex-A8 support in GENERIC.

Sponsored by:	ABT Systems Ltd
2016-10-25 18:01:19 +00:00
Hans Petter Selasky
d3bf5efc1f Fix device delete child function.
When detaching device trees parent devices must be detached prior to
detaching its children. This is because parent devices can have
pointers to the child devices in their softcs which are not
invalidated by device_delete_child(). This can cause use after free
issues and panic().

Device drivers implementing trees, must ensure its detach function
detaches or deletes all its children before returning.

While at it remove now redundant device_detach() calls before
device_delete_child() and device_delete_children(), mostly in
the USB controller drivers.

Tested by:		Jan Henrik Sylvester <me@janh.de>
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D8070
MFC after:		2 weeks
2016-10-17 10:20:38 +00:00
Michal Meloun
c7264b2dfa ARM: Remove unused includes.
MFC after: 1 week
2016-10-09 10:25:47 +00:00
Michal Meloun
7cc70732a3 ARM: SEV/WFE instructions are implemented starting from ARMv6K,
use it directly.

MFC after: 1 week
2016-10-06 13:18:18 +00:00
Luiz Otavio O Souza
ba14258f32 if_cpsw overhaul:
- Fix RX and TX teardown:
  . TX teardown would not reclaim the abandoned descriptors;
  . Interrupt storms in RX teardown;
  . Fixed the acknowledge of the teardown completion interrupt.

- Remove temporary lists for the descriptors;

- Simplified the descriptor handling (less writes and reads from
  descriptors where possible);

- Better debug;

- Add support for the RX threshold interrupts:
  With interrupt moderation only, an RX overrun is likely to happen.  The
  RX threshold is set to trigger a non paced interrupt everytime your RX
  free buffers are under the minimum threshold, helping to prevent the rx
  overrun.

The NIC now survive when pushed over its limits (where previously it would
lock up in a few seconds).

uFW (600MHz SoC) can now forward up to 560Mb/s of UDP traffic (netmap
pkt-gen as source and sink).  TCP forwarding rate is over 350Mb/s.

No difference (other than CPU use) was seen on Beaglebone black (1GHz SoC)
for his fast ethernet.

Tested on:	uFW, BBB
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-10-05 19:09:27 +00:00
Andrew Turner
1834282de6 Split CPU_CORTEXA into CPU_CORTEXA8, for the Cortex-A8, and CPU_CORTEXA_MP,
for later Cortex-A CPUs that support the Multiprocessor Extensions. This
will be needed to support both in a single GENERIC kernel while still
being able to only build for a single SoC.

Reviewed by:	mmel
Relnotes:	yes
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8138
2016-10-04 12:25:44 +00:00
Luiz Otavio O Souza
430d5eb47d Enable the TX completion interrupt for the cpsw NIC to assure the free tx
descriptors are reclaimed as soon as possible.

Without this the free buffers are reclaimed only on watchdog runs or after
trying to enqueue more packets.

Sponsored by:	Rubicon Communications, LLC (Netgte)
2016-10-03 19:48:56 +00:00
Oleksandr Tymoshenko
a6b15a3429 Modularize evdev
- Convert "options EVDEV" to "device evdev" and "device uinput", add
    modules for both new devices. They are isolated subsystems and do not
    require any compile-time changes to general kernel subsytems
- For hybrid drivers that have evdev as an optional way to deliver input
    events add option EVDEV_SUPPORT. Update all existing hybrid drivers
    to use it instead of EVDEV
- Remove no-op DECLARE_MODULE in evdev, it's not required, MODULE_VERSION
    is enough
- Add evdev module dependency to uinput

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
2016-10-02 03:20:31 +00:00
Oleksandr Tymoshenko
15eefa5b12 Add dependency to evdev module (if required) 2016-09-30 21:13:19 +00:00
Luiz Otavio O Souza
848a049b71 Remove the GLOBAL queue lock which just adds unnecessary complexity to code
(when used together with the individual tx and rx locks).

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-09-30 17:30:39 +00:00
Luiz Otavio O Souza
5a9c270ab6 Fix a typo in CPSW_DEBUG MACRO and then replace all the CPSWP_DEBUG() calls
with CPSW_DEBUG().

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-09-30 17:19:43 +00:00
Luiz Otavio O Souza
c933457038 Sort and remove unnecessary includes.
No functional changes.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-09-30 17:16:02 +00:00
Luiz Otavio O Souza
5de11ef951 Fix a typo.
Pointy hat to:	loos
2016-09-28 04:22:06 +00:00
Luiz Otavio O Souza
feeb22f34a Add a sysctl to control the interrupt pacing on AM335x integrated switch.
The hardware can be set to limit the number of interrupts from 2 to 63
interrupts per ms.

To keep the compatibility with the TI documentation the sysctl take the
interval between the interrupts pulses: 16~500 us.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-09-27 18:19:29 +00:00
Andrew Turner
0a4c0732a9 Restrict where we need to define fdt_fixup_table to just PowerPC and
Marvell.

Sponsored by:	ABT Systems Ltd
2016-09-23 14:11:23 +00:00
Andrew Turner
0dbb8873c8 Move cpu_reset to be a platform method to allow multiple implementations.
Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8010
2016-09-23 13:08:15 +00:00
Andrew Turner
c35b5d8372 Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
this on a few earlier arm SoCs.

Reviewed by:	manu (earlier version)
Sponsored by:	ABT Systems Ltd
2016-09-23 12:38:05 +00:00
Luiz Otavio O Souza
33fe8378ba If present, honor the USB port mode (host or peripheral) set on DTS, if not,
keep the beaglebone defaults: USB0 -> peripheral/gadget, USB1 -> host.

This is only a workaround as in fact fact this hardware is capable of detect
the USB port mode based on type of cable and act according with the detected
mode.  Unfortunately the driver does not handle that at moment.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-09-20 19:06:58 +00:00
Warner Losh
1648ac5095 Report the Silicon Revisions for the AM335x SoCs correctly. 2016-09-12 05:19:56 +00:00
Oleksandr Tymoshenko
b763171b46 Cleanup evdev support for TI ADC/TS
- evdev_set_methods call is not required if actual methods are no-ops
- evdev_set_serial is also optional if there is no meaningful input device
    identifier
- evdev_set_id on the other hand is mandatory, so set virtual bus with
    dummy vendor/product/version

Suggested by:	Vladimir Kondratiev
2016-09-12 01:18:25 +00:00
Oleksandr Tymoshenko
fbeb453ba9 Add evdev support to TI ADC/touchscreen driver
Add generic evdev support to touchscreen part of ti_adc: two absolute
coordinates + button touch to indicate pen position. Pressure value
reporting is not implemented yet.

Tested on: Beaglebone Black + 4DCAPE-43T + tslib
2016-09-11 19:08:21 +00:00
Oleksandr Tymoshenko
a4554c3736 Let knlist_add do the locking part
Remove explicit mtx_lock/mtx_unlock around knlist_add and pass 0 as
locked parameter so knlist_add does the locking itself

Suggested by:	kib@
2016-09-06 19:36:28 +00:00
Luiz Otavio O Souza
dc3155c1be Revert r305119, move the control module register data to am335x_scm.h and
fix if_cpsw.c to include the correct header.

Discussed with:	bz
2016-09-05 18:42:21 +00:00
Luiz Otavio O Souza
4b360eca4a All the TI platforms are FDT based and it is not necessary to enumerate
the hinted children (there wont be any).

Spotted by:	gonzo
2016-08-31 19:37:10 +00:00
Luiz Otavio O Souza
eff30e9149 Fix the build.
Works better when the file with the #define is actually included...
2016-08-31 18:35:41 +00:00
Bjoern A. Zeeb
4c0e176d9c After r305113, try to properly replace the magic numbers with
proper #defines for this driver (not using the wrong header).
2016-08-31 10:45:33 +00:00
Luiz Otavio O Souza
bf77189f92 Add a driver for the AM335x bandgap sensor, an on-die temperature sensor
as part of the AM335x control module extension.

TI says that the bandgap sensor is not very accurate on AM335x, but in our
tests it seems to be a good reference for the SoC temperature.

TI details:
http://processors.wiki.ti.com/index.php/AM335x_Thermal_Considerations#Measuring_Case_Temperature

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-08-31 07:42:46 +00:00
Luiz Otavio O Souza
73e6944164 Allow the use of control module extensions to cope with specific platform
features.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-08-31 07:22:14 +00:00
Luiz Otavio O Souza
0ba9f0ab1b Replace more magic numbers with the proper register names.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-08-31 07:03:06 +00:00
Luiz Otavio O Souza
a089112fdf Replace a magic number with the proper register name.
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-08-31 06:46:47 +00:00
Oleksandr Tymoshenko
6de4dd4f60 Fix TI PRUSS driver panic with INVARIANTS enabled
Value passed as islocked argument to knlist_add should
be consistent with actual lock state so add lock/unlock
calls around knlist_add

PR:		212120
Submitted by:	Manuel Stuhn
2016-08-30 01:31:03 +00:00
Michal Meloun
895c8b1c39 INTRNG: Rework handling with resources. Partially revert r301453.
- Read interrupt properties at bus enumeration time and store
   it into global mapping table.
 - At bus_activate_resource() time, given mapping entry is resolved and
   connected to real interrupt source. A copy of mapping entry is attached
   to given resource.
 - At bus_setup_intr() time, mapping entry stored in resource is used
   for delivery of requested interrupt configuration.
 - For MSI/MSIX interrupts, mapping entry is created within
   pci_alloc_msi()/pci_alloc_msix() call.
 - For legacy PCI interrupts, mapping entry must be created within
   pcib_route_interrupt() by pcib driver itself.

Reviewed by: nwhitehorn, andrew
Differential Revision: https://reviews.freebsd.org/D7493
2016-08-19 10:52:39 +00:00
Luiz Otavio O Souza
92ee0c01d4 Enable the build of micphy as part of generic miibus build, but only for
FDT enabled systems.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-28 05:59:56 +00:00
Luiz Otavio O Souza
285e3c3ea9 Allow the use of micphy on am335x devices.
The Micrel PHYs reads the optional external delays from DTB.

Tested and used by uBMC and uFW.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-24 01:31:41 +00:00
Luiz Otavio O Souza
59b67ee8f0 Fix a random memory overwrite at boot time, simplebus_init() and
simplebus_add_device() expect a simplebus_softc structure associated with
the device.

Add the simplebus_softc as first member in am335x_pwmss_softc structure.

Sponsored by:	Rubicon Communications (Netgate)
2016-07-18 06:35:40 +00:00
Luiz Otavio O Souza
cde7231a7f Fix a lockup in tx path for cspw.
Sometimes the software loses the race when appending more descriptors to
the tx ring and the tx queue stops.

This commit detects this condition and restart the tx queue whenever it stall.

Tested by:	sobomax@, Keith White <kwhite@site.uottawa.ca>,
	Paul Mather <paul@gromit.dlib.vt.edu>
Sponsored by:	Rubicon Communications (Netgate)
Approved by:	re (kib)
2016-07-07 20:01:03 +00:00
Luiz Otavio O Souza
d3dd020425 Only do the touch screen setup when the 'ti,wires' property is present.
While here fix a typo in a debug message.
2016-05-26 18:52:26 +00:00
Andrew Turner
9346e9130d Return the struct intr_pic pointer from intr_pic_register. This will be
needed in later changes where we may not be able to lock the pic list lock
to perform a lookup, e.g. from within interrupt context.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-05-18 15:05:44 +00:00
Oleksandr Tymoshenko
bc90a48ccf Add OF_prop_free function as a counterpart for OF_*prop_alloc
- Introduce new OF API function OF_prop_free to free memory allocated by
  OF_getprop_alloc and OF_getencprop_alloc. Current code just calls free(9)
  with M_OFWPROP memory class which assumes knowledge about OF_*prop_alloc
  functions' internals and leads to unneccessary code coupling

- Convert some of the free(..., M_OFWPROP) instances to OF_prop_free

Files affected by this commit are the ones I was able to test on real
hardware. The rest of free(..., M_OFWPROP) instances will be handled with
idividual maintainers

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D6315
2016-05-11 18:20:02 +00:00
Svatopluk Kraus
aa0d25b7a1 INTRNG - update gpio pin capabilities according to r299166.
Note that the updated comment is valid only for INTRNG. This should not
be a problem as not INTRNG code is left in place for debugging reasons
only and should not be used anymore. It's anticipated that this old
code will be removed soon.
2016-05-08 08:57:50 +00:00
Svatopluk Kraus
1a251c538f INTRNG - support new interrupt mapping type INTR_MAP_DATA_GPIO
introduced in r298738.
2016-05-06 08:59:25 +00:00
Svatopluk Kraus
2202c37926 INTRNG - use gpio interrupt modes definitions added in r298738 and
implement also GPIO_INTR_EDGE_BOTH mode. All reasonable interrupt
modes are supported now.
2016-05-06 08:56:46 +00:00
Svatopluk Kraus
cd642c88a1 INTRNG - redefine struct intr_map_data to avoid headers pollution. Each
struct associated with some type defined in enum intr_map_data_type
must have struct intr_map_data on the top of its own definition now.
When such structs are used, correct type and size must be filled in.

There are three such structs defined in sys/intr.h now. Their
definitions should be moved to corresponding headers by follow-up
commits.

While this change was propagated to all INTRNG like PICs,
pic_map_intr() method implementations were corrected on some places.
For this specific method, it's ensured by a caller that the 'data'
argument passed to this method is never NULL. Also, the return error
values were standardized there.
2016-05-05 13:31:19 +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
Andrew Turner
cca48a59de Add a MULTIDELAY option to allow the ARM kernel to have multiple DELAY
implementations. Early in the boot the kernel will use an approximate,
however after the timer has been probed it will switch to a more accurate
implementation.

Reviewed by:	manu
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5762
2016-04-30 17:27:33 +00:00
Oleksandr Tymoshenko
651f754421 Add driver for AM33xx SoC touchscreen
Split ADC driver in two halves: ADC(analog ot digital) and
TSC(touchscreen). Touchscreen driver is fully functional
up to the point of reporting samples. This part will be added
once FreeBSD has API for touchscreen.

Tested on: Beaglebone Black + 4DCAPE-43T
Reviewed by:	loos
Differential Revision:	https://reviews.freebsd.org/D5847
2016-04-29 20:31:49 +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
Oleksandr Tymoshenko
2927e6a868 Fix UART3 and UART4 clock offsets.
Original values were copy-pasted from UART1 and UART2

PR:		197037
Submitted by:	Scott Ellis <scott@jumpnowtek.com>
2016-04-13 21:39:45 +00:00
Svatopluk Kraus
3d6bafd11a Fix typo. No functional change. 2016-04-05 13:56:43 +00:00
Svatopluk Kraus
2df5562d0c Rework TI gpio interrupt controller for INTRNG. It's used on PANDABOARD
and BEAGLEBONE where INTRNG is already enabled by default.

Reviewed by:	gonzo
Differential Revision:	https://reviews.freebsd.org/D5806
2016-04-04 09:29:30 +00:00
Svatopluk Kraus
86816217ff Rework am33xx interrupt controller for INTRNG and enable it
on BEAGLEBONE by default.

Reviewed by:	gonzo
Differential Revision:	https://reviews.freebsd.org/D5805
2016-04-04 09:23:21 +00:00
Svatopluk Kraus
bff6be3e9b Remove FDT specific parts from INTRNG. Change its interface to make it
universal.

(1) New struct intr_map_data is defined as a container for arbitrary
description of an interrupt used by a device. Typically, an interrupt
number and configuration relevant to an interrupt controller is encoded
in such description. However, any additional information may be encoded
too like a set of cpus on which an interrupt should be enabled or vendor
specific data needed for setup of an interrupt in controller. The struct
intr_map_data itself is meant to be opaque for INTRNG.

(2) An intr_map_irq() function is created which takes an interrupt
controller identification and struct intr_map_data as arguments and
returns global interrupt number which identifies an interrupt.

(3) A set of functions to be used by bus drivers is created as well as
a corresponding set of methods for interrupt controller drivers. These
sets take both struct resource and struct intr_map_data as one of the
arguments. There is a goal to keep struct intr_map_data in struct
resource, however, this way a final solution is not limited to that.

(4) Other small changes are done to reflect new situation.

This is only first step aiming to create stable interface for interrupt
controller drivers. Thus, some temporary solution is taken. Interrupt
descriptions for devices are stored in INTRNG and two specific mapping
function are created to be temporary used by bus drivers. That's why
the struct intr_map_data is not opaque for INTRNG now. This temporary
solution will be replaced by final one in next step.

Differential Revision:	https://reviews.freebsd.org/D5730
2016-04-04 09:15:25 +00:00
Luiz Otavio O Souza
e5185f3e2f Bump up the read and write timeouts. The old value was too small for low
speed transfers.

Sponsored by:	Rubicon Communications (Netgate)
2016-03-30 16:26:00 +00:00
Luiz Otavio O Souza
cb18f3f308 Add the SPI driver for am335x.
This driver works in PIO mode for now, interrupts are available only when
FIFO is enabled.  The FIFO cannot be used with arbitrary sizes which defeat
its general use.

At some point we can add DMA transfers where the FIFO can be more useful.

Tested on uBMC (microBMC) and BBB.

Sponsored by:	Rubicon Communications (Netgate)
2016-03-29 19:11:04 +00:00
Luiz Otavio O Souza
e5ee119ae0 Use the internal references for ADC, this fixes the ADC readings on uBMC.
Tested on BBB and uBMC.

Sponsored by:	Rubicon Communications (Netgate)
2016-03-21 03:39:38 +00:00
Luiz Otavio O Souza
51f8a15cad Enable multicast addresses on vlan ports. Fixes the reception of broadcast
packets on vlan aware mode.

Sponsored by:	Rubicon Communications (Netgate)
2016-03-21 03:16:56 +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
Luiz Otavio O Souza
9c2dedde34 Count the input and output packets.
Sponsored by:	Rubicon Communications (Netgate)
2016-03-18 20:24:31 +00:00
Luiz Otavio O Souza
7996fcdcc3 Increase the arbitrary limit of TX segments.
Sponsored by:	Rubicon Communications (Netgate)
2016-03-18 20:09:54 +00:00
Luiz Otavio O Souza
3419d34598 Set the destination port in all TX segments.
Sponsored by:	Rubicon Communications (Netgate)
2016-03-18 20:04:34 +00:00
Luiz Otavio O Souza
23cd11b603 Add support for dual emac mode.
In dual emac mode, the CPSW subsystem provides two independent ethernets.

This is implemented (as recommended by TI's TRM) with a mixture of switch
settings (vlans) and specific features of CPSW subsystem.

The driver was splitted to accommodate the shared parts (RX and TX rings
for example) while it still provides two independent ethernets.

Each of the ethernet ports driver has it's own set of MDIO registers among
the other private settings.

Previously this driver always operate in promisc mode, now the Switch ALE
(address table entry) is properly initialized and enabled.

The driver is also tested (and known to work) with both ports operating in
single port mode (active_slave 0 or 1).

Tested on uBMC (dual emac mode, both ports in single mode, giga and fast
ethernet) and BBB (single port, fast ethernet).

Sponsored by:	Rubicon Communications (Netgate)
2016-03-17 19:35:08 +00:00
Luiz Otavio O Souza
0620372f28 Fixes a few style(9) issues, remove extra blank lines.
No functional changes.

Sponsored by:	Rubicon Comunications (Netgate)
2016-03-17 06:23:48 +00:00
John Baldwin
cbc4d2db75 Remove taskqueue_enqueue_fast().
taskqueue_enqueue() was changed to support both fast and non-fast
taskqueues 10 years ago in r154167.  It has been a compat shim ever
since.  It's time for the compat shim to go.

Submitted by:	Howard Su <howard0su@gmail.com>
Reviewed by:	sephe
Differential Revision:	https://reviews.freebsd.org/D5131
2016-03-01 17:47:32 +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
Svatopluk Kraus
547e50e022 Use EARLY_DRIVER_MODULE() for ti_scm driver to be attached before
am335x_prcm driver which uses it. Used BUS_PASS_BUS is a quick pick
for now and may be revised when other drivers start using multipass
feature.

This is needed after an update of Linux dts files done in r295436.
2016-02-16 13:40:23 +00:00
Svatopluk Kraus
c2849e3c11 Initial OMAP4 WUGEN pass-through driver. SPI interrupts are passed
through WUGEN to GIC. Hardware initialization is left in state after
reset as well as before.

This is needed after an update of Linux dts files.
2016-02-15 15:28:56 +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
Svatopluk Kraus
231ccab8e7 Remove not needed <machine/pte.h> includes. 2016-02-01 19:36:33 +00:00
Michal Meloun
ebda969939 ARM: Rename remaining instances of cpufunc_id() to cpu_ident(),
forgotten in r295096.
Remove tlb_flushI/tlb_flushI_SE functions forgotten in r295122.
2016-02-01 14:28:58 +00:00
Andrew Turner
654ad322b6 Stop defining fdt_pic_table with ARM_INTRNG, it's unused. 2016-01-22 12:51:12 +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
Warner Losh
31c9adb789 Create a simplebus PNP info wrapper.
Differential Review: https://reviews.freebsd.org/D4517
2015-12-18 05:29:22 +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
Andrew Turner
dd76e27f7a Move hdmi_if.m to files.arm so other kernel configs can use it. 2015-11-21 16:25:03 +00:00
Andrew Turner
ed18006cbf Create device options for the two common ARM timers.
Sponsored by:	ABT Systems Ltd
2015-11-21 16:23:56 +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
Warner Losh
c192c5d300 Makeoption ARM_LITLE_ENDIAN does nothing. Remove it since it isn't
consistently used. It was a carry over from NetBSD that FreeBSD
doesn't use.
2015-11-20 21:49:46 +00:00
Andrew Turner
805471578e Remove bus_space_asm_generic.S from the per-SoC files.* files, it's already
in files.arm.

Sponsored by:	ABT Systems Ltd
2015-11-20 19:48:32 +00:00
Andrew Turner
aeef645f92 Stop setting {KERN,}PHYSADDR on armv6, it's unneeded.
Sponsored by:	ABT Systems Ltd
2015-11-20 16:12:22 +00:00
Oleksandr Tymoshenko
6f79d9e96c Somewhat improve HDMI event API
- Pass device_t for HDMI framer as an argument for event hook
- Use #define for event values, instead of opaque (and unused) 0
2015-11-14 21:01:35 +00:00
Oleksandr Tymoshenko
ca298cac31 hdmi_if.m will be reused by iMX6 IPU code so move it to arm/arm 2015-11-14 03:22:59 +00:00
Oleksandr Tymoshenko
9c42981925 Move all HDMI-related stuff to hdmi_if.m, hdmi.h is not required 2015-11-14 03:05:42 +00:00
Gavin Atkinson
24e34f5771 Consistently capitalize "TI" as an abbreviation for Texas Instruments. 2015-11-12 20:14:25 +00:00
Tijl Coosemans
27f38a8d69 Since r289279 bufinit() uses mp_ncpus, but some architectures set this
variable during mp_start() which is too late.  Move this to mp_setmaxid()
where other architectures set it and move x86 assertions to MI code.

Reviewed by:	kib (x86 part)
2015-11-08 14:26:50 +00:00
Olivier Houchard
b34e5f2e07 Include opt_platform.h to get FDT defined. 2015-11-06 20:12:31 +00:00
Ian Lepore
9a2bb68894 Fix parsing of I2C addresses properties in fdt data. I2C address is
represented in 7-bits format in DT files, but system expect it in 8-bit
format.  Also, fix two drivers that locally hack around this bug.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-10-21 15:41:16 +00:00
Ian Lepore
cf91682f07 Enable ARM_INTRNG on the pandaboard platform.
Differential Revision:	https://reviews.freebsd.org/D2048
2015-10-18 18:39:16 +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
Andrew Turner
b1bddf4039 Move pmu.c to files.arm and rename the option to pmu. This is not hwpmc
specific as we may use the pmu registers for other uses. No configs seem
to currently build this.

This will allow for more use of this device.

Discussed with:	bz
Sponsored by:	ABT Systems Ltd
2015-10-07 13:19:44 +00:00
Ruslan Bukin
31239b7219 Attach interrupt controller device before other devices.
Sponsored by:	University of Cambridge
2015-10-05 13:15:21 +00:00
Ian Lepore
4159fbab87 Add a new PPS driver for AM335x (beaglebone) timer hardware. This can be
used as a module or compiled-in.
2015-08-13 15:19:30 +00:00
Ian Lepore
479e7c449b Remove all dregs of the old PPS driver from this code, in preparation for
redoing it as a separate driver.  Now that each hardware timer is handled by
a separate instance of the timer driver, it no longer makes sense to bundle
the pps driver with the regular timecounter code.  (When all 8 timers were
handled by one driver there was no choice about this.)

Split the hardware register definitions out to their own file, so that the
new pps driver (coming in a separate commit later) can share them.

With the PPS driver gone, the question of which hardware timer to use for
what purpose becomes much easier (some instances can't do the PPS capture).
Now we can just hardcore timer2 for eventtimer and timer3 for timecounter.

This also now only instantiates devices for the 2 hardware timers actually
used to implement eventtimer and timecounter.  This is required so that
other drivers can come along and attach to other hardware timers to provide
other functionality.  (In addition to PPS, this hardware can also do PWM
stuff, general pulse width and frequency measurements, etc.  Maybe some
day we'll have drivers for those things.)
2015-08-12 19:40:32 +00:00
Ian Lepore
303373a47d Remove a bogus printf that whines every time loading a driver module
triggers a fresh round of probing.
2015-08-12 19:26:36 +00:00
Ian Lepore
5b13e08cda Add a MODULE_VERSION(), because other things MODULE_DEPEND() on this. 2015-08-12 19:25:22 +00:00
Ian Lepore
beacf789e5 Add a routine to return the hardware instance/unit number from ti,hwmods,
given the hardware name.

The ti,hwmods property is used (among other things) to associate an fdt node
with a specific instance of some hardware.  For example given a device node
that contains the property ti,hwmods = "timer3", if you call this passing
"timer" as the hwmod string to look for it would return 3.
2015-08-12 17:23:15 +00:00
Ian Lepore
84dbb4b0d0 Make this compile again when PPS_SYNC is defined. Also remove a couple
comment blocks and constants that no longer apply.
2015-08-11 19:25:26 +00:00
Pedro F. Giffuni
6bc3fe5f4e Clean out some externally visible "more then" grammar
MFC after:	3 days
2015-08-11 03:12:09 +00:00
Oleksandr Tymoshenko
7b25d1d63b Pass correct type of argument to ti_gpio_unmask_irq in ti_gpio_activate_resource 2015-08-03 01:22:49 +00:00
Oleksandr Tymoshenko
c3321180ec Set output pin initial value based on pin's pinmux pullup/pulldown setup
Some of FDT blobs for AM335x-based devices use pinmux pullup/pulldown
flag to setup initial GPIO ouputp value, e.g. 4DCAPE-43 sets LCD DATAEN
signal this way. It works for Linux because Linux driver does not enforce
pin direction until after it's requested by consumer. So input with pullup
flag set acts as output with GPIO_HIGH value

Reviewed by:	loos
2015-08-01 23:10:36 +00:00
Oleksandr Tymoshenko
4f5f0f288f Fix color mapping for TDA19988. Values for VIP_CNTRL_1 and VIP_CNTRL_2
registers were mixed up
2015-07-25 03:19:02 +00:00
Oleksandr Tymoshenko
b8397a9f01 Synchronize PIN input/output modes with gnu/dts/include/dt-bindings/pinctrl/am33xx.h
gpio driver requires exact value to match SoC pin mode with GPIO pin direction
2015-07-25 03:03:32 +00:00
Oleksandr Tymoshenko
5625a3e560 If there is panel info in DTB do not wait for HDMI event and setup
framebuffer immediately
2015-07-25 02:59:45 +00:00
Oleksandr Tymoshenko
960dff03c3 Add missing driver for TDA19988 HDMI framer 2015-06-18 16:51:49 +00:00
Oleksandr Tymoshenko
224fba2b43 Add HDMI support to Beaglebone Black:
- Add driver for TDA19988 HDMI framer
- Add simple interface to communicate with HDMI sink: read EDID and set videomode
- Add event-based API to notify LCD controller when HDMI sink is available
- Add HDMI framer node and add refernce to it to lcdc node. This part of
    DTS tree is custom and does not match Linux DTS because Linux uses
    combination of pseudo-node in DTS and hardcoded driver information
    that does not map to our model.
2015-06-18 00:57:52 +00:00
Oleksandr Tymoshenko
a08b6d1141 - Add clk_set_source_freq field to struct ti_clock_dev so clock device
consumers can configure clock frequency
- Add ti_prcm_clk_set_source_freq wrapper for clk_set_source_freq
- Add am335x_clk_set_arm_disp_freq function to control pixel clock
   frequency for LCD and HDMI output. Both of them are sensitive
   to frequency skews and we need to get pixel clock matching requested
   frequency as close to possible
2015-06-17 23:26:00 +00:00
Maxim Sobolev
1ab62874ae "status_reg.acpwr ? 1 : 0" is now the same as just "status_reg.acpwr". 2015-06-09 19:22:13 +00:00
Maxim Sobolev
02f4627c40 Fix a typo in a comment that has been carried over from am335x_pmic.c. 2015-06-09 19:17:33 +00:00
Maxim Sobolev
019098cfd4 Use tab to do identation consistently. 2015-06-09 19:04:55 +00:00
Maxim Sobolev
8054d7cc0d Extend TPS65217 support to be able to pull and decode battery
charger configuration and provide some basic control knobs to
set charger voltage and dump config on boot. Two loader tunables
have been added:

 o hw.am335x_pmic.bootverbose set to 1 to get more info on the
   boot;

 o hw.am335x_pmic.vo: set to charger voltage to be applied on
   kernel initialization time, supported values are "4.10V",
   "4.15V", "4.20V" and "4.25V".

Cleanup code a bit in general, move TPS65217 register
definitions into a separate header, convert bit-banging
defines into bitmap structures.

Also threat the case when power source is neither "AC" nor "USB"
as "Battery", not "Unknown".
2015-06-09 18:46:31 +00:00
Oleksandr Tymoshenko
37c1967c5b Rename fdt_find_child to ofw_bus_find_child. There is nothing FDT-specific
in this function.

Suggested by: andrew@
2015-05-24 23:53:10 +00:00
Andrew Turner
66cbed6659 Remove an unused header. 2015-05-23 14:48:03 +00:00
Andrew Turner
7c909980ef Add a miibus_statchg and use it to enable Gigabit mode when appropriate.
MFC after:	1 week
2015-05-22 14:25:23 +00:00
Oleksandr Tymoshenko
5b03aba6c8 Switch TI platform support code from using FreeBSD's custom-baked DTS
files to vendor-provided ones. It should make easier to adopt platform
code to new revisions of hardware and to use DTS overlays for various
Beaglebone extensions (shields/capes).

Original dts filenames were not changed, they're now wrappers over dts
files provided by TI. So make sure you update .dtb files on your
devices as part of kernel update

GPIO addressing was changed: instead of one global /dev/gpioc0 there
are per-bank instances of /dev/gpiocX. Each bank has 32 pins so for
instance pin 121 on /dev/gpioc0 in old addressing scheme is now pin 25
on /dev/gpioc3

On Pandaboard serial console devices was changed from /dev/ttyu0 to
/dev/ttyu2 so you'll have to update /etc/ttys to get login prompt
on serial port in multiuser mode. Single user mode serial console
should work as-is

Differential Revision:	https://reviews.freebsd.org/D2146
Reviewed by:	rpaulo, ian, Michal Meloun, Svatopluk Kraus
2015-05-22 03:16:18 +00:00
Rui Paulo
c71d7e6735 ti_pruss: pass the correct IRQ to userland.
Also, fix several problems with the kqueue notification.

Submitted by:	Manuel Stühn freebsdnewbie at freenet.de
2015-05-20 06:23:01 +00:00
Luiz Otavio O Souza
6a4b96ad82 Add support for the power button on BeagleBone Black.
Shutdown and turn off the board when the power button is pressed.

Submitted by:	Michal Meloun <meloun@miracle.cz>
Relnotes:	yes
2015-05-13 01:10:28 +00:00
Andrew Turner
ace157c3a9 Use the new gic option on all configs that need it. 2015-05-10 12:13:27 +00:00
Luiz Otavio O Souza
8b651535df Pass the resources requests to the upper bus.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-05-09 03:39:18 +00:00
Andrew Turner
087af50ab8 Include vm/pmap.h for pmap_kextract. 2015-04-04 23:03:11 +00:00
Andrew Turner
ff3b52bb19 Stop using machine/fdt.h in the arm kernel code when we don't need it. 2015-04-04 21:34:26 +00:00
Andrew Turner
0ebebb1260 Build the cpufunc_asm_* files based on the cpu type, not which config file
we happen to be building.
2015-03-29 22:43:39 +00:00
Andrew Turner
d9d02715d3 Remove cpufunc_asm_arm11.S from the ARMv7 configs, it's not used. 2015-03-29 21:45:28 +00:00
Andrew Turner
698234c19b Stop building unused cpuvunc_* files, we don't need anything from these. 2015-03-29 17:33:03 +00:00
Ian Lepore
3e096b705c Change the name of the dmtimer pps device from /dev/ppsN to /dev/dmtppsN.
ntpd is hard-coded to use /dev/ppsN, and typically when multiple PPS sources
are available the sysadmin will symlink the right one(s) to /dev/ppsN, so
it's best to not usurp those names directly.
2015-03-09 21:58:41 +00:00
Ian Lepore
726f3ad5aa Attach the prcm clock driver early, so it can set the mpcore timer frequency.
Submitted by:	Svatopluk Kraus
2015-03-09 15:54:14 +00:00
Ian Lepore
d3df8026cf Fix spurious interrupts on arm am335x (beaglebone), by doing the EOI in
both the post-filter and post-thread callbacks.

Also eliminate a completely unecessary write to INTC_ISR_CLEAR register,
which clears a software-generated interrupt that can only happen with a
write to INTC_ISR_SET (which nothing does).
2015-03-08 03:34:06 +00:00
Dimitry Andric
4c991ff32f Fix a number of -Wcast-qual warnings under sys/arm. No functional
change.

Submitted by:	andrew
MFC after:	3 days
2015-02-26 07:47:35 +00:00
Dimitry Andric
9e950417ce In sys/arm/ti/am335x/am335x_rtc.c, fix a clang 3.6.0 warning about
am33x_rtc_softc::sc_irq_res (which is an array) never being NULL.

Submitted by:	andrew
MFC after:	3 days
2015-02-26 07:45:40 +00:00
Luiz Otavio O Souza
7d732cea63 Fix a bug where an interrupt could be masked unintentionally when
bus_config_intr() is called with the same interrupt type and polarity that
is already set.

Pointy hat:	loos
2015-02-04 18:35:49 +00:00
Rui Paulo
851d8eaaa4 am335x_clk_pruss_activate(): use the L3F clock.
The DISP DPLL clock is slower and was making the PRU programs slower
on FreeBSD than on Linux.

Submitted by:	Manuel Stuehn <freebsdnewbie at freenet.de>
MFC after:	1 week
2015-02-02 08:01:10 +00:00
Luiz Otavio O Souza
7836352b50 Implement GPIO_GET_BUS() method for all GPIO drivers.
Add helper routines to deal with attach and detach of gpiobus and gpioc
devices that are common to all drivers.
2015-01-31 19:32:14 +00:00
Luiz Otavio O Souza
876c1bd8b0 Clean up and fix the device detach routine and the failure path on GPIO
drivers.

This paves the way for upcoming work.
2015-01-31 12:17:07 +00:00
Rui Paulo
c0a9702f95 ti_pruss: make sure the mmap'ed memory region is uncacheable.
MFC after:	1 week
2015-01-31 02:12:57 +00:00
Oleksandr Tymoshenko
f100177dfb Set LCDC clock frequency to 2*148500 KHz
Minimum LCDC is 2 so clock freq shouild be 2*max_pixel_clock. Maximum pixel
clock for HDMI is 148500 (1920x1080). But AM335x can not run in this mode
due to bandwidth and clock limitations
2015-01-29 01:59:42 +00:00
Ruslan Bukin
6411d14d62 Add ARMv7 performance monitoring counters.
Differential Revision:	https://reviews.freebsd.org/D1687
Reviewed by:	rpaulo
Sponsored by:	DARPA, AFRL
2015-01-28 16:08:07 +00:00
Oleksandr Tymoshenko
e505aef3ed - Increase default i2c bus timeout to 5 seconds from 1 second. Sometimes
1 second is not enugh for TDA19988 HDMI framer (e.g. on Beaglebone Black)
- Add per-device i2c_timout sysctl (dev.iichb.X.i2c_timeout) to control
    I2C bus timeout manually
- Pass softc instead of device_t to all sysctl handlers
2015-01-25 23:58:34 +00:00
Oleksandr Tymoshenko
72584f4cba Add vt(4) support to AM335x LCDC driver 2015-01-25 22:08:36 +00:00
Oleksandr Tymoshenko
5967db8dca After interrupt read value from register to make sure it reached hardware. This
should fix "Spurious inteerupt" message

Suggested by ian@
2015-01-24 01:53:28 +00:00
Oleksandr Tymoshenko
fbae9a50c4 Write ACK for all kinds of LCDC interrupts 2015-01-22 03:32:04 +00:00
Oleksandr Tymoshenko
7d948458b1 Remove "#define DEBUG" that conflicts with "option DEBUG" in kernel config 2015-01-21 19:23:46 +00:00
Ian Lepore
eb8711ce16 Rename bus_space-v6.c to bus_space_base.c, because it's not v6-specific
and now some v5 Marvell systems are using it.  Only define fdt_bus_tag
if option FDT is defined.
2015-01-21 03:44:29 +00:00
Oleksandr Tymoshenko
eaf6610dd7 Properly clear IRQ status in order to fix "Spurious IRQ" message from AINT.
This register is not documented in TRM but that's what linux driver does
2015-01-20 02:24:08 +00:00
Oleksandr Tymoshenko
81d8de5f75 Fix programming timing parameters to LCDC. Actual value used for HBP, HFP, HSW, VSW
is register's programmed value + 1.
2015-01-18 06:43:09 +00:00
Bjoern A. Zeeb
6333a401ff Fix cpsw(4) after r277203 which folded 'struct m_hdr' into 'struct mbuf'.
While in theory this should have been a transparent change (and was for all
other drivers), cpsw(4) never used the proper accessor macros in a few
places but spelt the indirect m_hdr.mh_* out itself.  Convert those to
use m_len and m_data and unbreak the driver build.
2015-01-15 02:22:52 +00:00
Luiz Otavio O Souza
2566c5264a Add support to turn off Beaglebone with poweroff(8) or shutdown(8) -p.
To cut off the power we need to start the shutdown sequence by writing
the OFF bit on PMIC.

Once the PMIC is programmed the SoC needs to toggle the PMIC_PWR_ENABLE
pin when it is ready for the PMIC to cut off the power.  This is done by
triggering the ALARM2 interrupt on SoC RTC.

The RTC driver only works in power management mode which means it won't
provide any kind of time keeping functionality.  It only implements a way
to trigger the ALARM2 interrupt when requested.

Differential Revision:	https://reviews.freebsd.org/D1489
Reviewed by:	rpaulo
MFC after:	2 weeks
2015-01-12 03:23:16 +00:00
Andrew Turner
3f53a2d612 Rename gic_init_secondary to arm_init_secondary_ic to help with the merge
of the arm_intrng project branch.
2015-01-11 16:46:43 +00:00