Commit Graph

29 Commits

Author SHA1 Message Date
Robert Watson
ff82fb46d4 When a partially initialised FDT-based device instance can't attach,
perhaps due to an interrupt configuration problem, do not try to free
device ivars that have not yet have been allocated.

MFC after:	1 week
Reviewed by:	gonzo
Sponsored by:	DARPA, AFRL
2012-12-30 21:10:48 +00:00
Oleksandr Tymoshenko
1d1ffd9efb Add fdt_get_reserved_regions function. API is simmilar to fdt_get_mem_regions
It returns memory regions restricted from being used by kernel. These
regions are dfined in "memreserve" property of root node in the same
format as "reg" property of /memory node
2012-11-30 03:08:49 +00:00
Grzegorz Bernacki
68b7bd0469 If virtual addresses are not set use one to one mapping.
Do not map memory and IO space at address 0.

Obtained from: Semihalf
2012-09-14 09:45:13 +00:00
Grzegorz Bernacki
2c99056488 Add fdt_get_unit() function.
Obtained from:	Semihalf
2012-09-14 09:36:35 +00:00
Grzegorz Bernacki
2f0da24b47 Set busaddr and bussize to 0 when fdt_get_range() fails.
Obtained from:	Semihalf
2012-09-14 09:33:35 +00:00
Oleksandr Tymoshenko
c36ad1ffa3 Do not swap byte order if we assign default value for intr_cells 2012-08-25 20:18:12 +00:00
Oleksandr Tymoshenko
22cbf66621 Fix argument type for bus_space_map 2012-08-15 18:37:01 +00:00
Oleksandr Tymoshenko
8bb9363760 Merging of projects/armv6, part 4
r233822:
  Remove useless and wrong piece of code in fdt_get_range() which i
  overwrites passed phandle_t node. Modify debug printf in fdt_reg_to_rl()
  to be consistent (that is, print start and end *virtual* addresses).

r230560:
  Handle "ranges;"
  Make fdt_reg_to_rl() responsible for mapping the device memory, instead
  on just hoping that there's only one simplebus, and using fdt_immr_va as
  the base VA.

r230315
  Add a function to get the PA from range, instead of (ab)using
  fdt_immr_pa, and use it for the UART driver
2012-08-15 03:49:10 +00:00
Marcel Moolenaar
120c7e2eb7 Simplify simplebus_setup_intr and don't call MD code directly. We can
(and have to) trust our parent to handle interrupt configuration.
2012-07-02 23:53:08 +00:00
Marcel Moolenaar
8c4c7216e6 Properly implement bus_setup_intr so that it handles the configuration
of interrupts of direct children. Have the bus_config_intr and
bus_teardown_intr methods implemented by bus_generic_config_intr and
bus_generic_teardown_intr (resp) as we don't need to do anything
special outselves.

This removes all the ``#ifdef $arch'' code that was there because powerpc
didn't have a proper nexus and people tend to copy and paste stuff.
2012-07-02 23:49:29 +00:00
Marcel Moolenaar
695d8e87f2 Preset (clear) the ranges we're supposed to fill from the FDT. If a
particular range (either I/O memory or I/O port) is not defined in
the FDT, we're not handing uninitialized structures back to our caller.
2012-05-24 20:24:49 +00:00
Grzegorz Bernacki
4ffd4dfe17 Add a new geom class which allows to divide NAND Flash chip
into partitions.

Partitions are created based on data in dts file which are
extracted and interpreted by slicer.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-22 08:33:14 +00:00
Rafal Jaworowski
aa15e881bb Respect phy-handle property in Ethernet nodes of the device tree.
This lets specify whereabouts of the parent PHY for a given MAC node
(and get rid of ugly kludges in mge(4) and tsec(4)).

Obtained from:	Semihalf
MFC after:	1 week
2012-03-04 19:22:52 +00:00
Marcel Moolenaar
49a5225199 DEBUG is a kernel option. Don't define it here, as it breaks LINT.
Since DEBUG was subsequently undefined, this is just debugging left-
over.
2011-12-30 04:00:31 +00:00
Jayachandran C.
07042bef45 Fix OF_finddevice error return value in case of FDT.
According to the open firmware standard, finddevice call has to return
a phandle with value of -1 in case of error.

This commit is to:
- Fix the FDT implementation of this interface (ofw_fdt_finddevice) to
  return (phandle_t)-1 in case of error, instead of 0 as it does now.
- Fix up the callers of OF_finddevice() to compare the return value with
  -1 instead of 0 to check for errors.
- Since phandle_t is unsigned, the return value of OF_finddevice should
  be checked with '== -1' rather than '<= 0' or '> 0', fix up these cases
  as well.

Reported by:	nwhitehorn

Reviewed by:	raj
Approved by:	raj, nwhitehorn
2011-12-02 15:24:39 +00:00
Jayachandran C.
29a99755a9 FDT support for MIPS.
Add architecture specific files needed to compile MIPS with
flattened device tree support.
2011-10-18 07:29:21 +00:00
John Baldwin
b67d11bbcc Change rman_manage_region() to actually honor the rm_start and rm_end
constraints on the rman and reject attempts to manage a region that is out
of range.
- Fix various places that set rm_end incorrectly (to ~0 or ~0u instead of
  ~0ul).
- To preserve existing behavior, change rman_init() to set rm_start and
  rm_end to allow managing the full range (0 to ~0ul) if they are not set by
  the caller when rman_init() is called.
2011-04-29 18:41:21 +00:00
Marcel Moolenaar
3a47c0e263 Don't operate on the parent of the PCI node. It's the PCI node itself
that represents the host controller. This makes the FDT PCI support
working an a bare-bones manner. This needs a lot more work, of which
the beginning are at the end of the file, compiled-out with #if 0.

The intend being that both the Marvell PCIE and Freescale PCI/PCIX/PCIE
duplicate the same platform-independent domain initialization, that
should be moved into an unified implementation in the FDT code. Handling
of resources requires help from the platform. A unified implementation
allows us to properly support PCI devices listed in the device tree and
configured according to the device tree specification.

Sponsored by: Juniper Networks
2011-01-29 21:14:29 +00:00
Marcel Moolenaar
ac3fe75f97 Call newbus_device_create() for PCI devices. Call pci_from_fdt_node()
for the newly created device_t, rather than the parent.
2011-01-29 21:08:03 +00:00
Marcel Moolenaar
2af3fc178e Introduce macro FDT_MAP_IRQ to map from an interrupt controller and
interrupt pin pair to a global IRQ number. When multiple PICs exist
on a board, the interrupt pin alone is not unique.
2011-01-29 20:25:20 +00:00
Rafal Jaworowski
4f124b977c Eliminate FDT_IMMR_VA define.
This removes platform dependencies from <machine>/fdt.h for the benfit of
portability.
2010-07-19 18:47:18 +00:00
Rafal Jaworowski
5710b7a9da Move MRVL FDT fixups and PIC decode routine to a platform specific area.
This allows for better encapsulation (and eliminates generic fdt_arm.c, at
least for now).
2010-07-19 18:41:50 +00:00
Rafal Jaworowski
d1d3233ebd Convert Freescale PowerPC platforms to FDT convention.
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
2010-07-11 21:08:29 +00:00
Rafal Jaworowski
da6bc8989d Introduce PowerPC-specific helper routines for FDT.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-07-11 20:49:36 +00:00
Rafal Jaworowski
caaa3c62d4 Save fdtbus trigger / polarity data at their correct index. 2010-07-11 20:33:39 +00:00
Rafal Jaworowski
a22cd1e668 Let simplebus(4) diagnostics be a bit more descriptive. 2010-07-11 20:30:59 +00:00
Rafal Jaworowski
dc65d002dd Initial FDT infrastructure elements for ARM.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-06-13 13:12:52 +00:00
Rafal Jaworowski
10e8667600 Provide identify method for the fdtbus(4).
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-06-13 12:58:31 +00:00
Rafal Jaworowski
58158742f2 Import the common Flattened Device Tree infrastructure.
o fdtbus(4) - the main abstract bus driver for all FDT-compliant systems. This
  is a direct replacement for the many incompatible bus drivers grouping
  integrated peripherals on embedded platforms (like obio(4), ocpbus(4) etc.)

o simplebus(4) - bus driver representing ePAPR style 'simple-bus' node, which
  is an umbrella device for most of the integrated peripherals on a typical
  system-on-chip device.

o Other components (common routines library, PCI node processing helper
  functions)

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-06-02 17:17:45 +00:00