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

Commit b9ab1279 authored by Mark A. Greer's avatar Mark A. Greer Committed by Kevin Hilman
Browse files

davinci: Support JTAG ID register at any address



The Davinci cpu_is_davinci_*() macros use the SoC part number
and variant retrieved from the JTAG ID register to determine the
type of cpu that the kernel is running on.  Currently, the code to
read the JTAG ID register assumes that the register is always at
the same base address.  This isn't true on some newer SoCs.

To solve this, have the SoC-specific code set the JTAG ID register
base address in soc_info structure and add a 'cpu_id' member to it.
'cpu_id' will be used by the cpu_is_davinci_*() macros to match
the cpu id.  Also move the info used to identify the cpu type into
the SoC-specific code to keep all SoC-specific code together.

The common code will read the JTAG ID register, search through
an array of davinci_id structures to identify the cpu type.
Once identified, it will set the 'cpu_id' member of the soc_info
structure to the proper value and the cpu_is_davinci_*() macros
will now work.

Signed-off-by: default avatarMark A. Greer <mgreer@mvista.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 79c3c0b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
#

# Common objects
obj-y 			:= time.o irq.o clock.o serial.o io.o id.o psc.o \
obj-y 			:= time.o irq.o clock.o serial.o io.o psc.o \
			   gpio.o devices.o dma.o usb.o common.o

obj-$(CONFIG_DAVINCI_MUX)		+= mux.o
+28 −1
Original line number Diff line number Diff line
@@ -15,13 +15,31 @@
#include <asm/mach/map.h>

#include <mach/common.h>
#include <mach/cputype.h>

struct davinci_soc_info davinci_soc_info;
EXPORT_SYMBOL(davinci_soc_info);

static struct davinci_id * __init davinci_get_id(u32 jtag_id)
{
	int i;
	struct davinci_id *dip;
	u8 variant = (jtag_id & 0xf0000000) >> 28;
	u16 part_no = (jtag_id & 0x0ffff000) >> 12;

	for (i = 0, dip = davinci_soc_info.ids; i < davinci_soc_info.ids_num;
			i++, dip++)
		/* Don't care about the manufacturer right now */
		if ((dip->part_no == part_no) && (dip->variant == variant))
			return dip;

	return NULL;
}

void __init davinci_common_init(struct davinci_soc_info *soc_info)
{
	int ret;
	struct davinci_id *dip;

	if (!soc_info) {
		ret = -EINVAL;
@@ -46,7 +64,16 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
	 * We want to check CPU revision early for cpu_is_xxxx() macros.
	 * IO space mapping must be initialized before we can do that.
	 */
	davinci_check_revision();
	davinci_soc_info.jtag_id = __raw_readl(davinci_soc_info.jtag_id_base);

	dip = davinci_get_id(davinci_soc_info.jtag_id);
	if (!dip) {
		ret = -EINVAL;
		goto err;
	}

	davinci_soc_info.cpu_id = dip->cpu_id;
	pr_info("DaVinci %s variant 0x%x\n", dip->name, dip->variant);

	return;

+14 −0
Original line number Diff line number Diff line
@@ -534,9 +534,23 @@ static struct map_desc dm355_io_desc[] = {
	},
};

/* Contents of JTAG ID register used to identify exact cpu type */
static struct davinci_id dm355_ids[] = {
	{
		.variant	= 0x0,
		.part_no	= 0xb73b,
		.manufacturer	= 0x00f,
		.cpu_id		= DAVINCI_CPU_ID_DM355,
		.name		= "dm355",
	},
};

static struct davinci_soc_info davinci_soc_info_dm355 = {
	.io_desc		= dm355_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm355_io_desc),
	.jtag_id_base		= IO_ADDRESS(0x01c40028),
	.ids			= dm355_ids,
	.ids_num		= ARRAY_SIZE(dm355_ids),
};

void __init dm355_init(void)
+14 −1
Original line number Diff line number Diff line
@@ -388,7 +388,6 @@ MUX_CFG(DM644X, LOEEN, 0, 24, 1, 1, true)
MUX_CFG(DM644X, LFLDEN,		0,   25,    1,	  1,	 false)
};


/*----------------------------------------------------------------------*/

static const s8 dma_chan_dm644x_no_event[] = {
@@ -475,9 +474,23 @@ static struct map_desc dm644x_io_desc[] = {
	},
};

/* Contents of JTAG ID register used to identify exact cpu type */
static struct davinci_id dm644x_ids[] = {
	{
		.variant	= 0x0,
		.part_no	= 0xb700,
		.manufacturer	= 0x017,
		.cpu_id		= DAVINCI_CPU_ID_DM6446,
		.name		= "dm6446",
	},
};

static struct davinci_soc_info davinci_soc_info_dm644x = {
	.io_desc		= dm644x_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm644x_io_desc),
	.jtag_id_base		= IO_ADDRESS(0x01c40028),
	.ids			= dm644x_ids,
	.ids_num		= ARRAY_SIZE(dm644x_ids),
};

void __init dm644x_init(void)
+14 −0
Original line number Diff line number Diff line
@@ -454,9 +454,23 @@ static struct map_desc dm646x_io_desc[] = {
	},
};

/* Contents of JTAG ID register used to identify exact cpu type */
static struct davinci_id dm646x_ids[] = {
	{
		.variant	= 0x0,
		.part_no	= 0xb770,
		.manufacturer	= 0x017,
		.cpu_id		= DAVINCI_CPU_ID_DM6467,
		.name		= "dm6467",
	},
};

static struct davinci_soc_info davinci_soc_info_dm646x = {
	.io_desc		= dm646x_io_desc,
	.io_desc_num		= ARRAY_SIZE(dm646x_io_desc),
	.jtag_id_base		= IO_ADDRESS(0x01c40028),
	.ids			= dm646x_ids,
	.ids_num		= ARRAY_SIZE(dm646x_ids),
};

void __init dm646x_init(void)
Loading