summaryrefslogtreecommitdiffstats
path: root/drivers/of/partition.c
Commit message (Collapse)AuthorAgeFilesLines
* of: partition: set ret for error casesOleksij Rempel2018-11-191-2/+2
| | | | | | | looks like it was forgotten. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: fix typo when writing #address-cellsPhilipp Zabel2018-03-291-1/+1
| | | | | | | | | | | | On > 4 GiB eMMC devices, barebox writes a 32-bit address and a 64-bit size into the partition reg property, because #address-cells is accidentally written as '#addres-cells'. This causes a fallback to 32-bit address size. Fix the typo and thereby of_partition_fixup for 64-bit partitions. Fixes: a2fa18f9f483 ("mtd: of: Make used partition binding configurable") Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: mtd: partition: Use reproducible node names for fixupSascha Hauer2018-02-061-1/+4
| | | | | | | | | | The full names of device nodes are not as stable as we like them to be. Lately the leading zeroes in the i.MX6 device trees were removed which led to the result that we can no longer find the partition nodes in the to be fixed tree. Use reproducible names to overcome this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: of: only add partition layout param when GLOBAL support is enabledLucas Stach2017-04-191-3/+5
| | | | | | Fixes: a2fa18f9f483 (mtd: of: Make used partition binding configurable) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: flag partitions from a partition tableSascha Hauer2017-03-311-2/+6
| | | | | | | | | We are going to call the of_partition_fixup for regular block devices like MMC/SD aswell. Add a flag to partitions indicating they are instanciated from a on-disk partition table so that they won't be added as device tree partitions during fixup. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: only create partition node when partitions existSascha Hauer2017-03-311-1/+8
| | | | | | | | | With the legacy partition binding we did not modify the device node when no partition exist, but with the new binding we would create the "partitions" node with compatible = "fixed-partitions". Prevent that by catching the absence of partitions early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Make partition fixup independent from mtd devicesSascha Hauer2017-03-311-18/+27
| | | | | | | | The of partition parser is not only used for mtd device, but also for regular block devices, so make the of_mtd_fixup code independent of mtd devices also, so that other devices can be fixed up, too. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: support 64bit partition sizesSascha Hauer2017-03-301-4/+13
| | | | | | | | Do not assume that #address-cells and #size-cells are both 1. Parse them appropriately to support devices > 4GuB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: of: Make used partition binding configurableSascha Hauer2017-03-301-7/+77
| | | | | | | | | | | | | | So far we used the legacy partition binding when fixing up the mtd partition nodes. Change this to default to the new binding with a "partitions" submode. Make this behaviour configurable though: This creates a new of_binding device variable for mtd devices. This can be set to: - "new": Use the new partition binding (default) - "legacy": Use the old partition binding - "donttouch": Do not touch the partition node Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Move of_mtd_fixup to drivers/of/Sascha Hauer2017-03-301-0/+69
| | | | | | | | Move the fixup code where the parser code is already. Since the code will not only be used for mtd in the future drivers/of/ is a better place than drivers/mtd/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: force "partitions" subnodeSascha Hauer2017-01-191-6/+6
| | | | | | | | | The binding states that a subnode containing partition subnodes should have the name "partitions". Enforce this so that we do not parse nodes with other names which may have partition descriptions for other disks. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: Support new bindingSascha Hauer2016-11-111-0/+7
| | | | | | | The new binding recommends to put the partitions into a subnode with compatible "fixed-partitions". Add support for this binding. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* cdev: Add function to find cdev by device_nodeSascha Hauer2015-09-011-2/+2
| | | | | | | | | | This adds a device_node member to struct cdev and a function to find a cdev by device_node. This also removes the setting of cdev->dev->device_node in the of partition parser. We must not set the device since it may not refer to a partition but to a whole device with partitions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_partition: devfs_add_partition returns an error pointerSascha Hauer2014-08-011-0/+4
| | | | | | | | Check for the return value of devfs_add_partition with IS_ERR. Otherwise we dereference a NULL pointer when devfs_add_partition fails. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of'Sascha Hauer2014-05-051-0/+2
|\
| * of: partition: set device_node of the newly created partitionSascha Hauer2014-04-281-0/+2
| | | | | | | | | | | | So that we can find the devicenode for a partition. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: nand: create bb devices automaticallySascha Hauer2014-04-281-3/+0
|/ | | | | | | | When a mtd device can have bad blocks we want to create a bb device, so do this automatically. This allows us to drop bb device creation from the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Check for valid partition nameSascha Hauer2013-09-231-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: check for valid nodeSascha Hauer2013-07-181-0/+6
| | | | | | | So that users can call the of partition parsers without checking if they are probed from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: factor out function to parse a single partitionSascha Hauer2013-07-151-25/+33
| | | | | | To make it usable for other code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* OF: base: convert and remove device_node_for_nach_childSebastian Hesselbarth2013-06-201-1/+1
| | | | | | | | Remove device_node_for_nach_child and convert users to corresponding imported OF API functions. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: create bb device for nand flashesSascha Hauer2013-04-221-0/+4
| | | | | | For nand flashes automatically create a bb device for each partion. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: pass struct cdev as argumentSascha Hauer2013-04-221-5/+4
| | | | | | | | | pass a struct cdev instead of the cdev name to of_parse_partitions. This is available to the caller anyway and makes it easier to use additional stuff from the cdev (like knowing whether it's a mtd device). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add devicetree partition parsingSascha Hauer2012-09-141-0/+64
Helper code to probe mtd partitions from the devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>