Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7cf4b482 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Kukjin Kim
Browse files

ARM: SAMSUNG: Add a workaround for get_clock() for serial driver



Serial drivers call get_clock() very early, before platform bus
has been set up, this requires a special check to let them get
a proper clock. Without this patch, a serial console is broken
on S5PV310 and S5PC210 boards.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
[kgene.kim@samsung.com: fix coding-style]
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
parent 4341f9b3
Loading
Loading
Loading
Loading
+26 −1
Original line number Original line Diff line number Diff line
@@ -48,6 +48,9 @@
#include <plat/clock.h>
#include <plat/clock.h>
#include <plat/cpu.h>
#include <plat/cpu.h>


#include <linux/serial_core.h>
#include <plat/regs-serial.h> /* for s3c24xx_uart_devs */

/* clock information */
/* clock information */


static LIST_HEAD(clocks);
static LIST_HEAD(clocks);
@@ -65,6 +68,28 @@ static int clk_null_enable(struct clk *clk, int enable)
	return 0;
	return 0;
}
}


static int dev_is_s3c_uart(struct device *dev)
{
	struct platform_device **pdev = s3c24xx_uart_devs;
	int i;
	for (i = 0; i < ARRAY_SIZE(s3c24xx_uart_devs); i++, pdev++)
		if (*pdev && dev == &(*pdev)->dev)
			return 1;
	return 0;
}

/*
 * Serial drivers call get_clock() very early, before platform bus
 * has been set up, this requires a special check to let them get
 * a proper clock
 */

static int dev_is_platform_device(struct device *dev)
{
	return dev->bus == &platform_bus_type ||
	       (dev->bus == NULL && dev_is_s3c_uart(dev));
}

/* Clock API calls */
/* Clock API calls */


struct clk *clk_get(struct device *dev, const char *id)
struct clk *clk_get(struct device *dev, const char *id)
@@ -73,7 +98,7 @@ struct clk *clk_get(struct device *dev, const char *id)
	struct clk *clk = ERR_PTR(-ENOENT);
	struct clk *clk = ERR_PTR(-ENOENT);
	int idno;
	int idno;


	if (dev == NULL || dev->bus != &platform_bus_type)
	if (dev == NULL || !dev_is_platform_device(dev))
		idno = -1;
		idno = -1;
	else
	else
		idno = to_platform_device(dev)->id;
		idno = to_platform_device(dev)->id;