All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Scian <andrea.scian@dave-tech.it>
To: u-boot@lists.denx.de
Subject: [U-Boot] s3c44b0 serial driver questions
Date: Tue, 22 Jun 2010 19:11:18 +0200	[thread overview]
Message-ID: <4C20EEB6.8080605@dave-tech.it> (raw)
In-Reply-To: <AANLkTikuN27nPWp-JbwtRpAAcLZJNEZJIR3PsanM7FVe@mail.gmail.com>


Dear Brian,

yes it can be. IIRC I worked only with 75MHz version of S3C44B0, I've 
never used a 66MHz one.
Unfortunately I do not have such a board here, neither the time ;-), to 
check your bug report..
Did you already check the 66MHz BRD formula?
If it's correct in you testbed to me you can send the patch for commiting

Best Regards,

-- 


Andrea Scian

DAVE Srl - Electronics System House
via Forniz 2/1
33080 Porcia (PN) - Italy
Telephone: +39.0434.921215
Telefax: +39.0434.1994030
web: www.dave-tech.it
e-mail address: andrea.scian at dave-tech.it
how to reach us: http://mail.map24.com/dave


On 21/06/2010 14.45, Brian Cavagnolo wrote:
> Hello,
>
> I'm hoping to use the s3c44b0 serial driver for a CPU with very similar serial
> hardware.  One change that I must make is to calculate the baud rate divisor
> with a macro because this operation is board-specific.  I propose to clean up
> the large switch statement in the existing code with a macro that calculates
> the BRD using the formula in the datasheet ("S3C44B0X RISC MICROPROCESSOR"
> pg. 10-7; See proposed patch below.)  However, the BRD values in the current
> code for the 66MHz case do not match the formula in the data sheet.  They are
> all skewed high.  Is this a bug?
>
> Ciao,
> Brian
>
> diff --git a/arch/arm/include/asm/arch-s3c44b0/hardware.h
> b/arch/arm/include/asm/arch-s3c44b0/hardware.h
> index 146e265..38ff32c 100644
> --- a/arch/arm/include/asm/arch-s3c44b0/hardware.h
> +++ b/arch/arm/include/asm/arch-s3c44b0/hardware.h
> @@ -11,7 +11,8 @@
>   #define REGL(addr)	(*(volatile unsigned int *)(REGBASE+addr))
>   #define REGW(addr)	(*(volatile unsigned short *)(REGBASE+addr))
>   #define REGB(addr)	(*(volatile unsigned char *)(REGBASE+addr))
> -
> +#define BRD(bps)	(DIV_ROUND(CONFIG_S3C44B0_CLOCK_SPEED * 1000000, \
> +				(bps)*16) - 1)
>
>   /*****************************/
>   /* CPU Wrapper Registers     */
> diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
> index 95d0266..e6c535c 100644
> --- a/drivers/serial/serial_s3c44b0.c
> +++ b/drivers/serial/serial_s3c44b0.c
> @@ -70,68 +70,7 @@ static int serial_flush_output(void)
>
>   void serial_setbrg (void)
>   {
> -	u32 divisor = 0;
> -
> -	/* get correct divisor */
> -	switch(gd->baudrate) {
> -
> -	case 1200:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 3124;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 3905;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif
> -		break;
> -
> -	case 9600:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 390;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 487;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif
> -		break;
> -
> -	case 19200:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 194;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 243;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif
> -		break;
> -
> -	case 38400:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 97;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 121;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif	/* break; */
> -
> -	case 57600:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 64;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 80;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif	/* break; */
> -
> -	case 115200:
> -#if CONFIG_S3C44B0_CLOCK_SPEED==66
> -		divisor = 32;
> -#elif CONFIG_S3C44B0_CLOCK_SPEED==75
> -		divisor = 40;
> -#else
> -# error CONFIG_S3C44B0_CLOCK_SPEED undefined
> -#endif	/* break; */
> -	}
> +	u32 divisor = BRD(gd->baudrate);
>
>   	serial_flush_output();
>   	serial_flush_input();
>
>

  reply	other threads:[~2010-06-22 17:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-21 12:45 [U-Boot] s3c44b0 serial driver questions Brian Cavagnolo
2010-06-22 17:11 ` Andrea Scian [this message]
2010-06-29 16:54   ` Brian Cavagnolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C20EEB6.8080605@dave-tech.it \
    --to=andrea.scian@dave-tech.it \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.