CAT760 PCMCIAウェイト数

CAT760のCFカード (PCMCIA) アクセス速度について

詳しくはルネサス SH7760 ハードウェアマニュアル 10章バスステートコントローラを参照のこと

pic4.png

デフォルト

TEK0062.png

CAT760のデフォルトのブートローダでは

CKIO=66.66MHz (15.00ns)

CSアサート→IORDアサート
    PCR.A6TED=3 -> 3.5φ

IORD幅
    基本 1φ
    WCR2.A6W=7 -> 15φ
    PCR.A6PCW=1 → 15φ
    合計 31φ

IORDネゲート → CSネゲート 
    PCR.A6TEH=3 -> 3.5φ

アクセスサイクル合計 38φ x 15ns = 570ns と比較的長いアクセスタイムになっている。

カーネルに改造を加える

リアルタイム応答が必要な場合など、CFアクセスタイムを短くする改造について記載する。

カーネルソースの arch/sh/board/cat/setup760.c に改造を加える

ウェイトコントロールレジスタ(WCR)を再セットアップする関数

/* ---- WCR (Wait Control Regiser) 再設定 ---- */
#define WCR1 (volatile unsigned long*)(0xFF800008)
  #define DMAIW   1
  #define A6IW    1
  #define A5IW    1
  #define A4IW    1
  #define A3IW    1
  #define A2IW    1
  #define A1IW    1
  #define A0IW    1
#define WCR2 (volatile unsigned long*)(0xFF80000C)
  #define A6W     7       /* PCMCIA wait 15? */
  #define A6B     2
  #define A5W     7       /* PCMCIA wait 15? */
  #define A5B     2
  #define A4W     2
  #define A3W     2       /* MUST 2!! */
  #define A2W     2
  #define A1W     3
  #define A0W     3
  #define A0B     3
#define WCR3 (volatile unsigned long*)(0xFF800010)
  #define A6S     1
  #define A6H     3
  #define A5S     1
  #define A5H     3
  #define A4RDH   0
  #define A4S     1
  #define A4H     2
  #define A3S     1
  #define A3H     2
  #define A2S     1
  #define A2H     2
  #define A1RDH   0
  #define A1S     1
  #define A1H     2
  #define A0S     1
  #define A0H     2
#define WCR4 (volatile unsigned long*)(0xFE0A0028)
#define PCR  (volatile unsigned short*)(0xFF800018)
  #define A5PCW   1
  #define A6PCW   1		/* was 1 */
  #define A5TED   3
  #define A6TED   3
  #define A5TEH   3
  #define A6TEH   3

static void wcr_resetup(void){
	*WCR1 = (DMAIW<<28 | A6IW<<24 | A5IW<<20 | A4IW<<16 |
			 A3IW<<12 | A2IW<<8 | A1IW<<4 | A0IW);

	*WCR2 = (A6W<<29 | A6B<<26 | A5W<<23 | A5B<<20 | A4W<<17 |
			 A3W<<13 | A2W<<9  | A1W<<6  | A0W<<3  | A0B<<0);

	*WCR3 = (A6S<<26 | A6H<<24 | A5S<<22 | A5H<<20 |
			A4RDH<<19 | A4S<<18 | A4H<< 16 |
			A3S<<14 | A3H<<12 | A2S<<10 | A2H<<8 |
			A1RDH<<7 | A1S<<6 | A1H<<4 | A0S<<2 | A0H) ;

	*WCR4 = A1H;

	*PCR  = (A5PCW<<14 | A6PCW<<12 | A5TED<<9 | A6TED<<6 | A5TEH<<3 | A6TEH);
}

呼び出し元

void __init platform_setup(void)
{
	unsigned short x;

	wcr_resetup();  /*追加 */
以下略

例として、 PCR.PCW を 1→0 にして、ウェイト数を 15クロック削減する改造

A6PCWウェイト数
00:0クロック
01:15クロック
10:30クロック
11:50クロック

注意:A6PCW(エリア6)とA5PCW (エリア5) 両方とも同じく書き換えてください。理由はMMUの TC. ビットの関連で、エリア5、エリア6 両方共の書き換えをしてください。

  #define A5PCW   0
  #define A6PCW   0		/* was 1 */

カーネルの再コンパイルと書き込み方法は「組込みLinuxガイド」を参照のこと。

実行結果

TEK0063.png

CFへのアクセスタイムが半分に減っている

関連