Commit Graph

334 Commits

Author SHA1 Message Date
Luiz Otavio O Souza
b7f9d71cf4 After r308533, the platform compatible string must be an exact match.
Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every
DTS we support.

This fixes the boot on TI SoCs after r308533.

Suggested by:	gonzo
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-15 21:18:55 +00:00
Luiz Otavio O Souza
d47e148e0b Change the TI aintc driver name to "ti_aintc" to avoid the conflict with
the aintc driver for Allwinner A10.

This fixes the boot of the GENERIC ARM kernel on TI/AM335x SoCs.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-15 19:09:36 +00:00
Luiz Otavio O Souza
197029fec2 Fix ti_gpio_detach() to avoid crashing if something goes wrong.
Sponsored by:	Rubicon Communication, LLC (Netgate)
2016-11-15 18:57:25 +00:00
Andrew Turner
9783ea5c9f Use the correct OF_getencprop over OF_getprop + fdt32_to_cpu to read
integer data from the device tree.

Sponsored by:	ABT Systems Ltd
2016-11-14 12:03:08 +00:00
Andrew Turner
222102cfca Move including fdt_pinctrl.h after openfirm.h to get th edefinition of
phandle_t and remove the need for including fdt_common.h.

Sponsored by:	ABT Systems Ltd
2016-11-14 11:52:22 +00:00
Andrew Turner
df7675353e Stop including fdt_common.h from the arm code when it's unneeded.
Sponsored by:	ABT Systems Ltd
2016-11-14 11:41:22 +00:00
Andrew Turner
87acb7f815 Use the modern spelling of ofw_bus_node_is_compatible in sys/arm.
Sponsored by:	ABT Systems Ltd
2016-11-11 15:13:30 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Andrew Turner
feabce61dc Start to remove the old pre-INTRNG code from the arm platforms. These have
all moved to use INTRNG.

Reviewed by:	manu, mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8469
2016-11-08 12:15:57 +00:00
Andrew Turner
95d34803f7 Fix the order of includes so machine/asm.h is first.
MFC after:	1 week
Sponsored by:	ABT Systems Ltd
2016-11-07 11:56:18 +00:00
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