From 167efe01bc5a9de2aa4f7ce2663dbe398f9d43f6 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Oct 2014 21:37:04 -0600 Subject: dm: ns16550: Use an address instead of a pointer for the uart base It is inconvenient to have to use casts when specifying platform data. Also it is not strictly correct, since we should use map_sysmem() to convert an address to a pointer. Adjust the platform data to use an address. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- include/ns16550.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/ns16550.h b/include/ns16550.h index 5784cfd97b..0607379537 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -53,7 +53,7 @@ * @clock: UART base clock speed in Hz */ struct ns16550_platdata { - unsigned char *base; + unsigned long base; int reg_shift; int clock; }; -- cgit v1.2.1 From 1a44cd89faec48bc80543ed4cf2afc614863068b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Oct 2014 21:37:14 -0600 Subject: dm: am33xx: Move to driver model for GPIO and serial Adjust the configuration for the am33xx boards, including beaglebone black to use driver model. This can be extended to other OMAP boards once platform data is provided for them. Signed-off-by: Simon Glass Acked-by: Tom Rini --- include/configs/ti_am335x_common.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/configs/ti_am335x_common.h b/include/configs/ti_am335x_common.h index 80976e7e3b..5ed86d9365 100644 --- a/include/configs/ti_am335x_common.h +++ b/include/configs/ti_am335x_common.h @@ -19,12 +19,23 @@ #define CONFIG_SYS_TIMERBASE 0x48040000 /* Use Timer2 */ #define CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC +#ifndef CONFIG_SPL_BUILD +# define CONFIG_DM +# define CONFIG_CMD_DM +# define CONFIG_DM_GPIO +# define CONFIG_DM_SERIAL +# define CONFIG_OMAP_SERIAL +# define CONFIG_SYS_MALLOC_F_LEN (1 << 10) +#endif + #include /* NS16550 Configuration */ #define CONFIG_SYS_NS16550 +#ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE (-4) +#endif #define CONFIG_SYS_NS16550_CLK 48000000 /* Network defines. */ -- cgit v1.2.1 From b3f4ca1135edd66d14254089bbeb8077c6d0bb72 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 22 Oct 2014 21:37:15 -0600 Subject: dm: omap3: Move to driver model for GPIO and serial Adjust the configuration for the am33xx boards, including beagleboard, to use driver model. Signed-off-by: Simon Glass Acked-by: Tom Rini --- include/configs/ti_omap3_common.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/ti_omap3_common.h b/include/configs/ti_omap3_common.h index 3b19d3d6ba..3c634ee680 100644 --- a/include/configs/ti_omap3_common.h +++ b/include/configs/ti_omap3_common.h @@ -18,6 +18,15 @@ #include #include +#ifndef CONFIG_SPL_BUILD +# define CONFIG_DM +# define CONFIG_CMD_DM +# define CONFIG_DM_GPIO +# define CONFIG_DM_SERIAL +# define CONFIG_OMAP_SERIAL +# define CONFIG_SYS_MALLOC_F_LEN (1 << 10) +#endif + /* The chip has SDRC controller */ #define CONFIG_SDRC @@ -28,16 +37,20 @@ /* NS16550 Configuration */ #define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */ #define CONFIG_SYS_NS16550 -#define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE (-4) -#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK +#ifdef CONFIG_SPL_BUILD +# define CONFIG_SYS_NS16550_SERIAL +# define CONFIG_SYS_NS16550_REG_SIZE (-4) +# define CONFIG_SYS_NS16550_CLK V_NS16550_CLK +#endif #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, \ 115200} /* Select serial console configuration */ #define CONFIG_CONS_INDEX 3 +#ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_NS16550_COM3 OMAP34XX_UART3 #define CONFIG_SERIAL3 3 +#endif /* Physical Memory Map */ #define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0 -- cgit v1.2.1 From b892d127ffd448e8adf21e9703c0c5107e2a7814 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:42 -0600 Subject: dm: gpio: Implement GPIO reservation in the uclass We have several GPIO drivers now and all are doing similar things to record which GPIOs are reserved. Move this logic into the uclass to make the drivers similar. We retain the request()/free() methods since currently one driver does use these for setting up the pin. Signed-off-by: Simon Glass --- include/asm-generic/gpio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 1ebb9c724d..128249ef89 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -29,6 +29,9 @@ * Request a GPIO. This should be called before any of the other functions * are used on this GPIO. * + * Note: With driver model, the label is allocated so there is no need for + * the caller to preserve it. + * * @param gp GPIO number * @param label User label for this GPIO * @return 0 if ok, -1 on error @@ -157,11 +160,14 @@ struct dm_gpio_ops { * @gpio_base: Base GPIO number for this device. For the first active device * this will be 0; the numbering for others will follow sequentially so that * @gpio_base for device 1 will equal the number of GPIOs in device 0. + * @name: Array of pointers to the name for each GPIO in this bank. The + * value of the pointer will be NULL if the GPIO has not been claimed. */ struct gpio_dev_priv { const char *bank_name; unsigned gpio_count; unsigned gpio_base; + char **name; }; /* Access the GPIO operations for a device */ -- cgit v1.2.1 From 6449a506d67b0374bf23a3833f15afa0c92a7a0e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:43 -0600 Subject: dm: gpio: Add gpio_get_function() and friends Add helpers to the uclass to allow finding out the pin function. Signed-off-by: Simon Glass --- include/asm-generic/gpio.h | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 128249ef89..71044549ba 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -83,7 +83,7 @@ int gpio_get_value(unsigned gpio); int gpio_set_value(unsigned gpio, int value); /* State of a GPIO, as reported by get_function() */ -enum { +enum gpio_func_t { GPIOF_INPUT = 0, GPIOF_OUTPUT, GPIOF_UNUSED, /* Not claimed */ @@ -95,6 +95,38 @@ enum { struct udevice; +/** + * gpio_get_function() - get the current function for a GPIO pin + * + * Note this returns GPIOF_UNUSED if the GPIO is not requested. + * + * @dev: Device to check + * @offset: Offset of device GPIO to check + * @namep: If non-NULL, this is set to the nane given when the GPIO + * was requested, or -1 if it has not been requested + * @return -ENODATA if the driver returned an unknown function, + * -ENODEV if the device is not active, -EINVAL if the offset is invalid. + * GPIOF_UNUSED if the GPIO has not been requested. Otherwise returns the + * function from enum gpio_func_t. + */ +int gpio_get_function(struct udevice *dev, int offset, const char **namep); + +/** + * gpio_get_raw_function() - get the current raw function for a GPIO pin + * + * Note this does not return GPIOF_UNUSED - it will always return the GPIO + * driver's view of a pin function, even if it is not correctly set up. + * + * @dev: Device to check + * @offset: Offset of device GPIO to check + * @namep: If non-NULL, this is set to the nane given when the GPIO + * was requested, or -1 if it has not been requested + * @return -ENODATA if the driver returned an unknown function, + * -ENODEV if the device is not active, -EINVAL if the offset is invalid. + * Otherwise returns the function from enum gpio_func_t. + */ +int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep); + /** * struct struct dm_gpio_ops - Driver model GPIO operations * -- cgit v1.2.1 From 0757535a7eee3ae5603520fe4a0588a01a590ea7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:44 -0600 Subject: dm: Move the function for getting GPIO status into the uclass This function can be more easily tested if it is in the uclass. Signed-off-by: Simon Glass --- include/asm-generic/gpio.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 71044549ba..693bb56f77 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -95,6 +95,24 @@ enum gpio_func_t { struct udevice; +/** + * gpio_get_status() - get the current GPIO status as a string + * + * Obtain the current GPIO status as a string which can be presented to the + * user. A typical string is: + * + * "b4: in: 1 [x] sdmmc_cd" + * + * which means this is GPIO bank b, offset 4, currently set to input, current + * value 1, [x] means that it is requested and the owner is 'sdmmc_cd' + * + * @dev: Device to check + * @offset: Offset of device GPIO to check + * @buf: Place to put string + * @buffsize: Size of string including \0 + */ +int gpio_get_status(struct udevice *dev, int offset, char *buf, int buffsize); + /** * gpio_get_function() - get the current function for a GPIO pin * -- cgit v1.2.1 From d44f597b12b8f8099c3c52c3eb09540966cafe79 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:49 -0600 Subject: dm: gpio: Add gpio_requestf() helper for printf() strings Add a helper which permits a printf()-style format string for the requester string. Signed-off-by: Simon Glass --- include/asm-generic/gpio.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 693bb56f77..8af760e777 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -145,6 +145,16 @@ int gpio_get_function(struct udevice *dev, int offset, const char **namep); */ int gpio_get_raw_function(struct udevice *dev, int offset, const char **namep); +/** + * gpio_requestf() - request a GPIO using a format string for the owner + * + * This is a helper function for gpio_request(). It allows you to provide + * a printf()-format string for the GPIO owner. It calls gpio_request() with + * the string that is created + */ +int gpio_requestf(unsigned gpio, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + /** * struct struct dm_gpio_ops - Driver model GPIO operations * -- cgit v1.2.1 From 756ac0bb1526c8c661ad3ff673cd17c7602ab46e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:50 -0600 Subject: test: dm: Support memory leak checking as a core feature Check the state of the malloc() heap before each test is run, so that tests can verify that all is well at the end. Provide helper functions to mark the heap and to check that it returns to its initial state. Signed-off-by: Simon Glass --- include/dm/test.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include') diff --git a/include/dm/test.h b/include/dm/test.h index 235d728bfb..f08c05da81 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -8,6 +8,7 @@ #define __DM_TEST_H #include +#include /** * struct dm_test_cdata - configuration data for test instance @@ -120,6 +121,7 @@ struct dm_test_state { int force_fail_alloc; int skip_post_probe; struct udevice *removed; + struct mallinfo start; }; /* Test flags for each test */ @@ -177,6 +179,27 @@ int dm_check_operations(struct dm_test_state *dms, struct udevice *dev, */ int dm_check_devices(struct dm_test_state *dms, int num_devices); +/** + * dm_leak_check_start() - Prepare to check for a memory leak + * + * Call this before allocating memory to record the amount of memory being + * used. + * + * @dms: Overall test state + */ +void dm_leak_check_start(struct dm_test_state *dms); + +/** + * dm_leak_check_end() - Check that no memory has leaked + * + * Call this after dm_leak_check_start() and after you have hopefuilly freed + * all the memory that was allocated. This function will print an error if + * it sees a different amount of total memory allocated than before. + * + * @dms: Overall test state + */int dm_leak_check_end(struct dm_test_state *dms); + + /** * dm_test_main() - Run all the tests * -- cgit v1.2.1 From 2d91a9772c71e7f7c09fa4f6db2c3d11e6af8176 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 23 Oct 2014 13:15:58 -0600 Subject: dm: dts: Move omap device tree includes to correct place These ended up in arch/arm/dts/dt-bindings temporarily, but in fact the correct place is now include/dt-bindings. Move them to be consistent. Signed-off-by: Simon Glass --- include/dt-bindings/pinctrl/am33xx.h | 42 +++++++++++++++++++++++++++ include/dt-bindings/pinctrl/omap.h | 55 ++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 include/dt-bindings/pinctrl/am33xx.h create mode 100644 include/dt-bindings/pinctrl/omap.h (limited to 'include') diff --git a/include/dt-bindings/pinctrl/am33xx.h b/include/dt-bindings/pinctrl/am33xx.h new file mode 100644 index 0000000000..2fbc804e1a --- /dev/null +++ b/include/dt-bindings/pinctrl/am33xx.h @@ -0,0 +1,42 @@ +/* + * This header provides constants specific to AM33XX pinctrl bindings. + */ + +#ifndef _DT_BINDINGS_PINCTRL_AM33XX_H +#define _DT_BINDINGS_PINCTRL_AM33XX_H + +#include + +/* am33xx specific mux bit defines */ +#undef PULL_ENA +#undef INPUT_EN + +#define PULL_DISABLE (1 << 3) +#define INPUT_EN (1 << 5) +#define SLEWCTRL_FAST (1 << 6) + +/* update macro depending on INPUT_EN and PULL_ENA */ +#undef PIN_OUTPUT +#undef PIN_OUTPUT_PULLUP +#undef PIN_OUTPUT_PULLDOWN +#undef PIN_INPUT +#undef PIN_INPUT_PULLUP +#undef PIN_INPUT_PULLDOWN + +#define PIN_OUTPUT (PULL_DISABLE) +#define PIN_OUTPUT_PULLUP (PULL_UP) +#define PIN_OUTPUT_PULLDOWN 0 +#define PIN_INPUT (INPUT_EN | PULL_DISABLE) +#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP) +#define PIN_INPUT_PULLDOWN (INPUT_EN) + +/* undef non-existing modes */ +#undef PIN_OFF_NONE +#undef PIN_OFF_OUTPUT_HIGH +#undef PIN_OFF_OUTPUT_LOW +#undef PIN_OFF_INPUT_PULLUP +#undef PIN_OFF_INPUT_PULLDOWN +#undef PIN_OFF_WAKEUPENABLE + +#endif + diff --git a/include/dt-bindings/pinctrl/omap.h b/include/dt-bindings/pinctrl/omap.h new file mode 100644 index 0000000000..edbd250809 --- /dev/null +++ b/include/dt-bindings/pinctrl/omap.h @@ -0,0 +1,55 @@ +/* + * This header provides constants for OMAP pinctrl bindings. + * + * Copyright (C) 2009 Nokia + * Copyright (C) 2009-2010 Texas Instruments + */ + +#ifndef _DT_BINDINGS_PINCTRL_OMAP_H +#define _DT_BINDINGS_PINCTRL_OMAP_H + +/* 34xx mux mode options for each pin. See TRM for options */ +#define MUX_MODE0 0 +#define MUX_MODE1 1 +#define MUX_MODE2 2 +#define MUX_MODE3 3 +#define MUX_MODE4 4 +#define MUX_MODE5 5 +#define MUX_MODE6 6 +#define MUX_MODE7 7 + +/* 24xx/34xx mux bit defines */ +#define PULL_ENA (1 << 3) +#define PULL_UP (1 << 4) +#define ALTELECTRICALSEL (1 << 5) + +/* 34xx specific mux bit defines */ +#define INPUT_EN (1 << 8) +#define OFF_EN (1 << 9) +#define OFFOUT_EN (1 << 10) +#define OFFOUT_VAL (1 << 11) +#define OFF_PULL_EN (1 << 12) +#define OFF_PULL_UP (1 << 13) +#define WAKEUP_EN (1 << 14) + +/* 44xx specific mux bit defines */ +#define WAKEUP_EVENT (1 << 15) + +/* Active pin states */ +#define PIN_OUTPUT 0 +#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) +#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) +#define PIN_INPUT INPUT_EN +#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) +#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN) + +/* Off mode states */ +#define PIN_OFF_NONE 0 +#define PIN_OFF_OUTPUT_HIGH (OFF_EN | OFFOUT_EN | OFFOUT_VAL) +#define PIN_OFF_OUTPUT_LOW (OFF_EN | OFFOUT_EN) +#define PIN_OFF_INPUT_PULLUP (OFF_EN | OFF_PULL_EN | OFF_PULL_UP) +#define PIN_OFF_INPUT_PULLDOWN (OFF_EN | OFF_PULL_EN) +#define PIN_OFF_WAKEUPENABLE WAKEUP_EN + +#endif + -- cgit v1.2.1 From 85bfe6e4f6ecb667a8f65698e92bfa9a1a481850 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 4 Oct 2014 11:29:57 -0600 Subject: dm: gpio: Remove unused get_state() uclass method This is no longer used so drop it. Signed-off-by: Simon Glass --- include/asm-generic/gpio.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 8af760e777..4ec411b372 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -198,8 +198,6 @@ struct dm_gpio_ops { * @return current function - GPIOF_... */ int (*get_function)(struct udevice *dev, unsigned offset); - int (*get_state)(struct udevice *dev, unsigned offset, char *state, - int maxlen); }; /** -- cgit v1.2.1 From 7414112d70727e90be680e77dcb8a31394255ca8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 10 Oct 2014 07:49:18 -0600 Subject: dm: x86: Convert Intel ICH6 GPIO driver to use driver model Convert over this driver, using device tree to pass in the required information. The peripheral is still probed, just the number of GPIO banks and their offsets is in the device tree (previously this was a table in the driver). Signed-off-by: Simon Glass --- include/configs/coreboot.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 200b744e4f..0e85145c24 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -27,6 +27,10 @@ #define CONFIG_SYS_EARLY_PCI_INIT #define CONFIG_DISPLAY_BOARDINFO_LATE +#define CONFIG_DM +#define CONFIG_CMD_DM +#define CONFIG_DM_GPIO + #define CONFIG_LMB #define CONFIG_OF_LIBFDT -- cgit v1.2.1 From e98a03ca68ca0edd08c260126aacc8c0f550804a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 10 Oct 2014 07:49:20 -0600 Subject: dm: x86: Convert coreboot serial to use driver model This makes use of the existing device tree node to use driver model for the serial console. Signed-off-by: Simon Glass --- include/configs/coreboot.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h index 0e85145c24..4b90dc205d 100644 --- a/include/configs/coreboot.h +++ b/include/configs/coreboot.h @@ -30,6 +30,7 @@ #define CONFIG_DM #define CONFIG_CMD_DM #define CONFIG_DM_GPIO +#define CONFIG_DM_SERIAL #define CONFIG_LMB #define CONFIG_OF_LIBFDT @@ -92,21 +93,16 @@ /*----------------------------------------------------------------------- * Serial Configuration */ -#define CONFIG_CONS_INDEX 1 +#define CONFIG_COREBOOT_SERIAL #define CONFIG_SYS_NS16550 -#define CONFIG_SYS_NS16550_SERIAL -#define CONFIG_SYS_NS16550_REG_SIZE 1 -#define CONFIG_SYS_NS16550_CLK 1843200 -#define CONFIG_BAUDRATE 9600 +#define CONFIG_BAUDRATE 115200 #define CONFIG_SYS_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, \ 9600, 19200, 38400, 115200} -#define CONFIG_SYS_NS16550_COM1 UART0_BASE -#define CONFIG_SYS_NS16550_COM2 UART1_BASE #define CONFIG_SYS_NS16550_PORT_MAPPED -#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,eserial0\0" \ - "stdout=vga,eserial0,cbmem\0" \ - "stderr=vga,eserial0,cbmem\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ + "stdout=vga,serial,cbmem\0" \ + "stderr=vga,serial,cbmem\0" #define CONFIG_CONSOLE_MUX #define CONFIG_SYS_CONSOLE_IS_IN_ENV @@ -260,7 +256,7 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_MONITOR_LEN (256 * 1024) #define CONFIG_SYS_MALLOC_LEN (0x20000 + 128 * 1024) - +#define CONFIG_SYS_MALLOC_F_LEN (1 << 10) /* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE -- cgit v1.2.1 From 86256b796ee757b7d1407233d0ca71576a7b8182 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 24 Oct 2014 12:41:19 +0900 Subject: dm: move platform data headers to include/dm/platform_data The platform_data definitions are generally referenced from both drivers and board files. That is why header files defining platform_data sturectures are placed in "include" directory, but our top level "include" directory is already too cluttered. Let's collect platform_data definitions under the directory "include/dm/platform_data" like Linux gathers ones around under "include/linux/platform_data". This commit moves two header files: include/serial_mxc.h -> include/dm/platform_data/serial_mxc.h include/serial_pl01x.h -> include/dm/platform_data/serial_pl01x.h Signed-off-by: Masahiro Yamada --- include/dm/platform_data/serial_mxc.h | 14 ++++++++++++++ include/dm/platform_data/serial_pl01x.h | 27 +++++++++++++++++++++++++++ include/serial_mxc.h | 14 -------------- include/serial_pl01x.h | 27 --------------------------- 4 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 include/dm/platform_data/serial_mxc.h create mode 100644 include/dm/platform_data/serial_pl01x.h delete mode 100644 include/serial_mxc.h delete mode 100644 include/serial_pl01x.h (limited to 'include') diff --git a/include/dm/platform_data/serial_mxc.h b/include/dm/platform_data/serial_mxc.h new file mode 100644 index 0000000000..7d3ace2f9e --- /dev/null +++ b/include/dm/platform_data/serial_mxc.h @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2014 Google, Inc + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __serial_mxc_h +#define __serial_mxc_h + +/* Information about a serial port */ +struct mxc_serial_platdata { + struct mxc_uart *reg; /* address of registers in physical memory */ +}; + +#endif diff --git a/include/dm/platform_data/serial_pl01x.h b/include/dm/platform_data/serial_pl01x.h new file mode 100644 index 0000000000..5e068f390b --- /dev/null +++ b/include/dm/platform_data/serial_pl01x.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2014 Google, Inc + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __serial_pl01x_h +#define __serial_pl01x_h + +enum pl01x_type { + TYPE_PL010, + TYPE_PL011, +}; + +/* + *Information about a serial port + * + * @base: Register base address + * @type: Port type + * @clock: Input clock rate, used for calculating the baud rate divisor + */ +struct pl01x_serial_platdata { + unsigned long base; + enum pl01x_type type; + unsigned int clock; +}; + +#endif diff --git a/include/serial_mxc.h b/include/serial_mxc.h deleted file mode 100644 index 7d3ace2f9e..0000000000 --- a/include/serial_mxc.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2014 Google, Inc - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __serial_mxc_h -#define __serial_mxc_h - -/* Information about a serial port */ -struct mxc_serial_platdata { - struct mxc_uart *reg; /* address of registers in physical memory */ -}; - -#endif diff --git a/include/serial_pl01x.h b/include/serial_pl01x.h deleted file mode 100644 index 5e068f390b..0000000000 --- a/include/serial_pl01x.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014 Google, Inc - * SPDX-License-Identifier: GPL-2.0+ - */ - -#ifndef __serial_pl01x_h -#define __serial_pl01x_h - -enum pl01x_type { - TYPE_PL010, - TYPE_PL011, -}; - -/* - *Information about a serial port - * - * @base: Register base address - * @type: Port type - * @clock: Input clock rate, used for calculating the baud rate divisor - */ -struct pl01x_serial_platdata { - unsigned long base; - enum pl01x_type type; - unsigned int clock; -}; - -#endif -- cgit v1.2.1 From 3fdd0bb2b0dc20f192e9ea8682d5c18f37daadc1 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 23 Oct 2014 22:26:05 +0900 Subject: serial: add static directive to local functions The functions _serial_putc, _serial_putc_raw, _serial_puts, _serial_getc, _serial_tstc, _serial_setbrg are defined and used locally in each of serial_ns16550.c and serial_s3c24x0.c. Add static directive to them and remove declarations from include/common.h. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/common.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/common.h b/include/common.h index d5020c8c45..bcf6c7e950 100644 --- a/include/common.h +++ b/include/common.h @@ -636,13 +636,6 @@ struct stdio_dev; int serial_stub_getc(struct stdio_dev *sdev); int serial_stub_tstc(struct stdio_dev *sdev); -void _serial_setbrg (const int); -void _serial_putc (const char, const int); -void _serial_putc_raw(const char, const int); -void _serial_puts (const char *, const int); -int _serial_getc (const int); -int _serial_tstc (const int); - /* $(CPU)/speed.c */ int get_clocks (void); int get_clocks_866 (void); -- cgit v1.2.1 From d064cbffff37367b64b53f6e6942cbea67109237 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 23 Oct 2014 22:26:10 +0900 Subject: dm: serial: use Driver Model for UniPhier serial driver This commit converts UniPhier on-chip serial driver to driver model. Since UniPhier SoCs do not have Device Tree support, some board files should be added under arch/arm/cpu/armv7/uniphier/ph1-*/ directories. (Device Tree support for UniPhier platform is still under way.) Now the base address and master clock frequency are passed from platform data, so CONFIG_SYS_UNIPHIER_SERIAL_BASE* and CONFIG_SYS_UNIPHIER_UART_CLK should be removed. Tested on UniPhier PH1-LD4 ref board. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/configs/ph1_ld4.h | 2 -- include/configs/ph1_pro4.h | 2 -- include/configs/ph1_sld8.h | 2 -- include/configs/uniphier-common.h | 7 +++---- include/dm/platform_data/serial-uniphier.h | 18 ++++++++++++++++++ 5 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 include/dm/platform_data/serial-uniphier.h (limited to 'include') diff --git a/include/configs/ph1_ld4.h b/include/configs/ph1_ld4.h index a28d7b579a..a546865937 100644 --- a/include/configs/ph1_ld4.h +++ b/include/configs/ph1_ld4.h @@ -34,8 +34,6 @@ #define CONFIG_SYS_NS16550_SERIAL #endif -#define CONFIG_SYS_UNIPHIER_UART_CLK 36864000 - #define CONFIG_SMC911X #define CONFIG_DDR_NUM_CH0 1 diff --git a/include/configs/ph1_pro4.h b/include/configs/ph1_pro4.h index b79967f7da..85c14ba6cd 100644 --- a/include/configs/ph1_pro4.h +++ b/include/configs/ph1_pro4.h @@ -34,8 +34,6 @@ #define CONFIG_SYS_NS16550_SERIAL #endif -#define CONFIG_SYS_UNIPHIER_UART_CLK 73728000 - #define CONFIG_SMC911X #define CONFIG_DDR_NUM_CH0 2 diff --git a/include/configs/ph1_sld8.h b/include/configs/ph1_sld8.h index 9d391f1d74..41e2299bee 100644 --- a/include/configs/ph1_sld8.h +++ b/include/configs/ph1_sld8.h @@ -34,8 +34,6 @@ #define CONFIG_SYS_NS16550_SERIAL #endif -#define CONFIG_SYS_UNIPHIER_UART_CLK 80000000 - #define CONFIG_SMC911X #define CONFIG_DDR_NUM_CH0 1 diff --git a/include/configs/uniphier-common.h b/include/configs/uniphier-common.h index 18fe277cad..b18ae6dfae 100644 --- a/include/configs/uniphier-common.h +++ b/include/configs/uniphier-common.h @@ -33,18 +33,17 @@ are defined. Select only one of them." # define CONFIG_SUPPORT_CARD_UART_BASE (CONFIG_SUPPORT_CARD_BASE + 0x00200000) #endif +#ifdef CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550 #define CONFIG_SYS_NS16550_COM1 CONFIG_SUPPORT_CARD_UART_BASE #define CONFIG_SYS_NS16550_CLK 12288000 #define CONFIG_SYS_NS16550_REG_SIZE -2 +#endif #define CONFIG_SMC911X_BASE CONFIG_SUPPORT_CARD_ETHER_BASE #define CONFIG_SMC911X_32_BIT -#define CONFIG_SYS_UNIPHIER_SERIAL_BASE0 0x54006800 -#define CONFIG_SYS_UNIPHIER_SERIAL_BASE1 0x54006900 -#define CONFIG_SYS_UNIPHIER_SERIAL_BASE2 0x54006a00 -#define CONFIG_SYS_UNIPHIER_SERIAL_BASE3 0x54006b00 +#define CONFIG_SYS_MALLOC_F_LEN 0x7000 /*----------------------------------------------------------------------- * MMU and Cache Setting diff --git a/include/dm/platform_data/serial-uniphier.h b/include/dm/platform_data/serial-uniphier.h new file mode 100644 index 0000000000..52343e34ee --- /dev/null +++ b/include/dm/platform_data/serial-uniphier.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2014 Panasonic Corporation + * Author: Masahiro Yamada + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __PLAT_UNIPHIER_SERIAL_H +#define __PLAT_UNIPHIER_SERIAL_H + +#define DRIVER_NAME "uniphier-uart" + +struct uniphier_serial_platform_data { + unsigned long base; + unsigned int uartclk; +}; + +#endif /* __PLAT_UNIPHIER_SERIAL_H */ -- cgit v1.2.1 From ff247b7a0d2f4051786f5be1e73cf90a86b4b641 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 23 Oct 2014 22:26:11 +0900 Subject: serial: uniphier: move CONFIG_UNIPHIER_SERIAL to Kconfig Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/configs/ph1_ld4.h | 4 +--- include/configs/ph1_pro4.h | 4 +--- include/configs/ph1_sld8.h | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/configs/ph1_ld4.h b/include/configs/ph1_ld4.h index a546865937..005a853f56 100644 --- a/include/configs/ph1_ld4.h +++ b/include/configs/ph1_ld4.h @@ -28,9 +28,7 @@ * SoC UART : enable CONFIG_UNIPHIER_SERIAL * On-board UART: enable CONFIG_SYS_NS16550_SERIAL */ -#if 1 -#define CONFIG_UNIPHIER_SERIAL -#else +#if 0 #define CONFIG_SYS_NS16550_SERIAL #endif diff --git a/include/configs/ph1_pro4.h b/include/configs/ph1_pro4.h index 85c14ba6cd..7dd6fd2a92 100644 --- a/include/configs/ph1_pro4.h +++ b/include/configs/ph1_pro4.h @@ -28,9 +28,7 @@ * SoC UART : enable CONFIG_UNIPHIER_SERIAL * On-board UART: enable CONFIG_SYS_NS16550_SERIAL */ -#if 1 -#define CONFIG_UNIPHIER_SERIAL -#else +#if 0 #define CONFIG_SYS_NS16550_SERIAL #endif diff --git a/include/configs/ph1_sld8.h b/include/configs/ph1_sld8.h index 41e2299bee..1062aace38 100644 --- a/include/configs/ph1_sld8.h +++ b/include/configs/ph1_sld8.h @@ -28,9 +28,7 @@ * SoC UART : enable CONFIG_UNIPHIER_SERIAL * On-board UART: enable CONFIG_SYS_NS16550_SERIAL */ -#if 1 -#define CONFIG_UNIPHIER_SERIAL -#else +#if 0 #define CONFIG_SYS_NS16550_SERIAL #endif -- cgit v1.2.1