18c2ecf20Sopenharmony_ci/***************************************************************************/ 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * m68VZ328.c - 68VZ328 specific config 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 1993 Hamish Macdonald 78c2ecf20Sopenharmony_ci * Copyright (C) 1999 D. Jeff Dionne 88c2ecf20Sopenharmony_ci * Copyright (C) 2001 Georges Menie, Ken Desmet 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 118c2ecf20Sopenharmony_ci * License. See the file COPYING in the main directory of this archive 128c2ecf20Sopenharmony_ci * for more details. 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/***************************************************************************/ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <linux/init.h> 188c2ecf20Sopenharmony_ci#include <linux/types.h> 198c2ecf20Sopenharmony_ci#include <linux/kernel.h> 208c2ecf20Sopenharmony_ci#include <linux/kd.h> 218c2ecf20Sopenharmony_ci#include <linux/netdevice.h> 228c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 238c2ecf20Sopenharmony_ci#include <linux/irq.h> 248c2ecf20Sopenharmony_ci#include <linux/rtc.h> 258c2ecf20Sopenharmony_ci#include <linux/pgtable.h> 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include <asm/machdep.h> 288c2ecf20Sopenharmony_ci#include <asm/MC68VZ328.h> 298c2ecf20Sopenharmony_ci#include <asm/bootstd.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifdef CONFIG_INIT_LCD 328c2ecf20Sopenharmony_ci#include "bootlogo-vz.h" 338c2ecf20Sopenharmony_ci#endif 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/***************************************************************************/ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciint m68328_hwclk(int set, struct rtc_time *t); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/***************************************************************************/ 408c2ecf20Sopenharmony_ci/* Init Drangon Engine hardware */ 418c2ecf20Sopenharmony_ci/***************************************************************************/ 428c2ecf20Sopenharmony_ci#if defined(CONFIG_DRAGEN2) 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistatic void m68vz328_reset(void) 458c2ecf20Sopenharmony_ci{ 468c2ecf20Sopenharmony_ci local_irq_disable(); 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#ifdef CONFIG_INIT_LCD 498c2ecf20Sopenharmony_ci PBDATA |= 0x20; /* disable CCFL light */ 508c2ecf20Sopenharmony_ci PKDATA |= 0x4; /* disable LCD controller */ 518c2ecf20Sopenharmony_ci LCKCON = 0; 528c2ecf20Sopenharmony_ci#endif 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci __asm__ __volatile__( 558c2ecf20Sopenharmony_ci "reset\n\t" 568c2ecf20Sopenharmony_ci "moveal #0x04000000, %a0\n\t" 578c2ecf20Sopenharmony_ci "moveal 0(%a0), %sp\n\t" 588c2ecf20Sopenharmony_ci "moveal 4(%a0), %a0\n\t" 598c2ecf20Sopenharmony_ci "jmp (%a0)" 608c2ecf20Sopenharmony_ci ); 618c2ecf20Sopenharmony_ci} 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cistatic void __init init_hardware(char *command, int size) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci#ifdef CONFIG_DIRECT_IO_ACCESS 668c2ecf20Sopenharmony_ci SCR = 0x10; /* allow user access to internal registers */ 678c2ecf20Sopenharmony_ci#endif 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci /* CSGB Init */ 708c2ecf20Sopenharmony_ci CSGBB = 0x4000; 718c2ecf20Sopenharmony_ci CSB = 0x1a1; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci /* CS8900 init */ 748c2ecf20Sopenharmony_ci /* PK3: hardware sleep function pin, active low */ 758c2ecf20Sopenharmony_ci PKSEL |= PK(3); /* select pin as I/O */ 768c2ecf20Sopenharmony_ci PKDIR |= PK(3); /* select pin as output */ 778c2ecf20Sopenharmony_ci PKDATA |= PK(3); /* set pin high */ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci /* PF5: hardware reset function pin, active high */ 808c2ecf20Sopenharmony_ci PFSEL |= PF(5); /* select pin as I/O */ 818c2ecf20Sopenharmony_ci PFDIR |= PF(5); /* select pin as output */ 828c2ecf20Sopenharmony_ci PFDATA &= ~PF(5); /* set pin low */ 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci /* cs8900 hardware reset */ 858c2ecf20Sopenharmony_ci PFDATA |= PF(5); 868c2ecf20Sopenharmony_ci { int i; for (i = 0; i < 32000; ++i); } 878c2ecf20Sopenharmony_ci PFDATA &= ~PF(5); 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci /* INT1 enable (cs8900 IRQ) */ 908c2ecf20Sopenharmony_ci PDPOL &= ~PD(1); /* active high signal */ 918c2ecf20Sopenharmony_ci PDIQEG &= ~PD(1); 928c2ecf20Sopenharmony_ci PDIRQEN |= PD(1); /* IRQ enabled */ 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci#ifdef CONFIG_INIT_LCD 958c2ecf20Sopenharmony_ci /* initialize LCD controller */ 968c2ecf20Sopenharmony_ci LSSA = (long) screen_bits; 978c2ecf20Sopenharmony_ci LVPW = 0x14; 988c2ecf20Sopenharmony_ci LXMAX = 0x140; 998c2ecf20Sopenharmony_ci LYMAX = 0xef; 1008c2ecf20Sopenharmony_ci LRRA = 0; 1018c2ecf20Sopenharmony_ci LPXCD = 3; 1028c2ecf20Sopenharmony_ci LPICF = 0x08; 1038c2ecf20Sopenharmony_ci LPOLCF = 0; 1048c2ecf20Sopenharmony_ci LCKCON = 0x80; 1058c2ecf20Sopenharmony_ci PCPDEN = 0xff; 1068c2ecf20Sopenharmony_ci PCSEL = 0; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci /* Enable LCD controller */ 1098c2ecf20Sopenharmony_ci PKDIR |= 0x4; 1108c2ecf20Sopenharmony_ci PKSEL |= 0x4; 1118c2ecf20Sopenharmony_ci PKDATA &= ~0x4; 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci /* Enable CCFL backlighting circuit */ 1148c2ecf20Sopenharmony_ci PBDIR |= 0x20; 1158c2ecf20Sopenharmony_ci PBSEL |= 0x20; 1168c2ecf20Sopenharmony_ci PBDATA &= ~0x20; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci /* contrast control register */ 1198c2ecf20Sopenharmony_ci PFDIR |= 0x1; 1208c2ecf20Sopenharmony_ci PFSEL &= ~0x1; 1218c2ecf20Sopenharmony_ci PWMR = 0x037F; 1228c2ecf20Sopenharmony_ci#endif 1238c2ecf20Sopenharmony_ci} 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci/***************************************************************************/ 1268c2ecf20Sopenharmony_ci/* Init RT-Control uCdimm hardware */ 1278c2ecf20Sopenharmony_ci/***************************************************************************/ 1288c2ecf20Sopenharmony_ci#elif defined(CONFIG_UCDIMM) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_cistatic void m68vz328_reset(void) 1318c2ecf20Sopenharmony_ci{ 1328c2ecf20Sopenharmony_ci local_irq_disable(); 1338c2ecf20Sopenharmony_ci asm volatile ( 1348c2ecf20Sopenharmony_ci "moveal #0x10c00000, %a0;\n\t" 1358c2ecf20Sopenharmony_ci "moveb #0, 0xFFFFF300;\n\t" 1368c2ecf20Sopenharmony_ci "moveal 0(%a0), %sp;\n\t" 1378c2ecf20Sopenharmony_ci "moveal 4(%a0), %a0;\n\t" 1388c2ecf20Sopenharmony_ci "jmp (%a0);\n" 1398c2ecf20Sopenharmony_ci ); 1408c2ecf20Sopenharmony_ci} 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ciunsigned char *cs8900a_hwaddr; 1438c2ecf20Sopenharmony_cistatic int errno; 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci_bsc0(char *, getserialnum) 1468c2ecf20Sopenharmony_ci_bsc1(unsigned char *, gethwaddr, int, a) 1478c2ecf20Sopenharmony_ci_bsc1(char *, getbenv, char *, a) 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_cistatic void __init init_hardware(char *command, int size) 1508c2ecf20Sopenharmony_ci{ 1518c2ecf20Sopenharmony_ci char *p; 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci pr_info("uCdimm serial string [%s]\n", getserialnum()); 1548c2ecf20Sopenharmony_ci p = cs8900a_hwaddr = gethwaddr(0); 1558c2ecf20Sopenharmony_ci pr_info("uCdimm hwaddr %pM\n", p); 1568c2ecf20Sopenharmony_ci p = getbenv("APPEND"); 1578c2ecf20Sopenharmony_ci if (p) 1588c2ecf20Sopenharmony_ci strcpy(p, command); 1598c2ecf20Sopenharmony_ci else 1608c2ecf20Sopenharmony_ci command[0] = 0; 1618c2ecf20Sopenharmony_ci} 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci/***************************************************************************/ 1648c2ecf20Sopenharmony_ci#else 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cistatic void m68vz328_reset(void) 1678c2ecf20Sopenharmony_ci{ 1688c2ecf20Sopenharmony_ci} 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_cistatic void __init init_hardware(char *command, int size) 1718c2ecf20Sopenharmony_ci{ 1728c2ecf20Sopenharmony_ci} 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/***************************************************************************/ 1758c2ecf20Sopenharmony_ci#endif 1768c2ecf20Sopenharmony_ci/***************************************************************************/ 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_civoid __init config_BSP(char *command, int size) 1798c2ecf20Sopenharmony_ci{ 1808c2ecf20Sopenharmony_ci pr_info("68VZ328 DragonBallVZ support (c) 2001 Lineo, Inc.\n"); 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci init_hardware(command, size); 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ci mach_sched_init = hw_timer_init; 1858c2ecf20Sopenharmony_ci mach_hwclk = m68328_hwclk; 1868c2ecf20Sopenharmony_ci mach_reset = m68vz328_reset; 1878c2ecf20Sopenharmony_ci} 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci/***************************************************************************/ 190