From 891655ebc14bf617e7aa2385596e7768c053cb62 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 25 Apr 2014 13:45:08 +0200 Subject: serial: zynq: Remove sparse warnings Warnings: drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_init' was not declared. Should it be static? drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_setbrg' was not declared. Should it be static? drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_getc' was not declared. Should it be static? drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_tstc' was not declared. Should it be static? drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_putc' was not declared. Should it be static? drivers/serial/serial_zynq.c:181:1: warning: symbol 'uart_zynq0_puts' was not declared. Should it be static? drivers/serial/serial_zynq.c:182:22: warning: symbol 'uart_zynq_serial0_device' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_init' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_setbrg' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_getc' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_tstc' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_putc' was not declared. Should it be static? drivers/serial/serial_zynq.c:184:1: warning: symbol 'uart_zynq1_puts' was not declared. Should it be static? drivers/serial/serial_zynq.c:185:22: warning: symbol 'uart_zynq_serial1_device' was not declared. Should it be static? Signed-off-by: Michal Simek --- drivers/serial/serial_zynq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 53a8af0..3ce9a27 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -153,17 +153,17 @@ static int uart_zynq_serial_getc(const int port) /* Multi serial device functions */ #define DECLARE_PSSERIAL_FUNCTIONS(port) \ - int uart_zynq##port##_init(void) \ + static int uart_zynq##port##_init(void) \ { return uart_zynq_serial_init(port); } \ - void uart_zynq##port##_setbrg(void) \ + static void uart_zynq##port##_setbrg(void) \ { return uart_zynq_serial_setbrg(port); } \ - int uart_zynq##port##_getc(void) \ + static int uart_zynq##port##_getc(void) \ { return uart_zynq_serial_getc(port); } \ - int uart_zynq##port##_tstc(void) \ + static int uart_zynq##port##_tstc(void) \ { return uart_zynq_serial_tstc(port); } \ - void uart_zynq##port##_putc(const char c) \ + static void uart_zynq##port##_putc(const char c) \ { uart_zynq_serial_putc(c, port); } \ - void uart_zynq##port##_puts(const char *s) \ + static void uart_zynq##port##_puts(const char *s) \ { uart_zynq_serial_puts(s, port); } /* Serial device descriptor */ @@ -179,10 +179,10 @@ static int uart_zynq_serial_getc(const int port) } DECLARE_PSSERIAL_FUNCTIONS(0); -struct serial_device uart_zynq_serial0_device = +static struct serial_device uart_zynq_serial0_device = INIT_PSSERIAL_STRUCTURE(0, "ttyPS0"); DECLARE_PSSERIAL_FUNCTIONS(1); -struct serial_device uart_zynq_serial1_device = +static struct serial_device uart_zynq_serial1_device = INIT_PSSERIAL_STRUCTURE(1, "ttyPS1"); #ifdef CONFIG_OF_CONTROL -- cgit v1.1 From 09865465821fd35eabedcd9f102f1d576c626ad8 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 25 Apr 2014 13:46:28 +0200 Subject: serial: zynq: Fix typo in suffix function name 's/zynq_serial_initalize/zynq_serial_initialize/g' serial_initialize is used by all serial drivers. Signed-off-by: Michal Simek --- drivers/serial/serial.c | 4 ++-- drivers/serial/serial_zynq.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index df05bde..c4fb59c 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -117,7 +117,7 @@ serial_initfunc(ns16550_serial_initialize); serial_initfunc(pxa_serial_initialize); serial_initfunc(s3c24xx_serial_initialize); serial_initfunc(s5p_serial_initialize); -serial_initfunc(zynq_serial_initalize); +serial_initfunc(zynq_serial_initialize); serial_initfunc(bfin_serial_initialize); serial_initfunc(bfin_jtag_initialize); serial_initfunc(mpc512x_serial_initialize); @@ -214,7 +214,7 @@ void serial_initialize(void) bfin_serial_initialize(); bfin_jtag_initialize(); uartlite_serial_initialize(); - zynq_serial_initalize(); + zynq_serial_initialize(); au1x00_serial_initialize(); asc_serial_initialize(); jz_serial_initialize(); diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 3ce9a27..1ff27d5 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -223,7 +223,7 @@ __weak struct serial_device *default_serial_console(void) } #endif -void zynq_serial_initalize(void) +void zynq_serial_initialize(void) { serial_register(&uart_zynq_serial0_device); serial_register(&uart_zynq_serial1_device); -- cgit v1.1 From 1c1c7506de1051df6d81c51a06a57be6406b534c Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Thu, 8 May 2014 19:16:14 +0200 Subject: leon: use CONFIG_SYS_HZ to config timer prescaler Before it was hardcoded to 1000 ticks per second. Signed-off-by: Daniel Hellstrom --- arch/sparc/cpu/leon2/cpu_init.c | 17 +++++++++-------- arch/sparc/cpu/leon3/cpu_init.c | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/sparc/cpu/leon2/cpu_init.c b/arch/sparc/cpu/leon2/cpu_init.c index de310fb..04d9158 100644 --- a/arch/sparc/cpu/leon2/cpu_init.c +++ b/arch/sparc/cpu/leon2/cpu_init.c @@ -13,6 +13,9 @@ #include +#define TIMER_BASE_CLK 1000000 +#define US_PER_TICK (1000000 / CONFIG_SYS_HZ) + DECLARE_GLOBAL_DATA_PTR; /* reset CPU (jump to 0, without reset) */ @@ -90,7 +93,7 @@ void cpu_wait_ticks(unsigned long ticks) while (get_timer(start) < ticks) ; } -/* initiate and setup timer0 interrupt to 1MHz +/* initiate and setup timer0 interrupt to configured HZ. Base clock is 1MHz. * Return irq number for timer int or a negative number for * dealing with self */ @@ -98,9 +101,9 @@ int timer_interrupt_init_cpu(void) { LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS; - /* 1ms ticks */ + /* SYS_HZ ticks per second */ leon2->Timer_Counter_1 = 0; - leon2->Timer_Reload_1 = 999; /* (((1000000 / 100) - 1)) */ + leon2->Timer_Reload_1 = (TIMER_BASE_CLK / CONFIG_SYS_HZ) - 1; leon2->Timer_Control_1 = (LEON2_TIMER_CTRL_EN | LEON2_TIMER_CTRL_RS | LEON2_TIMER_CTRL_LD); @@ -112,14 +115,12 @@ int timer_interrupt_init_cpu(void) */ unsigned long cpu_usec2ticks(unsigned long usec) { - /* timer set to 1kHz ==> 1 clk tick = 1 msec */ - if (usec < 1000) + if (usec < US_PER_TICK) return 1; - return (usec / 1000); + return usec / US_PER_TICK; } unsigned long cpu_ticks2usec(unsigned long ticks) { - /* 1tick = 1usec */ - return ticks * 1000; + return ticks * US_PER_TICK; } diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c index 4720f42..57ffa96 100644 --- a/arch/sparc/cpu/leon3/cpu_init.c +++ b/arch/sparc/cpu/leon3/cpu_init.c @@ -14,6 +14,9 @@ #include +#define TIMER_BASE_CLK 1000000 +#define US_PER_TICK (1000000 / CONFIG_SYS_HZ) + DECLARE_GLOBAL_DATA_PTR; /* reset CPU (jump to 0, without reset) */ @@ -203,15 +206,15 @@ void cpu_wait_ticks(unsigned long ticks) while (get_timer(start) < ticks) ; } -/* initiate and setup timer0 interrupt to 1MHz +/* initiate and setup timer0 interrupt to configured HZ. Base clock is 1MHz. * Return irq number for timer int or a negative number for * dealing with self */ int timer_interrupt_init_cpu(void) { - /* 1ms ticks */ + /* SYS_HZ ticks per second */ gptimer->e[0].val = 0; - gptimer->e[0].rld = 999; /* (((1000000 / 100) - 1)) */ + gptimer->e[0].rld = (TIMER_BASE_CLK / CONFIG_SYS_HZ) - 1; gptimer->e[0].ctrl = (LEON3_GPTIMER_EN | LEON3_GPTIMER_RL | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); @@ -224,14 +227,12 @@ int timer_interrupt_init_cpu(void) */ unsigned long cpu_usec2ticks(unsigned long usec) { - /* timer set to 1kHz ==> 1 clk tick = 1 msec */ - if (usec < 1000) + if (usec < US_PER_TICK) return 1; - return (usec / 1000); + return usec / US_PER_TICK; } unsigned long cpu_ticks2usec(unsigned long ticks) { - /* 1tick = 1usec */ - return ticks * 1000; + return ticks * US_PER_TICK; } -- cgit v1.1 From 4148b3d0dd62c71c13545d3c5374d015c23b544b Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Thu, 8 May 2014 18:52:37 +0200 Subject: leon: implement missing get_tbclk() Without this patch SPARC/LEON does not build. Reported-by: Tom Rini Signed-off-by: Daniel Hellstrom --- arch/sparc/cpu/leon2/cpu_init.c | 5 +++++ arch/sparc/cpu/leon3/cpu_init.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/sparc/cpu/leon2/cpu_init.c b/arch/sparc/cpu/leon2/cpu_init.c index 04d9158..6e07fe6 100644 --- a/arch/sparc/cpu/leon2/cpu_init.c +++ b/arch/sparc/cpu/leon2/cpu_init.c @@ -110,6 +110,11 @@ int timer_interrupt_init_cpu(void) return LEON2_TIMER1_IRQNO; } +ulong get_tbclk(void) +{ + return TIMER_BASE_CLK; +} + /* * This function is intended for SHORT delays only. */ diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c index 57ffa96..2f41d88 100644 --- a/arch/sparc/cpu/leon3/cpu_init.c +++ b/arch/sparc/cpu/leon3/cpu_init.c @@ -222,6 +222,11 @@ int timer_interrupt_init_cpu(void) return gptimer_irq; } +ulong get_tbclk(void) +{ + return TIMER_BASE_CLK; +} + /* * This function is intended for SHORT delays only. */ -- cgit v1.1