Skip to contentSkip to conversation

OneNAND: S5PC100 OneNAND IPL support

PATCH New Kyungmin Park 2 participants 8 messages Jul 21, 2009 – Jul 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

onenand_ipl/onenand_ipl.h +9 -0
index 412572a..b43ddfb 100644
@@ -31,5 +31,14 @@
 #define READ_INTERRUPT()                                                \
 	onenand_readw(THIS_ONENAND(ONENAND_REG_INTERRUPT))
 
+#ifdef CONFIG_S5PC1XX
+#define AHB_ADDR			0xB0000000
+#define MEM_ADDR(fba, fpa, fsa)		((fba) << 13 | (fpa) << 7 | (fsa) << 5)
+#define CMD_MAP_01(mem_addr)		(AHB_ADDR | (1 << 26) | (mem_addr))
+#define CMD_MAP_11(addr)		(AHB_ADDR | (3 << 26) | ((addr) << 2))
+#undef onenand_readw
+#define onenand_readw(a)		(readl(CMD_MAP_11((a) >> 1)) & 0xffff)
+#endif
+
 extern int onenand_read_block(unsigned char *buf);
 #endif
onenand_ipl/onenand_read.c +18 -0
index d1a842d..7ffc9a9 100644
@@ -37,6 +37,23 @@
 extern void *memcpy32(void *dest, void *src, int size);
 #endif
 
+#ifdef CONFIG_S5PC1XX
+static inline int onenand_read_page(ulong block, ulong page,
+				u_char * buf, int pagesize)
+{
+	unsigned int *p = (unsigned int *) buf;
+	int mem_addr, i;
+
+	mem_addr = MEM_ADDR(block, page, 0);
+
+	pagesize >>= 2;
+
+	for (i = 0; i < pagesize; i++)
+		*p++ = readl(CMD_MAP_01(mem_addr));
+
+	return 0;
+}
+#else
 /* read a page with ECC */
 static inline int onenand_read_page(ulong block, ulong page,
 				u_char * buf, int pagesize)
@@ -88,6 +105,7 @@ static inline int onenand_read_page(ulong block, ulong page,
 
 	return 0;
 }
+#endif
 
 #define ONENAND_START_PAGE		1
 #define ONENAND_PAGES_PER_BLOCK		64
#1 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 5 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

is there any better than put soc specific code in generic implementatioN

Best Regards,
J.

#2 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

is there any better than put soc specific code in generic implementatioN

I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.

Thank you,
Kyungmin Park

#3 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 6 lines · Kyungmin Park
Quoted 4 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 3 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

---

is there any better than put soc specific code in generic implementatioN

I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.

I known
so what do you propose?

Best Regards,
J.

#4 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 9 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines · Kyungmin Park
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

is there any better than put soc specific code in generic implementatioN

I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.

I known
so what do you propose?

just commit the patch I sent. It's difficult to remove the ifdef since size limitation.

Thank you,
Kyungmin Park

#5 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 17 lines · Kyungmin Park
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Kyungmin Park
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

is there any better than put soc specific code in generic implementatioN

I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.

Quoted 6 lines
Quoted 3 lines

I known
so what do you propose?

just commit the patch I sent. It's difficult to remove the ifdef since size limitation.

I understand your problem of size but is there any otherway to do ti without the onenand soc controler ?

I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc

Best Regards,
J.

#6 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Kyungmin Park
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Kyungmin Park
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Kyungmin Park

S5PC100 has own OneNAND controller and has different interface. OneNAND IPL use it to S5PC100 board.

---

is there any better than put soc specific code in generic implementatioN

I hope so. only s3c64xx series and s5pc100 use own OneNAND controller. I also don't understand why need these controller. The OneNAND has its own controller at chips already.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I known
so what do you propose?

just commit the patch I sent. It's difficult to remove the ifdef since size limitation.

I understand your problem of size but is there any otherway to do ti without the onenand soc controler ?

No, no way we should use soc controller.

Quoted 4 lines

I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc

something like weak alias?

The new problem is now I want to support S5PC100 & S5PC110 Samsung SoC simultaneously.
But these has different interface. c100 has CMD_MAP method, c110 has similar generic but different.
At runtime it detects the cpu id and determine which read function is used. At this case, s5pc100/c110 has no size limitation because of internal ROM code. At boot it loads 16KiB and 8KiB data to internal RAM respectively.

Okay I will try to make it generic and resend it after finishing the port s5pc110 works

Thank you,
Kyungmin Park

Quoted 4 lines

Best Regards,
J.

#7 lore raw

PATCH 1/1 OneNAND: S5PC100 OneNAND IPL support

Quoted 16 lines
Quoted 4 lines

I'll prefer we find a way to not put soc specific code in the generic code maybe we can crete a header which will be soc specific or a generic that we will include depending on the soc

something like weak alias?

The new problem is now I want to support S5PC100 & S5PC110 Samsung SoC simultaneously.
But these has different interface. c100 has CMD_MAP method, c110 has similar generic but different.
At runtime it detects the cpu id and determine which read function is used. At this case, s5pc100/c110 has no size limitation because of internal ROM code. At boot it loads 16KiB and 8KiB data to internal RAM respectively.

Quoted 2 lines

Okay I will try to make it generic and resend it after finishing the port s5pc110 works

ok so this patch will be add at the same thime of the s5pc110 in the next branch

Best Regards,
J.