xref: /rk3399_rockchip-uboot/include/fdt_support.h (revision 49b97d9c8ea7b11c4fc9e457cc2cd9fd6ebf0c21)
164dbbd40SGerald Van Baren /*
264dbbd40SGerald Van Baren  * (C) Copyright 2007
364dbbd40SGerald Van Baren  * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com
464dbbd40SGerald Van Baren  *
564dbbd40SGerald Van Baren  * See file CREDITS for list of people who contributed to this
664dbbd40SGerald Van Baren  * project.
764dbbd40SGerald Van Baren  *
864dbbd40SGerald Van Baren  * This program is free software; you can redistribute it and/or
964dbbd40SGerald Van Baren  * modify it under the terms of the GNU General Public License as
1064dbbd40SGerald Van Baren  * published by the Free Software Foundation; either version 2 of
1164dbbd40SGerald Van Baren  * the License, or (at your option) any later version.
1264dbbd40SGerald Van Baren  *
1364dbbd40SGerald Van Baren  * This program is distributed in the hope that it will be useful,
1464dbbd40SGerald Van Baren  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1564dbbd40SGerald Van Baren  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1664dbbd40SGerald Van Baren  * GNU General Public License for more details.
1764dbbd40SGerald Van Baren  *
1864dbbd40SGerald Van Baren  * You should have received a copy of the GNU General Public License
1964dbbd40SGerald Van Baren  * along with this program; if not, write to the Free Software
2064dbbd40SGerald Van Baren  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2164dbbd40SGerald Van Baren  * MA 02111-1307 USA
2264dbbd40SGerald Van Baren  */
2364dbbd40SGerald Van Baren 
2464dbbd40SGerald Van Baren #ifndef __FDT_SUPPORT_H
2564dbbd40SGerald Van Baren #define __FDT_SUPPORT_H
2664dbbd40SGerald Van Baren 
2764dbbd40SGerald Van Baren #ifdef CONFIG_OF_LIBFDT
2864dbbd40SGerald Van Baren 
2964dbbd40SGerald Van Baren #include <fdt.h>
3064dbbd40SGerald Van Baren 
313bed2aafSKumar Gala u32 fdt_getprop_u32_default(void *fdt, const char *path, const char *prop,
323bed2aafSKumar Gala 				const u32 dflt);
3356844a22SHeiko Schocher int fdt_chosen(void *fdt, int force);
342a1a2cb6SKumar Gala int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force);
35e93becf8SKumar Gala void do_fixup_by_path(void *fdt, const char *path, const char *prop,
36e93becf8SKumar Gala 		      const void *val, int len, int create);
37e93becf8SKumar Gala void do_fixup_by_path_u32(void *fdt, const char *path, const char *prop,
38e93becf8SKumar Gala 			  u32 val, int create);
399eb77ceaSKumar Gala void do_fixup_by_prop(void *fdt,
409eb77ceaSKumar Gala 		      const char *pname, const void *pval, int plen,
419eb77ceaSKumar Gala 		      const char *prop, const void *val, int len,
429eb77ceaSKumar Gala 		      int create);
439eb77ceaSKumar Gala void do_fixup_by_prop_u32(void *fdt,
449eb77ceaSKumar Gala 			  const char *pname, const void *pval, int plen,
459eb77ceaSKumar Gala 			  const char *prop, u32 val, int create);
469eb77ceaSKumar Gala void do_fixup_by_compat(void *fdt, const char *compat,
479eb77ceaSKumar Gala 			const char *prop, const void *val, int len, int create);
489eb77ceaSKumar Gala void do_fixup_by_compat_u32(void *fdt, const char *compat,
499eb77ceaSKumar Gala 			    const char *prop, u32 val, int create);
503c927281SKumar Gala int fdt_fixup_memory(void *blob, u64 start, u64 size);
51ba37aa03SKumar Gala void fdt_fixup_ethernet(void *fdt);
5222fb2246SMatthias Fuchs int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
5322fb2246SMatthias Fuchs 			 const void *val, int len, int create);
54b8ec2385STimur Tabi void fdt_fixup_qe_firmware(void *fdt);
5564dbbd40SGerald Van Baren 
5618e69a35SAnton Vorontsov #ifdef CONFIG_HAS_FSL_DR_USB
5718e69a35SAnton Vorontsov void fdt_fixup_dr_usb(void *blob, bd_t *bd);
5818e69a35SAnton Vorontsov #else
5918e69a35SAnton Vorontsov static inline void fdt_fixup_dr_usb(void *blob, bd_t *bd) {}
6018e69a35SAnton Vorontsov #endif /* CONFIG_HAS_FSL_DR_USB */
6118e69a35SAnton Vorontsov 
620f898604SPeter Tyser #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC83xx)
636b70ffb9SKim Phillips void fdt_fixup_crypto_node(void *blob, int sec_rev);
646b70ffb9SKim Phillips #else
656b70ffb9SKim Phillips static inline void fdt_fixup_crypto_node(void *blob, int sec_rev) {}
666b70ffb9SKim Phillips #endif
676b70ffb9SKim Phillips 
688ab451c4SKumar Gala #ifdef CONFIG_PCI
698ab451c4SKumar Gala #include <pci.h>
708ab451c4SKumar Gala int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);
718ab451c4SKumar Gala #endif
728ab451c4SKumar Gala 
73e125a2ffSGerald Van Baren #ifdef CONFIG_OF_BOARD_SETUP
74e125a2ffSGerald Van Baren void ft_board_setup(void *blob, bd_t *bd);
75e125a2ffSGerald Van Baren void ft_cpu_setup(void *blob, bd_t *bd);
76e125a2ffSGerald Van Baren void ft_pci_setup(void *blob, bd_t *bd);
77e125a2ffSGerald Van Baren #endif
78e125a2ffSGerald Van Baren 
7954f9c866SKumar Gala void set_working_fdt_addr(void *addr);
803082d234SKumar Gala int fdt_resize(void *blob);
8154f9c866SKumar Gala 
8230d45c0dSStefan Roese int fdt_fixup_nor_flash_size(void *blob, int cs, u32 size);
8330d45c0dSStefan Roese 
843c950e2eSAnatolij Gustschin void fdt_fixup_mtdparts(void *fdt, void *node_info, int node_info_size);
85*49b97d9cSKumar Gala void fdt_del_node_and_alias(void *blob, const char *alias);
863c950e2eSAnatolij Gustschin 
8764dbbd40SGerald Van Baren #endif /* ifdef CONFIG_OF_LIBFDT */
8864dbbd40SGerald Van Baren #endif /* ifndef __FDT_SUPPORT_H */
89