^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/arch/arm/mach-pxa/lubbock.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Support for the Intel DBPXA250 Development Platform.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Author: Nicolas Pitre
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Created: Jun 15, 2001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Copyright: MontaVista Software Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/clkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/gpio/gpio-reg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/syscore_ops.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/major.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/smc91x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <linux/spi/ads7846.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include <linux/spi/pxa2xx_spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <asm/memory.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <mach/hardware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include <linux/sizes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <asm/mach/flash.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include <asm/hardware/sa1111.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include "pxa25x.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #include <mach/lubbock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include "udc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include <linux/platform_data/irda-pxaficp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #include <linux/platform_data/mmc-pxamci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include <mach/smemc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static unsigned long lubbock_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) GPIO15_nCS_1, /* CS1 - Flash */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) GPIO78_nCS_2, /* CS2 - Baseboard FGPA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) GPIO79_nCS_3, /* CS3 - SMC ethernet */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) GPIO80_nCS_4, /* CS4 - SA1111 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) /* SSP data pins */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) GPIO23_SSP1_SCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) GPIO25_SSP1_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) GPIO26_SSP1_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /* AC97 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) GPIO28_AC97_BITCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) GPIO29_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) GPIO30_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) GPIO31_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* LCD - 16bpp DSTN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) GPIOxx_LCD_DSTN_16BPP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* BTUART */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) GPIO42_BTUART_RXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) GPIO43_BTUART_TXD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) GPIO44_BTUART_CTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) GPIO45_BTUART_RTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) /* PC Card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) GPIO48_nPOE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) GPIO49_nPWE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) GPIO50_nPIOR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) GPIO51_nPIOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) GPIO52_nPCE_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) GPIO53_nPCE_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) GPIO54_nPSKTSEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) GPIO55_nPREG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) GPIO56_nPWAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) GPIO57_nIOIS16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) GPIO6_MMC_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) GPIO8_MMC_CS0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* SA1111 chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) GPIO11_3_6MHz,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) /* wakeup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #define LUB_HEXLED __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) void lubbock_set_hexled(uint32_t value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) LUB_HEXLED = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static struct gpio_chip *lubbock_misc_wr_gc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) unsigned long m = mask, v = set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) lubbock_misc_wr_gc->set_multiple(lubbock_misc_wr_gc, &m, &v);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static int lubbock_udc_is_connected(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) return (LUB_MISC_RD & (1 << 9)) == 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static struct pxa2xx_udc_mach_info udc_info __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) .udc_is_connected = lubbock_udc_is_connected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) // no D+ pullup; lubbock can't connect/disconnect in software
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) /* GPIOs for SA1111 PCMCIA */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static struct gpiod_lookup_table sa1111_pcmcia_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) .dev_id = "1800",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) { "sa1111", 0, "a0vpp", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) { "sa1111", 1, "a1vpp", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) { "sa1111", 2, "a0vcc", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) { "sa1111", 3, "a1vcc", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) { "lubbock", 14, "b0vcc", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) { "lubbock", 15, "b1vcc", GPIO_ACTIVE_HIGH },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static void lubbock_init_pcmcia(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) gpiod_add_lookup_table(&sa1111_pcmcia_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /* Add an alias for the SA1111 PCMCIA clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) clk = clk_get_sys("pxa2xx-pcmcia", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) if (!IS_ERR(clk)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) clkdev_create(clk, NULL, "1800");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) clk_put(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static struct resource sa1111_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) .start = 0x10000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) .end = 0x10001fff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) .start = LUBBOCK_SA1111_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) .end = LUBBOCK_SA1111_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static struct sa1111_platform_data sa1111_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) .irq_base = LUBBOCK_SA1111_IRQ_BASE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) .disable_devs = SA1111_DEVID_SAC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static struct platform_device sa1111_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) .name = "sa1111",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .num_resources = ARRAY_SIZE(sa1111_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .resource = sa1111_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) .platform_data = &sa1111_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) /* ADS7846 is connected through SSP ... and if your board has J5 populated,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) * you can select it to replace the ucb1400 by switching the touchscreen cable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * (to J5) and poking board registers (as done below). Else it's only useful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * for the temperature sensors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) static struct pxa2xx_spi_controller pxa_ssp_master_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) .num_chipselect = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static int lubbock_ads7846_pendown_state(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) /* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static struct ads7846_platform_data ads_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .model = 7846,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .vref_delay_usecs = 100, /* internal, no cap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .get_pendown_state = lubbock_ads7846_pendown_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) // .x_plate_ohms = 500, /* GUESS! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) // .y_plate_ohms = 500, /* GUESS! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) static void ads7846_cs(u32 command)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) static const unsigned TS_nCS = 1 << 11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) lubbock_set_misc_wr(TS_nCS, (command == PXA2XX_CS_ASSERT) ? 0 : TS_nCS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) static struct pxa2xx_spi_chip ads_hw = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) .tx_threshold = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) .rx_threshold = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) .cs_control = ads7846_cs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) static struct spi_board_info spi_board_info[] __initdata = { {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) .modalias = "ads7846",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) .platform_data = &ads_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) .controller_data = &ads_hw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .irq = LUBBOCK_BB_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) .max_speed_hz = 120000 /* max sample rate at 3V */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) * 26 /* command + data + overhead */,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) .bus_num = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) .chip_select = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static struct resource smc91x_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .name = "smc91x-regs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .start = 0x0c000c00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .end = 0x0c0fffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) .start = LUBBOCK_ETH_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .end = LUBBOCK_ETH_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .name = "smc91x-attrib",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) .start = 0x0e000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) .end = 0x0e0fffff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) static struct smc91x_platdata lubbock_smc91x_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) static struct platform_device smc91x_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) .name = "smc91x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) .num_resources = ARRAY_SIZE(smc91x_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) .resource = smc91x_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) .platform_data = &lubbock_smc91x_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) static struct resource flash_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) .start = 0x00000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) .end = SZ_64M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) .start = 0x04000000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) .end = 0x04000000 + SZ_64M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) static struct mtd_partition lubbock_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) .name = "Bootloader",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) .size = 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) .offset = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) .mask_flags = MTD_WRITEABLE /* force read-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) },{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) .name = "Kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) .size = 0x00100000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) .offset = 0x00040000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) },{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) .name = "Filesystem",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) .size = MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) .offset = 0x00140000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) static struct flash_platform_data lubbock_flash_data[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) .map_name = "cfi_probe",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) .parts = lubbock_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) .nr_parts = ARRAY_SIZE(lubbock_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) }, {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) .map_name = "cfi_probe",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) .parts = NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) .nr_parts = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) static struct platform_device lubbock_flash_device[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) .name = "pxa2xx-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) .platform_data = &lubbock_flash_data[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) .resource = &flash_resources[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) .name = "pxa2xx-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) .platform_data = &lubbock_flash_data[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) .resource = &flash_resources[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) .num_resources = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static struct resource lubbock_cplds_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) .start = LUBBOCK_FPGA_PHYS + 0xc0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) .end = LUBBOCK_FPGA_PHYS + 0xe0 - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) .start = PXA_GPIO_TO_IRQ(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) .end = PXA_GPIO_TO_IRQ(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) .start = LUBBOCK_IRQ(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) .end = LUBBOCK_IRQ(6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) .flags = IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) static struct platform_device lubbock_cplds_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) .name = "pxa_cplds_irqs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) .resource = &lubbock_cplds_resources[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) .num_resources = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) static struct platform_device *devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) &sa1111_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) &smc91x_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) &lubbock_flash_device[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) &lubbock_flash_device[1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) &lubbock_cplds_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) static struct pxafb_mode_info sharp_lm8v31_mode = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .pixclock = 270000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .xres = 640,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) .yres = 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) .bpp = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) .hsync_len = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) .left_margin = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) .right_margin = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) .vsync_len = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .upper_margin = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .lower_margin = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) .cmap_greyscale = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) static struct pxafb_mach_info sharp_lm8v31 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) .modes = &sharp_lm8v31_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) .num_modes = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) .cmap_inverse = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) .cmap_static = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) LCD_AC_BIAS_FREQ(255),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) #define MMC_POLL_RATE msecs_to_jiffies(1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) static irq_handler_t mmc_detect_int;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) static void *mmc_detect_int_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) static struct timer_list mmc_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) static void lubbock_mmc_poll(struct timer_list *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) /* clear any previous irq state, then ... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) LUB_IRQ_SET_CLR &= ~(1 << 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /* poll until mmc/sd card is removed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) if (LUB_IRQ_SET_CLR & (1 << 0))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) (void) mmc_detect_int(LUBBOCK_SD_IRQ, mmc_detect_int_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) enable_irq(LUBBOCK_SD_IRQ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) static irqreturn_t lubbock_detect_int(int irq, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) /* IRQ is level triggered; disable, and poll for removal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) disable_irq(irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) return mmc_detect_int(irq, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) static int lubbock_mci_init(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) irq_handler_t detect_int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /* detect card insert/eject */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) mmc_detect_int = detect_int;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) mmc_detect_int_data = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) timer_setup(&mmc_timer, lubbock_mmc_poll, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) return request_irq(LUBBOCK_SD_IRQ, lubbock_detect_int,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 0, "lubbock-sd-detect", data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) static int lubbock_mci_get_ro(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) return (LUB_MISC_RD & (1 << 2)) != 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static void lubbock_mci_exit(struct device *dev, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) free_irq(LUBBOCK_SD_IRQ, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) del_timer_sync(&mmc_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static struct pxamci_platform_data lubbock_mci_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) .detect_delay_ms = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) .init = lubbock_mci_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) .get_ro = lubbock_mci_get_ro,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) .exit = lubbock_mci_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) if (mode & IR_SIRMODE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) lubbock_set_misc_wr(BIT(4), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) } else if (mode & IR_FIRMODE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) lubbock_set_misc_wr(BIT(4), BIT(4));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) pxa2xx_transceiver_mode(dev, mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) static struct pxaficp_platform_data lubbock_ficp_platform_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) .gpio_pwdown = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) .transceiver_cap = IR_SIRMODE | IR_FIRMODE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) .transceiver_mode = lubbock_irda_transceiver_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) static void __init lubbock_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) int flashboot = (LUB_CONF_SWITCHES & 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) lubbock_misc_wr_gc = gpio_reg_init(NULL, (void *)&LUB_MISC_WR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) -1, 16, "lubbock", 0, LUB_MISC_WR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) NULL, NULL, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) if (IS_ERR(lubbock_misc_wr_gc)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) pr_err("Lubbock: unable to register lubbock GPIOs: %ld\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) PTR_ERR(lubbock_misc_wr_gc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) lubbock_misc_wr_gc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) pxa_set_ffuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) pxa_set_btuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) pxa_set_stuart_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) lubbock_init_pcmcia();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) pxa_set_udc_info(&udc_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) pxa_set_fb_info(NULL, &sharp_lm8v31);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) pxa_set_mci_info(&lubbock_mci_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) pxa_set_ficp_info(&lubbock_ficp_platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) pxa_set_ac97_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) lubbock_flash_data[0].width = lubbock_flash_data[1].width =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) (__raw_readl(BOOT_DEF) & 1) ? 2 : 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) /* Compensate for the nROMBT switch which swaps the flash banks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) flashboot?"Flash":"ROM", flashboot);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) lubbock_flash_data[flashboot^1].name = "application-flash";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) lubbock_flash_data[flashboot].name = "boot-rom";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) (void) platform_add_devices(devices, ARRAY_SIZE(devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) static struct map_desc lubbock_io_desc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) { /* CPLD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) .virtual = LUBBOCK_FPGA_VIRT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) .pfn = __phys_to_pfn(LUBBOCK_FPGA_PHYS),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .length = 0x00100000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) .type = MT_DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) static void __init lubbock_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) pxa25x_map_io();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) PCFR |= PCFR_OPDE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) * Driver for the 8 discrete LEDs available for general use:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) * Note: bits [15-8] are used to enable/blank the 8 7 segment hex displays
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) * so be sure to not monkey with them here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) struct lubbock_led {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) struct led_classdev cdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) u8 mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) * The triggers lines up below will only be used if the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) * LED triggers are compiled in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) static const struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) const char *trigger;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) } lubbock_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) { "lubbock:D28", "default-on", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) { "lubbock:D27", "cpu0", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) { "lubbock:D26", "heartbeat" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) { "lubbock:D25", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) { "lubbock:D24", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) { "lubbock:D23", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) { "lubbock:D22", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) { "lubbock:D21", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) static void lubbock_led_set(struct led_classdev *cdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) enum led_brightness b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) struct lubbock_led *led = container_of(cdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) struct lubbock_led, cdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) u32 reg = LUB_DISC_BLNK_LED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) if (b != LED_OFF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) reg |= led->mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) reg &= ~led->mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) LUB_DISC_BLNK_LED = reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) static enum led_brightness lubbock_led_get(struct led_classdev *cdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) struct lubbock_led *led = container_of(cdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) struct lubbock_led, cdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) u32 reg = LUB_DISC_BLNK_LED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) return (reg & led->mask) ? LED_FULL : LED_OFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) static int __init lubbock_leds_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) if (!machine_is_lubbock())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) /* All ON */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) LUB_DISC_BLNK_LED |= 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) for (i = 0; i < ARRAY_SIZE(lubbock_leds); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) struct lubbock_led *led;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) led = kzalloc(sizeof(*led), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) if (!led)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) led->cdev.name = lubbock_leds[i].name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) led->cdev.brightness_set = lubbock_led_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) led->cdev.brightness_get = lubbock_led_get;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) led->cdev.default_trigger = lubbock_leds[i].trigger;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) led->mask = BIT(i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) if (led_classdev_register(NULL, &led->cdev) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) kfree(led);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) * Since we may have triggers on any subsystem, defer registration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) * until after subsystem_init.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) fs_initcall(lubbock_leds_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) /* Maintainer: MontaVista Software Inc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) .map_io = lubbock_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .nr_irqs = LUBBOCK_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) .init_irq = pxa25x_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) .handle_irq = pxa25x_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) .init_machine = lubbock_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) .restart = pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) MACHINE_END