summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2019-01-04 10:55:06 +0100
committerTom Rini <trini@konsulko.com>2019-01-09 07:13:33 -0500
commit4fb224638d608ba3bdc9200360663b4109038580 (patch)
treea41a8a53c8e92be82d68a6b7862b50971ec2522a
parent39a8f0be2d3df589ba227310e66dca706e154920 (diff)
downloadu-boot-4fb224638d608ba3bdc9200360663b4109038580.tar.gz
u-boot-4fb224638d608ba3bdc9200360663b4109038580.tar.bz2
u-boot-4fb224638d608ba3bdc9200360663b4109038580.zip
gpio: stm32f7: Fix SPL code size
In order to keep SPL code size below the 32Kb limit, put under CONFIG_SPL_BUILD flag all unused code in SPL. This is needed for stm32f7xx board which are using SPL. Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
-rw-r--r--drivers/gpio/stm32f7_gpio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c
index dbaa80cf8c..5c9f2fe64d 100644
--- a/drivers/gpio/stm32f7_gpio.c
+++ b/drivers/gpio/stm32f7_gpio.c
@@ -19,6 +19,7 @@
#define MODE_BITS_MASK 3
#define BSRR_BIT(gpio_pin, value) BIT(gpio_pin + (value ? 0 : 16))
+#ifndef CONFIG_SPL_BUILD
/*
* convert gpio offset to gpio index taking into account gpio holes
* into gpio bank
@@ -145,23 +146,27 @@ static const struct dm_gpio_ops gpio_stm32_ops = {
.set_value = stm32_gpio_set_value,
.get_function = stm32_gpio_get_function,
};
+#endif
static int gpio_stm32_probe(struct udevice *dev)
{
- struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
struct stm32_gpio_priv *priv = dev_get_priv(dev);
- struct ofnode_phandle_args args;
struct clk clk;
fdt_addr_t addr;
- const char *name;
int ret;
- int i;
addr = dev_read_addr(dev);
if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
priv->regs = (struct stm32_gpio_regs *)addr;
+
+#ifndef CONFIG_SPL_BUILD
+ struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+ struct ofnode_phandle_args args;
+ const char *name;
+ int i;
+
name = dev_read_string(dev, "st,bank-name");
if (!name)
return -EINVAL;
@@ -189,7 +194,7 @@ static int gpio_stm32_probe(struct udevice *dev)
dev_dbg(dev, "addr = 0x%p bank_name = %s gpio_count = %d gpio_range = 0x%x\n",
(u32 *)priv->regs, uc_priv->bank_name, uc_priv->gpio_count,
priv->gpio_range);
-
+#endif
ret = clk_get_by_index(dev, 0, &clk);
if (ret < 0)
return ret;
@@ -215,7 +220,9 @@ U_BOOT_DRIVER(gpio_stm32) = {
.id = UCLASS_GPIO,
.of_match = stm32_gpio_ids,
.probe = gpio_stm32_probe,
+#ifndef CONFIG_SPL_BUILD
.ops = &gpio_stm32_ops,
+#endif
.flags = DM_UC_FLAG_SEQ_ALIAS,
.priv_auto_alloc_size = sizeof(struct stm32_gpio_priv),
};