preperation for sh adding
Subsystems (10)
cover preperation for sh adding
Hi,
this is the last updated patch series to prepare the adding of the SH architecture
The following changes since commit 0d35c3c8a0c2a1f1ff06eac20a12af0186753bc4:
menu: simplify usage for clients (2010-08-30 21:06:02 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git sh-prepare
Jean-Christophe PLAGNIOL-VILLARD (9):
types.h: move __kernel_dev_t to include/linux/types.h
device: fix dev_name
stm8815: fix the uart device clock match
arm: move clkdev to drivers/clk
vsprintf: add %w and %w support to print unit at91/clock: switch to %w for clock info printing
cfi_flash: use %W and IEEE 1541 format
use %W instead of size_human_readable and use IEEE 1541 format
clkdev: add print clk info command
arch/arm/Kconfig | 1 -
arch/arm/Makefile | 2 +-
arch/arm/common/Kconfig | 2 -
arch/arm/common/Makefile | 5 --
arch/arm/configs/nhk8815_defconfig | 2 +-
arch/arm/include/asm/clkdev.h | 15 +------
arch/arm/include/asm/posix_types.h | 1 -
arch/arm/mach-at91/clock.c | 8 +--
arch/arm/mach-nomadik/8815.c | 6 ++-
arch/arm/mach-nomadik/Kconfig | 2 +-
arch/arm/mach-nomadik/clock.c | 7 +--
arch/blackfin/include/asm/posix_types.h | 1 -
arch/m68k/include/asm/posix_types.h | 1 -
arch/ppc/include/asm/posix_types.h | 1 -
arch/sandbox/include/asm/posix_types.h | 1 -
arch/x86/include/asm/posix_types.h | 1 -
commands/Kconfig | 7 +++
commands/bootm.c | 7 +--
common/startup.c | 9 ++--
drivers/Kconfig | 1 +
drivers/Makefile | 1 +
drivers/clk/Kconfig | 4 ++
drivers/clk/Makefile | 2 +
{arch/arm/common => drivers/clk}/clkdev.c | 57 +++++++++++++++++++---
drivers/nor/cfi_flash.c | 4 +-
include/common.h | 1 -
include/driver.h | 12 +++--
include/linux/clkdev.h | 36 ++++++++++++++
include/linux/kernel.h | 20 ++++++++
include/linux/types.h | 2 +
lib/Makefile | 1 -
lib/display_options.c | 60 -----------------------
lib/driver.c | 16 +++----
lib/vsprintf.c | 73 +++++++++++++++++++++++++++++
34 files changed, 230 insertions(+), 139 deletions(-)
delete mode 100644 arch/arm/common/Kconfig
delete mode 100644 arch/arm/common/Makefile
create mode 100644 drivers/clk/Kconfig
create mode 100644 drivers/clk/Makefile
rename {arch/arm/common => drivers/clk}/clkdev.c (75%)
create mode 100644 include/linux/clkdev.h
delete mode 100644 lib/display_options.cBest Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/9 types.h: move __kernel_dev_t to include/linux/types.h
no need to have a arch specific type
--- arch/arm/include/asm/posix_types.h | 1 - arch/blackfin/include/asm/posix_types.h | 1 - arch/m68k/include/asm/posix_types.h | 1 - arch/ppc/include/asm/posix_types.h | 1 - arch/sandbox/include/asm/posix_types.h | 1 - arch/x86/include/asm/posix_types.h | 1 - include/linux/types.h | 2 ++ 7 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/include/asm/posix_types.h +0 -1
@@ -19,7 +19,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/blackfin/include/asm/posix_types.h +0 -1
@@ -34,7 +34,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/m68k/include/asm/posix_types.h +0 -1
@@ -27,7 +27,6 @@#define __ARCH_M68K_POSIX_TYPES_H -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/ppc/include/asm/posix_types.h +0 -1
@@ -7,7 +7,6 @@* assume GCC is being used. */ -typedef unsigned int __kernel_dev_t ;typedef unsigned int __kernel_ino_t ;typedef unsigned int __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/sandbox/include/asm/posix_types.h +0 -1
@@ -7,7 +7,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/x86/include/asm/posix_types.h +0 -1
@@ -27,7 +27,6 @@#define _ASM_X86_POSIX_TYPES_Htypedef unsigned long __kernel_ino_t ; -typedef unsigned short __kernel_dev_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;typedef long __kernel_off_t ;
include/linux/types.h +2 -0
@@ -6,6 +6,8 @@#ifndef __KERNEL_STRICT_NAMES +typedef __u32 __kernel_dev_t ; +typedef __kernel_fd_set fd_set ;typedef __kernel_dev_t dev_t ;typedef __kernel_ino_t ino_t ;
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/9 device: fix dev_name
In reply to Jean-Christophe PLAGNIOL-VILLARDdev_name is supposed to return the name of the device plus the id
currently we use %s%d format where in the kernel the use %s.%d
we may think to switch to this format for the device name and keeping the %s%d for the devfs
this will be usefull to not modify the clock device name as example
--- include/driver.h | 12 +++++++----- lib/driver.c | 16 +++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-)
include/driver.h +7 -5
@@ -25,7 +25,8 @@#include <linux/list.h> -#define MAX_DRIVER_NAME 32 +#define MAX_DRIVER_NAME 32 +#define FORMAT_DRIVER_MANE_ID "%s%d"#include <param.h>
@@ -176,9 +177,11 @@ int get_free_deviceid(const char *name_template);char *deviceid_from_spec_str (const char *str,char **endp); +extern const char *dev_id (const struct device_d *dev); +static inline const char *dev_name (const struct device_d *dev) { -return dev->name; +return dev_id (dev); }/* linear list over all available devices
@@ -239,11 +242,10 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f) }/* debugging and troubleshooting/diagnostic helpers. */ -extern const char *dev_id (const struct device_d *dev); #define dev_printf(dev, format, arg...) \ - printf("%s@%s: " format , dev_name(dev) , \ - dev_id(dev) , ## arg) + printf("%s@%s: " format , dev->name , \ + dev_name(dev) , ## arg) #define dev_emerg(dev, format, arg...) \ dev_printf((dev) , format , ## arg)
lib/driver.c +7 -9
@@ -45,11 +45,9 @@ static LIST_HEAD(active);struct device_d *get_device_by_name (const char *name) {struct device_d *dev; -char devname[MAX_DRIVER_NAME +3 ];for_each_device (dev) { -sprintf (devname,"%s%d" , dev->name, dev->id); -if (!strcmp (name, devname)) +if (!strcmp (dev_name (dev), name))return dev; }
@@ -62,7 +60,7 @@ int get_free_deviceid(const char *name_template)char name[MAX_DRIVER_NAME +3 ];while (1 ) { -sprintf (name,"%s%d" , name_template, i); +sprintf (name,FORMAT_DRIVER_MANE_ID , name_template, i);if (!get_device_by_name (name))return i; i++;
@@ -97,7 +95,7 @@ int register_device(struct device_d *new_device) new_device->id =get_free_deviceid (new_device->name); -debug ("register_device: %s\n" ,new_device->name); +debug ("register_device: %s\n" ,dev_name (new_device));if (!new_device->bus) {// dev_err(new_device, "no bus type associated. Needs fixup\n");
@@ -120,7 +118,7 @@ EXPORT_SYMBOL(register_device);int unregister_device (struct device_d *old_dev) { -debug ("unregister_device: %s:%s\n" ,old_dev->name, old_dev->id); +debug ("unregister_device: %s\n" ,dev_name (old_dev->name));if (!list_empty (&old_dev->children)) { errno = -EBUSY ;
@@ -164,7 +162,7 @@ struct driver_d *get_driver_by_name(const char *name)static void noinfo (struct device_d *dev) { -printf ("no info available for %s\n" , dev->name); +printf ("no info available for %s\n" ,dev_name (dev)); }static void noshortinfo (struct device_d *dev)
@@ -237,7 +235,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)for (i =0 ; i < depth; i++)printf ("| " ); -printf ("%c----%s%d" , edge, dev->name, dev->id); +printf ("%c----%s" , edge,dev_name (dev));if (!list_empty (&dev->cdevs)) {printf (" (" );list_for_each_entry (cdev, &dev->cdevs, devices_list) {
@@ -264,7 +262,7 @@ const char *dev_id(const struct device_d *dev) {static char buf[sizeof (unsigned long ) *2 ]; -sprintf (buf,"%s%d" , dev->name, dev->id); +sprintf (buf,FORMAT_DRIVER_MANE_ID , dev->name, dev->id);return buf; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/9 stm8815: fix the uart device clock match
In reply to Jean-Christophe PLAGNIOL-VILLARDthat use the device name + id to found it's clock to use the right match as we fix the dev_name macro
--- arch/arm/mach-nomadik/8815.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-nomadik/8815.c +4 -2
@@ -50,12 +50,14 @@ void st8815_add_device_sdram(u32 size) }static struct device_d uart0_serial_device = { + .id =0 , .name ="uart-pl011" , .map_base =NOMADIK_UART0_BASE , .size =4096 , };static struct device_d uart1_serial_device = { + .id =1 , .name ="uart-pl011" , .map_base =NOMADIK_UART1_BASE , .size =4096 ,
@@ -65,12 +67,12 @@ void st8815_register_uart(unsigned id) {switch (id) {case 0 : -nmdk_clk_create (&st8815_clk_48, uart0_serial_device.name);register_device (&uart0_serial_device); +nmdk_clk_create (&st8815_clk_48,dev_name (&uart0_serial_device));break ;case 1 : -nmdk_clk_create (&st8815_clk_48, uart1_serial_device.name);register_device (&uart1_serial_device); +nmdk_clk_create (&st8815_clk_48,dev_name (&uart0_serial_device));break ; } }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/9 arm: move clkdev to drivers/clk
In reply to Jean-Christophe PLAGNIOL-VILLARDas refer in this patch "arm & sh: factorised duplicated clkdev.c"
factorise some generic infrastructure to assist looking up struct clks for the ARM & SH architecture.
as the code is identical at 99% in linux
move it also as preparing for the SH adding
--- arch/arm/Kconfig | 1 - arch/arm/Makefile | 2 +- arch/arm/common/Kconfig | 2 - arch/arm/common/Makefile | 5 - arch/arm/common/clkdev.c | 160 ---------------------------------- arch/arm/configs/nhk8815_defconfig | 2 +- arch/arm/include/asm/clkdev.h | 15 +--- arch/arm/mach-nomadik/Kconfig | 2 +- arch/arm/mach-nomadik/clock.c | 7 +-- drivers/Kconfig | 1 + drivers/Makefile | 1 + drivers/clk/Kconfig | 4 + drivers/clk/Makefile | 2 + drivers/clk/clkdev.c | 168 ++++++++++++++++++++++++++++++++++++ include/linux/clkdev.h | 36 ++++++++ 15 files changed, 217 insertions(+), 191 deletions(-) delete mode 100644 arch/arm/common/Kconfig delete mode 100644 arch/arm/common/Makefile delete mode 100644 arch/arm/common/clkdev.c create mode 100644 drivers/clk/Kconfig create mode 100644 drivers/clk/Makefile create mode 100644 drivers/clk/clkdev.c create mode 100644 include/linux/clkdev.h
arch/arm/Kconfig +0 -1
@@ -58,7 +58,6 @@ config ARCH_S3C24xx endchoice -source arch/arm/common/Kconfig source arch/arm/cpu/Kconfig source arch/arm/mach-at91/Kconfig source arch/arm/mach-ep93xx/Kconfig
arch/arm/Makefile +1 -1
@@ -131,7 +131,7 @@ MACH := endif common-y += $(BOARD) $(MACH) -common-y += arch/arm/lib/ arch/arm/cpu/ arch/arm/common/ +common-y += arch/arm/lib/ arch/arm/cpu/ lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/arm/lib/barebox.lds lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
arch/arm/common/Kconfig deleted +0 -2
@@ -1,2 +0,0 @@ -config COMMON_CLKDEV - bool
arch/arm/common/Makefile deleted +0 -5
@@ -1,5 +0,0 @@ -# -# Makefile for the linux kernel. -# - -obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
arch/arm/common/clkdev.c deleted +0 -160
160 lines not on this page · raw message
arch/arm/configs/nhk8815_defconfig +1 -1
@@ -19,7 +19,7 @@ CONFIG_ARM_AMBA=y CONFIG_ARCH_NOMADIK=y # CONFIG_ARCH_OMAP is not set # CONFIG_ARCH_S3C24xx is not set -CONFIG_COMMON_CLKDEV=y +CONFIG_CLKDEV_LOOKUP=y # # Processor Type
arch/arm/include/asm/clkdev.h +1 -14
@@ -12,19 +12,6 @@#ifndef __ASM_CLKDEV_H#define __ASM_CLKDEV_H -struct clk ; - -struct clk_lookup { -struct list_head node; -const char *dev_id; -const char *con_id; -struct clk *clk; -}; - -struct clk_lookup *clkdev_alloc (struct clk *clk,const char *con_id, -const char *dev_fmt, ...); - -void clkdev_add (struct clk_lookup *cl); -void clkdev_drop (struct clk_lookup *cl); +#include <mach/clkdev.h> #endif
arch/arm/mach-nomadik/Kconfig +1 -1
@@ -13,7 +13,7 @@ choice config MACH_NOMADIK_8815NHK bool "ST 8815 Nomadik Hardware Kit (evaluation board)" select NOMADIK_8815 - select COMMON_CLKDEV + select CLKDEV_LOOKUP endchoice
arch/arm/mach-nomadik/clock.c +1 -6
@@ -8,7 +8,7 @@#include <linux/err.h> #include <linux/clk.h> #include <init.h> -#include <asm/clkdev.h> +#include <linux/clkdev.h> #include "clock.h"
@@ -34,11 +34,6 @@ void clk_disable(struct clk *clk) }EXPORT_SYMBOL (clk_disable); -int __clk_get (struct clk *clk) -{ -return 1 ; -} -/* Create a clock structure with the given name */ int nmdk_clk_create (struct clk *clk,const char *dev_id) {
drivers/Kconfig +1 -0
@@ -9,5 +9,6 @@ source "drivers/mtd/Kconfig" source "drivers/ata/Kconfig" source "drivers/usb/Kconfig" source "drivers/video/Kconfig" +source "drivers/clk/Kconfig" endmenu
drivers/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_ATA) += ata/ obj-$(CONFIG_SPI) += spi/ obj-$(CONFIG_I2C) += i2c/ obj-$(CONFIG_VIDEO) += video/ +obj-y += clk/
drivers/clk/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ + +config CLKDEV_LOOKUP + bool + select HAVE_CLK
drivers/clk/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
drivers/clk/clkdev.c new file +168 -0
168 lines not on this page · raw message
include/linux/clkdev.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* include/linux/clkdev.h +* +* Copyright (C) 2008 Russell King. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* Helper for the clk API to assist looking up a struct clk. +*/ +#ifndef __CLKDEV_H +#define __CLKDEV_H + +#include <asm/clkdev.h> + +struct clk ; +struct device_d ; + +struct clk_lookup { +struct list_head node; +const char *dev_id; +const char *con_id; +struct clk *clk; +}; + +struct clk_lookup *clkdev_alloc (struct clk *clk,const char *con_id, +const char *dev_fmt, ...); + +void clkdev_add (struct clk_lookup *cl); +void clkdev_drop (struct clk_lookup *cl); + +void clkdev_add_table (struct clk_lookup *,size_t ); +int clk_add_alias (const char *,const char *,char *,struct device_d *); + +#endif
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/9 vsprintf: add %w and %w support to print unit
In reply to Jean-Christophe PLAGNIOL-VILLARDShow a '%w' or %W thing.
This will show a frequency or byte at format xxx[.xxx] [ kMG] the precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
if no precision is specified and there is rest we will use a default precision of 3 as 66.667 M
base will be typically 1000 for Hz or B and 1024 for iB
--- include/linux/kernel.h | 20 +++++++++++++ lib/vsprintf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 0 deletions(-)
include/linux/kernel.h +20 -0
@@ -5,6 +5,26 @@#include <linux/barebox-wrapper.h> /* +* This looks more complex than it should be. But we need to +* get the type for the ~ right in round_down (it needs to be +* as wide as the result!), and we want to evaluate the macro +* arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) + +#define FIELD_SIZEOF (t, f) (sizeof(((t*)0)->f)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define DIV_ROUND_CLOSEST (x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) + +/* * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison.
lib/vsprintf.c +73 -0
85 lines not on this page · raw message
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 5/9] vsprintf: add %w and %w support to print unit
Hello Jean-Christophe,
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Show a '%w' or %W thing.
This will show a frequency or byte at format xxx[.xxx] [ kMG] the precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
if no precision is specified and there is rest we will use a default precision of 3 as 66.667 M
base will be typically 1000 for Hz or B and 1024 for iB
I see this used e.g. as:
printk("%WiB", somevalue)
right? hmm, what if somevalue is say 5? If I understand correctly the output then is: "5 iB".
Quoted 104 lines
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- include/linux/kernel.h | 20 +++++++++++++ lib/vsprintf.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 0 deletions(-)include/linux/kernel.h +20
-0@@ -5,6 +5,26 @@#include <linux/barebox-wrapper.h> /* +* This looks more complex than it should be. But we need to +* get the type for the ~ right in round_down (it needs to be +* as wide as the result!), and we want to evaluate the macro +* arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) + +#define FIELD_SIZEOF (t, f) (sizeof(((t*)0)->f)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define DIV_ROUND_CLOSEST (x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) + +/* * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison. lib/vsprintf.c +58
-0@@ -254,6 +254,71 @@ static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int }/* +* Show a '%w' or %W thing. This will show a frequency or byte +* at format xxx[.xxx] [ kMG] +* the precision can not excess the base kMG of the current unit +* otherwise it will be automatically reduce +* if no precision is specified and there is rest we will use a default +* precision of 3 as 66.667 M +* base will be typically 1000 for Hz or B and 1024 for iB +*/ +static char *unit_string (char *buf,char *end,long val,int base,int field_width,int precision,int flags) +{ +long rest =0 ; +long integer; +long pr =3 ; +long pr_mul =1 ; +long unit =1 ; +char format[] =" kMG" ; +int pow, i; + +for (pow =0 ; pow <strlen (format) -1 ; pow++) { +if (val < unit * base) +break ; + unit *= base; + } + + integer = val / unit; + +if (precision !=-1 ) { +if (precision > pow *3 ) + precision = pow *3 ; + pr = precision; + } + +for (i =0 ; i < pr; i++) { + pr_mul *=10 ; + } + +if (val % unit) { + rest =DIV_ROUND_CLOSEST (pr_mul * (val - (integer * unit)), unit); + +if (rest >= pr_mul) { + rest -= pr_mul; + integer++; + } + } + + buf =number (buf, end, integer,10 , field_width,-1 ,0 ); + +if (rest !=0 || precision !=-1 ) { +if (buf < end) + *buf ='.' ; + buf++; + buf =number (buf, end, rest,10 ,-1 , pr,0 ); + } + +if (buf < end) + *buf =' ' ; + buf++; +if (buf < end && pow !=0 )
lib/vsprintf.c static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int · line 324
Quoted 10 lines
lib/vsprintf.c +7
-0+ *buf = format[pow]; + buf++; + +return buf; +} + +/* * Show a '%p' thing. A kernel extension is that the '%p' is followed * by an extra set of alphanumeric characters that are extended format * specifiers.
I think the kernel documents all available formats in a single place. (Is that here in barebox? If yes, please add your new formats here, too.)
Quoted 24 lines
lib/vsprintf.c +8
-0@@ -421,6 +486,14 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) str = string(str, end, va_arg(args, char *), field_width, precision, flags);continue ; +case 'W' : + str =unit_string (str, end,va_arg (args, long),1024 , field_width, precision, flags); +continue ; + +case 'w' : + str =unit_string (str, end,va_arg (args, long),1000 , field_width, precision, flags); +continue ; +case 'p' : str = pointer(fmt+1, str, end, va_arg(args, void *),Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 5/9] vsprintf: add %w and %w support to print unit
Hello,
Quoted 10 lines · Uwe Kleine-König
Hello Jean-Christophe,
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Show a '%w' or %W thing.
This will show a frequency or byte at format xxx[.xxx] [ kMG] the precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
if no precision is specified and there is rest we will use a default precision of 3 as 66.667 M
base will be typically 1000 for Hz or B and 1024 for iB
Quoted 6 lines
I see this used e.g. as:
printk("%WiB", somevalue)right? hmm, what if somevalue is say 5? If I understand correctly the output then is: "5 iB".
[I forgot to complete this, sorry]
"5 iB" looks ugly, doesn't it? Do you care enough to fix that?
Best regards
Uwe
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 5/9] vsprintf: add %w and %w support to print unit
Quoted 32 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 15 lines · Uwe Kleine-König
Hello,
Quoted 12 lines · Uwe Kleine-König
Hello Jean-Christophe,
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD
Show a '%w' or %W thing.
This will show a frequency or byte at format xxx[.xxx] [ kMG] the precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
if no precision is specified and there is rest we will use a default precision of 3 as 66.667 M
base will be typically 1000 for Hz or B and 1024 for iBI see this used e.g. as:
Quoted 7 lines
Quoted 4 lines
printk("%WiB", somevalue)right? hmm, what if somevalue is say 5? If I understand correctly the output then is: "5 iB".
[I forgot to complete this, sorry]
"5 iB" looks ugly, doesn't it? Do you care enough to fix that?
After it's everyone preference
What do you think of
100MHz
100 MHz1 Hz
1Hz
Quoted 7 lines
100 MiB
100MiB1iB
1 iBso which one?
IMHO iB doesn't make sense. What should be the difference to a plain B?
And if "%WiB" yields 100MiB for 100*1024**2, it should yield 5B for 5 but neither "5 iB" nor "5iB" nor "5 B".
Best regards
Uwe
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/9 at91/clock: switch to %w for clock info printing
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/mach-at91/clock.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-at91/clock.c +3 -5
@@ -677,12 +677,10 @@ int at91_clock_init(unsigned long main_clock)static int at91_clock_display (void ) {if (pll_overclock) -pr_info ("Clocks: PLLA overclocked, %ld MHz\n" , plla.rate_hz /1000000 ); +pr_info ("Clocks: PLLA overclocked, %wHz\n" , plla.rate_hz); -printf ("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n" , - mck.parent->rate_hz /1000000 , (unsigned ) mck.rate_hz /1000000 , - (unsigned ) main_clk.rate_hz /1000000 , - ((unsigned ) main_clk.rate_hz %1000000 ) /1000 ); +printf ("Clocks: CPU %wHz, master %wHz, main %wHz\n" , + mck.parent->rate_hz, mck.rate_hz, main_clk.rate_hz);return 0 ; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/9 cfi_flash: use %W and IEEE 1541 format
In reply to Jean-Christophe PLAGNIOL-VILLARD--- drivers/nor/cfi_flash.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/nor/cfi_flash.c +2 -2
@@ -713,7 +713,7 @@ static void cfi_info (struct device_d* dev)printf ("CFI conformant FLASH (%d x %d)" , (info->portwidth <<3 ), (info->chipwidth <<3 )); -printf (" Size: %ld MB in %d Sectors\n" , +printf (" Size: %WiB in %d Sectors\n" , info->size >>20 , info->sector_count);printf (" " );switch (info->vendor) {
@@ -1036,7 +1036,7 @@ static int cfi_probe (struct device_d *dev) }if (info->flash_id ==FLASH_UNKNOWN ) { -printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n" , +printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %WiB\n" , dev->map_base, info->size, info->size <<20 );return -ENODEV ; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/9 use %W instead of size_human_readable and use IEEE 1541 format
In reply to Jean-Christophe PLAGNIOL-VILLARD--- commands/bootm.c | 7 ++--- common/startup.c | 9 +++---- include/common.h | 1 - lib/Makefile | 1 - lib/display_options.c | 60 ------------------------------------------------- 5 files changed, 7 insertions(+), 71 deletions(-) delete mode 100644 lib/display_options.c
commands/bootm.c +3 -4
@@ -552,11 +552,11 @@ print_image_hdr (image_header_t *hdr)printf (" Image Type: %s %s %s (%s)\n" ,image_arch (hdr),image_os (hdr),image_type (hdr),image_compression (hdr));#endif -printf (" Data Size: %d Bytes = %s\n" +printf (" Data Size: %d Bytes = %WiB\n" " Load Address: %08x\n" " Entry Point: %08x\n" ,ntohl (hdr->ih_size), -size_human_readable (ntohl (hdr->ih_size)), +ntohl (hdr->ih_size),ntohl (hdr->ih_load),ntohl (hdr->ih_ep));
@@ -567,8 +567,7 @@ print_image_hdr (image_header_t *hdr)puts (" Contents:\n" );for (i=0 ; (len =ntohl (*len_ptr)); ++i, ++len_ptr) { -printf (" Image %d: %8ld Bytes = %s" , i, len, -size_human_readable (len)); +printf (" Image %d: %8ld Bytes = %WiB" , i, len, len); } } }
common/startup.c +4 -5
@@ -52,12 +52,11 @@ static void display_meminfo(void)debug ("barebox code : 0x%08lX -> 0x%08lX BSS: -> 0x%08lX\n" , _barebox_start, _bss_start, _bss_end); -printf ("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n" , - mstart, mend,size_human_readable (msize)); +printf ("Malloc space: 0x%08lx -> 0x%08lx (size %WiB)\n" , + mstart, mend, msize);#ifdef CONFIG_ARM -printf ("Stack space : 0x%08lx -> 0x%08lx (size %s)\n" , -STACK_BASE ,STACK_BASE +STACK_SIZE , -size_human_readable (STACK_SIZE )); +printf ("Stack space : 0x%08lx -> 0x%08lx (size %WiB)\n" , +STACK_BASE ,STACK_BASE +STACK_SIZE ,STACK_SIZE );#endif }
include/common.h +0 -1
@@ -95,7 +95,6 @@ void __noreturn panic(const char *fmt, ...);/* */ long int initdram (int ); -char *size_human_readable (ulong size);/* common/main.c */ int run_command (const char *cmd,int flag);
lib/Makefile +0 -1
@@ -1,6 +1,5 @@ obj-y += ctype.o obj-y += rbtree.o -obj-y += display_options.o obj-y += ldiv.o obj-y += string.o obj-y += vsprintf.o
lib/display_options.c deleted +0 -60
60 lines not on this page · raw message
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 9/9 clkdev: add print clk info command
In reply to Jean-Christophe PLAGNIOL-VILLARD--- commands/Kconfig | 7 +++++++ drivers/clk/clkdev.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-)
commands/Kconfig +7 -0
@@ -338,4 +338,11 @@ config CMD_I2C include i2c_probe, i2c_read and i2c_write commands to communicate on i2c bus. +config CMD_CLOCK_INFO + bool + depends on LOOKUP_CLKDEV + prompt "clock info command" + help + shop list of registered clock + endmenu
drivers/clk/clkdev.c +33 -0
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <command.h> #include <linux/list.h> #include <errno.h> #include <linux/err.h>
@@ -166,3 +167,35 @@ void clkdev_drop(struct clk_lookup *cl)kfree (cl); }EXPORT_SYMBOL (clkdev_drop); + +#ifdef CONFIG_CMD_CLOCK_INFO +static int do_clock_info (struct command *cmdtp,int argc,char *argv[]) +{ +struct clk_lookup *p; + +puts ("Clocks\n" ); + +list_for_each_entry (p, &clocks, node) +if (!p->dev_id) +printf ("%s: %wHz\n" , p->con_id,clk_get_rate (p->clk)); + +puts ("Clocks for dev\n" ); + +list_for_each_entry (p, &clocks, node) +if (p->dev_id) +printf ("%s[%s]: %wHz\n" , p->con_id, p->dev_id, +clk_get_rate (p->clk)); + +return 0 ; +} + +static const __maybe_unused char cmd_clock_info_help[] = +"Print clocks info\n" +; + +BAREBOX_CMD_START(clock_info) + .cmd = do_clock_info, + .usage = "Clocks Info", + BAREBOX_CMD_HELP(cmd_clock_info_help) +BAREBOX_CMD_END +#endif
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 9/9] clkdev: add print clk info command
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- commands/Kconfig | 7 +++++++ drivers/clk/clkdev.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-)commands/Kconfig +7
-0@@ -338,4 +338,11 @@ config CMD_I2C include i2c_probe, i2c_read and i2c_write commands to communicate on i2c bus. +config CMD_CLOCK_INFO + bool + depends on LOOKUP_CLKDEV + prompt "clock info command" + help + shop list of registered clock + endmenudrivers/clk/clkdev.c +1
-0@@ -11,6 +11,7 @@*/ #include <common.h> +#include <command.h> #include <linux/list.h> #include <errno.h> #include <linux/err.h>
drivers/clk/clkdev.c void clkdev_drop(struct clk_lookup *cl) · line 176
Quoted 10 lines
drivers/clk/clkdev.c +7
-0@@ -166,3 +167,35 @@ void clkdev_drop(struct clk_lookup *cl)kfree (cl); }EXPORT_SYMBOL (clkdev_drop); + +#ifdef CONFIG_CMD_CLOCK_INFO +static int do_clock_info (struct command *cmdtp,int argc,char *argv[]) +{ +struct clk_lookup *p; + +puts ("Clocks\n" );
"global clocks"?
drivers/clk/clkdev.c void clkdev_drop(struct clk_lookup *cl) · line 182
Quoted 6 lines
drivers/clk/clkdev.c +6
-0+ +list_for_each_entry (p, &clocks, node) +if (!p->dev_id) +printf ("%s: %wHz\n" , p->con_id,clk_get_rate (p->clk)); + +puts ("Clocks for dev\n" );
"device specific clocks"?
Quoted 28 lines
drivers/clk/clkdev.c +19
-0+ +list_for_each_entry (p, &clocks, node) +if (p->dev_id) +printf ("%s[%s]: %wHz\n" , p->con_id, p->dev_id, +clk_get_rate (p->clk)); + +return 0 ; +} + +static const __maybe_unused char cmd_clock_info_help[] = +"Print clocks info\n" +; + +BAREBOX_CMD_START(clock_info) + .cmd = do_clock_info, + .usage = "Clocks Info", + BAREBOX_CMD_HELP(cmd_clock_info_help) +BAREBOX_CMD_END +#endif Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
v2 cover preperation for sh adding
In reply to Jean-Christophe PLAGNIOL-VILLARDHi,
this version 2
update the vsprintf by managing the iB internally and the Space before the unit as optional
the others comments was also fix
The following changes since commit 0d35c3c8a0c2a1f1ff06eac20a12af0186753bc4:
menu: simplify usage for clients (2010-08-30 21:06:02 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git sh-prepare
Jean-Christophe PLAGNIOL-VILLARD (9):
types.h: move __kernel_dev_t to include/linux/types.h
device: fix dev_name
stm8815: fix the uart device clock match
arm: move clkdev to drivers/clk
vsprintf: add %w and %w support to print unit at91/clock: switch to %w for clock info printing
cfi_flash: use %W and IEEE 1541 format
use %W instead of size_human_readable and use IEEE 1541 format
clkdev: add print clk info command
arch/arm/Kconfig | 1 -
arch/arm/Makefile | 2 +-
arch/arm/common/Kconfig | 2 -
arch/arm/common/Makefile | 5 --
arch/arm/configs/nhk8815_defconfig | 2 +-
arch/arm/include/asm/clkdev.h | 15 +-----
arch/arm/include/asm/posix_types.h | 1 -
arch/arm/mach-at91/clock.c | 8 +--
arch/arm/mach-nomadik/8815.c | 6 +-
arch/arm/mach-nomadik/Kconfig | 2 +-
arch/arm/mach-nomadik/clock.c | 7 +--
arch/blackfin/include/asm/posix_types.h | 1 -
arch/m68k/include/asm/posix_types.h | 1 -
arch/ppc/include/asm/posix_types.h | 1 -
arch/sandbox/include/asm/posix_types.h | 1 -
arch/x86/include/asm/posix_types.h | 1 -
commands/Kconfig | 7 ++
commands/bootm.c | 7 +-
common/startup.c | 9 +--
drivers/Kconfig | 1 +
drivers/Makefile | 1 +
drivers/clk/Kconfig | 4 +
drivers/clk/Makefile | 2 +
{arch/arm/common => drivers/clk}/clkdev.c | 57 +++++++++++++++---
drivers/nor/cfi_flash.c | 8 +-
include/common.h | 1 -
include/driver.h | 12 ++--
include/linux/clkdev.h | 36 +++++++++++
include/linux/kernel.h | 20 ++++++
include/linux/types.h | 2 +
lib/Makefile | 1 -
lib/display_options.c | 60 -------------------
lib/driver.c | 16 ++---
lib/vsprintf.c | 91 +++++++++++++++++++++++++++++
34 files changed, 250 insertions(+), 141 deletions(-)
delete mode 100644 arch/arm/common/Kconfig
delete mode 100644 arch/arm/common/Makefile
create mode 100644 drivers/clk/Kconfig
create mode 100644 drivers/clk/Makefile
rename {arch/arm/common => drivers/clk}/clkdev.c (74%)
create mode 100644 include/linux/clkdev.h
delete mode 100644 lib/display_options.cBest Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/9 types.h: move __kernel_dev_t to include/linux/types.h
no need to have a arch specific type
--- arch/arm/include/asm/posix_types.h | 1 - arch/blackfin/include/asm/posix_types.h | 1 - arch/m68k/include/asm/posix_types.h | 1 - arch/ppc/include/asm/posix_types.h | 1 - arch/sandbox/include/asm/posix_types.h | 1 - arch/x86/include/asm/posix_types.h | 1 - include/linux/types.h | 2 ++ 7 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/include/asm/posix_types.h +0 -1
@@ -19,7 +19,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/blackfin/include/asm/posix_types.h +0 -1
@@ -34,7 +34,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/m68k/include/asm/posix_types.h +0 -1
@@ -27,7 +27,6 @@#define __ARCH_M68K_POSIX_TYPES_H -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/ppc/include/asm/posix_types.h +0 -1
@@ -7,7 +7,6 @@* assume GCC is being used. */ -typedef unsigned int __kernel_dev_t ;typedef unsigned int __kernel_ino_t ;typedef unsigned int __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/sandbox/include/asm/posix_types.h +0 -1
@@ -7,7 +7,6 @@* assume GCC is being used. */ -typedef unsigned short __kernel_dev_t ;typedef unsigned long __kernel_ino_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;
arch/x86/include/asm/posix_types.h +0 -1
@@ -27,7 +27,6 @@#define _ASM_X86_POSIX_TYPES_Htypedef unsigned long __kernel_ino_t ; -typedef unsigned short __kernel_dev_t ;typedef unsigned short __kernel_mode_t ;typedef unsigned short __kernel_nlink_t ;typedef long __kernel_off_t ;
include/linux/types.h +2 -0
@@ -6,6 +6,8 @@#ifndef __KERNEL_STRICT_NAMES +typedef __u32 __kernel_dev_t ; +typedef __kernel_fd_set fd_set ;typedef __kernel_dev_t dev_t ;typedef __kernel_ino_t ino_t ;
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/9 device: fix dev_name
In reply to Jean-Christophe PLAGNIOL-VILLARDdev_name is supposed to return the name of the device plus the id
currently we use %s%d format where in the kernel the use %s.%d
we may think to switch to this format for the device name and keeping the %s%d for the devfs
this will be usefull to not modify the clock device name as example
--- include/driver.h | 12 +++++++----- lib/driver.c | 16 +++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-)
include/driver.h +7 -5
@@ -25,7 +25,8 @@#include <linux/list.h> -#define MAX_DRIVER_NAME 32 +#define MAX_DRIVER_NAME 32 +#define FORMAT_DRIVER_MANE_ID "%s%d"#include <param.h>
@@ -176,9 +177,11 @@ int get_free_deviceid(const char *name_template);char *deviceid_from_spec_str (const char *str,char **endp); +extern const char *dev_id (const struct device_d *dev); +static inline const char *dev_name (const struct device_d *dev) { -return dev->name; +return dev_id (dev); }/* linear list over all available devices
@@ -239,11 +242,10 @@ static inline int dev_close_default(struct device_d *dev, struct filep *f) }/* debugging and troubleshooting/diagnostic helpers. */ -extern const char *dev_id (const struct device_d *dev); #define dev_printf(dev, format, arg...) \ - printf("%s@%s: " format , dev_name(dev) , \ - dev_id(dev) , ## arg) + printf("%s@%s: " format , dev->name , \ + dev_name(dev) , ## arg) #define dev_emerg(dev, format, arg...) \ dev_printf((dev) , format , ## arg)
lib/driver.c +7 -9
@@ -45,11 +45,9 @@ static LIST_HEAD(active);struct device_d *get_device_by_name (const char *name) {struct device_d *dev; -char devname[MAX_DRIVER_NAME +3 ];for_each_device (dev) { -sprintf (devname,"%s%d" , dev->name, dev->id); -if (!strcmp (name, devname)) +if (!strcmp (dev_name (dev), name))return dev; }
@@ -62,7 +60,7 @@ int get_free_deviceid(const char *name_template)char name[MAX_DRIVER_NAME +3 ];while (1 ) { -sprintf (name,"%s%d" , name_template, i); +sprintf (name,FORMAT_DRIVER_MANE_ID , name_template, i);if (!get_device_by_name (name))return i; i++;
@@ -97,7 +95,7 @@ int register_device(struct device_d *new_device) new_device->id =get_free_deviceid (new_device->name); -debug ("register_device: %s\n" ,new_device->name); +debug ("register_device: %s\n" ,dev_name (new_device));if (!new_device->bus) {// dev_err(new_device, "no bus type associated. Needs fixup\n");
@@ -120,7 +118,7 @@ EXPORT_SYMBOL(register_device);int unregister_device (struct device_d *old_dev) { -debug ("unregister_device: %s:%s\n" ,old_dev->name, old_dev->id); +debug ("unregister_device: %s\n" ,dev_name (old_dev->name));if (!list_empty (&old_dev->children)) { errno = -EBUSY ;
@@ -164,7 +162,7 @@ struct driver_d *get_driver_by_name(const char *name)static void noinfo (struct device_d *dev) { -printf ("no info available for %s\n" , dev->name); +printf ("no info available for %s\n" ,dev_name (dev)); }static void noshortinfo (struct device_d *dev)
@@ -237,7 +235,7 @@ static int do_devinfo_subtree(struct device_d *dev, int depth, char edge)for (i =0 ; i < depth; i++)printf ("| " ); -printf ("%c----%s%d" , edge, dev->name, dev->id); +printf ("%c----%s" , edge,dev_name (dev));if (!list_empty (&dev->cdevs)) {printf (" (" );list_for_each_entry (cdev, &dev->cdevs, devices_list) {
@@ -264,7 +262,7 @@ const char *dev_id(const struct device_d *dev) {static char buf[sizeof (unsigned long ) *2 ]; -sprintf (buf,"%s%d" , dev->name, dev->id); +sprintf (buf,FORMAT_DRIVER_MANE_ID , dev->name, dev->id);return buf; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 3/9 stm8815: fix the uart device clock match
In reply to Jean-Christophe PLAGNIOL-VILLARDthat use the device name + id to found it's clock to use the right match as we fix the dev_name macro
--- arch/arm/mach-nomadik/8815.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-nomadik/8815.c +4 -2
@@ -50,12 +50,14 @@ void st8815_add_device_sdram(u32 size) }static struct device_d uart0_serial_device = { + .id =0 , .name ="uart-pl011" , .map_base =NOMADIK_UART0_BASE , .size =4096 , };static struct device_d uart1_serial_device = { + .id =1 , .name ="uart-pl011" , .map_base =NOMADIK_UART1_BASE , .size =4096 ,
@@ -65,12 +67,12 @@ void st8815_register_uart(unsigned id) {switch (id) {case 0 : -nmdk_clk_create (&st8815_clk_48, uart0_serial_device.name);register_device (&uart0_serial_device); +nmdk_clk_create (&st8815_clk_48,dev_name (&uart0_serial_device));break ;case 1 : -nmdk_clk_create (&st8815_clk_48, uart1_serial_device.name);register_device (&uart1_serial_device); +nmdk_clk_create (&st8815_clk_48,dev_name (&uart0_serial_device));break ; } }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 4/9 arm: move clkdev to drivers/clk
In reply to Jean-Christophe PLAGNIOL-VILLARDas refer in this patch "arm & sh: factorised duplicated clkdev.c"
factorise some generic infrastructure to assist looking up struct clks for the ARM & SH architecture.
as the code is identical at 99% in linux
move it also as preparing for the SH adding
---
arch/arm/Kconfig | 1 -
arch/arm/Makefile | 2 +-
arch/arm/common/Kconfig | 2 -
arch/arm/common/Makefile | 5 ----
arch/arm/configs/nhk8815_defconfig | 2 +-
arch/arm/include/asm/clkdev.h | 15 +------------
arch/arm/mach-nomadik/Kconfig | 2 +-
arch/arm/mach-nomadik/clock.c | 7 +-----
drivers/Kconfig | 1 +
drivers/Makefile | 1 +
drivers/clk/Kconfig | 4 +++
drivers/clk/Makefile | 2 +
{arch/arm/common => drivers/clk}/clkdev.c | 24 ++++++++++++++-------
{arch/arm/include/asm => include/linux}/clkdev.h | 12 ++++++++--
14 files changed, 38 insertions(+), 42 deletions(-)
delete mode 100644 arch/arm/common/Kconfig
delete mode 100644 arch/arm/common/Makefile
create mode 100644 drivers/clk/Kconfig
create mode 100644 drivers/clk/Makefile
rename {arch/arm/common => drivers/clk}/clkdev.c (90%)
copy {arch/arm/include/asm => include/linux}/clkdev.h (72%)arch/arm/Kconfig +0 -1
@@ -58,7 +58,6 @@ config ARCH_S3C24xx endchoice -source arch/arm/common/Kconfig source arch/arm/cpu/Kconfig source arch/arm/mach-at91/Kconfig source arch/arm/mach-ep93xx/Kconfig
arch/arm/Makefile +1 -1
@@ -131,7 +131,7 @@ MACH := endif common-y += $(BOARD) $(MACH) -common-y += arch/arm/lib/ arch/arm/cpu/ arch/arm/common/ +common-y += arch/arm/lib/ arch/arm/cpu/ lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/arm/lib/barebox.lds lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
arch/arm/common/Kconfig deleted +0 -2
@@ -1,2 +0,0 @@ -config COMMON_CLKDEV - bool
arch/arm/common/Makefile deleted +0 -5
@@ -1,5 +0,0 @@ -# -# Makefile for the linux kernel. -# - -obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o
arch/arm/configs/nhk8815_defconfig +1 -1
@@ -19,7 +19,7 @@ CONFIG_ARM_AMBA=y CONFIG_ARCH_NOMADIK=y # CONFIG_ARCH_OMAP is not set # CONFIG_ARCH_S3C24xx is not set -CONFIG_COMMON_CLKDEV=y +CONFIG_CLKDEV_LOOKUP=y # # Processor Type
arch/arm/include/asm/clkdev.h +1 -14
@@ -12,19 +12,6 @@#ifndef __ASM_CLKDEV_H#define __ASM_CLKDEV_H -struct clk ; - -struct clk_lookup { -struct list_head node; -const char *dev_id; -const char *con_id; -struct clk *clk; -}; - -struct clk_lookup *clkdev_alloc (struct clk *clk,const char *con_id, -const char *dev_fmt, ...); - -void clkdev_add (struct clk_lookup *cl); -void clkdev_drop (struct clk_lookup *cl); +#include <mach/clkdev.h> #endif
arch/arm/mach-nomadik/Kconfig +1 -1
@@ -13,7 +13,7 @@ choice config MACH_NOMADIK_8815NHK bool "ST 8815 Nomadik Hardware Kit (evaluation board)" select NOMADIK_8815 - select COMMON_CLKDEV + select CLKDEV_LOOKUP endchoice
arch/arm/mach-nomadik/clock.c +1 -6
@@ -8,7 +8,7 @@#include <linux/err.h> #include <linux/clk.h> #include <init.h> -#include <asm/clkdev.h> +#include <linux/clkdev.h> #include "clock.h"
@@ -34,11 +34,6 @@ void clk_disable(struct clk *clk) }EXPORT_SYMBOL (clk_disable); -int __clk_get (struct clk *clk) -{ -return 1 ; -} -/* Create a clock structure with the given name */ int nmdk_clk_create (struct clk *clk,const char *dev_id) {
drivers/Kconfig +1 -0
@@ -9,5 +9,6 @@ source "drivers/mtd/Kconfig" source "drivers/ata/Kconfig" source "drivers/usb/Kconfig" source "drivers/video/Kconfig" +source "drivers/clk/Kconfig" endmenu
drivers/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_ATA) += ata/ obj-$(CONFIG_SPI) += spi/ obj-$(CONFIG_I2C) += i2c/ obj-$(CONFIG_VIDEO) += video/ +obj-y += clk/
drivers/clk/Kconfig new file +4 -0
@@ -0,0 +1,4 @@ + +config CLKDEV_LOOKUP + bool + select HAVE_CLK
drivers/clk/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o
drivers/clk/clkdev.c renamed from arch/arm/common/clkdev.c +16 -8
@@ -1,5 +1,5 @@/* -* arch/arm/common/clkdev.c +* drivers/clk/lookup_clkdev.c * * Copyright (C) 2008 Russell King. *
@@ -14,14 +14,13 @@#include <linux/list.h> #include <errno.h> #include <linux/err.h> +#include <linux/string.h> #include <linux/clk.h> +#include <linux/clkdev.h> #include <init.h> #include <malloc.h> #include <stdio.h> -#include <asm/clkdev.h> -#include <mach/clkdev.h> -static LIST_HEAD (clocks);/*
@@ -31,7 +30,7 @@ static LIST_HEAD(clocks);* If an entry has a device ID, it must match * If an entry has a connection ID, it must match * Then we take the most specific entry - with the following -* order of precidence: dev+con > dev only > con only. +* order of precedence: dev+con > dev only > con only. */ static struct clk *clk_find (const char *dev_id,const char *con_id) {
@@ -51,12 +50,13 @@ static struct clk *clk_find(const char *dev_id, const char *con_id)continue ; match +=1 ; } -if (match ==0 ) -continue ;if (match > best) { clk = p->clk; - best = match; +if (match !=3 ) + best = match; +else +break ; } }return clk;
@@ -94,6 +94,14 @@ void clkdev_add(struct clk_lookup *cl) }EXPORT_SYMBOL (clkdev_add); +void __init clkdev_add_table (struct clk_lookup *cl,size_t num) +{ +while (num--) { +list_add_tail (&cl->node, &clocks); + cl++; + } +} +#define MAX_DEV_ID 20#define MAX_CON_ID 16
include/linux/clkdev.h renamed from arch/arm/include/asm/clkdev.h +9 -3
@@ -1,5 +1,5 @@/* -* arch/arm/include/asm/clkdev.h +* include/linux/clkdev.h * * Copyright (C) 2008 Russell King. *
@@ -9,10 +9,13 @@* * Helper for the clk API to assist looking up a struct clk. */ -#ifndef __ASM_CLKDEV_H -#define __ASM_CLKDEV_H +#ifndef __CLKDEV_H +#define __CLKDEV_H + +#include <asm/clkdev.h> struct clk; +struct device_d; struct clk_lookup { struct list_head node;
@@ -27,4 +30,7 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,void clkdev_add (struct clk_lookup *cl);void clkdev_drop (struct clk_lookup *cl); +void clkdev_add_table (struct clk_lookup *,size_t ); +int clk_add_alias (const char *,const char *,char *,struct device_d *); +#endif
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 5/9 vsprintf: add %w and %w support to print unit
In reply to Jean-Christophe PLAGNIOL-VILLARDShow a '%w' or %W thing. This will show a unit at format xxx[.xxx][ ][ kMG] with iEEE 1541 support
The precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
If no precision is specified and there is rest we will use a default precision of 3 as 66.667 M or 66.667M
%#w or %#W will add a space between the value and the unit
The base will be typically 1000 for Hz or B and 1024 for iB for 1024 the i is automactically add for val >= 1024
--- include/linux/kernel.h | 20 ++++++++++ lib/vsprintf.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 0 deletions(-)
include/linux/kernel.h +20 -0
@@ -5,6 +5,26 @@#include <linux/barebox-wrapper.h> /* +* This looks more complex than it should be. But we need to +* get the type for the ~ right in round_down (it needs to be +* as wide as the result!), and we want to evaluate the macro +* arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) + +#define FIELD_SIZEOF (t, f) (sizeof(((t*)0)->f)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define DIV_ROUND_CLOSEST (x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) + +/* * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison.
lib/vsprintf.c +91 -0
109 lines not on this page · raw message
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 5/9 V2] vsprintf: add %w and %w support to print unit
Hello Jean-Christophe,
Quoted 56 lines · Jean-Christophe PLAGNIOL-VILLARD
Show a '%w' or %W thing. This will show a unit at format xxx[.xxx][ ][ kMG] with iEEE 1541 support
The precision can not excess the base kMG of the current unit otherwise it will be automatically reduce
If no precision is specified and there is rest we will use a default precision of 3 as 66.667 M or 66.667M
%#w or %#W will add a space between the value and the unit
The base will be typically 1000 for Hz or B and 1024 for iB for 1024 the i is automactically add for val >= 1024
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- include/linux/kernel.h | 20 ++++++++++ lib/vsprintf.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+), 0 deletions(-)include/linux/kernel.h +20
-0@@ -5,6 +5,26 @@#include <linux/barebox-wrapper.h> /* +* This looks more complex than it should be. But we need to +* get the type for the ~ right in round_down (it needs to be +* as wide as the result!), and we want to evaluate the macro +* arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y)-1)) +#define round_up (x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down (x, y) ((x) & ~__round_mask(x, y)) + +#define FIELD_SIZEOF (t, f) (sizeof(((t*)0)->f)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#define roundup (x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#define DIV_ROUND_CLOSEST (x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) + +/* * min()/max()/clamp() macros that also do * strict type-checking.. See the * "unnecessary" pointer comparison. lib/vsprintf.c +0
-0
lib/vsprintf.c static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int · line 257
Quoted 4 lines
lib/vsprintf.c +1
-0@@ -254,6 +254,88 @@ static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int }/* +* Show a '%w' or %W thing. This will show a unit
s/%W/'%W'/, and you should note here, that %W uses 1024 as base, %w uses 1000. These formats expect a (signed) long, right? What about making this a flag to the usual %d and %u to support all integer types?
Something like: %lWuB to print an unsigned long using the ieee format (with base 1024)? (I don't know why you choosed 'w', is it just any free letter or a 'real' abbreviation?)
lib/vsprintf.c static char *symbol_string(char *buf, char *end, void *ptr, int field_width, int · line 261
Quoted 4 lines
lib/vsprintf.c +4
-0+* at format xxx[.xxx][ ][ kMG] with iEEE 1541 support +* +* The precision can not excess the base kMG of the current unit +* otherwise it will be automatically reduce
s/reduce/reduced./
Quoted 112 lines
lib/vsprintf.c +86
-0+* +* If no precision is specified and there is rest we will use a default +* precision of 3 as 66.667 M or 66.667M +* +* %#w or %#W will add a space between the value and the unit +* +* The base will be typically 1000 for Hz or B and 1024 for iB +* for 1024 the i is automactically add for val >= 1024 +*/ +static char *unit_string (char *buf,char *end,long val,int base,int field_width,int precision,int flags) +{ +long rest =0 ; +long integer; +long pr =3 ; +long pr_mul =1 ; +long unit =1 ; +char format[] =" kMG" ; +int pow, i; + +for (pow =0 ; pow <strlen (format) -1 ; pow++) { +if (val < unit * base) +break ; + unit *= base; + } + + integer = val / unit; + +if (precision !=-1 ) { +if (precision > pow *3 ) + precision = pow *3 ; + pr = precision; + } + +for (i =0 ; i < pr; i++) { + pr_mul *=10 ; + } + +if (val % unit) { + rest =DIV_ROUND_CLOSEST (pr_mul * (val - (integer * unit)), unit); + +if (rest >= pr_mul) { + rest -= pr_mul; + integer++; + } + } + + buf =number (buf, end, integer,10 , field_width,-1 , flags & ~LEFT ); + +if (rest !=0 || precision !=-1 ) { +if (buf < end) + *buf ='.' ; + buf++; + buf =number (buf, end, rest,10 ,-1 , pr, flags |ZEROPAD ); + } + +/* use SPECIAL as SPACE could be used for the interger part */ +if (flags &SPECIAL ) { +if (buf < end) + *buf =' ' ; + buf++; + } + +if (pow >0 ) { +if (buf < end) + *buf = format[pow]; + buf++; +if (base ==1024 ) { +if (buf < end) + *buf ='i' ; + buf++; + } + } + +return buf; +} + +/* * Show a '%p' thing. A kernel extension is that the '%p' is followed * by an extra set of alphanumeric characters that are extended format * specifiers. @@ -291,6 +373,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int field* %pS output the name of a text symbol * %pF output the name of a function pointer * %pR output the address range in a struct resource +* %W and %w output at unit format with iEEE 1541 support * * The return value is the number of characters which would * be generated for the given input, excluding the trailing @@ -421,6 +504,14 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) str = string(str, end, va_arg(args, char *), field_width, precision, flags);continue ; +case 'W' : + str =unit_string (str, end,va_arg (args, long),1024 , field_width, precision, flags); +continue ; + +case 'w' : + str =unit_string (str, end,va_arg (args, long),1000 , field_width, precision, flags); +continue ; +case 'p' : str = pointer(fmt+1, str, end, va_arg(args, void *),Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 7 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 6/9 at91/clock: switch to %w for clock info printing
In reply to Jean-Christophe PLAGNIOL-VILLARD--- arch/arm/mach-at91/clock.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-at91/clock.c +3 -5
@@ -677,12 +677,10 @@ int at91_clock_init(unsigned long main_clock)static int at91_clock_display (void ) {if (pll_overclock) -pr_info ("Clocks: PLLA overclocked, %ld MHz\n" , plla.rate_hz /1000000 ); +pr_info ("Clocks: PLLA overclocked, %#wHz\n" , plla.rate_hz); -printf ("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n" , - mck.parent->rate_hz /1000000 , (unsigned ) mck.rate_hz /1000000 , - (unsigned ) main_clk.rate_hz /1000000 , - ((unsigned ) main_clk.rate_hz %1000000 ) /1000 ); +printf ("Clocks: CPU %#wHz, master %#wHz, main %#wHz\n" , + mck.parent->rate_hz, mck.rate_hz, main_clk.rate_hz);return 0 ; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 7/9 cfi_flash: use %W and IEEE 1541 format
In reply to Jean-Christophe PLAGNIOL-VILLARD--- drivers/nor/cfi_flash.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/nor/cfi_flash.c +4 -4
@@ -713,8 +713,8 @@ static void cfi_info (struct device_d* dev)printf ("CFI conformant FLASH (%d x %d)" , (info->portwidth <<3 ), (info->chipwidth <<3 )); -printf (" Size: %ld MB in %d Sectors\n" , - info->size >>20 , info->sector_count); +printf (" Size: %WB in %d Sectors\n" , + info->size, info->sector_count);printf (" " );switch (info->vendor) {case CFI_CMDSET_INTEL_STANDARD :
@@ -1036,8 +1036,8 @@ static int cfi_probe (struct device_d *dev) }if (info->flash_id ==FLASH_UNKNOWN ) { -printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %ld MB\n" , - dev->map_base, info->size, info->size <<20 ); +printf ("## Unknown FLASH on Bank at 0x%08x - Size = 0x%08lx = %WB\n" , + dev->map_base, info->size, info->size);return -ENODEV ; }
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 8/9 use %W instead of size_human_readable and use IEEE 1541 format
In reply to Jean-Christophe PLAGNIOL-VILLARD--- commands/bootm.c | 7 ++--- common/startup.c | 9 +++---- include/common.h | 1 - lib/Makefile | 1 - lib/display_options.c | 60 ------------------------------------------------- 5 files changed, 7 insertions(+), 71 deletions(-) delete mode 100644 lib/display_options.c
commands/bootm.c +3 -4
@@ -552,11 +552,11 @@ print_image_hdr (image_header_t *hdr)printf (" Image Type: %s %s %s (%s)\n" ,image_arch (hdr),image_os (hdr),image_type (hdr),image_compression (hdr));#endif -printf (" Data Size: %d Bytes = %s\n" +printf (" Data Size: %d Bytes = %WB\n" " Load Address: %08x\n" " Entry Point: %08x\n" ,ntohl (hdr->ih_size), -size_human_readable (ntohl (hdr->ih_size)), +ntohl (hdr->ih_size),ntohl (hdr->ih_load),ntohl (hdr->ih_ep));
@@ -567,8 +567,7 @@ print_image_hdr (image_header_t *hdr)puts (" Contents:\n" );for (i=0 ; (len =ntohl (*len_ptr)); ++i, ++len_ptr) { -printf (" Image %d: %8ld Bytes = %s" , i, len, -size_human_readable (len)); +printf (" Image %d: %8ld Bytes = %WB" , i, len, len); } } }
common/startup.c +4 -5
@@ -52,12 +52,11 @@ static void display_meminfo(void)debug ("barebox code : 0x%08lX -> 0x%08lX BSS: -> 0x%08lX\n" , _barebox_start, _bss_start, _bss_end); -printf ("Malloc space: 0x%08lx -> 0x%08lx (size %s)\n" , - mstart, mend,size_human_readable (msize)); +printf ("Malloc space: 0x%08lx -> 0x%08lx (size %WB)\n" , + mstart, mend, msize);#ifdef CONFIG_ARM -printf ("Stack space : 0x%08lx -> 0x%08lx (size %s)\n" , -STACK_BASE ,STACK_BASE +STACK_SIZE , -size_human_readable (STACK_SIZE )); +printf ("Stack space : 0x%08lx -> 0x%08lx (size %WB)\n" , +STACK_BASE ,STACK_BASE +STACK_SIZE ,STACK_SIZE );#endif }
include/common.h +0 -1
@@ -95,7 +95,6 @@ void __noreturn panic(const char *fmt, ...);/* */ long int initdram (int ); -char *size_human_readable (ulong size);/* common/main.c */ int run_command (const char *cmd,int flag);
lib/Makefile +0 -1
@@ -1,6 +1,5 @@ obj-y += ctype.o obj-y += rbtree.o -obj-y += display_options.o obj-y += ldiv.o obj-y += string.o obj-y += vsprintf.o
lib/display_options.c deleted +0 -60
60 lines not on this page · raw message
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 9/9 clkdev: add print clk info command
In reply to Jean-Christophe PLAGNIOL-VILLARD--- commands/Kconfig | 7 +++++++ drivers/clk/clkdev.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 0 deletions(-)
commands/Kconfig +7 -0
@@ -338,4 +338,11 @@ config CMD_I2C include i2c_probe, i2c_read and i2c_write commands to communicate on i2c bus. +config CMD_CLOCK_INFO + bool + depends on CLKDEV_LOOKUP + prompt "clock info command" + help + show list of registered clock + endmenu
drivers/clk/clkdev.c +33 -0
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <command.h> #include <linux/list.h> #include <errno.h> #include <linux/err.h>
@@ -166,3 +167,35 @@ void clkdev_drop(struct clk_lookup *cl)kfree (cl); }EXPORT_SYMBOL (clkdev_drop); + +#ifdef CONFIG_CMD_CLOCK_INFO +static int do_clock_info (struct command *cmdtp,int argc,char *argv[]) +{ +struct clk_lookup *p; + +puts ("Global clocks:\n" ); + +list_for_each_entry (p, &clocks, node) +if (!p->dev_id) +printf ("%s: %#wHz\n" , p->con_id,clk_get_rate (p->clk)); + +puts ("Device specific clocks:\n" ); + +list_for_each_entry (p, &clocks, node) +if (p->dev_id) +printf ("%s[%s]: %#wHz\n" , p->con_id, p->dev_id, +clk_get_rate (p->clk)); + +return 0 ; +} + +static const __maybe_unused char cmd_clock_info_help[] = +"Print clocks info\n" +; + +BAREBOX_CMD_START(clock_info) + .cmd = do_clock_info, + .usage = "Clocks Info", + BAREBOX_CMD_HELP(cmd_clock_info_help) +BAREBOX_CMD_END +#endif
Signature · 7 lines
1.7.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Jean-Christophe,
Can you integrate the comment from Uwe please? Otherwise it seems ok for me.
Sascha
Quoted 77 lines · Jean-Christophe PLAGNIOL-VILLARD
Hi,
this version 2
update the vsprintf by managing the iB internally and the Space before the unit as optionalthe others comments was also fix
The following changes since commit
0d35c3c8a0c2a1f1ff06eac20a12af0186753bc4:menu: simplify usage for clients (2010-08-30 21:06:02 +0200)
are available in the git repository at:
git://git.jcrosoft.org/barebox.gitsh-prepareJean-Christophe PLAGNIOL-VILLARD (9):
types.h: move__kernel_dev_ttoinclude/linux/types.h
device: fixdev_name
stm8815: fix the uart device clock match
arm: move clkdev todrivers/clk
vsprintf: add %w and %w support to print unit at91/clock: switch to %w for clock info printing
cfi_flash: use %W and IEEE 1541 format
use %W instead ofsize_human_readableand use IEEE 1541 format
clkdev: add print clk info commandarch/arm/Kconfig | 1 - arch/arm/Makefile | 2 +- arch/arm/common/Kconfig | 2 - arch/arm/common/Makefile | 5 -- arch/arm/configs/nhk8815_defconfig | 2 +- arch/arm/include/asm/clkdev.h | 15 +----- arch/arm/include/asm/posix_types.h | 1 - arch/arm/mach-at91/clock.c | 8 +-- arch/arm/mach-nomadik/8815.c | 6 +- arch/arm/mach-nomadik/Kconfig | 2 +- arch/arm/mach-nomadik/clock.c | 7 +-- arch/blackfin/include/asm/posix_types.h | 1 - arch/m68k/include/asm/posix_types.h | 1 - arch/ppc/include/asm/posix_types.h | 1 - arch/sandbox/include/asm/posix_types.h | 1 - arch/x86/include/asm/posix_types.h | 1 - commands/Kconfig | 7 ++ commands/bootm.c | 7 +- common/startup.c | 9 +-- drivers/Kconfig | 1 + drivers/Makefile | 1 + drivers/clk/Kconfig | 4 + drivers/clk/Makefile | 2 + {arch/arm/common => drivers/clk}/clkdev.c | 57 +++++++++++++++--- drivers/nor/cfi_flash.c | 8 +- include/common.h | 1 - include/driver.h | 12 ++-- include/linux/clkdev.h | 36 +++++++++++ include/linux/kernel.h | 20 ++++++ include/linux/types.h | 2 + lib/Makefile | 1 - lib/display_options.c | 60 ------------------- lib/driver.c | 16 ++--- lib/vsprintf.c | 91 +++++++++++++++++++++++++++++ 34 files changed, 250 insertions(+), 141 deletions(-) delete mode 100644 arch/arm/common/Kconfig delete mode 100644 arch/arm/common/Makefile create mode 100644 drivers/clk/Kconfig create mode 100644 drivers/clk/Makefile rename {arch/arm/common => drivers/clk}/clkdev.c (74%) create mode 100644 include/linux/clkdev.h delete mode 100644 lib/display_options.cBest Regards,
J._______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox