Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Hardware definitions for HP iPAQ h5xxx Handheld Computers
0004  *
0005  * Copyright 2000-2003  Hewlett-Packard Company.
0006  * Copyright 2002       Jamey Hicks <jamey.hicks@hp.com>
0007  * Copyright 2004-2005  Phil Blundell <pb@handhelds.org>
0008  * Copyright 2007-2008  Anton Vorontsov <cbouatmailru@gmail.com>
0009  *
0010  * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
0011  * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
0012  * FITNESS FOR ANY PARTICULAR PURPOSE.
0013  *
0014  * Author: Jamey Hicks.
0015  */
0016 
0017 #include <linux/kernel.h>
0018 #include <linux/init.h>
0019 #include <linux/platform_device.h>
0020 #include <linux/mtd/mtd.h>
0021 #include <linux/mtd/partitions.h>
0022 #include <linux/mtd/physmap.h>
0023 
0024 #include <asm/mach-types.h>
0025 #include <asm/mach/arch.h>
0026 #include <asm/mach/map.h>
0027 #include <asm/irq.h>
0028 
0029 #include "pxa25x.h"
0030 #include "h5000.h"
0031 #include "udc.h"
0032 #include "smemc.h"
0033 
0034 #include "generic.h"
0035 
0036 /*
0037  * Flash
0038  */
0039 
0040 static struct mtd_partition h5000_flash0_partitions[] = {
0041     {
0042         .name = "bootldr",
0043         .size = 0x00040000,
0044         .offset = 0,
0045         .mask_flags = MTD_WRITEABLE,
0046     },
0047     {
0048         .name = "root",
0049         .size = MTDPART_SIZ_FULL,
0050         .offset = MTDPART_OFS_APPEND,
0051     },
0052 };
0053 
0054 static struct mtd_partition h5000_flash1_partitions[] = {
0055     {
0056         .name = "second root",
0057         .size = SZ_16M - 0x00040000,
0058         .offset = 0,
0059     },
0060     {
0061         .name = "asset",
0062         .size = MTDPART_SIZ_FULL,
0063         .offset = MTDPART_OFS_APPEND,
0064         .mask_flags = MTD_WRITEABLE,
0065     },
0066 };
0067 
0068 static struct physmap_flash_data h5000_flash0_data = {
0069     .width = 4,
0070     .parts = h5000_flash0_partitions,
0071     .nr_parts = ARRAY_SIZE(h5000_flash0_partitions),
0072 };
0073 
0074 static struct physmap_flash_data h5000_flash1_data = {
0075     .width = 4,
0076     .parts = h5000_flash1_partitions,
0077     .nr_parts = ARRAY_SIZE(h5000_flash1_partitions),
0078 };
0079 
0080 static struct resource h5000_flash0_resources = {
0081     .start = PXA_CS0_PHYS,
0082     .end = PXA_CS0_PHYS + SZ_32M - 1,
0083     .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
0084 };
0085 
0086 static struct resource h5000_flash1_resources = {
0087     .start = PXA_CS0_PHYS + SZ_32M,
0088     .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1,
0089     .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
0090 };
0091 
0092 static struct platform_device h5000_flash[] = {
0093     {
0094         .name = "physmap-flash",
0095         .id = 0,
0096         .resource = &h5000_flash0_resources,
0097         .num_resources = 1,
0098         .dev = {
0099             .platform_data = &h5000_flash0_data,
0100         },
0101     },
0102     {
0103         .name = "physmap-flash",
0104         .id = 1,
0105         .resource = &h5000_flash1_resources,
0106         .num_resources = 1,
0107         .dev = {
0108             .platform_data = &h5000_flash1_data,
0109         },
0110     },
0111 };
0112 
0113 /*
0114  * USB Device Controller
0115  */
0116 
0117 static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = {
0118     .gpio_pullup = H5000_GPIO_USB_PULLUP,
0119 };
0120 
0121 /*
0122  * GPIO setup
0123  */
0124 
0125 static unsigned long h5000_pin_config[] __initdata = {
0126     /* Crystal and Clock Signals */
0127     GPIO12_32KHz,
0128 
0129     /* SDRAM and Static Memory I/O Signals */
0130     GPIO15_nCS_1,
0131     GPIO78_nCS_2,
0132     GPIO79_nCS_3,
0133     GPIO80_nCS_4,
0134 
0135     /* FFUART */
0136     GPIO34_FFUART_RXD,
0137     GPIO35_FFUART_CTS,
0138     GPIO36_FFUART_DCD,
0139     GPIO37_FFUART_DSR,
0140     GPIO38_FFUART_RI,
0141     GPIO39_FFUART_TXD,
0142     GPIO40_FFUART_DTR,
0143     GPIO41_FFUART_RTS,
0144 
0145     /* BTUART */
0146     GPIO42_BTUART_RXD,
0147     GPIO43_BTUART_TXD,
0148     GPIO44_BTUART_CTS,
0149     GPIO45_BTUART_RTS,
0150 
0151     /* SSP1 */
0152     GPIO23_SSP1_SCLK,
0153     GPIO25_SSP1_TXD,
0154     GPIO26_SSP1_RXD,
0155 
0156     /* I2S */
0157     GPIO28_I2S_BITCLK_OUT,
0158     GPIO29_I2S_SDATA_IN,
0159     GPIO30_I2S_SDATA_OUT,
0160     GPIO31_I2S_SYNC,
0161     GPIO32_I2S_SYSCLK,
0162 };
0163 
0164 /*
0165  * Localbus setup:
0166  * CS0: Flash;
0167  * CS1: MediaQ chip, select 16-bit bus and vlio;
0168  * CS5: SAMCOP.
0169  */
0170 
0171 static void fix_msc(void)
0172 {
0173     __raw_writel(0x129c24f2, MSC0);
0174     __raw_writel(0x7ff424fa, MSC1);
0175     __raw_writel(0x7ff47ff4, MSC2);
0176 
0177     __raw_writel(__raw_readl(MDREFR) | 0x02080000, MDREFR);
0178 }
0179 
0180 /*
0181  * Platform devices
0182  */
0183 
0184 static struct platform_device *devices[] __initdata = {
0185     &h5000_flash[0],
0186     &h5000_flash[1],
0187 };
0188 
0189 static void __init h5000_init(void)
0190 {
0191     fix_msc();
0192 
0193     pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
0194     pxa_set_ffuart_info(NULL);
0195     pxa_set_btuart_info(NULL);
0196     pxa_set_stuart_info(NULL);
0197     pxa_set_udc_info(&h5000_udc_mach_info);
0198     platform_add_devices(ARRAY_AND_SIZE(devices));
0199 }
0200 
0201 MACHINE_START(H5400, "HP iPAQ H5000")
0202     .atag_offset = 0x100,
0203     .map_io = pxa25x_map_io,
0204     .nr_irqs = PXA_NR_IRQS,
0205     .init_irq = pxa25x_init_irq,
0206     .handle_irq = pxa25x_handle_irq,
0207     .init_time  = pxa_timer_init,
0208     .init_machine = h5000_init,
0209     .restart    = pxa_restart,
0210 MACHINE_END