Commit Graph

516 Commits

Author SHA1 Message Date
Emmanuel Vadot
fce9d29f8d if_awg: store mbuf and dma mapping in the last segment of a tx frame instead of the first
According to the datasheet, TX_DESC_CTL is cleared when whole frame is transmitted or all
data in the current descriptor's buffer are transmitted.
When the mbuf and mapping are stored in the first segment and in a scenario where a tx
completion interrupt arrives for a frame and only the start of the next frame was transmitted,
at the time of interrupt processing the mbuf and mapping will be freed when processing the
first segment of the next frame but the other untrasmitted segments still need to use them.

Submitted by:	Guy Yur <guyyur@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D13031
2017-11-18 20:46:31 +00:00
Emmanuel Vadot
c6110e7514 if_awg: mark the first tx descriptor as ready only after all the other tx descriptors are set up
In a multi segment frame, if the first tx descriptor is marked with TX_DESC_CTL
but not all tx descriptors for the other segments in the frame are set up,
the TX DMA may transmit an incomplete frame.
To prevent this, set TX_DESC_CTL for the first tx descriptor only when done
with all the other segments.

Also, don't bother cleaning transmitted tx descriptors since TX_DESC_CTL
is cleared for them by the hardware and they will be reprogrammed before
TX_DESC_CTL is reenabled for them.

Submitted by:	Guy Yur <guyyur@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D13030
2017-11-18 20:42:48 +00:00
Emmanuel Vadot
1ee5a3d3b2 if_awg: only request completion interrupt on the last descriptor of a tx frame
The hardware will not issue a completion interrupt for a descriptor
with TX_INT_CTL set if it doesn't also have TX_LAST_DESC set.

Submitted by:	 Guy Yur <guyyur_gmail.com>
Differential Revision:	https://reviews.freebsd.org/D13029
2017-11-18 20:38:05 +00:00
Emmanuel Vadot
70bc7e51ca Allwinner A13: Add clkng support
DTS files switch from clocks under /clocks to a ccu (Clock Controller Unit)
a while ago.
Restore A13 functionality by adding a clock driver for it.
Almost every clocks are handled, the missing ones are mostly video related
clocks.

Tested On: A13 Olinuxino
2017-11-08 21:24:06 +00:00
Emmanuel Vadot
58f6e2154e Allwinner: clk: Unlock the clknode after locking it.
Pointy Hat: manu
2017-11-08 21:12:59 +00:00
Oleksandr Tymoshenko
031d577716 Increase TX_MAX_SEGS from 10 to 20 for the if_awg.c driver
Under certain traffic pattern awg driver does not recover from TX queue
full condition. The actual source of the problem is not identified yet
but jmcneill@ agreed that bumping TX_MAX_SEGS to 20 is OK as a workaround
for the problem (NetBSD has it set to 128).

Also add some diagnostic printfs to prevent silent failure of bus_dma
functions in the future

PR will be kept open until root cause of the issue is identified and fixed

PR:		219927
Submitted by:	Tom Vijlbrief <tvijlbrief@gmail.com>
Approved by:	jmcneill
MFC after:	2 weeks
2017-11-04 23:28:02 +00:00
Emmanuel Vadot
ec9f9562a5 Allwinner: Fix compilation
Forgot an #endif in r324773, sorry for the breakage.
2017-10-19 21:34:53 +00:00
Emmanuel Vadot
3e8d2879c6 Allwinner: Add EARLY_PRINTF function
EARLY_PRINTF can help debugging early problems.
Add it for Allwinner SoCs.

Tested On: OrangePi One (H3)
2017-10-19 20:56:30 +00:00
Emmanuel Vadot
449ed68efb a10_ehci: Remove the passby code
It doesn't seems to be needed anymore and this make ehci working again
on the Pine64.
Thanks to jmcneill@ for the help.

Tested on:	Pine64 (A64), OrangePi One (H3), BananapiM2 (A31s)
2017-10-12 18:00:29 +00:00
Emmanuel Vadot
ac9297c128 Allwinner: Add clock driver for ccu_sun8i_r
SUN8I and SUN50I (H3, H5, A83T and A64) have a second clock controller
unit. It controls the clocks for the second gpio controller, the IR
controller etc ...
Support for A83T is not supported.

Tested On: OrangePi One, Pine64
2017-10-07 16:48:42 +00:00
Warner Losh
094fc1ed0f Tag all armv7 kernels as such in their machine config line.
Transition all boards that support arm cortex CPUs to armv7. This
leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
around the time RPI-B went in. Copy std.armv6 to std.armv7, even
though that duplicates a lot of stuff. More work needs to be done to
sort out the duplication.

Differential Revision: https://reviews.freebsd.org/D12027
2017-10-05 23:01:50 +00:00
Emmanuel Vadot
d3609450aa Allwinner H3 CCU: Fix build on ARM64
ccu_h3.c is also used on ARM64 as it provides clocks for the H5 SoC.
Since ARM64 doesn't have sys/gun/dts/include in it's include path, use
the full name for the sun8i-h3-ccu.h include.

Reported by:	andreast
2017-10-02 19:17:09 +00:00
Emmanuel Vadot
7bc85edd15 Allwinner GPIO: Fail if we cannot enable a clock
If we cannot enable a clock (which is required to have the device
working), do not attach the device as it will not work.
2017-10-02 17:20:07 +00:00
Emmanuel Vadot
4168a6e9f1 Allwinner: Remove a10_gpio.h
a10_gpio.h isn't used since a long time, remove it from the tree.
2017-10-02 16:39:12 +00:00
Emmanuel Vadot
d8ffc6fb25 Allwinner A31 ccu: Use clock/reset IDs from dt-bindings
Do not redefines resets and clocks ID which are already in the
dt-bindings include directory. Those files are under dual licenced
under GPL2/MIT so use them directly.
2017-10-02 16:21:20 +00:00
Emmanuel Vadot
f5bb8f4aaf Allwinner A64 ccu: Use clock/reset IDs from dt-bindings
Do not redefines resets and clocks ID which are already in the
dt-bindings include directory. Those files are under dual licenced
under GPL2/MIT so use them directly.
2017-10-02 16:12:06 +00:00
Emmanuel Vadot
5aefde1fa8 Allwinner H3 ccu: Use clock/reset IDs from dt-bindings
Do not redefines resets and clocks ID which are already in the
dt-bindings include directory. Those files are under dual licence
GPL2/MIT so use them directly.
2017-10-02 15:48:39 +00:00
Ian Lepore
74eb18b6cc Define a single instance of ahci_devclass and reference it from all the
attachment code for various SOCs and busses.  Remove all the static and
should-have-been-static and named-differently instances of it.

This should eliminate the recently-grown build warnings about multiple
definitions when building arm kernels.
2017-10-02 02:58:28 +00:00
Jared McNeill
2a811fc0b8 Disable/enable CSUM_UDP and CSUM_TCP along with CSUM_IP
Submitted by:		guyyur@gmail.com
Differential Revision:	https://reviews.freebsd.org/D12536
2017-09-30 10:35:44 +00:00
Jared McNeill
80e5f51916 Fix if_awg tx dma status reg offsets.
Submitted by:		guyyur@gmail.com
Differential Revision:	https://reviews.freebsd.org/D12535
2017-09-30 10:34:07 +00:00
Emmanuel Vadot
ff8241f7f0 a10_gpio: Enable all needed clocks
Do not enable only the first clock, enable them all.
2017-09-26 20:23:09 +00:00
Emmanuel Vadot
9980df7daa a10_ehci: Enable all clocks and reset
a10_ehci can have multiple clocks and reset, enable them all instead of
only the first one.
2017-09-26 19:21:43 +00:00
Emmanuel Vadot
de355bea02 aw_usbphy: Only reroute OTG for phy0
We only need to route OTG port to host mode on phy0 and if no VBUS
is present on the port, otherwise leave the port in periperal mode.
2017-09-26 19:20:50 +00:00
Emmanuel Vadot
1eca1d26fd aw_usbphy: Fix write of unknown register
Some SoC require a write to a unknown register to work corectly.
This write should be in the pmu region not in the phy ctrl one.

Reported by:	Mark Millard (markmi@dsl-only.net)
2017-09-26 19:19:44 +00:00
Emmanuel Vadot
36dcd6a499 Allwinner usb phy: Rework resource allocation
The usbphy node for allwinner have two kind of resources, one for the
phy_ctrl and one per phy. Instead of blindy allocating resources, alloc
the phy_ctrl and pmu ones separately.
Also add a configuration struct for all different phy that hold the difference
between them (number of phys, unknow needed register write etc ...).

While here remove A83T code as upstream and FreeBSD dts don't have
nodes for USB.

This (plus 323640) re-enable OHCI on Pine64 on the bottom USB port.
The top USB port is routed to the OHCI0/EHCI0 which is by default in OTG mode.
While the phy code can handle the re-route to standard OHCI/EHCI we still need
a driver for musb to probe and configure it in host mode.

EHCI is still buggy on Pine64 (hang the board) so do not enable it for now.

Tested On:	Bananapi (A20), BananapiM2 (A31S), OrangePi One (H3) Pine64 (A64)
2017-09-16 15:58:20 +00:00
Emmanuel Vadot
489cba7d58 A64 CCUNG: Correct gate and reset for OHCI0/1
Reported by:	jmcneill
Pointy Hat:	manu
2017-09-16 15:50:31 +00:00
Emmanuel Vadot
082f09757c Allwinner: a10_gpio Fix panic on multiple lock
r323392 introduce gpio_pin_get/gpio_pin_set for a10_gpio driver.
When called via gpio method they must aquire the device lock while
when they are called via gpio_pin_configure the lock is already aquire.

Introduce a10_gpio_pin_{s,g}et_locked and call them in pin_gpio_configure
instead.

Tested On: BananaPi (A20)

Reported by:	Richard Puga richard@puga.net
2017-09-16 14:08:20 +00:00
Ian Lepore
e1275c6805 Add gpio methods to read/write/configure up to 32 pins simultaneously.
Sometimes it is necessary to combine several gpio pins into an ad-hoc bus
and manipulate the pins as a group. In such cases manipulating the pins
individualy is not an option, because the value on the "bus" assumes
potentially-invalid intermediate values as each pin is changed in turn. Note
that the "bus" may be something as simple as a bi-color LED where changing
colors requires changing both gpio pins at once, or something as complex as
a bitbanged multiplexed address/data bus connected to a microcontroller.

In addition to the absolute requirement of simultaneously changing the
output values of driven pins, a desirable feature of these new methods is to
provide a higher-performance mechanism for reading and writing multiple
pins, especially from userland where pin-at-a-time access incurs a noticible
syscall time penalty.

These new interfaces are NOT intended to abstract away all the ugly details
of how gpio is implemented on any given platform. In fact, to use these
properly you absolutely must know something about how the gpio hardware is
organized. Typically there are "banks" of gpio pins controlled by registers
which group several pins together. A bank may be as small as 2 pins or as
big as "all the pins on the device, hundreds of them." In the latter case, a
driver might support this interface by allowing access to any 32 adjacent
pins within the overall collection. Or, more likely, any 32 adjacent pins
starting at any multiple of 32. Whatever the hardware restrictions may be,
you would need to understand them to use this interface.

In additional to defining the interfaces, two example implementations are
included here, for imx5/6, and allwinner. These represent the two primary
types of gpio hardware drivers. imx6 has multiple gpio devices, each
implementing a single bank of 32 pins. Allwinner implements a single large
gpio number space from 1-n pins, and the driver internally translates that
linear number space to a bank+pin scheme based on how the pins are grouped
into control registers. The allwinner implementation imposes the restriction
that the first_pin argument to the new functions must always be pin 0 of a
bank.

Differential Revision:	https://reviews.freebsd.org/D11810
2017-09-10 18:08:25 +00:00
Ian Lepore
094e5e7e12 Switch to iicdev_readfrom/writeto() to do xfers with proper bus ownership.
Tested by:	manu@
2017-08-03 18:43:54 +00:00
Emmanuel Vadot
48ee531892 arm64: Add Allwinner H5 SoC
Allwinner H5 is an H3 (arm32) with Cortex A53 cores.
Add support for it and enable it in GENERIC kernel config

Tested on: OrangePi PC2
2017-08-02 20:19:19 +00:00
Emmanuel Vadot
904581f050 allwiner: modclk: Do not try to enable parent clock if it doesn't exist 2017-08-02 20:17:04 +00:00
Emmanuel Vadot
df8257d71d Allwinner A64: fix typo
'pll_ddr0' is the dram parent, not 'pll_ddr'
2017-07-27 17:51:51 +00:00
Emmanuel Vadot
8460de6783 Allwinner EHCI: Do not fail if we cannot get a phy
If we cannot get a phy, do not detach the driver, some boards have phy
always enabled and not exposed.
While here do not release the clocks if we fails as we release them
in a10_ehci_detach.

Tested-on:	OrangePi-One
2017-07-18 19:50:02 +00:00
Emmanuel Vadot
50bb2d50e8 if_awg: Add "allwinner,sun50i-a64-emac" compatible string.
This enable ethernet on Pine64 with latest DTS.
2017-07-09 12:35:19 +00:00
Emmanuel Vadot
31a8b4896f allwinner: Add A64 ccung support
Upstream DTS for A64 SoC doesn't provide a /clocks node as Linux switched
to ccu-ng
This commit adds the necessary bits to boot on pine64 with latest DTS from
upstream.
USB is not working for now and some node aren't present in the DTS (like the
PMU, Power Management Unit).

Tested on: Pine64
2017-07-03 19:30:03 +00:00
Emmanuel Vadot
7f61394200 Allwinner: Add support for H2 Plus SoC
H2+ SoC is a stripped down version of H3 without gigabit ethernet and 4K HDMI.
Also add sun8i-h2-plus-orangepi-zero.dts to the build as we run on this board.
2017-06-24 16:41:26 +00:00
Emmanuel Vadot
acd690d524 allwinner: Configure pins for DTS >= Linux 4.11
Starting with DTS from Linux 4.11, the pins list, function, drive and pull
are no longer prefixed with "allwinner,".
Allow the pinctrl driver to handle both case.
2017-06-19 06:30:04 +00:00
Andrew Turner
a29b35dd5e Start to rename files with common or generic names to be SoC specific. The
build system doesn't handle two files with the same name.
2017-06-04 09:11:14 +00:00
Ganbold Tsagaankhuu
5657848913 Use hwreset_get_by_ofw_idx() function instead, since there is
no reset-names dts property defined for IR in case of H3 SoC.
That way IR works on H3 SoC based board.
Tested on Orangepi mini 2 board.
2017-04-19 05:59:00 +00:00
Ganbold Tsagaankhuu
64af9561d6 Remove function declaration that doesn't exist. 2017-04-18 06:58:04 +00:00
Ganbold Tsagaankhuu
c8c3a33403 Fix and add comments to match selected frequency sample.
Add debug printfs when bootverbose is used.
No functional changes.
2017-03-25 10:39:24 +00:00
Marius Strobl
55dae242e6 Add and use a MMC_DECLARE_BRIDGE macro for declaring mmc(4) bridges
as kernel drivers and their dependency onto mmc(4); this allows for
incrementing the mmc(4) module version but also for entire omission
of these bridge declarations for mmccam(4) in a single place, i. e.
in dev/mmc/bridge.h.
2017-03-07 22:42:44 +00:00
Marius Strobl
b440e965da o Another round fixes for mmc(4), mmcsd(4) and sdhci(4) regarding
comments, marking unused parameters as such, style(9), whitespace,
  etc.
o In the mmc(4) bridges and sdhci(4) (bus) front-ends:
  - Remove redundant assignments of the default bus_generic_print_child
    device method (I've whipped these out of the tree as part of r227843
    once, but they keep coming back ...),
  - use DEVMETHOD_END,
  - use NULL instead of 0 for pointers.
o Trim/adjust includes.
2017-03-06 23:47:59 +00:00
Emmanuel Vadot
fd8516cc05 allwinner: A31: Add ccung driver
This adds clocks support for the aw_ccung on the A31 SoC.
Newer DTS files require this.
All the clocks except two CSI are defined and exported on the clock domain.
2017-02-28 15:44:21 +00:00
Emmanuel Vadot
b78b8251c9 allwinner: nkmp: Add MUX capability
Some NKMP clocks have a mux options.
Add the capability to aw_clk_nkmp.
2017-02-28 15:11:33 +00:00
Emmanuel Vadot
511d4e58f3 allwinner: NKMP clock: add update bit
The PLL_DDR clock have an update bit which need to be set after changing
the value, add the possibility to define one for NKMP clocks.

This allow us to add the missing clocks.
We now have the full list of clocks created under the clock domain.
2017-02-28 11:38:11 +00:00
Emmanuel Vadot
7a5603c04a allwinner: NM clock: Add value for fixed factor.
The register func for aw_clk_nm didn't copy the value needed for the fixed
factor, resulting in all fixed factor not working on NM clocks.
2017-02-28 11:05:45 +00:00
Emmanuel Vadot
25d9f6e859 allwinner: Correct some clocks name for H3 CCU. 2017-02-27 17:12:17 +00:00
Emmanuel Vadot
a5ae21c50d allwinner: Order clocks by offset rather than by type for H3 ccu.
Also add a few more supported gates and add comments for which clocks
are missing.
2017-02-27 11:10:36 +00:00
Emmanuel Vadot
d7e3f295fa allwinner: Add support for lock and fractional mode on NM clock
Some PLL have a fractional mode and a lock bit.
Add support for it on the NM clock and export the clocks in the clkdom.
2017-02-27 08:58:27 +00:00
Emmanuel Vadot
f5d1d20574 Add clkng driver for Allwinner SoC
Since Linux 4.9-4.10 DTS doesn't have clocks under /clocks but only a ccu node.
Currently only H3 is supported with almost the same state as HEAD.
(video pll aren't supported for now but we don't support video).
This driver and clocks will also be used for other SoC (A64, A31, H5, H2 etc ...)

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D9517
2017-02-26 16:00:20 +00:00
Emmanuel Vadot
58256cf76e Rename timer.c to a10_timer.c
Requested by: andrew
2017-02-07 19:28:32 +00:00
Michal Meloun
93a065e749 Remake support for SMP kernel on UP cpu:
- Use new option SMP_ON_UP instead of (mis)using specific CPU type.
   By this, any SMP kernel can be compiled with SMP_ON_UP support.
 - Enable runtime detection of CPU multiprocessor extensions only
   if SMP_ON_UP option is used. In other cases (pure SMP or UP),
   statically compile only required variant.
 - Don't leak multiprocessor instructions to UP kernel.
 - Correctly handle data cache write back to point of unification.
   DCCMVAU is supported on all armv7 cpus.
 - For SMP_ON_UP kernels, detect proper TTB flags on runtime.

Differential Revision: https://reviews.freebsd.org/D9133
2017-02-02 06:14:44 +00:00
Emmanuel Vadot
cf72965fbf Allwinner: Add A33 support
Add basic support for A33/R16 that is enough to boot a kernel.
This adds the platform code, padconf data and the new clocks strings.

MFC after:	2 weeks
2017-01-04 03:35:39 +00:00
Emmanuel Vadot
338af8a097 Allwinner clk: factor M for mod clock is 4 bits, not 5
MFC after:	1 week
2016-12-22 15:01:06 +00:00
Jared McNeill
06785ff66a Split the DesignWare HDMI-specific code from imx6_hdmi.c into a separate
file and add a generic DT binding that takes advantage of the extres
framework for setting up clocks.

Reviewed by:		gonzo
Differential Revision:	https://reviews.freebsd.org/D8826
2016-12-20 01:34:29 +00:00
Emmanuel Vadot
1e64280173 Honor the CLK_SET_DRYRUN for the *set_freq function for allwinner clocks.
Reviewed by:	jmcneill
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8821
2016-12-16 21:58:48 +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
Emmanuel Vadot
74b66ae149 Fix building arm64 kernel after r310117
Pointy hat: me

MFC after:	3 days
2016-12-15 17:26:16 +00:00
Emmanuel Vadot
15b2342cf3 Add information about interrupts in the Allwinner padconf files and
correct some pin numbering.

While here switch to my freebsd mail address in the copyright.

MFC after:	3 days
2016-12-15 15:52:13 +00:00
Emmanuel Vadot
2b0f0faeb6 Add new compatible string "allwinner,sun7i-a20-mmc".
New upstream DTS is using this now for A20 SoC.

MFC after:	3 days
2016-12-14 15:00:24 +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
def44246f2 PLL3 have a fractional mode where an explicit frequency (297Mhz or 270)
can be selected for it. If the desired frequency is one of those two, use
this mode instead of the integer one.
When calculating the PLL3 freq for the dotclock, check if it is a multiple
of the fracional frequencies.

MFC after:	2 weeks
2016-11-26 10:36:48 +00:00
Emmanuel Vadot
49ba3f32c8 Enable the SCL and SDA i2c line for DDC.
This is an undocumented register that we need to set if we do not want to
rely on u-boot or other bootloader.
2016-11-24 01:24:26 +00:00
Emmanuel Vadot
183a6b3de6 Test that the emac device is enabled in probe function
MFC after:	3 days
2016-11-23 18:07:44 +00:00
Emmanuel Vadot
5e2be2f660 Do not attempt to disable/release clock if it had not been enabled.
While here fix a style(9) issue.

MFC after:	1 week
2016-11-23 01:44:28 +00:00
Jared McNeill
0a30b4b2a5 On H3, initialize alarm and shutdown trip points and do temperature
conversion as it is done in the BSP.
2016-11-19 14:56:22 +00:00
Jared McNeill
ce4e4d612b On command error, reset only DMA and FIFO engines instead of the entire
controller. Fixes eMMC device detection on OrangePi Plus 2e (and likely
others).
2016-11-15 23:48:30 +00:00
Jared McNeill
02b2e3c5fb Allow the MMC frequency to be set up to 52MHz for MMC high speed timings. 2016-11-15 23:46:01 +00:00
Emmanuel Vadot
51503e707b Upstream DTS provides PLL3 and PLL7 nodes (and their x2 form),
so remove them from our DTS and adapt the code to handle them correctly.
This fix HDMI video on A20.
2016-11-15 07:08:33 +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
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
Emmanuel Vadot
328dd395ba Do not fail to attach the clock if we cannot set the assigned parents as this
property isn't mandatory.

MFC after:	2 weeks
2016-11-08 10:06:43 +00:00
Emmanuel Vadot
6988dd5e61 Add support for AXP221 Power Management Unit.
AXP221 is used on board with A31/A31S and is mostly compatible with AXP209.
Regulators, GPIO and Sensors are supported.

MFC after:	2 weeks
2016-11-04 20:02:52 +00:00
Emmanuel Vadot
73e62e8c5c Fix r308306 by spelling variable correctly. 2016-11-04 19:23:52 +00:00
Emmanuel Vadot
1ca819f642 Set rst_apb to NULL to avoid panic when release. 2016-11-04 19:21:11 +00:00
Emmanuel Vadot
e3454ae8b3 For AHB clock we need to set the assigned parents for cpufreq(4) to work.
MFC after:	2 weeks
2016-11-04 17:13:47 +00:00
Jared McNeill
16025c357f Add support for Allwinner H3 audio codec.
The audio controller in the H3 is more or less the same as A10/A20 except
some registers are shuffled around. The mixer interface, however, is
completely different between SoCs. Separate a10_mixer_class and
h3_mixer_class implementations are now made available. This will also make
adding support for other SoCs easier in the future.

Reviewed by:		andrew, ganbold
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D8425
2016-11-03 23:22:04 +00:00
Jared McNeill
e1ca1a284c Add support for the integrated DMA controller found in the Allwinner A31,
A64, A83T, and H3 SoCs.

Relnotes:	yes
2016-11-02 23:58:10 +00:00
Jared McNeill
ddfb3d5aa7 Register the device's xref handle at attach time. 2016-11-02 23:53:47 +00:00
Jared McNeill
5f7cfb6035 Add support for H3 PLL2 (PLL_Audio). 2016-11-02 23:49:57 +00:00
Jared McNeill
8c07f7653a The DTS may report fewer than 4 parents for a module clock. Avoid setting
the module clock parent to an out-of-range index in these cases.
2016-11-02 23:46:23 +00:00
Jared McNeill
bd95d8610a Fix H3 temperature reporting. The formula in for V1.0 of the H3 datasheet
seems to be incorrect, so use the same method of conversion as the H3 BSP
instead.
2016-10-30 14:39:33 +00:00
Ganbold Tsagaankhuu
a6e9118bf4 Add support for Allwinner Consumer IR interface.
RX is supported now and the driver is using evdev framework.
It was tested on Cubieboard2 (A20 SoC) using lirc
with dfrobot's IR remote controller.
2016-10-27 04:26:33 +00:00
Andrew Turner
f1ae17fb50 Use the new fdt_intr.h constants in the Allwinner NMI driver.
Sponsored by:	DARPA, AFRL
2016-10-26 16:03:26 +00:00
Andrew Turner
87e1355ba5 Define the Allwinner PLL FDT constants in the file that uses them rather
than including a file from under sys/gnu.

Sponsored by:	DARPA, AFRL
2016-10-26 14:09:30 +00:00
Emmanuel Vadot
1535414c25 The only consumer of pll1 is the CPU clock, we don't need to set it glitch free.
Reported by:	jmcneill
MFC after:	1 week
2016-10-26 08:47:35 +00:00
Emmanuel Vadot
6a9f23793d allwinner A10 Pll1 allow changing freq
PLL1 is used by the cpu core, allowing changing freq is needed for cpufreq.
The factors table contains all the frequencies in the operating point table
present in the DTS.

MFC after:	1 week
2016-10-25 15:21:08 +00:00
Jared McNeill
2e4f934752 Defer cpufreq updates from intr handler to the taskqueue_thread queue. 2016-10-24 22:35:12 +00:00
Emmanuel Vadot
cd2b868b5d allwinner: Add support for P2WI in RSB driver
Push-Pull Two Wire interface is a almost compatible iic like bus used
in sun6i SoC. It's only use is to communicate with the power management IC.

Reviewed by:	jmcneill
MFC after:	1 week
Relnotes:	yes
2016-10-24 20:33:42 +00:00
Emmanuel Vadot
2c3b1e3c42 Revert 307822
P2WI is almost compatible with RSB which we already support.
I'll add support for P2WI in aw_rsb instead.

Discussed with:	 jmcneill
2016-10-24 14:24:12 +00:00
Jared McNeill
3c2b90f1d1 Throttle CPU frequency when hot temperature threshold has been reached to
prevent overheating.

When sensor 0's alarm interrupt is fired, set a throttle flag. Further
requests to set CPU frequency will be rejected until sensor 0's temperature
returns to a level below the hot temperature threshold.

Relnotes:	yes
2016-10-23 17:48:34 +00:00
Emmanuel Vadot
0b194aca21 allwinner: Add support for P2WI bus
P2WI (Push-Pull Two Wire Interface) is an I2C-like bus used in sun6i SoC
for talking to power management unit IC.
2016-10-23 12:48:09 +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
Jared McNeill
63f6b1a75a aw_ccu on H3 needs access to PRCM space. The r_pio controller works now. 2016-10-16 12:55:31 +00:00
Emmanuel Vadot
b3d4851e86 axp209: Add support for regulators
Except for LDO4, all regulators are supported.

MFC after:	1 week
2016-10-15 17:49:41 +00:00
Jared McNeill
3c6a684c11 Match "allwinner,sun8i-h3-apb0-gates-clk" compatible string. 2016-10-15 13:27:01 +00:00
Jared McNeill
2ee32f3c7f Provide a complete A23 PLL1 factor table, from 60MHz to 1872MHz. 2016-10-15 12:23:54 +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
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
Andrew Turner
18f555023a Remove the old Allwinner std.* files, these are not part of the common
Allwinner kernel configs.

Sponsored by:	ABT Systems Ltd
2016-10-03 16:47:46 +00:00
Michal Meloun
b58616d5d7 ALLWINNER: ahci_devclass is local variable, don't export it. 2016-09-30 05:30:16 +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
Emmanuel Vadot
2fb194c968 a10_mmc: Remove completly the PIO code now all access is done by DMA.
Rename registers as in the manual.
Do a hard reset of the controller before a soft one.
Since DMA is always used remove dependancy on allwinner_soc_family, it was used
to differentiate SoC as the fdt compatible string were the same.

Tested on A10, A20, H3 and A64.

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D6868
2016-09-10 17:45:35 +00:00
Jared McNeill
b78c83e321 Add support for Allwinner A83T CPU frequency scaling. 2016-09-07 01:10:16 +00:00
Jared McNeill
b3868b9f16 Attach later so axp81x attaches after aw_nmi. 2016-09-07 01:09:25 +00:00
Jared McNeill
22a07618ae Add sy8106a to Allwinner kernel. This regulator is used to control VDD_CPUX
and is connected to R_TWI on some H3-based Orange Pi boards.
2016-09-05 13:45:45 +00:00
Jared McNeill
a995bf1b7d Add support for Allwinner H3 PLL_CPUX.
The H3 PLL_CPUX register looks exactly like the one found in A23, but we
need to follow a specific protocol when making adjustments to the clock.
2016-09-05 12:36:54 +00:00
Jared McNeill
4e7f43bab6 Add support for the Allwinner H3 Thermal Sensor Controller. The H3 embeds
a single thermal sensor located in the CPU.
2016-09-05 11:05:14 +00:00
Jared McNeill
1403e695b7 Use the root key in the Security ID EFUSE (when valid) to generate a
MAC address instead of creating a random one each boot.
2016-09-03 15:28:09 +00:00
Jared McNeill
d69d5ab04f Add support for Allwinner A64 thermal sensors. 2016-09-03 15:26:00 +00:00
Jared McNeill
0503b90dde Add support for reading root key on A83T/A64. 2016-09-03 15:22:50 +00:00
Jared McNeill
1396b52e55 Add support for changing A23 PLL1 frequency. 2016-09-01 21:20:07 +00:00
Jared McNeill
e8ca6c4d83 Add support for setting DCDC2 voltage. 2016-09-01 21:19:11 +00:00
Jared McNeill
63dc81d861 Add support for Allwinner A64 USB PHY.
Reviewed by:	manu
2016-08-31 10:45:53 +00:00
Jared McNeill
c60d891c4f Add support for Allwinner A64 watchdog timer. 2016-08-30 10:21:32 +00:00
Jared McNeill
7f4b51c6f0 Add support for Allwinner A64 PLL_PERIPH0/PLL_PERIPH1 and PLL_HSIC clocks.
Reviewed by:	andrew, manu
2016-08-25 10:29:41 +00:00
Jared McNeill
30a0ebdb1c Switch parent clock when setting frequency if a new parent is a better
candidate for the target rate.

Reviewed by:	andrew, manu
2016-08-25 10:27:22 +00:00
Jared McNeill
1ff131af88 Add support for Allwinner multi-parent bus gates.
Reviewed by:	andrew, manu
2016-08-25 10:24:14 +00:00
Jared McNeill
224a4b630b Expose DC1SW as a regulator switch. On Pine64 this is used to control EMAC
PHY power.

Reviewed by:	andrew, manu
2016-08-25 10:20:27 +00:00
Jared McNeill
ef61a34ae8 Remove dependency on allwinner_soc_family() as it is not available on arm64.
Reviewed by:	andrew, manu
2016-08-25 10:14:56 +00:00
Emmanuel Vadot
1f3b7bbb56 Allwinner: Add thermal sensor driver for A10/A20
The thermal sensor lives in the touch screen controller. Touch screen part
isn't done for now.
Temperature is read every ~2 seconds and exposed via sysctl.
2016-08-23 22:26:50 +00:00
Emmanuel Vadot
728af0b7fc Do not include file from dt-bindings and simply use the already present defines.
Reported by:	jmcneill
MFC after:	1 week
2016-08-23 00:46:22 +00:00
Emmanuel Vadot
f8fc698b0d allwinner: Remove a20/a20_cpu_cfg.c from the build.
This was needed when we used the SoC specific timer and not the generic-timer.
2016-08-21 16:03:44 +00:00
Emmanuel Vadot
bee987e3c8 if_emac: Before generating a random MAC address, try using the SID rootkey
to generate one. This is was U-Boot does to generate a random MAC so we end
up with the same MAC address as if U-Boot did generate it.

MFC after:	1 week
2016-08-19 23:44:07 +00:00
Emmanuel Vadot
c8442223b6 Allwinner: Move a10_padconf.c into a10 subdirectory. 2016-08-19 12:48:32 +00:00
Emmanuel Vadot
d00d8ed84f Rename allwinner_machdep.{c.h} to aw_machdep.{c.h} as all allwinner source
files are name aw_*
2016-08-17 21:44:02 +00:00
Emmanuel Vadot
627ea1e104 Rename kernel config A10 into ALLWINNER_UP as it is intend to work with all
Allwinner Uniprocessor SoC.
As of now it works with A10 and A13 (and possibly R8 as it is the same as the A13).
Move files.a10 into a1o subdirectory as it should be.
Rename std.a10 into std.allwinner_up
2016-08-17 20:32:08 +00:00
Emmanuel Vadot
7dc8d93acb Only set pud settings if this is a pullup or pulldown configuration.
This removes the need to set the MMC pins with pullups in our DTS.
Thanks to jmcneill@ for spotting this.

Tested on Orange Pi One (Allwinner H3).

MFC after:	1 week
2016-08-17 13:09:31 +00:00
Emmanuel Vadot
4943ecf438 a10_gpio_get_function now returns the whole function not only
GPIO_INPUT/GPIO_OUTPUT.
a10_gpio_get_pud now returns the whole pud not only PULLDOWN/PULLUP.
Add a10_gpio_get_drv to get the current drive strenght.
During fdt pin configure, avoid setting function/drive/pud if it's already in
the correct value.

Tested on Allwinner H3 and A20

MFC after:	1 week
2016-08-17 10:20:36 +00:00
Emmanuel Vadot
29f11c7d8b Correct the size of the softc in a10_ehci
Reported by:	andrew
MFC after:	1 week
2016-08-14 13:17:59 +00:00
Emmanuel Vadot
80ab358ee4 We need aw_nmi to be attached which needs GIC so attach a bit later.
Also the GPIOC doesn't need to be attach early

Reviewed by:	andrew
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7082
2016-08-03 18:45:56 +00:00
Emmanuel Vadot
1c26086e73 PC5 doesn't have mmc2 function. 2016-07-22 14:39:55 +00:00
Emmanuel Vadot
852047d66a axp209 needs aw_nmi so attach a bit earlier
Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D7081
2016-07-21 13:28:07 +00:00
Emmanuel Vadot
be79f382c8 We need the GIC to be attached so attach later at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE
Reviewed by:	andrew
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7080
2016-07-21 13:26:39 +00:00
Emmanuel Vadot
280ab2edb1 Add support for the SID (Security ID Module) on Allwinner A10 and A20.
The rootkey is burnt at production and can't be changed, thus is can be used
as a device unique ID or to generate a MAC address (This is was u-boot does).
The rootkey is exposed as a sysctl (dev.aw_sid.<unit>.rootkey).

Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D6383
2016-07-20 11:23:06 +00:00
Jared McNeill
01a469b860 Add support for Allwinner H3 EMAC.
H3 EMAC is the same as A83T/A64 except the SoC includes an (optional)
internal 10/100 PHY. Both internal and external PHYs are supported on H3
with this driver.
2016-07-16 18:06:41 +00:00
Jared McNeill
169285288c Allwinner Gigabit EMAC performance improvements.
- Support DEVICE_POLLING
 - Increase TX descriptors to 1024
 - Add support for passing a chain of mbufs to if_input, reducing the
   number of calls to mtx_unlock/mtx_lock under load.
 - Remove duplicate byteswap when setting TX_INT_CTL in TX descriptor.
 - Set undocumented "TX_NEXT_FRAME" bit in TX control 1 register.
   According to the A83T BSP, setting this bit allows the DMA engine to
   operate on a packet while receiving another.

Tested on A83T (1000Mbps PHY) and H3 (100Mbps PHY).

Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D7031
2016-07-13 20:46:54 +00:00
Jared McNeill
814f548cd5 H3/A83T: Use PLL_PERIPH/2 for AHB2 parent clock.
Reviewed by:	manu
2016-07-13 20:44:02 +00:00
Jared McNeill
9f2b8101d7 Add support for Allwinner A64.
Reviewed by:	andrew, manu
2016-07-11 20:15:46 +00:00
Jared McNeill
d1d50b7010 Return early from bus_dmamap_load callback if the error indicator is set.
Reviewed by:	andrew, manu
2016-07-11 20:14:50 +00:00
Jared McNeill
d40e52436e Add support for arm64. The allwinner_soc_family() function is not available
on arm64 and all SoCs using the old FIFO register location are 32-bit only,
so unconditionally use the new location for arm64.

Reviewed by:	andrew, manu
2016-07-11 20:13:46 +00:00
Jared McNeill
2d36de5fb7 Add support for Allwinner A64 CPUx-PORT and CPUs-PORT Port Controllers.
Reviewed by:	andrew, manu
2016-07-11 20:09:17 +00:00
Jared McNeill
25cd5941be Add Allwinner A64 padconf settings.
Reviewed by:	andrew, manu
2016-07-11 20:06:21 +00:00
Jared McNeill
2274551aba Include sys/rman.h to fix build on arm64. 2016-07-11 20:03:31 +00:00
Jared McNeill
221a9d6dd6 Attach RSB early. Children of RSB may provide resources necessary for
other devices such as interrupts, GPIOs, and regulators.
2016-07-11 20:02:51 +00:00
Jared McNeill
7dd6227263 Build fix for arm64. The phy interface uses intptr_t for the "phy"
parameter, not int.
2016-07-11 20:00:57 +00:00
Jared McNeill
18c3530813 Remove unused bus_space prototypes. 2016-07-11 19:58:00 +00:00
Michal Meloun
dac935533b EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions.
In some cases, the driver must handle given properties located in
specific OF subnode. Instead of creating duplicate set of function, add
'node' as argument to existing functions, defaulting it to device OF node.

MFC after: 3 weeks
2016-07-10 18:28:15 +00:00
Jared McNeill
22a81821b0 Align descriptors and data buffers to 32 bits. This restriction is
described in the A20 (and later) user manuals.
2016-07-10 10:38:28 +00:00
Jared McNeill
6964917c0e In the absence of a bus-width property, default to 4-bit bus width instead
of 1-bit.
2016-07-10 10:21:22 +00:00
Emmanuel Vadot
356c50adff Add support for Allwinner A13.
Reviewed by:	jmcneill
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D6809
2016-07-08 23:38:25 +00:00
Emmanuel Vadot
f8f34e91da Check that the pin function exists before setting it.
This is needed for Allwinner A13 which has gpio pins with only "out" function.
2016-07-08 23:08:59 +00:00
Jared McNeill
b8f34c287a Fix a crash while iterating compat strings when no match is found.
Spotted by:	ian
2016-05-31 21:58:09 +00:00
Emmanuel Vadot
30068a1de9 Add support for interrupts, sensors and GPIO for AXP209 PMIC.
Pressing the PEK (power enable key) will shutdown the board.
Some events are reported to devd via system "PMU" and subsystem
"Battery", "AC" and "USB" such as connected/disconnected.
Some sensors values (power source voltage/current) are reported via
sysctl (dev.axp209_pmu.X.)
It also expose a gpioc node usable in kernel and userland. Only 3 of
the 4 GPIO are exposed (The GPIO3 is different and mostly unused on
boards). Most popular boards uses GPIO1 as a sense pin for OTG power.
Add a dtsi file that adds gpio-controller capability to the device as
upstream doesn't defined it and include it in our custom DTS.

Reviewed by:	jmcneill
Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D6135
2016-05-26 21:09:07 +00:00
Jared McNeill
627c360fa7 Enable USB PHY regulators when requested by the host controller driver.
Previously the USB PHY driver would enable all regulators at attach time.
This prevented boards from booting when powered by the USB OTG port, as
it didn't take VBUS presence into consideration.
2016-05-26 10:50:39 +00:00
Luiz Otavio O Souza
9d6672e13b Fix the deciKelvin to Celsius conversion in kernel.
After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by:	Rubicon Communications (Netgate)
2016-05-22 13:58:32 +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
Emmanuel Vadot
d71896a76a Add driver for "generic-ohci" as defined by FDT.
If platform support EXT_RESOURCES, clocks and resets are handled out of
the box.
If not driver can be subclassed using the generic_usb interface.
generic_usb name was choosed because at one point I'll add generic-ehci
FDT driver.

Reviewed by:	jmcneill, hselasky
Approved by:	andrew (mentor)
Differential Revision:	https://reviews.freebsd.org/D5481
2016-05-17 17:46:12 +00:00
Eitan Adler
cef367e6a1 Don't repeat the the word 'the'
(one manual change to fix grammar)

Confirmed With: db
Approved by: secteam (not really, but this is a comment typo fix)
2016-05-17 12:52:31 +00:00
Jared McNeill
343044c43b Add Allwinner A83T thermal sensor controller support.
The A83T thermal sensor controller has three sensors. Sensor 0 corresponds
to CPU cluster 0, sensor 1 to CPU cluster 1, and sensor 2 to the GPU. This
driver exports the temperature sensor readings via sysctl.

Calibration data is obtained from SRAM found in the Secure ID module.

Reviewed by:		manu
Differential Revision:	https://reviews.freebsd.org/D6378
2016-05-15 22:36:55 +00:00
Jared McNeill
6a94069a5e Reduce complexity of RSB by always using polling mode. Unfortunately
gpiobus methods can be called with non-sleepable locks held.

Reviewed by:	mmel
2016-05-15 16:43:47 +00:00
Jared McNeill
fafd846c91 Add support for the AXP813/AXP818 power key and GPIO pins. 2016-05-15 15:54:41 +00:00
Jared McNeill
37cc9a031b Allow RSB to be used from interrupt handlers.
The driver uses polling mode if cold or !THREAD_CAN_SLEEP() and now
implements the bus_* interface.
2016-05-15 15:52:34 +00:00
Jared McNeill
eceba010ba Add and enable Allwinner RSB and AXP81x power management IC drivers. 2016-05-14 23:34:57 +00:00
Jared McNeill
ceba82fdf5 Add a basic driver for X-Powers AXP813 and AXP818 power management ICs.
This driver simply installs a shutdown event handler for handling
RB_POWEROFF at shutdown. Tested on a Sinovoip BananaPi BPI-M3.
2016-05-14 23:33:57 +00:00
Jared McNeill
4b9a54a9fc Add a driver for the Allwinner Reduced Serial Bus (RSB).
The RSB controller speaks a simplified two wire protocol at speeds up to
20MHz. It is used on sun8i and sun9i family SoCs to communicate with
power management ICs.

RSB isn't really I2C or SMBus, but the driver exposes an iicbus interface
to simplify power management IC drivers (which may need to support both
RSB and I2C connectivity).
2016-05-14 23:27:54 +00:00
Oleksandr Tymoshenko
39a997283f Use OF_prop_free instead of direct call to free(9)
Approved by:	jmcneill
2016-05-13 22:28:02 +00:00
Emmanuel Vadot
0aa4b81381 Add support for Allwinner H3 SoC.
For now clocks, GPIO, Pinmux, UART, MMC, EHCI is supported.
Tested on OrangePi-One

Reviewed by:	jmcneill
Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D6311
2016-05-13 18:20:54 +00:00
Emmanuel Vadot
498b9fa710 Merge a20_mp_start_ap and a31_mp_start_ap into one function.
This function works with all smp non-multicluster allwinner SoC (A20, A31, A31S and H3).

Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D6269
2016-05-10 18:00:37 +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
Jared McNeill
8a0fd1a7cd Add support for the Allwinner A83T (sun8iw6p1) SoC.
Clocks, GPIO, UART, SD card / eMMC, USB, watchdog, and ethernet are
supported. Note that the A83T contains two clusters of four Cortex-A7
CPUs, and only CPUs in first cluster are started for now.

Tested on a Sinovoip Banana Pi BPI-M3.
2016-05-05 09:41:57 +00:00
Jared McNeill
d3810ff91c Add driver for Allwinner A83T/H3/A64 Gigabit Ethernet.
The datasheets refer to this controller as EMAC, not to be confused with
the fast ethernet controller (also named EMAC) found in A10/A20 SoCs.

Tested on a BananaPi M3 (A83T), which uses an external RGMII PHY (RTL8211E).

Reviewed by:		adrian
Differential Revision:	https://reviews.freebsd.org/D6169
2016-05-04 20:06:20 +00:00
Emmanuel Vadot
22d6365976 ACK the interrupt after disabling it, this avoid an interrupt storm.
Approved by:	andrew (mentor)
2016-04-30 18:07:13 +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
Emmanuel Vadot
30c05743c4 Add support for the Non-maskable interrupt driver found in the Allwinner A20 and A31 SoCs.
This is normally used for the PMU.

Reviewed by:	andrew
Approved by:	andrew (mentor)
Differential Revision:	https://reviews.freebsd.org/D5663
2016-04-27 20:49:57 +00:00
Jared McNeill
39fe39bca9 Fix calculation of LCD CH1 SCLK1 output frequency when SCLK2 /2 is used
as source.

PR:		208680
Reported by:	David Binderman <dcb314@hotmail.com>
2016-04-26 12:36:12 +00:00
Jared McNeill
fc0424631d Add support for 8-bit eMMC.
Set MMC_CAP_4_BIT_DATA and MMC_CAP_8_BIT_DATA based on the "bus-width"
DT property and reduce maximum bus frequency from 52MHz to 50MHz to match
the capabilities of the clock provider.

Tested on a BananaPi BPI-M3 (A83T).
2016-04-26 12:02:36 +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
Emmanuel Vadot
75bf4f5a11 Convert A10 interrupt controller to INTRNG
Reviewed by:	skra
Approved by:	cognet (mentor)
Differential Revision:	https://reviews.freebsd.org/D5573
2016-04-26 11:15:48 +00:00
Jared McNeill
013cb2e961 Add support for Allwinner A31/A31S R-GPIO (CPUs-PORT) controller.
Submitted by:		Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:		jmcneill
Differential Revision:	https://reviews.freebsd.org/D5930
2016-04-23 13:59:18 +00:00
Jared McNeill
473bbf691b Replace the A20 kernel config with a generic ALLWINNER kernel config that
supports A20, A31, and A31S. Adds support for the BananaPi M2 (A31S) board.

Submitted by:		Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:		jmcneill
Differential Revision:	https://reviews.freebsd.org/D5580
2016-04-21 16:49:04 +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
Jared McNeill
a09ecc1326 Enable PHY regulator when the optional "phy-supply" property is present.
Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
2016-04-09 11:23:46 +00:00
Jared McNeill
222947a742 Fix incorrect pin definitions for Allwinner A31. 2016-04-08 23:11:00 +00:00
Jared McNeill
65d6a5a446 Attach hwreset resources at the same time as clock resources. 2016-04-08 23:07:16 +00:00
Jared McNeill
ce45969226 Add function for mapping SRAM-D area to USB0 (OTG) controller. Use a lower
pass number to ensure that this driver is loaded before EMAC or OTG,
regardless of the order of nodes in the DT.
2016-04-08 10:54:59 +00:00
Jared McNeill
43b227c89f Match on compatible string "allwinner,sun4i-a10-sram-controller" instead of
"allwinner,sun4i-sramc", to match upstream DTS.
2016-04-08 00:01:19 +00:00
Jared McNeill
6a05f063ed Convert Allwinner port to extres clk/hwreset/regulator APIs.
Reviewed by:		andrew, gonzo, Emmanuel Vadot <manu@bidouilliste.com>
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5752
2016-04-06 23:11:03 +00:00
Jared McNeill
bfba653b0e Improve HDMI display detection by searching the CEA-861 extension block for
an HDMI vendor-specific data block (VSDB) containing the HDMI 24-bit IEEE
registration ID (0x000C03).

Approved by:	gonzo (mentor)
2016-04-02 16:53:12 +00:00
Andrew Turner
bdb976c4a3 Only define the platform methods for the Allwinner platforms we are
building for.

Sponsored by:	ABT Systems Ltd
2016-03-26 17:49:46 +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
Michal Meloun
f645a5d9c7 A20: Gpiobus can be attached only after full gpio driver initialization.
While i'm in, remove now unused global variable.

Submited by:	Emmanuel Vadot <manu@bidouilliste.com>
2016-03-17 08:57:41 +00:00
Jared McNeill
f7f2f3a975 Fix display output for non-HDMI display devices.
Only set the display to HDMI mode if a CEA-861 extension block was found
on the connected display.

PR:		207912
Approved by:	gonzo (mentor)
2016-03-13 01:47:42 +00:00
Andrew Turner
f4df324224 Add SMP support for the Allwinner A31 and A31s. This updated the existing
code for the A20 to use the new PLATFORM_SMP interface, and extends it to
add support for the new SoCs allowing for both to coexist within the same
kernel.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D5342
2016-03-06 11:41:08 +00:00
Andrew Turner
c794871343 Add support to enable/disable both the EHCI and OHCI Allwinner clocks. This
adds a lock to ensure only a single device is accessing the hardware. A
reference count is added to only enable when we start to use the clock,
and to disable after we have finished needing the clock.

This was extracted from a larger review to add OHCI support to the
Allwinner SoCs.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:	jmcneill
X-Differential Revision:	https://reviews.freebsd.org/D5481
2016-03-05 13:17:53 +00:00
Jared McNeill
7bf46e12dd Add support for Allwinner A31 RTC controller.
Very similar to the A10 RTC controller with a few register offsets changed
and a different location for the LOSC switch status.

Submitted by:		Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:		jmcneill
Approved by:		adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5500
2016-03-03 22:19:39 +00:00
Jared McNeill
1b4bd0235e Add support for Allwinner A31/A31s EHCI controller and USB PHY.
Reviewed by:		andrew, Emmanuel Vadot <manu@bidouilliste.com>
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5467
2016-03-01 22:54:30 +00:00
Jared McNeill
3f3af790f9 Add Allwinner A10/A20 RTC driver.
Submitted by:		Vladimir Belian <fate10@gmail.com>
Reviewed by:		andrew, imp, jmcneill
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5414
2016-02-28 17:42:27 +00:00
Jared McNeill
ce6507d3d9 Fix PIO mode on A31 and later SoCs.
Newer Allwinner MMC implementations use a different FIFO register offset
(0x200 instead of 0x100). Since the FDT uses the same compat string for
both cases, base the decision on which FIFO offset to use on the Allwinner
SoC family.

Reviewed by:		Emmanuel Vadot <manu@bidouilliste.com>
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5468
2016-02-27 22:26:05 +00:00
Jared McNeill
81e802c14b Fix inverted test for lock status while waiting for PLL to become stable.
Reviewed by:	andrew
Approved by:	adrian (mentor)
2016-02-26 20:33: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
461a7671c7 Add the start of support for the Allwinner A31 clocks. It only adds
support for the i2c, mmc, and gmac clocks. Further clocks can be added as
needed.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Reviewed by:	jmcneill
Differential Revision:	https://reviews.freebsd.org/D5339
2016-02-26 13:53:09 +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
Jared McNeill
dd03610a2e Add Allwinner A20 HDMI support.
The HDMI driver will attach a framebuffer device when a display is
connected. If the EDID can be read and contains a preferred mode, it
will be used. Otherwise the framebuffer will default to 800x600.

In addition, if the EDID contains a CEA-861 extension block and the
"basic audio" flag is set, audio playback at 48kHz 16-bit stereo is
enabled on the controller.

Reviewed by:		andrew
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5383
2016-02-25 20:17:18 +00:00
Andrew Turner
7ea3f5b654 Add support for the Allwinner A31 watchdog to the existing A10 watchdog
driver. This mostly involves selecting the register offsets to use at
runtime based on the hardware we are talking to.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5327
2016-02-25 16:50:36 +00:00
Andrew Turner
ccf8caad14 Add the Allwinner A31 and A31s padconf support. It's currently unused, but
will be needed when we bring in further support for these SoCs.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5340
2016-02-25 12:17:41 +00:00
Jared McNeill
6da9071523 Fix dedicated DMA transfers.
For sources and destinations marked "noincr", the previous code was
incorrectly programming the dedicated DMA channel control register
using bit definitions for normal DMA channels. This code path is not
currently used, but will be used by the HDMI audio driver in review.

Reviewed by:		andrew
Approved by:		gonzo (mentor)
Differential Revision:	https://reviews.freebsd.org/D5382
2016-02-25 01:24:02 +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
0bd11ac8f9 Add initial support for the Allwinner A31i and A31s. This just adds the
FDT platform code to detect when we are booting on one of these SoCs. The
driver changes will be added shortly.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5338
2016-02-19 14:15:31 +00:00
Andrew Turner
4b68de9c1a Move the Allwinner kernels to use fdt_pinctrl. This will read the pin
configuration from the FDT data, then set the pins into the requested
state. As part of this the gpio controller now reports the correct number
of pins instead of returning the number of bank * 32.

To allow for a future consolidated kernel we add the SOC_ALLWINNER_A10 and
SOC_ALLWINNER_A20 kernel options. These need to be set as appropriate for
the SoC the kernel will boot on.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D5177
2016-02-17 18:28:03 +00:00
Andrew Turner
86914a0f9b Add a sysctl to read the internal temperature of the AXP209 Power
Management IC.

Submitted by:	Jared McNeill <jmcneill@invisible.ca>
Differential Revision:	https://reviews.freebsd.org/D5298
2016-02-16 11:51:54 +00:00
Andrew Turner
ba9b71631d Add an analog audio driver for the audio codec found on the Allwinner
A10/A20 SoC. Based loosely on the submitters NetBSD driver, tested on
Cubieboard 2. Playback and capture are supported.

Submitted by:	Jared McNeill <jmcneill@invisible.ca>
Differential Revision:	https://reviews.freebsd.org/D5202
2016-02-16 11:45:46 +00:00
Andrew Turner
276b1ac928 Only read the power state register when we will be using its value. While
here remove magic shifts, and cleanup pwr_name.

Sponsored by:	ABT Systems Ltd
2016-02-16 11:03:21 +00:00
Andrew Turner
501ce0d86b Add support for the Allwinner DMA controller. This will be used by the at
least the audio codec driver currently in review.

Submitted by:	Jared McNeill <jmcneill@invisible.ca>
Differential Revision:	https://reviews.freebsd.org/D5050
2016-02-15 19:56:35 +00:00
Andrew Turner
2ff143af3f Add support for the AXP209 Power System Management IC. This allows boards
with this and an Allwinner SoC to power off.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D4954
2016-02-15 19:31:23 +00:00
Andrew Turner
5f250b53e8 Add support for the Allwinner i2c device. This is similar to the existing
Marvell twsi part, however uses different register locations, as such split
the existing driver into Marvell and Allwinner attachments.

While here clean a few style issues.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D4846
2016-02-15 15:11:26 +00:00
Andrew Turner
907fe11655 Update of the Allwinner drivers to:
* Use the Linux compat string
 * Use EARLY_DRIVER_MODULE to attach at the right time
 * Add a generic A10 kernel config file
 * A20 now use generic_timer
 * Add two new dts files for Olimex boards
 * Update our custom DTS file for A10 and A20 to use the same compatible
   property names as the vendor ones.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
Differential Revision:	https://reviews.freebsd.org/D4792
2016-02-10 09:19:29 +00:00
Andrew Turner
23da15d045 Remove unneeded whitespace, and fix a license for a new file. Extracted
from a larger patch.

Submitted by:	Emmanuel Vadot <manu@bidouilliste.com>
X-Differential Revision:	https://reviews.freebsd.org/D4792
2016-02-09 18:19:24 +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
Andrew Turner
c9a608ac3f Add allwinner_machdep.h, it was missed in r294698. 2016-01-25 08:19:16 +00:00
Andrew Turner
d8b624dcab Update the Allwinner kernels:
* Use the ARM PLATFORM framework
 * Use ARM_INTRNG on teh A20 as it has a GICv2
 * Add a method to find which Allwinner SoC we are running on

Differential Revision:	https://reviews.freebsd.org/D5059
2016-01-25 00:24:57 +00:00
Andrew Turner
b4733230c9 Remove an extra newline that crept in. 2016-01-24 19:12:16 +00:00
Andrew Turner
aea7d91520 Add support for controlling the clocks for the audio codec and DMA engines.
Submitted by:	Jared McNeill <jmcneill@invisible.ca>
Differential Revision:	https://reviews.freebsd.org/D5052
2016-01-24 19:10:30 +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
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
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
ea8b18848f Add the A20 glue code for if_dwc.
This code initializes the GMAC clock and sets the pin mux to rgmii.

It also override the if_dwc defaults to set the alternate descriptor type
and MII clock used on A20.

Tested on cubieboard2 and banana pi.
2015-09-21 01:51:37 +00:00
Luiz Otavio O Souza
fbb065700c The vendor's DTS for Allwinner A20 uses a different way to map the gpio
pins, they specify the bank and the pin in two separated cells.

This allow the use of vendor's DTS definitions by adding a gpio map
routine that copes with that.
2015-08-30 22:38:06 +00:00
Luiz Otavio O Souza
fb54940587 Bring a few simplifications to a10_gpio:
o Return the real hardware state in gpio_pin_getflags() instead of keep
   the last state in an internal table.  Now the driver returns the real
   state of pins (input/output and pull-up/pull-down) at all times.
 o Use a spin mutex.  This is required by interrupts and the 1-wire code.
 o Use better variable names and place parentheses around them in MACROS.
 o Do not lock the driver when returning static data.

Tested with gpioled(4) and DS1820 (1-wire) sensors on banana pi.
2015-07-13 18:19:26 +00:00
Luiz Otavio O Souza
a8921b867f Return the FDT node of the GPIO controller to gpiobus. It is used by the
children of gpiobus.
2015-07-11 21:09:43 +00:00
Luiz Otavio O Souza
50ad20b383 Add the routines to activate the GMAC clock and setup the GMAC mode.
Tested on Cubieboard 2 and Banana pi.
2015-07-03 18:39:25 +00:00
Luiz Otavio O Souza
9639a6c7c9 Rename a10_emac_gpio_config() to a10_gpio_ethernet_activate() to make the
change to GMAC easier on A20 SoCs.

On A10 only the EMAC controller is available (fast ethernet), but on A20
there is also GMAC a high (or better) performant controller (gigabit
ethernet).

On A20 the both controllers uses the same pins to talk to the ethernet PHY
(MII or RGMII) and they can be selected by the GPIO pin mux.

There is work in progress to bring in GMAC support.
2015-07-03 17:54:41 +00:00
Luiz Otavio O Souza
2e33d3583d Remove duplicate and unnecessary includes.
While here remove an unused and wrong define.
2015-07-03 17:09:27 +00:00
Luiz Otavio O Souza
7ec8c789c3 Add AHCI attachment code for Allwinner A10/A20 SoCs.
The Allwinner SoC has an AHCI device on its internal main bus rather
than the PCI bus.  This SoC is somewhat underdocumented, and its SATA
controller is no exception.  The methods to support this chip were
harvested from the Linux Allwinner SDK, and then constants invented to
describe what's going on based on low-level constants contained in the
SATA standard and guess work.

This SoC requires a specific AHCI channel setup in order to start the
operations on the channel properly.

Clock setup and AHCI channel setup idea came from NetBSD.

Tested on Cubieboard 2 and Banana pi (and attachment on Cubieboard by
Pratik Singhal).

Differential Revision:	https://reviews.freebsd.org/D737
Submitted by:	imp
Reviewed by:	imp, ganbold, mav, andrew
2015-07-03 14:11:01 +00:00
Luiz Otavio O Souza
5ee00411e4 Add DMA support for Allwinner MMC controller.
DMA handles all data transfers up to 128K or 16 segments and fallback to
pio mode when DMA requirements are not met.

The read performance has improved greatly while the write performance also
showed some improvement but seems limited by the card type and quality.

Submitted by:	Pratik Singhal <pratiksinghal@freebsd.org>
Sponsored by:	Google Summer of Code 2015
Tested on:	A10 (cubieboard) and A20 (cubieboard 2 and banana pi)
2015-07-01 23:27:01 +00:00
Luiz Otavio O Souza
6a11fa4e31 Add the MMC/SD driver for Allwinner SoCs.
This is based on the patch sent by Alexander Fedorov with the following
fixes/improvements:

 - Better error handling;
 - Clock is derived from PLL6 (obtained from netbsd);
 - No more unnecessary busy loops on interrupt handler;
 - style(9) fixes and code cleanup.

I also want to thanks Martin Galvan who has sent an alternative
implementation with some interesting fixes.

Tested on CubieBoard2, Banana-Pi (thanks to netgate!) and Cubieboard1
(Pratik Singhal).

This is intended to pave the way for the upcoming GSoC work (and make
easier the build of images for the supported boards).

PR:		196081
Submitted by:	Alexander Fedorov <alexander.fedorov@rtlservice.com>
2015-05-21 17:39:42 +00:00
Andrew Turner
e4ca149905 Add the gic to files.arm under "device gic" and use it with the
CUBIEBOARD2 config. This is common across a few SoCs so should be a common
option.
2015-05-10 09:33:03 +00:00
Andrew Turner
70ad407c86 Clean up the style to use "options<space><tab>". 2015-05-10 08:48:00 +00:00