aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/mpc85xx
Commit message (Collapse)AuthorAgeFilesLines
* Remove dead errata fixup codeJustin Hibbits2018-05-013-119/+0
| | | | | | | | | | This code caused more problems than it should have fixed (boot failures) on the machines I tested, so has been commented out for a while now. Remove it, and assume the errata fixups were done by the bootloader where they belong. Notes: svn path=/head/; revision=333135
* Use a resource hint instead of environment variable for DIU modeJustin Hibbits2018-04-161-7/+4
| | | | | | | | | | | | | | This makes it more consistent with FreeBSD norms, rather than using Linux's norms. Now, instead of needing an environment variable video-mode=fslfb:1280x1024@60 Now one would use a hint: hint.fb.0.mode=1280x1024@60 Notes: svn path=/head/; revision=332546
* Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_allocOleksandr Tymoshenko2018-04-091-2/+3
| | | | | | | | | | | | | | | | | | | | | Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size. Notes: svn path=/head/; revision=332341
* Clean up OF_getprop_alloc APIOleksandr Tymoshenko2018-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Notes: svn path=/head/; revision=332310
* Remove platform_cpu_idle() and platform_cpu_idle_wakeup() interfacesJustin Hibbits2018-02-241-29/+0
| | | | | | | | | | | | These interfaces were put in place to let QorIQ SoCs dictate CPU idling semantics, in order to support capabilities such as NAP mode and deep sleep. However, this never stabilized, and the idling support reverted back to CPU-level rather than SoC level. Move this code back to cpu.c instead. If at a later date the lower power modes do come to fruition, it should be done by overriding the cpu_idle_hook instead of this platform hook. Notes: svn path=/head/; revision=329891
* Only look for L2 cache controllers for mpc85xx_cacheJustin Hibbits2018-02-041-1/+43
| | | | | | | | | | The L3 cache controller (Corenet Platform Cache) is listed with one of its compatible strings as "cache", which this driver can't attach to. Restrict to a known list of primary cache controller strings, as found in the l2cache devicetree binding. Notes: svn path=/head/; revision=328862
* Add ISA PNP tables to ISA drivers. Fix a few incidental comments.Warner Losh2018-01-291-3/+3
| | | | | | | ACPI ISA PBP tables not tagged, there's bigger issues with them. Notes: svn path=/head/; revision=328524
* Make fsl_sata driver work on P1022Justin Hibbits2018-01-161-4/+7
| | | | | | | | | | | | | P1022 SATA controller may set the wrong CCR bit for a command completion. This would previously cause an interrupt storm. Solve this by marking all commands complete, and letting the end_transaction deal with the successes. Causes no problems on P5020. While here, fix a minor bug in collision detection. The Freescale SATA controller only has 16 slots, not 32. Notes: svn path=/head/; revision=328040
* Include only the headers neededJustin Hibbits2018-01-131-9/+0
| | | | | | | The extra headers came through evolution of the file. Notes: svn path=/head/; revision=327943
* Add SPDX identifier to headerJustin Hibbits2018-01-131-0/+2
| | | | | | | Reported by: pfg Notes: svn path=/head/; revision=327928
* Enable L2 cache on supported PowerQUICC and QorIQ platformsJustin Hibbits2018-01-131-0/+129
| | | | | | | | | Some PowerQUICC and QorIQ platforms have a L2 cache managed via the memory-mapped configuration registers, and appear as a node in the device tree. This adds basic support to enable the cache. Notes: svn path=/head/; revision=327906
* Override memattr for mmap on the Freescale DIU driverJustin Hibbits2017-12-021-0/+2
| | | | | | | | | The Display Interface Unit (DIU) uses main memory for the framebuffer, which is already mapped as cache coherent physical memory. Prevent mmap() from using its own attributes which may otherwise conflict. Notes: svn path=/head/; revision=326453
* sys/powerpc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2712-0/+24
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326261
* Whether you can use mttb() or not is more complicated than whether PSL_HVNathan Whitehorn2017-11-251-0/+9
| | | | | | | | | | | is set and the right thing to do may be platform-dependent (it requires firmware on PowerNV, for instance). Make it a new platform method called platform_smp_timebase_sync(). MFC after: 3 weeks Notes: svn path=/head/; revision=326205
* Expand the Freescale PCIe root complex driver with the ofw_pcib_pciJustin Hibbits2017-11-141-2/+96
| | | | | | | | | | | | | | The interrupt map wasn't being allocated properly, preventing IRQs from being allocated to children of the PCIe bus. Fix this by cloning the ofw_pcib_pci code, which handles all cases -- device tree and probed. In the future this may become a subclass of the ofw_pcib_pci driver, but as that's not an exported class, it's cloned for now. MFC after: 3 weeks Notes: svn path=/head/; revision=325791
* Set the PRD extension list base address in little endianJustin Hibbits2017-11-061-2/+2
| | | | | | | | All data accesses with the SATA controller are little endian. This was missed when writing the extension code. Notes: svn path=/head/; revision=325468
* Fix an off-by-one error missed in the initial commit of this driverJustin Hibbits2017-11-051-2/+3
| | | | | | | | | When the segment count is > 16 it spills into an 'indirect descriptor list', which immediately follows the main table, but the indirect list is entry 15, so needs to be skipped for the general list. Notes: svn path=/head/; revision=325453
* Add Freescale QorIQ SATA controller support.Justin Hibbits2017-11-052-0/+2058
| | | | | | | | | | | | | | | | | | | The Freescale SATA controller has many similarities to AHCI controllers, so this driver is a heavily modified AHCI driver. Currently it seems to only do SATA 1.0 speeds (~100-150MB/s), so there is still room for improvement. Still to be done: * Address erratum SATA-A-006187 -- Spread Spectrum Support (intermittent non-recoverable transient data integrity error seen when SSC enabled). * Linux doesn't read the log page as it hangs on the P1022. See if that's applicable to this, and address accordingly. * Try to determine what's holding back performance, and address it. MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D6071 Notes: svn path=/head/; revision=325421
* Fix integer type and format in debug printJustin Hibbits2017-11-031-2/+2
| | | | | | | | gcc complains "cast to pointer from integer of different size". phandle_t is *always* a uint32_t, so treat it as such, not as a pointer. Fixes 64-bit build. Notes: svn path=/head/; revision=325352
* Remove some unnecessary includesJustin Hibbits2017-10-191-7/+0
| | | | Notes: svn path=/head/; revision=324737
* Add P5021 and P5040 conditions for LAW count check.Justin Hibbits2017-09-091-0/+4
| | | | | | | | | | P5040/P5021 have the same number of LAWs as P5020. There may be a better way of getting the count from the FDT (fsl,num-laws property on soc/corenet-law or soc/ecm-law), but that's not supported everywhere, so we still need this check for those other cases. Notes: svn path=/head/; revision=323340
* Actually add the mpc85xx_get_platform_clock() function.Justin Hibbits2017-06-142-3/+16
| | | | | | | | | | | | | | | | Follow up r319935 by actually committing the mpc85xx_get_platform_clock() function. This function was created to facilitate other development, and I thought I had committed it earlier. Some blocks depend on the platform clock rather than the system clock. The System clock is derived from the platform clock as one-half the platform clock. Rewrite mpc85xx_get_system_clock() to use the new function. Pointy-hat to: jhibbits Notes: svn path=/head/; revision=319936
* Use mpc85xx_get_platform_clock() instead of rolling our own.Justin Hibbits2017-06-141-3/+1
| | | | | | | | Now that we have a single source for the platform clock, we don't need to roll our own in every user. Notes: svn path=/head/; revision=319935
* Add Freescale eSPI driver found on QorIQ SoCsJustin Hibbits2017-04-021-0/+434
| | | | Notes: svn path=/head/; revision=316380
* Add a helper function to get system reference clockJustin Hibbits2017-04-012-0/+16
| | | | | | | | | | Many devices are clocked from the SoC's platform clock / 2. Some device nodes include their own clock-frequency property, while others are dependent on the SoC's bus-frequency property instead. To simplify, add a helper function to get this clock. Notes: svn path=/head/; revision=316378
* Don't bother checking core versionJustin Hibbits2017-03-241-11/+0
| | | | | | | We already constrain by SoC, so there's no need to check the core version, too. Notes: svn path=/head/; revision=315880
* Switch qoriq_gpio over to using ofw_bus_search_compatibleJustin Hibbits2017-03-241-3/+8
| | | | | | | | This will make it easier to add more compatibility strings in the future, if necessary. Notes: svn path=/head/; revision=315879
* Fix r312613.Justin Hibbits2017-01-221-1/+1
| | | | | | | Somehow this slipped through my build testing. Notes: svn path=/head/; revision=312615
* Fix use of uninitialized variable.Justin Hibbits2017-01-221-2/+2
| | | | | | | | I don't know how gcc didn't catch this. This was caught during test building with clang. Notes: svn path=/head/; revision=312613
* Simplify the page tracking for VA<->PA translations.Justin Hibbits2016-11-162-0/+6
| | | | | | | | | | Drop the tracking down to the pmap layer, with optimizations to only track necessary pages. This should give a (slight) performance improvement, as well as a stability improvement, as the tracking is already mostly handled by the pmap layer. Notes: svn path=/head/; revision=308718
* Write to the correct GPIO registers.Justin Hibbits2016-11-151-2/+2
| | | | | | | | | Offset 0 is the direction register, not the data register. MFC after: 1 week Notes: svn path=/head/; revision=308669
* Merge i.MX and PowerPC SDHCI driversJustin Hibbits2016-11-022-1600/+0
| | | | | | | | | | | | | | | | | | | | | | | | Summary: i.MX5 and PowerPC use a very similar eSDHC controller, which is also similar to the uSDHC controller used by i.MX6. The imx_sdhci driver works almost completely with PowerPC, with some minor tweaks. There is one caveat with this: reset currently does not work on PowerPC, so has been #ifdef'd out until this can be tracked down and fixed. If resets are done the controller will timeout all data transactions. Without a reset, it appears to work just fine. This is part 3, following up r308186 and r308187. Test Plan: This has been tested on a PowerPC QorIQ P1022 board. It has not been tested on i.MX, but no regressions are expected. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D8407 Notes: svn path=/head/; revision=308188
* Adjust copyright date. No real work was done on it until 2016.Justin Hibbits2016-10-081-1/+1
| | | | Notes: svn path=/head/; revision=306838
* Fix e500mc/derivatives cpu idleJustin Hibbits2016-10-051-12/+5
| | | | | | | | | | | Setting the doze registers wasn't actually working, and was being masked by a bad #ifdef. Since the #ifdef was fixed, now e500mc-based SoCs hang at idle. Fix this by using the intended wait. MFC after: 1 week Notes: svn path=/head/; revision=306702
* Add NXP/Freescale DIU driver for PowerPC SoCsJustin Hibbits2016-09-272-0/+486
| | | | | | | | | | | | | | | | | | | | | Summary: This enables some features of the DIU, using a static configuration, specified either via a 'edid' property on the 'display' FDT node, or a 'video-mode' environment variable (bootarg). 'video-mode' was chosen because it matches u-boot's naming, so it can be set with: setenv bootargs video-mode=${video-mode} at the u-boot CLI. Mouse cursor is not supported currently, as a hardware cursor is not supported by framebuffer VT yet. Currently it only supports a 32bpp ARGB (actually BGRA) format, and only a single composite plane, at up to 1280x1024. Differential Revision: https://reviews.freebsd.org/D8022 Notes: svn path=/head/; revision=306358
* Add yet another QorIQ GPIO compat string.Justin Hibbits2016-09-211-0/+1
| | | | | | | | P1022 boards use the string "fsl,pq3-gpio", which seems to be common in Linux dts files. Notes: svn path=/head/; revision=306064
* Disable the qoriq errata fix for nowJustin Hibbits2016-09-071-0/+2
| | | | | | | | It hangs more often than it actually works it seems. Further debugging is needed to determine why, but for now the system needs to be able to boot. Notes: svn path=/head/; revision=305520
* Return a NULL pointer (0 vm_offset) on error in map_dcsr().Justin Hibbits2016-09-031-1/+1
| | | | | | | | mpc85xx_map_dcsr() returns a vm_offset_t, not an error code. Follow-up to r304069. Notes: svn path=/head/; revision=305321
* Attach and LAW problems to fixJustin Hibbits2016-08-301-24/+11
| | | | | | | | | | | | | | | | | | | Summary: 1) Attach problem - mpc85xx_probe() relies on fact that 0xfff0 mask matches all QorIQ CPUs what is not true since e6500. This shall be reworked to match against all supported CPUs. 2) There is no any reason for operating system to re-program or anyhow else touch the LAWs programmed by firmware (u-boot). Right now mpc85xx_attach() removes all LaW entries except for DRAM. This causes MCE to be generated when later any of driver maps DTB-provided hardware addresses which do not exist anymore because corresponding LaWs were removed. Submitted by: Ivan Krivonos <int0dster_AT_gmail.com> Differential Revision: https://reviews.freebsd.org/D7663 Notes: svn path=/head/; revision=305043
* Return 0 instead of an error code on failure to find dcsr.Justin Hibbits2016-08-141-2/+2
| | | | | | | | | mpc85xx_map_dcsr() returns a vm_offset_t, not an error code. mpc85xx_fix_errata() will gracefully exit if mpc85xx_map_dcsr() returns 0, as that indicates an error (NULL pointer). Notes: svn path=/head/; revision=304069
* Only flush bp_kernload from the dcache, no need to sync the icache on the ↵Justin Hibbits2016-08-141-1/+1
| | | | | | | | | | | | | boot CPU. __syncicache() only syncs the icache on the current CPU, it doesn't touch the cache on any other core. Replace the call with cpu_flush_dcache() instead. Since bp_kernload is not touched again by the boot CPU in this code path, dcbf is no less efficient than the dcbst from __syncicache() by invalidating the cache line. Notes: svn path=/head/; revision=304068
* Add ePAPR boot support for PowerPC book-E (MPC85xx) hardwareJustin Hibbits2016-08-131-8/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: u-boot, following the ePAPR specification, puts secondary cores into a spinloop at boot, rather than leaving them shut off. It then relies on the host OS to write the correct values to a special spin table, located in coherent memory (on newer implementations), or noncoherent memory (older implementations). This supports both implementations of ePAPR, as well as continuing to support non-ePAPR booting, by first attempting to use the spintable, and falling back to expecting non-started CPUs. Test Plan: Booted on a P5020 board. Tested before and after the changes. Before the changes, prints the error "SMP: CPU 1 already out of hold-off state!" and panics shortly thereafter. After the changes, same boot method lets it complete boot. Reviewed by: nwhitehorn MFC after: 2 weeks Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D7494 Notes: svn path=/head/; revision=304047
* Merge MPC85XX and QorIQ config optionsJustin Hibbits2016-08-034-129/+150
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: MPC85XX and QorIQ are very similar. When the DPAA dTSEC driver was added, QORIQ_DPAA was brought in as a config option to support the differences in hardware register settings between QorIQ (e500mc-, e5500- based) SoCs and QUICC (e500v1/e500v2-based) SoCs, particularly in the Local Access Window (LAW) target settings. Unify these settings using macros to hide details and ease porting, and use a new function (mpc85xx_is_qoriq()) to distinguish between QorIQ and QUICC SoCs at runtime. An alternative to using the function could be to use a variable initialized at platform attach time, which may incur less overhead at runtime. Since it's not in the critical path once booted, this optimization doesn't seem necessary at first pass. Reviewed by: nwhitehorn MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D7294 Notes: svn path=/head/; revision=303693
* Unbreak the LBC driver, broken with the large RMan and 36-bit physical ↵Justin Hibbits2016-07-051-21/+32
| | | | | | | | | | | | | address changes. Remove the use of fdt_data_to_res(), and instead construct the resources manually. Additionally, avoid the 32-bit size limitation of fdt_data_get(), by building physical addresses manually from the lbc ranges property. Approved by: re@(gjb) Notes: svn path=/head/; revision=302340
* Use OF_prop_free instead of direct call to free(9)Oleksandr Tymoshenko2016-05-141-3/+3
| | | | | | | Reviewed by: jhibbits Notes: svn path=/head/; revision=299756
* sys/powerpc: make use of the howmany() macro when available.Pedro F. Giffuni2016-04-261-1/+1
| | | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. Notes: svn path=/head/; revision=298642
* Fix SMP booting for PowerPC Book-EJustin Hibbits2016-04-191-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: PowerPC Book-E SMP is currently broken for unknown reasons. Pull in Semihalf changes made c2012 for e500mc/e5500, which enables booting SMP. This eliminates the shared software TLB1 table, replacing it with tlb1_read_entry() function. This does not yet support ePAPR SMP booting, and doesn't handle resetting CPUs already released (ePAPR boot releases APs to a spin loop waiting on a specific address). This will be addressed in the near future by using the MPIC to reset the AP into our own alternate boot address. This does include a change to the dpaa/dtsec(4) driver, to mark the portals as CPU-private. Test Plan: Tested on Amiga X5000/20 (P5020). Boots, prints the following messages: Adding CPU 0, pir=0, awake=1 Waking up CPU 1 (dev=1) Adding CPU 1, pir=20, awake=1 SMP: AP CPU #1 launched top(1) shows CPU1 active. Obtained from: Semihalf Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D5945 Notes: svn path=/head/; revision=298237
* Make i2c device child auto-probe work for MPC85xx and QorIQ SoCs.Justin Hibbits2016-04-051-1/+11
| | | | | | | | | OFW i2c probing requires a new method ofw_bus_get_node(), and the bus device is assumed iichb. With these changes, i2c devices attached in fdt are probed and attached automagically. Notes: svn path=/head/; revision=297572
* Reduce OFW PCI code duplication - involves ARM, PPC and SPARC64Zbigniew Bodek2016-03-291-2/+1
| | | | | | | | | | | | | | | | | | | | Import portions of the PowerPC OF PCI implementation into new file "ofwpci.c", common for other platforms. The files ofw_pci.c and ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations are moved to sys/dev/ofw/ofwpci.h. This creates a new ofw_pci_write_ivar() function and modifies some others methods. Most functions contain existing ppc implementations in the majority unchanged. Now there is no need to have multiple identical copies of methods for various architectures. Requested by: jhibbits Reviewed by: jhibbits, marius Submitted by: Marcin Mazurek <mma@semihalf.com> Obtained from: Semihalf Sponsored by: Annapurna Labs Differential Revision: https://reviews.freebsd.org/D4879 Notes: svn path=/head/; revision=297392
* Fix fallout from r292180 (Dec 2015)... ensure that every driver which hasIan Lepore2016-03-211-1/+1
| | | | | | | | | | | | 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.) Notes: svn path=/head/; revision=297127