From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Chou Date: Mon, 14 Dec 2015 20:53:26 +0800 Subject: [U-Boot] [PATCH 1/3] dm: serial: Allow the UART driver to be dropped from the image In-Reply-To: <1450067820-17357-2-git-send-email-sjg@chromium.org> References: <1450067820-17357-1-git-send-email-sjg@chromium.org> <1450067820-17357-2-git-send-email-sjg@chromium.org> Message-ID: <566EBBC6.3090002@wytron.com.tw> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On 2015?12?14? 12:36, Simon Glass wrote: > In very very space-constrained devices even the full UART driver is too > large. In this case the debug UART can still be used in some cases. > > Add options to enable the UART driver in SPL and U-Boot proper. Enable both > options by default. > > Signed-off-by: Simon Glass > --- > > drivers/serial/Kconfig | 20 ++++++++++++++++++++ > drivers/serial/serial-uclass.c | 2 ++ > 2 files changed, 22 insertions(+) > > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig > index 1fc287e..04541c9 100644 > --- a/drivers/serial/Kconfig > +++ b/drivers/serial/Kconfig > @@ -15,6 +15,26 @@ config REQUIRE_SERIAL_CONSOLE > during serial port initialization (default y). Set this to n on > boards which have no debug serial port whatsoever. > > +config SERIAL_PRESENT > + bool "Provide a serial driver" > + depends on DM_SERIAL > + default y > + help > + In very space-constrained devices even the full UART driver is too > + large. In this case the debug UART can still be used in some cases. > + This option enables the full UART in U-Boot, so if is it disabled, > + the full UART driver will be omitted, thus saving space. > + > +config SPL_SERIAL_PRESENT > + bool "Provide a serial driver in SPL" > + depends on DM_SERIAL > + default y > + help > + In very space-constrained devices even the full UART driver is too > + large. In this case the debug UART can still be used in some cases. > + This option enables the full UART in SPL, so if is it disabled, > + the full UART driver will be omitted, thus saving space. > + > config DM_SERIAL > bool "Enable Driver Model for serial drivers" > depends on DM > diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c > index 4bf9a5c..95c3b91 100644 > --- a/drivers/serial/serial-uclass.c > +++ b/drivers/serial/serial-uclass.c > @@ -287,6 +287,7 @@ static int on_baudrate(const char *name, const char *value, enum env_op op, > } > U_BOOT_ENV_CALLBACK(baudrate, on_baudrate); > > +#if CONFIG_IS_ENABLED(SERIAL_PRESENT) > static int serial_post_probe(struct udevice *dev) > { > struct dm_serial_ops *ops = serial_get_ops(dev); > @@ -356,3 +357,4 @@ UCLASS_DRIVER(serial) = { > .pre_remove = serial_pre_remove, > .per_device_auto_alloc_size = sizeof(struct serial_dev_priv), > }; > +#endif > Reviewed-by: Thomas Chou