Commit Graph

352 Commits

Author SHA1 Message Date
Luiz Otavio O Souza
ab8fdacc82 Fixes the sensor initialization, always reset the digital outputs to start.
Obtained from:	pfSense
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-31 02:18:08 +00:00
Emmanuel Vadot
7073d12c4d ofw_spi: Parse property for the SPI mode and CS polarity.
As cs is stored in a uint32_t, use the last bit to store the
active high flag as it's unlikely that we will have that much CS.

Reviewed by:	loos
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D8614
2016-12-18 14:54:20 +00:00
Svatopluk Kraus
e5b16f1d0e Fix sscanf() format string to match an argument. This also fixes kernel
build after r310171.

MFC after:	1 weeks
2016-12-17 18:03:03 +00:00
Andrew Turner
6c925b9c81 All armv6 platforms have the same implementation of platform_lastaddr.
Replace them with a default handler that returns devmap_lastaddr.

Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8806
2016-12-16 10:31:13 +00:00
Andrew Turner
ba9f40ca3b Use the platform_*_t typedefs to help check the platform function types are
correct.

Sponsored by:	ABT Systems Ltd
2016-12-13 13:46:09 +00:00
Andrew Turner
59249a516a Add the missing void to function signatures in much of the arm code.
Sponsored by:	ABT Systems Ltd
2016-12-13 13:43:22 +00:00
Emmanuel Vadot
718860e469 CS ivar is uint32_t, not int.
MFC after:	3 days
2016-12-12 18:36:46 +00:00
Luiz Otavio O Souza
7f67614061 MDIO_PHYACCESS_ACK is only valid for read access, remove it from
miibus_writereg.

Reduce the DELAY() between reads while waiting for MII access.

Spotted by:	yongari
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 03:34:04 +00:00
Luiz Otavio O Souza
71462f5652 The RX_FREEBUFFER registers are a write to increment field.
Writing the full queue size to it every time was makeing it overflow with a
lot of bogus values.

This fixes the interrupt storms on irq 40.

Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-12-01 02:35:15 +00:00
Luiz Otavio O Souza
a2c46b941e Add the etherswitch(4) support for TI CPSW.
Adds VLAN and port management abilities for etherswitchcfg(8).

The code is conditionally enabled for now, because it is not necessary on
single ethernet use cases.

Obtained from:	pfSense
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC (Netgate)
2016-11-24 20:14:43 +00:00
Olivier Houchard
cbfebd9a6e The only remaining offender that used ti_chip() without checking for
compatibility first was the gpio code, so change that, and re-assert
that the TI chip is a known chip
2016-11-19 15:43:22 +00:00
Olivier Houchard
80d2898d0f Don't panic if it's not a TI chip, this code can be called when it is not. 2016-11-19 15:35:40 +00:00
Olivier Houchard
645f6eaf9a Don't attempt to get the chip revision if it's not a supported TI chip 2016-11-19 15:35:10 +00:00
Olivier Houchard
487012f4f8 Move the pandaboard initialization from the probe to the attach method.
Use ofw_bus_node_is_compatible instead of fdt_is_compatible, as the
later is deprecated.

Suggested by:	andrew
2016-11-19 13:11:03 +00:00
Olivier Houchard
c49cf11473 Resolv the remaining conflicting symbols between omap4 and am335x, and
add omap4/pandaboard into the GENERIC kernel.
2016-11-19 01:51:56 +00:00
Olivier Houchard
8917c565bd Don't assume we're running on a pandaboard if the pandaboard-specific
code is compiled in, use FDT to detect it instead.
2016-11-19 00:55:46 +00:00
Olivier Houchard
31a2ddf253 Guess the TI chip based on the PLATFORM infos, instead of relying on the
kernel config file.
2016-11-18 23:48:20 +00:00
Olivier Houchard
44f0c15c6c Convert the omap4 code to use PLATFORM_SMP. 2016-11-18 22:58:47 +00:00
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