Skip to contentSkip to conversation

ARM: OMAP: Add minimal OMAP2430 support

PATCH In review Komal Shah 3 participants 6 messages May 18, 2006 – Jun 11, 2006

lore
Share & tools
lore

Komal Shah

author
#0 lore raw

PATCH 1/1 ARM: OMAP: Add minimal OMAP2430 support

* NFS is still not working. NETDEV Watchdog timeouts.
* Intel Starta flash gets detected - JFFS2 is not yet tested.
* platform_add_devices() is not working - Let me know, where I am making mistake :)

Please review.
---

This patch adds minimal OMAP2430 support.
Based on 2.6.10 Linux kernel available on linux.omap.com from TI.

Signature · 1 line
http://www.fastmail.fm - A fast, anti-spam email service.
#1 lore raw

Hi,

Quoted 8 lines · Komal Shah

Tony/Richard,

* NFS is still not working. NETDEV Watchdog timeouts.
* Intel Starta flash gets detected - JFFS2 is not yet tested.
* platform_add_devices() is not working - Let me know, where I am making mistake :)

Please review.

Well one thing we should change is to make it possible to compile in all 24xx boards. This involves changing things like PRCM register access to use a base address instead of ifdefs.

I know we this is quite a bit of work now, but it pays off in the long run. Something like this has proven to work well for portable code across various omaps/platforms:

#define OMAP2420_PRCM_SOME_BASE 0xaaaaaaaa
#define OMAP2430_PRCM_SOME_BASE 0xbbbbbbbb

#define PRCM_SOME_REG1_OFFSET 0x10
#define REG1_AAAA (1 << 31)
#define REG1_BBBB (1 << 30)
#define REG1_CCCC (1 << 29)

#define PRCM_SOME_REG2_OFFSET 0x20
#define REG2_AAAA (1 << 2)
#define REG2_BBBB (1 << 1)
#define REG2_CCCC (1 << 0)

#define PRCM_SOME_REG3_OFFSET 0x30

static unsigned long prcm_vbase;

#define prcm_readl(r) __raw_readl(prcm_vbase + (r))
#define prcm_writel(v, r) __raw_writel((v), prcm_vbase + (r))

static int prcm_do_something(void)

{
	u32 reg;

	reg = prcm_readl(PRCM_SOME_REG1_OFFSET);
	reg |= REG1_BBBB;
	prcm_writel(reg, PRCM_SOME_REG1_OFFSET);
}

static int __init prcm_init(void)

{
	if (cpu_is_omap2420())
		prcm_vbase = OMAP2420_PRCM_SOME_BASE;
	else if (cpu_is_omap2430())
		prcm_vbase = OMAP2430_PRCM_SOME_BASE;

	return 0;
}

Regards,

Tony

author
#2 lore raw
Quoted 41 lines · --- Tony Lindgren

Well one thing we should change is to make it possible to compile in all
24xx boards. This involves changing things like PRCM register access to use a base address instead of ifdefs.

I know we this is quite a bit of work now, but it pays off in the long
run. Something like this has proven to work well for portable code across various omaps/platforms:

#define OMAP2420_PRCM_SOME_BASE 0xaaaaaaaa
#define OMAP2430_PRCM_SOME_BASE 0xbbbbbbbb

#define PRCM_SOME_REG1_OFFSET 0x10
#define REG1_AAAA (1 << 31)
#define REG1_BBBB (1 << 30)
#define REG1_CCCC (1 << 29)

#define PRCM_SOME_REG2_OFFSET 0x20
#define REG2_AAAA (1 << 2)
#define REG2_BBBB (1 << 1)
#define REG2_CCCC (1 << 0)

#define PRCM_SOME_REG3_OFFSET 0x30

static unsigned long prcm_vbase;

#define prcm_readl(r) __raw_readl(prcm_vbase + (r))
#define prcm_writel(v, r) __raw_writel((v), prcm_vbase + (r))

static int prcm_do_something(void)

{
	u32 reg;

	reg = prcm_readl(PRCM_SOME_REG1_OFFSET);
	reg |= REG1_BBBB;
	prcm_writel(reg, PRCM_SOME_REG1_OFFSET);
}

static int __init prcm_init(void)

Quoted 9 lines
{
	if (cpu_is_omap2420())
		prcm_vbase = OMAP2420_PRCM_SOME_BASE;
	else if (cpu_is_omap2430())
		prcm_vbase = OMAP2430_PRCM_SOME_BASE;

	return 0;
}

Thanx for the review. I will work on this, once I come back from Japan :). At home, both the 2430 boards are not-booting and I had tough time with CSST and switch settings, so was not able to flash bootloader on 2430SDP-EVM ES1.0 chips. But it will not be hard to make compile-only patch for review.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#3 lore raw
Quoted 53 lines · Komal Shah
Quoted 41 lines · --- Tony Lindgren

Well one thing we should change is to make it possible to compile in all
24xx boards. This involves changing things like PRCM register access to use a base address instead of ifdefs.

I know we this is quite a bit of work now, but it pays off in the long
run. Something like this has proven to work well for portable code across various omaps/platforms:

#define OMAP2420_PRCM_SOME_BASE 0xaaaaaaaa
#define OMAP2430_PRCM_SOME_BASE 0xbbbbbbbb

#define PRCM_SOME_REG1_OFFSET 0x10
#define REG1_AAAA (1 << 31)
#define REG1_BBBB (1 << 30)
#define REG1_CCCC (1 << 29)

#define PRCM_SOME_REG2_OFFSET 0x20
#define REG2_AAAA (1 << 2)
#define REG2_BBBB (1 << 1)
#define REG2_CCCC (1 << 0)

#define PRCM_SOME_REG3_OFFSET 0x30

static unsigned long prcm_vbase;

#define prcm_readl(r) __raw_readl(prcm_vbase + (r))
#define prcm_writel(v, r) __raw_writel((v), prcm_vbase + (r))

static int prcm_do_something(void)

{
	u32 reg;

	reg = prcm_readl(PRCM_SOME_REG1_OFFSET);
	reg |= REG1_BBBB;
	prcm_writel(reg, PRCM_SOME_REG1_OFFSET);
}

static int __init prcm_init(void)

Quoted 9 lines
{
	if (cpu_is_omap2420())
		prcm_vbase = OMAP2420_PRCM_SOME_BASE;
	else if (cpu_is_omap2430())
		prcm_vbase = OMAP2430_PRCM_SOME_BASE;

	return 0;
}
Quoted 5 lines

Thanx for the review. I will work on this, once I come back from Japan :). At home, both the 2430 boards are not-booting and I had tough time with CSST and switch settings, so was not able to flash bootloader on 2430SDP-EVM ES1.0 chips. But it will not be hard to make compile-only patch for review.

OK, cool. I have some 24xx PM related patches coming up that already convert some part of the PRCM registers to use prcm_readl/writel(). I'll have those available probably towards the end of the week.

Tony

author
#4 lore raw
Quoted 57 lines · --- Tony Lindgren
Quoted 4 lines · Komal Shah
Quoted 2 lines · --- Tony Lindgren

Well one thing we should change is to make it possible to compile

in

Quoted 2 lines
Quoted 2 lines

all
24xx boards. This involves changing things like PRCM register

access

Quoted 5 lines
Quoted 5 lines

to use a base address instead of ifdefs.

I know we this is quite a bit of work now, but it pays off in the long
run. Something like this has proven to work well for portable

code

Quoted 42 lines
Quoted 41 lines

across various omaps/platforms:

#define OMAP2420_PRCM_SOME_BASE 0xaaaaaaaa
#define OMAP2430_PRCM_SOME_BASE 0xbbbbbbbb

#define PRCM_SOME_REG1_OFFSET 0x10
#define REG1_AAAA (1 << 31)
#define REG1_BBBB (1 << 30)
#define REG1_CCCC (1 << 29)

#define PRCM_SOME_REG2_OFFSET 0x20
#define REG2_AAAA (1 << 2)
#define REG2_BBBB (1 << 1)
#define REG2_CCCC (1 << 0)

#define PRCM_SOME_REG3_OFFSET 0x30

static unsigned long prcm_vbase;

#define prcm_readl(r) __raw_readl(prcm_vbase + (r))
#define prcm_writel(v, r) __raw_writel((v), prcm_vbase + (r))

static int prcm_do_something(void)

{
	u32 reg;

	reg = prcm_readl(PRCM_SOME_REG1_OFFSET);
	reg |= REG1_BBBB;
	prcm_writel(reg, PRCM_SOME_REG1_OFFSET);
}

static int __init prcm_init(void)

{
	if (cpu_is_omap2420())
		prcm_vbase = OMAP2420_PRCM_SOME_BASE;
	else if (cpu_is_omap2430())
		prcm_vbase = OMAP2430_PRCM_SOME_BASE;

	return 0;
}
Quoted 10 lines
Quoted 1 line

Thanx for the review. I will work on this, once I come back from

Japan

Quoted 1 line

:). At home, both the 2430 boards are not-booting and I had tough

time

Quoted 1 line

with CSST and switch settings, so was not able to flash bootloader

on

Quoted 1 line

2430SDP-EVM ES1.0 chips. But it will not be hard to make

compile-only

Quoted 1 line

patch for review.

After looking at the files which are needed to change for prcm_read/write[l], clock.c needs the major update. I hope Richard is OK with going from __REG32(...) to __raw_read/write[l] based prcm_rw wrappers?

Anyways, I have started doing that changes for other files.

---Komal Shah
http://komalshah.blogspot.com/

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#5 lore raw

Hi,

Quoted 4 lines · Komal Shah

After looking at the files which are needed to change for prcm_read/write[l], clock.c needs the major update. I hope Richard is OK with going from __REG32(...) to __raw_read/write[l] based prcm_rw wrappers?

read_reg() and write_reg() are definitely the way to go. The __REG() macros are unportable, and usually even lead to inefficient assembly code.

As for which API is the most coherent, I've found that this approach makes the most sense:

static void __iomem *prcm_base;

static u32 prcm_read_reg(int reg);
static void prcm_write_reg(int reg, u32 value);

If you go with the readl/writel argument ordering, you'll end up with oddness like:

static u32 mmc_writel(struct mmc *mmc, u32 value, int reg);

You should also not expose the raw register read/write functions, but rather implement wrapper functions to modify the relevant registers. Otherwise you might run into race issues with a preemptible kernel.

Cheers,
Juha