1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/gumstix.c
5 * Support for the Gumstix motherboards.
7 * Original Author: Craig Hughes
8 * Created: Feb 14, 2008
9 * Copyright: Craig Hughes
11 * Implemented based on lubbock.c by Nicolas Pitre and code from Craig
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/interrupt.h>
20 #include <linux/delay.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/partitions.h>
23 #include <linux/gpio/machine.h>
24 #include <linux/gpio/property.h>
25 #include <linux/gpio.h>
26 #include <linux/err.h>
27 #include <linux/clk.h>
29 #include <asm/setup.h>
31 #include <asm/mach-types.h>
33 #include <linux/sizes.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/map.h>
37 #include <asm/mach/irq.h>
38 #include <asm/mach/flash.h>
41 #include <linux/platform_data/mmc-pxamci.h>
48 static struct resource flash_resource
= {
51 .flags
= IORESOURCE_MEM
,
54 static struct mtd_partition gumstix_partitions
[] = {
59 .mask_flags
= MTD_WRITEABLE
/* force read-only */
62 .size
= MTDPART_SIZ_FULL
,
63 .offset
= MTDPART_OFS_APPEND
67 static struct flash_platform_data gumstix_flash_data
= {
68 .map_name
= "cfi_probe",
69 .parts
= gumstix_partitions
,
70 .nr_parts
= ARRAY_SIZE(gumstix_partitions
),
74 static struct platform_device gumstix_flash_device
= {
75 .name
= "pxa2xx-flash",
78 .platform_data
= &gumstix_flash_data
,
80 .resource
= &flash_resource
,
84 static struct platform_device
*devices
[] __initdata
= {
85 &gumstix_flash_device
,
89 static struct pxamci_platform_data gumstix_mci_platform_data
= {
90 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
93 static void __init
gumstix_mmc_init(void)
95 pxa_set_mci_info(&gumstix_mci_platform_data
, NULL
);
98 static void __init
gumstix_mmc_init(void)
100 pr_debug("Gumstix mmc disabled\n");
104 #if IS_ENABLED(CONFIG_USB_PXA25X)
105 static const struct property_entry gumstix_vbus_props
[] __initconst
= {
106 PROPERTY_ENTRY_GPIO("vbus-gpios", &pxa2xx_gpiochip_node
,
107 GPIO_GUMSTIX_USB_GPIOn
, GPIO_ACTIVE_HIGH
),
108 PROPERTY_ENTRY_GPIO("pullup-gpios", &pxa2xx_gpiochip_node
,
109 GPIO_GUMSTIX_USB_GPIOx
, GPIO_ACTIVE_HIGH
),
113 static const struct platform_device_info gumstix_gpio_vbus_info __initconst
= {
115 .id
= PLATFORM_DEVID_NONE
,
116 .properties
= gumstix_vbus_props
,
119 static void __init
gumstix_udc_init(void)
121 platform_device_register_full(&gumstix_gpio_vbus_info
);
124 static void gumstix_udc_init(void)
126 pr_debug("Gumstix udc is disabled\n");
131 /* Normally, the bootloader would have enabled this 32kHz clock but many
132 ** boards still have u-boot 1.1.4 so we check if it has been turned on and
133 ** if not, we turn it on with a warning message. */
134 static void gumstix_setup_bt_clock(void)
138 if (!(readl(OSCC
) & OSCC_OOK
))
139 pr_warn("32kHz clock was not on. Bootloader may need to be updated\n");
143 writel(readl(OSCC
) | OSCC_OON
, OSCC
);
145 if (readl(OSCC
) & OSCC_OOK
)
150 pr_err("Failed to start 32kHz clock\n");
153 static void __init
gumstix_bluetooth_init(void)
157 gumstix_setup_bt_clock();
159 err
= gpio_request(GPIO_GUMSTIX_BTRESET
, "BTRST");
161 pr_err("gumstix: failed request gpio for bluetooth reset\n");
165 err
= gpio_direction_output(GPIO_GUMSTIX_BTRESET
, 1);
167 pr_err("gumstix: can't reset bluetooth\n");
170 gpio_set_value(GPIO_GUMSTIX_BTRESET
, 0);
172 gpio_set_value(GPIO_GUMSTIX_BTRESET
, 1);
175 static void gumstix_bluetooth_init(void)
177 pr_debug("Gumstix Bluetooth is disabled\n");
181 static unsigned long gumstix_pin_config
[] __initdata
= {
194 int __attribute__((weak
)) am200_init(void)
199 int __attribute__((weak
)) am300_init(void)
204 static void __init
carrier_board_init(void)
207 * put carrier/expansion board init here if
208 * they cannot be detected programatically
214 static void __init
gumstix_init(void)
216 pxa2xx_mfp_config(ARRAY_AND_SIZE(gumstix_pin_config
));
218 pxa_set_ffuart_info(NULL
);
219 pxa_set_btuart_info(NULL
);
220 pxa_set_stuart_info(NULL
);
221 pxa_set_hwuart_info(NULL
);
223 gumstix_bluetooth_init();
226 (void) platform_add_devices(devices
, ARRAY_SIZE(devices
));
227 carrier_board_init();
230 MACHINE_START(GUMSTIX
, "Gumstix")
231 .atag_offset
= 0x100, /* match u-boot bi_boot_params */
232 .map_io
= pxa25x_map_io
,
233 .nr_irqs
= PXA_NR_IRQS
,
234 .init_irq
= pxa25x_init_irq
,
235 .init_time
= pxa_timer_init
,
236 .init_machine
= gumstix_init
,
237 .restart
= pxa_restart
,