summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/mpc85xx/lbc.c
Commit message (Collapse)AuthorAgeFilesLines
* Unbreak the LBC driver, broken with the large RMan and 36-bit physical ↵jhibbits2016-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)
* Use OF_prop_free instead of direct call to free(9)gonzo2016-05-141-3/+3
| | | | Reviewed by: jhibbits
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.jhibbits2016-03-181-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544
* Let rman_init() initialize the default rman range.jhibbits2016-03-031-2/+0
| | | | | If rm_start and rm_end are both 0 on input to rman_init(), rman_init() pre-initializes them to the default range. No need to set it before.
* Fix 2 bugs in the mpc85xx local bus controller driver.jhibbits2016-03-021-2/+26
| | | | | | | | | | 1) Include opt_platform.h to get QORIQ_DPAA. Otherwise the definition of OCP85XX_TGTIF_LBC is incorrect. 2) The child resources are already allocated, just activate them, instead of incorrectly remapping the memory regions (resource lists for lbc consist of the virtual address of the child's resources, not the physical address). Sponsored by: Alex Perez/Inertial Computing
* Move another range check to use RMAN_IS_DEFAULT_RANGE().jhibbits2016-02-271-1/+1
|
* Make lbc(4) the same driver pass as simplebus.jhibbits2016-02-031-1/+2
| | | | | | | | Device trees mark lbc as compatible with simplebus. Since simplebus is passed first, it attaches first. When lbc's pass (default pass) comes, the bus is already attached to simplebus, so is skipped. Sponsored by: Alex Perez/Inertial Computing
* Convert rman to use rman_res_t instead of u_longjhibbits2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075
* Use uint32_t for LBC block size.jhibbits2016-01-011-3/+3
| | | | | | LBC block size can only be up to 4GB. The existing code already clamps it, but mixes unsigned long and uint32_t. This works on 32-bit targets, but not 64-bit, so isn't completely correct. This fixes the type confusion.
* Move Open Firmware device root on PowerPC, ARM, and MIPS systems tonwhitehorn2014-02-051-1/+1
| | | | | | | | a sub-node of nexus (ofwbus) rather than direct attach under nexus. This fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier. SPARC is unchanged. Reviewed by: imp, ian
* Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiringnwhitehorn2013-11-051-1/+1
| | | | | | | | | | | | | | | | | fdtbus in most cases. This brings ARM and MIPS more in line with existing Open Firmware platforms like sparc64 and powerpc, as well as preventing double-enumeration of the OF tree on embedded PowerPC (first through nexus, then through fdtbus). This change is also designed to simplify resource management on FDT platforms by letting there exist a platform-defined root bus resource_activate() call instead of replying on fdtbus to do the right thing through fdt_bs_tag. The OFW_BUS_MAP_INTR() and OFW_BUS_CONFIG_INTR() kobj methods are also available to implement for similar purposes. Discussed on: -arm, -mips Tested by: zbb, brooks, imp, and others MFC after: 6 weeks
* Support lbc interrupts:marcel2012-07-031-32/+99
| | | | | | | | | | | | | | | | | o Save and clear the LTESR register in the interrupt handler. o In lbc_read_reg(), return the saved LTESR register value if applicable (i.e. when the saved value is not invalid (read: ~0U)). o In lbc_write_reg(), clear the bits in the saved register when when it's written to and when the asved value is not invalid. o Also in lbc_write_reg(), the LTESR register is unlocked (in H/W) when bit 1 of LTEATR is cleared. We use this to invalidate our saved LTESR register value. Subsequent reads and write go to H/W directly. While here: o In lbc_read_reg() & lbc_write_reg(), add some belts and suspenders to catch when register offsets are out of range. o In lbc_attach(), initialize completely and don't leave something left for lbc_banks_enable().
* A few improvements:marcel2012-05-241-57/+137
| | | | | | | | | | | | | | | | | | | | | | | 1. Define all registers. These definitions are needed to support the FCM driver for direct-connect NAND. 2. Repurpose lbc_read_reg() and lbc_write_reg() for use by localbus attached device drivers. Use bus_space functions directly in the lbc driver itself. 3. Be smarter about programming LAWs and mapping memory. The ranges defined in the FDT are per bank (= chip select) and since we can have up to 8 banks, we could easily use more than 8 LAWs or TLB enrties when per-bank memory ranges need multiple LAWs or TLBs due to alignment or size constraints. We now combine all memory ranges into the fewest possible set of contiguous regions and program the hardware for that. Thus, a cleverly written FDT with 8 devices may still only need 1 LAW or 1 TLB entry. Note that the memory ranges can be assigned randomly to the banks. We sort as we build to handle that. 4. Support the FCM when programming the OR register. This is mostly for documention purposes as we do not have a way to define the mode for a bank. 5. Remove Semihalf-ism: do not define DEBUG (only to undefine it again).
* Convert Freescale PowerPC platforms to FDT convention.raj2010-07-111-247/+395
| | | | | | | | | | | | | | | | | | | | | | | | | The following systems are affected: - MPC8555CDS - MPC8572DS This overhaul covers the following major changes: - All integrated peripherals drivers for Freescale MPC85XX SoC, which are currently in the FreeBSD source tree are reworked and adjusted so they derive config data out of the device tree blob (instead of hard coded / tabelarized values). - This includes: LBC, PCI / PCI-Express, I2C, DS1553, OpenPIC, TSEC, SEC, QUICC, UART, CFI. - Thanks to the common FDT infrastrucutre (fdtbus, simplebus) we retire ocpbus(4) driver, which was based on hard-coded config data. Note that world for these platforms has to be built WITH_FDT. Reviewed by: imp Sponsored by: The FreeBSD Foundation
* Extend and improve MPC85XX Local Bus management.raj2008-12-181-33/+235
| | | | | | | | | | | | | | | | | - Make LBC resources management self-contained: introduce explicit LBC resources definition (much like the OCP), provide dedicated rman for LB mem space. - Full configuration of an LB chip select device: program LAW and BR/OR, map into KVA, handle all LB attributes (bus width, machine select, ecc, write protect etc). - Factor out LAW manipulation routines into shared code, adjust OCP area accordingly. - Other LBC fixes and clean-ups. Obtained from: Semihalf
* Add a driver for the Local Bus Controller.marcel2008-10-251-0/+328
Obtained from: Juniper Networks, Inc.
OpenPOWER on IntegriCloud