Module Name: src Committed By: kiyohara Date: Tue Jun 21 15:23:58 UTC 2011
Modified Files: src/sys/arch/hpcarm/conf: WZERO3 files.pxa2x0 src/sys/arch/hpcarm/hpcarm: pxa2x0_hpc_machdep.c Added Files: src/sys/arch/hpcarm/conf: files.wzero3 src/sys/arch/hpcarm/hpcarm: wzero3_machdep.c Log Message: Split pxa2x0_hpc/wzero3. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/hpcarm/conf/WZERO3 cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hpcarm/conf/files.pxa2x0 cvs rdiff -u -r0 -r1.1 src/sys/arch/hpcarm/conf/files.wzero3 cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/hpcarm/hpcarm/wzero3_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/hpcarm/conf/WZERO3 diff -u src/sys/arch/hpcarm/conf/WZERO3:1.19 src/sys/arch/hpcarm/conf/WZERO3:1.20 --- src/sys/arch/hpcarm/conf/WZERO3:1.19 Sun Mar 6 17:08:25 2011 +++ src/sys/arch/hpcarm/conf/WZERO3 Tue Jun 21 15:23:57 2011 @@ -1,13 +1,14 @@ -# $NetBSD: WZERO3,v 1.19 2011/03/06 17:08:25 bouyer Exp $ +# $NetBSD: WZERO3,v 1.20 2011/06/21 15:23:57 kiyohara Exp $ # # WZERO3 -- Sharp Windows Mobile 5 based PDA # include "arch/hpcarm/conf/std.pxa2x0" +include "arch/hpcarm/conf/files.wzero3" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.19 $" +#ident "GENERIC-$Revision: 1.20 $" # estimated number of users maxusers 32 Index: src/sys/arch/hpcarm/conf/files.pxa2x0 diff -u src/sys/arch/hpcarm/conf/files.pxa2x0:1.3 src/sys/arch/hpcarm/conf/files.pxa2x0:1.4 --- src/sys/arch/hpcarm/conf/files.pxa2x0:1.3 Sun May 30 10:00:27 2010 +++ src/sys/arch/hpcarm/conf/files.pxa2x0 Tue Jun 21 15:23:57 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.pxa2x0,v 1.3 2010/05/30 10:00:27 nonaka Exp $ +# $NetBSD: files.pxa2x0,v 1.4 2011/06/21 15:23:57 kiyohara Exp $ # # PXA2x0 specific configuration info # @@ -7,40 +7,3 @@ # Include hpcarm/XScale config definitions. include "arch/arm/xscale/files.pxa2x0" - -# -# W-ZERO3 specific configuration info -# - -# Dedicated SSP unit for touch screen, keypad -device wzero3ssp -attach wzero3ssp at pxaip -file arch/hpcarm/dev/wzero3_ssp.c wzero3ssp - -# LCD frame buffer -attach lcd at pxaip with wzero3lcd -file arch/hpcarm/dev/wzero3_lcd.c wzero3lcd needs-flag - -# keyboard -device wzero3kbd: hpckbdif, sysmon_power, sysmon_taskq -attach wzero3kbd at pxaip -file arch/hpcarm/dev/wzero3_kbd.c wzero3kbd - -# keypad -device wzero3keypad: wskbddev -attach wzero3keypad at pxaip -file arch/hpcarm/dev/wzero3_keypad.c wzero3keypad - -# touchpad -device wzero3tp: wsmousedev, hpctpanel -attach wzero3tp at pxaip -file arch/hpcarm/dev/wzero3_tp.c wzero3tp - -# MMC/SD controller -attach pxamci at pxaip with wzero3mci -file arch/hpcarm/dev/wzero3_mci.c wzero3mci - -# USB power control -device wzero3usb -attach wzero3usb at pxaip -file arch/hpcarm/dev/wzero3_usb.c wzero3usb Index: src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c diff -u src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c:1.9 src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c:1.10 --- src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c:1.9 Tue Jun 14 14:33:50 2011 +++ src/sys/arch/hpcarm/hpcarm/pxa2x0_hpc_machdep.c Tue Jun 21 15:23:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pxa2x0_hpc_machdep.c,v 1.9 2011/06/14 14:33:50 kiyohara Exp $ */ +/* $NetBSD: pxa2x0_hpc_machdep.c,v 1.10 2011/06/21 15:23:57 kiyohara Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.9 2011/06/14 14:33:50 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pxa2x0_hpc_machdep.c,v 1.10 2011/06/21 15:23:57 kiyohara Exp $"); #include "opt_ddb.h" #include "opt_dram_pages.h" @@ -59,7 +59,6 @@ #include <sys/boot_flag.h> #include <sys/conf.h> /* XXX for consinit related hacks */ #include <sys/device.h> -#include <sys/termios.h> #if NKSYMS || defined(DDB) || defined(MODULAR) #include <machine/db_machdep.h> @@ -89,21 +88,11 @@ #include <machine/intr.h> #include <machine/io.h> #include <machine/platid.h> -#include <machine/platid_mask.h> #include <machine/rtc.h> #include <machine/signal.h> -#include <dev/cons.h> #include <dev/hpc/apm/apmvar.h> -#include <dev/hpc/bicons.h> - -#include "com.h" -#if (NCOM > 0) -#include "opt_com.h" -#include <dev/ic/comvar.h> -#endif /* NCOM > 0 */ -#include "lcd.h" -#include "wzero3lcd.h" +#include <dev/ic/comreg.h> #include <sys/mount.h> #include <nfs/rpcv2.h> @@ -181,12 +170,13 @@ u_int initarm(int, char **, struct bootinfo *); +/* Machine dependent initialize function */ +extern void pxa2x0_machdep_init(void); + /* Mode dependent sleep function holder */ extern void (*__sleep_func)(void *); extern void *__sleep_ctx; -extern void (*__cpu_reset)(void); - #ifdef DEBUG_BEFOREMMU static void fakecninit(void); #endif @@ -261,85 +251,8 @@ }; #undef _A #undef _S +extern const struct pmap_devmap machdep_devmap[]; -static void -ws003sh_cpu_reset(void) -{ - uint32_t rv; - - rv = pxa2x0_memctl_read(MEMCTL_MSC0); - if ((rv & 0xffff0000) == 0x7ff00000) { - pxa2x0_memctl_write(MEMCTL_MSC0, (rv & 0xffff) | 0x7ee00000); - } - - pxa2x0_gpio_set_function(89, GPIO_OUT | GPIO_SET); - for (;;) - continue; -} - -static struct pxa2x0_gpioconf ws003sh_boarddep_gpioconf[] = { - /* FFUART */ - { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ - { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ - /* SSP3 */ - { 34, GPIO_ALT_FN_3_OUT }, /* SSPSCLK3 */ - { 38, GPIO_ALT_FN_1_OUT }, /* SSPTXD3 */ - { 82, GPIO_ALT_FN_1_IN }, /* SSPRXD3 */ - - { -1 } -}; - -static struct pxa2x0_gpioconf ws007sh_boarddep_gpioconf[] = { - /* FFUART */ - { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ - { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ - /* SSP2 */ - { 19, GPIO_ALT_FN_1_OUT }, /* SSPSCLK2 */ - { 86, GPIO_ALT_FN_1_IN }, /* SSPRXD2 */ - { 87, GPIO_ALT_FN_1_OUT }, /* SSPTXD2 */ - /* SSP3 */ - { 38, GPIO_ALT_FN_1_OUT }, /* SSPTXD3 */ - { 52, GPIO_ALT_FN_2_OUT }, /* SSPSCLK3 */ - { 89, GPIO_ALT_FN_1_IN }, /* SSPRXD3 */ - - { -1 } -}; - -static struct pxa2x0_gpioconf ws011sh_boarddep_gpioconf[] = { - /* FFUART */ - { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ - { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ - /* SSP2 */ - { 19, GPIO_ALT_FN_1_OUT }, /* SSPSCLK2 */ - { 86, GPIO_ALT_FN_1_IN }, /* SSPRXD2 */ - { 87, GPIO_ALT_FN_1_OUT }, /* SSPTXD2 */ - - { -1 } -}; - -static struct pxa2x0_gpioconf *ws003sh_gpioconf[] = { - pxa27x_com_ffuart_gpioconf, - pxa27x_pxamci_gpioconf, - pxa27x_ohci_gpioconf, - ws003sh_boarddep_gpioconf, - NULL -}; - -static struct pxa2x0_gpioconf *ws007sh_gpioconf[] = { - pxa27x_com_ffuart_gpioconf, - pxa27x_pxamci_gpioconf, - pxa27x_ohci_gpioconf, - ws007sh_boarddep_gpioconf, - NULL -}; - -static struct pxa2x0_gpioconf *ws011sh_gpioconf[] = { - pxa27x_com_ffuart_gpioconf, - pxa27x_pxamci_gpioconf, - pxa27x_ohci_gpioconf, - ws011sh_boarddep_gpioconf, - NULL -}; static inline pd_entry_t * read_ttb(void) @@ -440,38 +353,16 @@ pxa2x0_clkman_bootstrap(PXA2X0_CLKMAN_VBASE); pxa2x0_gpio_bootstrap(PXA2X0_GPIO_VBASE); - if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS020SH)) { - if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH)) { - pxa2x0_gpio_config(ws003sh_gpioconf); - __cpu_reset = ws003sh_cpu_reset; - } else if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH)) { - pxa2x0_gpio_config(ws007sh_gpioconf); - } else if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH)) { - pxa2x0_gpio_config(ws011sh_gpioconf); - } - pxa2x0_clkman_config(CKEN_FFUART, 1); - pxa2x0_clkman_config(CKEN_OST, 1); - pxa2x0_clkman_config(CKEN_USBHC, 0); - pxa2x0_clkman_config(CKEN_USBDC, 0); - pxa2x0_clkman_config(CKEN_AC97, 0); - pxa2x0_clkman_config(CKEN_SSP, 0); - pxa2x0_clkman_config(CKEN_HWUART, 0); - pxa2x0_clkman_config(CKEN_STUART, 0); - pxa2x0_clkman_config(CKEN_BTUART, 0); - pxa2x0_clkman_config(CKEN_I2S, 0); - pxa2x0_clkman_config(CKEN_MMC, 0); - pxa2x0_clkman_config(CKEN_FICP, 0); - pxa2x0_clkman_config(CKEN_I2C, 0); - pxa2x0_clkman_config(CKEN_PWM1, 0); - if (!platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH)) { - pxa2x0_clkman_config(CKEN_PWM0, 0); /* WS011SH: DON'T DISABLE */ - } - } + /* + * XXX for now, overwrite bootconfig to hardcoded values in + * XXX pxa2x0_machdep_init(). + * XXX kill bootconfig and directly call uvm_physload + */ + bootconfig.dram[0].address = 0xa0000000; + bootconfig.dram[0].pages = DRAM_PAGES; + bootconfig.dramblocks = 1; + + pxa2x0_machdep_init(); #ifdef DEBUG_BEFOREMMU /* @@ -482,24 +373,6 @@ fakecninit(); #endif - /* - * XXX for now, overwrite bootconfig to hardcoded values. - * XXX kill bootconfig and directly call uvm_physload - */ - bootconfig.dram[0].address = 0xa0000000; - bootconfig.dram[0].pages = DRAM_PAGES; - bootconfig.dramblocks = 1; - - if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH)) { - bootconfig.dram[0].pages = 16384; /* 64MiB */ - } else - if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH) - || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS020SH)) { - bootconfig.dram[0].pages = 32768; /* 128MiB */ - } - kerneldatasize = (uint32_t)&end - (uint32_t)KERNEL_TEXT_BASE; symbolsize = 0; #if NKSYMS || defined(DDB) || defined(MODULAR) @@ -730,6 +603,7 @@ * so that we can continue to use console. */ pmap_devmap_bootstrap(l1pagetable, pxa2x0_devmap); + pmap_devmap_bootstrap(l1pagetable, machdep_devmap); /* * Give the XScale global cache clean code an appropriately @@ -863,60 +737,6 @@ return (kernelstack.pv_va + USPACE_SVC_STACK_TOP); } -#if (NCOM > 0) && defined(COM_PXA2X0) -#ifndef CONSPEED -#define CONSPEED 9600 -#endif -#ifndef CONMODE -#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ -#endif - -int comcnspeed = CONSPEED; -int comcnmode = CONMODE; - -#if defined(HWUARTCONSOLE) -#define CONADDR PXA2X0_HWUART_BASE -#elsif defined(BTUARTCONSOLE) -#define CONADDR PXA2X0_BTUART_BASE -#elsif defined(STUARTCONSOLE) -#define CONADDR PXA2X0_STUART_BASE -#else -#define CONADDR PXA2X0_FFUART_BASE -#endif - -bus_addr_t comcnaddr = CONADDR; -#endif /* NCOM > 0 && COM_PXA2X0 */ - -void -consinit(void) -{ - static int consinit_called = 0; - - if (consinit_called != 0) - return; - - consinit_called = 1; - if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL) { -#if (NCOM > 0) && defined(COM_PXA2X0) - comcnattach(&pxa2x0_a4x_bs_tag, comcnaddr, comcnspeed, - PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode); -#endif - } else { -#if (NLCD > 0) -#if NWZERO3LCD > 0 - if (platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS003SH) - || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS004SH) - || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS007SH) - || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS011SH) - || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS020SH)) { - extern void wzero3lcd_cnattach(void); - wzero3lcd_cnattach(); - } -#endif -#endif - } -} - #ifdef DEBUG_BEFOREMMU static void fakecninit(void) Added files: Index: src/sys/arch/hpcarm/conf/files.wzero3 diff -u /dev/null src/sys/arch/hpcarm/conf/files.wzero3:1.1 --- /dev/null Tue Jun 21 15:23:58 2011 +++ src/sys/arch/hpcarm/conf/files.wzero3 Tue Jun 21 15:23:57 2011 @@ -0,0 +1,39 @@ +# $NetBSD: files.wzero3,v 1.1 2011/06/21 15:23:57 kiyohara Exp $ +# +# WZERO3 specific configuration info +# + +file arch/hpcarm/hpcarm/wzero3_machdep.c + +# LCD frame buffer +attach lcd at pxaip with wzero3lcd +file arch/hpcarm/dev/wzero3_lcd.c wzero3lcd needs-flag + +# MMC/SD controller +attach pxamci at pxaip with wzero3mci +file arch/hpcarm/dev/wzero3_mci.c wzero3mci + +# Dedicated SSP unit for touch screen, keypad +device wzero3ssp +attach wzero3ssp at pxaip +file arch/hpcarm/dev/wzero3_ssp.c wzero3ssp + +# keyboard +device wzero3kbd: hpckbdif, sysmon_power, sysmon_taskq +attach wzero3kbd at pxaip +file arch/hpcarm/dev/wzero3_kbd.c wzero3kbd + +# keypad +device wzero3keypad: wskbddev +attach wzero3keypad at pxaip +file arch/hpcarm/dev/wzero3_keypad.c wzero3keypad + +# touchpad +device wzero3tp: wsmousedev, hpctpanel +attach wzero3tp at pxaip +file arch/hpcarm/dev/wzero3_tp.c wzero3tp + +# USB power control +device wzero3usb +attach wzero3usb at pxaip +file arch/hpcarm/dev/wzero3_usb.c wzero3usb Index: src/sys/arch/hpcarm/hpcarm/wzero3_machdep.c diff -u /dev/null src/sys/arch/hpcarm/hpcarm/wzero3_machdep.c:1.1 --- /dev/null Tue Jun 21 15:23:58 2011 +++ src/sys/arch/hpcarm/hpcarm/wzero3_machdep.c Tue Jun 21 15:23:57 2011 @@ -0,0 +1,247 @@ +/* $NetBSD: wzero3_machdep.c,v 1.1 2011/06/21 15:23:57 kiyohara Exp $ */ + +/* + * Copyright (c) 1994-1998 Mark Brinicombe. + * Copyright (c) 1994 Brini. + * All rights reserved. + * + * This code is derived from software written for Brini by Mark Brinicombe + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Brini. + * 4. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: wzero3_machdep.c,v 1.1 2011/06/21 15:23:57 kiyohara Exp $"); + +#include <sys/systm.h> +#include <sys/param.h> +#include <sys/termios.h> + +#include <uvm/uvm.h> + +#include <machine/bootconfig.h> +#include <machine/bootinfo.h> +#include <machine/platid.h> +#include <machine/platid_mask.h> + +#include <arm/xscale/pxa2x0reg.h> +#include <arm/xscale/pxa2x0var.h> +#include <arm/xscale/pxa2x0_gpio.h> + +#include "com.h" +#if (NCOM > 0) +#include "opt_com.h" +#include <dev/ic/comvar.h> +#endif /* NCOM > 0 */ +#include "lcd.h" +#include "wzero3lcd.h" + +#if (NCOM > 0) && defined(COM_PXA2X0) +#ifndef CONSPEED +#define CONSPEED 9600 +#endif +#ifndef CONMODE +#define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */ +#endif + +int comcnspeed = CONSPEED; +int comcnmode = CONMODE; + +#if defined(HWUARTCONSOLE) +#define CONADDR PXA2X0_HWUART_BASE +#elsif defined(BTUARTCONSOLE) +#define CONADDR PXA2X0_BTUART_BASE +#elsif defined(STUARTCONSOLE) +#define CONADDR PXA2X0_STUART_BASE +#else +#define CONADDR PXA2X0_FFUART_BASE +#endif + +bus_addr_t comcnaddr = CONADDR; +#endif /* NCOM > 0 && COM_PXA2X0 */ + +const struct pmap_devmap machdep_devmap[] = { { 0, 0, 0, 0, 0, } }; + +void pxa2x0_machdep_init(void); + + +static void +ws003sh_cpu_reset(void) +{ + uint32_t rv; + + rv = pxa2x0_memctl_read(MEMCTL_MSC0); + if ((rv & 0xffff0000) == 0x7ff00000) { + pxa2x0_memctl_write(MEMCTL_MSC0, (rv & 0xffff) | 0x7ee00000); + } + + pxa2x0_gpio_set_function(89, GPIO_OUT | GPIO_SET); + for (;;) + continue; +} + +static struct pxa2x0_gpioconf ws003sh_boarddep_gpioconf[] = { + /* FFUART */ + { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ + { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ + /* SSP3 */ + { 34, GPIO_ALT_FN_3_OUT }, /* SSPSCLK3 */ + { 38, GPIO_ALT_FN_1_OUT }, /* SSPTXD3 */ + { 82, GPIO_ALT_FN_1_IN }, /* SSPRXD3 */ + + { -1 } +}; + +static struct pxa2x0_gpioconf ws007sh_boarddep_gpioconf[] = { + /* FFUART */ + { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ + { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ + /* SSP2 */ + { 19, GPIO_ALT_FN_1_OUT }, /* SSPSCLK2 */ + { 86, GPIO_ALT_FN_1_IN }, /* SSPRXD2 */ + { 87, GPIO_ALT_FN_1_OUT }, /* SSPTXD2 */ + /* SSP3 */ + { 38, GPIO_ALT_FN_1_OUT }, /* SSPTXD3 */ + { 52, GPIO_ALT_FN_2_OUT }, /* SSPSCLK3 */ + { 89, GPIO_ALT_FN_1_IN }, /* SSPRXD3 */ + + { -1 } +}; + +static struct pxa2x0_gpioconf ws011sh_boarddep_gpioconf[] = { + /* FFUART */ + { 98, GPIO_ALT_FN_3_OUT }, /* FFRTS */ + { 99, GPIO_ALT_FN_3_OUT }, /* FFTXD */ + /* SSP2 */ + { 19, GPIO_ALT_FN_1_OUT }, /* SSPSCLK2 */ + { 86, GPIO_ALT_FN_1_IN }, /* SSPRXD2 */ + { 87, GPIO_ALT_FN_1_OUT }, /* SSPTXD2 */ + + { -1 } +}; + +static struct pxa2x0_gpioconf *ws003sh_gpioconf[] = { + pxa27x_com_ffuart_gpioconf, + pxa27x_pxamci_gpioconf, + pxa27x_ohci_gpioconf, + ws003sh_boarddep_gpioconf, + NULL +}; + +static struct pxa2x0_gpioconf *ws007sh_gpioconf[] = { + pxa27x_com_ffuart_gpioconf, + pxa27x_pxamci_gpioconf, + pxa27x_ohci_gpioconf, + ws007sh_boarddep_gpioconf, + NULL +}; + +static struct pxa2x0_gpioconf *ws011sh_gpioconf[] = { + pxa27x_com_ffuart_gpioconf, + pxa27x_pxamci_gpioconf, + pxa27x_ohci_gpioconf, + ws011sh_boarddep_gpioconf, + NULL +}; + +void +pxa2x0_machdep_init(void) +{ + extern void (*__cpu_reset)(void); + extern BootConfig bootconfig; /* Boot config storage */ + + if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH) + || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH)) { + pxa2x0_gpio_config(ws003sh_gpioconf); + __cpu_reset = ws003sh_cpu_reset; + } else if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH)) { + pxa2x0_gpio_config(ws007sh_gpioconf); + } else if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH)) { + pxa2x0_gpio_config(ws011sh_gpioconf); + } + pxa2x0_clkman_config(CKEN_FFUART, 1); + pxa2x0_clkman_config(CKEN_OST, 1); + pxa2x0_clkman_config(CKEN_USBHC, 0); + pxa2x0_clkman_config(CKEN_USBDC, 0); + pxa2x0_clkman_config(CKEN_AC97, 0); + pxa2x0_clkman_config(CKEN_SSP, 0); + pxa2x0_clkman_config(CKEN_HWUART, 0); + pxa2x0_clkman_config(CKEN_STUART, 0); + pxa2x0_clkman_config(CKEN_BTUART, 0); + pxa2x0_clkman_config(CKEN_I2S, 0); + pxa2x0_clkman_config(CKEN_MMC, 0); + pxa2x0_clkman_config(CKEN_FICP, 0); + pxa2x0_clkman_config(CKEN_I2C, 0); + pxa2x0_clkman_config(CKEN_PWM1, 0); + if (!platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH)) { + pxa2x0_clkman_config(CKEN_PWM0, 0); /* WS011SH: DON'T DISABLE */ + } + + if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH) + || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH) + || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH)) { + bootconfig.dram[0].pages = 16384; /* 64MiB */ + } else + if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH) + || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS020SH)) { + bootconfig.dram[0].pages = 32768; /* 128MiB */ + } +} + +void +consinit(void) +{ + static int consinit_called = 0; + + if (consinit_called != 0) + return; + + consinit_called = 1; + + if (bootinfo->bi_cnuse == BI_CNUSE_SERIAL) { +#if (NCOM > 0) && defined(COM_PXA2X0) + comcnattach(&pxa2x0_a4x_bs_tag, comcnaddr, comcnspeed, + PXA2X0_COM_FREQ, COM_TYPE_PXA2x0, comcnmode); +#endif + } else { +#if (NLCD > 0) +#if NWZERO3LCD > 0 + if (platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS003SH) + || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS004SH) + || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS007SH) + || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS011SH) + || platid_match(&platid,&platid_mask_MACH_SHARP_WZERO3_WS020SH)) { + extern void wzero3lcd_cnattach(void); + + wzero3lcd_cnattach(); + return; + } +#endif +#endif + } +}