Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281584
b: refs/heads/master
c: c3310fb
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Abraham authored and Kukjin Kim committed Dec 23, 2011
1 parent 1766a1e commit 97d5898
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 248 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: afba7f91e64025748a2cfec181e5a910fd0dee0e
refs/heads/master: c3310fbbeb9db6967900ed22eb3d0bd0bb0e892c
4 changes: 1 addition & 3 deletions trunk/arch/arm/mach-exynos/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ void __init exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
struct s3c2410_uartcfg *tcfg = cfg;
u32 ucnt;

for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {
for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
tcfg->has_fracval = 1;
tcfg->flags |= NO_NEED_CHECK_CLKSRC;
}

s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
}
7 changes: 6 additions & 1 deletion trunk/arch/arm/plat-samsung/include/plat/regs-serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@
#define S3C2410_LCON_IRM (1<<6)

#define S3C2440_UCON_CLKMASK (3<<10)
#define S3C2440_UCON_CLKSHIFT (10)
#define S3C2440_UCON_PCLK (0<<10)
#define S3C2440_UCON_UCLK (1<<10)
#define S3C2440_UCON_PCLK2 (2<<10)
#define S3C2440_UCON_FCLK (3<<10)
#define S3C2443_UCON_EPLL (3<<10)

#define S3C6400_UCON_CLKMASK (3<<10)
#define S3C6400_UCON_CLKSHIFT (10)
#define S3C6400_UCON_PCLK (0<<10)
#define S3C6400_UCON_PCLK2 (2<<10)
#define S3C6400_UCON_UCLK0 (1<<10)
Expand All @@ -90,11 +92,14 @@
#define S3C2440_UCON_DIVSHIFT (12)

#define S3C2412_UCON_CLKMASK (3<<10)
#define S3C2412_UCON_CLKSHIFT (10)
#define S3C2412_UCON_UCLK (1<<10)
#define S3C2412_UCON_USYSCLK (3<<10)
#define S3C2412_UCON_PCLK (0<<10)
#define S3C2412_UCON_PCLK2 (2<<10)

#define S3C2410_UCON_CLKMASK (1 << 10)
#define S3C2410_UCON_CLKSHIFT (10)
#define S3C2410_UCON_UCLK (1<<10)
#define S3C2410_UCON_SBREAK (1<<4)

Expand Down Expand Up @@ -193,6 +198,7 @@

/* Following are specific to S5PV210 */
#define S5PV210_UCON_CLKMASK (1<<10)
#define S5PV210_UCON_CLKSHIFT (10)
#define S5PV210_UCON_PCLK (0<<10)
#define S5PV210_UCON_UCLK (1<<10)

Expand Down Expand Up @@ -221,7 +227,6 @@
#define S5PV210_UFSTAT_RXMASK (255<<0)
#define S5PV210_UFSTAT_RXSHIFT (0)

#define NO_NEED_CHECK_CLKSRC 1
#define S3C2410_UCON_CLKSEL0 (1 << 0)
#define S3C2410_UCON_CLKSEL1 (1 << 1)
#define S3C2410_UCON_CLKSEL2 (1 << 2)
Expand Down
31 changes: 4 additions & 27 deletions trunk/drivers/tty/serial/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@

#include "samsung.h"

static int s3c2410_serial_setsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

if (strcmp(clk->name, "uclk") == 0)
ucon |= S3C2410_UCON_UCLK;
else
ucon &= ~S3C2410_UCON_UCLK;

wr_regl(port, S3C2410_UCON, ucon);
return 0;
}

static int s3c2410_serial_getsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

clk->divisor = 1;
clk->name = (ucon & S3C2410_UCON_UCLK) ? "uclk" : "pclk";

return 0;
}

static int s3c2410_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg)
{
Expand Down Expand Up @@ -77,8 +52,10 @@ static struct s3c24xx_uart_info s3c2410_uart_inf = {
.tx_fifofull = S3C2410_UFSTAT_TXFULL,
.tx_fifomask = S3C2410_UFSTAT_TXMASK,
.tx_fifoshift = S3C2410_UFSTAT_TXSHIFT,
.get_clksrc = s3c2410_serial_getsource,
.set_clksrc = s3c2410_serial_setsource,
.def_clk_sel = S3C2410_UCON_CLKSEL0,
.num_clks = 2,
.clksel_mask = S3C2410_UCON_CLKMASK,
.clksel_shift = S3C2410_UCON_CLKSHIFT,
.reset_port = s3c2410_serial_resetport,
};

Expand Down
55 changes: 4 additions & 51 deletions trunk/drivers/tty/serial/s3c2412.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,55 +25,6 @@

#include "samsung.h"

static int s3c2412_serial_setsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

ucon &= ~S3C2412_UCON_CLKMASK;

if (strcmp(clk->name, "uclk") == 0)
ucon |= S3C2440_UCON_UCLK;
else if (strcmp(clk->name, "pclk") == 0)
ucon |= S3C2440_UCON_PCLK;
else if (strcmp(clk->name, "usysclk") == 0)
ucon |= S3C2412_UCON_USYSCLK;
else {
printk(KERN_ERR "unknown clock source %s\n", clk->name);
return -EINVAL;
}

wr_regl(port, S3C2410_UCON, ucon);
return 0;
}


static int s3c2412_serial_getsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

switch (ucon & S3C2412_UCON_CLKMASK) {
case S3C2412_UCON_UCLK:
clk->divisor = 1;
clk->name = "uclk";
break;

case S3C2412_UCON_PCLK:
case S3C2412_UCON_PCLK2:
clk->divisor = 1;
clk->name = "pclk";
break;

case S3C2412_UCON_USYSCLK:
clk->divisor = 1;
clk->name = "usysclk";
break;
}

return 0;
}

static int s3c2412_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg)
{
Expand Down Expand Up @@ -108,8 +59,10 @@ static struct s3c24xx_uart_info s3c2412_uart_inf = {
.tx_fifofull = S3C2440_UFSTAT_TXFULL,
.tx_fifomask = S3C2440_UFSTAT_TXMASK,
.tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
.get_clksrc = s3c2412_serial_getsource,
.set_clksrc = s3c2412_serial_setsource,
.def_clk_sel = S3C2410_UCON_CLKSEL2,
.num_clks = 4,
.clksel_mask = S3C2412_UCON_CLKMASK,
.clksel_shift = S3C2412_UCON_CLKSHIFT,
.reset_port = s3c2412_serial_resetport,
};

Expand Down
58 changes: 4 additions & 54 deletions trunk/drivers/tty/serial/s3c2440.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,58 +25,6 @@

#include "samsung.h"


static int s3c2440_serial_setsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

/* todo - proper fclk<>nonfclk switch. */

ucon &= ~S3C2440_UCON_CLKMASK;

if (strcmp(clk->name, "uclk") == 0)
ucon |= S3C2440_UCON_UCLK;
else if (strcmp(clk->name, "pclk") == 0)
ucon |= S3C2440_UCON_PCLK;
else if (strcmp(clk->name, "fclk_n") == 0)
ucon |= S3C2440_UCON_FCLK;
else {
printk(KERN_ERR "unknown clock source %s\n", clk->name);
return -EINVAL;
}

wr_regl(port, S3C2410_UCON, ucon);
return 0;
}


static int s3c2440_serial_getsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

switch (ucon & S3C2440_UCON_CLKMASK) {
case S3C2440_UCON_UCLK:
clk->divisor = 1;
clk->name = "uclk";
break;

case S3C2440_UCON_PCLK:
case S3C2440_UCON_PCLK2:
clk->divisor = 1;
clk->name = "pclk";
break;

case S3C2440_UCON_FCLK:
clk->divisor = 1;
clk->name = "fclk_n";
break;
}

return 0;
}

static int s3c2440_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg)
{
Expand Down Expand Up @@ -110,8 +58,10 @@ static struct s3c24xx_uart_info s3c2440_uart_inf = {
.tx_fifofull = S3C2440_UFSTAT_TXFULL,
.tx_fifomask = S3C2440_UFSTAT_TXMASK,
.tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
.get_clksrc = s3c2440_serial_getsource,
.set_clksrc = s3c2440_serial_setsource,
.def_clk_sel = S3C2410_UCON_CLKSEL2,
.num_clks = 4,
.clksel_mask = S3C2440_UCON_CLKMASK,
.clksel_shift = S3C2440_UCON_CLKSHIFT,
.reset_port = s3c2440_serial_resetport,
};

Expand Down
54 changes: 4 additions & 50 deletions trunk/drivers/tty/serial/s3c6400.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,54 +26,6 @@

#include "samsung.h"

static int s3c6400_serial_setsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
unsigned long ucon = rd_regl(port, S3C2410_UCON);

if (strcmp(clk->name, "uclk0") == 0) {
ucon &= ~S3C6400_UCON_CLKMASK;
ucon |= S3C6400_UCON_UCLK0;
} else if (strcmp(clk->name, "uclk1") == 0)
ucon |= S3C6400_UCON_UCLK1;
else if (strcmp(clk->name, "pclk") == 0) {
/* See notes about transitioning from UCLK to PCLK */
ucon &= ~S3C6400_UCON_UCLK0;
} else {
printk(KERN_ERR "unknown clock source %s\n", clk->name);
return -EINVAL;
}

wr_regl(port, S3C2410_UCON, ucon);
return 0;
}


static int s3c6400_serial_getsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
u32 ucon = rd_regl(port, S3C2410_UCON);

clk->divisor = 1;

switch (ucon & S3C6400_UCON_CLKMASK) {
case S3C6400_UCON_UCLK0:
clk->name = "uclk0";
break;

case S3C6400_UCON_UCLK1:
clk->name = "uclk1";
break;

case S3C6400_UCON_PCLK:
case S3C6400_UCON_PCLK2:
clk->name = "pclk";
break;
}

return 0;
}

static int s3c6400_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg)
{
Expand Down Expand Up @@ -108,8 +60,10 @@ static struct s3c24xx_uart_info s3c6400_uart_inf = {
.tx_fifofull = S3C2440_UFSTAT_TXFULL,
.tx_fifomask = S3C2440_UFSTAT_TXMASK,
.tx_fifoshift = S3C2440_UFSTAT_TXSHIFT,
.get_clksrc = s3c6400_serial_getsource,
.set_clksrc = s3c6400_serial_setsource,
.def_clk_sel = S3C2410_UCON_CLKSEL2,
.num_clks = 4,
.clksel_mask = S3C6400_UCON_CLKMASK,
.clksel_shift = S3C6400_UCON_CLKSHIFT,
.reset_port = s3c6400_serial_resetport,
};

Expand Down
60 changes: 4 additions & 56 deletions trunk/drivers/tty/serial/s5pv210.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,6 @@
#include <plat/regs-serial.h>
#include "samsung.h"

static int s5pv210_serial_setsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
struct s3c24xx_uart_port *ourport;
struct s3c2410_uartcfg *cfg;
unsigned long ucon = rd_regl(port, S3C2410_UCON);

ourport = container_of(port, struct s3c24xx_uart_port, port);
cfg = ourport->cfg;

if (cfg->flags & NO_NEED_CHECK_CLKSRC)
return 0;

if (strcmp(clk->name, "pclk") == 0)
ucon &= ~S5PV210_UCON_CLKMASK;
else if (strcmp(clk->name, "uclk1") == 0)
ucon |= S5PV210_UCON_CLKMASK;
else {
printk(KERN_ERR "unknown clock source %s\n", clk->name);
return -EINVAL;
}

wr_regl(port, S3C2410_UCON, ucon);
return 0;
}


static int s5pv210_serial_getsource(struct uart_port *port,
struct s3c24xx_uart_clksrc *clk)
{
struct s3c24xx_uart_port *ourport;
struct s3c2410_uartcfg *cfg;
u32 ucon = rd_regl(port, S3C2410_UCON);

ourport = container_of(port, struct s3c24xx_uart_port, port);
cfg = ourport->cfg;

clk->divisor = 1;

if (cfg->flags & NO_NEED_CHECK_CLKSRC)
return 0;

switch (ucon & S5PV210_UCON_CLKMASK) {
case S5PV210_UCON_PCLK:
clk->name = "pclk";
break;
case S5PV210_UCON_UCLK:
clk->name = "uclk1";
break;
}

return 0;
}

static int s5pv210_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg)
{
Expand Down Expand Up @@ -109,8 +55,10 @@ static int s5pv210_serial_resetport(struct uart_port *port,
.tx_fifofull = S5PV210_UFSTAT_TXFULL, \
.tx_fifomask = S5PV210_UFSTAT_TXMASK, \
.tx_fifoshift = S5PV210_UFSTAT_TXSHIFT, \
.get_clksrc = s5pv210_serial_getsource, \
.set_clksrc = s5pv210_serial_setsource, \
.def_clk_sel = S3C2410_UCON_CLKSEL0, \
.num_clks = 2, \
.clksel_mask = S5PV210_UCON_CLKMASK, \
.clksel_shift = S5PV210_UCON_CLKSHIFT, \
.reset_port = s5pv210_serial_resetport

static struct s3c24xx_uart_info s5p_port_fifo256 = {
Expand Down
Loading

0 comments on commit 97d5898

Please sign in to comment.