Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (33 commits)
OMAP3: PM: Boot message is not an error, and not helpful, remove it
OMAP3: cpuidle: change the power domains modes determination logic
OMAP3: cpuidle: code rework for improved readability
OMAP3: cpuidle: re-organize the C-states data
OMAP3: clean-up mach specific cpuidle data structures
OMAP3 cpuidle: remove useless SDP specific timings
usb: otg: OMAP4430: Powerdown the internal PHY when USB is disabled
usb: otg: OMAP4430: Fixing the omap4430_phy_init function
usb: musb: am35x: fix compile error when building am35x
usb: musb: OMAP4430: Power down the PHY during board init
omap: drop board-igep0030.c
omap: igep0020: add support for IGEP3
omap: igep0020: minor refactoring
omap: igep0020: name refactoring for future merge with IGEP3
omap: Remove support for omap2evm
arm: omap2plus: GPIO cleanup
omap: musb: introduce default board config
omap: move detection of NAND CS to common-board-devices
omap: use common initialization for PMIC i2c bus
omap: consolidate touch screen initialization among different boards
...

+1109 -3383
+7 -76
arch/arm/configs/omap2plus_defconfig
··· 21 21 CONFIG_MODULE_SRCVERSION_ALL=y 22 22 # CONFIG_BLK_DEV_BSG is not set 23 23 CONFIG_ARCH_OMAP=y 24 - CONFIG_ARCH_OMAP2=y 25 - CONFIG_ARCH_OMAP3=y 26 - CONFIG_ARCH_OMAP4=y 27 24 CONFIG_OMAP_RESET_CLOCKS=y 28 25 CONFIG_OMAP_MUX_DEBUG=y 29 - CONFIG_OMAP_32K_TIMER=y 30 - CONFIG_MACH_OMAP_GENERIC=y 31 - CONFIG_ARCH_OMAP2420=y 32 - CONFIG_ARCH_OMAP2430=y 33 - CONFIG_ARCH_OMAP3430=y 34 - CONFIG_MACH_OMAP_H4=y 35 - CONFIG_MACH_OMAP_APOLLON=y 36 - CONFIG_MACH_OMAP_2430SDP=y 37 - CONFIG_MACH_OMAP3_BEAGLE=y 38 - CONFIG_MACH_DEVKIT8000=y 39 - CONFIG_MACH_OMAP_LDP=y 40 - CONFIG_MACH_OVERO=y 41 - CONFIG_MACH_OMAP3EVM=y 42 - CONFIG_MACH_OMAP3517EVM=y 43 - CONFIG_MACH_OMAP3_PANDORA=y 44 - CONFIG_MACH_OMAP3_TOUCHBOOK=y 45 - CONFIG_MACH_OMAP_3430SDP=y 46 - CONFIG_MACH_NOKIA_N8X0=y 47 - CONFIG_MACH_NOKIA_RX51=y 48 - CONFIG_MACH_OMAP_ZOOM2=y 49 - CONFIG_MACH_OMAP_ZOOM3=y 50 - CONFIG_MACH_CM_T35=y 51 - CONFIG_MACH_IGEP0020=y 52 - CONFIG_MACH_SBC3530=y 53 - CONFIG_MACH_OMAP_3630SDP=y 54 - CONFIG_MACH_OMAP_4430SDP=y 55 26 CONFIG_ARM_THUMBEE=y 56 - CONFIG_ARM_L1_CACHE_SHIFT=5 57 27 CONFIG_ARM_ERRATA_411920=y 58 28 CONFIG_NO_HZ=y 59 29 CONFIG_HIGH_RES_TIMERS=y 60 30 CONFIG_SMP=y 61 31 CONFIG_NR_CPUS=2 62 - # CONFIG_LOCAL_TIMERS is not set 63 - CONFIG_AEABI=y 64 32 CONFIG_LEDS=y 65 33 CONFIG_ZBOOT_ROM_TEXT=0x0 66 34 CONFIG_ZBOOT_ROM_BSS=0x0 67 35 CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" 68 36 CONFIG_KEXEC=y 69 37 CONFIG_FPE_NWFPE=y 70 - CONFIG_VFP=y 71 - CONFIG_NEON=y 72 38 CONFIG_BINFMT_MISC=y 73 - CONFIG_PM=y 74 39 CONFIG_PM_DEBUG=y 75 - CONFIG_PM_RUNTIME=y 76 40 CONFIG_NET=y 77 41 CONFIG_PACKET=y 78 42 CONFIG_UNIX=y ··· 53 89 # CONFIG_IPV6 is not set 54 90 CONFIG_NETFILTER=y 55 91 CONFIG_BT=m 56 - CONFIG_BT_L2CAP=m 57 - CONFIG_BT_SCO=m 58 - CONFIG_BT_RFCOMM=y 59 - CONFIG_BT_RFCOMM_TTY=y 60 - CONFIG_BT_BNEP=m 61 - CONFIG_BT_BNEP_MC_FILTER=y 62 - CONFIG_BT_BNEP_PROTO_FILTER=y 63 - CONFIG_BT_HIDP=m 64 92 CONFIG_BT_HCIUART=m 65 93 CONFIG_BT_HCIUART_H4=y 66 94 CONFIG_BT_HCIUART_BCSP=y ··· 63 107 CONFIG_MAC80211=m 64 108 CONFIG_MAC80211_RC_PID=y 65 109 CONFIG_MAC80211_RC_DEFAULT_PID=y 66 - CONFIG_MAC80211_LEDS=y 67 110 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 68 111 CONFIG_CONNECTOR=y 69 112 CONFIG_MTD=y 70 - CONFIG_MTD_CONCAT=y 71 113 CONFIG_MTD_CMDLINE_PARTS=y 72 114 CONFIG_MTD_CHAR=y 73 115 CONFIG_MTD_BLOCK=y ··· 81 127 CONFIG_BLK_DEV_LOOP=y 82 128 CONFIG_BLK_DEV_RAM=y 83 129 CONFIG_BLK_DEV_RAM_SIZE=16384 84 - CONFIG_EEPROM_LEGACY=y 85 130 CONFIG_SCSI=y 86 131 CONFIG_BLK_DEV_SD=y 87 132 CONFIG_SCSI_MULTI_LUN=y ··· 111 158 CONFIG_INPUT_MISC=y 112 159 CONFIG_INPUT_TWL4030_PWRBUTTON=y 113 160 CONFIG_VT_HW_CONSOLE_BINDING=y 114 - CONFIG_SERIAL_8250=y 115 - CONFIG_SERIAL_8250_CONSOLE=y 161 + # CONFIG_LEGACY_PTYS is not set 116 162 CONFIG_SERIAL_8250_NR_UARTS=32 117 163 CONFIG_SERIAL_8250_EXTENDED=y 118 164 CONFIG_SERIAL_8250_MANY_PORTS=y 119 165 CONFIG_SERIAL_8250_SHARE_IRQ=y 120 166 CONFIG_SERIAL_8250_DETECT_IRQ=y 121 167 CONFIG_SERIAL_8250_RSA=y 122 - # CONFIG_LEGACY_PTYS is not set 123 168 CONFIG_HW_RANDOM=y 124 - CONFIG_I2C=y 125 169 CONFIG_I2C_CHARDEV=y 126 - CONFIG_I2C_OMAP=y 127 170 CONFIG_SPI=y 128 171 CONFIG_SPI_OMAP24XX=y 129 172 CONFIG_DEBUG_GPIO=y ··· 130 181 CONFIG_WATCHDOG=y 131 182 CONFIG_OMAP_WATCHDOG=y 132 183 CONFIG_TWL4030_WATCHDOG=y 133 - CONFIG_MENELAUS=y 134 - CONFIG_TWL4030_CORE=y 135 - CONFIG_TWL4030_POWER=y 136 - CONFIG_REGULATOR=y 137 184 CONFIG_REGULATOR_TWL4030=y 138 185 CONFIG_REGULATOR_TPS65023=y 139 186 CONFIG_REGULATOR_TPS6507X=y ··· 153 208 CONFIG_LCD_CLASS_DEVICE=y 154 209 CONFIG_LCD_PLATFORM=y 155 210 CONFIG_DISPLAY_SUPPORT=y 156 - # CONFIG_VGA_CONSOLE is not set 157 211 CONFIG_FRAMEBUFFER_CONSOLE=y 158 212 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y 159 213 CONFIG_FONTS=y ··· 161 217 CONFIG_LOGO=y 162 218 CONFIG_SOUND=m 163 219 CONFIG_SND=m 164 - CONFIG_SND_MIXER_OSS=y 165 - CONFIG_SND_PCM_OSS=y 220 + CONFIG_SND_MIXER_OSS=m 221 + CONFIG_SND_PCM_OSS=m 166 222 CONFIG_SND_VERBOSE_PRINTK=y 167 223 CONFIG_SND_DEBUG=y 168 - CONFIG_SND_USB_AUDIO=y 169 - CONFIG_SND_SOC=y 170 - CONFIG_SND_OMAP_SOC=y 171 - CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=y 224 + CONFIG_SND_USB_AUDIO=m 225 + CONFIG_SND_SOC=m 226 + CONFIG_SND_OMAP_SOC=m 227 + CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m 172 228 CONFIG_USB=y 173 229 CONFIG_USB_DEBUG=y 174 230 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y 175 231 CONFIG_USB_DEVICEFS=y 176 232 CONFIG_USB_SUSPEND=y 177 - # CONFIG_USB_OTG_WHITELIST is not set 178 233 CONFIG_USB_MON=y 179 - # CONFIG_USB_MUSB_HDRC is not set 180 - # CONFIG_USB_MUSB_OTG is not set 181 - # CONFIG_USB_GADGET_MUSB_HDRC is not set 182 - CONFIG_USB_MUSB_DEBUG=y 183 234 CONFIG_USB_WDM=y 184 235 CONFIG_USB_STORAGE=y 185 236 CONFIG_USB_LIBUSUAL=y ··· 189 250 CONFIG_SDIO_UART=y 190 251 CONFIG_MMC_OMAP=y 191 252 CONFIG_MMC_OMAP_HS=y 192 - CONFIG_LEDS_CLASS=y 193 - CONFIG_LEDS_GPIO=y 194 - CONFIG_LEDS_TRIGGER_TIMER=y 195 - CONFIG_LEDS_TRIGGER_HEARTBEAT=y 196 - CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 197 253 CONFIG_RTC_CLASS=y 198 254 CONFIG_RTC_DRV_TWL92330=y 199 255 CONFIG_RTC_DRV_TWL4030=y 200 256 CONFIG_EXT2_FS=y 201 257 CONFIG_EXT3_FS=y 202 258 # CONFIG_EXT3_FS_XATTR is not set 203 - CONFIG_INOTIFY=y 204 259 CONFIG_QUOTA=y 205 260 CONFIG_QFMT_V2=y 206 261 CONFIG_MSDOS_FS=y ··· 218 285 CONFIG_NLS_ISO8859_1=y 219 286 CONFIG_PRINTK_TIME=y 220 287 CONFIG_MAGIC_SYSRQ=y 221 - CONFIG_DEBUG_FS=y 222 288 CONFIG_DEBUG_KERNEL=y 223 289 CONFIG_SCHEDSTATS=y 224 290 CONFIG_TIMER_STATS=y 225 291 CONFIG_PROVE_LOCKING=y 226 - # CONFIG_LOCK_STAT is not set 227 292 CONFIG_DEBUG_SPINLOCK_SLEEP=y 228 293 # CONFIG_DEBUG_BUGVERBOSE is not set 229 294 CONFIG_DEBUG_INFO=y
+1
arch/arm/mach-omap2/Kconfig
··· 288 288 depends on ARCH_OMAP3 289 289 default y 290 290 select OMAP_PACKAGE_CBB 291 + select MACH_IGEP0020 291 292 292 293 config MACH_SBC3530 293 294 bool "OMAP3 SBC STALKER board"
+2 -2
arch/arm/mach-omap2/Makefile
··· 229 229 obj-$(CONFIG_MACH_CM_T3517) += board-cm-t3517.o 230 230 obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ 231 231 hsmmc.o 232 - obj-$(CONFIG_MACH_IGEP0030) += board-igep0030.o \ 233 - hsmmc.o 234 232 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ 235 233 hsmmc.o 236 234 obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ ··· 268 270 269 271 disp-$(CONFIG_OMAP2_DSS) := display.o 270 272 obj-y += $(disp-m) $(disp-y) 273 + 274 + obj-y += common-board-devices.o
+5 -22
arch/arm/mach-omap2/board-2430sdp.c
··· 41 41 42 42 #include "mux.h" 43 43 #include "hsmmc.h" 44 + #include "common-board-devices.h" 44 45 45 46 #define SDP2430_CS0_BASE 0x04000000 46 47 #define SECONDARY_LCD_GPIO 147 ··· 181 180 .vmmc1 = &sdp2430_vmmc1, 182 181 }; 183 182 184 - static struct i2c_board_info __initdata sdp2430_i2c_boardinfo[] = { 185 - { 186 - I2C_BOARD_INFO("twl4030", 0x48), 187 - .flags = I2C_CLIENT_WAKE, 188 - .irq = INT_24XX_SYS_NIRQ, 189 - .platform_data = &sdp2430_twldata, 190 - }, 191 - }; 192 - 193 183 static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = { 194 184 { 195 185 I2C_BOARD_INFO("isp1301_omap", 0x2D), ··· 193 201 { 194 202 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 195 203 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 196 - omap_register_i2c_bus(2, 2600, sdp2430_i2c_boardinfo, 197 - ARRAY_SIZE(sdp2430_i2c_boardinfo)); 204 + omap2_pmic_init("twl4030", &sdp2430_twldata); 198 205 return 0; 199 206 } 200 207 ··· 208 217 {} /* Terminator */ 209 218 }; 210 219 211 - static struct omap_musb_board_data musb_board_data = { 212 - .interface_type = MUSB_INTERFACE_ULPI, 213 - .mode = MUSB_OTG, 214 - .power = 100, 215 - }; 216 220 static struct omap_usb_config sdp2430_usb_config __initdata = { 217 221 .otg = 1, 218 222 #ifdef CONFIG_USB_GADGET_OMAP ··· 226 240 227 241 static void __init omap_2430sdp_init(void) 228 242 { 229 - int ret; 230 - 231 243 omap2430_mux_init(board_mux, OMAP_PACKAGE_ZAC); 232 244 233 245 omap_board_config = sdp2430_config; ··· 239 255 omap2_usbfs_init(&sdp2430_usb_config); 240 256 241 257 omap_mux_init_signal("usb0hs_stp", OMAP_PULL_ENA | OMAP_PULL_UP); 242 - usb_musb_init(&musb_board_data); 258 + usb_musb_init(NULL); 243 259 244 260 board_smc91x_init(); 245 261 246 262 /* Turn off secondary LCD backlight */ 247 - ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight"); 248 - if (ret == 0) 249 - gpio_direction_output(SECONDARY_LCD_GPIO, 0); 263 + gpio_request_one(SECONDARY_LCD_GPIO, GPIOF_OUT_INIT_LOW, 264 + "Secondary LCD backlight"); 250 265 } 251 266 252 267 static void __init omap_2430sdp_map_io(void)
+23 -128
arch/arm/mach-omap2/board-3430sdp.c
··· 19 19 #include <linux/input.h> 20 20 #include <linux/input/matrix_keypad.h> 21 21 #include <linux/spi/spi.h> 22 - #include <linux/spi/ads7846.h> 23 22 #include <linux/i2c/twl.h> 24 23 #include <linux/regulator/machine.h> 25 24 #include <linux/io.h> ··· 47 48 #include "hsmmc.h" 48 49 #include "pm.h" 49 50 #include "control.h" 51 + #include "common-board-devices.h" 50 52 51 53 #define CONFIG_DISABLE_HFCLK 1 52 54 ··· 58 58 #define ENABLE_VAUX3_DEV_GRP 0x20 59 59 60 60 #define TWL4030_MSECURE_GPIO 22 61 - 62 - /* FIXME: These values need to be updated based on more profiling on 3430sdp*/ 63 - static struct cpuidle_params omap3_cpuidle_params_table[] = { 64 - /* C1 */ 65 - {1, 2, 2, 5}, 66 - /* C2 */ 67 - {1, 10, 10, 30}, 68 - /* C3 */ 69 - {1, 50, 50, 300}, 70 - /* C4 */ 71 - {1, 1500, 1800, 4000}, 72 - /* C5 */ 73 - {1, 2500, 7500, 12000}, 74 - /* C6 */ 75 - {1, 3000, 8500, 15000}, 76 - /* C7 */ 77 - {1, 10000, 30000, 300000}, 78 - }; 79 61 80 62 static uint32_t board_keymap[] = { 81 63 KEY(0, 0, KEY_LEFT), ··· 105 123 .rep = 1, 106 124 }; 107 125 108 - static int ts_gpio; /* Needed for ads7846_get_pendown_state */ 109 - 110 - /** 111 - * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq 112 - * 113 - * @return - void. If request gpio fails then Flag KERN_ERR. 114 - */ 115 - static void ads7846_dev_init(void) 116 - { 117 - if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) { 118 - printk(KERN_ERR "can't get ads746 pen down GPIO\n"); 119 - return; 120 - } 121 - 122 - gpio_direction_input(ts_gpio); 123 - gpio_set_debounce(ts_gpio, 310); 124 - } 125 - 126 - static int ads7846_get_pendown_state(void) 127 - { 128 - return !gpio_get_value(ts_gpio); 129 - } 130 - 131 - static struct ads7846_platform_data tsc2046_config __initdata = { 132 - .get_pendown_state = ads7846_get_pendown_state, 133 - .keep_vref_on = 1, 134 - .wakeup = true, 135 - }; 136 - 137 - 138 - static struct omap2_mcspi_device_config tsc2046_mcspi_config = { 139 - .turbo_mode = 0, 140 - .single_channel = 1, /* 0: slave, 1: master */ 141 - }; 142 - 143 - static struct spi_board_info sdp3430_spi_board_info[] __initdata = { 144 - [0] = { 145 - /* 146 - * TSC2046 operates at a max freqency of 2MHz, so 147 - * operate slightly below at 1.5MHz 148 - */ 149 - .modalias = "ads7846", 150 - .bus_num = 1, 151 - .chip_select = 0, 152 - .max_speed_hz = 1500000, 153 - .controller_data = &tsc2046_mcspi_config, 154 - .irq = 0, 155 - .platform_data = &tsc2046_config, 156 - }, 157 - }; 158 - 159 - 160 126 #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 161 127 #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 162 128 163 - static unsigned backlight_gpio; 164 - static unsigned enable_gpio; 129 + static struct gpio sdp3430_dss_gpios[] __initdata = { 130 + {SDP3430_LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "LCD reset" }, 131 + {SDP3430_LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "LCD Backlight"}, 132 + }; 133 + 165 134 static int lcd_enabled; 166 135 static int dvi_enabled; 167 136 ··· 120 187 { 121 188 int r; 122 189 123 - enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; 124 - backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; 190 + r = gpio_request_array(sdp3430_dss_gpios, 191 + ARRAY_SIZE(sdp3430_dss_gpios)); 192 + if (r) 193 + printk(KERN_ERR "failed to get LCD control GPIOs\n"); 125 194 126 - r = gpio_request(enable_gpio, "LCD reset"); 127 - if (r) { 128 - printk(KERN_ERR "failed to get LCD reset GPIO\n"); 129 - goto err0; 130 - } 131 - 132 - r = gpio_request(backlight_gpio, "LCD Backlight"); 133 - if (r) { 134 - printk(KERN_ERR "failed to get LCD backlight GPIO\n"); 135 - goto err1; 136 - } 137 - 138 - gpio_direction_output(enable_gpio, 0); 139 - gpio_direction_output(backlight_gpio, 0); 140 - 141 - return; 142 - err1: 143 - gpio_free(enable_gpio); 144 - err0: 145 - return; 146 195 } 147 196 148 197 static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) ··· 134 219 return -EINVAL; 135 220 } 136 221 137 - gpio_direction_output(enable_gpio, 1); 138 - gpio_direction_output(backlight_gpio, 1); 222 + gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 1); 223 + gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 1); 139 224 140 225 lcd_enabled = 1; 141 226 ··· 146 231 { 147 232 lcd_enabled = 0; 148 233 149 - gpio_direction_output(enable_gpio, 0); 150 - gpio_direction_output(backlight_gpio, 0); 234 + gpio_direction_output(SDP3430_LCD_PANEL_ENABLE_GPIO, 0); 235 + gpio_direction_output(SDP3430_LCD_PANEL_BACKLIGHT_GPIO, 0); 151 236 } 152 237 153 238 static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) ··· 275 360 omap2_hsmmc_init(mmc); 276 361 277 362 /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ 278 - gpio_request(gpio + 7, "sub_lcd_en_bkl"); 279 - gpio_direction_output(gpio + 7, 0); 363 + gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl"); 280 364 281 365 /* gpio + 15 is "sub_lcd_nRST" (output) */ 282 - gpio_request(gpio + 15, "sub_lcd_nRST"); 283 - gpio_direction_output(gpio + 15, 0); 366 + gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST"); 284 367 285 368 return 0; 286 369 } ··· 493 580 .vpll2 = &sdp3430_vpll2, 494 581 }; 495 582 496 - static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { 497 - { 498 - I2C_BOARD_INFO("twl4030", 0x48), 499 - .flags = I2C_CLIENT_WAKE, 500 - .irq = INT_34XX_SYS_NIRQ, 501 - .platform_data = &sdp3430_twldata, 502 - }, 503 - }; 504 - 505 583 static int __init omap3430_i2c_init(void) 506 584 { 507 585 /* i2c1 for PMIC only */ 508 - omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, 509 - ARRAY_SIZE(sdp3430_i2c_boardinfo)); 586 + omap3_pmic_init("twl4030", &sdp3430_twldata); 510 587 /* i2c2 on camera connector (for sensor control) and optional isp1301 */ 511 588 omap_register_i2c_bus(2, 400, NULL, 0); 512 589 /* i2c3 on display connector (for DVI, tfp410) */ ··· 775 872 }, 776 873 }; 777 874 778 - static struct omap_musb_board_data musb_board_data = { 779 - .interface_type = MUSB_INTERFACE_ULPI, 780 - .mode = MUSB_OTG, 781 - .power = 100, 782 - }; 783 - 784 875 static void __init omap_3430sdp_init(void) 785 876 { 877 + int gpio_pendown; 878 + 786 879 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 787 880 omap_board_config = sdp3430_config; 788 881 omap_board_config_size = ARRAY_SIZE(sdp3430_config); 789 - omap3_pm_init_cpuidle(omap3_cpuidle_params_table); 790 882 omap3430_i2c_init(); 791 883 omap_display_init(&sdp3430_dss_data); 792 884 if (omap_rev() > OMAP3430_REV_ES1_0) 793 - ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2; 885 + gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV2; 794 886 else 795 - ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1; 796 - sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio); 797 - spi_register_board_info(sdp3430_spi_board_info, 798 - ARRAY_SIZE(sdp3430_spi_board_info)); 799 - ads7846_dev_init(); 887 + gpio_pendown = SDP3430_TS_GPIO_IRQ_SDPV1; 888 + omap_ads7846_init(1, gpio_pendown, 310, NULL); 800 889 board_serial_init(); 801 - usb_musb_init(&musb_board_data); 890 + usb_musb_init(NULL); 802 891 board_smc91x_init(); 803 892 board_flash_init(sdp_flash_partitions, chip_sel_3430, 0); 804 893 sdp3430_display_init();
+25 -89
arch/arm/mach-omap2/board-4430sdp.c
··· 42 42 #include "hsmmc.h" 43 43 #include "timer-gp.h" 44 44 #include "control.h" 45 + #include "common-board-devices.h" 45 46 46 47 #define ETH_KS8851_IRQ 34 47 48 #define ETH_KS8851_POWER_ON 48 ··· 252 251 }, 253 252 }; 254 253 254 + static struct gpio sdp4430_eth_gpios[] __initdata = { 255 + { ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH, "eth_power" }, 256 + { ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH, "quart" }, 257 + { ETH_KS8851_IRQ, GPIOF_IN, "eth_irq" }, 258 + }; 259 + 255 260 static int omap_ethernet_init(void) 256 261 { 257 262 int status; 258 263 259 264 /* Request of GPIO lines */ 265 + status = gpio_request_array(sdp4430_eth_gpios, 266 + ARRAY_SIZE(sdp4430_eth_gpios)); 267 + if (status) 268 + pr_err("Cannot request ETH GPIOs\n"); 260 269 261 - status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); 262 - if (status) { 263 - pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); 264 - return status; 265 - } 266 - 267 - status = gpio_request(ETH_KS8851_QUART, "quart"); 268 - if (status) { 269 - pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); 270 - goto error1; 271 - } 272 - 273 - status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); 274 - if (status) { 275 - pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); 276 - goto error2; 277 - } 278 - 279 - /* Configuration of requested GPIO lines */ 280 - 281 - status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); 282 - if (status) { 283 - pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); 284 - goto error3; 285 - } 286 - 287 - status = gpio_direction_output(ETH_KS8851_QUART, 1); 288 - if (status) { 289 - pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); 290 - goto error3; 291 - } 292 - 293 - status = gpio_direction_input(ETH_KS8851_IRQ); 294 - if (status) { 295 - pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); 296 - goto error3; 297 - } 298 - 299 - return 0; 300 - 301 - error3: 302 - gpio_free(ETH_KS8851_IRQ); 303 - error2: 304 - gpio_free(ETH_KS8851_QUART); 305 - error1: 306 - gpio_free(ETH_KS8851_POWER_ON); 307 270 return status; 308 271 } 309 272 ··· 540 575 .usb = &omap4_usbphy_data 541 576 }; 542 577 543 - static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { 544 - { 545 - I2C_BOARD_INFO("twl6030", 0x48), 546 - .flags = I2C_CLIENT_WAKE, 547 - .irq = OMAP44XX_IRQ_SYS_1N, 548 - .platform_data = &sdp4430_twldata, 549 - }, 550 - }; 551 578 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { 552 579 { 553 580 I2C_BOARD_INFO("tmp105", 0x48), ··· 555 598 }; 556 599 static int __init omap4_i2c_init(void) 557 600 { 558 - /* 559 - * Phoenix Audio IC needs I2C1 to 560 - * start with 400 KHz or less 561 - */ 562 - omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo, 563 - ARRAY_SIZE(sdp4430_i2c_boardinfo)); 601 + omap4_pmic_init("twl6030", &sdp4430_twldata); 564 602 omap_register_i2c_bus(2, 400, NULL, 0); 565 603 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 566 604 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); ··· 566 614 567 615 static void __init omap_sfh7741prox_init(void) 568 616 { 569 - int error; 617 + int error; 570 618 571 - error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); 572 - if (error < 0) { 619 + error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO, 620 + GPIOF_OUT_INIT_LOW, "sfh7741"); 621 + if (error < 0) 573 622 pr_err("%s:failed to request GPIO %d, error %d\n", 574 623 __func__, OMAP4_SFH7741_ENABLE_GPIO, error); 575 - return; 576 - } 577 - 578 - error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); 579 - if (error < 0) { 580 - pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n", 581 - __func__, OMAP4_SFH7741_ENABLE_GPIO, error); 582 - gpio_free(OMAP4_SFH7741_ENABLE_GPIO); 583 - } 584 624 } 585 625 586 626 static void sdp4430_hdmi_mux_init(void) ··· 589 645 OMAP_PIN_INPUT_PULLUP); 590 646 } 591 647 648 + static struct gpio sdp4430_hdmi_gpios[] = { 649 + { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, 650 + { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, 651 + }; 652 + 592 653 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev) 593 654 { 594 655 int status; 595 656 596 - status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, 597 - "hdmi_gpio_hpd"); 598 - if (status) { 599 - pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); 600 - return status; 601 - } 602 - status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, 603 - "hdmi_gpio_ls_oe"); 604 - if (status) { 605 - pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); 606 - goto error1; 607 - } 608 - 609 - return 0; 610 - 611 - error1: 612 - gpio_free(HDMI_GPIO_HPD); 657 + status = gpio_request_array(sdp4430_hdmi_gpios, 658 + ARRAY_SIZE(sdp4430_hdmi_gpios)); 659 + if (status) 660 + pr_err("%s: Cannot request HDMI GPIOs\n", __func__); 613 661 614 662 return status; 615 663 }
+2 -8
arch/arm/mach-omap2/board-am3517crane.c
··· 89 89 return; 90 90 } 91 91 92 - ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable"); 92 + ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH, 93 + "usb_ehci_enable"); 93 94 if (ret < 0) { 94 95 pr_err("Can not request GPIO %d\n", GPIO_USB_POWER); 95 - return; 96 - } 97 - 98 - ret = gpio_direction_output(GPIO_USB_POWER, 1); 99 - if (ret < 0) { 100 - gpio_free(GPIO_USB_POWER); 101 - pr_err("Unable to initialize EHCI power\n"); 102 96 return; 103 97 } 104 98
+17 -39
arch/arm/mach-omap2/board-am3517evm.c
··· 174 174 int r; 175 175 176 176 omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP); 177 - r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq"); 177 + 178 + r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq"); 178 179 if (r < 0) { 179 180 printk(KERN_WARNING "failed to request GPIO#%d\n", 180 181 GPIO_RTCS35390A_IRQ); 181 182 return; 182 183 } 183 - r = gpio_direction_input(GPIO_RTCS35390A_IRQ); 184 - if (r < 0) { 185 - printk(KERN_WARNING "GPIO#%d cannot be configured as input\n", 186 - GPIO_RTCS35390A_IRQ); 187 - gpio_free(GPIO_RTCS35390A_IRQ); 188 - return; 189 - } 184 + 190 185 am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ); 191 186 } 192 187 ··· 237 242 238 243 #if defined(CONFIG_PANEL_SHARP_LQ043T1DG01) || \ 239 244 defined(CONFIG_PANEL_SHARP_LQ043T1DG01_MODULE) 245 + static struct gpio am3517_evm_dss_gpios[] __initdata = { 246 + /* GPIO 182 = LCD Backlight Power */ 247 + { LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH, "lcd_backlight_pwr" }, 248 + /* GPIO 181 = LCD Panel PWM */ 249 + { LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, 250 + /* GPIO 176 = LCD Panel Power enable pin */ 251 + { LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH, "dvi enable" }, 252 + }; 253 + 240 254 static void __init am3517_evm_display_init(void) 241 255 { 242 256 int r; ··· 253 249 omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP); 254 250 omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN); 255 251 omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN); 256 - /* 257 - * Enable GPIO 182 = LCD Backlight Power 258 - */ 259 - r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr"); 252 + 253 + r = gpio_request_array(am3517_evm_dss_gpios, 254 + ARRAY_SIZE(am3517_evm_dss_gpios)); 260 255 if (r) { 261 - printk(KERN_ERR "failed to get lcd_backlight_pwr\n"); 256 + printk(KERN_ERR "failed to get DSS panel control GPIOs\n"); 262 257 return; 263 258 } 264 - gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1); 265 - /* 266 - * Enable GPIO 181 = LCD Panel PWM 267 - */ 268 - r = gpio_request(LCD_PANEL_PWM, "lcd_pwm"); 269 - if (r) { 270 - printk(KERN_ERR "failed to get lcd_pwm\n"); 271 - goto err_1; 272 - } 273 - gpio_direction_output(LCD_PANEL_PWM, 1); 274 - /* 275 - * Enable GPIO 176 = LCD Panel Power enable pin 276 - */ 277 - r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr"); 278 - if (r) { 279 - printk(KERN_ERR "failed to get lcd_panel_pwr\n"); 280 - goto err_2; 281 - } 282 - gpio_direction_output(LCD_PANEL_PWR, 1); 283 259 284 260 printk(KERN_INFO "Display initialized successfully\n"); 285 - return; 286 - 287 - err_2: 288 - gpio_free(LCD_PANEL_PWM); 289 - err_1: 290 - gpio_free(LCD_PANEL_BKLIGHT_PWR); 291 261 } 292 262 #else 293 263 static void __init am3517_evm_display_init(void) {} ··· 374 396 .power = 500, 375 397 .set_phy_power = am35x_musb_phy_power, 376 398 .clear_irq = am35x_musb_clear_irq, 377 - .set_mode = am35x_musb_set_mode, 399 + .set_mode = am35x_set_mode, 378 400 .reset = am35x_musb_reset, 379 401 }; 380 402
+13 -16
arch/arm/mach-omap2/board-apollon.c
··· 202 202 unsigned int rate; 203 203 struct clk *gpmc_fck; 204 204 int eth_cs; 205 + int err; 205 206 206 207 gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ 207 208 if (IS_ERR(gpmc_fck)) { ··· 246 245 apollon_smc91x_resources[0].end = base + 0x30f; 247 246 udelay(100); 248 247 249 - omap_mux_init_gpio(74, 0); 250 - if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) { 248 + omap_mux_init_gpio(APOLLON_ETHR_GPIO_IRQ, 0); 249 + err = gpio_request_one(APOLLON_ETHR_GPIO_IRQ, GPIOF_IN, "SMC91x irq"); 250 + if (err) { 251 251 printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", 252 252 APOLLON_ETHR_GPIO_IRQ); 253 253 gpmc_cs_free(APOLLON_ETH_CS); 254 - goto out; 255 254 } 256 - gpio_direction_input(APOLLON_ETHR_GPIO_IRQ); 257 - 258 255 out: 259 256 clk_disable(gpmc_fck); 260 257 clk_put(gpmc_fck); ··· 279 280 omap2_init_common_devices(NULL, NULL); 280 281 } 281 282 283 + static struct gpio apollon_gpio_leds[] __initdata = { 284 + { LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0" }, /* LED0 - AA10 */ 285 + { LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1" }, /* LED1 - AA6 */ 286 + { LED2_GPIO15, GPIOF_OUT_INIT_LOW, "LED2" }, /* LED2 - AA4 */ 287 + }; 288 + 282 289 static void __init apollon_led_init(void) 283 290 { 284 - /* LED0 - AA10 */ 285 291 omap_mux_init_signal("vlynq_clk.gpio_13", 0); 286 - gpio_request(LED0_GPIO13, "LED0"); 287 - gpio_direction_output(LED0_GPIO13, 0); 288 - /* LED1 - AA6 */ 289 292 omap_mux_init_signal("vlynq_rx1.gpio_14", 0); 290 - gpio_request(LED1_GPIO14, "LED1"); 291 - gpio_direction_output(LED1_GPIO14, 0); 292 - /* LED2 - AA4 */ 293 293 omap_mux_init_signal("vlynq_rx0.gpio_15", 0); 294 - gpio_request(LED2_GPIO15, "LED2"); 295 - gpio_direction_output(LED2_GPIO15, 0); 294 + 295 + gpio_request_array(apollon_gpio_leds, ARRAY_SIZE(apollon_gpio_leds)); 296 296 } 297 297 298 298 static void __init apollon_usb_init(void) ··· 299 301 /* USB device */ 300 302 /* DEVICE_SUSPEND */ 301 303 omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0); 302 - gpio_request(12, "USB suspend"); 303 - gpio_direction_output(12, 0); 304 + gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend"); 304 305 omap2_usbfs_init(&apollon_usb_config); 305 306 } 306 307
+39 -197
arch/arm/mach-omap2/board-cm-t35.c
··· 54 54 #include "mux.h" 55 55 #include "sdram-micron-mt46h32m32lf-6.h" 56 56 #include "hsmmc.h" 57 + #include "common-board-devices.h" 57 58 58 59 #define CM_T35_GPIO_PENDOWN 57 59 60 ··· 67 66 68 67 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 69 68 #include <linux/smsc911x.h> 69 + #include <plat/gpmc-smsc911x.h> 70 70 71 - static struct smsc911x_platform_config cm_t35_smsc911x_config = { 72 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 73 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 74 - .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 75 - .phy_interface = PHY_INTERFACE_MODE_MII, 76 - }; 77 - 78 - static struct resource cm_t35_smsc911x_resources[] = { 79 - { 80 - .flags = IORESOURCE_MEM, 81 - }, 82 - { 83 - .start = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO), 84 - .end = OMAP_GPIO_IRQ(CM_T35_SMSC911X_GPIO), 85 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 86 - }, 87 - }; 88 - 89 - static struct platform_device cm_t35_smsc911x_device = { 90 - .name = "smsc911x", 71 + static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = { 91 72 .id = 0, 92 - .num_resources = ARRAY_SIZE(cm_t35_smsc911x_resources), 93 - .resource = cm_t35_smsc911x_resources, 94 - .dev = { 95 - .platform_data = &cm_t35_smsc911x_config, 96 - }, 73 + .cs = CM_T35_SMSC911X_CS, 74 + .gpio_irq = CM_T35_SMSC911X_GPIO, 75 + .gpio_reset = -EINVAL, 76 + .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 97 77 }; 98 78 99 - static struct resource sb_t35_smsc911x_resources[] = { 100 - { 101 - .flags = IORESOURCE_MEM, 102 - }, 103 - { 104 - .start = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO), 105 - .end = OMAP_GPIO_IRQ(SB_T35_SMSC911X_GPIO), 106 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 107 - }, 108 - }; 109 - 110 - static struct platform_device sb_t35_smsc911x_device = { 111 - .name = "smsc911x", 79 + static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = { 112 80 .id = 1, 113 - .num_resources = ARRAY_SIZE(sb_t35_smsc911x_resources), 114 - .resource = sb_t35_smsc911x_resources, 115 - .dev = { 116 - .platform_data = &cm_t35_smsc911x_config, 117 - }, 81 + .cs = SB_T35_SMSC911X_CS, 82 + .gpio_irq = SB_T35_SMSC911X_GPIO, 83 + .gpio_reset = -EINVAL, 84 + .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 118 85 }; 119 - 120 - static void __init cm_t35_init_smsc911x(struct platform_device *dev, 121 - int cs, int irq_gpio) 122 - { 123 - unsigned long cs_mem_base; 124 - 125 - if (gpmc_cs_request(cs, SZ_16M, &cs_mem_base) < 0) { 126 - pr_err("CM-T35: Failed request for GPMC mem for smsc911x\n"); 127 - return; 128 - } 129 - 130 - dev->resource[0].start = cs_mem_base + 0x0; 131 - dev->resource[0].end = cs_mem_base + 0xff; 132 - 133 - if ((gpio_request(irq_gpio, "ETH IRQ") == 0) && 134 - (gpio_direction_input(irq_gpio) == 0)) { 135 - gpio_export(irq_gpio, 0); 136 - } else { 137 - pr_err("CM-T35: could not obtain gpio for SMSC911X IRQ\n"); 138 - return; 139 - } 140 - 141 - platform_device_register(dev); 142 - } 143 86 144 87 static void __init cm_t35_init_ethernet(void) 145 88 { 146 - cm_t35_init_smsc911x(&cm_t35_smsc911x_device, 147 - CM_T35_SMSC911X_CS, CM_T35_SMSC911X_GPIO); 148 - cm_t35_init_smsc911x(&sb_t35_smsc911x_device, 149 - SB_T35_SMSC911X_CS, SB_T35_SMSC911X_GPIO); 89 + gpmc_smsc911x_init(&cm_t35_smsc911x_cfg); 90 + gpmc_smsc911x_init(&sb_t35_smsc911x_cfg); 150 91 } 151 92 #else 152 93 static inline void __init cm_t35_init_ethernet(void) { return; } ··· 178 235 static inline void cm_t35_init_nand(void) {} 179 236 #endif 180 237 181 - #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 182 - defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 183 - #include <linux/spi/ads7846.h> 184 - 185 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 186 - .turbo_mode = 0, 187 - .single_channel = 1, /* 0: slave, 1: master */ 188 - }; 189 - 190 - static int ads7846_get_pendown_state(void) 191 - { 192 - return !gpio_get_value(CM_T35_GPIO_PENDOWN); 193 - } 194 - 195 - static struct ads7846_platform_data ads7846_config = { 196 - .x_max = 0x0fff, 197 - .y_max = 0x0fff, 198 - .x_plate_ohms = 180, 199 - .pressure_max = 255, 200 - .debounce_max = 10, 201 - .debounce_tol = 3, 202 - .debounce_rep = 1, 203 - .get_pendown_state = ads7846_get_pendown_state, 204 - .keep_vref_on = 1, 205 - }; 206 - 207 - static struct spi_board_info cm_t35_spi_board_info[] __initdata = { 208 - { 209 - .modalias = "ads7846", 210 - .bus_num = 1, 211 - .chip_select = 0, 212 - .max_speed_hz = 1500000, 213 - .controller_data = &ads7846_mcspi_config, 214 - .irq = OMAP_GPIO_IRQ(CM_T35_GPIO_PENDOWN), 215 - .platform_data = &ads7846_config, 216 - }, 217 - }; 218 - 219 - static void __init cm_t35_init_ads7846(void) 220 - { 221 - if ((gpio_request(CM_T35_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && 222 - (gpio_direction_input(CM_T35_GPIO_PENDOWN) == 0)) { 223 - gpio_export(CM_T35_GPIO_PENDOWN, 0); 224 - } else { 225 - pr_err("CM-T35: could not obtain gpio for ADS7846_PENDOWN\n"); 226 - return; 227 - } 228 - 229 - spi_register_board_info(cm_t35_spi_board_info, 230 - ARRAY_SIZE(cm_t35_spi_board_info)); 231 - } 232 - #else 233 - static inline void cm_t35_init_ads7846(void) {} 234 - #endif 235 - 236 238 #define CM_T35_LCD_EN_GPIO 157 237 239 #define CM_T35_LCD_BL_GPIO 58 238 240 #define CM_T35_DVI_EN_GPIO 54 239 - 240 - static int lcd_bl_gpio; 241 - static int lcd_en_gpio; 242 - static int dvi_en_gpio; 243 241 244 242 static int lcd_enabled; 245 243 static int dvi_enabled; ··· 192 308 return -EINVAL; 193 309 } 194 310 195 - gpio_set_value(lcd_en_gpio, 1); 196 - gpio_set_value(lcd_bl_gpio, 1); 311 + gpio_set_value(CM_T35_LCD_EN_GPIO, 1); 312 + gpio_set_value(CM_T35_LCD_BL_GPIO, 1); 197 313 198 314 lcd_enabled = 1; 199 315 ··· 204 320 { 205 321 lcd_enabled = 0; 206 322 207 - gpio_set_value(lcd_bl_gpio, 0); 208 - gpio_set_value(lcd_en_gpio, 0); 323 + gpio_set_value(CM_T35_LCD_BL_GPIO, 0); 324 + gpio_set_value(CM_T35_LCD_EN_GPIO, 0); 209 325 } 210 326 211 327 static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) ··· 215 331 return -EINVAL; 216 332 } 217 333 218 - gpio_set_value(dvi_en_gpio, 0); 334 + gpio_set_value(CM_T35_DVI_EN_GPIO, 0); 219 335 dvi_enabled = 1; 220 336 221 337 return 0; ··· 223 339 224 340 static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) 225 341 { 226 - gpio_set_value(dvi_en_gpio, 1); 342 + gpio_set_value(CM_T35_DVI_EN_GPIO, 1); 227 343 dvi_enabled = 0; 228 344 } 229 345 ··· 305 421 }, 306 422 }; 307 423 424 + static struct gpio cm_t35_dss_gpios[] __initdata = { 425 + { CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable" }, 426 + { CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable" }, 427 + { CM_T35_DVI_EN_GPIO, GPIOF_OUT_INIT_HIGH, "dvi enable" }, 428 + }; 429 + 308 430 static void __init cm_t35_init_display(void) 309 431 { 310 432 int err; 311 433 312 - lcd_en_gpio = CM_T35_LCD_EN_GPIO; 313 - lcd_bl_gpio = CM_T35_LCD_BL_GPIO; 314 - dvi_en_gpio = CM_T35_DVI_EN_GPIO; 315 - 316 434 spi_register_board_info(cm_t35_lcd_spi_board_info, 317 435 ARRAY_SIZE(cm_t35_lcd_spi_board_info)); 318 436 319 - err = gpio_request(lcd_en_gpio, "LCD RST"); 437 + err = gpio_request_array(cm_t35_dss_gpios, 438 + ARRAY_SIZE(cm_t35_dss_gpios)); 320 439 if (err) { 321 - pr_err("CM-T35: failed to get LCD reset GPIO\n"); 322 - goto out; 440 + pr_err("CM-T35: failed to request DSS control GPIOs\n"); 441 + return; 323 442 } 324 443 325 - err = gpio_request(lcd_bl_gpio, "LCD BL"); 326 - if (err) { 327 - pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); 328 - goto err_lcd_bl; 329 - } 330 - 331 - err = gpio_request(dvi_en_gpio, "DVI EN"); 332 - if (err) { 333 - pr_err("CM-T35: failed to get DVI reset GPIO\n"); 334 - goto err_dvi_en; 335 - } 336 - 337 - gpio_export(lcd_en_gpio, 0); 338 - gpio_export(lcd_bl_gpio, 0); 339 - gpio_export(dvi_en_gpio, 0); 340 - gpio_direction_output(lcd_en_gpio, 0); 341 - gpio_direction_output(lcd_bl_gpio, 0); 342 - gpio_direction_output(dvi_en_gpio, 1); 444 + gpio_export(CM_T35_LCD_EN_GPIO, 0); 445 + gpio_export(CM_T35_LCD_BL_GPIO, 0); 446 + gpio_export(CM_T35_DVI_EN_GPIO, 0); 343 447 344 448 msleep(50); 345 - gpio_set_value(lcd_en_gpio, 1); 449 + gpio_set_value(CM_T35_LCD_EN_GPIO, 1); 346 450 347 451 err = omap_display_init(&cm_t35_dss_data); 348 452 if (err) { 349 453 pr_err("CM-T35: failed to register DSS device\n"); 350 - goto err_dev_reg; 454 + gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios)); 351 455 } 352 - 353 - return; 354 - 355 - err_dev_reg: 356 - gpio_free(dvi_en_gpio); 357 - err_dvi_en: 358 - gpio_free(lcd_bl_gpio); 359 - err_lcd_bl: 360 - gpio_free(lcd_en_gpio); 361 - out: 362 - 363 - return; 364 456 } 365 457 366 458 static struct regulator_consumer_supply cm_t35_vmmc1_supply = { ··· 469 609 { 470 610 int wlan_rst = gpio + 2; 471 611 472 - if ((gpio_request(wlan_rst, "WLAN RST") == 0) && 473 - (gpio_direction_output(wlan_rst, 1) == 0)) { 612 + if (gpio_request_one(wlan_rst, GPIOF_OUT_INIT_HIGH, "WLAN RST") == 0) { 474 613 gpio_export(wlan_rst, 0); 475 - 476 614 udelay(10); 477 615 gpio_set_value(wlan_rst, 0); 478 616 udelay(10); ··· 511 653 .vpll2 = &cm_t35_vpll2, 512 654 }; 513 655 514 - static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = { 515 - { 516 - I2C_BOARD_INFO("tps65930", 0x48), 517 - .flags = I2C_CLIENT_WAKE, 518 - .irq = INT_34XX_SYS_NIRQ, 519 - .platform_data = &cm_t35_twldata, 520 - }, 521 - }; 522 - 523 656 static void __init cm_t35_init_i2c(void) 524 657 { 525 - omap_register_i2c_bus(1, 2600, cm_t35_i2c_boardinfo, 526 - ARRAY_SIZE(cm_t35_i2c_boardinfo)); 658 + omap3_pmic_init("tps65930", &cm_t35_twldata); 527 659 } 528 660 529 661 static void __init cm_t35_init_early(void) ··· 623 775 }; 624 776 #endif 625 777 626 - static struct omap_musb_board_data musb_board_data = { 627 - .interface_type = MUSB_INTERFACE_ULPI, 628 - .mode = MUSB_OTG, 629 - .power = 100, 630 - }; 631 - 632 778 static struct omap_board_config_kernel cm_t35_config[] __initdata = { 633 779 }; 634 780 ··· 634 792 omap_serial_init(); 635 793 cm_t35_init_i2c(); 636 794 cm_t35_init_nand(); 637 - cm_t35_init_ads7846(); 795 + omap_ads7846_init(1, CM_T35_GPIO_PENDOWN, 0, NULL); 638 796 cm_t35_init_ethernet(); 639 797 cm_t35_init_led(); 640 798 cm_t35_init_display(); 641 799 642 - usb_musb_init(&musb_board_data); 800 + usb_musb_init(NULL); 643 801 usbhs_init(&usbhs_bdata); 644 802 } 645 803
+4 -5
arch/arm/mach-omap2/board-cm-t3517.c
··· 148 148 { 149 149 int err; 150 150 151 - err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en"); 151 + err = gpio_request_one(RTC_CS_EN_GPIO, GPIOF_OUT_INIT_HIGH, 152 + "rtc cs en"); 152 153 if (err) { 153 154 pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err); 154 155 return; 155 156 } 156 - 157 - gpio_direction_output(RTC_CS_EN_GPIO, 1); 158 157 159 158 platform_device_register(&cm_t3517_rtc_device); 160 159 } ··· 181 182 { 182 183 int err; 183 184 184 - err = gpio_request(USB_HUB_RESET_GPIO, "usb hub rst"); 185 + err = gpio_request_one(USB_HUB_RESET_GPIO, GPIOF_OUT_INIT_LOW, 186 + "usb hub rst"); 185 187 if (err) { 186 188 pr_err("CM-T3517: usb hub rst gpio request failed: %d\n", err); 187 189 } else { 188 - gpio_direction_output(USB_HUB_RESET_GPIO, 0); 189 190 udelay(10); 190 191 gpio_set_value(USB_HUB_RESET_GPIO, 1); 191 192 msleep(1);
+12 -119
arch/arm/mach-omap2/board-devkit8000.c
··· 51 51 #include <plat/mcspi.h> 52 52 #include <linux/input/matrix_keypad.h> 53 53 #include <linux/spi/spi.h> 54 - #include <linux/spi/ads7846.h> 55 54 #include <linux/dm9000.h> 56 55 #include <linux/interrupt.h> 57 56 ··· 59 60 #include "mux.h" 60 61 #include "hsmmc.h" 61 62 #include "timer-gp.h" 63 + #include "common-board-devices.h" 62 64 63 65 #define NAND_BLOCK_SIZE SZ_128K 64 66 ··· 95 95 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 96 96 .size = MTDPART_SIZ_FULL, 97 97 }, 98 - }; 99 - 100 - static struct omap_nand_platform_data devkit8000_nand_data = { 101 - .options = NAND_BUSWIDTH_16, 102 - .parts = devkit8000_nand_partitions, 103 - .nr_parts = ARRAY_SIZE(devkit8000_nand_partitions), 104 - .dma_channel = -1, /* disable DMA in OMAP NAND driver */ 105 98 }; 106 99 107 100 static struct omap2_hsmmc_info mmc[] = { ··· 242 249 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */ 243 250 devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0; 244 251 ret = gpio_request_one(devkit8000_lcd_device.reset_gpio, 245 - GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN"); 252 + GPIOF_OUT_INIT_LOW, "LCD_PWREN"); 246 253 if (ret < 0) { 247 254 devkit8000_lcd_device.reset_gpio = -EINVAL; 248 255 printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n"); ··· 251 258 /* gpio + 7 is "DVI_PD" (out, active low) */ 252 259 devkit8000_dvi_device.reset_gpio = gpio + 7; 253 260 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio, 254 - GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown"); 261 + GPIOF_OUT_INIT_LOW, "DVI PowerDown"); 255 262 if (ret < 0) { 256 263 devkit8000_dvi_device.reset_gpio = -EINVAL; 257 264 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n"); ··· 359 366 .keypad = &devkit8000_kp_data, 360 367 }; 361 368 362 - static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = { 363 - { 364 - I2C_BOARD_INFO("tps65930", 0x48), 365 - .flags = I2C_CLIENT_WAKE, 366 - .irq = INT_34XX_SYS_NIRQ, 367 - .platform_data = &devkit8000_twldata, 368 - }, 369 - }; 370 - 371 369 static int __init devkit8000_i2c_init(void) 372 370 { 373 - omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, 374 - ARRAY_SIZE(devkit8000_i2c_boardinfo)); 371 + omap3_pmic_init("tps65930", &devkit8000_twldata); 375 372 /* Bus 3 is attached to the DVI port where devices like the pico DLP 376 373 * projector don't work reliably with 400kHz */ 377 374 omap_register_i2c_bus(3, 400, NULL, 0); ··· 446 463 #endif 447 464 } 448 465 449 - static void __init devkit8000_ads7846_init(void) 450 - { 451 - int gpio = OMAP3_DEVKIT_TS_GPIO; 452 - int ret; 453 - 454 - ret = gpio_request(gpio, "ads7846_pen_down"); 455 - if (ret < 0) { 456 - printk(KERN_ERR "Failed to request GPIO %d for " 457 - "ads7846 pen down IRQ\n", gpio); 458 - return; 459 - } 460 - 461 - gpio_direction_input(gpio); 462 - } 463 - 464 - static int ads7846_get_pendown_state(void) 465 - { 466 - return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO); 467 - } 468 - 469 - static struct ads7846_platform_data ads7846_config = { 470 - .x_max = 0x0fff, 471 - .y_max = 0x0fff, 472 - .x_plate_ohms = 180, 473 - .pressure_max = 255, 474 - .debounce_max = 10, 475 - .debounce_tol = 5, 476 - .debounce_rep = 1, 477 - .get_pendown_state = ads7846_get_pendown_state, 478 - .keep_vref_on = 1, 479 - .settle_delay_usecs = 150, 480 - }; 481 - 482 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 483 - .turbo_mode = 0, 484 - .single_channel = 1, /* 0: slave, 1: master */ 485 - }; 486 - 487 - static struct spi_board_info devkit8000_spi_board_info[] __initdata = { 488 - { 489 - .modalias = "ads7846", 490 - .bus_num = 2, 491 - .chip_select = 0, 492 - .max_speed_hz = 1500000, 493 - .controller_data = &ads7846_mcspi_config, 494 - .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO), 495 - .platform_data = &ads7846_config, 496 - } 497 - }; 498 - 499 466 #define OMAP_DM9000_BASE 0x2c000000 500 467 501 468 static struct resource omap_dm9000_resources[] = { ··· 483 550 { 484 551 unsigned char *eth_addr = omap_dm9000_platdata.dev_addr; 485 552 struct omap_die_id odi; 553 + int ret; 486 554 487 - if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { 555 + ret = gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq"); 556 + if (ret < 0) { 488 557 printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", 489 558 OMAP_DM9000_GPIO_IRQ); 490 559 return; 491 - } 492 - 493 - gpio_direction_input(OMAP_DM9000_GPIO_IRQ); 560 + } 494 561 495 562 /* init the mac address using DIE id */ 496 563 omap_get_die_id(&odi); ··· 507 574 &leds_gpio, 508 575 &keys_gpio, 509 576 &omap_dm9000_dev, 510 - }; 511 - 512 - static void __init devkit8000_flash_init(void) 513 - { 514 - u8 cs = 0; 515 - u8 nandcs = GPMC_CS_NUM + 1; 516 - 517 - /* find out the chip-select on which NAND exists */ 518 - while (cs < GPMC_CS_NUM) { 519 - u32 ret = 0; 520 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 521 - 522 - if ((ret & 0xC00) == 0x800) { 523 - printk(KERN_INFO "Found NAND on CS%d\n", cs); 524 - if (nandcs > GPMC_CS_NUM) 525 - nandcs = cs; 526 - } 527 - cs++; 528 - } 529 - 530 - if (nandcs > GPMC_CS_NUM) { 531 - printk(KERN_INFO "NAND: Unable to find configuration " 532 - "in GPMC\n "); 533 - return; 534 - } 535 - 536 - if (nandcs < GPMC_CS_NUM) { 537 - devkit8000_nand_data.cs = nandcs; 538 - 539 - printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); 540 - if (gpmc_nand_init(&devkit8000_nand_data) < 0) 541 - printk(KERN_ERR "Unable to register NAND device\n"); 542 - } 543 - } 544 - 545 - static struct omap_musb_board_data musb_board_data = { 546 - .interface_type = MUSB_INTERFACE_ULPI, 547 - .mode = MUSB_OTG, 548 - .power = 100, 549 577 }; 550 578 551 579 static const struct usbhs_omap_board_data usbhs_bdata __initconst = { ··· 689 795 ARRAY_SIZE(devkit8000_devices)); 690 796 691 797 omap_display_init(&devkit8000_dss_data); 692 - spi_register_board_info(devkit8000_spi_board_info, 693 - ARRAY_SIZE(devkit8000_spi_board_info)); 694 798 695 - devkit8000_ads7846_init(); 799 + omap_ads7846_init(2, OMAP3_DEVKIT_TS_GPIO, 0, NULL); 696 800 697 - usb_musb_init(&musb_board_data); 801 + usb_musb_init(NULL); 698 802 usbhs_init(&usbhs_bdata); 699 - devkit8000_flash_init(); 803 + omap_nand_flash_init(NAND_BUSWIDTH_16, devkit8000_nand_partitions, 804 + ARRAY_SIZE(devkit8000_nand_partitions)); 700 805 701 806 /* Ensure SDRC pins are mux'd for self-refresh */ 702 807 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
+226 -221
arch/arm/mach-omap2/board-igep0020.c
··· 38 38 #include "mux.h" 39 39 #include "hsmmc.h" 40 40 #include "sdram-numonyx-m65kxxxxam.h" 41 + #include "common-board-devices.h" 41 42 42 43 #define IGEP2_SMSC911X_CS 5 43 44 #define IGEP2_SMSC911X_GPIO 176 ··· 55 54 #define IGEP2_RC_GPIO_WIFI_NRESET 139 56 55 #define IGEP2_RC_GPIO_BT_NRESET 137 57 56 57 + #define IGEP3_GPIO_LED0_GREEN 54 58 + #define IGEP3_GPIO_LED0_RED 53 59 + #define IGEP3_GPIO_LED1_RED 16 60 + #define IGEP3_GPIO_USBH_NRESET 183 61 + 58 62 /* 59 63 * IGEP2 Hardware Revision Table 60 64 * ··· 74 68 75 69 #define IGEP2_BOARD_HWREV_B 0 76 70 #define IGEP2_BOARD_HWREV_C 1 71 + #define IGEP3_BOARD_HWREV 2 77 72 78 73 static u8 hwrev; 79 74 ··· 82 75 { 83 76 u8 ret; 84 77 78 + if (machine_is_igep0030()) { 79 + hwrev = IGEP3_BOARD_HWREV; 80 + return; 81 + } 82 + 85 83 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); 86 84 87 - if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && 88 - (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) { 89 - ret = gpio_get_value(IGEP2_GPIO_LED1_RED); 90 - if (ret == 0) { 91 - pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); 92 - hwrev = IGEP2_BOARD_HWREV_C; 93 - } else if (ret == 1) { 94 - pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); 95 - hwrev = IGEP2_BOARD_HWREV_B; 96 - } else { 97 - pr_err("IGEP2: Unknown Hardware Revision\n"); 98 - hwrev = -1; 99 - } 100 - } else { 85 + if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) { 101 86 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); 102 87 pr_err("IGEP2: Unknown Hardware Revision\n"); 88 + return; 89 + } 90 + 91 + ret = gpio_get_value(IGEP2_GPIO_LED1_RED); 92 + if (ret == 0) { 93 + pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); 94 + hwrev = IGEP2_BOARD_HWREV_C; 95 + } else if (ret == 1) { 96 + pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); 97 + hwrev = IGEP2_BOARD_HWREV_B; 98 + } else { 99 + pr_err("IGEP2: Unknown Hardware Revision\n"); 100 + hwrev = -1; 103 101 } 104 102 105 103 gpio_free(IGEP2_GPIO_LED1_RED); ··· 123 111 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) 124 112 */ 125 113 126 - static struct mtd_partition igep2_onenand_partitions[] = { 114 + static struct mtd_partition igep_onenand_partitions[] = { 127 115 { 128 116 .name = "X-Loader", 129 117 .offset = 0, ··· 151 139 }, 152 140 }; 153 141 154 - static struct omap_onenand_platform_data igep2_onenand_data = { 155 - .parts = igep2_onenand_partitions, 156 - .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), 142 + static struct omap_onenand_platform_data igep_onenand_data = { 143 + .parts = igep_onenand_partitions, 144 + .nr_parts = ARRAY_SIZE(igep_onenand_partitions), 157 145 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 158 146 }; 159 147 160 - static struct platform_device igep2_onenand_device = { 148 + static struct platform_device igep_onenand_device = { 161 149 .name = "omap2-onenand", 162 150 .id = -1, 163 151 .dev = { 164 - .platform_data = &igep2_onenand_data, 152 + .platform_data = &igep_onenand_data, 165 153 }, 166 154 }; 167 155 168 - static void __init igep2_flash_init(void) 156 + static void __init igep_flash_init(void) 169 157 { 170 158 u8 cs = 0; 171 159 u8 onenandcs = GPMC_CS_NUM + 1; ··· 177 165 /* Check if NAND/oneNAND is configured */ 178 166 if ((ret & 0xC00) == 0x800) 179 167 /* NAND found */ 180 - pr_err("IGEP2: Unsupported NAND found\n"); 168 + pr_err("IGEP: Unsupported NAND found\n"); 181 169 else { 182 170 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 183 171 if ((ret & 0x3F) == (ONENAND_MAP >> 24)) ··· 187 175 } 188 176 189 177 if (onenandcs > GPMC_CS_NUM) { 190 - pr_err("IGEP2: Unable to find configuration in GPMC\n"); 178 + pr_err("IGEP: Unable to find configuration in GPMC\n"); 191 179 return; 192 180 } 193 181 194 - igep2_onenand_data.cs = onenandcs; 182 + igep_onenand_data.cs = onenandcs; 195 183 196 - if (platform_device_register(&igep2_onenand_device) < 0) 197 - pr_err("IGEP2: Unable to register OneNAND device\n"); 184 + if (platform_device_register(&igep_onenand_device) < 0) 185 + pr_err("IGEP: Unable to register OneNAND device\n"); 198 186 } 199 187 200 188 #else 201 - static void __init igep2_flash_init(void) {} 189 + static void __init igep_flash_init(void) {} 202 190 #endif 203 191 204 192 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 205 193 206 194 #include <linux/smsc911x.h> 195 + #include <plat/gpmc-smsc911x.h> 207 196 208 - static struct smsc911x_platform_config igep2_smsc911x_config = { 209 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 210 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 211 - .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , 212 - .phy_interface = PHY_INTERFACE_MODE_MII, 213 - }; 214 - 215 - static struct resource igep2_smsc911x_resources[] = { 216 - { 217 - .flags = IORESOURCE_MEM, 218 - }, 219 - { 220 - .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), 221 - .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), 222 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 223 - }, 224 - }; 225 - 226 - static struct platform_device igep2_smsc911x_device = { 227 - .name = "smsc911x", 228 - .id = 0, 229 - .num_resources = ARRAY_SIZE(igep2_smsc911x_resources), 230 - .resource = igep2_smsc911x_resources, 231 - .dev = { 232 - .platform_data = &igep2_smsc911x_config, 233 - }, 197 + static struct omap_smsc911x_platform_data smsc911x_cfg = { 198 + .cs = IGEP2_SMSC911X_CS, 199 + .gpio_irq = IGEP2_SMSC911X_GPIO, 200 + .gpio_reset = -EINVAL, 201 + .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 234 202 }; 235 203 236 204 static inline void __init igep2_init_smsc911x(void) 237 205 { 238 - unsigned long cs_mem_base; 239 - 240 - if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { 241 - pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n"); 242 - gpmc_cs_free(IGEP2_SMSC911X_CS); 243 - return; 244 - } 245 - 246 - igep2_smsc911x_resources[0].start = cs_mem_base + 0x0; 247 - igep2_smsc911x_resources[0].end = cs_mem_base + 0xff; 248 - 249 - if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && 250 - (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) { 251 - gpio_export(IGEP2_SMSC911X_GPIO, 0); 252 - } else { 253 - pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n"); 254 - return; 255 - } 256 - 257 - platform_device_register(&igep2_smsc911x_device); 206 + gpmc_smsc911x_init(&smsc911x_cfg); 258 207 } 259 208 260 209 #else 261 210 static inline void __init igep2_init_smsc911x(void) { } 262 211 #endif 263 212 264 - static struct regulator_consumer_supply igep2_vmmc1_supply = 213 + static struct regulator_consumer_supply igep_vmmc1_supply = 265 214 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"); 266 215 267 216 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ 268 - static struct regulator_init_data igep2_vmmc1 = { 217 + static struct regulator_init_data igep_vmmc1 = { 269 218 .constraints = { 270 219 .min_uV = 1850000, 271 220 .max_uV = 3150000, ··· 237 264 | REGULATOR_CHANGE_STATUS, 238 265 }, 239 266 .num_consumer_supplies = 1, 240 - .consumer_supplies = &igep2_vmmc1_supply, 267 + .consumer_supplies = &igep_vmmc1_supply, 241 268 }; 242 269 243 - static struct regulator_consumer_supply igep2_vio_supply = 270 + static struct regulator_consumer_supply igep_vio_supply = 244 271 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"); 245 272 246 - static struct regulator_init_data igep2_vio = { 273 + static struct regulator_init_data igep_vio = { 247 274 .constraints = { 248 275 .min_uV = 1800000, 249 276 .max_uV = 1800000, ··· 255 282 | REGULATOR_CHANGE_STATUS, 256 283 }, 257 284 .num_consumer_supplies = 1, 258 - .consumer_supplies = &igep2_vio_supply, 285 + .consumer_supplies = &igep_vio_supply, 259 286 }; 260 287 261 - static struct regulator_consumer_supply igep2_vmmc2_supply = 288 + static struct regulator_consumer_supply igep_vmmc2_supply = 262 289 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); 263 290 264 - static struct regulator_init_data igep2_vmmc2 = { 291 + static struct regulator_init_data igep_vmmc2 = { 265 292 .constraints = { 266 293 .valid_modes_mask = REGULATOR_MODE_NORMAL, 267 294 .always_on = 1, 268 295 }, 269 296 .num_consumer_supplies = 1, 270 - .consumer_supplies = &igep2_vmmc2_supply, 297 + .consumer_supplies = &igep_vmmc2_supply, 271 298 }; 272 299 273 - static struct fixed_voltage_config igep2_vwlan = { 300 + static struct fixed_voltage_config igep_vwlan = { 274 301 .supply_name = "vwlan", 275 302 .microvolts = 3300000, 276 303 .gpio = -EINVAL, 277 304 .enabled_at_boot = 1, 278 - .init_data = &igep2_vmmc2, 305 + .init_data = &igep_vmmc2, 279 306 }; 280 307 281 - static struct platform_device igep2_vwlan_device = { 308 + static struct platform_device igep_vwlan_device = { 282 309 .name = "reg-fixed-voltage", 283 310 .id = 0, 284 311 .dev = { 285 - .platform_data = &igep2_vwlan, 312 + .platform_data = &igep_vwlan, 286 313 }, 287 314 }; 288 315 ··· 307 334 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 308 335 #include <linux/leds.h> 309 336 310 - static struct gpio_led igep2_gpio_leds[] = { 337 + static struct gpio_led igep_gpio_leds[] = { 311 338 [0] = { 312 339 .name = "gpio-led:red:d0", 313 - .gpio = IGEP2_GPIO_LED0_RED, 314 340 .default_trigger = "default-off" 315 341 }, 316 342 [1] = { 317 343 .name = "gpio-led:green:d0", 318 - .gpio = IGEP2_GPIO_LED0_GREEN, 319 344 .default_trigger = "default-off", 320 345 }, 321 346 [2] = { 322 347 .name = "gpio-led:red:d1", 323 - .gpio = IGEP2_GPIO_LED1_RED, 324 348 .default_trigger = "default-off", 325 349 }, 326 350 [3] = { ··· 328 358 }, 329 359 }; 330 360 331 - static struct gpio_led_platform_data igep2_led_pdata = { 332 - .leds = igep2_gpio_leds, 333 - .num_leds = ARRAY_SIZE(igep2_gpio_leds), 361 + static struct gpio_led_platform_data igep_led_pdata = { 362 + .leds = igep_gpio_leds, 363 + .num_leds = ARRAY_SIZE(igep_gpio_leds), 334 364 }; 335 365 336 - static struct platform_device igep2_led_device = { 366 + static struct platform_device igep_led_device = { 337 367 .name = "leds-gpio", 338 368 .id = -1, 339 369 .dev = { 340 - .platform_data = &igep2_led_pdata, 370 + .platform_data = &igep_led_pdata, 341 371 }, 342 372 }; 343 373 344 - static void __init igep2_leds_init(void) 374 + static void __init igep_leds_init(void) 345 375 { 346 - platform_device_register(&igep2_led_device); 376 + if (machine_is_igep0020()) { 377 + igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED; 378 + igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN; 379 + igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED; 380 + } else { 381 + igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED; 382 + igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN; 383 + igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED; 384 + } 385 + 386 + platform_device_register(&igep_led_device); 347 387 } 348 388 349 389 #else 350 - static inline void igep2_leds_init(void) 390 + static struct gpio igep_gpio_leds[] __initdata = { 391 + { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" }, 392 + { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" }, 393 + { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" }, 394 + }; 395 + 396 + static inline void igep_leds_init(void) 351 397 { 352 - if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && 353 - (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0)) 354 - gpio_export(IGEP2_GPIO_LED0_RED, 0); 355 - else 356 - pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); 398 + int i; 357 399 358 - if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && 359 - (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0)) 360 - gpio_export(IGEP2_GPIO_LED0_GREEN, 0); 361 - else 362 - pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); 400 + if (machine_is_igep0020()) { 401 + igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED; 402 + igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN; 403 + igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED; 404 + } else { 405 + igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED; 406 + igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN; 407 + igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED; 408 + } 363 409 364 - if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && 365 - (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0)) 366 - gpio_export(IGEP2_GPIO_LED1_RED, 0); 367 - else 368 - pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); 410 + if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) { 411 + pr_warning("IGEP v2: Could not obtain leds gpios\n"); 412 + return; 413 + } 369 414 415 + for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++) 416 + gpio_export(igep_gpio_leds[i].gpio, 0); 370 417 } 371 418 #endif 372 419 373 - static int igep2_twl_gpio_setup(struct device *dev, 420 + static struct gpio igep2_twl_gpios[] = { 421 + { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" }, 422 + { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" }, 423 + }; 424 + 425 + static int igep_twl_gpio_setup(struct device *dev, 374 426 unsigned gpio, unsigned ngpio) 375 427 { 428 + int ret; 429 + 376 430 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 377 431 mmc[0].gpio_cd = gpio + 0; 378 432 omap2_hsmmc_init(mmc); 433 + 434 + /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 435 + #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 436 + ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, 437 + "gpio-led:green:d1"); 438 + if (ret == 0) 439 + gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); 440 + else 441 + pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n"); 442 + #else 443 + igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; 444 + #endif 445 + 446 + if (machine_is_igep0030()) 447 + return 0; 379 448 380 449 /* 381 450 * REVISIT: need ehci-omap hooks for external VBUS 382 451 * power switch and overcurrent detect 383 452 */ 384 - if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) || 385 - (gpio_direction_input(gpio + 1) < 0)) 386 - pr_err("IGEP2: Could not obtain gpio for EHCI NOC"); 453 + igep2_twl_gpios[0].gpio = gpio + 1; 387 454 388 - /* 389 - * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN 390 - * (out, active low) 391 - */ 392 - if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) || 393 - (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) 455 + /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */ 456 + igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX; 457 + 458 + ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios)); 459 + if (ret < 0) 394 460 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); 395 - 396 - /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 397 - #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 398 - if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) 399 - && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) 400 - gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); 401 - else 402 - pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); 403 - #else 404 - igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; 405 - #endif 406 461 407 462 return 0; 408 463 }; 409 464 410 - static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = { 465 + static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = { 411 466 .gpio_base = OMAP_MAX_GPIO_LINES, 412 467 .irq_base = TWL4030_GPIO_IRQ_BASE, 413 468 .irq_end = TWL4030_GPIO_IRQ_END, 414 469 .use_leds = true, 415 - .setup = igep2_twl_gpio_setup, 470 + .setup = igep_twl_gpio_setup, 416 471 }; 417 472 418 - static struct twl4030_usb_data igep2_usb_data = { 473 + static struct twl4030_usb_data igep_usb_data = { 419 474 .usb_mode = T2_USB_MODE_ULPI, 420 475 }; 421 476 ··· 502 507 503 508 static void __init igep2_display_init(void) 504 509 { 505 - if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && 506 - gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) 510 + int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH, 511 + "GPIO_DVI_PUP"); 512 + if (err) 507 513 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); 508 514 } 509 515 510 - static struct platform_device *igep2_devices[] __initdata = { 511 - &igep2_vwlan_device, 516 + static struct platform_device *igep_devices[] __initdata = { 517 + &igep_vwlan_device, 512 518 }; 513 519 514 - static void __init igep2_init_early(void) 520 + static void __init igep_init_early(void) 515 521 { 516 522 omap2_init_common_infrastructure(); 517 523 omap2_init_common_devices(m65kxxxxam_sdrc_params, ··· 557 561 .rep = 1, 558 562 }; 559 563 560 - static struct twl4030_platform_data igep2_twldata = { 564 + static struct twl4030_platform_data igep_twldata = { 561 565 .irq_base = TWL4030_IRQ_BASE, 562 566 .irq_end = TWL4030_IRQ_END, 563 567 564 568 /* platform_data for children goes here */ 565 - .usb = &igep2_usb_data, 566 - .codec = &igep2_codec_data, 567 - .gpio = &igep2_twl4030_gpio_pdata, 568 - .keypad = &igep2_keypad_pdata, 569 - .vmmc1 = &igep2_vmmc1, 570 - .vpll2 = &igep2_vpll2, 571 - .vio = &igep2_vio, 572 - }; 573 - 574 - static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = { 575 - { 576 - I2C_BOARD_INFO("twl4030", 0x48), 577 - .flags = I2C_CLIENT_WAKE, 578 - .irq = INT_34XX_SYS_NIRQ, 579 - .platform_data = &igep2_twldata, 580 - }, 569 + .usb = &igep_usb_data, 570 + .gpio = &igep_twl4030_gpio_pdata, 571 + .vmmc1 = &igep_vmmc1, 572 + .vio = &igep_vio, 581 573 }; 582 574 583 575 static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { ··· 574 590 }, 575 591 }; 576 592 577 - static void __init igep2_i2c_init(void) 593 + static void __init igep_i2c_init(void) 578 594 { 579 595 int ret; 580 596 581 - ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo, 582 - ARRAY_SIZE(igep2_i2c1_boardinfo)); 583 - if (ret) 584 - pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret); 597 + if (machine_is_igep0020()) { 598 + /* 599 + * Bus 3 is attached to the DVI port where devices like the 600 + * pico DLP projector don't work reliably with 400kHz 601 + */ 602 + ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo, 603 + ARRAY_SIZE(igep2_i2c3_boardinfo)); 604 + if (ret) 605 + pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); 585 606 586 - /* 587 - * Bus 3 is attached to the DVI port where devices like the pico DLP 588 - * projector don't work reliably with 400kHz 589 - */ 590 - ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo, 591 - ARRAY_SIZE(igep2_i2c3_boardinfo)); 592 - if (ret) 593 - pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); 607 + igep_twldata.codec = &igep2_codec_data; 608 + igep_twldata.keypad = &igep2_keypad_pdata; 609 + igep_twldata.vpll2 = &igep2_vpll2; 610 + } 611 + 612 + omap3_pmic_init("twl4030", &igep_twldata); 594 613 } 595 614 596 - static struct omap_musb_board_data musb_board_data = { 597 - .interface_type = MUSB_INTERFACE_ULPI, 598 - .mode = MUSB_OTG, 599 - .power = 100, 600 - }; 601 - 602 - static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 615 + static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = { 603 616 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, 604 617 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, 605 618 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, ··· 607 626 .reset_gpio_port[2] = -EINVAL, 608 627 }; 609 628 629 + static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = { 630 + .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 631 + .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 632 + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 633 + 634 + .phy_reset = true, 635 + .reset_gpio_port[0] = -EINVAL, 636 + .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, 637 + .reset_gpio_port[2] = -EINVAL, 638 + }; 639 + 610 640 #ifdef CONFIG_OMAP_MUX 611 641 static struct omap_board_mux board_mux[] __initdata = { 612 642 { .reg_offset = OMAP_MUX_TERMINATOR }, ··· 625 633 #endif 626 634 627 635 #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) 636 + static struct gpio igep_wlan_bt_gpios[] __initdata = { 637 + { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" }, 638 + { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" }, 639 + { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" }, 640 + }; 628 641 629 - static void __init igep2_wlan_bt_init(void) 642 + static void __init igep_wlan_bt_init(void) 630 643 { 631 - unsigned npd, wreset, btreset; 644 + int err; 632 645 633 646 /* GPIO's for WLAN-BT combo depends on hardware revision */ 634 647 if (hwrev == IGEP2_BOARD_HWREV_B) { 635 - npd = IGEP2_RB_GPIO_WIFI_NPD; 636 - wreset = IGEP2_RB_GPIO_WIFI_NRESET; 637 - btreset = IGEP2_RB_GPIO_BT_NRESET; 638 - } else if (hwrev == IGEP2_BOARD_HWREV_C) { 639 - npd = IGEP2_RC_GPIO_WIFI_NPD; 640 - wreset = IGEP2_RC_GPIO_WIFI_NRESET; 641 - btreset = IGEP2_RC_GPIO_BT_NRESET; 648 + igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD; 649 + igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET; 650 + igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET; 651 + } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) { 652 + igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD; 653 + igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET; 654 + igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET; 642 655 } else 643 656 return; 644 657 645 - /* Set GPIO's for WLAN-BT combo module */ 646 - if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) && 647 - (gpio_direction_output(npd, 1) == 0)) { 648 - gpio_export(npd, 0); 649 - } else 650 - pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n"); 658 + err = gpio_request_array(igep_wlan_bt_gpios, 659 + ARRAY_SIZE(igep_wlan_bt_gpios)); 660 + if (err) { 661 + pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n"); 662 + return; 663 + } 651 664 652 - if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) && 653 - (gpio_direction_output(wreset, 1) == 0)) { 654 - gpio_export(wreset, 0); 655 - gpio_set_value(wreset, 0); 656 - udelay(10); 657 - gpio_set_value(wreset, 1); 658 - } else 659 - pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n"); 665 + gpio_export(igep_wlan_bt_gpios[0].gpio, 0); 666 + gpio_export(igep_wlan_bt_gpios[1].gpio, 0); 667 + gpio_export(igep_wlan_bt_gpios[2].gpio, 0); 660 668 661 - if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) && 662 - (gpio_direction_output(btreset, 1) == 0)) { 663 - gpio_export(btreset, 0); 664 - } else 665 - pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n"); 669 + gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0); 670 + udelay(10); 671 + gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1); 672 + 666 673 } 667 674 #else 668 - static inline void __init igep2_wlan_bt_init(void) { } 675 + static inline void __init igep_wlan_bt_init(void) { } 669 676 #endif 670 677 671 - static void __init igep2_init(void) 678 + static void __init igep_init(void) 672 679 { 673 680 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 674 681 675 682 /* Get IGEP2 hardware revision */ 676 683 igep2_get_revision(); 677 684 /* Register I2C busses and drivers */ 678 - igep2_i2c_init(); 679 - platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); 680 - omap_display_init(&igep2_dss_data); 685 + igep_i2c_init(); 686 + platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); 681 687 omap_serial_init(); 682 - usb_musb_init(&musb_board_data); 683 - usbhs_init(&usbhs_bdata); 688 + usb_musb_init(NULL); 684 689 685 - igep2_flash_init(); 686 - igep2_leds_init(); 687 - igep2_display_init(); 688 - igep2_init_smsc911x(); 690 + igep_flash_init(); 691 + igep_leds_init(); 689 692 690 693 /* 691 694 * WLAN-BT combo module from MuRata which has a Marvell WLAN 692 695 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. 693 696 */ 694 - igep2_wlan_bt_init(); 697 + igep_wlan_bt_init(); 695 698 699 + if (machine_is_igep0020()) { 700 + omap_display_init(&igep2_dss_data); 701 + igep2_display_init(); 702 + igep2_init_smsc911x(); 703 + usbhs_init(&igep2_usbhs_bdata); 704 + } else { 705 + usbhs_init(&igep3_usbhs_bdata); 706 + } 696 707 } 697 708 698 709 MACHINE_START(IGEP0020, "IGEP v2 board") 699 710 .boot_params = 0x80000100, 700 711 .reserve = omap_reserve, 701 712 .map_io = omap3_map_io, 702 - .init_early = igep2_init_early, 713 + .init_early = igep_init_early, 703 714 .init_irq = omap_init_irq, 704 - .init_machine = igep2_init, 715 + .init_machine = igep_init, 716 + .timer = &omap_timer, 717 + MACHINE_END 718 + 719 + MACHINE_START(IGEP0030, "IGEP OMAP3 module") 720 + .boot_params = 0x80000100, 721 + .reserve = omap_reserve, 722 + .map_io = omap3_map_io, 723 + .init_early = igep_init_early, 724 + .init_irq = omap_init_irq, 725 + .init_machine = igep_init, 705 726 .timer = &omap_timer, 706 727 MACHINE_END
-458
arch/arm/mach-omap2/board-igep0030.c
··· 1 - /* 2 - * Copyright (C) 2010 - ISEE 2007 SL 3 - * 4 - * Modified from mach-omap2/board-generic.c 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/init.h> 13 - #include <linux/platform_device.h> 14 - #include <linux/delay.h> 15 - #include <linux/err.h> 16 - #include <linux/clk.h> 17 - #include <linux/io.h> 18 - #include <linux/gpio.h> 19 - #include <linux/interrupt.h> 20 - 21 - #include <linux/regulator/machine.h> 22 - #include <linux/regulator/fixed.h> 23 - #include <linux/i2c/twl.h> 24 - #include <linux/mmc/host.h> 25 - 26 - #include <asm/mach-types.h> 27 - #include <asm/mach/arch.h> 28 - 29 - #include <plat/board.h> 30 - #include <plat/common.h> 31 - #include <plat/gpmc.h> 32 - #include <plat/usb.h> 33 - #include <plat/onenand.h> 34 - 35 - #include "mux.h" 36 - #include "hsmmc.h" 37 - #include "sdram-numonyx-m65kxxxxam.h" 38 - 39 - #define IGEP3_GPIO_LED0_GREEN 54 40 - #define IGEP3_GPIO_LED0_RED 53 41 - #define IGEP3_GPIO_LED1_RED 16 42 - 43 - #define IGEP3_GPIO_WIFI_NPD 138 44 - #define IGEP3_GPIO_WIFI_NRESET 139 45 - #define IGEP3_GPIO_BT_NRESET 137 46 - 47 - #define IGEP3_GPIO_USBH_NRESET 183 48 - 49 - 50 - #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 51 - defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) 52 - 53 - #define ONENAND_MAP 0x20000000 54 - 55 - /* 56 - * x2 Flash built-in COMBO POP MEMORY 57 - * Since the device is equipped with two DataRAMs, and two-plane NAND 58 - * Flash memory array, these two component enables simultaneous program 59 - * of 4KiB. Plane1 has only even blocks such as block0, block2, block4 60 - * while Plane2 has only odd blocks such as block1, block3, block5. 61 - * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) 62 - */ 63 - 64 - static struct mtd_partition igep3_onenand_partitions[] = { 65 - { 66 - .name = "X-Loader", 67 - .offset = 0, 68 - .size = 2 * (64*(2*2048)) 69 - }, 70 - { 71 - .name = "U-Boot", 72 - .offset = MTDPART_OFS_APPEND, 73 - .size = 6 * (64*(2*2048)), 74 - }, 75 - { 76 - .name = "Environment", 77 - .offset = MTDPART_OFS_APPEND, 78 - .size = 2 * (64*(2*2048)), 79 - }, 80 - { 81 - .name = "Kernel", 82 - .offset = MTDPART_OFS_APPEND, 83 - .size = 12 * (64*(2*2048)), 84 - }, 85 - { 86 - .name = "File System", 87 - .offset = MTDPART_OFS_APPEND, 88 - .size = MTDPART_SIZ_FULL, 89 - }, 90 - }; 91 - 92 - static struct omap_onenand_platform_data igep3_onenand_pdata = { 93 - .parts = igep3_onenand_partitions, 94 - .nr_parts = ARRAY_SIZE(igep3_onenand_partitions), 95 - .onenand_setup = NULL, 96 - .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 97 - }; 98 - 99 - static struct platform_device igep3_onenand_device = { 100 - .name = "omap2-onenand", 101 - .id = -1, 102 - .dev = { 103 - .platform_data = &igep3_onenand_pdata, 104 - }, 105 - }; 106 - 107 - static void __init igep3_flash_init(void) 108 - { 109 - u8 cs = 0; 110 - u8 onenandcs = GPMC_CS_NUM + 1; 111 - 112 - for (cs = 0; cs < GPMC_CS_NUM; cs++) { 113 - u32 ret; 114 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 115 - 116 - /* Check if NAND/oneNAND is configured */ 117 - if ((ret & 0xC00) == 0x800) 118 - /* NAND found */ 119 - pr_err("IGEP3: Unsupported NAND found\n"); 120 - else { 121 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 122 - 123 - if ((ret & 0x3F) == (ONENAND_MAP >> 24)) 124 - /* OneNAND found */ 125 - onenandcs = cs; 126 - } 127 - } 128 - 129 - if (onenandcs > GPMC_CS_NUM) { 130 - pr_err("IGEP3: Unable to find configuration in GPMC\n"); 131 - return; 132 - } 133 - 134 - igep3_onenand_pdata.cs = onenandcs; 135 - 136 - if (platform_device_register(&igep3_onenand_device) < 0) 137 - pr_err("IGEP3: Unable to register OneNAND device\n"); 138 - } 139 - 140 - #else 141 - static void __init igep3_flash_init(void) {} 142 - #endif 143 - 144 - static struct regulator_consumer_supply igep3_vmmc1_supply = 145 - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"); 146 - 147 - /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ 148 - static struct regulator_init_data igep3_vmmc1 = { 149 - .constraints = { 150 - .min_uV = 1850000, 151 - .max_uV = 3150000, 152 - .valid_modes_mask = REGULATOR_MODE_NORMAL 153 - | REGULATOR_MODE_STANDBY, 154 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 155 - | REGULATOR_CHANGE_MODE 156 - | REGULATOR_CHANGE_STATUS, 157 - }, 158 - .num_consumer_supplies = 1, 159 - .consumer_supplies = &igep3_vmmc1_supply, 160 - }; 161 - 162 - static struct regulator_consumer_supply igep3_vio_supply = 163 - REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"); 164 - 165 - static struct regulator_init_data igep3_vio = { 166 - .constraints = { 167 - .min_uV = 1800000, 168 - .max_uV = 1800000, 169 - .apply_uV = 1, 170 - .valid_modes_mask = REGULATOR_MODE_NORMAL 171 - | REGULATOR_MODE_STANDBY, 172 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 173 - | REGULATOR_CHANGE_MODE 174 - | REGULATOR_CHANGE_STATUS, 175 - }, 176 - .num_consumer_supplies = 1, 177 - .consumer_supplies = &igep3_vio_supply, 178 - }; 179 - 180 - static struct regulator_consumer_supply igep3_vmmc2_supply = 181 - REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); 182 - 183 - static struct regulator_init_data igep3_vmmc2 = { 184 - .constraints = { 185 - .valid_modes_mask = REGULATOR_MODE_NORMAL, 186 - .always_on = 1, 187 - }, 188 - .num_consumer_supplies = 1, 189 - .consumer_supplies = &igep3_vmmc2_supply, 190 - }; 191 - 192 - static struct fixed_voltage_config igep3_vwlan = { 193 - .supply_name = "vwlan", 194 - .microvolts = 3300000, 195 - .gpio = -EINVAL, 196 - .enabled_at_boot = 1, 197 - .init_data = &igep3_vmmc2, 198 - }; 199 - 200 - static struct platform_device igep3_vwlan_device = { 201 - .name = "reg-fixed-voltage", 202 - .id = 0, 203 - .dev = { 204 - .platform_data = &igep3_vwlan, 205 - }, 206 - }; 207 - 208 - static struct omap2_hsmmc_info mmc[] = { 209 - [0] = { 210 - .mmc = 1, 211 - .caps = MMC_CAP_4_BIT_DATA, 212 - .gpio_cd = -EINVAL, 213 - .gpio_wp = -EINVAL, 214 - }, 215 - #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) 216 - [1] = { 217 - .mmc = 2, 218 - .caps = MMC_CAP_4_BIT_DATA, 219 - .gpio_cd = -EINVAL, 220 - .gpio_wp = -EINVAL, 221 - }, 222 - #endif 223 - {} /* Terminator */ 224 - }; 225 - 226 - #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 227 - #include <linux/leds.h> 228 - 229 - static struct gpio_led igep3_gpio_leds[] = { 230 - [0] = { 231 - .name = "gpio-led:red:d0", 232 - .gpio = IGEP3_GPIO_LED0_RED, 233 - .default_trigger = "default-off" 234 - }, 235 - [1] = { 236 - .name = "gpio-led:green:d0", 237 - .gpio = IGEP3_GPIO_LED0_GREEN, 238 - .default_trigger = "default-off", 239 - }, 240 - [2] = { 241 - .name = "gpio-led:red:d1", 242 - .gpio = IGEP3_GPIO_LED1_RED, 243 - .default_trigger = "default-off", 244 - }, 245 - [3] = { 246 - .name = "gpio-led:green:d1", 247 - .default_trigger = "heartbeat", 248 - .gpio = -EINVAL, /* gets replaced */ 249 - }, 250 - }; 251 - 252 - static struct gpio_led_platform_data igep3_led_pdata = { 253 - .leds = igep3_gpio_leds, 254 - .num_leds = ARRAY_SIZE(igep3_gpio_leds), 255 - }; 256 - 257 - static struct platform_device igep3_led_device = { 258 - .name = "leds-gpio", 259 - .id = -1, 260 - .dev = { 261 - .platform_data = &igep3_led_pdata, 262 - }, 263 - }; 264 - 265 - static void __init igep3_leds_init(void) 266 - { 267 - platform_device_register(&igep3_led_device); 268 - } 269 - 270 - #else 271 - static inline void igep3_leds_init(void) 272 - { 273 - if ((gpio_request(IGEP3_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && 274 - (gpio_direction_output(IGEP3_GPIO_LED0_RED, 1) == 0)) { 275 - gpio_export(IGEP3_GPIO_LED0_RED, 0); 276 - gpio_set_value(IGEP3_GPIO_LED0_RED, 1); 277 - } else 278 - pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_RED\n"); 279 - 280 - if ((gpio_request(IGEP3_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && 281 - (gpio_direction_output(IGEP3_GPIO_LED0_GREEN, 1) == 0)) { 282 - gpio_export(IGEP3_GPIO_LED0_GREEN, 0); 283 - gpio_set_value(IGEP3_GPIO_LED0_GREEN, 1); 284 - } else 285 - pr_warning("IGEP3: Could not obtain gpio GPIO_LED0_GREEN\n"); 286 - 287 - if ((gpio_request(IGEP3_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && 288 - (gpio_direction_output(IGEP3_GPIO_LED1_RED, 1) == 0)) { 289 - gpio_export(IGEP3_GPIO_LED1_RED, 0); 290 - gpio_set_value(IGEP3_GPIO_LED1_RED, 1); 291 - } else 292 - pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_RED\n"); 293 - } 294 - #endif 295 - 296 - static int igep3_twl4030_gpio_setup(struct device *dev, 297 - unsigned gpio, unsigned ngpio) 298 - { 299 - /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 300 - mmc[0].gpio_cd = gpio + 0; 301 - omap2_hsmmc_init(mmc); 302 - 303 - /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 304 - #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 305 - if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) 306 - && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) { 307 - gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); 308 - gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0); 309 - } else 310 - pr_warning("IGEP3: Could not obtain gpio GPIO_LED1_GREEN\n"); 311 - #else 312 - igep3_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; 313 - #endif 314 - 315 - return 0; 316 - }; 317 - 318 - static struct twl4030_gpio_platform_data igep3_twl4030_gpio_pdata = { 319 - .gpio_base = OMAP_MAX_GPIO_LINES, 320 - .irq_base = TWL4030_GPIO_IRQ_BASE, 321 - .irq_end = TWL4030_GPIO_IRQ_END, 322 - .use_leds = true, 323 - .setup = igep3_twl4030_gpio_setup, 324 - }; 325 - 326 - static struct twl4030_usb_data igep3_twl4030_usb_data = { 327 - .usb_mode = T2_USB_MODE_ULPI, 328 - }; 329 - 330 - static struct platform_device *igep3_devices[] __initdata = { 331 - &igep3_vwlan_device, 332 - }; 333 - 334 - static void __init igep3_init_early(void) 335 - { 336 - omap2_init_common_infrastructure(); 337 - omap2_init_common_devices(m65kxxxxam_sdrc_params, 338 - m65kxxxxam_sdrc_params); 339 - } 340 - 341 - static struct twl4030_platform_data igep3_twl4030_pdata = { 342 - .irq_base = TWL4030_IRQ_BASE, 343 - .irq_end = TWL4030_IRQ_END, 344 - 345 - /* platform_data for children goes here */ 346 - .usb = &igep3_twl4030_usb_data, 347 - .gpio = &igep3_twl4030_gpio_pdata, 348 - .vmmc1 = &igep3_vmmc1, 349 - .vio = &igep3_vio, 350 - }; 351 - 352 - static struct i2c_board_info __initdata igep3_i2c_boardinfo[] = { 353 - { 354 - I2C_BOARD_INFO("twl4030", 0x48), 355 - .flags = I2C_CLIENT_WAKE, 356 - .irq = INT_34XX_SYS_NIRQ, 357 - .platform_data = &igep3_twl4030_pdata, 358 - }, 359 - }; 360 - 361 - static int __init igep3_i2c_init(void) 362 - { 363 - omap_register_i2c_bus(1, 2600, igep3_i2c_boardinfo, 364 - ARRAY_SIZE(igep3_i2c_boardinfo)); 365 - 366 - return 0; 367 - } 368 - 369 - static struct omap_musb_board_data musb_board_data = { 370 - .interface_type = MUSB_INTERFACE_ULPI, 371 - .mode = MUSB_OTG, 372 - .power = 100, 373 - }; 374 - 375 - #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) 376 - 377 - static void __init igep3_wifi_bt_init(void) 378 - { 379 - /* Configure MUX values for W-LAN + Bluetooth GPIO's */ 380 - omap_mux_init_gpio(IGEP3_GPIO_WIFI_NPD, OMAP_PIN_OUTPUT); 381 - omap_mux_init_gpio(IGEP3_GPIO_WIFI_NRESET, OMAP_PIN_OUTPUT); 382 - omap_mux_init_gpio(IGEP3_GPIO_BT_NRESET, OMAP_PIN_OUTPUT); 383 - 384 - /* Set GPIO's for W-LAN + Bluetooth combo module */ 385 - if ((gpio_request(IGEP3_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && 386 - (gpio_direction_output(IGEP3_GPIO_WIFI_NPD, 1) == 0)) { 387 - gpio_export(IGEP3_GPIO_WIFI_NPD, 0); 388 - } else 389 - pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NPD\n"); 390 - 391 - if ((gpio_request(IGEP3_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) && 392 - (gpio_direction_output(IGEP3_GPIO_WIFI_NRESET, 1) == 0)) { 393 - gpio_export(IGEP3_GPIO_WIFI_NRESET, 0); 394 - gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 0); 395 - udelay(10); 396 - gpio_set_value(IGEP3_GPIO_WIFI_NRESET, 1); 397 - } else 398 - pr_warning("IGEP3: Could not obtain gpio GPIO_WIFI_NRESET\n"); 399 - 400 - if ((gpio_request(IGEP3_GPIO_BT_NRESET, "GPIO_BT_NRESET") == 0) && 401 - (gpio_direction_output(IGEP3_GPIO_BT_NRESET, 1) == 0)) { 402 - gpio_export(IGEP3_GPIO_BT_NRESET, 0); 403 - } else 404 - pr_warning("IGEP3: Could not obtain gpio GPIO_BT_NRESET\n"); 405 - } 406 - #else 407 - void __init igep3_wifi_bt_init(void) {} 408 - #endif 409 - 410 - static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 411 - .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, 412 - .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, 413 - .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, 414 - 415 - .phy_reset = true, 416 - .reset_gpio_port[0] = -EINVAL, 417 - .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, 418 - .reset_gpio_port[2] = -EINVAL, 419 - }; 420 - 421 - #ifdef CONFIG_OMAP_MUX 422 - static struct omap_board_mux board_mux[] __initdata = { 423 - OMAP3_MUX(I2C2_SDA, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), 424 - { .reg_offset = OMAP_MUX_TERMINATOR }, 425 - }; 426 - #endif 427 - 428 - static void __init igep3_init(void) 429 - { 430 - omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 431 - 432 - /* Register I2C busses and drivers */ 433 - igep3_i2c_init(); 434 - platform_add_devices(igep3_devices, ARRAY_SIZE(igep3_devices)); 435 - omap_serial_init(); 436 - usb_musb_init(&musb_board_data); 437 - usbhs_init(&usbhs_bdata); 438 - 439 - igep3_flash_init(); 440 - igep3_leds_init(); 441 - 442 - /* 443 - * WLAN-BT combo module from MuRata which has a Marvell WLAN 444 - * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. 445 - */ 446 - igep3_wifi_bt_init(); 447 - 448 - } 449 - 450 - MACHINE_START(IGEP0030, "IGEP OMAP3 module") 451 - .boot_params = 0x80000100, 452 - .reserve = omap_reserve, 453 - .map_io = omap3_map_io, 454 - .init_early = igep3_init_early, 455 - .init_irq = omap_init_irq, 456 - .init_machine = igep3_init, 457 - .timer = &omap_timer, 458 - MACHINE_END
+11 -127
arch/arm/mach-omap2/board-ldp.c
··· 22 22 #include <linux/err.h> 23 23 #include <linux/clk.h> 24 24 #include <linux/spi/spi.h> 25 - #include <linux/spi/ads7846.h> 26 25 #include <linux/regulator/machine.h> 27 26 #include <linux/i2c/twl.h> 28 27 #include <linux/io.h> ··· 42 43 43 44 #include <asm/delay.h> 44 45 #include <plat/usb.h> 46 + #include <plat/gpmc-smsc911x.h> 45 47 46 48 #include "board-flash.h" 47 49 #include "mux.h" 48 50 #include "hsmmc.h" 49 51 #include "control.h" 52 + #include "common-board-devices.h" 50 53 51 54 #define LDP_SMSC911X_CS 1 52 55 #define LDP_SMSC911X_GPIO 152 53 56 #define DEBUG_BASE 0x08000000 54 57 #define LDP_ETHR_START DEBUG_BASE 55 - 56 - static struct resource ldp_smsc911x_resources[] = { 57 - [0] = { 58 - .start = LDP_ETHR_START, 59 - .end = LDP_ETHR_START + SZ_4K, 60 - .flags = IORESOURCE_MEM, 61 - }, 62 - [1] = { 63 - .start = 0, 64 - .end = 0, 65 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 66 - }, 67 - }; 68 - 69 - static struct smsc911x_platform_config ldp_smsc911x_config = { 70 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 71 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 72 - .flags = SMSC911X_USE_32BIT, 73 - .phy_interface = PHY_INTERFACE_MODE_MII, 74 - }; 75 - 76 - static struct platform_device ldp_smsc911x_device = { 77 - .name = "smsc911x", 78 - .id = -1, 79 - .num_resources = ARRAY_SIZE(ldp_smsc911x_resources), 80 - .resource = ldp_smsc911x_resources, 81 - .dev = { 82 - .platform_data = &ldp_smsc911x_config, 83 - }, 84 - }; 85 58 86 59 static uint32_t board_keymap[] = { 87 60 KEY(0, 0, KEY_1), ··· 168 197 }, 169 198 }; 170 199 171 - static int ts_gpio; 172 - 173 - /** 174 - * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq 175 - * 176 - * @return - void. If request gpio fails then Flag KERN_ERR. 177 - */ 178 - static void ads7846_dev_init(void) 179 - { 180 - if (gpio_request(ts_gpio, "ads7846 irq") < 0) { 181 - printk(KERN_ERR "can't get ads746 pen down GPIO\n"); 182 - return; 183 - } 184 - 185 - gpio_direction_input(ts_gpio); 186 - gpio_set_debounce(ts_gpio, 310); 187 - } 188 - 189 - static int ads7846_get_pendown_state(void) 190 - { 191 - return !gpio_get_value(ts_gpio); 192 - } 193 - 194 - static struct ads7846_platform_data tsc2046_config __initdata = { 195 - .get_pendown_state = ads7846_get_pendown_state, 196 - .keep_vref_on = 1, 197 - }; 198 - 199 - static struct omap2_mcspi_device_config tsc2046_mcspi_config = { 200 - .turbo_mode = 0, 201 - .single_channel = 1, /* 0: slave, 1: master */ 202 - }; 203 - 204 - static struct spi_board_info ldp_spi_board_info[] __initdata = { 205 - [0] = { 206 - /* 207 - * TSC2046 operates at a max freqency of 2MHz, so 208 - * operate slightly below at 1.5MHz 209 - */ 210 - .modalias = "ads7846", 211 - .bus_num = 1, 212 - .chip_select = 0, 213 - .max_speed_hz = 1500000, 214 - .controller_data = &tsc2046_mcspi_config, 215 - .irq = 0, 216 - .platform_data = &tsc2046_config, 217 - }, 200 + static struct omap_smsc911x_platform_data smsc911x_cfg = { 201 + .cs = LDP_SMSC911X_CS, 202 + .gpio_irq = LDP_SMSC911X_GPIO, 203 + .gpio_reset = -EINVAL, 204 + .flags = SMSC911X_USE_32BIT, 218 205 }; 219 206 220 207 static inline void __init ldp_init_smsc911x(void) 221 208 { 222 - int eth_cs; 223 - unsigned long cs_mem_base; 224 - int eth_gpio = 0; 225 - 226 - eth_cs = LDP_SMSC911X_CS; 227 - 228 - if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { 229 - printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); 230 - return; 231 - } 232 - 233 - ldp_smsc911x_resources[0].start = cs_mem_base + 0x0; 234 - ldp_smsc911x_resources[0].end = cs_mem_base + 0xff; 235 - udelay(100); 236 - 237 - eth_gpio = LDP_SMSC911X_GPIO; 238 - 239 - ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); 240 - 241 - if (gpio_request(eth_gpio, "smsc911x irq") < 0) { 242 - printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 243 - eth_gpio); 244 - return; 245 - } 246 - gpio_direction_input(eth_gpio); 209 + gpmc_smsc911x_init(&smsc911x_cfg); 247 210 } 248 211 249 212 static struct platform_device ldp_lcd_device = { ··· 265 360 .keypad = &ldp_kp_twl4030_data, 266 361 }; 267 362 268 - static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = { 269 - { 270 - I2C_BOARD_INFO("twl4030", 0x48), 271 - .flags = I2C_CLIENT_WAKE, 272 - .irq = INT_34XX_SYS_NIRQ, 273 - .platform_data = &ldp_twldata, 274 - }, 275 - }; 276 - 277 363 static int __init omap_i2c_init(void) 278 364 { 279 - omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo, 280 - ARRAY_SIZE(ldp_i2c_boardinfo)); 365 + omap3_pmic_init("twl4030", &ldp_twldata); 281 366 omap_register_i2c_bus(2, 400, NULL, 0); 282 367 omap_register_i2c_bus(3, 400, NULL, 0); 283 368 return 0; ··· 284 389 }; 285 390 286 391 static struct platform_device *ldp_devices[] __initdata = { 287 - &ldp_smsc911x_device, 288 392 &ldp_lcd_device, 289 393 &ldp_gpio_keys_device, 290 394 }; ··· 293 399 { .reg_offset = OMAP_MUX_TERMINATOR }, 294 400 }; 295 401 #endif 296 - 297 - static struct omap_musb_board_data musb_board_data = { 298 - .interface_type = MUSB_INTERFACE_ULPI, 299 - .mode = MUSB_OTG, 300 - .power = 100, 301 - }; 302 402 303 403 static struct mtd_partition ldp_nand_partitions[] = { 304 404 /* All the partition sizes are listed in terms of NAND block size */ ··· 334 446 ldp_init_smsc911x(); 335 447 omap_i2c_init(); 336 448 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); 337 - ts_gpio = 54; 338 - ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio); 339 - spi_register_board_info(ldp_spi_board_info, 340 - ARRAY_SIZE(ldp_spi_board_info)); 341 - ads7846_dev_init(); 449 + omap_ads7846_init(1, 54, 310, NULL); 342 450 omap_serial_init(); 343 - usb_musb_init(&musb_board_data); 451 + usb_musb_init(NULL); 344 452 board_nand_init(ldp_nand_partitions, 345 453 ARRAY_SIZE(ldp_nand_partitions), ZOOM_NAND_CS, 0); 346 454
+11 -17
arch/arm/mach-omap2/board-n8x0.c
··· 106 106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; 107 107 108 108 /* PM companion chip power control pin */ 109 - ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); 109 + ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW, 110 + "TUSB6010 enable"); 110 111 if (ret != 0) { 111 112 printk(KERN_ERR "Could not get TUSB power GPIO%i\n", 112 113 TUSB6010_GPIO_ENABLE); 113 114 return; 114 115 } 115 - gpio_direction_output(TUSB6010_GPIO_ENABLE, 0); 116 - 117 116 tusb_set_power(0); 118 117 119 118 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, ··· 493 494 494 495 static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; 495 496 496 - static void __init n8x0_mmc_init(void) 497 + static struct gpio n810_emmc_gpios[] __initdata = { 498 + { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" }, 499 + { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" }, 500 + }; 497 501 502 + static void __init n8x0_mmc_init(void) 498 503 { 499 504 int err; 500 505 ··· 515 512 mmc1_data.slots[1].ban_openended = 1; 516 513 } 517 514 518 - err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); 515 + err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW, 516 + "MMC slot switch"); 519 517 if (err) 520 518 return; 521 519 522 - gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0); 523 - 524 520 if (machine_is_nokia_n810()) { 525 - err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); 521 + err = gpio_request_array(n810_emmc_gpios, 522 + ARRAY_SIZE(n810_emmc_gpios)); 526 523 if (err) { 527 524 gpio_free(N8X0_SLOT_SWITCH_GPIO); 528 525 return; 529 526 } 530 - gpio_direction_output(N810_EMMC_VSD_GPIO, 0); 531 - 532 - err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd"); 533 - if (err) { 534 - gpio_free(N8X0_SLOT_SWITCH_GPIO); 535 - gpio_free(N810_EMMC_VSD_GPIO); 536 - return; 537 - } 538 - gpio_direction_output(N810_EMMC_VIO_GPIO, 0); 539 527 } 540 528 541 529 mmc_data[0] = &mmc1_data;
+50 -144
arch/arm/mach-omap2/board-omap3beagle.c
··· 52 52 #include "hsmmc.h" 53 53 #include "timer-gp.h" 54 54 #include "pm.h" 55 + #include "common-board-devices.h" 55 56 56 57 #define NAND_BLOCK_SIZE SZ_128K 57 58 ··· 80 79 return omap3_beagle_version; 81 80 } 82 81 82 + static struct gpio omap3_beagle_rev_gpios[] __initdata = { 83 + { 171, GPIOF_IN, "rev_id_0" }, 84 + { 172, GPIOF_IN, "rev_id_1" }, 85 + { 173, GPIOF_IN, "rev_id_2" }, 86 + }; 87 + 83 88 static void __init omap3_beagle_init_rev(void) 84 89 { 85 90 int ret; ··· 95 88 omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP); 96 89 omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP); 97 90 98 - ret = gpio_request(171, "rev_id_0"); 99 - if (ret < 0) 100 - goto fail0; 101 - 102 - ret = gpio_request(172, "rev_id_1"); 103 - if (ret < 0) 104 - goto fail1; 105 - 106 - ret = gpio_request(173, "rev_id_2"); 107 - if (ret < 0) 108 - goto fail2; 109 - 110 - gpio_direction_input(171); 111 - gpio_direction_input(172); 112 - gpio_direction_input(173); 91 + ret = gpio_request_array(omap3_beagle_rev_gpios, 92 + ARRAY_SIZE(omap3_beagle_rev_gpios)); 93 + if (ret < 0) { 94 + printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); 95 + omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; 96 + return; 97 + } 113 98 114 99 beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1) 115 100 | (gpio_get_value(173) << 2); ··· 127 128 printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev); 128 129 omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; 129 130 } 130 - 131 - return; 132 - 133 - fail2: 134 - gpio_free(172); 135 - fail1: 136 - gpio_free(171); 137 - fail0: 138 - printk(KERN_ERR "Unable to get revision detection GPIO pins\n"); 139 - omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN; 140 - 141 - return; 142 131 } 143 132 144 133 static struct mtd_partition omap3beagle_nand_partitions[] = { ··· 158 171 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 159 172 .size = MTDPART_SIZ_FULL, 160 173 }, 161 - }; 162 - 163 - static struct omap_nand_platform_data omap3beagle_nand_data = { 164 - .options = NAND_BUSWIDTH_16, 165 - .parts = omap3beagle_nand_partitions, 166 - .nr_parts = ARRAY_SIZE(omap3beagle_nand_partitions), 167 - .dma_channel = -1, /* disable DMA in OMAP NAND driver */ 168 - .nand_setup = NULL, 169 - .dev_ready = NULL, 170 174 }; 171 175 172 176 /* DSS */ ··· 221 243 { 222 244 int r; 223 245 224 - r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); 225 - if (r < 0) { 246 + r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW, 247 + "DVI reset"); 248 + if (r < 0) 226 249 printk(KERN_ERR "Unable to get DVI reset GPIO\n"); 227 - return; 228 - } 229 - 230 - gpio_direction_output(beagle_dvi_device.reset_gpio, 0); 231 250 } 232 251 233 252 #include "sdram-micron-mt46h32m32lf-6.h" ··· 251 276 static int beagle_twl_gpio_setup(struct device *dev, 252 277 unsigned gpio, unsigned ngpio) 253 278 { 254 - int r; 279 + int r, usb_pwr_level; 255 280 256 281 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 257 282 mmc[0].gpio_wp = -EINVAL; ··· 270 295 beagle_vmmc1_supply.dev = mmc[0].dev; 271 296 beagle_vsim_supply.dev = mmc[0].dev; 272 297 273 - /* REVISIT: need ehci-omap hooks for external VBUS 274 - * power switch and overcurrent detect 275 - */ 276 - if (omap3_beagle_get_rev() != OMAP3BEAGLE_BOARD_XM) { 277 - r = gpio_request(gpio + 1, "EHCI_nOC"); 278 - if (!r) { 279 - r = gpio_direction_input(gpio + 1); 280 - if (r) 281 - gpio_free(gpio + 1); 282 - } 283 - if (r) 284 - pr_err("%s: unable to configure EHCI_nOC\n", __func__); 285 - } 286 - 287 298 /* 288 299 * TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, XM active 289 300 * high / others active low) 290 - */ 291 - gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); 292 - if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) 293 - gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); 294 - else 295 - gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 296 - 297 - /* DVI reset GPIO is different between beagle revisions */ 298 - if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) 299 - beagle_dvi_device.reset_gpio = 129; 300 - else 301 - beagle_dvi_device.reset_gpio = 170; 302 - 303 - /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 304 - gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 305 - 306 - /* 307 - * gpio + 1 on Xm controls the TFP410's enable line (active low) 308 - * gpio + 2 control varies depending on the board rev as follows: 309 - * P7/P8 revisions(prototype): Camera EN 310 - * A2+ revisions (production): LDO (supplies DVI, serial, led blocks) 301 + * DVI reset GPIO is different between beagle revisions 311 302 */ 312 303 if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM) { 313 - r = gpio_request(gpio + 1, "nDVI_PWR_EN"); 314 - if (!r) { 315 - r = gpio_direction_output(gpio + 1, 0); 316 - if (r) 317 - gpio_free(gpio + 1); 318 - } 304 + usb_pwr_level = GPIOF_OUT_INIT_HIGH; 305 + beagle_dvi_device.reset_gpio = 129; 306 + /* 307 + * gpio + 1 on Xm controls the TFP410's enable line (active low) 308 + * gpio + 2 control varies depending on the board rev as below: 309 + * P7/P8 revisions(prototype): Camera EN 310 + * A2+ revisions (production): LDO (DVI, serial, led blocks) 311 + */ 312 + r = gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW, 313 + "nDVI_PWR_EN"); 319 314 if (r) 320 315 pr_err("%s: unable to configure nDVI_PWR_EN\n", 321 316 __func__); 322 - r = gpio_request(gpio + 2, "DVI_LDO_EN"); 323 - if (!r) { 324 - r = gpio_direction_output(gpio + 2, 1); 325 - if (r) 326 - gpio_free(gpio + 2); 327 - } 317 + r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, 318 + "DVI_LDO_EN"); 328 319 if (r) 329 320 pr_err("%s: unable to configure DVI_LDO_EN\n", 330 321 __func__); 322 + } else { 323 + usb_pwr_level = GPIOF_OUT_INIT_LOW; 324 + beagle_dvi_device.reset_gpio = 170; 325 + /* 326 + * REVISIT: need ehci-omap hooks for external VBUS 327 + * power switch and overcurrent detect 328 + */ 329 + if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC")) 330 + pr_err("%s: unable to configure EHCI_nOC\n", __func__); 331 331 } 332 + 333 + gpio_request_one(gpio + TWL4030_GPIO_MAX, usb_pwr_level, "nEN_USB_PWR"); 334 + 335 + /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 336 + gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 332 337 333 338 return 0; 334 339 } ··· 408 453 .vpll2 = &beagle_vpll2, 409 454 }; 410 455 411 - static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { 412 - { 413 - I2C_BOARD_INFO("twl4030", 0x48), 414 - .flags = I2C_CLIENT_WAKE, 415 - .irq = INT_34XX_SYS_NIRQ, 416 - .platform_data = &beagle_twldata, 417 - }, 418 - }; 419 - 420 456 static struct i2c_board_info __initdata beagle_i2c_eeprom[] = { 421 457 { 422 458 I2C_BOARD_INFO("eeprom", 0x50), ··· 416 470 417 471 static int __init omap3_beagle_i2c_init(void) 418 472 { 419 - omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, 420 - ARRAY_SIZE(beagle_i2c_boardinfo)); 473 + omap3_pmic_init("twl4030", &beagle_twldata); 421 474 /* Bus 3 is attached to the DVI port where devices like the pico DLP 422 475 * projector don't work reliably with 400kHz */ 423 476 omap_register_i2c_bus(3, 100, beagle_i2c_eeprom, ARRAY_SIZE(beagle_i2c_eeprom)); ··· 496 551 &keys_gpio, 497 552 }; 498 553 499 - static void __init omap3beagle_flash_init(void) 500 - { 501 - u8 cs = 0; 502 - u8 nandcs = GPMC_CS_NUM + 1; 503 - 504 - /* find out the chip-select on which NAND exists */ 505 - while (cs < GPMC_CS_NUM) { 506 - u32 ret = 0; 507 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 508 - 509 - if ((ret & 0xC00) == 0x800) { 510 - printk(KERN_INFO "Found NAND on CS%d\n", cs); 511 - if (nandcs > GPMC_CS_NUM) 512 - nandcs = cs; 513 - } 514 - cs++; 515 - } 516 - 517 - if (nandcs > GPMC_CS_NUM) { 518 - printk(KERN_INFO "NAND: Unable to find configuration " 519 - "in GPMC\n "); 520 - return; 521 - } 522 - 523 - if (nandcs < GPMC_CS_NUM) { 524 - omap3beagle_nand_data.cs = nandcs; 525 - 526 - printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); 527 - if (gpmc_nand_init(&omap3beagle_nand_data) < 0) 528 - printk(KERN_ERR "Unable to register NAND device\n"); 529 - } 530 - } 531 - 532 554 static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 533 555 534 556 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, ··· 513 601 { .reg_offset = OMAP_MUX_TERMINATOR }, 514 602 }; 515 603 #endif 516 - 517 - static struct omap_musb_board_data musb_board_data = { 518 - .interface_type = MUSB_INTERFACE_ULPI, 519 - .mode = MUSB_OTG, 520 - .power = 100, 521 - }; 522 604 523 605 static void __init beagle_opp_init(void) 524 606 { ··· 571 665 omap_serial_init(); 572 666 573 667 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 574 - gpio_request(170, "DVI_nPD"); 575 668 /* REVISIT leave DVI powered down until it's needed ... */ 576 - gpio_direction_output(170, true); 669 + gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); 577 670 578 - usb_musb_init(&musb_board_data); 671 + usb_musb_init(NULL); 579 672 usbhs_init(&usbhs_bdata); 580 - omap3beagle_flash_init(); 673 + omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions, 674 + ARRAY_SIZE(omap3beagle_nand_partitions)); 581 675 582 676 /* Ensure SDRC pins are mux'd for self-refresh */ 583 677 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
+44 -198
arch/arm/mach-omap2/board-omap3evm.c
··· 50 50 #include "mux.h" 51 51 #include "sdram-micron-mt46h32m32lf-6.h" 52 52 #include "hsmmc.h" 53 + #include "common-board-devices.h" 53 54 54 55 #define OMAP3_EVM_TS_GPIO 175 55 56 #define OMAP3_EVM_EHCI_VBUS 22 ··· 102 101 } 103 102 104 103 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 105 - static struct resource omap3evm_smsc911x_resources[] = { 106 - [0] = { 107 - .start = OMAP3EVM_ETHR_START, 108 - .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), 109 - .flags = IORESOURCE_MEM, 110 - }, 111 - [1] = { 112 - .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), 113 - .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), 114 - .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), 115 - }, 116 - }; 104 + #include <plat/gpmc-smsc911x.h> 117 105 118 - static struct smsc911x_platform_config smsc911x_config = { 119 - .phy_interface = PHY_INTERFACE_MODE_MII, 120 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 121 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 122 - .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 123 - }; 124 - 125 - static struct platform_device omap3evm_smsc911x_device = { 126 - .name = "smsc911x", 127 - .id = -1, 128 - .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), 129 - .resource = &omap3evm_smsc911x_resources[0], 130 - .dev = { 131 - .platform_data = &smsc911x_config, 132 - }, 106 + static struct omap_smsc911x_platform_data smsc911x_cfg = { 107 + .cs = OMAP3EVM_SMSC911X_CS, 108 + .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ, 109 + .gpio_reset = -EINVAL, 110 + .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 133 111 }; 134 112 135 113 static inline void __init omap3evm_init_smsc911x(void) 136 114 { 137 - int eth_cs, eth_rst; 138 115 struct clk *l3ck; 139 116 unsigned int rate; 140 - 141 - if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) 142 - eth_rst = OMAP3EVM_GEN1_ETHR_GPIO_RST; 143 - else 144 - eth_rst = OMAP3EVM_GEN2_ETHR_GPIO_RST; 145 - 146 - eth_cs = OMAP3EVM_SMSC911X_CS; 147 117 148 118 l3ck = clk_get(NULL, "l3_ck"); 149 119 if (IS_ERR(l3ck)) ··· 124 152 125 153 /* Configure ethernet controller reset gpio */ 126 154 if (cpu_is_omap3430()) { 127 - if (gpio_request(eth_rst, "SMSC911x gpio") < 0) { 128 - pr_err(KERN_ERR "Failed to request %d for smsc911x\n", 129 - eth_rst); 130 - return; 131 - } 132 - 133 - if (gpio_direction_output(eth_rst, 1) < 0) { 134 - pr_err(KERN_ERR "Failed to set direction of %d for" \ 135 - " smsc911x\n", eth_rst); 136 - return; 137 - } 138 - /* reset pulse to ethernet controller*/ 139 - usleep_range(150, 220); 140 - gpio_set_value(eth_rst, 0); 141 - usleep_range(150, 220); 142 - gpio_set_value(eth_rst, 1); 143 - usleep_range(1, 2); 155 + if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) 156 + smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST; 157 + else 158 + smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST; 144 159 } 145 160 146 - if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { 147 - printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 148 - OMAP3EVM_ETHR_GPIO_IRQ); 149 - return; 150 - } 151 - 152 - gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 153 - platform_device_register(&omap3evm_smsc911x_device); 161 + gpmc_smsc911x_init(&smsc911x_cfg); 154 162 } 155 163 156 164 #else ··· 149 197 #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 150 198 #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 151 199 200 + static struct gpio omap3_evm_dss_gpios[] __initdata = { 201 + { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" }, 202 + { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" }, 203 + { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" }, 204 + { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" }, 205 + { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" }, 206 + { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" }, 207 + }; 208 + 152 209 static int lcd_enabled; 153 210 static int dvi_enabled; 154 211 ··· 165 204 { 166 205 int r; 167 206 168 - r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); 169 - if (r) { 170 - printk(KERN_ERR "failed to get lcd_panel_resb\n"); 171 - return; 172 - } 173 - gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1); 174 - 175 - r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini"); 176 - if (r) { 177 - printk(KERN_ERR "failed to get lcd_panel_ini\n"); 178 - goto err_1; 179 - } 180 - gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1); 181 - 182 - r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga"); 183 - if (r) { 184 - printk(KERN_ERR "failed to get lcd_panel_qvga\n"); 185 - goto err_2; 186 - } 187 - gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0); 188 - 189 - r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr"); 190 - if (r) { 191 - printk(KERN_ERR "failed to get lcd_panel_lr\n"); 192 - goto err_3; 193 - } 194 - gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1); 195 - 196 - r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud"); 197 - if (r) { 198 - printk(KERN_ERR "failed to get lcd_panel_ud\n"); 199 - goto err_4; 200 - } 201 - gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1); 202 - 203 - r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd"); 204 - if (r) { 205 - printk(KERN_ERR "failed to get lcd_panel_envdd\n"); 206 - goto err_5; 207 - } 208 - gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0); 209 - 210 - return; 211 - 212 - err_5: 213 - gpio_free(OMAP3EVM_LCD_PANEL_UD); 214 - err_4: 215 - gpio_free(OMAP3EVM_LCD_PANEL_LR); 216 - err_3: 217 - gpio_free(OMAP3EVM_LCD_PANEL_QVGA); 218 - err_2: 219 - gpio_free(OMAP3EVM_LCD_PANEL_INI); 220 - err_1: 221 - gpio_free(OMAP3EVM_LCD_PANEL_RESB); 222 - 207 + r = gpio_request_array(omap3_evm_dss_gpios, 208 + ARRAY_SIZE(omap3_evm_dss_gpios)); 209 + if (r) 210 + printk(KERN_ERR "failed to get lcd_panel_* gpios\n"); 223 211 } 224 212 225 213 static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) ··· 358 448 static int omap3evm_twl_gpio_setup(struct device *dev, 359 449 unsigned gpio, unsigned ngpio) 360 450 { 361 - int r; 451 + int r, lcd_bl_en; 362 452 363 453 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 364 454 omap_mux_init_gpio(63, OMAP_PIN_INPUT); ··· 375 465 */ 376 466 377 467 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 378 - r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 379 - if (!r) 380 - r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, 381 - (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0); 468 + lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ? 469 + GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; 470 + r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL"); 382 471 if (r) 383 472 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); 384 473 385 474 /* gpio + 7 == DVI Enable */ 386 - gpio_request(gpio + 7, "EN_DVI"); 387 - gpio_direction_output(gpio + 7, 0); 475 + gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); 388 476 389 477 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 390 478 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; ··· 560 652 .vdac = &omap3_evm_vdac, 561 653 .vpll2 = &omap3_evm_vpll2, 562 654 .vio = &omap3evm_vio, 563 - }; 564 - 565 - static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { 566 - { 567 - I2C_BOARD_INFO("twl4030", 0x48), 568 - .flags = I2C_CLIENT_WAKE, 569 - .irq = INT_34XX_SYS_NIRQ, 570 - .platform_data = &omap3evm_twldata, 571 - }, 655 + .vmmc1 = &omap3evm_vmmc1, 656 + .vsim = &omap3evm_vsim, 572 657 }; 573 658 574 659 static int __init omap3_evm_i2c_init(void) 575 660 { 576 - /* 577 - * REVISIT: These entries can be set in omap3evm_twl_data 578 - * after a merge with MFD tree 579 - */ 580 - omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; 581 - omap3evm_twldata.vsim = &omap3evm_vsim; 582 - 583 - omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, 584 - ARRAY_SIZE(omap3evm_i2c_boardinfo)); 661 + omap3_pmic_init("twl4030", &omap3evm_twldata); 585 662 omap_register_i2c_bus(2, 400, NULL, 0); 586 663 omap_register_i2c_bus(3, 400, NULL, 0); 587 664 return 0; 588 665 } 589 - 590 - static void ads7846_dev_init(void) 591 - { 592 - if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) 593 - printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); 594 - 595 - gpio_direction_input(OMAP3_EVM_TS_GPIO); 596 - gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310); 597 - } 598 - 599 - static int ads7846_get_pendown_state(void) 600 - { 601 - return !gpio_get_value(OMAP3_EVM_TS_GPIO); 602 - } 603 - 604 - static struct ads7846_platform_data ads7846_config = { 605 - .x_max = 0x0fff, 606 - .y_max = 0x0fff, 607 - .x_plate_ohms = 180, 608 - .pressure_max = 255, 609 - .debounce_max = 10, 610 - .debounce_tol = 3, 611 - .debounce_rep = 1, 612 - .get_pendown_state = ads7846_get_pendown_state, 613 - .keep_vref_on = 1, 614 - .settle_delay_usecs = 150, 615 - .wakeup = true, 616 - }; 617 - 618 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 619 - .turbo_mode = 0, 620 - .single_channel = 1, /* 0: slave, 1: master */ 621 - }; 622 - 623 - static struct spi_board_info omap3evm_spi_board_info[] = { 624 - [0] = { 625 - .modalias = "ads7846", 626 - .bus_num = 1, 627 - .chip_select = 0, 628 - .max_speed_hz = 1500000, 629 - .controller_data = &ads7846_mcspi_config, 630 - .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), 631 - .platform_data = &ads7846_config, 632 - }, 633 - }; 634 666 635 667 static struct omap_board_config_kernel omap3_evm_config[] __initdata = { 636 668 }; ··· 673 825 .power = 100, 674 826 }; 675 827 828 + static struct gpio omap3_evm_ehci_gpios[] __initdata = { 829 + { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" }, 830 + { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" }, 831 + }; 832 + 676 833 static void __init omap3_evm_init(void) 677 834 { 678 835 omap3_evm_get_revision(); ··· 694 841 695 842 omap_display_init(&omap3_evm_dss_data); 696 843 697 - spi_register_board_info(omap3evm_spi_board_info, 698 - ARRAY_SIZE(omap3evm_spi_board_info)); 699 - 700 844 omap_serial_init(); 701 845 702 846 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ ··· 701 851 702 852 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { 703 853 /* enable EHCI VBUS using GPIO22 */ 704 - omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); 705 - gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); 706 - gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); 707 - gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); 708 - 854 + omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP); 709 855 /* Select EHCI port on main board */ 710 - omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); 711 - gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); 712 - gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); 713 - gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); 856 + omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT, 857 + OMAP_PIN_INPUT_PULLUP); 858 + gpio_request_array(omap3_evm_ehci_gpios, 859 + ARRAY_SIZE(omap3_evm_ehci_gpios)); 714 860 715 861 /* setup EHCI phy reset config */ 716 862 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); ··· 722 876 } 723 877 usb_musb_init(&musb_board_data); 724 878 usbhs_init(&usbhs_bdata); 725 - ads7846_dev_init(); 879 + omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL); 726 880 omap3evm_init_smsc911x(); 727 881 omap3_evm_display_init(); 728 882
+2 -12
arch/arm/mach-omap2/board-omap3logic.c
··· 37 37 #include "hsmmc.h" 38 38 #include "timer-gp.h" 39 39 #include "control.h" 40 + #include "common-board-devices.h" 40 41 41 42 #include <plat/mux.h> 42 43 #include <plat/board.h> ··· 94 93 .vmmc1 = &omap3logic_vmmc1, 95 94 }; 96 95 97 - static struct i2c_board_info __initdata omap3logic_i2c_boardinfo[] = { 98 - { 99 - I2C_BOARD_INFO("twl4030", 0x48), 100 - .flags = I2C_CLIENT_WAKE, 101 - .irq = INT_34XX_SYS_NIRQ, 102 - .platform_data = &omap3logic_twldata, 103 - }, 104 - }; 105 - 106 96 static int __init omap3logic_i2c_init(void) 107 97 { 108 - omap_register_i2c_bus(1, 2600, omap3logic_i2c_boardinfo, 109 - ARRAY_SIZE(omap3logic_i2c_boardinfo)); 98 + omap3_pmic_init("twl4030", &omap3logic_twldata); 110 99 return 0; 111 100 } 112 101 ··· 138 147 .cs = OMAP3LOGIC_SMSC911X_CS, 139 148 .gpio_irq = -EINVAL, 140 149 .gpio_reset = -EINVAL, 141 - .flags = IORESOURCE_IRQ_LOWLEVEL, 142 150 }; 143 151 144 152 /* TODO/FIXME (comment by Peter Barada, LogicPD):
+7 -83
arch/arm/mach-omap2/board-omap3pandora.c
··· 22 22 #include <linux/platform_device.h> 23 23 24 24 #include <linux/spi/spi.h> 25 - #include <linux/spi/ads7846.h> 26 25 #include <linux/regulator/machine.h> 27 26 #include <linux/i2c/twl.h> 28 27 #include <linux/wl12xx.h> ··· 51 52 #include "mux.h" 52 53 #include "sdram-micron-mt46h32m32lf-6.h" 53 54 #include "hsmmc.h" 55 + #include "common-board-devices.h" 54 56 55 57 #define PANDORA_WIFI_IRQ_GPIO 21 56 58 #define PANDORA_WIFI_NRESET_GPIO 23 ··· 305 305 306 306 /* gpio + 13 drives 32kHz buffer for wifi module */ 307 307 gpio_32khz = gpio + 13; 308 - ret = gpio_request(gpio_32khz, "wifi 32kHz"); 308 + ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz"); 309 309 if (ret < 0) { 310 310 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret); 311 - goto fail; 312 - } 313 - 314 - ret = gpio_direction_output(gpio_32khz, 1); 315 - if (ret < 0) { 316 - pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret); 317 - goto fail_direction; 311 + return -ENODEV; 318 312 } 319 313 320 314 return 0; 321 - 322 - fail_direction: 323 - gpio_free(gpio_32khz); 324 - fail: 325 - return -ENODEV; 326 315 } 327 316 328 317 static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { ··· 533 544 .bci = &pandora_bci_data, 534 545 }; 535 546 536 - static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = { 537 - { 538 - I2C_BOARD_INFO("tps65950", 0x48), 539 - .flags = I2C_CLIENT_WAKE, 540 - .irq = INT_34XX_SYS_NIRQ, 541 - .platform_data = &omap3pandora_twldata, 542 - }, 543 - }; 544 - 545 547 static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { 546 548 { 547 549 I2C_BOARD_INFO("bq27500", 0x55), ··· 542 562 543 563 static int __init omap3pandora_i2c_init(void) 544 564 { 545 - omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, 546 - ARRAY_SIZE(omap3pandora_i2c_boardinfo)); 565 + omap3_pmic_init("tps65950", &omap3pandora_twldata); 547 566 /* i2c2 pins are not connected */ 548 567 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo, 549 568 ARRAY_SIZE(omap3pandora_i2c3_boardinfo)); 550 569 return 0; 551 570 } 552 571 553 - static void __init omap3pandora_ads7846_init(void) 554 - { 555 - int gpio = OMAP3_PANDORA_TS_GPIO; 556 - int ret; 557 - 558 - ret = gpio_request(gpio, "ads7846_pen_down"); 559 - if (ret < 0) { 560 - printk(KERN_ERR "Failed to request GPIO %d for " 561 - "ads7846 pen down IRQ\n", gpio); 562 - return; 563 - } 564 - 565 - gpio_direction_input(gpio); 566 - } 567 - 568 - static int ads7846_get_pendown_state(void) 569 - { 570 - return !gpio_get_value(OMAP3_PANDORA_TS_GPIO); 571 - } 572 - 573 - static struct ads7846_platform_data ads7846_config = { 574 - .x_max = 0x0fff, 575 - .y_max = 0x0fff, 576 - .x_plate_ohms = 180, 577 - .pressure_max = 255, 578 - .debounce_max = 10, 579 - .debounce_tol = 3, 580 - .debounce_rep = 1, 581 - .get_pendown_state = ads7846_get_pendown_state, 582 - .keep_vref_on = 1, 583 - }; 584 - 585 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 586 - .turbo_mode = 0, 587 - .single_channel = 1, /* 0: slave, 1: master */ 588 - }; 589 - 590 572 static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { 591 573 { 592 - .modalias = "ads7846", 593 - .bus_num = 1, 594 - .chip_select = 0, 595 - .max_speed_hz = 1500000, 596 - .controller_data = &ads7846_mcspi_config, 597 - .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO), 598 - .platform_data = &ads7846_config, 599 - }, { 600 574 .modalias = "tpo_td043mtea1_panel_spi", 601 575 .bus_num = 1, 602 576 .chip_select = 1, ··· 573 639 574 640 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); 575 641 576 - ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); 642 + ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq"); 577 643 if (ret < 0) 578 644 goto fail; 579 - 580 - ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO); 581 - if (ret < 0) 582 - goto fail_irq; 583 645 584 646 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); 585 647 if (pandora_wl1251_pdata.irq < 0) ··· 618 688 }; 619 689 #endif 620 690 621 - static struct omap_musb_board_data musb_board_data = { 622 - .interface_type = MUSB_INTERFACE_ULPI, 623 - .mode = MUSB_OTG, 624 - .power = 100, 625 - }; 626 - 627 691 static void __init omap3pandora_init(void) 628 692 { 629 693 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); ··· 629 705 omap_serial_init(); 630 706 spi_register_board_info(omap3pandora_spi_board_info, 631 707 ARRAY_SIZE(omap3pandora_spi_board_info)); 632 - omap3pandora_ads7846_init(); 708 + omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 0, NULL); 633 709 usbhs_init(&usbhs_bdata); 634 - usb_musb_init(&musb_board_data); 710 + usb_musb_init(NULL); 635 711 gpmc_nand_init(&pandora_nand_data); 636 712 637 713 /* Ensure SDRC pins are mux'd for self-refresh */
+16 -117
arch/arm/mach-omap2/board-omap3stalker.c
··· 45 45 #include <plat/mcspi.h> 46 46 #include <linux/input/matrix_keypad.h> 47 47 #include <linux/spi/spi.h> 48 - #include <linux/spi/ads7846.h> 49 48 #include <linux/interrupt.h> 50 49 #include <linux/smsc911x.h> 51 50 #include <linux/i2c/at24.h> ··· 53 54 #include "mux.h" 54 55 #include "hsmmc.h" 55 56 #include "timer-gp.h" 57 + #include "common-board-devices.h" 56 58 57 59 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 60 + #include <plat/gpmc-smsc911x.h> 61 + 58 62 #define OMAP3STALKER_ETHR_START 0x2c000000 59 63 #define OMAP3STALKER_ETHR_SIZE 1024 60 64 #define OMAP3STALKER_ETHR_GPIO_IRQ 19 61 65 #define OMAP3STALKER_SMC911X_CS 5 62 66 63 - static struct resource omap3stalker_smsc911x_resources[] = { 64 - [0] = { 65 - .start = OMAP3STALKER_ETHR_START, 66 - .end = 67 - (OMAP3STALKER_ETHR_START + OMAP3STALKER_ETHR_SIZE - 1), 68 - .flags = IORESOURCE_MEM, 69 - }, 70 - [1] = { 71 - .start = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), 72 - .end = OMAP_GPIO_IRQ(OMAP3STALKER_ETHR_GPIO_IRQ), 73 - .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), 74 - }, 75 - }; 76 - 77 - static struct smsc911x_platform_config smsc911x_config = { 78 - .phy_interface = PHY_INTERFACE_MODE_MII, 79 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 80 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 67 + static struct omap_smsc911x_platform_data smsc911x_cfg = { 68 + .cs = OMAP3STALKER_SMC911X_CS, 69 + .gpio_irq = OMAP3STALKER_ETHR_GPIO_IRQ, 70 + .gpio_reset = -EINVAL, 81 71 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), 82 - }; 83 - 84 - static struct platform_device omap3stalker_smsc911x_device = { 85 - .name = "smsc911x", 86 - .id = -1, 87 - .num_resources = ARRAY_SIZE(omap3stalker_smsc911x_resources), 88 - .resource = &omap3stalker_smsc911x_resources[0], 89 - .dev = { 90 - .platform_data = &smsc911x_config, 91 - }, 92 72 }; 93 73 94 74 static inline void __init omap3stalker_init_eth(void) 95 75 { 96 - int eth_cs; 97 76 struct clk *l3ck; 98 77 unsigned int rate; 99 - 100 - eth_cs = OMAP3STALKER_SMC911X_CS; 101 78 102 79 l3ck = clk_get(NULL, "l3_ck"); 103 80 if (IS_ERR(l3ck)) ··· 82 107 rate = clk_get_rate(l3ck); 83 108 84 109 omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); 85 - if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) { 86 - printk(KERN_ERR 87 - "Failed to request GPIO%d for smc911x IRQ\n", 88 - OMAP3STALKER_ETHR_GPIO_IRQ); 89 - return; 90 - } 91 - 92 - gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ); 93 - 94 - platform_device_register(&omap3stalker_smsc911x_device); 110 + gpmc_smsc911x_init(&smsc911x_cfg); 95 111 } 96 112 97 113 #else ··· 331 365 */ 332 366 333 367 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 334 - gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 335 - gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 368 + gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, 369 + "EN_LCD_BKL"); 336 370 337 371 /* gpio + 7 == DVI Enable */ 338 - gpio_request(gpio + 7, "EN_DVI"); 339 - gpio_direction_output(gpio + 7, 0); 372 + gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); 340 373 341 374 /* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */ 342 375 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; ··· 454 489 .codec = &omap3stalker_codec_data, 455 490 .vdac = &omap3_stalker_vdac, 456 491 .vpll2 = &omap3_stalker_vpll2, 457 - }; 458 - 459 - static struct i2c_board_info __initdata omap3stalker_i2c_boardinfo[] = { 460 - { 461 - I2C_BOARD_INFO("twl4030", 0x48), 462 - .flags = I2C_CLIENT_WAKE, 463 - .irq = INT_34XX_SYS_NIRQ, 464 - .platform_data = &omap3stalker_twldata, 465 - }, 492 + .vmmc1 = &omap3stalker_vmmc1, 493 + .vsim = &omap3stalker_vsim, 466 494 }; 467 495 468 496 static struct at24_platform_data fram_info = { ··· 474 516 475 517 static int __init omap3_stalker_i2c_init(void) 476 518 { 477 - /* 478 - * REVISIT: These entries can be set in omap3evm_twl_data 479 - * after a merge with MFD tree 480 - */ 481 - omap3stalker_twldata.vmmc1 = &omap3stalker_vmmc1; 482 - omap3stalker_twldata.vsim = &omap3stalker_vsim; 483 - 484 - omap_register_i2c_bus(1, 2600, omap3stalker_i2c_boardinfo, 485 - ARRAY_SIZE(omap3stalker_i2c_boardinfo)); 519 + omap3_pmic_init("twl4030", &omap3stalker_twldata); 486 520 omap_register_i2c_bus(2, 400, NULL, 0); 487 521 omap_register_i2c_bus(3, 400, omap3stalker_i2c_boardinfo3, 488 522 ARRAY_SIZE(omap3stalker_i2c_boardinfo3)); ··· 482 532 } 483 533 484 534 #define OMAP3_STALKER_TS_GPIO 175 485 - static void ads7846_dev_init(void) 486 - { 487 - if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0) 488 - printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); 489 - 490 - gpio_direction_input(OMAP3_STALKER_TS_GPIO); 491 - gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310); 492 - } 493 - 494 - static int ads7846_get_pendown_state(void) 495 - { 496 - return !gpio_get_value(OMAP3_STALKER_TS_GPIO); 497 - } 498 - 499 - static struct ads7846_platform_data ads7846_config = { 500 - .x_max = 0x0fff, 501 - .y_max = 0x0fff, 502 - .x_plate_ohms = 180, 503 - .pressure_max = 255, 504 - .debounce_max = 10, 505 - .debounce_tol = 3, 506 - .debounce_rep = 1, 507 - .get_pendown_state = ads7846_get_pendown_state, 508 - .keep_vref_on = 1, 509 - .settle_delay_usecs = 150, 510 - }; 511 - 512 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 513 - .turbo_mode = 0, 514 - .single_channel = 1, /* 0: slave, 1: master */ 515 - }; 516 - 517 - static struct spi_board_info omap3stalker_spi_board_info[] = { 518 - [0] = { 519 - .modalias = "ads7846", 520 - .bus_num = 1, 521 - .chip_select = 0, 522 - .max_speed_hz = 1500000, 523 - .controller_data = &ads7846_mcspi_config, 524 - .irq = OMAP_GPIO_IRQ(OMAP3_STALKER_TS_GPIO), 525 - .platform_data = &ads7846_config, 526 - }, 527 - }; 528 535 529 536 static struct omap_board_config_kernel omap3_stalker_config[] __initdata = { 530 537 }; ··· 525 618 }; 526 619 #endif 527 620 528 - static struct omap_musb_board_data musb_board_data = { 529 - .interface_type = MUSB_INTERFACE_ULPI, 530 - .mode = MUSB_OTG, 531 - .power = 100, 532 - }; 533 - 534 621 static void __init omap3_stalker_init(void) 535 622 { 536 623 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); ··· 537 636 ARRAY_SIZE(omap3_stalker_devices)); 538 637 539 638 omap_display_init(&omap3_stalker_dss_data); 540 - spi_register_board_info(omap3stalker_spi_board_info, 541 - ARRAY_SIZE(omap3stalker_spi_board_info)); 542 639 543 640 omap_serial_init(); 544 - usb_musb_init(&musb_board_data); 641 + usb_musb_init(NULL); 545 642 usbhs_init(&usbhs_bdata); 546 - ads7846_dev_init(); 643 + omap_ads7846_init(1, OMAP3_STALKER_TS_GPIO, 310, NULL); 547 644 548 645 omap_mux_init_gpio(21, OMAP_PIN_OUTPUT); 549 646 omap_mux_init_gpio(18, OMAP_PIN_INPUT_PULLUP);
+13 -108
arch/arm/mach-omap2/board-omap3touchbook.c
··· 52 52 #include "mux.h" 53 53 #include "hsmmc.h" 54 54 #include "timer-gp.h" 55 + #include "common-board-devices.h" 55 56 56 57 #include <asm/setup.h> 57 58 ··· 94 93 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ 95 94 .size = MTDPART_SIZ_FULL, 96 95 }, 97 - }; 98 - 99 - static struct omap_nand_platform_data omap3touchbook_nand_data = { 100 - .options = NAND_BUSWIDTH_16, 101 - .parts = omap3touchbook_nand_partitions, 102 - .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions), 103 - .dma_channel = -1, /* disable DMA in OMAP NAND driver */ 104 - .nand_setup = NULL, 105 - .dev_ready = NULL, 106 96 }; 107 97 108 98 #include "sdram-micron-mt46h32m32lf-6.h" ··· 146 154 /* REVISIT: need ehci-omap hooks for external VBUS 147 155 * power switch and overcurrent detect 148 156 */ 149 - 150 - gpio_request(gpio + 1, "EHCI_nOC"); 151 - gpio_direction_input(gpio + 1); 157 + gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"); 152 158 153 159 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ 154 - gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); 155 - gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 160 + gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW, 161 + "nEN_USB_PWR"); 156 162 157 163 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 158 164 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; ··· 263 273 .vpll2 = &touchbook_vpll2, 264 274 }; 265 275 266 - static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = { 267 - { 268 - I2C_BOARD_INFO("twl4030", 0x48), 269 - .flags = I2C_CLIENT_WAKE, 270 - .irq = INT_34XX_SYS_NIRQ, 271 - .platform_data = &touchbook_twldata, 272 - }, 273 - }; 274 - 275 276 static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = { 276 277 { 277 278 I2C_BOARD_INFO("bq27200", 0x55), ··· 272 291 static int __init omap3_touchbook_i2c_init(void) 273 292 { 274 293 /* Standard TouchBook bus */ 275 - omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo, 276 - ARRAY_SIZE(touchbook_i2c_boardinfo)); 294 + omap3_pmic_init("twl4030", &touchbook_twldata); 277 295 278 296 /* Additional TouchBook bus */ 279 297 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo, ··· 281 301 return 0; 282 302 } 283 303 284 - static void __init omap3_ads7846_init(void) 285 - { 286 - if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) { 287 - printk(KERN_ERR "Failed to request GPIO %d for " 288 - "ads7846 pen down IRQ\n", OMAP3_TS_GPIO); 289 - return; 290 - } 291 - 292 - gpio_direction_input(OMAP3_TS_GPIO); 293 - gpio_set_debounce(OMAP3_TS_GPIO, 310); 294 - } 295 - 296 - static struct ads7846_platform_data ads7846_config = { 304 + static struct ads7846_platform_data ads7846_pdata = { 297 305 .x_min = 100, 298 306 .y_min = 265, 299 307 .x_max = 3950, ··· 293 325 .debounce_rep = 1, 294 326 .gpio_pendown = OMAP3_TS_GPIO, 295 327 .keep_vref_on = 1, 296 - }; 297 - 298 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 299 - .turbo_mode = 0, 300 - .single_channel = 1, /* 0: slave, 1: master */ 301 - }; 302 - 303 - static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = { 304 - { 305 - .modalias = "ads7846", 306 - .bus_num = 4, 307 - .chip_select = 0, 308 - .max_speed_hz = 1500000, 309 - .controller_data = &ads7846_mcspi_config, 310 - .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO), 311 - .platform_data = &ads7846_config, 312 - } 313 328 }; 314 329 315 330 static struct gpio_led gpio_leds[] = { ··· 385 434 &keys_gpio, 386 435 }; 387 436 388 - static void __init omap3touchbook_flash_init(void) 389 - { 390 - u8 cs = 0; 391 - u8 nandcs = GPMC_CS_NUM + 1; 392 - 393 - /* find out the chip-select on which NAND exists */ 394 - while (cs < GPMC_CS_NUM) { 395 - u32 ret = 0; 396 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 397 - 398 - if ((ret & 0xC00) == 0x800) { 399 - printk(KERN_INFO "Found NAND on CS%d\n", cs); 400 - if (nandcs > GPMC_CS_NUM) 401 - nandcs = cs; 402 - } 403 - cs++; 404 - } 405 - 406 - if (nandcs > GPMC_CS_NUM) { 407 - printk(KERN_INFO "NAND: Unable to find configuration " 408 - "in GPMC\n "); 409 - return; 410 - } 411 - 412 - if (nandcs < GPMC_CS_NUM) { 413 - omap3touchbook_nand_data.cs = nandcs; 414 - 415 - printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); 416 - if (gpmc_nand_init(&omap3touchbook_nand_data) < 0) 417 - printk(KERN_ERR "Unable to register NAND device\n"); 418 - } 419 - } 420 - 421 437 static const struct usbhs_omap_board_data usbhs_bdata __initconst = { 422 438 423 439 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, ··· 399 481 400 482 static void omap3_touchbook_poweroff(void) 401 483 { 402 - int r; 484 + int pwr_off = TB_KILL_POWER_GPIO; 403 485 404 - r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset"); 405 - if (r < 0) { 486 + if (gpio_request_one(pwr_off, GPIOF_OUT_INIT_LOW, "DVI reset") < 0) 406 487 printk(KERN_ERR "Unable to get kill power GPIO\n"); 407 - return; 408 - } 409 - 410 - gpio_direction_output(TB_KILL_POWER_GPIO, 0); 411 488 } 412 489 413 490 static int __init early_touchbook_revision(char *p) ··· 413 500 return strict_strtoul(p, 10, &touchbook_revision); 414 501 } 415 502 early_param("tbr", early_touchbook_revision); 416 - 417 - static struct omap_musb_board_data musb_board_data = { 418 - .interface_type = MUSB_INTERFACE_ULPI, 419 - .mode = MUSB_OTG, 420 - .power = 100, 421 - }; 422 503 423 504 static void __init omap3_touchbook_init(void) 424 505 { ··· 428 521 omap_serial_init(); 429 522 430 523 omap_mux_init_gpio(170, OMAP_PIN_INPUT); 431 - gpio_request(176, "DVI_nPD"); 432 524 /* REVISIT leave DVI powered down until it's needed ... */ 433 - gpio_direction_output(176, true); 525 + gpio_request_one(176, GPIOF_OUT_INIT_HIGH, "DVI_nPD"); 434 526 435 527 /* Touchscreen and accelerometer */ 436 - spi_register_board_info(omap3_ads7846_spi_board_info, 437 - ARRAY_SIZE(omap3_ads7846_spi_board_info)); 438 - omap3_ads7846_init(); 439 - usb_musb_init(&musb_board_data); 528 + omap_ads7846_init(4, OMAP3_TS_GPIO, 310, &ads7846_pdata); 529 + usb_musb_init(NULL); 440 530 usbhs_init(&usbhs_bdata); 441 - omap3touchbook_flash_init(); 531 + omap_nand_flash_init(NAND_BUSWIDTH_16, omap3touchbook_nand_partitions, 532 + ARRAY_SIZE(omap3touchbook_nand_partitions)); 442 533 443 534 /* Ensure SDRC pins are mux'd for self-refresh */ 444 535 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
+23 -56
arch/arm/mach-omap2/board-omap4panda.c
··· 46 46 #include "hsmmc.h" 47 47 #include "control.h" 48 48 #include "mux.h" 49 + #include "common-board-devices.h" 49 50 50 51 #define GPIO_HUB_POWER 1 51 52 #define GPIO_HUB_NRESET 62 ··· 112 111 .reset_gpio_port[2] = -EINVAL 113 112 }; 114 113 114 + static struct gpio panda_ehci_gpios[] __initdata = { 115 + { GPIO_HUB_POWER, GPIOF_OUT_INIT_LOW, "hub_power" }, 116 + { GPIO_HUB_NRESET, GPIOF_OUT_INIT_LOW, "hub_nreset" }, 117 + }; 118 + 115 119 static void __init omap4_ehci_init(void) 116 120 { 117 121 int ret; ··· 126 120 phy_ref_clk = clk_get(NULL, "auxclk3_ck"); 127 121 if (IS_ERR(phy_ref_clk)) { 128 122 pr_err("Cannot request auxclk3\n"); 129 - goto error1; 123 + return; 130 124 } 131 125 clk_set_rate(phy_ref_clk, 19200000); 132 126 clk_enable(phy_ref_clk); 133 127 134 - /* disable the power to the usb hub prior to init */ 135 - ret = gpio_request(GPIO_HUB_POWER, "hub_power"); 128 + /* disable the power to the usb hub prior to init and reset phy+hub */ 129 + ret = gpio_request_array(panda_ehci_gpios, 130 + ARRAY_SIZE(panda_ehci_gpios)); 136 131 if (ret) { 137 - pr_err("Cannot request GPIO %d\n", GPIO_HUB_POWER); 138 - goto error1; 132 + pr_err("Unable to initialize EHCI power/reset\n"); 133 + return; 139 134 } 140 - gpio_export(GPIO_HUB_POWER, 0); 141 - gpio_direction_output(GPIO_HUB_POWER, 0); 142 - gpio_set_value(GPIO_HUB_POWER, 0); 143 135 144 - /* reset phy+hub */ 145 - ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset"); 146 - if (ret) { 147 - pr_err("Cannot request GPIO %d\n", GPIO_HUB_NRESET); 148 - goto error2; 149 - } 136 + gpio_export(GPIO_HUB_POWER, 0); 150 137 gpio_export(GPIO_HUB_NRESET, 0); 151 - gpio_direction_output(GPIO_HUB_NRESET, 0); 152 - gpio_set_value(GPIO_HUB_NRESET, 0); 153 138 gpio_set_value(GPIO_HUB_NRESET, 1); 154 139 155 140 usbhs_init(&usbhs_bdata); 156 141 157 142 /* enable power to hub */ 158 143 gpio_set_value(GPIO_HUB_POWER, 1); 159 - return; 160 - 161 - error2: 162 - gpio_free(GPIO_HUB_POWER); 163 - error1: 164 - pr_err("Unable to initialize EHCI power/reset\n"); 165 - return; 166 - 167 144 } 168 145 169 146 static struct omap_musb_board_data musb_board_data = { ··· 397 408 .usb = &omap4_usbphy_data, 398 409 }; 399 410 400 - static struct i2c_board_info __initdata omap4_panda_i2c_boardinfo[] = { 401 - { 402 - I2C_BOARD_INFO("twl6030", 0x48), 403 - .flags = I2C_CLIENT_WAKE, 404 - .irq = OMAP44XX_IRQ_SYS_1N, 405 - .platform_data = &omap4_panda_twldata, 406 - }, 407 - }; 408 - 409 411 /* 410 412 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 411 413 * is connected as I2C slave device, and can be accessed at address 0x50 ··· 409 429 410 430 static int __init omap4_panda_i2c_init(void) 411 431 { 412 - /* 413 - * Phoenix Audio IC needs I2C1 to 414 - * start with 400 KHz or less 415 - */ 416 - omap_register_i2c_bus(1, 400, omap4_panda_i2c_boardinfo, 417 - ARRAY_SIZE(omap4_panda_i2c_boardinfo)); 432 + omap4_pmic_init("twl6030", &omap4_panda_twldata); 418 433 omap_register_i2c_bus(2, 400, NULL, 0); 419 434 /* 420 435 * Bus 3 is attached to the DVI port where devices like the pico DLP ··· 626 651 OMAP_PIN_INPUT_PULLUP); 627 652 } 628 653 654 + static struct gpio panda_hdmi_gpios[] = { 655 + { HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_hpd" }, 656 + { HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, "hdmi_gpio_ls_oe" }, 657 + }; 658 + 629 659 static int omap4_panda_panel_enable_hdmi(struct omap_dss_device *dssdev) 630 660 { 631 661 int status; 632 662 633 - status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH, 634 - "hdmi_gpio_hpd"); 635 - if (status) { 636 - pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD); 637 - return status; 638 - } 639 - status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH, 640 - "hdmi_gpio_ls_oe"); 641 - if (status) { 642 - pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE); 643 - goto error1; 644 - } 645 - 646 - return 0; 647 - 648 - error1: 649 - gpio_free(HDMI_GPIO_HPD); 663 + status = gpio_request_array(panda_hdmi_gpios, 664 + ARRAY_SIZE(panda_hdmi_gpios)); 665 + if (status) 666 + pr_err("Cannot request HDMI GPIOs\n"); 650 667 651 668 return status; 652 669 }
+46 -219
arch/arm/mach-omap2/board-overo.c
··· 56 56 #include "mux.h" 57 57 #include "sdram-micron-mt46h32m32lf-6.h" 58 58 #include "hsmmc.h" 59 + #include "common-board-devices.h" 59 60 60 61 #define OVERO_GPIO_BT_XGATE 15 61 62 #define OVERO_GPIO_W2W_NRESET 16 ··· 74 73 75 74 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 76 75 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 77 - 78 - #include <linux/spi/ads7846.h> 79 - 80 - static struct omap2_mcspi_device_config ads7846_mcspi_config = { 81 - .turbo_mode = 0, 82 - .single_channel = 1, /* 0: slave, 1: master */ 83 - }; 84 - 85 - static int ads7846_get_pendown_state(void) 86 - { 87 - return !gpio_get_value(OVERO_GPIO_PENDOWN); 88 - } 89 - 90 - static struct ads7846_platform_data ads7846_config = { 91 - .x_max = 0x0fff, 92 - .y_max = 0x0fff, 93 - .x_plate_ohms = 180, 94 - .pressure_max = 255, 95 - .debounce_max = 10, 96 - .debounce_tol = 3, 97 - .debounce_rep = 1, 98 - .get_pendown_state = ads7846_get_pendown_state, 99 - .keep_vref_on = 1, 100 - }; 101 76 102 77 /* fixed regulator for ads7846 */ 103 78 static struct regulator_consumer_supply ads7846_supply = ··· 105 128 106 129 static void __init overo_ads7846_init(void) 107 130 { 108 - if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && 109 - (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) { 110 - gpio_export(OVERO_GPIO_PENDOWN, 0); 111 - } else { 112 - printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n"); 113 - return; 114 - } 115 - 131 + omap_ads7846_init(1, OVERO_GPIO_PENDOWN, 0, NULL); 116 132 platform_device_register(&vads7846_device); 117 133 } 118 134 ··· 116 146 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 117 147 118 148 #include <linux/smsc911x.h> 149 + #include <plat/gpmc-smsc911x.h> 119 150 120 - static struct resource overo_smsc911x_resources[] = { 121 - { 122 - .name = "smsc911x-memory", 123 - .flags = IORESOURCE_MEM, 124 - }, 125 - { 126 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 127 - }, 128 - }; 129 - 130 - static struct resource overo_smsc911x2_resources[] = { 131 - { 132 - .name = "smsc911x2-memory", 133 - .flags = IORESOURCE_MEM, 134 - }, 135 - { 136 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 137 - }, 138 - }; 139 - 140 - static struct smsc911x_platform_config overo_smsc911x_config = { 141 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 142 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 143 - .flags = SMSC911X_USE_32BIT , 144 - .phy_interface = PHY_INTERFACE_MODE_MII, 145 - }; 146 - 147 - static struct platform_device overo_smsc911x_device = { 148 - .name = "smsc911x", 151 + static struct omap_smsc911x_platform_data smsc911x_cfg = { 149 152 .id = 0, 150 - .num_resources = ARRAY_SIZE(overo_smsc911x_resources), 151 - .resource = overo_smsc911x_resources, 152 - .dev = { 153 - .platform_data = &overo_smsc911x_config, 154 - }, 153 + .cs = OVERO_SMSC911X_CS, 154 + .gpio_irq = OVERO_SMSC911X_GPIO, 155 + .gpio_reset = -EINVAL, 156 + .flags = SMSC911X_USE_32BIT, 155 157 }; 156 158 157 - static struct platform_device overo_smsc911x2_device = { 158 - .name = "smsc911x", 159 + static struct omap_smsc911x_platform_data smsc911x2_cfg = { 159 160 .id = 1, 160 - .num_resources = ARRAY_SIZE(overo_smsc911x2_resources), 161 - .resource = overo_smsc911x2_resources, 162 - .dev = { 163 - .platform_data = &overo_smsc911x_config, 164 - }, 161 + .cs = OVERO_SMSC911X2_CS, 162 + .gpio_irq = OVERO_SMSC911X2_GPIO, 163 + .gpio_reset = -EINVAL, 164 + .flags = SMSC911X_USE_32BIT, 165 165 }; 166 166 167 - static struct platform_device *smsc911x_devices[] = { 168 - &overo_smsc911x_device, 169 - &overo_smsc911x2_device, 170 - }; 171 - 172 - static inline void __init overo_init_smsc911x(void) 167 + static void __init overo_init_smsc911x(void) 173 168 { 174 - unsigned long cs_mem_base, cs_mem_base2; 175 - 176 - /* set up first smsc911x chip */ 177 - 178 - if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { 179 - printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); 180 - return; 181 - } 182 - 183 - overo_smsc911x_resources[0].start = cs_mem_base + 0x0; 184 - overo_smsc911x_resources[0].end = cs_mem_base + 0xff; 185 - 186 - if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && 187 - (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) { 188 - gpio_export(OVERO_SMSC911X_GPIO, 0); 189 - } else { 190 - printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n"); 191 - return; 192 - } 193 - 194 - overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); 195 - overo_smsc911x_resources[1].end = 0; 196 - 197 - /* set up second smsc911x chip */ 198 - 199 - if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) { 200 - printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n"); 201 - return; 202 - } 203 - 204 - overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0; 205 - overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff; 206 - 207 - if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) && 208 - (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) { 209 - gpio_export(OVERO_SMSC911X2_GPIO, 0); 210 - } else { 211 - printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n"); 212 - return; 213 - } 214 - 215 - overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO); 216 - overo_smsc911x2_resources[1].end = 0; 217 - 218 - platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices)); 169 + gpmc_smsc911x_init(&smsc911x_cfg); 170 + gpmc_smsc911x_init(&smsc911x2_cfg); 219 171 } 220 172 221 173 #else ··· 151 259 #define OVERO_GPIO_LCD_EN 144 152 260 #define OVERO_GPIO_LCD_BL 145 153 261 262 + static struct gpio overo_dss_gpios[] __initdata = { 263 + { OVERO_GPIO_LCD_EN, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_EN" }, 264 + { OVERO_GPIO_LCD_BL, GPIOF_OUT_INIT_HIGH, "OVERO_GPIO_LCD_BL" }, 265 + }; 266 + 154 267 static void __init overo_display_init(void) 155 268 { 156 - if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) && 157 - (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0)) 158 - gpio_export(OVERO_GPIO_LCD_EN, 0); 159 - else 160 - printk(KERN_ERR "could not obtain gpio for " 161 - "OVERO_GPIO_LCD_EN\n"); 269 + if (gpio_request_array(overo_dss_gpios, ARRAY_SIZE(overo_dss_gpios))) { 270 + printk(KERN_ERR "could not obtain DSS control GPIOs\n"); 271 + return; 272 + } 162 273 163 - if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) && 164 - (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0)) 165 - gpio_export(OVERO_GPIO_LCD_BL, 0); 166 - else 167 - printk(KERN_ERR "could not obtain gpio for " 168 - "OVERO_GPIO_LCD_BL\n"); 274 + gpio_export(OVERO_GPIO_LCD_EN, 0); 275 + gpio_export(OVERO_GPIO_LCD_BL, 0); 169 276 } 170 277 171 278 static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) ··· 302 411 .size = MTDPART_SIZ_FULL, 303 412 }, 304 413 }; 305 - 306 - static struct omap_nand_platform_data overo_nand_data = { 307 - .parts = overo_nand_partitions, 308 - .nr_parts = ARRAY_SIZE(overo_nand_partitions), 309 - .dma_channel = -1, /* disable DMA in OMAP NAND driver */ 310 - }; 311 - 312 - static void __init overo_flash_init(void) 313 - { 314 - u8 cs = 0; 315 - u8 nandcs = GPMC_CS_NUM + 1; 316 - 317 - /* find out the chip-select on which NAND exists */ 318 - while (cs < GPMC_CS_NUM) { 319 - u32 ret = 0; 320 - ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 321 - 322 - if ((ret & 0xC00) == 0x800) { 323 - printk(KERN_INFO "Found NAND on CS%d\n", cs); 324 - if (nandcs > GPMC_CS_NUM) 325 - nandcs = cs; 326 - } 327 - cs++; 328 - } 329 - 330 - if (nandcs > GPMC_CS_NUM) { 331 - printk(KERN_INFO "NAND: Unable to find configuration " 332 - "in GPMC\n "); 333 - return; 334 - } 335 - 336 - if (nandcs < GPMC_CS_NUM) { 337 - overo_nand_data.cs = nandcs; 338 - 339 - printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); 340 - if (gpmc_nand_init(&overo_nand_data) < 0) 341 - printk(KERN_ERR "Unable to register NAND device\n"); 342 - } 343 - } 344 414 345 415 static struct omap2_hsmmc_info mmc[] = { 346 416 { ··· 500 648 .vpll2 = &overo_vpll2, 501 649 }; 502 650 503 - static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { 504 - { 505 - I2C_BOARD_INFO("tps65950", 0x48), 506 - .flags = I2C_CLIENT_WAKE, 507 - .irq = INT_34XX_SYS_NIRQ, 508 - .platform_data = &overo_twldata, 509 - }, 510 - }; 511 - 512 651 static int __init overo_i2c_init(void) 513 652 { 514 - omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, 515 - ARRAY_SIZE(overo_i2c_boardinfo)); 653 + omap3_pmic_init("tps65950", &overo_twldata); 516 654 /* i2c2 pins are used for gpio */ 517 655 omap_register_i2c_bus(3, 400, NULL, 0); 518 656 return 0; 519 657 } 520 658 521 659 static struct spi_board_info overo_spi_board_info[] __initdata = { 522 - #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 523 - defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 524 - { 525 - .modalias = "ads7846", 526 - .bus_num = 1, 527 - .chip_select = 0, 528 - .max_speed_hz = 1500000, 529 - .controller_data = &ads7846_mcspi_config, 530 - .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), 531 - .platform_data = &ads7846_config, 532 - }, 533 - #endif 534 660 #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \ 535 661 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE) 536 662 { ··· 552 722 }; 553 723 #endif 554 724 555 - static struct omap_musb_board_data musb_board_data = { 556 - .interface_type = MUSB_INTERFACE_ULPI, 557 - .mode = MUSB_OTG, 558 - .power = 100, 725 + static struct gpio overo_bt_gpios[] __initdata = { 726 + { OVERO_GPIO_BT_XGATE, GPIOF_OUT_INIT_LOW, "lcd enable" }, 727 + { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, 559 728 }; 560 729 561 730 static void __init overo_init(void) 562 731 { 732 + int ret; 733 + 563 734 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 564 735 overo_i2c_init(); 565 736 omap_display_init(&overo_dss_data); 566 737 omap_serial_init(); 567 - overo_flash_init(); 568 - usb_musb_init(&musb_board_data); 738 + omap_nand_flash_init(0, overo_nand_partitions, 739 + ARRAY_SIZE(overo_nand_partitions)); 740 + usb_musb_init(NULL); 569 741 usbhs_init(&usbhs_bdata); 570 742 overo_spi_init(); 571 743 overo_ads7846_init(); ··· 580 748 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); 581 749 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); 582 750 583 - if ((gpio_request(OVERO_GPIO_W2W_NRESET, 584 - "OVERO_GPIO_W2W_NRESET") == 0) && 585 - (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { 751 + ret = gpio_request_one(OVERO_GPIO_W2W_NRESET, GPIOF_OUT_INIT_HIGH, 752 + "OVERO_GPIO_W2W_NRESET"); 753 + if (ret == 0) { 586 754 gpio_export(OVERO_GPIO_W2W_NRESET, 0); 587 755 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); 588 756 udelay(10); ··· 592 760 "OVERO_GPIO_W2W_NRESET\n"); 593 761 } 594 762 595 - if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && 596 - (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) 763 + ret = gpio_request_array(overo_bt_gpios, ARRAY_SIZE(overo_bt_gpios)); 764 + if (ret) { 765 + pr_err("%s: could not obtain BT gpios\n", __func__); 766 + } else { 597 767 gpio_export(OVERO_GPIO_BT_XGATE, 0); 598 - else 599 - printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); 600 - 601 - if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && 602 - (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { 603 768 gpio_export(OVERO_GPIO_BT_NRESET, 0); 604 769 gpio_set_value(OVERO_GPIO_BT_NRESET, 0); 605 770 mdelay(6); 606 771 gpio_set_value(OVERO_GPIO_BT_NRESET, 1); 607 - } else { 608 - printk(KERN_ERR "could not obtain gpio for " 609 - "OVERO_GPIO_BT_NRESET\n"); 610 772 } 611 773 612 - if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && 613 - (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) 774 + ret = gpio_request_one(OVERO_GPIO_USBH_CPEN, GPIOF_OUT_INIT_HIGH, 775 + "OVERO_GPIO_USBH_CPEN"); 776 + if (ret == 0) 614 777 gpio_export(OVERO_GPIO_USBH_CPEN, 0); 615 778 else 616 779 printk(KERN_ERR "could not obtain gpio for "
+3 -18
arch/arm/mach-omap2/board-rm680.c
··· 31 31 #include "mux.h" 32 32 #include "hsmmc.h" 33 33 #include "sdram-nokia.h" 34 + #include "common-board-devices.h" 34 35 35 36 static struct regulator_consumer_supply rm680_vemmc_consumers[] = { 36 37 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"), ··· 91 90 /* add rest of the children here */ 92 91 }; 93 92 94 - static struct i2c_board_info __initdata rm680_twl_i2c_board_info[] = { 95 - { 96 - I2C_BOARD_INFO("twl5031", 0x48), 97 - .flags = I2C_CLIENT_WAKE, 98 - .irq = INT_34XX_SYS_NIRQ, 99 - .platform_data = &rm680_twl_data, 100 - }, 101 - }; 102 - 103 93 static void __init rm680_i2c_init(void) 104 94 { 105 - omap_register_i2c_bus(1, 2900, rm680_twl_i2c_board_info, 106 - ARRAY_SIZE(rm680_twl_i2c_board_info)); 95 + omap_pmic_init(1, 2900, "twl5031", INT_34XX_SYS_NIRQ, &rm680_twl_data); 107 96 omap_register_i2c_bus(2, 400, NULL, 0); 108 97 omap_register_i2c_bus(3, 400, NULL, 0); 109 98 } ··· 144 153 }; 145 154 #endif 146 155 147 - static struct omap_musb_board_data rm680_musb_data = { 148 - .interface_type = MUSB_INTERFACE_ULPI, 149 - .mode = MUSB_PERIPHERAL, 150 - .power = 100, 151 - }; 152 - 153 156 static void __init rm680_init(void) 154 157 { 155 158 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 156 159 omap_serial_init(); 157 - usb_musb_init(&rm680_musb_data); 160 + usb_musb_init(NULL); 158 161 rm680_peripherals_init(); 159 162 } 160 163
+11 -31
arch/arm/mach-omap2/board-rx51-peripherals.c
··· 43 43 44 44 #include "mux.h" 45 45 #include "hsmmc.h" 46 + #include "common-board-devices.h" 46 47 47 48 #define SYSTEM_REV_B_USES_VAUX3 0x1699 48 49 #define SYSTEM_REV_S_USES_VAUX3 0x8 ··· 558 557 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) 559 558 { 560 559 /* FIXME this gpio setup is just a placeholder for now */ 561 - gpio_request(gpio + 6, "backlight_pwm"); 562 - gpio_direction_output(gpio + 6, 0); 563 - gpio_request(gpio + 7, "speaker_en"); 564 - gpio_direction_output(gpio + 7, 1); 560 + gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm"); 561 + gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en"); 565 562 566 563 return 0; 567 564 } ··· 776 777 .power_gpio = 98, 777 778 }; 778 779 779 - static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = { 780 - { 781 - I2C_BOARD_INFO("twl5030", 0x48), 782 - .flags = I2C_CLIENT_WAKE, 783 - .irq = INT_34XX_SYS_NIRQ, 784 - .platform_data = &rx51_twldata, 785 - }, 786 - }; 787 - 788 780 /* Audio setup data */ 789 781 static struct aic3x_setup_data rx51_aic34_setup = { 790 782 .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED, ··· 823 833 rx51_twldata.vaux3 = &rx51_vaux3_cam; 824 834 } 825 835 rx51_twldata.vmmc2 = &rx51_vmmc2; 826 - omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, 827 - ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); 836 + omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata); 828 837 omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, 829 838 ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); 830 839 omap_register_i2c_bus(3, 400, NULL, 0); ··· 910 921 gpio_set_value(RX51_WL1251_POWER_GPIO, enable); 911 922 } 912 923 924 + static struct gpio rx51_wl1251_gpios[] __initdata = { 925 + { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW, "wl1251 power" }, 926 + { RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq" }, 927 + }; 928 + 913 929 static void __init rx51_init_wl1251(void) 914 930 { 915 931 int irq, ret; 916 932 917 - ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); 933 + ret = gpio_request_array(rx51_wl1251_gpios, 934 + ARRAY_SIZE(rx51_wl1251_gpios)); 918 935 if (ret < 0) 919 936 goto error; 920 - 921 - ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0); 922 - if (ret < 0) 923 - goto err_power; 924 - 925 - ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq"); 926 - if (ret < 0) 927 - goto err_power; 928 - 929 - ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO); 930 - if (ret < 0) 931 - goto err_irq; 932 937 933 938 irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); 934 939 if (irq < 0) ··· 935 952 936 953 err_irq: 937 954 gpio_free(RX51_WL1251_IRQ_GPIO); 938 - 939 - err_power: 940 955 gpio_free(RX51_WL1251_POWER_GPIO); 941 - 942 956 error: 943 957 printk(KERN_ERR "wl1251 board initialisation failed\n"); 944 958 wl1251_pdata.set_power = NULL;
+2 -3
arch/arm/mach-omap2/board-rx51-video.c
··· 76 76 return 0; 77 77 } 78 78 79 - if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) { 79 + if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH, 80 + "LCD ACX565AKM reset")) { 80 81 pr_err("%s failed to get LCD Reset GPIO\n", __func__); 81 82 return 0; 82 83 } 83 - 84 - gpio_direction_output(RX51_LCD_RESET_GPIO, 1); 85 84 86 85 omap_display_init(&rx51_dss_board_info); 87 86 return 0;
+11 -7
arch/arm/mach-omap2/board-rx51.c
··· 58 58 }, 59 59 }; 60 60 61 + /* 62 + * cpuidle C-states definition override from the default values. 63 + * The 'exit_latency' field is the sum of sleep and wake-up latencies. 64 + */ 61 65 static struct cpuidle_params rx51_cpuidle_params[] = { 62 66 /* C1 */ 63 - {1, 110, 162, 5}, 67 + {110 + 162, 5 , 1}, 64 68 /* C2 */ 65 - {1, 106, 180, 309}, 69 + {106 + 180, 309, 1}, 66 70 /* C3 */ 67 - {0, 107, 410, 46057}, 71 + {107 + 410, 46057, 0}, 68 72 /* C4 */ 69 - {0, 121, 3374, 46057}, 73 + {121 + 3374, 46057, 0}, 70 74 /* C5 */ 71 - {1, 855, 1146, 46057}, 75 + {855 + 1146, 46057, 1}, 72 76 /* C6 */ 73 - {0, 7580, 4134, 484329}, 77 + {7580 + 4134, 484329, 0}, 74 78 /* C7 */ 75 - {1, 7505, 15274, 484329}, 79 + {7505 + 15274, 484329, 1}, 76 80 }; 77 81 78 82 static struct omap_lcd_config rx51_lcd_config = {
+9 -56
arch/arm/mach-omap2/board-zoom-debugboard.c
··· 15 15 #include <linux/interrupt.h> 16 16 17 17 #include <plat/gpmc.h> 18 + #include <plat/gpmc-smsc911x.h> 18 19 19 20 #include <mach/board-zoom.h> 20 21 ··· 27 26 #define DEBUG_BASE 0x08000000 28 27 #define ZOOM_ETHR_START DEBUG_BASE 29 28 30 - static struct resource zoom_smsc911x_resources[] = { 31 - [0] = { 32 - .start = ZOOM_ETHR_START, 33 - .end = ZOOM_ETHR_START + SZ_4K, 34 - .flags = IORESOURCE_MEM, 35 - }, 36 - [1] = { 37 - .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 38 - }, 39 - }; 40 - 41 - static struct smsc911x_platform_config zoom_smsc911x_config = { 42 - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 43 - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 29 + static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = { 30 + .cs = ZOOM_SMSC911X_CS, 31 + .gpio_irq = ZOOM_SMSC911X_GPIO, 32 + .gpio_reset = -EINVAL, 44 33 .flags = SMSC911X_USE_32BIT, 45 - .phy_interface = PHY_INTERFACE_MODE_MII, 46 - }; 47 - 48 - static struct platform_device zoom_smsc911x_device = { 49 - .name = "smsc911x", 50 - .id = -1, 51 - .num_resources = ARRAY_SIZE(zoom_smsc911x_resources), 52 - .resource = zoom_smsc911x_resources, 53 - .dev = { 54 - .platform_data = &zoom_smsc911x_config, 55 - }, 56 34 }; 57 35 58 36 static inline void __init zoom_init_smsc911x(void) 59 37 { 60 - int eth_cs; 61 - unsigned long cs_mem_base; 62 - int eth_gpio = 0; 63 - 64 - eth_cs = ZOOM_SMSC911X_CS; 65 - 66 - if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { 67 - printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); 68 - return; 69 - } 70 - 71 - zoom_smsc911x_resources[0].start = cs_mem_base + 0x0; 72 - zoom_smsc911x_resources[0].end = cs_mem_base + 0xff; 73 - 74 - eth_gpio = ZOOM_SMSC911X_GPIO; 75 - 76 - zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio); 77 - 78 - if (gpio_request(eth_gpio, "smsc911x irq") < 0) { 79 - printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 80 - eth_gpio); 81 - return; 82 - } 83 - gpio_direction_input(eth_gpio); 38 + gpmc_smsc911x_init(&zoom_smsc911x_cfg); 84 39 } 85 40 86 41 static struct plat_serial8250_port serial_platform_data[] = { ··· 77 120 78 121 quart_gpio = ZOOM_QUADUART_GPIO; 79 122 80 - if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) { 123 + if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) 81 124 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", 82 125 quart_gpio); 83 - return; 84 - } 85 - gpio_direction_input(quart_gpio); 86 126 } 87 127 88 128 static inline int omap_zoom_debugboard_detect(void) ··· 89 135 90 136 debug_board_detect = ZOOM_SMSC911X_GPIO; 91 137 92 - if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) { 138 + if (gpio_request_one(debug_board_detect, GPIOF_IN, 139 + "Zoom debug board detect") < 0) { 93 140 printk(KERN_ERR "Failed to request GPIO%d for Zoom debug" 94 141 "board detect\n", debug_board_detect); 95 142 return 0; 96 143 } 97 - gpio_direction_input(debug_board_detect); 98 144 99 145 if (!gpio_get_value(debug_board_detect)) { 100 146 ret = 0; ··· 104 150 } 105 151 106 152 static struct platform_device *zoom_devices[] __initdata = { 107 - &zoom_smsc911x_device, 108 153 &zoom_debugboard_serial_device, 109 154 }; 110 155
+8 -23
arch/arm/mach-omap2/board-zoom-display.c
··· 21 21 #define LCD_PANEL_RESET_GPIO_PILOT 55 22 22 #define LCD_PANEL_QVGA_GPIO 56 23 23 24 + static struct gpio zoom_lcd_gpios[] __initdata = { 25 + { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" }, 26 + { LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "lcd qvga" }, 27 + }; 28 + 24 29 static void zoom_lcd_panel_init(void) 25 30 { 26 - int ret; 27 - unsigned char lcd_panel_reset_gpio; 28 - 29 - lcd_panel_reset_gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? 31 + zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ? 30 32 LCD_PANEL_RESET_GPIO_PROD : 31 33 LCD_PANEL_RESET_GPIO_PILOT; 32 34 33 - ret = gpio_request(lcd_panel_reset_gpio, "lcd reset"); 34 - if (ret) { 35 - pr_err("Failed to get LCD reset GPIO (gpio%d).\n", 36 - lcd_panel_reset_gpio); 37 - return; 38 - } 39 - gpio_direction_output(lcd_panel_reset_gpio, 1); 40 - 41 - ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga"); 42 - if (ret) { 43 - pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n", 44 - LCD_PANEL_QVGA_GPIO); 45 - goto err0; 46 - } 47 - gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1); 48 - 49 - return; 50 - err0: 51 - gpio_free(lcd_panel_reset_gpio); 35 + if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios))) 36 + pr_err("%s: Failed to get LCD GPIOs.\n", __func__); 52 37 } 53 38 54 39 static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev)
+6 -23
arch/arm/mach-omap2/board-zoom-peripherals.c
··· 31 31 32 32 #include "mux.h" 33 33 #include "hsmmc.h" 34 + #include "common-board-devices.h" 34 35 35 36 #define OMAP_ZOOM_WLAN_PMENA_GPIO (101) 36 37 #define OMAP_ZOOM_WLAN_IRQ_GPIO (162) ··· 277 276 zoom_vsim_supply.dev = mmc[0].dev; 278 277 zoom_vmmc2_supply.dev = mmc[1].dev; 279 278 280 - ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable"); 281 - if (ret) { 279 + ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, 280 + "lcd enable"); 281 + if (ret) 282 282 pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n", 283 283 LCD_PANEL_ENABLE_GPIO); 284 - return ret; 285 - } 286 - gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0); 287 284 288 285 return ret; 289 286 } ··· 348 349 .vdac = &zoom_vdac, 349 350 }; 350 351 351 - static struct i2c_board_info __initdata zoom_i2c_boardinfo[] = { 352 - { 353 - I2C_BOARD_INFO("twl5030", 0x48), 354 - .flags = I2C_CLIENT_WAKE, 355 - .irq = INT_34XX_SYS_NIRQ, 356 - .platform_data = &zoom_twldata, 357 - }, 358 - }; 359 - 360 352 static int __init omap_i2c_init(void) 361 353 { 362 354 if (machine_is_omap_zoom2()) { ··· 355 365 zoom_audio_data.hs_extmute = 1; 356 366 zoom_audio_data.set_hs_extmute = zoom2_set_hs_extmute; 357 367 } 358 - omap_register_i2c_bus(1, 2400, zoom_i2c_boardinfo, 359 - ARRAY_SIZE(zoom_i2c_boardinfo)); 368 + omap_pmic_init(1, 2400, "twl5030", INT_34XX_SYS_NIRQ, &zoom_twldata); 360 369 omap_register_i2c_bus(2, 400, NULL, 0); 361 370 omap_register_i2c_bus(3, 400, NULL, 0); 362 371 return 0; 363 372 } 364 - 365 - static struct omap_musb_board_data musb_board_data = { 366 - .interface_type = MUSB_INTERFACE_ULPI, 367 - .mode = MUSB_OTG, 368 - .power = 100, 369 - }; 370 373 371 374 static void enable_board_wakeup_source(void) 372 375 { ··· 375 392 376 393 omap_i2c_init(); 377 394 platform_device_register(&omap_vwlan_device); 378 - usb_musb_init(&musb_board_data); 395 + usb_musb_init(NULL); 379 396 enable_board_wakeup_source(); 380 397 omap_serial_init(); 381 398 }
+163
arch/arm/mach-omap2/common-board-devices.c
··· 1 + /* 2 + * common-board-devices.c 3 + * 4 + * Copyright (C) 2011 CompuLab, Ltd. 5 + * Author: Mike Rapoport <mike@compulab.co.il> 6 + * 7 + * This program is free software; you can redistribute it and/or 8 + * modify it under the terms of the GNU General Public License 9 + * version 2 as published by the Free Software Foundation. 10 + * 11 + * This program is distributed in the hope that it will be useful, but 12 + * WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 + * General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 + * 02110-1301 USA 20 + * 21 + */ 22 + 23 + #include <linux/i2c.h> 24 + #include <linux/i2c/twl.h> 25 + 26 + #include <linux/gpio.h> 27 + #include <linux/spi/spi.h> 28 + #include <linux/spi/ads7846.h> 29 + 30 + #include <plat/i2c.h> 31 + #include <plat/mcspi.h> 32 + #include <plat/nand.h> 33 + 34 + #include "common-board-devices.h" 35 + 36 + static struct i2c_board_info __initdata pmic_i2c_board_info = { 37 + .addr = 0x48, 38 + .flags = I2C_CLIENT_WAKE, 39 + }; 40 + 41 + void __init omap_pmic_init(int bus, u32 clkrate, 42 + const char *pmic_type, int pmic_irq, 43 + struct twl4030_platform_data *pmic_data) 44 + { 45 + strncpy(pmic_i2c_board_info.type, pmic_type, 46 + sizeof(pmic_i2c_board_info.type)); 47 + pmic_i2c_board_info.irq = pmic_irq; 48 + pmic_i2c_board_info.platform_data = pmic_data; 49 + 50 + omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 51 + } 52 + 53 + #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ 54 + defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 55 + static struct omap2_mcspi_device_config ads7846_mcspi_config = { 56 + .turbo_mode = 0, 57 + .single_channel = 1, /* 0: slave, 1: master */ 58 + }; 59 + 60 + static struct ads7846_platform_data ads7846_config = { 61 + .x_max = 0x0fff, 62 + .y_max = 0x0fff, 63 + .x_plate_ohms = 180, 64 + .pressure_max = 255, 65 + .debounce_max = 10, 66 + .debounce_tol = 3, 67 + .debounce_rep = 1, 68 + .gpio_pendown = -EINVAL, 69 + .keep_vref_on = 1, 70 + }; 71 + 72 + static struct spi_board_info ads7846_spi_board_info __initdata = { 73 + .modalias = "ads7846", 74 + .bus_num = -EINVAL, 75 + .chip_select = 0, 76 + .max_speed_hz = 1500000, 77 + .controller_data = &ads7846_mcspi_config, 78 + .irq = -EINVAL, 79 + .platform_data = &ads7846_config, 80 + }; 81 + 82 + void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 83 + struct ads7846_platform_data *board_pdata) 84 + { 85 + struct spi_board_info *spi_bi = &ads7846_spi_board_info; 86 + int err; 87 + 88 + err = gpio_request(gpio_pendown, "TS PenDown"); 89 + if (err) { 90 + pr_err("Could not obtain gpio for TS PenDown: %d\n", err); 91 + return; 92 + } 93 + 94 + gpio_direction_input(gpio_pendown); 95 + gpio_export(gpio_pendown, 0); 96 + 97 + if (gpio_debounce) 98 + gpio_set_debounce(gpio_pendown, gpio_debounce); 99 + 100 + ads7846_config.gpio_pendown = gpio_pendown; 101 + 102 + spi_bi->bus_num = bus_num; 103 + spi_bi->irq = OMAP_GPIO_IRQ(gpio_pendown); 104 + 105 + if (board_pdata) 106 + spi_bi->platform_data = board_pdata; 107 + 108 + spi_register_board_info(&ads7846_spi_board_info, 1); 109 + } 110 + #else 111 + void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 112 + struct ads7846_platform_data *board_pdata) 113 + { 114 + } 115 + #endif 116 + 117 + #if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE) 118 + static struct omap_nand_platform_data nand_data = { 119 + .dma_channel = -1, /* disable DMA in OMAP NAND driver */ 120 + }; 121 + 122 + void __init omap_nand_flash_init(int options, struct mtd_partition *parts, 123 + int nr_parts) 124 + { 125 + u8 cs = 0; 126 + u8 nandcs = GPMC_CS_NUM + 1; 127 + 128 + /* find out the chip-select on which NAND exists */ 129 + while (cs < GPMC_CS_NUM) { 130 + u32 ret = 0; 131 + ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 132 + 133 + if ((ret & 0xC00) == 0x800) { 134 + printk(KERN_INFO "Found NAND on CS%d\n", cs); 135 + if (nandcs > GPMC_CS_NUM) 136 + nandcs = cs; 137 + } 138 + cs++; 139 + } 140 + 141 + if (nandcs > GPMC_CS_NUM) { 142 + printk(KERN_INFO "NAND: Unable to find configuration " 143 + "in GPMC\n "); 144 + return; 145 + } 146 + 147 + if (nandcs < GPMC_CS_NUM) { 148 + nand_data.cs = nandcs; 149 + nand_data.parts = parts; 150 + nand_data.nr_parts = nr_parts; 151 + nand_data.options = options; 152 + 153 + printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); 154 + if (gpmc_nand_init(&nand_data) < 0) 155 + printk(KERN_ERR "Unable to register NAND device\n"); 156 + } 157 + } 158 + #else 159 + void __init omap_nand_flash_init(int options, struct mtd_partition *parts, 160 + int nr_parts) 161 + { 162 + } 163 + #endif
+35
arch/arm/mach-omap2/common-board-devices.h
··· 1 + #ifndef __OMAP_COMMON_BOARD_DEVICES__ 2 + #define __OMAP_COMMON_BOARD_DEVICES__ 3 + 4 + struct twl4030_platform_data; 5 + struct mtd_partition; 6 + 7 + void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, 8 + struct twl4030_platform_data *pmic_data); 9 + 10 + static inline void omap2_pmic_init(const char *pmic_type, 11 + struct twl4030_platform_data *pmic_data) 12 + { 13 + omap_pmic_init(2, 2600, pmic_type, INT_24XX_SYS_NIRQ, pmic_data); 14 + } 15 + 16 + static inline void omap3_pmic_init(const char *pmic_type, 17 + struct twl4030_platform_data *pmic_data) 18 + { 19 + omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); 20 + } 21 + 22 + static inline void omap4_pmic_init(const char *pmic_type, 23 + struct twl4030_platform_data *pmic_data) 24 + { 25 + /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */ 26 + omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data); 27 + } 28 + 29 + struct ads7846_platform_data; 30 + 31 + void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, 32 + struct ads7846_platform_data *board_pdata); 33 + void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts); 34 + 35 + #endif /* __OMAP_COMMON_BOARD_DEVICES__ */
+146 -290
arch/arm/mach-omap2/cpuidle34xx.c
··· 36 36 37 37 #ifdef CONFIG_CPU_IDLE 38 38 39 - #define OMAP3_MAX_STATES 7 40 - #define OMAP3_STATE_C1 0 /* C1 - MPU WFI + Core active */ 41 - #define OMAP3_STATE_C2 1 /* C2 - MPU WFI + Core inactive */ 42 - #define OMAP3_STATE_C3 2 /* C3 - MPU CSWR + Core inactive */ 43 - #define OMAP3_STATE_C4 3 /* C4 - MPU OFF + Core iactive */ 44 - #define OMAP3_STATE_C5 4 /* C5 - MPU RET + Core RET */ 45 - #define OMAP3_STATE_C6 5 /* C6 - MPU OFF + Core RET */ 46 - #define OMAP3_STATE_C7 6 /* C7 - MPU OFF + Core OFF */ 47 - 48 - #define OMAP3_STATE_MAX OMAP3_STATE_C7 49 - 50 - #define CPUIDLE_FLAG_CHECK_BM 0x10000 /* use omap3_enter_idle_bm() */ 51 - 52 - struct omap3_processor_cx { 53 - u8 valid; 54 - u8 type; 55 - u32 sleep_latency; 56 - u32 wakeup_latency; 57 - u32 mpu_state; 58 - u32 core_state; 59 - u32 threshold; 60 - u32 flags; 61 - const char *desc; 62 - }; 63 - 64 - struct omap3_processor_cx omap3_power_states[OMAP3_MAX_STATES]; 65 - struct omap3_processor_cx current_cx_state; 66 - struct powerdomain *mpu_pd, *core_pd, *per_pd; 67 - struct powerdomain *cam_pd; 68 - 69 39 /* 70 40 * The latencies/thresholds for various C states have 71 41 * to be configured from the respective board files. ··· 45 75 */ 46 76 static struct cpuidle_params cpuidle_params_table[] = { 47 77 /* C1 */ 48 - {1, 2, 2, 5}, 78 + {2 + 2, 5, 1}, 49 79 /* C2 */ 50 - {1, 10, 10, 30}, 80 + {10 + 10, 30, 1}, 51 81 /* C3 */ 52 - {1, 50, 50, 300}, 82 + {50 + 50, 300, 1}, 53 83 /* C4 */ 54 - {1, 1500, 1800, 4000}, 84 + {1500 + 1800, 4000, 1}, 55 85 /* C5 */ 56 - {1, 2500, 7500, 12000}, 86 + {2500 + 7500, 12000, 1}, 57 87 /* C6 */ 58 - {1, 3000, 8500, 15000}, 88 + {3000 + 8500, 15000, 1}, 59 89 /* C7 */ 60 - {1, 10000, 30000, 300000}, 90 + {10000 + 30000, 300000, 1}, 61 91 }; 92 + #define OMAP3_NUM_STATES ARRAY_SIZE(cpuidle_params_table) 62 93 63 - static int omap3_idle_bm_check(void) 64 - { 65 - if (!omap3_can_sleep()) 66 - return 1; 67 - return 0; 68 - } 94 + /* Mach specific information to be recorded in the C-state driver_data */ 95 + struct omap3_idle_statedata { 96 + u32 mpu_state; 97 + u32 core_state; 98 + u8 valid; 99 + }; 100 + struct omap3_idle_statedata omap3_idle_data[OMAP3_NUM_STATES]; 101 + 102 + struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd; 69 103 70 104 static int _cpuidle_allow_idle(struct powerdomain *pwrdm, 71 105 struct clockdomain *clkdm) ··· 96 122 static int omap3_enter_idle(struct cpuidle_device *dev, 97 123 struct cpuidle_state *state) 98 124 { 99 - struct omap3_processor_cx *cx = cpuidle_get_statedata(state); 125 + struct omap3_idle_statedata *cx = cpuidle_get_statedata(state); 100 126 struct timespec ts_preidle, ts_postidle, ts_idle; 101 127 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 102 - 103 - current_cx_state = *cx; 104 128 105 129 /* Used to keep track of the total time in idle */ 106 130 getnstimeofday(&ts_preidle); ··· 112 140 if (omap_irq_pending() || need_resched()) 113 141 goto return_sleep_time; 114 142 115 - if (cx->type == OMAP3_STATE_C1) { 143 + /* Deny idle for C1 */ 144 + if (state == &dev->states[0]) { 116 145 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_deny_idle); 117 146 pwrdm_for_each_clkdm(core_pd, _cpuidle_deny_idle); 118 147 } ··· 121 148 /* Execute ARM wfi */ 122 149 omap_sram_idle(); 123 150 124 - if (cx->type == OMAP3_STATE_C1) { 151 + /* Re-allow idle for C1 */ 152 + if (state == &dev->states[0]) { 125 153 pwrdm_for_each_clkdm(mpu_pd, _cpuidle_allow_idle); 126 154 pwrdm_for_each_clkdm(core_pd, _cpuidle_allow_idle); 127 155 } ··· 138 164 } 139 165 140 166 /** 141 - * next_valid_state - Find next valid c-state 167 + * next_valid_state - Find next valid C-state 142 168 * @dev: cpuidle device 143 - * @state: Currently selected c-state 169 + * @state: Currently selected C-state 144 170 * 145 171 * If the current state is valid, it is returned back to the caller. 146 172 * Else, this function searches for a lower c-state which is still 147 - * valid (as defined in omap3_power_states[]). 173 + * valid. 174 + * 175 + * A state is valid if the 'valid' field is enabled and 176 + * if it satisfies the enable_off_mode condition. 148 177 */ 149 178 static struct cpuidle_state *next_valid_state(struct cpuidle_device *dev, 150 - struct cpuidle_state *curr) 179 + struct cpuidle_state *curr) 151 180 { 152 181 struct cpuidle_state *next = NULL; 153 - struct omap3_processor_cx *cx; 182 + struct omap3_idle_statedata *cx = cpuidle_get_statedata(curr); 183 + u32 mpu_deepest_state = PWRDM_POWER_RET; 184 + u32 core_deepest_state = PWRDM_POWER_RET; 154 185 155 - cx = (struct omap3_processor_cx *)cpuidle_get_statedata(curr); 186 + if (enable_off_mode) { 187 + mpu_deepest_state = PWRDM_POWER_OFF; 188 + /* 189 + * Erratum i583: valable for ES rev < Es1.2 on 3630. 190 + * CORE OFF mode is not supported in a stable form, restrict 191 + * instead the CORE state to RET. 192 + */ 193 + if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) 194 + core_deepest_state = PWRDM_POWER_OFF; 195 + } 156 196 157 197 /* Check if current state is valid */ 158 - if (cx->valid) { 198 + if ((cx->valid) && 199 + (cx->mpu_state >= mpu_deepest_state) && 200 + (cx->core_state >= core_deepest_state)) { 159 201 return curr; 160 202 } else { 161 - u8 idx = OMAP3_STATE_MAX; 203 + int idx = OMAP3_NUM_STATES - 1; 162 204 163 - /* 164 - * Reach the current state starting at highest C-state 165 - */ 166 - for (; idx >= OMAP3_STATE_C1; idx--) { 205 + /* Reach the current state starting at highest C-state */ 206 + for (; idx >= 0; idx--) { 167 207 if (&dev->states[idx] == curr) { 168 208 next = &dev->states[idx]; 169 209 break; 170 210 } 171 211 } 172 212 173 - /* 174 - * Should never hit this condition. 175 - */ 213 + /* Should never hit this condition */ 176 214 WARN_ON(next == NULL); 177 215 178 216 /* ··· 192 206 * Start search from the next (lower) state. 193 207 */ 194 208 idx--; 195 - for (; idx >= OMAP3_STATE_C1; idx--) { 196 - struct omap3_processor_cx *cx; 197 - 209 + for (; idx >= 0; idx--) { 198 210 cx = cpuidle_get_statedata(&dev->states[idx]); 199 - if (cx->valid) { 211 + if ((cx->valid) && 212 + (cx->mpu_state >= mpu_deepest_state) && 213 + (cx->core_state >= core_deepest_state)) { 200 214 next = &dev->states[idx]; 201 215 break; 202 216 } 203 217 } 204 218 /* 205 - * C1 and C2 are always valid. 219 + * C1 is always valid. 206 220 * So, no need to check for 'next==NULL' outside this loop. 207 221 */ 208 222 } ··· 215 229 * @dev: cpuidle device 216 230 * @state: The target state to be programmed 217 231 * 218 - * Used for C states with CPUIDLE_FLAG_CHECK_BM flag set. This 219 - * function checks for any pending activity and then programs the 220 - * device to the specified or a safer state. 232 + * This function checks for any pending activity and then programs 233 + * the device to the specified or a safer state. 221 234 */ 222 235 static int omap3_enter_idle_bm(struct cpuidle_device *dev, 223 236 struct cpuidle_state *state) 224 237 { 225 - struct cpuidle_state *new_state = next_valid_state(dev, state); 226 - u32 core_next_state, per_next_state = 0, per_saved_state = 0; 227 - u32 cam_state; 228 - struct omap3_processor_cx *cx; 238 + struct cpuidle_state *new_state; 239 + u32 core_next_state, per_next_state = 0, per_saved_state = 0, cam_state; 240 + struct omap3_idle_statedata *cx; 229 241 int ret; 230 242 231 - if ((state->flags & CPUIDLE_FLAG_CHECK_BM) && omap3_idle_bm_check()) { 232 - BUG_ON(!dev->safe_state); 243 + if (!omap3_can_sleep()) { 233 244 new_state = dev->safe_state; 234 245 goto select_state; 235 246 } 236 - 237 - cx = cpuidle_get_statedata(state); 238 - core_next_state = cx->core_state; 239 - 240 - /* 241 - * FIXME: we currently manage device-specific idle states 242 - * for PER and CORE in combination with CPU-specific 243 - * idle states. This is wrong, and device-specific 244 - * idle management needs to be separated out into 245 - * its own code. 246 - */ 247 247 248 248 /* 249 249 * Prevent idle completely if CAM is active. ··· 242 270 } 243 271 244 272 /* 273 + * FIXME: we currently manage device-specific idle states 274 + * for PER and CORE in combination with CPU-specific 275 + * idle states. This is wrong, and device-specific 276 + * idle management needs to be separated out into 277 + * its own code. 278 + */ 279 + 280 + /* 245 281 * Prevent PER off if CORE is not in retention or off as this 246 282 * would disable PER wakeups completely. 247 283 */ 284 + cx = cpuidle_get_statedata(state); 285 + core_next_state = cx->core_state; 248 286 per_next_state = per_saved_state = pwrdm_read_next_pwrst(per_pd); 249 287 if ((per_next_state == PWRDM_POWER_OFF) && 250 288 (core_next_state > PWRDM_POWER_RET)) ··· 263 281 /* Are we changing PER target state? */ 264 282 if (per_next_state != per_saved_state) 265 283 pwrdm_set_next_pwrst(per_pd, per_next_state); 284 + 285 + new_state = next_valid_state(dev, state); 266 286 267 287 select_state: 268 288 dev->last_state = new_state; ··· 279 295 280 296 DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev); 281 297 282 - /** 283 - * omap3_cpuidle_update_states() - Update the cpuidle states 284 - * @mpu_deepest_state: Enable states up to and including this for mpu domain 285 - * @core_deepest_state: Enable states up to and including this for core domain 286 - * 287 - * This goes through the list of states available and enables and disables the 288 - * validity of C states based on deepest state that can be achieved for the 289 - * variable domain 290 - */ 291 - void omap3_cpuidle_update_states(u32 mpu_deepest_state, u32 core_deepest_state) 292 - { 293 - int i; 294 - 295 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 296 - struct omap3_processor_cx *cx = &omap3_power_states[i]; 297 - 298 - if ((cx->mpu_state >= mpu_deepest_state) && 299 - (cx->core_state >= core_deepest_state)) { 300 - cx->valid = 1; 301 - } else { 302 - cx->valid = 0; 303 - } 304 - } 305 - } 306 - 307 298 void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params) 308 299 { 309 300 int i; ··· 286 327 if (!cpuidle_board_params) 287 328 return; 288 329 289 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 290 - cpuidle_params_table[i].valid = 291 - cpuidle_board_params[i].valid; 292 - cpuidle_params_table[i].sleep_latency = 293 - cpuidle_board_params[i].sleep_latency; 294 - cpuidle_params_table[i].wake_latency = 295 - cpuidle_board_params[i].wake_latency; 296 - cpuidle_params_table[i].threshold = 297 - cpuidle_board_params[i].threshold; 330 + for (i = 0; i < OMAP3_NUM_STATES; i++) { 331 + cpuidle_params_table[i].valid = cpuidle_board_params[i].valid; 332 + cpuidle_params_table[i].exit_latency = 333 + cpuidle_board_params[i].exit_latency; 334 + cpuidle_params_table[i].target_residency = 335 + cpuidle_board_params[i].target_residency; 298 336 } 299 337 return; 300 - } 301 - 302 - /* omap3_init_power_states - Initialises the OMAP3 specific C states. 303 - * 304 - * Below is the desciption of each C state. 305 - * C1 . MPU WFI + Core active 306 - * C2 . MPU WFI + Core inactive 307 - * C3 . MPU CSWR + Core inactive 308 - * C4 . MPU OFF + Core inactive 309 - * C5 . MPU CSWR + Core CSWR 310 - * C6 . MPU OFF + Core CSWR 311 - * C7 . MPU OFF + Core OFF 312 - */ 313 - void omap_init_power_states(void) 314 - { 315 - /* C1 . MPU WFI + Core active */ 316 - omap3_power_states[OMAP3_STATE_C1].valid = 317 - cpuidle_params_table[OMAP3_STATE_C1].valid; 318 - omap3_power_states[OMAP3_STATE_C1].type = OMAP3_STATE_C1; 319 - omap3_power_states[OMAP3_STATE_C1].sleep_latency = 320 - cpuidle_params_table[OMAP3_STATE_C1].sleep_latency; 321 - omap3_power_states[OMAP3_STATE_C1].wakeup_latency = 322 - cpuidle_params_table[OMAP3_STATE_C1].wake_latency; 323 - omap3_power_states[OMAP3_STATE_C1].threshold = 324 - cpuidle_params_table[OMAP3_STATE_C1].threshold; 325 - omap3_power_states[OMAP3_STATE_C1].mpu_state = PWRDM_POWER_ON; 326 - omap3_power_states[OMAP3_STATE_C1].core_state = PWRDM_POWER_ON; 327 - omap3_power_states[OMAP3_STATE_C1].flags = CPUIDLE_FLAG_TIME_VALID; 328 - omap3_power_states[OMAP3_STATE_C1].desc = "MPU ON + CORE ON"; 329 - 330 - /* C2 . MPU WFI + Core inactive */ 331 - omap3_power_states[OMAP3_STATE_C2].valid = 332 - cpuidle_params_table[OMAP3_STATE_C2].valid; 333 - omap3_power_states[OMAP3_STATE_C2].type = OMAP3_STATE_C2; 334 - omap3_power_states[OMAP3_STATE_C2].sleep_latency = 335 - cpuidle_params_table[OMAP3_STATE_C2].sleep_latency; 336 - omap3_power_states[OMAP3_STATE_C2].wakeup_latency = 337 - cpuidle_params_table[OMAP3_STATE_C2].wake_latency; 338 - omap3_power_states[OMAP3_STATE_C2].threshold = 339 - cpuidle_params_table[OMAP3_STATE_C2].threshold; 340 - omap3_power_states[OMAP3_STATE_C2].mpu_state = PWRDM_POWER_ON; 341 - omap3_power_states[OMAP3_STATE_C2].core_state = PWRDM_POWER_ON; 342 - omap3_power_states[OMAP3_STATE_C2].flags = CPUIDLE_FLAG_TIME_VALID | 343 - CPUIDLE_FLAG_CHECK_BM; 344 - omap3_power_states[OMAP3_STATE_C2].desc = "MPU ON + CORE ON"; 345 - 346 - /* C3 . MPU CSWR + Core inactive */ 347 - omap3_power_states[OMAP3_STATE_C3].valid = 348 - cpuidle_params_table[OMAP3_STATE_C3].valid; 349 - omap3_power_states[OMAP3_STATE_C3].type = OMAP3_STATE_C3; 350 - omap3_power_states[OMAP3_STATE_C3].sleep_latency = 351 - cpuidle_params_table[OMAP3_STATE_C3].sleep_latency; 352 - omap3_power_states[OMAP3_STATE_C3].wakeup_latency = 353 - cpuidle_params_table[OMAP3_STATE_C3].wake_latency; 354 - omap3_power_states[OMAP3_STATE_C3].threshold = 355 - cpuidle_params_table[OMAP3_STATE_C3].threshold; 356 - omap3_power_states[OMAP3_STATE_C3].mpu_state = PWRDM_POWER_RET; 357 - omap3_power_states[OMAP3_STATE_C3].core_state = PWRDM_POWER_ON; 358 - omap3_power_states[OMAP3_STATE_C3].flags = CPUIDLE_FLAG_TIME_VALID | 359 - CPUIDLE_FLAG_CHECK_BM; 360 - omap3_power_states[OMAP3_STATE_C3].desc = "MPU RET + CORE ON"; 361 - 362 - /* C4 . MPU OFF + Core inactive */ 363 - omap3_power_states[OMAP3_STATE_C4].valid = 364 - cpuidle_params_table[OMAP3_STATE_C4].valid; 365 - omap3_power_states[OMAP3_STATE_C4].type = OMAP3_STATE_C4; 366 - omap3_power_states[OMAP3_STATE_C4].sleep_latency = 367 - cpuidle_params_table[OMAP3_STATE_C4].sleep_latency; 368 - omap3_power_states[OMAP3_STATE_C4].wakeup_latency = 369 - cpuidle_params_table[OMAP3_STATE_C4].wake_latency; 370 - omap3_power_states[OMAP3_STATE_C4].threshold = 371 - cpuidle_params_table[OMAP3_STATE_C4].threshold; 372 - omap3_power_states[OMAP3_STATE_C4].mpu_state = PWRDM_POWER_OFF; 373 - omap3_power_states[OMAP3_STATE_C4].core_state = PWRDM_POWER_ON; 374 - omap3_power_states[OMAP3_STATE_C4].flags = CPUIDLE_FLAG_TIME_VALID | 375 - CPUIDLE_FLAG_CHECK_BM; 376 - omap3_power_states[OMAP3_STATE_C4].desc = "MPU OFF + CORE ON"; 377 - 378 - /* C5 . MPU CSWR + Core CSWR*/ 379 - omap3_power_states[OMAP3_STATE_C5].valid = 380 - cpuidle_params_table[OMAP3_STATE_C5].valid; 381 - omap3_power_states[OMAP3_STATE_C5].type = OMAP3_STATE_C5; 382 - omap3_power_states[OMAP3_STATE_C5].sleep_latency = 383 - cpuidle_params_table[OMAP3_STATE_C5].sleep_latency; 384 - omap3_power_states[OMAP3_STATE_C5].wakeup_latency = 385 - cpuidle_params_table[OMAP3_STATE_C5].wake_latency; 386 - omap3_power_states[OMAP3_STATE_C5].threshold = 387 - cpuidle_params_table[OMAP3_STATE_C5].threshold; 388 - omap3_power_states[OMAP3_STATE_C5].mpu_state = PWRDM_POWER_RET; 389 - omap3_power_states[OMAP3_STATE_C5].core_state = PWRDM_POWER_RET; 390 - omap3_power_states[OMAP3_STATE_C5].flags = CPUIDLE_FLAG_TIME_VALID | 391 - CPUIDLE_FLAG_CHECK_BM; 392 - omap3_power_states[OMAP3_STATE_C5].desc = "MPU RET + CORE RET"; 393 - 394 - /* C6 . MPU OFF + Core CSWR */ 395 - omap3_power_states[OMAP3_STATE_C6].valid = 396 - cpuidle_params_table[OMAP3_STATE_C6].valid; 397 - omap3_power_states[OMAP3_STATE_C6].type = OMAP3_STATE_C6; 398 - omap3_power_states[OMAP3_STATE_C6].sleep_latency = 399 - cpuidle_params_table[OMAP3_STATE_C6].sleep_latency; 400 - omap3_power_states[OMAP3_STATE_C6].wakeup_latency = 401 - cpuidle_params_table[OMAP3_STATE_C6].wake_latency; 402 - omap3_power_states[OMAP3_STATE_C6].threshold = 403 - cpuidle_params_table[OMAP3_STATE_C6].threshold; 404 - omap3_power_states[OMAP3_STATE_C6].mpu_state = PWRDM_POWER_OFF; 405 - omap3_power_states[OMAP3_STATE_C6].core_state = PWRDM_POWER_RET; 406 - omap3_power_states[OMAP3_STATE_C6].flags = CPUIDLE_FLAG_TIME_VALID | 407 - CPUIDLE_FLAG_CHECK_BM; 408 - omap3_power_states[OMAP3_STATE_C6].desc = "MPU OFF + CORE RET"; 409 - 410 - /* C7 . MPU OFF + Core OFF */ 411 - omap3_power_states[OMAP3_STATE_C7].valid = 412 - cpuidle_params_table[OMAP3_STATE_C7].valid; 413 - omap3_power_states[OMAP3_STATE_C7].type = OMAP3_STATE_C7; 414 - omap3_power_states[OMAP3_STATE_C7].sleep_latency = 415 - cpuidle_params_table[OMAP3_STATE_C7].sleep_latency; 416 - omap3_power_states[OMAP3_STATE_C7].wakeup_latency = 417 - cpuidle_params_table[OMAP3_STATE_C7].wake_latency; 418 - omap3_power_states[OMAP3_STATE_C7].threshold = 419 - cpuidle_params_table[OMAP3_STATE_C7].threshold; 420 - omap3_power_states[OMAP3_STATE_C7].mpu_state = PWRDM_POWER_OFF; 421 - omap3_power_states[OMAP3_STATE_C7].core_state = PWRDM_POWER_OFF; 422 - omap3_power_states[OMAP3_STATE_C7].flags = CPUIDLE_FLAG_TIME_VALID | 423 - CPUIDLE_FLAG_CHECK_BM; 424 - omap3_power_states[OMAP3_STATE_C7].desc = "MPU OFF + CORE OFF"; 425 - 426 - /* 427 - * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 428 - * enable OFF mode in a stable form for previous revisions. 429 - * we disable C7 state as a result. 430 - */ 431 - if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) { 432 - omap3_power_states[OMAP3_STATE_C7].valid = 0; 433 - cpuidle_params_table[OMAP3_STATE_C7].valid = 0; 434 - pr_warn("%s: core off state C7 disabled due to i583\n", 435 - __func__); 436 - } 437 338 } 438 339 439 340 struct cpuidle_driver omap3_idle_driver = { ··· 301 482 .owner = THIS_MODULE, 302 483 }; 303 484 485 + /* Helper to fill the C-state common data and register the driver_data */ 486 + static inline struct omap3_idle_statedata *_fill_cstate( 487 + struct cpuidle_device *dev, 488 + int idx, const char *descr) 489 + { 490 + struct omap3_idle_statedata *cx = &omap3_idle_data[idx]; 491 + struct cpuidle_state *state = &dev->states[idx]; 492 + 493 + state->exit_latency = cpuidle_params_table[idx].exit_latency; 494 + state->target_residency = cpuidle_params_table[idx].target_residency; 495 + state->flags = CPUIDLE_FLAG_TIME_VALID; 496 + state->enter = omap3_enter_idle_bm; 497 + cx->valid = cpuidle_params_table[idx].valid; 498 + sprintf(state->name, "C%d", idx + 1); 499 + strncpy(state->desc, descr, CPUIDLE_DESC_LEN); 500 + cpuidle_set_statedata(state, cx); 501 + 502 + return cx; 503 + } 504 + 304 505 /** 305 506 * omap3_idle_init - Init routine for OMAP3 idle 306 507 * 307 - * Registers the OMAP3 specific cpuidle driver with the cpuidle 508 + * Registers the OMAP3 specific cpuidle driver to the cpuidle 308 509 * framework with the valid set of states. 309 510 */ 310 511 int __init omap3_idle_init(void) 311 512 { 312 - int i, count = 0; 313 - struct omap3_processor_cx *cx; 314 - struct cpuidle_state *state; 315 513 struct cpuidle_device *dev; 514 + struct omap3_idle_statedata *cx; 316 515 317 516 mpu_pd = pwrdm_lookup("mpu_pwrdm"); 318 517 core_pd = pwrdm_lookup("core_pwrdm"); 319 518 per_pd = pwrdm_lookup("per_pwrdm"); 320 519 cam_pd = pwrdm_lookup("cam_pwrdm"); 321 520 322 - omap_init_power_states(); 323 521 cpuidle_register_driver(&omap3_idle_driver); 324 - 325 522 dev = &per_cpu(omap3_idle_dev, smp_processor_id()); 326 523 327 - for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { 328 - cx = &omap3_power_states[i]; 329 - state = &dev->states[count]; 524 + /* C1 . MPU WFI + Core active */ 525 + cx = _fill_cstate(dev, 0, "MPU ON + CORE ON"); 526 + (&dev->states[0])->enter = omap3_enter_idle; 527 + dev->safe_state = &dev->states[0]; 528 + cx->valid = 1; /* C1 is always valid */ 529 + cx->mpu_state = PWRDM_POWER_ON; 530 + cx->core_state = PWRDM_POWER_ON; 330 531 331 - if (!cx->valid) 332 - continue; 333 - cpuidle_set_statedata(state, cx); 334 - state->exit_latency = cx->sleep_latency + cx->wakeup_latency; 335 - state->target_residency = cx->threshold; 336 - state->flags = cx->flags; 337 - state->enter = (state->flags & CPUIDLE_FLAG_CHECK_BM) ? 338 - omap3_enter_idle_bm : omap3_enter_idle; 339 - if (cx->type == OMAP3_STATE_C1) 340 - dev->safe_state = state; 341 - sprintf(state->name, "C%d", count+1); 342 - strncpy(state->desc, cx->desc, CPUIDLE_DESC_LEN); 343 - count++; 532 + /* C2 . MPU WFI + Core inactive */ 533 + cx = _fill_cstate(dev, 1, "MPU ON + CORE ON"); 534 + cx->mpu_state = PWRDM_POWER_ON; 535 + cx->core_state = PWRDM_POWER_ON; 536 + 537 + /* C3 . MPU CSWR + Core inactive */ 538 + cx = _fill_cstate(dev, 2, "MPU RET + CORE ON"); 539 + cx->mpu_state = PWRDM_POWER_RET; 540 + cx->core_state = PWRDM_POWER_ON; 541 + 542 + /* C4 . MPU OFF + Core inactive */ 543 + cx = _fill_cstate(dev, 3, "MPU OFF + CORE ON"); 544 + cx->mpu_state = PWRDM_POWER_OFF; 545 + cx->core_state = PWRDM_POWER_ON; 546 + 547 + /* C5 . MPU RET + Core RET */ 548 + cx = _fill_cstate(dev, 4, "MPU RET + CORE RET"); 549 + cx->mpu_state = PWRDM_POWER_RET; 550 + cx->core_state = PWRDM_POWER_RET; 551 + 552 + /* C6 . MPU OFF + Core RET */ 553 + cx = _fill_cstate(dev, 5, "MPU OFF + CORE RET"); 554 + cx->mpu_state = PWRDM_POWER_OFF; 555 + cx->core_state = PWRDM_POWER_RET; 556 + 557 + /* C7 . MPU OFF + Core OFF */ 558 + cx = _fill_cstate(dev, 6, "MPU OFF + CORE OFF"); 559 + /* 560 + * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 561 + * enable OFF mode in a stable form for previous revisions. 562 + * We disable C7 state as a result. 563 + */ 564 + if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) { 565 + cx->valid = 0; 566 + pr_warn("%s: core off state C7 disabled due to i583\n", 567 + __func__); 344 568 } 569 + cx->mpu_state = PWRDM_POWER_OFF; 570 + cx->core_state = PWRDM_POWER_OFF; 345 571 346 - if (!count) 347 - return -EINVAL; 348 - dev->state_count = count; 349 - 350 - if (enable_off_mode) 351 - omap3_cpuidle_update_states(PWRDM_POWER_OFF, PWRDM_POWER_OFF); 352 - else 353 - omap3_cpuidle_update_states(PWRDM_POWER_RET, PWRDM_POWER_RET); 354 - 572 + dev->state_count = OMAP3_NUM_STATES; 355 573 if (cpuidle_register_device(dev)) { 356 574 printk(KERN_ERR "%s: CPUidle register device failed\n", 357 575 __func__);
+5 -6
arch/arm/mach-omap2/gpmc-smc91x.c
··· 147 147 goto free1; 148 148 } 149 149 150 - if (gpio_request(gpmc_cfg->gpio_irq, "SMC91X irq") < 0) 150 + if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0) 151 151 goto free1; 152 152 153 - gpio_direction_input(gpmc_cfg->gpio_irq); 154 153 gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); 155 154 156 155 if (gpmc_cfg->gpio_pwrdwn) { 157 - ret = gpio_request(gpmc_cfg->gpio_pwrdwn, "SMC91X powerdown"); 156 + ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn, 157 + GPIOF_OUT_INIT_LOW, "SMC91X powerdown"); 158 158 if (ret) 159 159 goto free2; 160 - gpio_direction_output(gpmc_cfg->gpio_pwrdwn, 0); 161 160 } 162 161 163 162 if (gpmc_cfg->gpio_reset) { 164 - ret = gpio_request(gpmc_cfg->gpio_reset, "SMC91X reset"); 163 + ret = gpio_request_one(gpmc_cfg->gpio_reset, 164 + GPIOF_OUT_INIT_LOW, "SMC91X reset"); 165 165 if (ret) 166 166 goto free3; 167 167 168 - gpio_direction_output(gpmc_cfg->gpio_reset, 0); 169 168 gpio_set_value(gpmc_cfg->gpio_reset, 1); 170 169 msleep(100); 171 170 gpio_set_value(gpmc_cfg->gpio_reset, 0);
+19 -25
arch/arm/mach-omap2/gpmc-smsc911x.c
··· 10 10 * it under the terms of the GNU General Public License version 2 as 11 11 * published by the Free Software Foundation. 12 12 */ 13 + #define pr_fmt(fmt) "%s: " fmt, __func__ 13 14 14 15 #include <linux/kernel.h> 15 16 #include <linux/platform_device.h> ··· 31 30 .flags = IORESOURCE_MEM, 32 31 }, 33 32 [1] = { 34 - .flags = IORESOURCE_IRQ, 33 + .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 35 34 }, 36 35 }; 37 36 ··· 42 41 .flags = SMSC911X_USE_16BIT, 43 42 }; 44 43 45 - static struct platform_device gpmc_smsc911x_device = { 46 - .name = "smsc911x", 47 - .id = -1, 48 - .num_resources = ARRAY_SIZE(gpmc_smsc911x_resources), 49 - .resource = gpmc_smsc911x_resources, 50 - .dev = { 51 - .platform_data = &gpmc_smsc911x_config, 52 - }, 53 - }; 54 - 55 44 /* 56 45 * Initialize smsc911x device connected to the GPMC. Note that we 57 46 * assume that pin multiplexing is done in the board-*.c file, ··· 49 58 */ 50 59 void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) 51 60 { 61 + struct platform_device *pdev; 52 62 unsigned long cs_mem_base; 53 63 int ret; 54 64 55 65 gpmc_cfg = board_data; 56 66 57 67 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 58 - printk(KERN_ERR "Failed to request GPMC mem for smsc911x\n"); 68 + pr_err("Failed to request GPMC mem region\n"); 59 69 return; 60 70 } 61 71 62 72 gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0; 63 73 gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff; 64 74 65 - if (gpio_request(gpmc_cfg->gpio_irq, "smsc911x irq") < 0) { 66 - printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 67 - gpmc_cfg->gpio_irq); 75 + if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq")) { 76 + pr_err("Failed to request IRQ GPIO%d\n", gpmc_cfg->gpio_irq); 68 77 goto free1; 69 78 } 70 79 71 - gpio_direction_input(gpmc_cfg->gpio_irq); 72 80 gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); 73 - gpmc_smsc911x_resources[1].flags |= 74 - (gpmc_cfg->flags & IRQF_TRIGGER_MASK); 75 81 76 82 if (gpio_is_valid(gpmc_cfg->gpio_reset)) { 77 - ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset"); 83 + ret = gpio_request_one(gpmc_cfg->gpio_reset, 84 + GPIOF_OUT_INIT_HIGH, "smsc911x reset"); 78 85 if (ret) { 79 - printk(KERN_ERR "Failed to request GPIO%d for smsc911x reset\n", 80 - gpmc_cfg->gpio_reset); 86 + pr_err("Failed to request reset GPIO%d\n", 87 + gpmc_cfg->gpio_reset); 81 88 goto free2; 82 89 } 83 90 84 - gpio_direction_output(gpmc_cfg->gpio_reset, 1); 85 91 gpio_set_value(gpmc_cfg->gpio_reset, 0); 86 92 msleep(100); 87 93 gpio_set_value(gpmc_cfg->gpio_reset, 1); 88 94 } 89 95 90 - if (platform_device_register(&gpmc_smsc911x_device) < 0) { 91 - printk(KERN_ERR "Unable to register smsc911x device\n"); 96 + if (gpmc_cfg->flags) 97 + gpmc_smsc911x_config.flags = gpmc_cfg->flags; 98 + 99 + pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, 100 + gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), 101 + &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config)); 102 + if (!pdev) { 103 + pr_err("Unable to register platform device\n"); 92 104 gpio_free(gpmc_cfg->gpio_reset); 93 105 goto free2; 94 106 } ··· 103 109 free1: 104 110 gpmc_cs_free(gpmc_cfg->cs); 105 111 106 - printk(KERN_ERR "Could not initialize smsc911x\n"); 112 + pr_err("Could not initialize smsc911x device\n"); 107 113 }
+23 -28
arch/arm/mach-omap2/omap_l3_noc.c
··· 63 63 char *source_name; 64 64 65 65 /* Get the Type of interrupt */ 66 - if (irq == l3->app_irq) 67 - inttype = L3_APPLICATION_ERROR; 68 - else 69 - inttype = L3_DEBUG_ERROR; 66 + inttype = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; 70 67 71 68 for (i = 0; i < L3_MODULES; i++) { 72 69 /* ··· 81 84 82 85 err_src = j; 83 86 /* Read the stderrlog_main_source from clk domain */ 84 - std_err_main_addr = base + (*(l3_targ[i] + err_src)); 85 - std_err_main = readl(std_err_main_addr); 87 + std_err_main_addr = base + *(l3_targ[i] + err_src); 88 + std_err_main = readl(std_err_main_addr); 86 89 87 - switch ((std_err_main & CUSTOM_ERROR)) { 90 + switch (std_err_main & CUSTOM_ERROR) { 88 91 case STANDARD_ERROR: 89 92 source_name = 90 93 l3_targ_stderrlog_main_name[i][err_src]; ··· 129 132 130 133 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 131 134 if (!l3) 132 - ret = -ENOMEM; 135 + return -ENOMEM; 133 136 134 137 platform_set_drvdata(pdev, l3); 135 138 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 136 139 if (!res) { 137 140 dev_err(&pdev->dev, "couldn't find resource 0\n"); 138 141 ret = -ENODEV; 139 - goto err1; 142 + goto err0; 140 143 } 141 144 142 145 l3->l3_base[0] = ioremap(res->start, resource_size(res)); 143 - if (!(l3->l3_base[0])) { 146 + if (!l3->l3_base[0]) { 144 147 dev_err(&pdev->dev, "ioremap failed\n"); 145 148 ret = -ENOMEM; 146 - goto err2; 149 + goto err0; 147 150 } 148 151 149 152 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 150 153 if (!res) { 151 154 dev_err(&pdev->dev, "couldn't find resource 1\n"); 152 155 ret = -ENODEV; 153 - goto err3; 156 + goto err1; 154 157 } 155 158 156 159 l3->l3_base[1] = ioremap(res->start, resource_size(res)); 157 - if (!(l3->l3_base[1])) { 160 + if (!l3->l3_base[1]) { 158 161 dev_err(&pdev->dev, "ioremap failed\n"); 159 162 ret = -ENOMEM; 160 - goto err4; 163 + goto err1; 161 164 } 162 165 163 166 res = platform_get_resource(pdev, IORESOURCE_MEM, 2); 164 167 if (!res) { 165 168 dev_err(&pdev->dev, "couldn't find resource 2\n"); 166 169 ret = -ENODEV; 167 - goto err5; 170 + goto err2; 168 171 } 169 172 170 173 l3->l3_base[2] = ioremap(res->start, resource_size(res)); 171 - if (!(l3->l3_base[2])) { 174 + if (!l3->l3_base[2]) { 172 175 dev_err(&pdev->dev, "ioremap failed\n"); 173 176 ret = -ENOMEM; 174 - goto err6; 177 + goto err2; 175 178 } 176 179 177 180 /* ··· 184 187 if (ret) { 185 188 pr_crit("L3: request_irq failed to register for 0x%x\n", 186 189 OMAP44XX_IRQ_L3_DBG); 187 - goto err7; 190 + goto err3; 188 191 } 189 192 l3->debug_irq = irq; 190 193 ··· 195 198 if (ret) { 196 199 pr_crit("L3: request_irq failed to register for 0x%x\n", 197 200 OMAP44XX_IRQ_L3_APP); 198 - goto err8; 201 + goto err4; 199 202 } 200 203 l3->app_irq = irq; 201 204 202 - goto err0; 203 - err8: 204 - err7: 205 - iounmap(l3->l3_base[2]); 206 - err6: 207 - err5: 208 - iounmap(l3->l3_base[1]); 205 + return 0; 206 + 209 207 err4: 208 + free_irq(l3->debug_irq, l3); 210 209 err3: 211 - iounmap(l3->l3_base[0]); 210 + iounmap(l3->l3_base[2]); 212 211 err2: 212 + iounmap(l3->l3_base[1]); 213 213 err1: 214 - kfree(l3); 214 + iounmap(l3->l3_base[0]); 215 215 err0: 216 + kfree(l3); 216 217 return ret; 217 218 } 218 219
+15 -27
arch/arm/mach-omap2/omap_l3_smx.c
··· 155 155 u8 multi = error & L3_ERROR_LOG_MULTI; 156 156 u32 address = omap3_l3_decode_addr(error_addr); 157 157 158 - WARN(true, "%s Error seen by %s %s at address %x\n", 158 + WARN(true, "%s seen by %s %s at address %x\n", 159 159 omap3_l3_code_string(code), 160 160 omap3_l3_initiator_string(initid), 161 161 multi ? "Multiple Errors" : "", ··· 167 167 static irqreturn_t omap3_l3_app_irq(int irq, void *_l3) 168 168 { 169 169 struct omap3_l3 *l3 = _l3; 170 - 171 170 u64 status, clear; 172 171 u64 error; 173 172 u64 error_addr; 174 173 u64 err_source = 0; 175 174 void __iomem *base; 176 175 int int_type; 177 - 178 176 irqreturn_t ret = IRQ_NONE; 179 177 180 - if (irq == l3->app_irq) 181 - int_type = L3_APPLICATION_ERROR; 182 - else 183 - int_type = L3_DEBUG_ERROR; 184 - 178 + int_type = irq == l3->app_irq ? L3_APPLICATION_ERROR : L3_DEBUG_ERROR; 185 179 if (!int_type) { 186 180 status = omap3_l3_readll(l3->rt, L3_SI_FLAG_STATUS_0); 187 181 /* ··· 196 202 197 203 base = l3->rt + *(omap3_l3_bases[int_type] + err_source); 198 204 error = omap3_l3_readll(base, L3_ERROR_LOG); 199 - 200 205 if (error) { 201 206 error_addr = omap3_l3_readll(base, L3_ERROR_LOG_ADDR); 202 207 ··· 203 210 } 204 211 205 212 /* Clear the status register */ 206 - clear = ((L3_AGENT_STATUS_CLEAR_IA << int_type) | 207 - (L3_AGENT_STATUS_CLEAR_TA)); 208 - 213 + clear = (L3_AGENT_STATUS_CLEAR_IA << int_type) | 214 + L3_AGENT_STATUS_CLEAR_TA; 209 215 omap3_l3_writell(base, L3_AGENT_STATUS, clear); 210 216 211 217 /* clear the error log register */ ··· 220 228 int ret; 221 229 222 230 l3 = kzalloc(sizeof(*l3), GFP_KERNEL); 223 - if (!l3) { 224 - ret = -ENOMEM; 225 - goto err0; 226 - } 231 + if (!l3) 232 + return -ENOMEM; 227 233 228 234 platform_set_drvdata(pdev, l3); 229 235 ··· 229 239 if (!res) { 230 240 dev_err(&pdev->dev, "couldn't find resource\n"); 231 241 ret = -ENODEV; 232 - goto err1; 242 + goto err0; 233 243 } 234 244 l3->rt = ioremap(res->start, resource_size(res)); 235 - if (!(l3->rt)) { 245 + if (!l3->rt) { 236 246 dev_err(&pdev->dev, "ioremap failed\n"); 237 247 ret = -ENOMEM; 238 - goto err2; 248 + goto err0; 239 249 } 240 250 241 251 l3->debug_irq = platform_get_irq(pdev, 0); ··· 244 254 "l3-debug-irq", l3); 245 255 if (ret) { 246 256 dev_err(&pdev->dev, "couldn't request debug irq\n"); 247 - goto err3; 257 + goto err1; 248 258 } 249 259 250 260 l3->app_irq = platform_get_irq(pdev, 1); 251 261 ret = request_irq(l3->app_irq, omap3_l3_app_irq, 252 262 IRQF_DISABLED | IRQF_TRIGGER_RISING, 253 263 "l3-app-irq", l3); 254 - 255 264 if (ret) { 256 265 dev_err(&pdev->dev, "couldn't request app irq\n"); 257 - goto err4; 266 + goto err2; 258 267 } 259 268 260 - goto err0; 269 + return 0; 261 270 262 - err4: 263 - err3: 264 - iounmap(l3->rt); 265 271 err2: 272 + free_irq(l3->debug_irq, l3); 266 273 err1: 267 - kfree(l3); 274 + iounmap(l3->rt); 268 275 err0: 276 + kfree(l3); 269 277 return ret; 270 278 } 271 279
+6 -3
arch/arm/mach-omap2/omap_phy_internal.c
··· 50 50 { 51 51 ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K); 52 52 if (!ctrl_base) { 53 - dev_err(dev, "control module ioremap failed\n"); 53 + pr_err("control module ioremap failed\n"); 54 54 return -ENOMEM; 55 55 } 56 56 /* Power down the phy */ 57 57 __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF); 58 - phyclk = clk_get(dev, "ocp2scp_usb_phy_ick"); 59 58 59 + if (!dev) 60 + return 0; 61 + 62 + phyclk = clk_get(dev, "ocp2scp_usb_phy_ick"); 60 63 if (IS_ERR(phyclk)) { 61 64 dev_err(dev, "cannot clk_get ocp2scp_usb_phy_ick\n"); 62 65 iounmap(ctrl_base); ··· 231 228 regval = omap_ctrl_readl(AM35XX_CONTROL_LVL_INTR_CLEAR); 232 229 } 233 230 234 - void am35x_musb_set_mode(u8 musb_mode) 231 + void am35x_set_mode(u8 musb_mode) 235 232 { 236 233 u32 devconf2 = omap_ctrl_readl(AM35XX_CONTROL_DEVCONF2); 237 234
+9 -8
arch/arm/mach-omap2/pm.h
··· 36 36 } 37 37 #endif 38 38 39 + /* 40 + * cpuidle mach specific parameters 41 + * 42 + * The board code can override the default C-states definition using 43 + * omap3_pm_init_cpuidle 44 + */ 39 45 struct cpuidle_params { 40 - u8 valid; 41 - u32 sleep_latency; 42 - u32 wake_latency; 43 - u32 threshold; 46 + u32 exit_latency; /* exit_latency = sleep + wake-up latencies */ 47 + u32 target_residency; 48 + u8 valid; /* validates the C-state */ 44 49 }; 45 50 46 51 #if defined(CONFIG_PM) && defined(CONFIG_CPU_IDLE) ··· 76 71 #define omap2_pm_debug 0 77 72 #define enable_off_mode 0 78 73 #define sleep_while_idle 0 79 - #endif 80 - 81 - #if defined(CONFIG_CPU_IDLE) 82 - extern void omap3_cpuidle_update_states(u32, u32); 83 74 #endif 84 75 85 76 #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-14
arch/arm/mach-omap2/pm34xx.c
··· 779 779 else 780 780 state = PWRDM_POWER_RET; 781 781 782 - #ifdef CONFIG_CPU_IDLE 783 - /* 784 - * Erratum i583: implementation for ES rev < Es1.2 on 3630. We cannot 785 - * enable OFF mode in a stable form for previous revisions, restrict 786 - * instead to RET 787 - */ 788 - if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583)) 789 - omap3_cpuidle_update_states(state, PWRDM_POWER_RET); 790 - else 791 - omap3_cpuidle_update_states(state, state); 792 - #endif 793 - 794 782 list_for_each_entry(pwrst, &pwrst_list, node) { 795 783 if (IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583) && 796 784 pwrst->pwrdm == core_pwrdm && ··· 882 894 return -ENODEV; 883 895 884 896 pm_errata_configure(); 885 - 886 - printk(KERN_ERR "Power Management for TI OMAP3.\n"); 887 897 888 898 /* XXX prcm_setup_regs needs to be before enabling hw 889 899 * supervised mode for powerdomains */
-2
arch/arm/mach-omap2/pm44xx.c
··· 105 105 106 106 pr_err("Power Management for TI OMAP4.\n"); 107 107 108 - #ifdef CONFIG_PM 109 108 ret = pwrdm_for_each(pwrdms_setup, NULL); 110 109 if (ret) { 111 110 pr_err("Failed to setup powerdomains\n"); 112 111 goto err2; 113 112 } 114 - #endif 115 113 116 114 #ifdef CONFIG_SUSPEND 117 115 suspend_set_ops(&omap_pm_ops);
+18 -5
arch/arm/mach-omap2/smartreflex.c
··· 847 847 goto err_free_devinfo; 848 848 } 849 849 850 + mem = request_mem_region(mem->start, resource_size(mem), 851 + dev_name(&pdev->dev)); 852 + if (!mem) { 853 + dev_err(&pdev->dev, "%s: no mem region\n", __func__); 854 + ret = -EBUSY; 855 + goto err_free_devinfo; 856 + } 857 + 850 858 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 851 859 852 860 pm_runtime_enable(&pdev->dev); ··· 891 883 ret = sr_late_init(sr_info); 892 884 if (ret) { 893 885 pr_warning("%s: Error in SR late init\n", __func__); 894 - goto err_release_region; 886 + return ret; 895 887 } 896 888 } 897 889 ··· 904 896 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); 905 897 if (!vdd_dbg_dir) { 906 898 ret = -EINVAL; 907 - goto err_release_region; 899 + goto err_iounmap; 908 900 } 909 901 910 902 sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); ··· 912 904 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 913 905 __func__); 914 906 ret = PTR_ERR(sr_info->dbg_dir); 915 - goto err_release_region; 907 + goto err_iounmap; 916 908 } 917 909 918 910 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, ··· 929 921 dev_err(&pdev->dev, "%s: Unable to create debugfs directory" 930 922 "for n-values\n", __func__); 931 923 ret = PTR_ERR(nvalue_dir); 932 - goto err_release_region; 924 + goto err_debugfs; 933 925 } 934 926 935 927 omap_voltage_get_volttable(sr_info->voltdm, &volt_data); ··· 939 931 "entries for n-values\n", 940 932 __func__, sr_info->voltdm->name); 941 933 ret = -ENODATA; 942 - goto err_release_region; 934 + goto err_debugfs; 943 935 } 944 936 945 937 for (i = 0; i < sr_info->nvalue_count; i++) { ··· 953 945 954 946 return ret; 955 947 948 + err_debugfs: 949 + debugfs_remove_recursive(sr_info->dbg_dir); 950 + err_iounmap: 951 + list_del(&sr_info->node); 952 + iounmap(sr_info->base); 956 953 err_release_region: 957 954 release_mem_region(mem->start, resource_size(mem)); 958 955 err_free_devinfo:
+17 -5
arch/arm/mach-omap2/usb-musb.c
··· 108 108 } 109 109 } 110 110 111 - void __init usb_musb_init(struct omap_musb_board_data *board_data) 111 + static struct omap_musb_board_data musb_default_board_data = { 112 + .interface_type = MUSB_INTERFACE_ULPI, 113 + .mode = MUSB_OTG, 114 + .power = 100, 115 + }; 116 + 117 + void __init usb_musb_init(struct omap_musb_board_data *musb_board_data) 112 118 { 113 119 struct omap_hwmod *oh; 114 120 struct omap_device *od; ··· 122 116 struct device *dev; 123 117 int bus_id = -1; 124 118 const char *oh_name, *name; 119 + struct omap_musb_board_data *board_data; 125 120 126 - if (cpu_is_omap3517() || cpu_is_omap3505()) { 127 - } else if (cpu_is_omap44xx()) { 128 - usb_musb_mux_init(board_data); 129 - } 121 + if (musb_board_data) 122 + board_data = musb_board_data; 123 + else 124 + board_data = &musb_default_board_data; 130 125 131 126 /* 132 127 * REVISIT: This line can be removed once all the platforms using ··· 171 164 dev->dma_mask = &musb_dmamask; 172 165 dev->coherent_dma_mask = musb_dmamask; 173 166 put_device(dev); 167 + 168 + if (cpu_is_omap44xx()) 169 + omap4430_phy_init(dev); 174 170 } 175 171 176 172 #else 177 173 void __init usb_musb_init(struct omap_musb_board_data *board_data) 178 174 { 175 + if (cpu_is_omap44xx()) 176 + omap4430_phy_init(NULL); 179 177 } 180 178 #endif /* CONFIG_USB_MUSB_SOC */
+1 -2
arch/arm/mach-omap2/usb-tusb6010.c
··· 293 293 ); 294 294 295 295 /* IRQ */ 296 - status = gpio_request(irq, "TUSB6010 irq"); 296 + status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq"); 297 297 if (status < 0) { 298 298 printk(error, 3, status); 299 299 return status; 300 300 } 301 - gpio_direction_input(irq); 302 301 tusb_resources[2].start = irq + IH_GPIO_BASE; 303 302 304 303 /* set up memory timings ... can speed them up later */
-1
arch/arm/mach-omap2/voltage.c
··· 148 148 } 149 149 150 150 vsel = vdd->read_reg(prm_mod_offs, vdd->vp_data->voltage); 151 - pr_notice("curr_vsel = %x\n", vsel); 152 151 153 152 if (!vdd->pmic_info->vsel_to_uv) { 154 153 pr_warning("PMIC function to convert vsel to voltage"
+2 -2
arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
··· 14 14 #ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__ 15 15 16 16 struct omap_smsc911x_platform_data { 17 + int id; 17 18 int cs; 18 19 int gpio_irq; 19 20 int gpio_reset; 20 21 u32 flags; 21 22 }; 22 23 23 - #if defined(CONFIG_SMSC911X) || \ 24 - defined(CONFIG_SMSC911X_MODULE) 24 + #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 25 25 26 26 extern void gpmc_smsc911x_init(struct omap_smsc911x_platform_data *d); 27 27
-1
arch/arm/plat-omap/include/plat/uncompress.h
··· 129 129 DEBUG_LL_OMAP1(3, sx1); 130 130 131 131 /* omap2 based boards using UART1 */ 132 - DEBUG_LL_OMAP2(1, omap2evm); 133 132 DEBUG_LL_OMAP2(1, omap_2430sdp); 134 133 DEBUG_LL_OMAP2(1, omap_apollon); 135 134 DEBUG_LL_OMAP2(1, omap_h4);
+1 -1
arch/arm/plat-omap/include/plat/usb.h
··· 113 113 extern void am35x_musb_reset(void); 114 114 extern void am35x_musb_phy_power(u8 on); 115 115 extern void am35x_musb_clear_irq(void); 116 - extern void am35x_musb_set_mode(u8 musb_mode); 116 + extern void am35x_set_mode(u8 musb_mode); 117 117 118 118 /* 119 119 * FIXME correct answer depends on hmc_mode,
-1
drivers/video/omap/Makefile
··· 30 30 objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o 31 31 objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o 32 32 objs-y$(CONFIG_MACH_OMAP_LDP) += lcd_ldp.o 33 - objs-y$(CONFIG_MACH_OMAP2EVM) += lcd_omap2evm.o 34 33 objs-y$(CONFIG_MACH_OMAP3EVM) += lcd_omap3evm.o 35 34 objs-y$(CONFIG_MACH_OMAP3_BEAGLE) += lcd_omap3beagle.o 36 35 objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
-192
drivers/video/omap/lcd_omap2evm.c
··· 1 - /* 2 - * LCD panel support for the MISTRAL OMAP2EVM board 3 - * 4 - * Author: Arun C <arunedarath@mistralsolutions.com> 5 - * 6 - * Derived from drivers/video/omap/lcd_omap3evm.c 7 - * Derived from drivers/video/omap/lcd-apollon.c 8 - * 9 - * This program is free software; you can redistribute it and/or modify it 10 - * under the terms of the GNU General Public License as published by the 11 - * Free Software Foundation; either version 2 of the License, or (at your 12 - * option) any later version. 13 - * 14 - * This program is distributed in the hope that it will be useful, but 15 - * WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 - * General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU General Public License along 20 - * with this program; if not, write to the Free Software Foundation, Inc., 21 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 - */ 23 - 24 - #include <linux/module.h> 25 - #include <linux/platform_device.h> 26 - #include <linux/gpio.h> 27 - #include <linux/i2c/twl.h> 28 - 29 - #include <plat/mux.h> 30 - #include <asm/mach-types.h> 31 - 32 - #include "omapfb.h" 33 - 34 - #define LCD_PANEL_ENABLE_GPIO 154 35 - #define LCD_PANEL_LR 128 36 - #define LCD_PANEL_UD 129 37 - #define LCD_PANEL_INI 152 38 - #define LCD_PANEL_QVGA 148 39 - #define LCD_PANEL_RESB 153 40 - 41 - #define TWL_LED_LEDEN 0x00 42 - #define TWL_PWMA_PWMAON 0x00 43 - #define TWL_PWMA_PWMAOFF 0x01 44 - 45 - static unsigned int bklight_level; 46 - 47 - static int omap2evm_panel_init(struct lcd_panel *panel, 48 - struct omapfb_device *fbdev) 49 - { 50 - gpio_request(LCD_PANEL_ENABLE_GPIO, "LCD enable"); 51 - gpio_request(LCD_PANEL_LR, "LCD lr"); 52 - gpio_request(LCD_PANEL_UD, "LCD ud"); 53 - gpio_request(LCD_PANEL_INI, "LCD ini"); 54 - gpio_request(LCD_PANEL_QVGA, "LCD qvga"); 55 - gpio_request(LCD_PANEL_RESB, "LCD resb"); 56 - 57 - gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1); 58 - gpio_direction_output(LCD_PANEL_RESB, 1); 59 - gpio_direction_output(LCD_PANEL_INI, 1); 60 - gpio_direction_output(LCD_PANEL_QVGA, 0); 61 - gpio_direction_output(LCD_PANEL_LR, 1); 62 - gpio_direction_output(LCD_PANEL_UD, 1); 63 - 64 - twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN); 65 - twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON); 66 - twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF); 67 - bklight_level = 100; 68 - 69 - return 0; 70 - } 71 - 72 - static void omap2evm_panel_cleanup(struct lcd_panel *panel) 73 - { 74 - gpio_free(LCD_PANEL_RESB); 75 - gpio_free(LCD_PANEL_QVGA); 76 - gpio_free(LCD_PANEL_INI); 77 - gpio_free(LCD_PANEL_UD); 78 - gpio_free(LCD_PANEL_LR); 79 - gpio_free(LCD_PANEL_ENABLE_GPIO); 80 - } 81 - 82 - static int omap2evm_panel_enable(struct lcd_panel *panel) 83 - { 84 - gpio_set_value(LCD_PANEL_ENABLE_GPIO, 0); 85 - return 0; 86 - } 87 - 88 - static void omap2evm_panel_disable(struct lcd_panel *panel) 89 - { 90 - gpio_set_value(LCD_PANEL_ENABLE_GPIO, 1); 91 - } 92 - 93 - static unsigned long omap2evm_panel_get_caps(struct lcd_panel *panel) 94 - { 95 - return 0; 96 - } 97 - 98 - static int omap2evm_bklight_setlevel(struct lcd_panel *panel, 99 - unsigned int level) 100 - { 101 - u8 c; 102 - if ((level >= 0) && (level <= 100)) { 103 - c = (125 * (100 - level)) / 100 + 2; 104 - twl_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_PWMA_PWMAOFF); 105 - bklight_level = level; 106 - } 107 - return 0; 108 - } 109 - 110 - static unsigned int omap2evm_bklight_getlevel(struct lcd_panel *panel) 111 - { 112 - return bklight_level; 113 - } 114 - 115 - static unsigned int omap2evm_bklight_getmaxlevel(struct lcd_panel *panel) 116 - { 117 - return 100; 118 - } 119 - 120 - struct lcd_panel omap2evm_panel = { 121 - .name = "omap2evm", 122 - .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC | 123 - OMAP_LCDC_INV_HSYNC, 124 - 125 - .bpp = 16, 126 - .data_lines = 18, 127 - .x_res = 480, 128 - .y_res = 640, 129 - .hsw = 3, 130 - .hfp = 0, 131 - .hbp = 28, 132 - .vsw = 2, 133 - .vfp = 1, 134 - .vbp = 0, 135 - 136 - .pixel_clock = 20000, 137 - 138 - .init = omap2evm_panel_init, 139 - .cleanup = omap2evm_panel_cleanup, 140 - .enable = omap2evm_panel_enable, 141 - .disable = omap2evm_panel_disable, 142 - .get_caps = omap2evm_panel_get_caps, 143 - .set_bklight_level = omap2evm_bklight_setlevel, 144 - .get_bklight_level = omap2evm_bklight_getlevel, 145 - .get_bklight_max = omap2evm_bklight_getmaxlevel, 146 - }; 147 - 148 - static int omap2evm_panel_probe(struct platform_device *pdev) 149 - { 150 - omapfb_register_panel(&omap2evm_panel); 151 - return 0; 152 - } 153 - 154 - static int omap2evm_panel_remove(struct platform_device *pdev) 155 - { 156 - return 0; 157 - } 158 - 159 - static int omap2evm_panel_suspend(struct platform_device *pdev, 160 - pm_message_t mesg) 161 - { 162 - return 0; 163 - } 164 - 165 - static int omap2evm_panel_resume(struct platform_device *pdev) 166 - { 167 - return 0; 168 - } 169 - 170 - struct platform_driver omap2evm_panel_driver = { 171 - .probe = omap2evm_panel_probe, 172 - .remove = omap2evm_panel_remove, 173 - .suspend = omap2evm_panel_suspend, 174 - .resume = omap2evm_panel_resume, 175 - .driver = { 176 - .name = "omap2evm_lcd", 177 - .owner = THIS_MODULE, 178 - }, 179 - }; 180 - 181 - static int __init omap2evm_panel_drv_init(void) 182 - { 183 - return platform_driver_register(&omap2evm_panel_driver); 184 - } 185 - 186 - static void __exit omap2evm_panel_drv_exit(void) 187 - { 188 - platform_driver_unregister(&omap2evm_panel_driver); 189 - } 190 - 191 - module_init(omap2evm_panel_drv_init); 192 - module_exit(omap2evm_panel_drv_exit);
-8
sound/soc/omap/Kconfig
··· 65 65 Say Y if you want to add support for SoC audio on the 66 66 Gumstix Overo or CompuLab CM-T35 67 67 68 - config SND_OMAP_SOC_OMAP2EVM 69 - tristate "SoC Audio support for OMAP2EVM board" 70 - depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP2EVM 71 - select SND_OMAP_SOC_MCBSP 72 - select SND_SOC_TWL4030 73 - help 74 - Say Y if you want to add support for SoC audio on the omap2evm board. 75 - 76 68 config SND_OMAP_SOC_OMAP3EVM 77 69 tristate "SoC Audio support for OMAP3EVM board" 78 70 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
-1
sound/soc/omap/Makefile
··· 13 13 snd-soc-ams-delta-objs := ams-delta.o 14 14 snd-soc-osk5912-objs := osk5912.o 15 15 snd-soc-overo-objs := overo.o 16 - snd-soc-omap2evm-objs := omap2evm.o 17 16 snd-soc-omap3evm-objs := omap3evm.o 18 17 snd-soc-am3517evm-objs := am3517evm.o 19 18 snd-soc-sdp3430-objs := sdp3430.o
-139
sound/soc/omap/omap2evm.c
··· 1 - /* 2 - * omap2evm.c -- SoC audio machine driver for omap2evm board 3 - * 4 - * Author: Arun KS <arunks@mistralsolutions.com> 5 - * 6 - * Based on sound/soc/omap/overo.c by Steve Sakoman 7 - * 8 - * This program is free software; you can redistribute it and/or 9 - * modify it under the terms of the GNU General Public License 10 - * version 2 as published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, but 13 - * WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 - * General Public License for more details. 16 - * 17 - * You should have received a copy of the GNU General Public License 18 - * along with this program; if not, write to the Free Software 19 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 - * 02110-1301 USA 21 - * 22 - */ 23 - 24 - #include <linux/clk.h> 25 - #include <linux/platform_device.h> 26 - #include <sound/core.h> 27 - #include <sound/pcm.h> 28 - #include <sound/soc.h> 29 - 30 - #include <asm/mach-types.h> 31 - #include <mach/hardware.h> 32 - #include <mach/gpio.h> 33 - #include <plat/mcbsp.h> 34 - 35 - #include "omap-mcbsp.h" 36 - #include "omap-pcm.h" 37 - 38 - static int omap2evm_hw_params(struct snd_pcm_substream *substream, 39 - struct snd_pcm_hw_params *params) 40 - { 41 - struct snd_soc_pcm_runtime *rtd = substream->private_data; 42 - struct snd_soc_dai *codec_dai = rtd->codec_dai; 43 - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 44 - int ret; 45 - 46 - /* Set codec DAI configuration */ 47 - ret = snd_soc_dai_set_fmt(codec_dai, 48 - SND_SOC_DAIFMT_I2S | 49 - SND_SOC_DAIFMT_NB_NF | 50 - SND_SOC_DAIFMT_CBM_CFM); 51 - if (ret < 0) { 52 - printk(KERN_ERR "can't set codec DAI configuration\n"); 53 - return ret; 54 - } 55 - 56 - /* Set cpu DAI configuration */ 57 - ret = snd_soc_dai_set_fmt(cpu_dai, 58 - SND_SOC_DAIFMT_I2S | 59 - SND_SOC_DAIFMT_NB_NF | 60 - SND_SOC_DAIFMT_CBM_CFM); 61 - if (ret < 0) { 62 - printk(KERN_ERR "can't set cpu DAI configuration\n"); 63 - return ret; 64 - } 65 - 66 - /* Set the codec system clock for DAC and ADC */ 67 - ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000, 68 - SND_SOC_CLOCK_IN); 69 - if (ret < 0) { 70 - printk(KERN_ERR "can't set codec system clock\n"); 71 - return ret; 72 - } 73 - 74 - return 0; 75 - } 76 - 77 - static struct snd_soc_ops omap2evm_ops = { 78 - .hw_params = omap2evm_hw_params, 79 - }; 80 - 81 - /* Digital audio interface glue - connects codec <--> CPU */ 82 - static struct snd_soc_dai_link omap2evm_dai = { 83 - .name = "TWL4030", 84 - .stream_name = "TWL4030", 85 - .cpu_dai_name = "omap-mcbsp-dai.1", 86 - .codec_dai_name = "twl4030-hifi", 87 - .platform_name = "omap-pcm-audio", 88 - .codec_name = "twl4030-codec", 89 - .ops = &omap2evm_ops, 90 - }; 91 - 92 - /* Audio machine driver */ 93 - static struct snd_soc_card snd_soc_omap2evm = { 94 - .name = "omap2evm", 95 - .dai_link = &omap2evm_dai, 96 - .num_links = 1, 97 - }; 98 - 99 - static struct platform_device *omap2evm_snd_device; 100 - 101 - static int __init omap2evm_soc_init(void) 102 - { 103 - int ret; 104 - 105 - if (!machine_is_omap2evm()) 106 - return -ENODEV; 107 - printk(KERN_INFO "omap2evm SoC init\n"); 108 - 109 - omap2evm_snd_device = platform_device_alloc("soc-audio", -1); 110 - if (!omap2evm_snd_device) { 111 - printk(KERN_ERR "Platform device allocation failed\n"); 112 - return -ENOMEM; 113 - } 114 - 115 - platform_set_drvdata(omap2evm_snd_device, &snd_soc_omap2evm); 116 - 117 - ret = platform_device_add(omap2evm_snd_device); 118 - if (ret) 119 - goto err1; 120 - 121 - return 0; 122 - 123 - err1: 124 - printk(KERN_ERR "Unable to add platform device\n"); 125 - platform_device_put(omap2evm_snd_device); 126 - 127 - return ret; 128 - } 129 - module_init(omap2evm_soc_init); 130 - 131 - static void __exit omap2evm_soc_exit(void) 132 - { 133 - platform_device_unregister(omap2evm_snd_device); 134 - } 135 - module_exit(omap2evm_soc_exit); 136 - 137 - MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); 138 - MODULE_DESCRIPTION("ALSA SoC omap2evm"); 139 - MODULE_LICENSE("GPL");