dm: gpio: Allow control of GPIO uclass in SPL
At present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass is included in SPL/TPL without any control for boards. Some boards may want to disable this to reduce code size where GPIOs are not needed in SPL or TPL. Add a new Kconfig option to permit this. Default it to 'y' so that existing boards work correctly. Change existing uses of CONFIG_DM_GPIO to CONFIG_IS_ENABLED(DM_GPIO) to preserve the current behaviour. Also update the 74x164 GPIO driver since it cannot build with SPL. This allows us to remove the hacks in config_uncmd_spl.h and Makefile.uncmd_spl (eventually those files should be removed). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
		
							parent
							
								
									3c10dc95bd
								
							
						
					
					
						commit
						bcee8d6764
					
				|  | @ -22,7 +22,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <asm/arch/cpu.h> | #include <asm/arch/cpu.h> | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| /* Information about a GPIO bank */ | /* Information about a GPIO bank */ | ||||||
| struct omap_gpio_platdata { | struct omap_gpio_platdata { | ||||||
|  |  | ||||||
|  | @ -133,7 +133,7 @@ | ||||||
| /*
 | /*
 | ||||||
|  * Other misc defines |  * Other misc defines | ||||||
|  */ |  */ | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #define ATMEL_PIO_PORTS		3		/* these SoCs have 3 PIO */ | #define ATMEL_PIO_PORTS		3		/* these SoCs have 3 PIO */ | ||||||
| #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA | #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ | ||||||
| #define davinci_gpio_bank67 ((struct davinci_gpio *)DAVINCI_GPIO_BANK67) | #define davinci_gpio_bank67 ((struct davinci_gpio *)DAVINCI_GPIO_BANK67) | ||||||
| #define davinci_gpio_bank8 ((struct davinci_gpio *)DAVINCI_GPIO_BANK8) | #define davinci_gpio_bank8 ((struct davinci_gpio *)DAVINCI_GPIO_BANK8) | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #define gpio_status()		gpio_info() | #define gpio_status()		gpio_info() | ||||||
| #endif | #endif | ||||||
| #define GPIO_NAME_SIZE		20 | #define GPIO_NAME_SIZE		20 | ||||||
|  |  | ||||||
|  | @ -116,7 +116,7 @@ U_BOOT_DEVICES(am33xx_i2c) = { | ||||||
| }; | }; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static const struct omap_gpio_platdata am33xx_gpio[] = { | static const struct omap_gpio_platdata am33xx_gpio[] = { | ||||||
| 	{ 0, AM33XX_GPIO0_BASE }, | 	{ 0, AM33XX_GPIO0_BASE }, | ||||||
| 	{ 1, AM33XX_GPIO1_BASE }, | 	{ 1, AM33XX_GPIO1_BASE }, | ||||||
|  | @ -141,7 +141,7 @@ U_BOOT_DEVICES(am33xx_gpios) = { | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static const struct gpio_bank gpio_bank_am33xx[] = { | static const struct gpio_bank gpio_bank_am33xx[] = { | ||||||
| 	{ (void *)AM33XX_GPIO0_BASE }, | 	{ (void *)AM33XX_GPIO0_BASE }, | ||||||
| 	{ (void *)AM33XX_GPIO1_BASE }, | 	{ (void *)AM33XX_GPIO1_BASE }, | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ extern omap3_sysinfo sysinfo; | ||||||
| static void omap3_invalidate_l2_cache_secure(void); | static void omap3_invalidate_l2_cache_secure(void); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #if !CONFIG_IS_ENABLED(OF_CONTROL) | #if !CONFIG_IS_ENABLED(OF_CONTROL) | ||||||
| /* Manually initialize GPIO banks when OF_CONTROL doesn't */ | /* Manually initialize GPIO banks when OF_CONTROL doesn't */ | ||||||
| static const struct omap_gpio_platdata omap34xx_gpio[] = { | static const struct omap_gpio_platdata omap34xx_gpio[] = { | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ | ||||||
| 
 | 
 | ||||||
| u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV; | u32 *const omap_si_rev = (u32 *)OMAP_SRAM_SCRATCH_OMAP_REV; | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static struct gpio_bank gpio_bank_54xx[8] = { | static struct gpio_bank gpio_bank_54xx[8] = { | ||||||
| 	{ (void *)OMAP54XX_GPIO1_BASE }, | 	{ (void *)OMAP54XX_GPIO1_BASE }, | ||||||
| 	{ (void *)OMAP54XX_GPIO2_BASE }, | 	{ (void *)OMAP54XX_GPIO2_BASE }, | ||||||
|  |  | ||||||
|  | @ -50,7 +50,7 @@ int board_early_init_f(void) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if IS_ENABLED(CONFIG_DM_GPIO) | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static void board_gpio_init(void) | static void board_gpio_init(void) | ||||||
| { | { | ||||||
| 	/* TODO */ | 	/* TODO */ | ||||||
|  |  | ||||||
|  | @ -54,7 +54,7 @@ int board_early_init_f(void) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if IS_ENABLED(CONFIG_DM_GPIO) | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static void board_gpio_init(void) | static void board_gpio_init(void) | ||||||
| { | { | ||||||
| 	struct gpio_desc desc; | 	struct gpio_desc desc; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,8 @@ | ||||||
| if TARGET_GW_VENTANA | if TARGET_GW_VENTANA | ||||||
| 
 | 
 | ||||||
|  | config DM_GPIO | ||||||
|  | 	default y | ||||||
|  | 
 | ||||||
| config SYS_BOARD | config SYS_BOARD | ||||||
| 	default "gw_ventana" | 	default "gw_ventana" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -51,7 +51,7 @@ int board_early_init_f(void) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if IS_ENABLED(CONFIG_DM_GPIO) | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static void board_gpio_init(void) | static void board_gpio_init(void) | ||||||
| { | { | ||||||
| 	/* TODO */ | 	/* TODO */ | ||||||
|  |  | ||||||
|  | @ -45,6 +45,7 @@ CONFIG_DEFAULT_DEVICE_TREE="logicpd-torpedo-35xx-devkit" | ||||||
| CONFIG_ENV_IS_IN_NAND=y | CONFIG_ENV_IS_IN_NAND=y | ||||||
| CONFIG_SPL_DM=y | CONFIG_SPL_DM=y | ||||||
| CONFIG_SPL_OF_TRANSLATE=y | CONFIG_SPL_OF_TRANSLATE=y | ||||||
|  | # CONFIG_SPL_DM_GPIO is not set | ||||||
| CONFIG_DM_I2C=y | CONFIG_DM_I2C=y | ||||||
| CONFIG_DM_MMC=y | CONFIG_DM_MMC=y | ||||||
| CONFIG_MMC_OMAP_HS=y | CONFIG_MMC_OMAP_HS=y | ||||||
|  |  | ||||||
|  | @ -14,6 +14,28 @@ config DM_GPIO | ||||||
| 	  particular GPIOs that they provide. The uclass interface | 	  particular GPIOs that they provide. The uclass interface | ||||||
| 	  is defined in include/asm-generic/gpio.h. | 	  is defined in include/asm-generic/gpio.h. | ||||||
| 
 | 
 | ||||||
|  | config SPL_DM_GPIO | ||||||
|  | 	bool "Enable Driver Model for GPIO drivers in SPL" | ||||||
|  | 	depends on DM_GPIO && SPL_DM && SPL_GPIO_SUPPORT | ||||||
|  | 	default y | ||||||
|  | 	help | ||||||
|  | 	  Enable driver model for GPIO access in SPL. The standard GPIO | ||||||
|  | 	  interface (gpio_get_value(), etc.) is then implemented by | ||||||
|  | 	  the GPIO uclass. Drivers provide methods to query the | ||||||
|  | 	  particular GPIOs that they provide. The uclass interface | ||||||
|  | 	  is defined in include/asm-generic/gpio.h. | ||||||
|  | 
 | ||||||
|  | config TPL_DM_GPIO | ||||||
|  | 	bool "Enable Driver Model for GPIO drivers in TPL" | ||||||
|  | 	depends on DM_GPIO && TPL_DM && TPL_GPIO_SUPPORT | ||||||
|  | 	default y | ||||||
|  | 	help | ||||||
|  | 	  Enable driver model for GPIO access in TPL. The standard GPIO | ||||||
|  | 	  interface (gpio_get_value(), etc.) is then implemented by | ||||||
|  | 	  the GPIO uclass. Drivers provide methods to query the | ||||||
|  | 	  particular GPIOs that they provide. The uclass interface | ||||||
|  | 	  is defined in include/asm-generic/gpio.h. | ||||||
|  | 
 | ||||||
| config GPIO_HOG | config GPIO_HOG | ||||||
| 	bool "Enable GPIO hog support" | 	bool "Enable GPIO hog support" | ||||||
| 	depends on DM_GPIO | 	depends on DM_GPIO | ||||||
|  |  | ||||||
|  | @ -7,10 +7,12 @@ ifndef CONFIG_SPL_BUILD | ||||||
| obj-$(CONFIG_DWAPB_GPIO)	+= dwapb_gpio.o | obj-$(CONFIG_DWAPB_GPIO)	+= dwapb_gpio.o | ||||||
| obj-$(CONFIG_AXP_GPIO)		+= axp_gpio.o | obj-$(CONFIG_AXP_GPIO)		+= axp_gpio.o | ||||||
| endif | endif | ||||||
| obj-$(CONFIG_DM_GPIO)		+= gpio-uclass.o | obj-$(CONFIG_$(SPL_TPL_)DM_GPIO) += gpio-uclass.o | ||||||
| 
 | 
 | ||||||
| obj-$(CONFIG_$(SPL_)DM_PCA953X)	+= pca953x_gpio.o | obj-$(CONFIG_$(SPL_)DM_PCA953X)	+= pca953x_gpio.o | ||||||
|  | ifdef CONFIG_$(SPL_TPL_)GPIO | ||||||
| obj-$(CONFIG_DM_74X164)		+= 74x164_gpio.o | obj-$(CONFIG_DM_74X164)		+= 74x164_gpio.o | ||||||
|  | endif | ||||||
| 
 | 
 | ||||||
| obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o | obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o | ||||||
| obj-$(CONFIG_ATMEL_PIO4)	+= atmel_pio4.o | obj-$(CONFIG_ATMEL_PIO4)	+= atmel_pio4.o | ||||||
|  |  | ||||||
|  | @ -210,7 +210,7 @@ int at91_pio3_set_d_periph(unsigned port, unsigned pin, int use_pullup) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static bool at91_get_port_output(struct at91_port *at91_port, int offset) | static bool at91_get_port_output(struct at91_port *at91_port, int offset) | ||||||
| { | { | ||||||
| 	u32 mask, val; | 	u32 mask, val; | ||||||
|  | @ -457,7 +457,7 @@ int at91_get_pio_value(unsigned port, unsigned pin) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| /* Common GPIO API */ | /* Common GPIO API */ | ||||||
| 
 | 
 | ||||||
| int gpio_request(unsigned gpio, const char *label) | int gpio_request(unsigned gpio, const char *label) | ||||||
|  | @ -499,7 +499,7 @@ int gpio_set_value(unsigned gpio, int value) | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| struct at91_port_priv { | struct at91_port_priv { | ||||||
| 	struct at91_port *regs; | 	struct at91_port *regs; | ||||||
|  |  | ||||||
|  | @ -168,7 +168,7 @@ int atmel_pio4_get_pio_input(u32 port, u32 pin) | ||||||
| 	return (readl(&port_base->pdsr) & mask) ? 1 : 0; | 	return (readl(&port_base->pdsr) & mask) ? 1 : 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| struct atmel_pioctrl_data { | struct atmel_pioctrl_data { | ||||||
| 	u32 nbanks; | 	u32 nbanks; | ||||||
|  |  | ||||||
|  | @ -15,7 +15,7 @@ | ||||||
| 
 | 
 | ||||||
| #include "da8xx_gpio.h" | #include "da8xx_gpio.h" | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <asm/arch/hardware.h> | #include <asm/arch/hardware.h> | ||||||
| #include <asm/arch/davinci_misc.h> | #include <asm/arch/davinci_misc.h> | ||||||
| 
 | 
 | ||||||
|  | @ -377,7 +377,8 @@ static int _gpio_direction_output(struct davinci_gpio *bank, unsigned int gpio, | ||||||
| 	_gpio_set_value(bank, gpio, value); | 	_gpio_set_value(bank, gpio, value); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| #ifndef CONFIG_DM_GPIO | 
 | ||||||
|  | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| void gpio_info(void) | void gpio_info(void) | ||||||
| { | { | ||||||
|  | @ -428,7 +429,7 @@ int gpio_set_value(unsigned int gpio, int value) | ||||||
| 	return _gpio_set_value(bank, gpio, value); | 	return _gpio_set_value(bank, gpio, value); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #else /* CONFIG_DM_GPIO */ | #else /* DM_GPIO */ | ||||||
| 
 | 
 | ||||||
| static struct davinci_gpio *davinci_get_gpio_bank(struct udevice *dev, unsigned int offset) | static struct davinci_gpio *davinci_get_gpio_bank(struct udevice *dev, unsigned int offset) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ struct davinci_gpio_bank { | ||||||
| #define MAX_NUM_GPIOS		144 | #define MAX_NUM_GPIOS		144 | ||||||
| #define GPIO_BIT(gp)		((gp) & 0x1F) | #define GPIO_BIT(gp)		((gp) & 0x1F) | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| /* Information about a GPIO bank */ | /* Information about a GPIO bank */ | ||||||
| struct davinci_gpio_platdata { | struct davinci_gpio_platdata { | ||||||
|  |  | ||||||
|  | @ -30,7 +30,7 @@ struct mxc_bank_info { | ||||||
| 	struct gpio_regs *regs; | 	struct gpio_regs *regs; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #define GPIO_TO_PORT(n)		((n) / 32) | #define GPIO_TO_PORT(n)		((n) / 32) | ||||||
| 
 | 
 | ||||||
| /* GPIO port description */ | /* GPIO port description */ | ||||||
|  | @ -161,7 +161,7 @@ int gpio_direction_output(unsigned gpio, int value) | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <fdtdec.h> | #include <fdtdec.h> | ||||||
| static int mxc_gpio_is_output(struct gpio_regs *regs, int offset) | static int mxc_gpio_is_output(struct gpio_regs *regs, int offset) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -128,7 +128,7 @@ int name_to_gpio(const char *name) | ||||||
| 
 | 
 | ||||||
| 	return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT); | 	return (bank << MXS_PAD_BANK_SHIFT) | (pin << MXS_PAD_PIN_SHIFT); | ||||||
| } | } | ||||||
| #else /* CONFIG_DM_GPIO */ | #else /* DM_GPIO */ | ||||||
| #include <dm.h> | #include <dm.h> | ||||||
| #include <asm/gpio.h> | #include <asm/gpio.h> | ||||||
| #include <dt-structs.h> | #include <dt-structs.h> | ||||||
|  | @ -312,4 +312,4 @@ U_BOOT_DRIVER(gpio_mxs) = { | ||||||
| 	.ofdata_to_platdata = mxs_ofdata_to_platdata, | 	.ofdata_to_platdata = mxs_ofdata_to_platdata, | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| #endif /* CONFIG_DM_GPIO */ | #endif /* DM_GPIO */ | ||||||
|  |  | ||||||
|  | @ -30,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR; | ||||||
| #define OMAP_GPIO_DIR_OUT	0 | #define OMAP_GPIO_DIR_OUT	0 | ||||||
| #define OMAP_GPIO_DIR_IN	1 | #define OMAP_GPIO_DIR_IN	1 | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| #define GPIO_PER_BANK			32 | #define GPIO_PER_BANK			32 | ||||||
| 
 | 
 | ||||||
|  | @ -121,7 +121,7 @@ static int _get_gpio_value(const struct gpio_bank *bank, int gpio) | ||||||
| 	return (__raw_readl(reg) & (1 << gpio)) != 0; | 	return (__raw_readl(reg) & (1 << gpio)) != 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 
 | 
 | ||||||
| static inline const struct gpio_bank *get_gpio_bank(int gpio) | static inline const struct gpio_bank *get_gpio_bank(int gpio) | ||||||
| { | { | ||||||
|  | @ -377,4 +377,4 @@ U_BOOT_DRIVER(gpio_omap) = { | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif /* CONFIG_DM_GPIO */ | #endif /* !DM_GPIO */ | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ struct sunxi_gpio_platdata { | ||||||
| 	int gpio_count; | 	int gpio_count; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static int sunxi_gpio_output(u32 pin, u32 val) | static int sunxi_gpio_output(u32 pin, u32 val) | ||||||
| { | { | ||||||
| 	u32 dat; | 	u32 dat; | ||||||
|  | @ -116,7 +116,7 @@ int sunxi_name_to_gpio(const char *name) | ||||||
| 		return -1; | 		return -1; | ||||||
| 	return group * 32 + pin; | 	return group * 32 + pin; | ||||||
| } | } | ||||||
| #endif | #endif /* DM_GPIO */ | ||||||
| 
 | 
 | ||||||
| int sunxi_name_to_gpio_bank(const char *name) | int sunxi_name_to_gpio_bank(const char *name) | ||||||
| { | { | ||||||
|  | @ -132,7 +132,7 @@ int sunxi_name_to_gpio_bank(const char *name) | ||||||
| 	return -1; | 	return -1; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| /* TODO(sjg@chromium.org): Remove this function and use device tree */ | /* TODO(sjg@chromium.org): Remove this function and use device tree */ | ||||||
| int sunxi_name_to_gpio(const char *name) | int sunxi_name_to_gpio(const char *name) | ||||||
| { | { | ||||||
|  | @ -373,4 +373,4 @@ U_BOOT_DRIVER(gpio_sunxi) = { | ||||||
| 	.bind	= gpio_sunxi_bind, | 	.bind	= gpio_sunxi_bind, | ||||||
| 	.probe	= gpio_sunxi_probe, | 	.probe	= gpio_sunxi_probe, | ||||||
| }; | }; | ||||||
| #endif | #endif /* DM_GPIO */ | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| #include <dm/device-internal.h> | #include <dm/device-internal.h> | ||||||
| #include <dm/lists.h> | #include <dm/lists.h> | ||||||
| #include <dm/pinctrl.h> | #include <dm/pinctrl.h> | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <asm/gpio.h> | #include <asm/gpio.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -465,7 +465,7 @@ int i2c_get_chip_offset_len(struct udevice *dev) | ||||||
| 	return chip->offset_len; | 	return chip->offset_len; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static void i2c_gpio_set_pin(struct gpio_desc *pin, int bit) | static void i2c_gpio_set_pin(struct gpio_desc *pin, int bit) | ||||||
| { | { | ||||||
| 	if (bit) | 	if (bit) | ||||||
|  | @ -561,7 +561,7 @@ static int i2c_deblock_gpio(struct udevice *bus) | ||||||
| { | { | ||||||
| 	return -ENOSYS; | 	return -ENOSYS; | ||||||
| } | } | ||||||
| #endif // CONFIG_DM_GPIO
 | #endif /* DM_GPIO */ | ||||||
| 
 | 
 | ||||||
| int i2c_deblock(struct udevice *bus) | int i2c_deblock(struct udevice *bus) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -125,7 +125,7 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev) | ||||||
| 
 | 
 | ||||||
| static int pca954x_probe(struct udevice *dev) | static int pca954x_probe(struct udevice *dev) | ||||||
| { | { | ||||||
| 	if (IS_ENABLED(CONFIG_DM_GPIO)) { | 	if (CONFIG_IS_ENABLED(DM_GPIO)) { | ||||||
| 		struct pca954x_priv *priv = dev_get_priv(dev); | 		struct pca954x_priv *priv = dev_get_priv(dev); | ||||||
| 		int err; | 		int err; | ||||||
| 
 | 
 | ||||||
|  | @ -146,7 +146,7 @@ static int pca954x_probe(struct udevice *dev) | ||||||
| 
 | 
 | ||||||
| static int pca954x_remove(struct udevice *dev) | static int pca954x_remove(struct udevice *dev) | ||||||
| { | { | ||||||
| 	if (IS_ENABLED(CONFIG_DM_GPIO)) { | 	if (CONFIG_IS_ENABLED(DM_GPIO)) { | ||||||
| 		struct pca954x_priv *priv = dev_get_priv(dev); | 		struct pca954x_priv *priv = dev_get_priv(dev); | ||||||
| 
 | 
 | ||||||
| 		if (dm_gpio_is_valid(&priv->gpio_mux_reset)) | 		if (dm_gpio_is_valid(&priv->gpio_mux_reset)) | ||||||
|  |  | ||||||
|  | @ -150,7 +150,7 @@ struct fsl_esdhc_priv { | ||||||
| 	struct udevice *vqmmc_dev; | 	struct udevice *vqmmc_dev; | ||||||
| 	struct udevice *vmmc_dev; | 	struct udevice *vmmc_dev; | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc cd_gpio; | 	struct gpio_desc cd_gpio; | ||||||
| 	struct gpio_desc wp_gpio; | 	struct gpio_desc wp_gpio; | ||||||
| #endif | #endif | ||||||
|  | @ -303,8 +303,9 @@ static int esdhc_setup_data(struct fsl_esdhc_priv *priv, struct mmc *mmc, | ||||||
| 				return -ETIMEDOUT; | 				return -ETIMEDOUT; | ||||||
| 			} | 			} | ||||||
| 		} else { | 		} else { | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 			if (dm_gpio_is_valid(&priv->wp_gpio) && dm_gpio_get_value(&priv->wp_gpio)) { | 			if (dm_gpio_is_valid(&priv->wp_gpio) && | ||||||
|  | 			    dm_gpio_get_value(&priv->wp_gpio)) { | ||||||
| 				printf("\nThe SD card is locked. Can not write to a locked card.\n\n"); | 				printf("\nThe SD card is locked. Can not write to a locked card.\n\n"); | ||||||
| 				return -ETIMEDOUT; | 				return -ETIMEDOUT; | ||||||
| 			} | 			} | ||||||
|  | @ -1092,7 +1093,7 @@ static int esdhc_getcd_common(struct fsl_esdhc_priv *priv) | ||||||
| #if CONFIG_IS_ENABLED(DM_MMC) | #if CONFIG_IS_ENABLED(DM_MMC) | ||||||
| 	if (priv->non_removable) | 	if (priv->non_removable) | ||||||
| 		return 1; | 		return 1; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	if (dm_gpio_is_valid(&priv->cd_gpio)) | 	if (dm_gpio_is_valid(&priv->cd_gpio)) | ||||||
| 		return dm_gpio_get_value(&priv->cd_gpio); | 		return dm_gpio_get_value(&priv->cd_gpio); | ||||||
| #endif | #endif | ||||||
|  | @ -1454,7 +1455,7 @@ static int fsl_esdhc_probe(struct udevice *dev) | ||||||
| 		priv->non_removable = 1; | 		priv->non_removable = 1; | ||||||
| 	 } else { | 	 } else { | ||||||
| 		priv->non_removable = 0; | 		priv->non_removable = 0; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 		gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, | 		gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, | ||||||
| 				     GPIOD_IS_IN); | 				     GPIOD_IS_IN); | ||||||
| #endif | #endif | ||||||
|  | @ -1464,7 +1465,7 @@ static int fsl_esdhc_probe(struct udevice *dev) | ||||||
| 		priv->wp_enable = 1; | 		priv->wp_enable = 1; | ||||||
| 	} else { | 	} else { | ||||||
| 		priv->wp_enable = 0; | 		priv->wp_enable = 0; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 		gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio, | 		gpio_request_by_name(dev, "wp-gpios", 0, &priv->wp_gpio, | ||||||
| 				   GPIOD_IS_IN); | 				   GPIOD_IS_IN); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -184,7 +184,7 @@ static int omap_mmc_setup_gpio_in(int gpio, const char *label) | ||||||
| { | { | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	if (!gpio_is_valid(gpio)) | 	if (!gpio_is_valid(gpio)) | ||||||
| 		return -1; | 		return -1; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -82,7 +82,7 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_GPIO) | #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static int dw_mdio_reset(struct mii_dev *bus) | static int dw_mdio_reset(struct mii_dev *bus) | ||||||
| { | { | ||||||
| 	struct udevice *dev = bus->priv; | 	struct udevice *dev = bus->priv; | ||||||
|  | @ -128,7 +128,7 @@ static int dw_mdio_init(const char *name, void *priv) | ||||||
| 	bus->read = dw_mdio_read; | 	bus->read = dw_mdio_read; | ||||||
| 	bus->write = dw_mdio_write; | 	bus->write = dw_mdio_write; | ||||||
| 	snprintf(bus->name, sizeof(bus->name), "%s", name); | 	snprintf(bus->name, sizeof(bus->name), "%s", name); | ||||||
| #if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_GPIO) | #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	bus->reset = dw_mdio_reset; | 	bus->reset = dw_mdio_reset; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -807,12 +807,12 @@ const struct eth_ops designware_eth_ops = { | ||||||
| int designware_eth_ofdata_to_platdata(struct udevice *dev) | int designware_eth_ofdata_to_platdata(struct udevice *dev) | ||||||
| { | { | ||||||
| 	struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); | 	struct dw_eth_pdata *dw_pdata = dev_get_platdata(dev); | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct dw_eth_dev *priv = dev_get_priv(dev); | 	struct dw_eth_dev *priv = dev_get_priv(dev); | ||||||
| #endif | #endif | ||||||
| 	struct eth_pdata *pdata = &dw_pdata->eth_pdata; | 	struct eth_pdata *pdata = &dw_pdata->eth_pdata; | ||||||
| 	const char *phy_mode; | 	const char *phy_mode; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	int reset_flags = GPIOD_IS_OUT; | 	int reset_flags = GPIOD_IS_OUT; | ||||||
| #endif | #endif | ||||||
| 	int ret = 0; | 	int ret = 0; | ||||||
|  | @ -829,7 +829,7 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev) | ||||||
| 
 | 
 | ||||||
| 	pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0); | 	pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	if (dev_read_bool(dev, "snps,reset-active-low")) | 	if (dev_read_bool(dev, "snps,reset-active-low")) | ||||||
| 		reset_flags |= GPIOD_ACTIVE_LOW; | 		reset_flags |= GPIOD_ACTIVE_LOW; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| #ifndef _DW_ETH_H | #ifndef _DW_ETH_H | ||||||
| #define _DW_ETH_H | #define _DW_ETH_H | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <asm-generic/gpio.h> | #include <asm-generic/gpio.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -235,7 +235,7 @@ struct dw_eth_dev { | ||||||
| #ifndef CONFIG_DM_ETH | #ifndef CONFIG_DM_ETH | ||||||
| 	struct eth_device *dev; | 	struct eth_device *dev; | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc reset_gpio; | 	struct gpio_desc reset_gpio; | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_CLK | #ifdef CONFIG_CLK | ||||||
|  |  | ||||||
|  | @ -1309,7 +1309,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| /* FEC GPIO reset */ | /* FEC GPIO reset */ | ||||||
| static void fec_gpio_reset(struct fec_priv *priv) | static void fec_gpio_reset(struct fec_priv *priv) | ||||||
| { | { | ||||||
|  | @ -1402,7 +1402,7 @@ static int fecmxc_probe(struct udevice *dev) | ||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	fec_gpio_reset(priv); | 	fec_gpio_reset(priv); | ||||||
| #endif | #endif | ||||||
| 	/* Reset chip. */ | 	/* Reset chip. */ | ||||||
|  | @ -1508,7 +1508,7 @@ static int fecmxc_ofdata_to_platdata(struct udevice *dev) | ||||||
| 	device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply); | 	device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0, | 	ret = gpio_request_by_name(dev, "phy-reset-gpios", 0, | ||||||
| 				   &priv->phy_reset_gpio, GPIOD_IS_OUT); | 				   &priv->phy_reset_gpio, GPIOD_IS_OUT); | ||||||
| 	if (ret < 0) | 	if (ret < 0) | ||||||
|  |  | ||||||
|  | @ -255,7 +255,7 @@ struct fec_priv { | ||||||
| #ifdef CONFIG_DM_REGULATOR | #ifdef CONFIG_DM_REGULATOR | ||||||
| 	struct udevice *phy_supply; | 	struct udevice *phy_supply; | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc phy_reset_gpio; | 	struct gpio_desc phy_reset_gpio; | ||||||
| 	uint32_t reset_delay; | 	uint32_t reset_delay; | ||||||
| 	uint32_t reset_post_delay; | 	uint32_t reset_post_delay; | ||||||
|  |  | ||||||
|  | @ -276,7 +276,7 @@ struct mvneta_port { | ||||||
| 	int init; | 	int init; | ||||||
| 	int phyaddr; | 	int phyaddr; | ||||||
| 	struct phy_device *phydev; | 	struct phy_device *phydev; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc phy_reset_gpio; | 	struct gpio_desc phy_reset_gpio; | ||||||
| #endif | #endif | ||||||
| 	struct mii_dev *bus; | 	struct mii_dev *bus; | ||||||
|  | @ -1754,7 +1754,7 @@ static int mvneta_probe(struct udevice *dev) | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		return ret; | 		return ret; | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	gpio_request_by_name(dev, "phy-reset-gpios", 0, | 	gpio_request_by_name(dev, "phy-reset-gpios", 0, | ||||||
| 			     &pp->phy_reset_gpio, GPIOD_IS_OUT); | 			     &pp->phy_reset_gpio, GPIOD_IS_OUT); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -959,7 +959,8 @@ struct mvpp2_port { | ||||||
| 	phy_interface_t phy_interface; | 	phy_interface_t phy_interface; | ||||||
| 	int phyaddr; | 	int phyaddr; | ||||||
| 	struct udevice *mdio_dev; | 	struct udevice *mdio_dev; | ||||||
| #ifdef CONFIG_DM_GPIO | 	struct mii_dev *bus; | ||||||
|  | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc phy_reset_gpio; | 	struct gpio_desc phy_reset_gpio; | ||||||
| 	struct gpio_desc phy_tx_disable_gpio; | 	struct gpio_desc phy_tx_disable_gpio; | ||||||
| #endif | #endif | ||||||
|  | @ -4742,7 +4743,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	gpio_request_by_name(dev, "phy-reset-gpios", 0, | 	gpio_request_by_name(dev, "phy-reset-gpios", 0, | ||||||
| 			     &port->phy_reset_gpio, GPIOD_IS_OUT); | 			     &port->phy_reset_gpio, GPIOD_IS_OUT); | ||||||
| 	gpio_request_by_name(dev, "marvell,sfp-tx-disable-gpio", 0, | 	gpio_request_by_name(dev, "marvell,sfp-tx-disable-gpio", 0, | ||||||
|  | @ -4769,7 +4770,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| /* Port GPIO initialization */ | /* Port GPIO initialization */ | ||||||
| static void mvpp2_gpio_init(struct mvpp2_port *port) | static void mvpp2_gpio_init(struct mvpp2_port *port) | ||||||
| { | { | ||||||
|  | @ -4802,7 +4803,7 @@ static int mvpp2_port_probe(struct udevice *dev, | ||||||
| 	} | 	} | ||||||
| 	mvpp2_port_power_up(port); | 	mvpp2_port_power_up(port); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	mvpp2_gpio_init(port); | 	mvpp2_gpio_init(port); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ | ||||||
| #include <net.h> | #include <net.h> | ||||||
| #include <reset.h> | #include <reset.h> | ||||||
| #include <dt-bindings/pinctrl/sun4i-a10.h> | #include <dt-bindings/pinctrl/sun4i-a10.h> | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <asm-generic/gpio.h> | #include <asm-generic/gpio.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -142,7 +142,7 @@ struct emac_eth_dev { | ||||||
| 	struct clk ephy_clk; | 	struct clk ephy_clk; | ||||||
| 	struct reset_ctl tx_rst; | 	struct reset_ctl tx_rst; | ||||||
| 	struct reset_ctl ephy_rst; | 	struct reset_ctl ephy_rst; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc reset_gpio; | 	struct gpio_desc reset_gpio; | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  | @ -696,7 +696,7 @@ err_tx_clk: | ||||||
| 	return ret; | 	return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if defined(CONFIG_DM_GPIO) | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| static int sun8i_mdio_reset(struct mii_dev *bus) | static int sun8i_mdio_reset(struct mii_dev *bus) | ||||||
| { | { | ||||||
| 	struct udevice *dev = bus->priv; | 	struct udevice *dev = bus->priv; | ||||||
|  | @ -743,7 +743,7 @@ static int sun8i_mdio_init(const char *name, struct udevice *priv) | ||||||
| 	bus->write = sun8i_mdio_write; | 	bus->write = sun8i_mdio_write; | ||||||
| 	snprintf(bus->name, sizeof(bus->name), name); | 	snprintf(bus->name, sizeof(bus->name), name); | ||||||
| 	bus->priv = (void *)priv; | 	bus->priv = (void *)priv; | ||||||
| #if defined(CONFIG_DM_GPIO) | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	bus->reset = sun8i_mdio_reset; | 	bus->reset = sun8i_mdio_reset; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -905,7 +905,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) | ||||||
| 	const fdt32_t *reg; | 	const fdt32_t *reg; | ||||||
| 	int node = dev_of_offset(dev); | 	int node = dev_of_offset(dev); | ||||||
| 	int offset = 0; | 	int offset = 0; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	int reset_flags = GPIOD_IS_OUT; | 	int reset_flags = GPIOD_IS_OUT; | ||||||
| #endif | #endif | ||||||
| 	int ret; | 	int ret; | ||||||
|  | @ -999,7 +999,7 @@ static int sun8i_emac_eth_ofdata_to_platdata(struct udevice *dev) | ||||||
| 		printf("%s: Invalid RX delay value %d\n", __func__, | 		printf("%s: Invalid RX delay value %d\n", __func__, | ||||||
| 		       sun8i_pdata->rx_delay_ps); | 		       sun8i_pdata->rx_delay_ps); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), | 	if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev), | ||||||
| 			    "snps,reset-active-low")) | 			    "snps,reset-active-low")) | ||||||
| 		reset_flags |= GPIOD_ACTIVE_LOW; | 		reset_flags |= GPIOD_ACTIVE_LOW; | ||||||
|  |  | ||||||
|  | @ -610,7 +610,7 @@ static int pcie_advk_probe(struct udevice *dev) | ||||||
| { | { | ||||||
| 	struct pcie_advk *pcie = dev_get_priv(dev); | 	struct pcie_advk *pcie = dev_get_priv(dev); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc reset_gpio; | 	struct gpio_desc reset_gpio; | ||||||
| 
 | 
 | ||||||
| 	gpio_request_by_name(dev, "reset-gpio", 0, &reset_gpio, | 	gpio_request_by_name(dev, "reset-gpio", 0, &reset_gpio, | ||||||
|  | @ -636,7 +636,7 @@ static int pcie_advk_probe(struct udevice *dev) | ||||||
| 	} | 	} | ||||||
| #else | #else | ||||||
| 	dev_dbg(pcie->dev, "PCIE Reset on GPIO support is missing\n"); | 	dev_dbg(pcie->dev, "PCIE Reset on GPIO support is missing\n"); | ||||||
| #endif /* CONFIG_DM_GPIO */ | #endif /* DM_GPIO */ | ||||||
| 
 | 
 | ||||||
| 	pcie->first_busno = dev->seq; | 	pcie->first_busno = dev->seq; | ||||||
| 	pcie->dev = pci_get_controller(dev); | 	pcie->dev = pci_get_controller(dev); | ||||||
|  |  | ||||||
|  | @ -476,7 +476,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) | ||||||
| 	struct pcie_dw_mvebu *pcie = dev_get_priv(dev); | 	struct pcie_dw_mvebu *pcie = dev_get_priv(dev); | ||||||
| 	struct udevice *ctlr = pci_get_controller(dev); | 	struct udevice *ctlr = pci_get_controller(dev); | ||||||
| 	struct pci_controller *hose = dev_get_uclass_priv(ctlr); | 	struct pci_controller *hose = dev_get_uclass_priv(ctlr); | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc reset_gpio; | 	struct gpio_desc reset_gpio; | ||||||
| 
 | 
 | ||||||
| 	gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio, | 	gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio, | ||||||
|  | @ -496,7 +496,7 @@ static int pcie_dw_mvebu_probe(struct udevice *dev) | ||||||
| 	} | 	} | ||||||
| #else | #else | ||||||
| 	debug("PCIE Reset on GPIO support is missing\n"); | 	debug("PCIE Reset on GPIO support is missing\n"); | ||||||
| #endif /* CONFIG_DM_GPIO */ | #endif /* DM_GPIO */ | ||||||
| 
 | 
 | ||||||
| 	pcie->first_busno = dev->seq; | 	pcie->first_busno = dev->seq; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
| #ifdef CONFIG_DM_SPI | #ifdef CONFIG_DM_SPI | ||||||
| #include <asm/arch/at91_spi.h> | #include <asm/arch/at91_spi.h> | ||||||
| #endif | #endif | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #include <asm/gpio.h> | #include <asm/gpio.h> | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | @ -228,7 +228,7 @@ struct atmel_spi_priv { | ||||||
| 	unsigned int freq;		/* Default frequency */ | 	unsigned int freq;		/* Default frequency */ | ||||||
| 	unsigned int mode; | 	unsigned int mode; | ||||||
| 	ulong bus_clk_rate; | 	ulong bus_clk_rate; | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct gpio_desc cs_gpios[MAX_CS_COUNT]; | 	struct gpio_desc cs_gpios[MAX_CS_COUNT]; | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  | @ -285,7 +285,7 @@ static int atmel_spi_release_bus(struct udevice *dev) | ||||||
| 
 | 
 | ||||||
| static void atmel_spi_cs_activate(struct udevice *dev) | static void atmel_spi_cs_activate(struct udevice *dev) | ||||||
| { | { | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct udevice *bus = dev_get_parent(dev); | 	struct udevice *bus = dev_get_parent(dev); | ||||||
| 	struct atmel_spi_priv *priv = dev_get_priv(bus); | 	struct atmel_spi_priv *priv = dev_get_priv(bus); | ||||||
| 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); | 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); | ||||||
|  | @ -300,7 +300,7 @@ static void atmel_spi_cs_activate(struct udevice *dev) | ||||||
| 
 | 
 | ||||||
| static void atmel_spi_cs_deactivate(struct udevice *dev) | static void atmel_spi_cs_deactivate(struct udevice *dev) | ||||||
| { | { | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct udevice *bus = dev_get_parent(dev); | 	struct udevice *bus = dev_get_parent(dev); | ||||||
| 	struct atmel_spi_priv *priv = dev_get_priv(bus); | 	struct atmel_spi_priv *priv = dev_get_priv(bus); | ||||||
| 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); | 	struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); | ||||||
|  | @ -468,7 +468,7 @@ static int atmel_spi_probe(struct udevice *bus) | ||||||
| 
 | 
 | ||||||
| 	bus_plat->regs = (struct at91_spi *)devfdt_get_addr(bus); | 	bus_plat->regs = (struct at91_spi *)devfdt_get_addr(bus); | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_DM_GPIO | #if CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| 	struct atmel_spi_priv *priv = dev_get_priv(bus); | 	struct atmel_spi_priv *priv = dev_get_priv(bus); | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -126,7 +126,7 @@ static inline void dw_write(struct dw_spi_priv *priv, u32 offset, u32 val) | ||||||
| 
 | 
 | ||||||
| static int request_gpio_cs(struct udevice *bus) | static int request_gpio_cs(struct udevice *bus) | ||||||
| { | { | ||||||
| #if defined(CONFIG_DM_GPIO) && !defined(CONFIG_SPL_BUILD) | #if CONFIG_IS_ENABLED(DM_GPIO) && !defined(CONFIG_SPL_BUILD) | ||||||
| 	struct dw_spi_priv *priv = dev_get_priv(bus); | 	struct dw_spi_priv *priv = dev_get_priv(bus); | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
|  | @ -373,7 +373,7 @@ static int poll_transfer(struct dw_spi_priv *priv) | ||||||
|  */ |  */ | ||||||
| __weak void external_cs_manage(struct udevice *dev, bool on) | __weak void external_cs_manage(struct udevice *dev, bool on) | ||||||
| { | { | ||||||
| #if defined(CONFIG_DM_GPIO) && !defined(CONFIG_SPL_BUILD) | #if CONFIG_IS_ENABLED(DM_GPIO) && !defined(CONFIG_SPL_BUILD) | ||||||
| 	struct dw_spi_priv *priv = dev_get_priv(dev->parent); | 	struct dw_spi_priv *priv = dev_get_priv(dev->parent); | ||||||
| 
 | 
 | ||||||
| 	if (!dm_gpio_is_valid(&priv->cs_gpio)) | 	if (!dm_gpio_is_valid(&priv->cs_gpio)) | ||||||
|  |  | ||||||
|  | @ -587,7 +587,7 @@ static int tpm_tis_spi_probe(struct udevice *dev) | ||||||
| 	/* Use the TPM v2 stack */ | 	/* Use the TPM v2 stack */ | ||||||
| 	priv->version = TPM_V2; | 	priv->version = TPM_V2; | ||||||
| 
 | 
 | ||||||
| 	if (IS_ENABLED(CONFIG_DM_GPIO)) { | 	if (CONFIG_IS_ENABLED(DM_GPIO)) { | ||||||
| 		struct gpio_desc reset_gpio; | 		struct gpio_desc reset_gpio; | ||||||
| 
 | 
 | ||||||
| 		ret = gpio_request_by_name(dev, "gpio-reset", 0, | 		ret = gpio_request_by_name(dev, "gpio-reset", 0, | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| 
 | 
 | ||||||
| #ifndef CONFIG_SPL_DM | #ifndef CONFIG_SPL_DM | ||||||
| #undef CONFIG_DM_SERIAL | #undef CONFIG_DM_SERIAL | ||||||
| #undef CONFIG_DM_GPIO |  | ||||||
| #undef CONFIG_DM_I2C | #undef CONFIG_DM_I2C | ||||||
| #undef CONFIG_DM_SPI | #undef CONFIG_DM_SPI | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -9,6 +9,8 @@ | ||||||
| #ifndef __AT91_SAMA5_COMMON_H | #ifndef __AT91_SAMA5_COMMON_H | ||||||
| #define __AT91_SAMA5_COMMON_H | #define __AT91_SAMA5_COMMON_H | ||||||
| 
 | 
 | ||||||
|  | #include <linux/kconfig.h> | ||||||
|  | 
 | ||||||
| /* ARM asynchronous clock */ | /* ARM asynchronous clock */ | ||||||
| #define CONFIG_SYS_AT91_SLOW_CLOCK      32768 | #define CONFIG_SYS_AT91_SLOW_CLOCK      32768 | ||||||
| #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */ | #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */ | ||||||
|  | @ -18,11 +20,10 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /* general purpose I/O */ | /* general purpose I/O */ | ||||||
| #ifndef CONFIG_DM_GPIO | #if !CONFIG_IS_ENABLED(DM_GPIO) | ||||||
| #define CONFIG_AT91_GPIO | #define CONFIG_AT91_GPIO | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| /*
 | /*
 | ||||||
|  * BOOTP options |  * BOOTP options | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | @ -36,7 +36,6 @@ | ||||||
| 
 | 
 | ||||||
| /* Driver Model */ | /* Driver Model */ | ||||||
| #ifndef CONFIG_SPL_BUILD | #ifndef CONFIG_SPL_BUILD | ||||||
| #define CONFIG_DM_GPIO |  | ||||||
| #define CONFIG_DM_THERMAL | #define CONFIG_DM_THERMAL | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -44,6 +44,7 @@ | ||||||
| #define CONFIG_SYS_I2C_SPEED		100000 | #define CONFIG_SYS_I2C_SPEED		100000 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | /* Note: This is incorrect and should move to Kconfig / defconfig */ | ||||||
| #ifdef CONFIG_DM_GPIO | #ifdef CONFIG_DM_GPIO | ||||||
| #define CONFIG_DM_74X164 | #define CONFIG_DM_74X164 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | @ -6,7 +6,6 @@ ifdef CONFIG_SPL_BUILD | ||||||
| 
 | 
 | ||||||
| ifndef CONFIG_SPL_DM | ifndef CONFIG_SPL_DM | ||||||
| CONFIG_DM_SERIAL= | CONFIG_DM_SERIAL= | ||||||
| CONFIG_DM_GPIO= |  | ||||||
| CONFIG_DM_I2C= | CONFIG_DM_I2C= | ||||||
| CONFIG_DM_SPI= | CONFIG_DM_SPI= | ||||||
| CONFIG_DM_SPI_FLASH= | CONFIG_DM_SPI_FLASH= | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue