16494d708SSimon Glass /* 26494d708SSimon Glass * Copyright (c) 2013 Google, Inc 36494d708SSimon Glass * 46494d708SSimon Glass * (C) Copyright 2012 56494d708SSimon Glass * Pavel Herrmann <morpheus.ibis@gmail.com> 66494d708SSimon Glass * 76494d708SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 86494d708SSimon Glass */ 96494d708SSimon Glass 106494d708SSimon Glass #ifndef _DM_ROOT_H_ 116494d708SSimon Glass #define _DM_ROOT_H_ 126494d708SSimon Glass 1354c5d08aSHeiko Schocher struct udevice; 146494d708SSimon Glass 156494d708SSimon Glass /** 166494d708SSimon Glass * dm_root() - Return pointer to the top of the driver tree 176494d708SSimon Glass * 186494d708SSimon Glass * This function returns pointer to the root node of the driver tree, 196494d708SSimon Glass * 206494d708SSimon Glass * @return pointer to root device, or NULL if not inited yet 216494d708SSimon Glass */ 2254c5d08aSHeiko Schocher struct udevice *dm_root(void); 236494d708SSimon Glass 246494d708SSimon Glass /** 256494d708SSimon Glass * dm_scan_platdata() - Scan all platform data and bind drivers 266494d708SSimon Glass * 276494d708SSimon Glass * This scans all available platdata and creates drivers for each 286494d708SSimon Glass * 29*00606d7eSSimon Glass * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC 30*00606d7eSSimon Glass * flag. If false bind all drivers. 316494d708SSimon Glass * @return 0 if OK, -ve on error 326494d708SSimon Glass */ 33*00606d7eSSimon Glass int dm_scan_platdata(bool pre_reloc_only); 346494d708SSimon Glass 356494d708SSimon Glass /** 366494d708SSimon Glass * dm_scan_fdt() - Scan the device tree and bind drivers 376494d708SSimon Glass * 386494d708SSimon Glass * This scans the device tree and creates a driver for each node 396494d708SSimon Glass * 406494d708SSimon Glass * @blob: Pointer to device tree blob 41*00606d7eSSimon Glass * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC 42*00606d7eSSimon Glass * flag. If false bind all drivers. 436494d708SSimon Glass * @return 0 if OK, -ve on error 446494d708SSimon Glass */ 45*00606d7eSSimon Glass int dm_scan_fdt(const void *blob, bool pre_reloc_only); 466494d708SSimon Glass 476494d708SSimon Glass /** 48f2bc6fc3SSimon Glass * dm_init() - Initialise Driver Model structures 496494d708SSimon Glass * 506494d708SSimon Glass * This function will initialize roots of driver tree and class tree. 516494d708SSimon Glass * This needs to be called before anything uses the DM 526494d708SSimon Glass * 536494d708SSimon Glass * @return 0 if OK, -ve on error 546494d708SSimon Glass */ 556494d708SSimon Glass int dm_init(void); 566494d708SSimon Glass 579adbd7a1SSimon Glass /** 589adbd7a1SSimon Glass * dm_uninit - Uninitialise Driver Model structures 599adbd7a1SSimon Glass * 609adbd7a1SSimon Glass * All devices will be removed and unbound 619adbd7a1SSimon Glass * @return 0 if OK, -ve on error 629adbd7a1SSimon Glass */ 639adbd7a1SSimon Glass int dm_uninit(void); 649adbd7a1SSimon Glass 656494d708SSimon Glass #endif 66