[Suzaku:00099] Re: 追加UARTとlinux /dev/ttyS1の関係

Yasushi SHOJI email@hidden
2004年 10月 6日 (水) 16:27:54 JST


At Tue, 05 Oct 2004 14:09:22 +0900,
kyosuke yoshizu wrote:
[...]
> suzaku hardare manualの 9.UARTの追加を行い、linuxのdevice fileとし
> てttyS1,c,4,65の定義の追加をして、このUARTをttyS1のデバイスファイル
> としてアクセスしたいのですが、このttyS1の定義と追加UARTハードbaseア
> ドレスFFFF8000との関係はどのようにして結び付ければよいのでしょうか?
> 
> それとも結ぶ必要はない?

あります、こんな↓感じです。

uClinux-dist/linux-2.4.x/arch/microblaze/kernel/xmbserial.cに対するパッ
チです。

現在のドライバーはイマイチなので、置き換える予定です。予定ですので、い
つになるかは未定ですが…。

わからない部分があったら、聞いてください。
--
             yashi

--- xmbserial.c.orig	2004-10-06 10:11:36.000000000 +0900
+++ xmbserial.c	2004-10-06 10:16:59.000000000 +0900
@@ -181,9 +181,8 @@
  */
 static struct xmb_serial xmbrs_table[] = {
   { 0, (XPAR_CONSOLE_UART_BASEADDR), IRQBASE, ASYNC_BOOT_AUTOCONF }, /* ttyS0 */
-#ifdef CONFIG_MICROBLAZE_DEBUG_UART
-  { 0, (XPAR_DEBUG_UART_BASEADDR), IRQBASE+1, ASYNC_BOOT_AUTOCONF } /* ttyS1 */
-#endif
+  { 0, (XPAR_SECOND_UART1_BASEADDR), IRQBASE+2, ASYNC_BOOT_AUTOCONF }, /* ttyS1 */
+  { 0, (XPAR_SECOND_UART2_BASEADDR), IRQBASE+3, ASYNC_BOOT_AUTOCONF } /* ttyS2 */
 };
 
 #define	NR_PORTS	(sizeof(xmbrs_table) / sizeof(struct xmb_serial))
@@ -389,13 +388,22 @@
  */
 void xmbrs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	struct xmb_serial	*info;
+	struct xmb_serial	*info = NULL;
 	unsigned int isr;
 	volatile unsigned int *uartp;
+	int i;
 
-	info = &xmbrs_table[(irq - IRQBASE)];
-	uartp = (volatile unsigned int *) info->addr;
+	for(i = 0 ; i < NR_PORTS ; i++){
+		if(xmbrs_table[i].irq == irq){
+			info = &xmbrs_table[i];
+		}
+	}
+	if(!info){
+		printk("invalied irq happen, no : %d\n", irq);
+		return;
+	}
 
+	uartp = (volatile unsigned int *) info->addr;
 	isr = uartp[XUL_STATUS_REG_OFFSET/4];
 
 	/* Grab any valid chars */
@@ -1464,6 +1472,7 @@
 	switch (info->line) {
 	case 0:
 	case 1:
+	case 2:
 		break;
 	default:
 		printk("SERIAL: don't know how to handle UART %d interrupt?\n",



suzaku メーリングリストの案内