Merge branch '2020-08-01-misc-cleanups'

- Further cleanup of common.h and dm.h usage in headers
This commit is contained in:
Tom Rini 2020-08-03 22:20:22 -04:00
commit d6faedca76
137 changed files with 260 additions and 143 deletions

View file

@ -6,7 +6,7 @@
#ifndef __MEDIATEK_RESET_H #ifndef __MEDIATEK_RESET_H
#define __MEDIATEK_RESET_H #define __MEDIATEK_RESET_H
#include <dm.h> struct udevice;
int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs); int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs);

View file

@ -8,6 +8,7 @@
#include <bootm.h> #include <bootm.h>
#include <common.h> #include <common.h>
#include <dm.h>
#include <init.h> #include <init.h>
#include <log.h> #include <log.h>
#include <net.h> #include <net.h>

View file

@ -7,6 +7,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <image.h> #include <image.h>
#include <log.h> #include <log.h>
#include <spl.h> #include <spl.h>

View file

@ -5,6 +5,7 @@
#include <common.h> #include <common.h>
#include <console.h> #include <console.h>
#include <dm.h>
#include <dfu.h> #include <dfu.h>
#include <malloc.h> #include <malloc.h>
#include <serial.h> #include <serial.h>

View file

@ -8,9 +8,6 @@
#ifndef _MSCC_JR2_H_ #ifndef _MSCC_JR2_H_
#define _MSCC_JR2_H_ #define _MSCC_JR2_H_
#include <linux/bitops.h>
#include <dm.h>
/* /*
* Target offset base(s) * Target offset base(s)
*/ */

View file

@ -8,9 +8,6 @@
#ifndef _MSCC_OCELOT_H_ #ifndef _MSCC_OCELOT_H_
#define _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_
#include <linux/bitops.h>
#include <dm.h>
/* /*
* Target offset base(s) * Target offset base(s)
*/ */

View file

@ -8,9 +8,6 @@
#ifndef _MSCC_OCELOT_H_ #ifndef _MSCC_OCELOT_H_
#define _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_
#include <linux/bitops.h>
#include <dm.h>
/* /*
* Target offset base(s) * Target offset base(s)
*/ */

View file

@ -8,9 +8,6 @@
#ifndef _MSCC_SERVAL_H_ #ifndef _MSCC_SERVAL_H_
#define _MSCC_SERVAL_H_ #define _MSCC_SERVAL_H_
#include <linux/bitops.h>
#include <dm.h>
/* /*
* Target offset base(s) * Target offset base(s)
*/ */

View file

@ -8,9 +8,6 @@
#ifndef _MSCC_SERVALT_H_ #ifndef _MSCC_SERVALT_H_
#define _MSCC_SERVALT_H_ #define _MSCC_SERVALT_H_
#include <linux/bitops.h>
#include <dm.h>
/* /*
* Target offset base(s) * Target offset base(s)
*/ */

View file

@ -10,6 +10,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <errno.h> #include <errno.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <init.h> #include <init.h>

View file

@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <env.h> #include <env.h>
#include <w1.h> #include <w1.h>
#include <w1-eeprom.h> #include <w1-eeprom.h>

View file

@ -27,7 +27,6 @@
#include <i2c.h> #include <i2c.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <dm.h>
#include <dm/platform_data/serial_mxc.h> #include <dm/platform_data/serial_mxc.h>
#include <dm/platdata.h> #include <dm/platdata.h>

View file

@ -9,6 +9,8 @@
#include <asm/io.h> #include <asm/io.h>
#include <led.h> #include <led.h>
DECLARE_GLOBAL_DATA_PTR;
enum { enum {
BOARD_TYPE_PCB116 = 0xAABBCE00, BOARD_TYPE_PCB116 = 0xAABBCE00,
}; };

View file

@ -5,6 +5,7 @@
#include <common.h> #include <common.h>
#include <blk.h> #include <blk.h>
#include <dm.h>
#include <dfu.h> #include <dfu.h>
#include <env.h> #include <env.h>
#include <memalign.h> #include <memalign.h>

View file

@ -8,6 +8,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <dm.h>
#include <dm-demo.h> #include <dm-demo.h>
#include <mapmem.h> #include <mapmem.h>
#include <asm/io.h> #include <asm/io.h>

View file

@ -10,6 +10,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <dm.h>
#include <miiphy.h> #include <miiphy.h>
#include <phy.h> #include <phy.h>

View file

@ -10,6 +10,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <dm.h>
#include <miiphy.h> #include <miiphy.h>
typedef struct _MII_field_desc_t { typedef struct _MII_field_desc_t {

View file

@ -6,6 +6,7 @@
*/ */
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <dm.h>
#include <w1.h> #include <w1.h>
#include <w1-eeprom.h> #include <w1-eeprom.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>

View file

@ -1529,6 +1529,16 @@ config TPL_SPI_FLASH_SUPPORT
Enable support for using SPI flash in TPL. See SPL_SPI_FLASH_SUPPORT Enable support for using SPI flash in TPL. See SPL_SPI_FLASH_SUPPORT
for details. for details.
config TPL_SPI_FLASH_TINY
bool "Enable low footprint TPL SPI Flash support"
depends on TPL_SPI_FLASH_SUPPORT && !SPI_FLASH_BAR
default y if SPI_FLASH
help
Enable lightweight TPL SPI Flash support that supports just reading
data/images from flash. No support to write/erase flash. Enable
this if you have TPL size limitations and don't need full-fledged
SPI flash support.
config TPL_SPI_LOAD config TPL_SPI_LOAD
bool "Support loading from SPI flash" bool "Support loading from SPI flash"
depends on TPL_SPI_FLASH_SUPPORT depends on TPL_SPI_FLASH_SUPPORT

View file

@ -7,6 +7,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/bitops.h> #include <linux/bitops.h>

View file

@ -26,9 +26,9 @@
#define STM32_ADC_MAX_ADCS 3 #define STM32_ADC_MAX_ADCS 3
#define STM32_ADCX_COMN_OFFSET 0x300 #define STM32_ADCX_COMN_OFFSET 0x300
#include <common.h>
#include <clk.h> #include <clk.h>
#include <dm.h>
struct udevice;
/** /**
* struct stm32_adc_common - stm32 ADC driver common data (for all instances) * struct stm32_adc_common - stm32 ADC driver common data (for all instances)

View file

@ -8,6 +8,7 @@
#include <common.h> #include <common.h>
#include <adc.h> #include <adc.h>
#include <dm.h>
#include <asm/io.h> #include <asm/io.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/bitops.h> #include <linux/bitops.h>

View file

@ -25,6 +25,11 @@ static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)
return (const struct clk_ops *)dev->driver->ops; return (const struct clk_ops *)dev->driver->ops;
} }
struct clk *dev_get_clk_ptr(struct udevice *dev)
{
return (struct clk *)dev_get_uclass_priv(dev);
}
#if CONFIG_IS_ENABLED(OF_CONTROL) #if CONFIG_IS_ENABLED(OF_CONTROL)
# if CONFIG_IS_ENABLED(OF_PLATDATA) # if CONFIG_IS_ENABLED(OF_PLATDATA)
int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells,

View file

@ -4,12 +4,15 @@
*/ */
#define LOG_CATEGORY UCLASS_CLK #define LOG_CATEGORY UCLASS_CLK
#include <kendryte/bypass.h>
#include <common.h>
#include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <dm.h>
#include <log.h>
#include <kendryte/bypass.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/err.h> #include <linux/err.h>
#include <log.h>
#define CLK_K210_BYPASS "k210_clk_bypass" #define CLK_K210_BYPASS "k210_clk_bypass"

View file

@ -3,18 +3,20 @@
* Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com> * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com>
*/ */
#define LOG_CATEGORY UCLASS_CLK #define LOG_CATEGORY UCLASS_CLK
#include <kendryte/pll.h>
#include <asm/io.h> #include <common.h>
#include <dm.h>
/* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */
#include <div64.h> #include <div64.h>
#include <log.h>
#include <serial.h>
#include <asm/io.h>
#include <dt-bindings/clock/k210-sysctl.h> #include <dt-bindings/clock/k210-sysctl.h>
#include <kendryte/pll.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <log.h>
#include <serial.h>
#define CLK_K210_PLL "k210_clk_pll" #define CLK_K210_PLL "k210_clk_pll"

View file

@ -13,6 +13,7 @@
#include <altera.h> #include <altera.h>
#include <asm/arch/pinmux.h> #include <asm/arch/pinmux.h>
#include <common.h> #include <common.h>
#include <dm.h>
#include <dm/ofnode.h> #include <dm/ofnode.h>
#include <errno.h> #include <errno.h>
#include <fs_loader.h> #include <fs_loader.h>

View file

@ -15,7 +15,6 @@
#include <malloc.h> #include <malloc.h>
#include <mmc.h> #include <mmc.h>
#include <sdhci.h> #include <sdhci.h>
#include <dm.h>
#include <asm/cache.h> #include <asm/cache.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: GPL-2.0+
#include <common.h> #include <common.h>
#include <dm.h>
#include <malloc.h> #include <malloc.h>
#include <dm/devres.h> #include <dm/devres.h>
#include "brcmnand_compat.h" #include "brcmnand_compat.h"

View file

@ -3,8 +3,8 @@
#ifndef __BRCMNAND_COMPAT_H #ifndef __BRCMNAND_COMPAT_H
#define __BRCMNAND_COMPAT_H #define __BRCMNAND_COMPAT_H
#include <clk.h> struct clk;
#include <dm.h> struct udevice;
char *devm_kasprintf(struct udevice *dev, gfp_t gfp, const char *fmt, ...); char *devm_kasprintf(struct udevice *dev, gfp_t gfp, const char *fmt, ...);

View file

@ -8,7 +8,7 @@ spi-nor-y := sf_probe.o spi-nor-ids.o
ifdef CONFIG_SPL_BUILD ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o obj-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o
ifeq ($(CONFIG_SPL_SPI_FLASH_TINY),y) ifeq ($(CONFIG_$(SPL_TPL_)SPI_FLASH_TINY),y)
spi-nor-y += spi-nor-tiny.o spi-nor-y += spi-nor-tiny.o
else else
spi-nor-y += spi-nor-core.o spi-nor-y += spi-nor-core.o

View file

@ -119,7 +119,7 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
struct erase_info instr; struct erase_info instr;
if (offset % mtd->erasesize || len % mtd->erasesize) { if (offset % mtd->erasesize || len % mtd->erasesize) {
printf("SF: Erase offset/length not multiple of erase size\n"); debug("SF: Erase offset/length not multiple of erase size\n");
return -EINVAL; return -EINVAL;
} }

View file

@ -2470,7 +2470,7 @@ static int spi_nor_init(struct spi_nor *nor)
* designer) that this is bad. * designer) that this is bad.
*/ */
if (nor->flags & SNOR_F_BROKEN_RESET) if (nor->flags & SNOR_F_BROKEN_RESET)
printf("enabling reset hack; may not recover from unexpected reboots\n"); debug("enabling reset hack; may not recover from unexpected reboots\n");
set_4byte(nor, nor->info, 1); set_4byte(nor, nor->info, 1);
} }

View file

@ -377,7 +377,7 @@ static const struct flash_info *spi_nor_read_id(struct spi_nor *nor)
} }
dev_dbg(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n", dev_dbg(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n",
id[0], id[1], id[2]); id[0], id[1], id[2]);
return ERR_PTR(-ENODEV); return ERR_PTR(-EMEDIUMTYPE);
} }
static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
@ -733,7 +733,7 @@ int spi_nor_scan(struct spi_nor *nor)
info = spi_nor_read_id(nor); info = spi_nor_read_id(nor);
if (IS_ERR_OR_NULL(info)) if (IS_ERR_OR_NULL(info))
return -ENOENT; return PTR_ERR(info);
/* Parse the Serial Flash Discoverable Parameters table. */ /* Parse the Serial Flash Discoverable Parameters table. */
ret = spi_nor_init_params(nor, info, &params); ret = spi_nor_init_params(nor, info, &params);
if (ret) if (ret)

View file

@ -10,7 +10,6 @@
#include <cpu_func.h> #include <cpu_func.h>
#include <dm.h> #include <dm.h>
#include <log.h> #include <log.h>
#include <dm.h>
#include <malloc.h> #include <malloc.h>
#include <memalign.h> #include <memalign.h>
#include <net.h> #include <net.h>

View file

@ -8,7 +8,7 @@
#ifndef _PCIE_LAYERSCAPE_H_ #ifndef _PCIE_LAYERSCAPE_H_
#define _PCIE_LAYERSCAPE_H_ #define _PCIE_LAYERSCAPE_H_
#include <pci.h> #include <pci.h>
#include <dm.h>
#include <linux/sizes.h> #include <linux/sizes.h>
#ifndef CONFIG_SYS_PCI_MEMORY_BUS #ifndef CONFIG_SYS_PCI_MEMORY_BUS

View file

@ -6,6 +6,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <init.h> #include <init.h>
#include <log.h> #include <log.h>
#include <pci.h> #include <pci.h>

View file

@ -9,7 +9,6 @@
#ifndef _PCIE_LAYERSCAPE_GEN4_H_ #ifndef _PCIE_LAYERSCAPE_GEN4_H_
#define _PCIE_LAYERSCAPE_GEN4_H_ #define _PCIE_LAYERSCAPE_GEN4_H_
#include <pci.h> #include <pci.h>
#include <dm.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#ifndef CONFIG_SYS_PCI_MEMORY_SIZE #ifndef CONFIG_SYS_PCI_MEMORY_SIZE

View file

@ -8,6 +8,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <log.h> #include <log.h>
#include <pci.h> #include <pci.h>
#include <asm/arch/fsl_serdes.h> #include <asm/arch/fsl_serdes.h>

View file

@ -5,7 +5,6 @@
* Przemyslaw Marczak <p.marczak@samsung.com> * Przemyslaw Marczak <p.marczak@samsung.com>
*/ */
#include "regulator_common.h"
#include <common.h> #include <common.h>
#include <errno.h> #include <errno.h>
#include <dm.h> #include <dm.h>
@ -13,6 +12,8 @@
#include <power/pmic.h> #include <power/pmic.h>
#include <power/regulator.h> #include <power/regulator.h>
#include "regulator_common.h"
static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) static int fixed_regulator_ofdata_to_platdata(struct udevice *dev)
{ {
struct dm_regulator_uclass_platdata *uc_pdata; struct dm_regulator_uclass_platdata *uc_pdata;

View file

@ -4,7 +4,6 @@
* Keerthy <j-keerthy@ti.com> * Keerthy <j-keerthy@ti.com>
*/ */
#include "regulator_common.h"
#include <common.h> #include <common.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <errno.h> #include <errno.h>
@ -15,6 +14,8 @@
#include <power/pmic.h> #include <power/pmic.h>
#include <power/regulator.h> #include <power/regulator.h>
#include "regulator_common.h"
#define GPIO_REGULATOR_MAX_STATES 2 #define GPIO_REGULATOR_MAX_STATES 2
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;

View file

@ -4,12 +4,14 @@
* Sven Schwermer <sven.svenschwermer@disruptive-technologies.com> * Sven Schwermer <sven.svenschwermer@disruptive-technologies.com>
*/ */
#include "regulator_common.h"
#include <common.h> #include <common.h>
#include <dm.h>
#include <log.h> #include <log.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <power/regulator.h> #include <power/regulator.h>
#include "regulator_common.h"
int regulator_common_ofdata_to_platdata(struct udevice *dev, int regulator_common_ofdata_to_platdata(struct udevice *dev,
struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name) struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name)
{ {

View file

@ -7,9 +7,7 @@
#ifndef _REGULATOR_COMMON_H #ifndef _REGULATOR_COMMON_H
#define _REGULATOR_COMMON_H #define _REGULATOR_COMMON_H
#include <common.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <dm.h>
struct regulator_common_platdata { struct regulator_common_platdata {
struct gpio_desc gpio; /* GPIO for regulator enable control */ struct gpio_desc gpio; /* GPIO for regulator enable control */

View file

@ -13,7 +13,6 @@
#include <ram.h> #include <ram.h>
#include <asm/io.h> #include <asm/io.h>
#include <power-domain.h> #include <power-domain.h>
#include <dm.h>
#include <asm/arch/sys_proto.h> #include <asm/arch/sys_proto.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <power/regulator.h> #include <power/regulator.h>

View file

@ -11,7 +11,6 @@
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>
#include <spi.h> #include <spi.h>
#include <dm.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/bitops.h> #include <linux/bitops.h>

View file

@ -13,9 +13,14 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include "internals.h" #include "internals.h"
#else #else
#include <dm/device_compat.h> #include <common.h>
#include <dm.h>
#include <errno.h>
#include <malloc.h>
#include <spi.h>
#include <spi.h> #include <spi.h>
#include <spi-mem.h> #include <spi-mem.h>
#include <dm/device_compat.h>
#endif #endif
#ifndef __UBOOT__ #ifndef __UBOOT__

View file

@ -10,6 +10,7 @@
#include <dm.h> #include <dm.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <malloc.h> #include <malloc.h>
#include <spi.h>
#include <spi-mem.h> #include <spi-mem.h>
#include <wait_bit.h> #include <wait_bit.h>
#include <asm/io.h> #include <asm/io.h>

View file

@ -9,8 +9,10 @@
#include <common.h> #include <common.h>
#include <clk.h> #include <clk.h>
#include <dm.h>
#include <log.h> #include <log.h>
#include <reset.h> #include <reset.h>
#include <spi.h>
#include <spi-mem.h> #include <spi-mem.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/bitops.h> #include <linux/bitops.h>

View file

@ -9,6 +9,7 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <ufs.h> #include <ufs.h>
#include <asm/io.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/err.h> #include <linux/err.h>

View file

@ -19,9 +19,10 @@
#include <malloc.h> #include <malloc.h>
#include <hexdump.h> #include <hexdump.h>
#include <scsi.h> #include <scsi.h>
#include <asm/io.h>
#include <asm/dma-mapping.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include "ufs.h" #include "ufs.h"

View file

@ -2,11 +2,10 @@
#ifndef __UFS_H #ifndef __UFS_H
#define __UFS_H #define __UFS_H
#include <asm/io.h>
#include <dm.h>
#include "unipro.h" #include "unipro.h"
struct udevice;
#define UFS_CDB_SIZE 16 #define UFS_CDB_SIZE 16
#define UPIU_TRANSACTION_UIC_CMD 0x1F #define UPIU_TRANSACTION_UIC_CMD 0x1F
#define UIC_CMD_SIZE (sizeof(u32) * 4) #define UIC_CMD_SIZE (sizeof(u32) * 4)

View file

@ -1,5 +1,6 @@
#include <common.h> #include <common.h>
#include <console.h> #include <console.h>
#include <dm.h>
#include <malloc.h> #include <malloc.h>
#include <watchdog.h> #include <watchdog.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -452,3 +453,39 @@ struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
return *musbp; return *musbp;
} }
#if CONFIG_IS_ENABLED(DM_USB)
struct usb_device *usb_dev_get_parent(struct usb_device *udev)
{
struct udevice *parent = udev->dev->parent;
/*
* When called from usb-uclass.c: usb_scan_device() udev->dev points
* to the parent udevice, not the actual udevice belonging to the
* udev as the device is not instantiated yet.
*
* If dev is an usb-bus, then we are called from usb_scan_device() for
* an usb-device plugged directly into the root port, return NULL.
*/
if (device_get_uclass_id(udev->dev) == UCLASS_USB)
return NULL;
/*
* If these 2 are not the same we are being called from
* usb_scan_device() and udev itself is the parent.
*/
if (dev_get_parent_priv(udev->dev) != udev)
return udev;
/* We are being called normally, use the parent pointer */
if (device_get_uclass_id(parent) == UCLASS_USB_HUB)
return dev_get_parent_priv(parent);
return NULL;
}
#else
struct usb_device *usb_dev_get_parent(struct usb_device *udev)
{
return udev->parent;
}
#endif

View file

@ -10,6 +10,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dm.h>
#include <dm/device_compat.h> #include <dm/device_compat.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>

View file

@ -1,9 +1,10 @@
#ifndef __USB_COMPAT_H__ #ifndef __USB_COMPAT_H__
#define __USB_COMPAT_H__ #define __USB_COMPAT_H__
#include <dm.h>
#include "usb.h" #include "usb.h"
struct udevice;
struct usb_hcd { struct usb_hcd {
void *hcd_priv; void *hcd_priv;
}; };
@ -67,40 +68,12 @@ static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd,
return 0; return 0;
} }
#if CONFIG_IS_ENABLED(DM_USB) /**
static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev) * usb_dev_get_parent() - Get the parent of a USB device
{
struct udevice *parent = udev->dev->parent;
/*
* When called from usb-uclass.c: usb_scan_device() udev->dev points
* to the parent udevice, not the actual udevice belonging to the
* udev as the device is not instantiated yet.
* *
* If dev is an usb-bus, then we are called from usb_scan_device() for * @udev: USB struct containing information about the device
* an usb-device plugged directly into the root port, return NULL. * @return associated device for which udev == dev_get_parent_priv(dev)
*/ */
if (device_get_uclass_id(udev->dev) == UCLASS_USB) struct usb_device *usb_dev_get_parent(struct usb_device *udev);
return NULL;
/*
* If these 2 are not the same we are being called from
* usb_scan_device() and udev itself is the parent.
*/
if (dev_get_parent_priv(udev->dev) != udev)
return udev;
/* We are being called normally, use the parent pointer */
if (device_get_uclass_id(parent) == UCLASS_USB_HUB)
return dev_get_parent_priv(parent);
return NULL;
}
#else
static inline struct usb_device *usb_dev_get_parent(struct usb_device *dev)
{
return dev->parent;
}
#endif
#endif /* __USB_COMPAT_H__ */ #endif /* __USB_COMPAT_H__ */

View file

@ -6,8 +6,6 @@
#ifndef __DM_DEMO_H #ifndef __DM_DEMO_H
#define __DM_DEMO_H #define __DM_DEMO_H
#include <dm.h>
/** /**
* struct dm_demo_pdata - configuration data for demo instance * struct dm_demo_pdata - configuration data for demo instance
* *

View file

@ -3,6 +3,10 @@
* Copyright (c) 2013 Google, Inc * Copyright (c) 2013 Google, Inc
*/ */
#ifdef _DM_H_
#warning "Suspect dm.h is included from a header file - please fix"
#endif
#ifndef _DM_H_ #ifndef _DM_H_
#define _DM_H_ #define _DM_H_

View file

@ -11,6 +11,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <dm/device.h>
#include <dm/fdtaddr.h> #include <dm/fdtaddr.h>
#include <dm/ofnode.h> #include <dm/ofnode.h>
#include <dm/uclass.h> #include <dm/uclass.h>

View file

@ -6,9 +6,6 @@
#ifndef __DM_TEST_H #ifndef __DM_TEST_H
#define __DM_TEST_H #define __DM_TEST_H
#include <dm.h>
#include <test/test.h>
/** /**
* struct dm_test_cdata - configuration data for test instance * struct dm_test_cdata - configuration data for test instance
* *

View file

@ -8,8 +8,6 @@
#ifndef _EFI_DRIVER_H #ifndef _EFI_DRIVER_H
#define _EFI_DRIVER_H 1 #define _EFI_DRIVER_H 1
#include <common.h>
#include <dm.h>
#include <efi_loader.h> #include <efi_loader.h>
/* /*

View file

@ -6,9 +6,10 @@
#ifndef _eth_phy_h_ #ifndef _eth_phy_h_
#define _eth_phy_h_ #define _eth_phy_h_
#include <dm.h>
#include <phy.h> #include <phy.h>
struct udevice;
int eth_phy_binds_nodes(struct udevice *eth_dev); int eth_phy_binds_nodes(struct udevice *eth_dev);
int eth_phy_set_mdio_bus(struct udevice *eth_dev, struct mii_dev *mdio_bus); int eth_phy_set_mdio_bus(struct udevice *eth_dev, struct mii_dev *mdio_bus);
struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev); struct mii_dev *eth_phy_get_mdio_bus(struct udevice *eth_dev);

View file

@ -6,7 +6,7 @@
#ifndef _FS_LOADER_H_ #ifndef _FS_LOADER_H_
#define _FS_LOADER_H_ #define _FS_LOADER_H_
#include <dm.h> struct udevice;
/** /**
* struct phandle_part - A place for storing phandle of node and its partition * struct phandle_part - A place for storing phandle of node and its partition

View file

@ -5,7 +5,7 @@
#ifndef K210_BYPASS_H #ifndef K210_BYPASS_H
#define K210_BYPASS_H #define K210_BYPASS_H
#include <clk.h> struct clk;
struct k210_bypass { struct k210_bypass {
struct clk clk; struct clk clk;

View file

@ -9,12 +9,13 @@
#ifndef __LINUX_CLK_PROVIDER_H #ifndef __LINUX_CLK_PROVIDER_H
#define __LINUX_CLK_PROVIDER_H #define __LINUX_CLK_PROVIDER_H
#include <dm.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/err.h> #include <linux/err.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <linux/err.h> #include <linux/err.h>
struct udevice;
static inline void clk_dm(ulong id, struct clk *clk) static inline void clk_dm(ulong id, struct clk *clk)
{ {
if (!IS_ERR(clk)) if (!IS_ERR(clk))
@ -188,8 +189,5 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
const char *clk_hw_get_name(const struct clk *hw); const char *clk_hw_get_name(const struct clk *hw);
ulong clk_generic_get_rate(struct clk *clk); ulong clk_generic_get_rate(struct clk *clk);
static inline struct clk *dev_get_clk_ptr(struct udevice *dev) struct clk *dev_get_clk_ptr(struct udevice *dev);
{
return (struct clk *)dev_get_uclass_priv(dev);
}
#endif /* __LINUX_CLK_PROVIDER_H */ #endif /* __LINUX_CLK_PROVIDER_H */

View file

@ -9,14 +9,17 @@
#ifndef _PHY_H #ifndef _PHY_H
#define _PHY_H #define _PHY_H
#include <dm.h> #include <log.h>
#include <phy_interface.h>
#include <dm/ofnode.h>
#include <dm/read.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/mii.h> #include <linux/mii.h>
#include <linux/ethtool.h> #include <linux/ethtool.h>
#include <linux/mdio.h> #include <linux/mdio.h>
#include <log.h>
#include <phy_interface.h> struct udevice;
#define PHY_FIXED_ID 0xa5a55a5a #define PHY_FIXED_ID 0xa5a55a5a
#define PHY_NCSI_ID 0xbeefcafe #define PHY_NCSI_ID 0xbeefcafe

View file

@ -10,6 +10,8 @@
#ifndef _PHY_INTERFACE_H #ifndef _PHY_INTERFACE_H
#define _PHY_INTERFACE_H #define _PHY_INTERFACE_H
#include <string.h>
typedef enum { typedef enum {
PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_MII,
PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_GMII,

View file

@ -11,10 +11,7 @@
#ifndef __UBOOT_SPI_MEM_H #ifndef __UBOOT_SPI_MEM_H
#define __UBOOT_SPI_MEM_H #define __UBOOT_SPI_MEM_H
#include <common.h> struct udevice;
#include <dm.h>
#include <errno.h>
#include <spi.h>
#define SPI_MEM_OP_CMD(__opcode, __buswidth) \ #define SPI_MEM_OP_CMD(__opcode, __buswidth) \
{ \ { \

View file

@ -146,8 +146,6 @@ struct spi_slave {
#define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */ #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */
#define SPI_XFER_END BIT(1) /* Deassert CS after transfer */ #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */
#define SPI_XFER_ONCE (SPI_XFER_BEGIN | SPI_XFER_END) #define SPI_XFER_ONCE (SPI_XFER_BEGIN | SPI_XFER_END)
#define SPI_XFER_MMAP BIT(2) /* Memory Mapped start */
#define SPI_XFER_MMAP_END BIT(3) /* Memory Mapped End */
}; };
/** /**

View file

@ -9,10 +9,11 @@
#ifndef _SPI_FLASH_H_ #ifndef _SPI_FLASH_H_
#define _SPI_FLASH_H_ #define _SPI_FLASH_H_
#include <dm.h> /* Because we dereference struct udevice here */
#include <linux/types.h> #include <linux/types.h>
#include <linux/mtd/spi-nor.h> #include <linux/mtd/spi-nor.h>
struct udevice;
/* by default ENV use the same parameters than SF command */ /* by default ENV use the same parameters than SF command */
#ifndef CONFIG_ENV_SPI_BUS #ifndef CONFIG_ENV_SPI_BUS
# define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS # define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS

View file

@ -11,6 +11,7 @@
#include <command.h> #include <command.h>
#include <hexdump.h> #include <hexdump.h>
#include <linux/err.h> #include <linux/err.h>
#include <test/test.h>
struct unit_test_state; struct unit_test_state;

View file

@ -7,7 +7,7 @@
#ifndef _THERMAL_H_ #ifndef _THERMAL_H_
#define _THERMAL_H_ #define _THERMAL_H_
#include <dm.h> struct udevice;
int thermal_get_temp(struct udevice *dev, int *temp); int thermal_get_temp(struct udevice *dev, int *temp);

View file

@ -8,7 +8,7 @@
#ifndef __W1_H #ifndef __W1_H
#define __W1_H #define __W1_H
#include <dm.h> struct udevice;
#define W1_FAMILY_DS24B33 0x23 #define W1_FAMILY_DS24B33 0x23
#define W1_FAMILY_DS2431 0x2d #define W1_FAMILY_DS2431 0x2d

View file

@ -6,9 +6,7 @@
#ifndef _WDT_H_ #ifndef _WDT_H_
#define _WDT_H_ #define _WDT_H_
#include <dm.h> struct udevice;
#include <log.h>
#include <dm/read.h>
/* /*
* Implement a simple watchdog uclass. Watchdog is basically a timer that * Implement a simple watchdog uclass. Watchdog is basically a timer that

View file

@ -30,6 +30,7 @@
#include <common.h> #include <common.h>
#include <blk.h> #include <blk.h>
#include <dm.h>
#include <efi_driver.h> #include <efi_driver.h>
#include <malloc.h> #include <malloc.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>

View file

@ -17,6 +17,8 @@
* controllers. * controllers.
*/ */
#include <common.h>
#include <dm.h>
#include <efi_driver.h> #include <efi_driver.h>
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>

View file

@ -8,6 +8,7 @@
#include <common.h> #include <common.h>
#include <bootstage.h> #include <bootstage.h>
#include <command.h> #include <command.h>
#include <dm.h>
#include <env.h> #include <env.h>
#include <log.h> #include <log.h>
#include <net.h> #include <net.h>

View file

@ -2322,7 +2322,7 @@ sub get_raw_comment {
# Checks specific to U-Boot # Checks specific to U-Boot
sub u_boot_line { sub u_boot_line {
my ($realfile, $line, $herecurr) = @_; my ($realfile, $line, $rawline, $herecurr) = @_;
# ask for a test if a new uclass ID is added # ask for a test if a new uclass ID is added
if ($realfile =~ /uclass-id.h/ && $line =~ /^\+/) { if ($realfile =~ /uclass-id.h/ && $line =~ /^\+/) {
@ -2353,6 +2353,12 @@ sub u_boot_line {
ERROR("DEFINE_CONFIG_CMD", ERROR("DEFINE_CONFIG_CMD",
"All commands are managed by Kconfig\n" . $herecurr); "All commands are managed by Kconfig\n" . $herecurr);
} }
# Don't put common.h and dm.h in header files
if ($realfile =~ /\.h$/ && $rawline =~ /^\+#include\s*<(common|dm)\.h>*/) {
ERROR("BARRED_INCLUDE_IN_HDR",
"Avoid including common.h and dm.h in header files\n" . $herecurr);
}
} }
sub process { sub process {
@ -3296,7 +3302,7 @@ sub process {
} }
if ($u_boot) { if ($u_boot) {
u_boot_line($realfile, $line, $herecurr); u_boot_line($realfile, $line, $rawline, $herecurr);
} }
# check we are in a valid source file C or perl if not then ignore this hunk # check we are in a valid source file C or perl if not then ignore this hunk

View file

@ -17,6 +17,7 @@
#include <power/regulator.h> #include <power/regulator.h>
#include <power/sandbox_pmic.h> #include <power/sandbox_pmic.h>
#include <sandbox-adc.h> #include <sandbox-adc.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_adc_bind(struct unit_test_state *uts) static int dm_test_adc_bind(struct unit_test_state *uts)

View file

@ -8,6 +8,7 @@
#include <audio_codec.h> #include <audio_codec.h>
#include <dm.h> #include <dm.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
#include <asm/test.h> #include <asm/test.h>

View file

@ -8,9 +8,10 @@
#include <axi.h> #include <axi.h>
#include <dm.h> #include <dm.h>
#include <log.h> #include <log.h>
#include <dm/test.h>
#include <test/ut.h>
#include <asm/axi.h> #include <asm/axi.h>
#include <dm/test.h>
#include <test/test.h>
#include <test/ut.h>
/* Test that sandbox AXI works correctly */ /* Test that sandbox AXI works correctly */
static int dm_test_axi_base(struct unit_test_state *uts) static int dm_test_axi_base(struct unit_test_state *uts)

View file

@ -9,6 +9,7 @@
#include <usb.h> #include <usb.h>
#include <asm/state.h> #include <asm/state.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;

View file

@ -9,6 +9,7 @@
#include <log.h> #include <log.h>
#include <dm/test.h> #include <dm/test.h>
#include <board.h> #include <board.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
#include "../../drivers/board/sandbox.h" #include "../../drivers/board/sandbox.h"

View file

@ -9,6 +9,7 @@
#include <log.h> #include <log.h>
#include <asm/test.h> #include <asm/test.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_bootcount(struct unit_test_state *uts) static int dm_test_bootcount(struct unit_test_state *uts)

View file

@ -14,6 +14,7 @@
#include <dm/test.h> #include <dm/test.h>
#include <dm/uclass-internal.h> #include <dm/uclass-internal.h>
#include <dm/util.h> #include <dm/util.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;

View file

@ -12,6 +12,7 @@
#include <dm/test.h> #include <dm/test.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
#include <linux/err.h> #include <linux/err.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* Base test of the clk uclass */ /* Base test of the clk uclass */

View file

@ -11,6 +11,7 @@
#include <dm/test.h> #include <dm/test.h>
#include <dm/uclass.h> #include <dm/uclass.h>
#include <linux/err.h> #include <linux/err.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
#include <sandbox-clk.h> #include <sandbox-clk.h>

View file

@ -16,6 +16,7 @@
#include <dm/util.h> #include <dm/util.h>
#include <dm/test.h> #include <dm/test.h>
#include <dm/uclass-internal.h> #include <dm/uclass-internal.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;

View file

@ -10,6 +10,7 @@
#include <dm/test.h> #include <dm/test.h>
#include <dm/uclass-internal.h> #include <dm/uclass-internal.h>
#include <cpu.h> #include <cpu.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_cpu(struct unit_test_state *uts) static int dm_test_cpu(struct unit_test_state *uts)

View file

@ -11,6 +11,7 @@
#include <malloc.h> #include <malloc.h>
#include <dm/test.h> #include <dm/test.h>
#include <dma.h> #include <dma.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_dma_m2m(struct unit_test_state *uts) static int dm_test_dma_m2m(struct unit_test_state *uts)

View file

@ -10,6 +10,7 @@
#include <asm/state.h> #include <asm/state.h>
#include <asm/test.h> #include <asm/test.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_dsi_host_phy_init(void *priv_data) static int dm_test_dsi_host_phy_init(void *priv_data)

View file

@ -13,10 +13,11 @@
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>
#include <net.h> #include <net.h>
#include <asm/eth.h>
#include <dm/test.h> #include <dm/test.h>
#include <dm/device-internal.h> #include <dm/device-internal.h>
#include <dm/uclass-internal.h> #include <dm/uclass-internal.h>
#include <asm/eth.h> #include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
#define DM_TEST_ETH_NUM 4 #define DM_TEST_ETH_NUM 4

View file

@ -8,6 +8,7 @@
#include <syscon.h> #include <syscon.h>
#include <asm/test.h> #include <asm/test.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* Base test of firmware probe */ /* Base test of firmware probe */

View file

@ -9,10 +9,11 @@
#include <log.h> #include <log.h>
#include <malloc.h> #include <malloc.h>
#include <acpi/acpi_device.h> #include <acpi/acpi_device.h>
#include <asm/gpio.h>
#include <dm/root.h> #include <dm/root.h>
#include <dm/test.h> #include <dm/test.h>
#include <dm/util.h> #include <dm/util.h>
#include <asm/gpio.h> #include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* Test that sandbox GPIOs work correctly */ /* Test that sandbox GPIOs work correctly */

View file

@ -9,6 +9,7 @@
#include <asm/state.h> #include <asm/state.h>
#include <asm/test.h> #include <asm/test.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* Test that hwspinlock driver functions are called */ /* Test that hwspinlock driver functions are called */

View file

@ -16,6 +16,7 @@
#include <dm/uclass-internal.h> #include <dm/uclass-internal.h>
#include <dm/util.h> #include <dm/util.h>
#include <hexdump.h> #include <hexdump.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static const int busnum; static const int busnum;

View file

@ -7,9 +7,10 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <i2s.h> #include <i2s.h>
#include <dm/test.h>
#include <test/ut.h>
#include <asm/test.h> #include <asm/test.h>
#include <dm/test.h>
#include <test/test.h>
#include <test/ut.h>
/* Basic test of the i2s codec uclass */ /* Basic test of the i2s codec uclass */
static int dm_test_i2s(struct unit_test_state *uts) static int dm_test_i2s(struct unit_test_state *uts)

View file

@ -8,6 +8,7 @@
#include <led.h> #include <led.h>
#include <asm/gpio.h> #include <asm/gpio.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* Base test of the led uclass */ /* Base test of the led uclass */

View file

@ -8,6 +8,7 @@
#include <malloc.h> #include <malloc.h>
#include <dm/test.h> #include <dm/test.h>
#include <asm/mbox.h> #include <asm/mbox.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_mailbox(struct unit_test_state *uts) static int dm_test_mailbox(struct unit_test_state *uts)

View file

@ -7,10 +7,11 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <log.h> #include <log.h>
#include <dm/test.h>
#include <misc.h>
#include <test/ut.h>
#include <miiphy.h> #include <miiphy.h>
#include <misc.h>
#include <dm/test.h>
#include <test/test.h>
#include <test/ut.h>
/* macros copied over from mdio_sandbox.c */ /* macros copied over from mdio_sandbox.c */
#define SANDBOX_PHY_ADDR 5 #define SANDBOX_PHY_ADDR 5

View file

@ -6,10 +6,11 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <dm/test.h>
#include <misc.h>
#include <test/ut.h>
#include <miiphy.h> #include <miiphy.h>
#include <misc.h>
#include <dm/test.h>
#include <test/test.h>
#include <test/ut.h>
/* macros copied over from mdio_sandbox.c */ /* macros copied over from mdio_sandbox.c */
#define SANDBOX_PHY_ADDR 5 #define SANDBOX_PHY_ADDR 5

View file

@ -8,6 +8,7 @@
#include <dm.h> #include <dm.h>
#include <dm/test.h> #include <dm/test.h>
#include <misc.h> #include <misc.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
static int dm_test_misc(struct unit_test_state *uts) static int dm_test_misc(struct unit_test_state *uts)

View file

@ -8,6 +8,7 @@
#include <mmc.h> #include <mmc.h>
#include <part.h> #include <part.h>
#include <dm/test.h> #include <dm/test.h>
#include <test/test.h>
#include <test/ut.h> #include <test/ut.h>
/* /*

Some files were not shown because too many files have changed in this diff Show more