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

Merge branches 'fixes' and 'devel-stable' into for-linus

+1115 -617
+1
arch/arm/Kconfig
··· 365 365 select GENERIC_CLOCKEVENTS 366 366 select ARCH_REQUIRE_GPIOLIB 367 367 select CLKDEV_LOOKUP 368 + select HAVE_SCHED_CLOCK 368 369 help 369 370 Support for Freescale MXC/iMX-based family of processors 370 371
-2
arch/arm/include/asm/mach/udc_pxa2xx.h
··· 20 20 * VBUS IRQ and omit the methods above. Store the GPIO number 21 21 * here. Note that sometimes the signals go through inverters... 22 22 */ 23 - bool gpio_vbus_inverted; 24 - int gpio_vbus; /* high == vbus present */ 25 23 bool gpio_pullup_inverted; 26 24 int gpio_pullup; /* high == pullup activated */ 27 25 };
+1
arch/arm/mach-imx/Kconfig
··· 255 255 bool "Vista Silicon i.MX27 Visstrim_m10" 256 256 select SOC_IMX27 257 257 select IMX_HAVE_PLATFORM_IMX_I2C 258 + select IMX_HAVE_PLATFORM_IMX_SSI 258 259 select IMX_HAVE_PLATFORM_IMX_UART 259 260 select IMX_HAVE_PLATFORM_MXC_MMC 260 261 select IMX_HAVE_PLATFORM_MXC_EHCI
+7 -1
arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
··· 34 34 #include <mach/mx25.h> 35 35 #include <mach/imx-uart.h> 36 36 #include <mach/audmux.h> 37 + #include <mach/esdhc.h> 37 38 38 39 #include "devices-imx25.h" 39 40 ··· 243 242 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, 244 243 }; 245 244 245 + static struct esdhc_platform_data sd1_pdata = { 246 + .cd_gpio = GPIO_SD1CD, 247 + .wp_gpio = -EINVAL, 248 + }; 249 + 246 250 /* 247 251 * system init for baseboard usage. Will be called by cpuimx25 init. 248 252 * ··· 281 275 imx25_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 282 276 283 277 imx25_add_flexcan1(NULL); 284 - imx25_add_sdhci_esdhc_imx(0, NULL); 278 + imx25_add_sdhci_esdhc_imx(0, &sd1_pdata); 285 279 286 280 gpio_request(GPIO_LED1, "LED1"); 287 281 gpio_direction_output(GPIO_LED1, 1);
+11 -3
arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
··· 43 43 #include <mach/ipu.h> 44 44 #include <mach/mx3fb.h> 45 45 #include <mach/audmux.h> 46 + #include <mach/esdhc.h> 46 47 47 48 #include "devices-imx35.h" 48 49 #include "devices.h" ··· 164 163 MX35_PAD_SD1_DATA1__ESDHC1_DAT1, 165 164 MX35_PAD_SD1_DATA2__ESDHC1_DAT2, 166 165 MX35_PAD_SD1_DATA3__ESDHC1_DAT3, 166 + /* SD1 CD */ 167 + MX35_PAD_LD18__GPIO3_24, 167 168 }; 168 169 169 170 #define GPIO_LED1 IMX_GPIO_NR(3, 29) 170 171 #define GPIO_SWITCH1 IMX_GPIO_NR(3, 25) 171 - #define GPIO_LCDPWR (4) 172 + #define GPIO_LCDPWR IMX_GPIO_NR(1, 4) 173 + #define GPIO_SD1CD IMX_GPIO_NR(3, 24) 172 174 173 175 static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd, 174 176 unsigned int power) ··· 258 254 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE, 259 255 }; 260 256 257 + static struct esdhc_platform_data sd1_pdata = { 258 + .cd_gpio = GPIO_SD1CD, 259 + .wp_gpio = -EINVAL, 260 + }; 261 + 261 262 /* 262 263 * system init for baseboard usage. Will be called by cpuimx35 init. 263 264 * ··· 298 289 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 299 290 300 291 imx35_add_flexcan1(NULL); 301 - imx35_add_sdhci_esdhc_imx(0, NULL); 292 + imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); 302 293 303 294 gpio_request(GPIO_LED1, "LED1"); 304 295 gpio_direction_output(GPIO_LED1, 1); ··· 310 301 311 302 gpio_request(GPIO_LCDPWR, "LCDPWR"); 312 303 gpio_direction_output(GPIO_LCDPWR, 1); 313 - gpio_free(GPIO_LCDPWR); 314 304 315 305 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, 316 306 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
+11 -1
arch/arm/mach-mx3/mach-pcm043.c
··· 40 40 #include <mach/mx3fb.h> 41 41 #include <mach/ulpi.h> 42 42 #include <mach/audmux.h> 43 + #include <mach/esdhc.h> 43 44 44 45 #include "devices-imx35.h" 45 46 #include "devices.h" ··· 218 217 MX35_PAD_SD1_DATA1__ESDHC1_DAT1, 219 218 MX35_PAD_SD1_DATA2__ESDHC1_DAT2, 220 219 MX35_PAD_SD1_DATA3__ESDHC1_DAT3, 220 + MX35_PAD_ATA_DATA10__GPIO2_23, /* WriteProtect */ 221 + MX35_PAD_ATA_DATA11__GPIO2_24, /* CardDetect */ 221 222 }; 222 223 223 224 #define AC97_GPIO_TXFS IMX_GPIO_NR(2, 31) 224 225 #define AC97_GPIO_TXD IMX_GPIO_NR(2, 28) 225 226 #define AC97_GPIO_RESET IMX_GPIO_NR(2, 0) 227 + #define SD1_GPIO_WP IMX_GPIO_NR(2, 23) 228 + #define SD1_GPIO_CD IMX_GPIO_NR(2, 24) 226 229 227 230 static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97) 228 231 { ··· 351 346 } 352 347 __setup("otg_mode=", pcm043_otg_mode); 353 348 349 + static struct esdhc_platform_data sd1_pdata = { 350 + .wp_gpio = SD1_GPIO_WP, 351 + .cd_gpio = SD1_GPIO_CD, 352 + }; 353 + 354 354 /* 355 355 * Board specific initialization. 356 356 */ ··· 405 395 imx35_add_fsl_usb2_udc(&otg_device_pdata); 406 396 407 397 imx35_add_flexcan1(NULL); 408 - imx35_add_sdhci_esdhc_imx(0, NULL); 398 + imx35_add_sdhci_esdhc_imx(0, &sd1_pdata); 409 399 } 410 400 411 401 static void __init pcm043_timer_init(void)
+1
arch/arm/mach-mx5/Kconfig
··· 165 165 select IMX_HAVE_PLATFORM_IMX_I2C 166 166 select IMX_HAVE_PLATFORM_IMX_UART 167 167 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 168 + select IMX_HAVE_PLATFORM_GPIO_KEYS 168 169 help 169 170 Include support for MX53 LOCO platform. This includes specific 170 171 configurations for the board and its peripherals.
+1 -1
arch/arm/mach-mx5/Makefile
··· 3 3 # 4 4 5 5 # Object file lists. 6 - obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o 6 + obj-y := cpu.o mm.o clock-mx51-mx53.o devices.o ehci.o system.o 7 7 obj-$(CONFIG_SOC_IMX50) += mm-mx50.o 8 8 9 9 obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
+2 -3
arch/arm/mach-mx5/board-mx51_babbage.c
··· 228 228 int ret; 229 229 230 230 /* reset FEC PHY */ 231 - ret = gpio_request(BABBAGE_FEC_PHY_RESET, "fec-phy-reset"); 231 + ret = gpio_request_one(BABBAGE_FEC_PHY_RESET, 232 + GPIOF_OUT_INIT_LOW, "fec-phy-reset"); 232 233 if (ret) { 233 234 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret); 234 235 return; 235 236 } 236 - gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0); 237 - gpio_set_value(BABBAGE_FEC_PHY_RESET, 0); 238 237 msleep(1); 239 238 gpio_set_value(BABBAGE_FEC_PHY_RESET, 1); 240 239 }
+4 -5
arch/arm/mach-mx5/board-mx53_evk.c
··· 34 34 #include <mach/imx-uart.h> 35 35 #include <mach/iomux-mx53.h> 36 36 37 - #define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6) 37 + #define MX53_EVK_FEC_PHY_RST IMX_GPIO_NR(7, 6) 38 38 #define EVK_ECSPI1_CS0 IMX_GPIO_NR(2, 30) 39 39 #define EVK_ECSPI1_CS1 IMX_GPIO_NR(3, 19) 40 40 ··· 82 82 int ret; 83 83 84 84 /* reset FEC PHY */ 85 - ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset"); 85 + ret = gpio_request_one(MX53_EVK_FEC_PHY_RST, GPIOF_OUT_INIT_LOW, 86 + "fec-phy-reset"); 86 87 if (ret) { 87 88 printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret); 88 89 return; 89 90 } 90 - gpio_direction_output(SMD_FEC_PHY_RST, 0); 91 - gpio_set_value(SMD_FEC_PHY_RST, 0); 92 91 msleep(1); 93 - gpio_set_value(SMD_FEC_PHY_RST, 1); 92 + gpio_set_value(MX53_EVK_FEC_PHY_RST, 1); 94 93 } 95 94 96 95 static struct fec_platform_data mx53_evk_fec_pdata = {
+25
arch/arm/mach-mx5/board-mx53_loco.c
··· 36 36 #include "crm_regs.h" 37 37 #include "devices-imx53.h" 38 38 39 + #define MX53_LOCO_POWER IMX_GPIO_NR(1, 8) 40 + #define MX53_LOCO_UI1 IMX_GPIO_NR(2, 14) 41 + #define MX53_LOCO_UI2 IMX_GPIO_NR(2, 15) 39 42 #define LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6) 40 43 41 44 static iomux_v3_cfg_t mx53_loco_pads[] = { ··· 183 180 MX53_PAD_GPIO_8__GPIO1_8, 184 181 }; 185 182 183 + #define GPIO_BUTTON(gpio_num, ev_code, act_low, descr, wake) \ 184 + { \ 185 + .gpio = gpio_num, \ 186 + .type = EV_KEY, \ 187 + .code = ev_code, \ 188 + .active_low = act_low, \ 189 + .desc = "btn " descr, \ 190 + .wakeup = wake, \ 191 + } 192 + 193 + static const struct gpio_keys_button loco_buttons[] __initconst = { 194 + GPIO_BUTTON(MX53_LOCO_POWER, KEY_POWER, 1, "power", 0), 195 + GPIO_BUTTON(MX53_LOCO_UI1, KEY_VOLUMEUP, 1, "volume-up", 0), 196 + GPIO_BUTTON(MX53_LOCO_UI2, KEY_VOLUMEDOWN, 1, "volume-down", 0), 197 + }; 198 + 199 + static const struct gpio_keys_platform_data loco_button_data __initconst = { 200 + .buttons = loco_buttons, 201 + .nbuttons = ARRAY_SIZE(loco_buttons), 202 + }; 203 + 186 204 static inline void mx53_loco_fec_reset(void) 187 205 { 188 206 int ret; ··· 239 215 imx53_add_imx_i2c(1, &mx53_loco_i2c_data); 240 216 imx53_add_sdhci_esdhc_imx(0, NULL); 241 217 imx53_add_sdhci_esdhc_imx(2, NULL); 218 + imx_add_gpio_keys(&loco_button_data); 242 219 } 243 220 244 221 static void __init mx53_loco_timer_init(void)
+9
arch/arm/mach-mx5/clock-mx51-mx53.c
··· 865 865 .disable = _clk_ccgr_disable_inwait, 866 866 }; 867 867 868 + static struct clk gpc_dvfs_clk = { 869 + .enable_reg = MXC_CCM_CCGR5, 870 + .enable_shift = MXC_CCM_CCGRx_CG12_OFFSET, 871 + .enable = _clk_ccgr_enable, 872 + .disable = _clk_ccgr_disable, 873 + }; 874 + 868 875 static struct clk gpt_32k_clk = { 869 876 .id = 0, 870 877 .parent = &ckil_clk, ··· 1455 1448 _REGISTER_CLOCK("imx-ipuv3", NULL, ipu_clk) 1456 1449 _REGISTER_CLOCK("imx-ipuv3", "di0", ipu_di0_clk) 1457 1450 _REGISTER_CLOCK("imx-ipuv3", "di1", ipu_di1_clk) 1451 + _REGISTER_CLOCK(NULL, "gpc_dvfs", gpc_dvfs_clk) 1458 1452 }; 1459 1453 1460 1454 static struct clk_lookup mx53_lookups[] = { ··· 1519 1511 clk_enable(&iim_clk); 1520 1512 mx51_revision(); 1521 1513 clk_disable(&iim_clk); 1514 + mx51_display_revision(); 1522 1515 1523 1516 /* move usb_phy_clk to 24MHz */ 1524 1517 clk_set_parent(&usb_phy1_clk, &osc_clk);
+59
arch/arm/mach-mx5/cpu.c
··· 21 21 static int cpu_silicon_rev = -1; 22 22 23 23 #define IIM_SREV 0x24 24 + #define MX50_HW_ADADIG_DIGPROG 0xB0 24 25 25 26 static int get_mx51_srev(void) 26 27 { ··· 51 50 return cpu_silicon_rev; 52 51 } 53 52 EXPORT_SYMBOL(mx51_revision); 53 + 54 + void mx51_display_revision(void) 55 + { 56 + int rev; 57 + char *srev; 58 + rev = mx51_revision(); 59 + 60 + switch (rev) { 61 + case IMX_CHIP_REVISION_2_0: 62 + srev = IMX_CHIP_REVISION_2_0_STRING; 63 + break; 64 + case IMX_CHIP_REVISION_3_0: 65 + srev = IMX_CHIP_REVISION_3_0_STRING; 66 + break; 67 + default: 68 + srev = IMX_CHIP_REVISION_UNKNOWN_STRING; 69 + } 70 + printk(KERN_INFO "CPU identified as i.MX51, silicon rev %s\n", srev); 71 + } 72 + EXPORT_SYMBOL(mx51_display_revision); 54 73 55 74 #ifdef CONFIG_NEON 56 75 ··· 127 106 return cpu_silicon_rev; 128 107 } 129 108 EXPORT_SYMBOL(mx53_revision); 109 + 110 + static int get_mx50_srev(void) 111 + { 112 + void __iomem *anatop = ioremap(MX50_ANATOP_BASE_ADDR, SZ_8K); 113 + u32 rev; 114 + 115 + if (!anatop) { 116 + cpu_silicon_rev = -EINVAL; 117 + return 0; 118 + } 119 + 120 + rev = readl(anatop + MX50_HW_ADADIG_DIGPROG); 121 + rev &= 0xff; 122 + 123 + iounmap(anatop); 124 + if (rev == 0x0) 125 + return IMX_CHIP_REVISION_1_0; 126 + else if (rev == 0x1) 127 + return IMX_CHIP_REVISION_1_1; 128 + return 0; 129 + } 130 + 131 + /* 132 + * Returns: 133 + * the silicon revision of the cpu 134 + * -EINVAL - not a mx50 135 + */ 136 + int mx50_revision(void) 137 + { 138 + if (!cpu_is_mx50()) 139 + return -EINVAL; 140 + 141 + if (cpu_silicon_rev == -1) 142 + cpu_silicon_rev = get_mx50_srev(); 143 + 144 + return cpu_silicon_rev; 145 + } 146 + EXPORT_SYMBOL(mx50_revision); 130 147 131 148 static int __init post_cpu_init(void) 132 149 {
+4
arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
··· 67 67 MX51_PAD_SD1_DATA1__SD1_DATA1, 68 68 MX51_PAD_SD1_DATA2__SD1_DATA2, 69 69 MX51_PAD_SD1_DATA3__SD1_DATA3, 70 + /* SD1 CD */ 71 + _MX51_PAD_GPIO1_0__SD1_CD | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP | 72 + PAD_CTL_PKE | PAD_CTL_SRE_FAST | 73 + PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS), 70 74 }; 71 75 72 76 #define GPIO_LED1 IMX_GPIO_NR(3, 30)
+4 -3
arch/arm/mach-mx5/mx51_efika.c
··· 42 42 #include <asm/mach-types.h> 43 43 #include <asm/mach/arch.h> 44 44 #include <asm/mach/time.h> 45 - #include <asm/mach-types.h> 46 45 47 46 #include "devices-imx51.h" 48 47 #include "devices.h" ··· 571 572 572 573 static struct mc13xxx_platform_data mx51_efika_mc13892_data = { 573 574 .flags = MC13XXX_USE_RTC | MC13XXX_USE_REGULATOR, 574 - .num_regulators = ARRAY_SIZE(mx51_efika_regulators), 575 - .regulators = mx51_efika_regulators, 575 + .regulators = { 576 + .num_regulators = ARRAY_SIZE(mx51_efika_regulators), 577 + .regulators = mx51_efika_regulators, 578 + }, 576 579 }; 577 580 578 581 static struct spi_board_info mx51_efika_spi_board_info[] __initdata = {
+84
arch/arm/mach-mx5/system.c
··· 1 + /* 2 + * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. 3 + */ 4 + 5 + /* 6 + * The code contained herein is licensed under the GNU General Public 7 + * License. You may obtain a copy of the GNU General Public License 8 + * Version 2 or later at the following locations: 9 + * 10 + * http://www.opensource.org/licenses/gpl-license.html 11 + * http://www.gnu.org/copyleft/gpl.html 12 + */ 13 + #include <linux/platform_device.h> 14 + #include <linux/io.h> 15 + #include <mach/hardware.h> 16 + #include "crm_regs.h" 17 + 18 + /* set cpu low power mode before WFI instruction. This function is called 19 + * mx5 because it can be used for mx50, mx51, and mx53.*/ 20 + void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode) 21 + { 22 + u32 plat_lpc, arm_srpgcr, ccm_clpcr; 23 + u32 empgc0, empgc1; 24 + int stop_mode = 0; 25 + 26 + /* always allow platform to issue a deep sleep mode request */ 27 + plat_lpc = __raw_readl(MXC_CORTEXA8_PLAT_LPC) & 28 + ~(MXC_CORTEXA8_PLAT_LPC_DSM); 29 + ccm_clpcr = __raw_readl(MXC_CCM_CLPCR) & ~(MXC_CCM_CLPCR_LPM_MASK); 30 + arm_srpgcr = __raw_readl(MXC_SRPG_ARM_SRPGCR) & ~(MXC_SRPGCR_PCR); 31 + empgc0 = __raw_readl(MXC_SRPG_EMPGC0_SRPGCR) & ~(MXC_SRPGCR_PCR); 32 + empgc1 = __raw_readl(MXC_SRPG_EMPGC1_SRPGCR) & ~(MXC_SRPGCR_PCR); 33 + 34 + switch (mode) { 35 + case WAIT_CLOCKED: 36 + break; 37 + case WAIT_UNCLOCKED: 38 + ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET; 39 + break; 40 + case WAIT_UNCLOCKED_POWER_OFF: 41 + case STOP_POWER_OFF: 42 + plat_lpc |= MXC_CORTEXA8_PLAT_LPC_DSM 43 + | MXC_CORTEXA8_PLAT_LPC_DBG_DSM; 44 + if (mode == WAIT_UNCLOCKED_POWER_OFF) { 45 + ccm_clpcr |= 0x1 << MXC_CCM_CLPCR_LPM_OFFSET; 46 + ccm_clpcr &= ~MXC_CCM_CLPCR_VSTBY; 47 + ccm_clpcr &= ~MXC_CCM_CLPCR_SBYOS; 48 + stop_mode = 0; 49 + } else { 50 + ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET; 51 + ccm_clpcr |= 0x3 << MXC_CCM_CLPCR_STBY_COUNT_OFFSET; 52 + ccm_clpcr |= MXC_CCM_CLPCR_VSTBY; 53 + ccm_clpcr |= MXC_CCM_CLPCR_SBYOS; 54 + stop_mode = 1; 55 + } 56 + arm_srpgcr |= MXC_SRPGCR_PCR; 57 + 58 + if (tzic_enable_wake(1) != 0) 59 + return; 60 + break; 61 + case STOP_POWER_ON: 62 + ccm_clpcr |= 0x2 << MXC_CCM_CLPCR_LPM_OFFSET; 63 + break; 64 + default: 65 + printk(KERN_WARNING "UNKNOWN cpu power mode: %d\n", mode); 66 + return; 67 + } 68 + 69 + __raw_writel(plat_lpc, MXC_CORTEXA8_PLAT_LPC); 70 + __raw_writel(ccm_clpcr, MXC_CCM_CLPCR); 71 + __raw_writel(arm_srpgcr, MXC_SRPG_ARM_SRPGCR); 72 + 73 + /* Enable NEON SRPG for all but MX50TO1.0. */ 74 + if (mx50_revision() != IMX_CHIP_REVISION_1_0) 75 + __raw_writel(arm_srpgcr, MXC_SRPG_NEON_SRPGCR); 76 + 77 + if (stop_mode) { 78 + empgc0 |= MXC_SRPGCR_PCR; 79 + empgc1 |= MXC_SRPGCR_PCR; 80 + 81 + __raw_writel(empgc0, MXC_SRPG_EMPGC0_SRPGCR); 82 + __raw_writel(empgc1, MXC_SRPG_EMPGC1_SRPGCR); 83 + } 84 + }
+2
arch/arm/mach-mxs/Kconfig
··· 22 22 select SOC_IMX23 23 23 select MXS_HAVE_AMBA_DUART 24 24 select MXS_HAVE_PLATFORM_AUART 25 + select MXS_HAVE_PLATFORM_MXS_MMC 25 26 select MXS_HAVE_PLATFORM_MXSFB 26 27 default y 27 28 help ··· 36 35 select MXS_HAVE_PLATFORM_AUART 37 36 select MXS_HAVE_PLATFORM_FEC 38 37 select MXS_HAVE_PLATFORM_FLEXCAN 38 + select MXS_HAVE_PLATFORM_MXS_MMC 39 39 select MXS_HAVE_PLATFORM_MXSFB 40 40 select MXS_OCOTP 41 41 default y
+15
arch/arm/mach-mxs/clock-mx23.c
··· 521 521 __raw_writel(BM_CLKCTRL_CPU_INTERRUPT_WAIT, 522 522 CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU_SET); 523 523 524 + /* 525 + * 480 MHz seems too high to be ssp clock source directly, 526 + * so set frac to get a 288 MHz ref_io. 527 + */ 528 + reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC); 529 + reg &= ~BM_CLKCTRL_FRAC_IOFRAC; 530 + reg |= 30 << BP_CLKCTRL_FRAC_IOFRAC; 531 + __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC); 532 + 524 533 return 0; 525 534 } 526 535 527 536 int __init mx23_clocks_init(void) 528 537 { 529 538 clk_misc_init(); 539 + 540 + /* 541 + * source ssp clock from ref_io than ref_xtal, 542 + * as ref_xtal only provides 24 MHz as maximum. 543 + */ 544 + clk_set_parent(&ssp_clk, &ref_io_clk); 530 545 531 546 clk_enable(&cpu_clk); 532 547 clk_enable(&hbus_clk);
+18
arch/arm/mach-mxs/clock-mx28.c
··· 618 618 _REGISTER_CLOCK("pll2", NULL, pll2_clk) 619 619 _REGISTER_CLOCK("mxs-dma-apbh", NULL, hbus_clk) 620 620 _REGISTER_CLOCK("mxs-dma-apbx", NULL, xbus_clk) 621 + _REGISTER_CLOCK("mxs-mmc.0", NULL, ssp0_clk) 622 + _REGISTER_CLOCK("mxs-mmc.1", NULL, ssp1_clk) 621 623 _REGISTER_CLOCK("flexcan.0", NULL, can0_clk) 622 624 _REGISTER_CLOCK("flexcan.1", NULL, can1_clk) 623 625 _REGISTER_CLOCK(NULL, "usb0", usb0_clk) ··· 739 737 reg |= BM_CLKCTRL_ENET_CLK_OUT_EN; 740 738 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_ENET); 741 739 740 + /* 741 + * 480 MHz seems too high to be ssp clock source directly, 742 + * so set frac0 to get a 288 MHz ref_io0. 743 + */ 744 + reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC0); 745 + reg &= ~BM_CLKCTRL_FRAC0_IO0FRAC; 746 + reg |= 30 << BP_CLKCTRL_FRAC0_IO0FRAC; 747 + __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_FRAC0); 748 + 742 749 return 0; 743 750 } 744 751 745 752 int __init mx28_clocks_init(void) 746 753 { 747 754 clk_misc_init(); 755 + 756 + /* 757 + * source ssp clock from ref_io0 than ref_xtal, 758 + * as ref_xtal only provides 24 MHz as maximum. 759 + */ 760 + clk_set_parent(&ssp0_clk, &ref_io0_clk); 761 + clk_set_parent(&ssp1_clk, &ref_io0_clk); 748 762 749 763 clk_enable(&cpu_clk); 750 764 clk_enable(&hbus_clk);
+4
arch/arm/mach-mxs/devices-mx23.h
··· 21 21 #define mx23_add_auart0() mx23_add_auart(0) 22 22 #define mx23_add_auart1() mx23_add_auart(1) 23 23 24 + extern const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst; 25 + #define mx23_add_mxs_mmc(id, pdata) \ 26 + mxs_add_mxs_mmc(&mx23_mxs_mmc_data[id], pdata) 27 + 24 28 #define mx23_add_mxs_pwm(id) mxs_add_mxs_pwm(MX23_PWM_BASE_ADDR, id) 25 29 26 30 struct platform_device *__init mx23_add_mxsfb(
+4
arch/arm/mach-mxs/devices-mx28.h
··· 37 37 extern const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst; 38 38 #define mx28_add_mxs_i2c(id) mxs_add_mxs_i2c(&mx28_mxs_i2c_data[id]) 39 39 40 + extern const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst; 41 + #define mx28_add_mxs_mmc(id, pdata) \ 42 + mxs_add_mxs_mmc(&mx28_mxs_mmc_data[id], pdata) 43 + 40 44 #define mx28_add_mxs_pwm(id) mxs_add_mxs_pwm(MX28_PWM_BASE_ADDR, id) 41 45 42 46 struct platform_device *__init mx28_add_mxsfb(
+3
arch/arm/mach-mxs/devices/Kconfig
··· 15 15 config MXS_HAVE_PLATFORM_MXS_I2C 16 16 bool 17 17 18 + config MXS_HAVE_PLATFORM_MXS_MMC 19 + bool 20 + 18 21 config MXS_HAVE_PLATFORM_MXS_PWM 19 22 bool 20 23
+1
arch/arm/mach-mxs/devices/Makefile
··· 4 4 obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o 5 5 obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 6 6 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_I2C) += platform-mxs-i2c.o 7 + obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_MMC) += platform-mxs-mmc.o 7 8 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o 8 9 obj-$(CONFIG_MXS_HAVE_PLATFORM_MXSFB) += platform-mxsfb.o
+73
arch/arm/mach-mxs/devices/platform-mxs-mmc.c
··· 1 + /* 2 + * Copyright (C) 2010 Pengutronix 3 + * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> 4 + * 5 + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. 6 + * 7 + * This program is free software; you can redistribute it and/or modify it under 8 + * the terms of the GNU General Public License version 2 as published by the 9 + * Free Software Foundation. 10 + */ 11 + 12 + #include <linux/compiler.h> 13 + #include <linux/err.h> 14 + #include <linux/init.h> 15 + 16 + #include <mach/mx23.h> 17 + #include <mach/mx28.h> 18 + #include <mach/devices-common.h> 19 + 20 + #define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \ 21 + { \ 22 + .id = _id, \ 23 + .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \ 24 + .dma = soc ## _DMA_SSP ## hwid, \ 25 + .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \ 26 + .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \ 27 + } 28 + 29 + #define mxs_mxs_mmc_data_entry(soc, _id, hwid) \ 30 + [_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid) 31 + 32 + 33 + #ifdef CONFIG_SOC_IMX23 34 + const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = { 35 + mxs_mxs_mmc_data_entry(MX23, 0, 1), 36 + mxs_mxs_mmc_data_entry(MX23, 1, 2), 37 + }; 38 + #endif 39 + 40 + #ifdef CONFIG_SOC_IMX28 41 + const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = { 42 + mxs_mxs_mmc_data_entry(MX28, 0, 0), 43 + mxs_mxs_mmc_data_entry(MX28, 1, 1), 44 + }; 45 + #endif 46 + 47 + struct platform_device *__init mxs_add_mxs_mmc( 48 + const struct mxs_mxs_mmc_data *data, 49 + const struct mxs_mmc_platform_data *pdata) 50 + { 51 + struct resource res[] = { 52 + { 53 + .start = data->iobase, 54 + .end = data->iobase + SZ_8K - 1, 55 + .flags = IORESOURCE_MEM, 56 + }, { 57 + .start = data->dma, 58 + .end = data->dma, 59 + .flags = IORESOURCE_DMA, 60 + }, { 61 + .start = data->irq_err, 62 + .end = data->irq_err, 63 + .flags = IORESOURCE_IRQ, 64 + }, { 65 + .start = data->irq_dma, 66 + .end = data->irq_dma, 67 + .flags = IORESOURCE_IRQ, 68 + }, 69 + }; 70 + 71 + return mxs_add_platform_device("mxs-mmc", data->id, 72 + res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); 73 + }
+13
arch/arm/mach-mxs/include/mach/devices-common.h
··· 73 73 }; 74 74 struct platform_device * __init mxs_add_mxs_i2c(const struct mxs_i2c_data *data); 75 75 76 + /* mmc */ 77 + #include <mach/mmc.h> 78 + struct mxs_mxs_mmc_data { 79 + int id; 80 + resource_size_t iobase; 81 + resource_size_t dma; 82 + resource_size_t irq_err; 83 + resource_size_t irq_dma; 84 + }; 85 + struct platform_device *__init mxs_add_mxs_mmc( 86 + const struct mxs_mxs_mmc_data *data, 87 + const struct mxs_mmc_platform_data *pdata); 88 + 76 89 /* pwm */ 77 90 struct platform_device *__init mxs_add_mxs_pwm( 78 91 resource_size_t iobase, int id);
+44
arch/arm/mach-mxs/mach-mx23evk.c
··· 28 28 29 29 #define MX23EVK_LCD_ENABLE MXS_GPIO_NR(1, 18) 30 30 #define MX23EVK_BL_ENABLE MXS_GPIO_NR(1, 28) 31 + #define MX23EVK_MMC0_WRITE_PROTECT MXS_GPIO_NR(1, 30) 32 + #define MX23EVK_MMC0_SLOT_POWER MXS_GPIO_NR(1, 29) 31 33 32 34 static const iomux_cfg_t mx23evk_pads[] __initconst = { 33 35 /* duart */ ··· 75 73 MX23_PAD_LCD_RESET__GPIO_1_18 | MXS_PAD_CTRL, 76 74 /* backlight control */ 77 75 MX23_PAD_PWM2__GPIO_1_28 | MXS_PAD_CTRL, 76 + 77 + /* mmc */ 78 + MX23_PAD_SSP1_DATA0__SSP1_DATA0 | 79 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 80 + MX23_PAD_SSP1_DATA1__SSP1_DATA1 | 81 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 82 + MX23_PAD_SSP1_DATA2__SSP1_DATA2 | 83 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 84 + MX23_PAD_SSP1_DATA3__SSP1_DATA3 | 85 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 86 + MX23_PAD_GPMI_D08__SSP1_DATA4 | 87 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 88 + MX23_PAD_GPMI_D09__SSP1_DATA5 | 89 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 90 + MX23_PAD_GPMI_D10__SSP1_DATA6 | 91 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 92 + MX23_PAD_GPMI_D11__SSP1_DATA7 | 93 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 94 + MX23_PAD_SSP1_CMD__SSP1_CMD | 95 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 96 + MX23_PAD_SSP1_DETECT__SSP1_DETECT | 97 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 98 + MX23_PAD_SSP1_SCK__SSP1_SCK | 99 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 100 + /* write protect */ 101 + MX23_PAD_PWM4__GPIO_1_30 | 102 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 103 + /* slot power enable */ 104 + MX23_PAD_PWM3__GPIO_1_29 | 105 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 78 106 }; 79 107 80 108 /* mxsfb (lcdif) */ ··· 133 101 .ld_intf_width = STMLCDIF_24BIT, 134 102 }; 135 103 104 + static struct mxs_mmc_platform_data mx23evk_mmc_pdata __initdata = { 105 + .wp_gpio = MX23EVK_MMC0_WRITE_PROTECT, 106 + .flags = SLOTF_8_BIT_CAPABLE, 107 + }; 108 + 136 109 static void __init mx23evk_init(void) 137 110 { 138 111 int ret; ··· 146 109 147 110 mx23_add_duart(); 148 111 mx23_add_auart0(); 112 + 113 + /* power on mmc slot by writing 0 to the gpio */ 114 + ret = gpio_request_one(MX23EVK_MMC0_SLOT_POWER, GPIOF_DIR_OUT, 115 + "mmc0-slot-power"); 116 + if (ret) 117 + pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); 118 + mx23_add_mxs_mmc(0, &mx23evk_mmc_pdata); 149 119 150 120 ret = gpio_request_one(MX23EVK_LCD_ENABLE, GPIOF_DIR_OUT, "lcd-enable"); 151 121 if (ret)
+89
arch/arm/mach-mxs/mach-mx28evk.c
··· 34 34 #define MX28EVK_LCD_ENABLE MXS_GPIO_NR(3, 30) 35 35 #define MX28EVK_FEC_PHY_RESET MXS_GPIO_NR(4, 13) 36 36 37 + #define MX28EVK_MMC0_WRITE_PROTECT MXS_GPIO_NR(2, 12) 38 + #define MX28EVK_MMC1_WRITE_PROTECT MXS_GPIO_NR(0, 28) 39 + #define MX28EVK_MMC0_SLOT_POWER MXS_GPIO_NR(3, 28) 40 + #define MX28EVK_MMC1_SLOT_POWER MXS_GPIO_NR(3, 29) 41 + 37 42 static const iomux_cfg_t mx28evk_pads[] __initconst = { 38 43 /* duart */ 39 44 MX28_PAD_PWM0__DUART_RX | MXS_PAD_CTRL, ··· 120 115 MX28_PAD_LCD_RESET__GPIO_3_30 | MXS_PAD_CTRL, 121 116 /* backlight control */ 122 117 MX28_PAD_PWM2__GPIO_3_18 | MXS_PAD_CTRL, 118 + /* mmc0 */ 119 + MX28_PAD_SSP0_DATA0__SSP0_D0 | 120 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 121 + MX28_PAD_SSP0_DATA1__SSP0_D1 | 122 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 123 + MX28_PAD_SSP0_DATA2__SSP0_D2 | 124 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 125 + MX28_PAD_SSP0_DATA3__SSP0_D3 | 126 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 127 + MX28_PAD_SSP0_DATA4__SSP0_D4 | 128 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 129 + MX28_PAD_SSP0_DATA5__SSP0_D5 | 130 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 131 + MX28_PAD_SSP0_DATA6__SSP0_D6 | 132 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 133 + MX28_PAD_SSP0_DATA7__SSP0_D7 | 134 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 135 + MX28_PAD_SSP0_CMD__SSP0_CMD | 136 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 137 + MX28_PAD_SSP0_DETECT__SSP0_CARD_DETECT | 138 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 139 + MX28_PAD_SSP0_SCK__SSP0_SCK | 140 + (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 141 + /* write protect */ 142 + MX28_PAD_SSP1_SCK__GPIO_2_12 | 143 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 144 + /* slot power enable */ 145 + MX28_PAD_PWM3__GPIO_3_28 | 146 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 147 + 148 + /* mmc1 */ 149 + MX28_PAD_GPMI_D00__SSP1_D0 | 150 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 151 + MX28_PAD_GPMI_D01__SSP1_D1 | 152 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 153 + MX28_PAD_GPMI_D02__SSP1_D2 | 154 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 155 + MX28_PAD_GPMI_D03__SSP1_D3 | 156 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 157 + MX28_PAD_GPMI_D04__SSP1_D4 | 158 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 159 + MX28_PAD_GPMI_D05__SSP1_D5 | 160 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 161 + MX28_PAD_GPMI_D06__SSP1_D6 | 162 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 163 + MX28_PAD_GPMI_D07__SSP1_D7 | 164 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 165 + MX28_PAD_GPMI_RDY1__SSP1_CMD | 166 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP), 167 + MX28_PAD_GPMI_RDY0__SSP1_CARD_DETECT | 168 + (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 169 + MX28_PAD_GPMI_WRN__SSP1_SCK | 170 + (MXS_PAD_12MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 171 + /* write protect */ 172 + MX28_PAD_GPMI_RESETN__GPIO_0_28 | 173 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 174 + /* slot power enable */ 175 + MX28_PAD_PWM4__GPIO_3_29 | 176 + (MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), 123 177 }; 124 178 125 179 /* fec */ ··· 322 258 .ld_intf_width = STMLCDIF_24BIT, 323 259 }; 324 260 261 + static struct mxs_mmc_platform_data mx28evk_mmc_pdata[] __initdata = { 262 + { 263 + /* mmc0 */ 264 + .wp_gpio = MX28EVK_MMC0_WRITE_PROTECT, 265 + .flags = SLOTF_8_BIT_CAPABLE, 266 + }, { 267 + /* mmc1 */ 268 + .wp_gpio = MX28EVK_MMC1_WRITE_PROTECT, 269 + .flags = SLOTF_8_BIT_CAPABLE, 270 + }, 271 + }; 272 + 325 273 static void __init mx28evk_init(void) 326 274 { 327 275 int ret; ··· 373 297 gpio_set_value(MX28EVK_BL_ENABLE, 1); 374 298 375 299 mx28_add_mxsfb(&mx28evk_mxsfb_pdata); 300 + 301 + /* power on mmc slot by writing 0 to the gpio */ 302 + ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_DIR_OUT, 303 + "mmc0-slot-power"); 304 + if (ret) 305 + pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); 306 + mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]); 307 + 308 + ret = gpio_request_one(MX28EVK_MMC1_SLOT_POWER, GPIOF_DIR_OUT, 309 + "mmc1-slot-power"); 310 + if (ret) 311 + pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret); 312 + mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); 376 313 } 377 314 378 315 static void __init mx28evk_timer_init(void)
+35 -6
arch/arm/mach-mxs/module-tx28.c
··· 45 45 }; 46 46 47 47 #define FEC_MODE (MXS_PAD_8MA | MXS_PAD_PULLUP | MXS_PAD_3V3) 48 - static const iomux_cfg_t tx28_fec_pads[] __initconst = { 48 + static const iomux_cfg_t tx28_fec0_pads[] __initconst = { 49 49 MX28_PAD_ENET0_MDC__ENET0_MDC | FEC_MODE, 50 50 MX28_PAD_ENET0_MDIO__ENET0_MDIO | FEC_MODE, 51 51 MX28_PAD_ENET0_RX_EN__ENET0_RX_EN | FEC_MODE, ··· 57 57 MX28_PAD_ENET_CLK__CLKCTRL_ENET | FEC_MODE, 58 58 }; 59 59 60 - static const struct fec_platform_data tx28_fec_data __initconst = { 60 + static const iomux_cfg_t tx28_fec1_pads[] __initconst = { 61 + MX28_PAD_ENET0_RXD2__ENET1_RXD0, 62 + MX28_PAD_ENET0_RXD3__ENET1_RXD1, 63 + MX28_PAD_ENET0_TXD2__ENET1_TXD0, 64 + MX28_PAD_ENET0_TXD3__ENET1_TXD1, 65 + MX28_PAD_ENET0_COL__ENET1_TX_EN, 66 + MX28_PAD_ENET0_CRS__ENET1_RX_EN, 67 + }; 68 + 69 + static struct fec_platform_data tx28_fec0_data = { 70 + .phy = PHY_INTERFACE_MODE_RMII, 71 + }; 72 + 73 + static struct fec_platform_data tx28_fec1_data = { 61 74 .phy = PHY_INTERFACE_MODE_RMII, 62 75 }; 63 76 ··· 121 108 pr_debug("%s: Deasserting FEC PHY RESET\n", __func__); 122 109 gpio_set_value(TX28_FEC_PHY_RESET, 1); 123 110 124 - ret = mxs_iomux_setup_multiple_pads(tx28_fec_pads, 125 - ARRAY_SIZE(tx28_fec_pads)); 111 + ret = mxs_iomux_setup_multiple_pads(tx28_fec0_pads, 112 + ARRAY_SIZE(tx28_fec0_pads)); 126 113 if (ret) { 127 114 pr_debug("%s: mxs_iomux_setup_multiple_pads() failed with rc: %d\n", 128 115 __func__, ret); 129 116 goto free_gpios; 130 117 } 131 - pr_debug("%s: Registering FEC device\n", __func__); 132 - mx28_add_fec(0, &tx28_fec_data); 118 + pr_debug("%s: Registering FEC0 device\n", __func__); 119 + mx28_add_fec(0, &tx28_fec0_data); 133 120 return 0; 134 121 135 122 free_gpios: ··· 141 128 } 142 129 143 130 return ret; 131 + } 132 + 133 + int __init tx28_add_fec1(void) 134 + { 135 + int ret; 136 + 137 + ret = mxs_iomux_setup_multiple_pads(tx28_fec1_pads, 138 + ARRAY_SIZE(tx28_fec1_pads)); 139 + if (ret) { 140 + pr_debug("%s: mxs_iomux_setup_multiple_pads() failed with rc: %d\n", 141 + __func__, ret); 142 + return ret; 143 + } 144 + pr_debug("%s: Registering FEC1 device\n", __func__); 145 + mx28_add_fec(1, &tx28_fec1_data); 146 + return 0; 144 147 }
+1
arch/arm/mach-mxs/module-tx28.h
··· 7 7 * Free Software Foundation. 8 8 */ 9 9 int __init tx28_add_fec0(void); 10 + int __init tx28_add_fec1(void);
+4 -4
arch/arm/mach-pxa/am200epd.c
··· 128 128 return 0; 129 129 130 130 err_req_gpio: 131 - while (i > 0) 132 - gpio_free(gpios[i--]); 131 + while (--i >= 0) 132 + gpio_free(gpios[i]); 133 133 134 134 return err; 135 135 } ··· 194 194 }; 195 195 196 196 /* this gets called as part of our init. these steps must be done now so 197 - * that we can use set_pxa_fb_info */ 197 + * that we can use pxa_set_fb_info */ 198 198 static void __init am200_presetup_fb(void) 199 199 { 200 200 int fw; ··· 249 249 /* we divide since we told the LCD controller we're 16bpp */ 250 250 am200_fb_info.modes->xres /= 2; 251 251 252 - set_pxa_fb_info(&am200_fb_info); 252 + pxa_set_fb_info(NULL, &am200_fb_info); 253 253 254 254 } 255 255
+7 -6
arch/arm/mach-pxa/am300epd.c
··· 125 125 if (err) { 126 126 dev_err(&am300_device->dev, "failed requesting " 127 127 "gpio %d, err=%d\n", i, err); 128 - while (i >= DB0_GPIO_PIN) 129 - gpio_free(i--); 130 - i = ARRAY_SIZE(gpios) - 1; 131 - goto err_req_gpio; 128 + goto err_req_gpio2; 132 129 } 133 130 } 134 131 ··· 156 159 157 160 return 0; 158 161 162 + err_req_gpio2: 163 + while (--i >= DB0_GPIO_PIN) 164 + gpio_free(i); 165 + i = ARRAY_SIZE(gpios); 159 166 err_req_gpio: 160 - while (i > 0) 161 - gpio_free(gpios[i--]); 167 + while (--i >= 0) 168 + gpio_free(gpios[i]); 162 169 163 170 return err; 164 171 }
+1 -1
arch/arm/mach-pxa/balloon3.c
··· 263 263 } 264 264 265 265 balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power; 266 - set_pxa_fb_info(&balloon3_lcd_screen); 266 + pxa_set_fb_info(NULL, &balloon3_lcd_screen); 267 267 return; 268 268 269 269 err2:
+1 -1
arch/arm/mach-pxa/cm-x2xx.c
··· 379 379 380 380 static void __init cmx2xx_init_display(void) 381 381 { 382 - set_pxa_fb_info(cmx2xx_display); 382 + pxa_set_fb_info(NULL, cmx2xx_display); 383 383 } 384 384 #else 385 385 static inline void cmx2xx_init_display(void) {}
+1 -1
arch/arm/mach-pxa/cm-x300.c
··· 296 296 297 297 static void __init cm_x300_init_lcd(void) 298 298 { 299 - set_pxa_fb_info(&cm_x300_lcd); 299 + pxa_set_fb_info(NULL, &cm_x300_lcd); 300 300 } 301 301 #else 302 302 static inline void cm_x300_init_lcd(void) {}
+1 -1
arch/arm/mach-pxa/colibri-pxa270-income.c
··· 175 175 176 176 static void __init income_lcd_init(void) 177 177 { 178 - set_pxa_fb_info(&income_lcd_screen); 178 + pxa_set_fb_info(NULL, &income_lcd_screen); 179 179 } 180 180 #else 181 181 static inline void income_lcd_init(void) {}
+1 -1
arch/arm/mach-pxa/colibri-pxa3xx.c
··· 105 105 lcd_bl_pin = bl_pin; 106 106 gpio_request(bl_pin, "lcd backlight"); 107 107 gpio_direction_output(bl_pin, 0); 108 - set_pxa_fb_info(&sharp_lq43_info); 108 + pxa_set_fb_info(NULL, &sharp_lq43_info); 109 109 } 110 110 #endif 111 111
-1
arch/arm/mach-pxa/corgi.c
··· 462 462 * USB Device Controller 463 463 */ 464 464 static struct pxa2xx_udc_mach_info udc_info __initdata = { 465 - .gpio_vbus = -1, 466 465 /* no connect GPIO; corgi can't tell connection status */ 467 466 .gpio_pullup = CORGI_GPIO_USB_PULLUP, 468 467 };
+2 -7
arch/arm/mach-pxa/devices.c
··· 90 90 91 91 static struct pxa2xx_udc_mach_info pxa_udc_info = { 92 92 .gpio_pullup = -1, 93 - .gpio_vbus = -1, 94 93 }; 95 94 96 95 void __init pxa_set_udc_info(struct pxa2xx_udc_mach_info *info) ··· 187 188 .resource = pxafb_resources, 188 189 }; 189 190 190 - void __init set_pxa_fb_info(struct pxafb_mach_info *info) 191 + void __init pxa_set_fb_info(struct device *parent, struct pxafb_mach_info *info) 191 192 { 193 + pxa_device_fb.dev.parent = parent; 192 194 pxa_register_device(&pxa_device_fb, info); 193 - } 194 - 195 - void __init set_pxa_fb_parent(struct device *parent_dev) 196 - { 197 - pxa_device_fb.dev.parent = parent_dev; 198 195 } 199 196 200 197 static struct resource pxa_resource_ffuart[] = {
+1 -1
arch/arm/mach-pxa/em-x270.c
··· 689 689 690 690 static void __init em_x270_init_lcd(void) 691 691 { 692 - set_pxa_fb_info(&em_x270_lcd); 692 + pxa_set_fb_info(NULL, &em_x270_lcd); 693 693 } 694 694 #else 695 695 static inline void em_x270_init_lcd(void) {}
+27 -9
arch/arm/mach-pxa/eseries.c
··· 20 20 #include <linux/mfd/t7l66xb.h> 21 21 #include <linux/mtd/nand.h> 22 22 #include <linux/mtd/partitions.h> 23 + #include <linux/usb/gpio_vbus.h> 23 24 24 25 #include <video/w100fb.h> 25 26 ··· 52 51 mi->bank[0].size = (64*1024*1024); 53 52 } 54 53 55 - struct pxa2xx_udc_mach_info e7xx_udc_mach_info = { 54 + struct gpio_vbus_mach_info e7xx_udc_info = { 56 55 .gpio_vbus = GPIO_E7XX_USB_DISC, 57 56 .gpio_pullup = GPIO_E7XX_USB_PULLUP, 58 57 .gpio_pullup_inverted = 1 58 + }; 59 + 60 + static struct platform_device e7xx_gpio_vbus = { 61 + .name = "gpio-vbus", 62 + .id = -1, 63 + .dev = { 64 + .platform_data = &e7xx_udc_info, 65 + }, 59 66 }; 60 67 61 68 struct pxaficp_platform_data e7xx_ficp_platform_data = { ··· 174 165 175 166 static struct platform_device *e330_devices[] __initdata = { 176 167 &e330_tc6387xb_device, 168 + &e7xx_gpio_vbus, 177 169 }; 178 170 179 171 static void __init e330_init(void) ··· 185 175 eseries_register_clks(); 186 176 eseries_get_tmio_gpios(); 187 177 platform_add_devices(ARRAY_AND_SIZE(e330_devices)); 188 - pxa_set_udc_info(&e7xx_udc_mach_info); 189 178 } 190 179 191 180 MACHINE_START(E330, "Toshiba e330") ··· 223 214 224 215 static struct platform_device *e350_devices[] __initdata = { 225 216 &e350_t7l66xb_device, 217 + &e7xx_gpio_vbus, 226 218 }; 227 219 228 220 static void __init e350_init(void) ··· 234 224 eseries_register_clks(); 235 225 eseries_get_tmio_gpios(); 236 226 platform_add_devices(ARRAY_AND_SIZE(e350_devices)); 237 - pxa_set_udc_info(&e7xx_udc_mach_info); 238 227 } 239 228 240 229 MACHINE_START(E350, "Toshiba e350") ··· 342 333 343 334 static struct platform_device *e400_devices[] __initdata = { 344 335 &e400_t7l66xb_device, 336 + &e7xx_gpio_vbus, 345 337 }; 346 338 347 339 static void __init e400_init(void) ··· 354 344 /* Fixme - e400 may have a switched clock */ 355 345 eseries_register_clks(); 356 346 eseries_get_tmio_gpios(); 357 - set_pxa_fb_info(&e400_pxafb_mach_info); 347 + pxa_set_fb_info(NULL, &e400_pxafb_mach_info); 358 348 platform_add_devices(ARRAY_AND_SIZE(e400_devices)); 359 - pxa_set_udc_info(&e7xx_udc_mach_info); 360 349 } 361 350 362 351 MACHINE_START(E400, "Toshiba e400") ··· 528 519 static struct platform_device *e740_devices[] __initdata = { 529 520 &e740_fb_device, 530 521 &e740_t7l66xb_device, 522 + &e7xx_gpio_vbus, 531 523 }; 532 524 533 525 static void __init e740_init(void) ··· 542 532 "UDCCLK", &pxa25x_device_udc.dev), 543 533 eseries_get_tmio_gpios(); 544 534 platform_add_devices(ARRAY_AND_SIZE(e740_devices)); 545 - pxa_set_udc_info(&e7xx_udc_mach_info); 546 535 pxa_set_ac97_info(NULL); 547 536 pxa_set_ficp_info(&e7xx_ficp_platform_data); 548 537 } ··· 720 711 static struct platform_device *e750_devices[] __initdata = { 721 712 &e750_fb_device, 722 713 &e750_tc6393xb_device, 714 + &e7xx_gpio_vbus, 723 715 }; 724 716 725 717 static void __init e750_init(void) ··· 733 723 "GPIO11_CLK", NULL), 734 724 eseries_get_tmio_gpios(); 735 725 platform_add_devices(ARRAY_AND_SIZE(e750_devices)); 736 - pxa_set_udc_info(&e7xx_udc_mach_info); 737 726 pxa_set_ac97_info(NULL); 738 727 pxa_set_ficp_info(&e7xx_ficp_platform_data); 739 728 } ··· 882 873 883 874 /* --------------------------- UDC definitions --------------------------- */ 884 875 885 - static struct pxa2xx_udc_mach_info e800_udc_mach_info = { 876 + static struct gpio_vbus_mach_info e800_udc_info = { 886 877 .gpio_vbus = GPIO_E800_USB_DISC, 887 878 .gpio_pullup = GPIO_E800_USB_PULLUP, 888 879 .gpio_pullup_inverted = 1 889 880 }; 881 + 882 + static struct platform_device e800_gpio_vbus = { 883 + .name = "gpio-vbus", 884 + .id = -1, 885 + .dev = { 886 + .platform_data = &e800_udc_info, 887 + }, 888 + }; 889 + 890 890 891 891 /* ----------------- e800 tc6393xb parameters ------------------ */ 892 892 ··· 925 907 static struct platform_device *e800_devices[] __initdata = { 926 908 &e800_fb_device, 927 909 &e800_tc6393xb_device, 910 + &e800_gpio_vbus, 928 911 }; 929 912 930 913 static void __init e800_init(void) ··· 938 919 "GPIO11_CLK", NULL), 939 920 eseries_get_tmio_gpios(); 940 921 platform_add_devices(ARRAY_AND_SIZE(e800_devices)); 941 - pxa_set_udc_info(&e800_udc_mach_info); 942 922 pxa_set_ac97_info(NULL); 943 923 } 944 924
+6 -6
arch/arm/mach-pxa/ezx.c
··· 783 783 784 784 pxa_set_i2c_info(NULL); 785 785 786 - set_pxa_fb_info(&ezx_fb_info_1); 786 + pxa_set_fb_info(NULL, &ezx_fb_info_1); 787 787 788 788 pxa_set_keypad_info(&a780_keypad_platform_data); 789 789 ··· 853 853 pxa_set_i2c_info(NULL); 854 854 i2c_register_board_info(0, ARRAY_AND_SIZE(e680_i2c_board_info)); 855 855 856 - set_pxa_fb_info(&ezx_fb_info_1); 856 + pxa_set_fb_info(NULL, &ezx_fb_info_1); 857 857 858 858 pxa_set_keypad_info(&e680_keypad_platform_data); 859 859 ··· 918 918 pxa_set_i2c_info(NULL); 919 919 i2c_register_board_info(0, ARRAY_AND_SIZE(a1200_i2c_board_info)); 920 920 921 - set_pxa_fb_info(&ezx_fb_info_2); 921 + pxa_set_fb_info(NULL, &ezx_fb_info_2); 922 922 923 923 pxa_set_keypad_info(&a1200_keypad_platform_data); 924 924 ··· 1103 1103 pxa_set_i2c_info(NULL); 1104 1104 i2c_register_board_info(0, ARRAY_AND_SIZE(a910_i2c_board_info)); 1105 1105 1106 - set_pxa_fb_info(&ezx_fb_info_2); 1106 + pxa_set_fb_info(NULL, &ezx_fb_info_2); 1107 1107 1108 1108 pxa_set_keypad_info(&a910_keypad_platform_data); 1109 1109 ··· 1173 1173 pxa_set_i2c_info(NULL); 1174 1174 i2c_register_board_info(0, ARRAY_AND_SIZE(e6_i2c_board_info)); 1175 1175 1176 - set_pxa_fb_info(&ezx_fb_info_2); 1176 + pxa_set_fb_info(NULL, &ezx_fb_info_2); 1177 1177 1178 1178 pxa_set_keypad_info(&e6_keypad_platform_data); 1179 1179 ··· 1212 1212 pxa_set_i2c_info(NULL); 1213 1213 i2c_register_board_info(0, ARRAY_AND_SIZE(e2_i2c_board_info)); 1214 1214 1215 - set_pxa_fb_info(&ezx_fb_info_2); 1215 + pxa_set_fb_info(NULL, &ezx_fb_info_2); 1216 1216 1217 1217 pxa_set_keypad_info(&e2_keypad_platform_data); 1218 1218
+11 -2
arch/arm/mach-pxa/gumstix.c
··· 26 26 #include <linux/gpio.h> 27 27 #include <linux/err.h> 28 28 #include <linux/clk.h> 29 + #include <linux/usb/gpio_vbus.h> 29 30 30 31 #include <asm/setup.h> 31 32 #include <asm/memory.h> ··· 107 106 #endif 108 107 109 108 #ifdef CONFIG_USB_GADGET_PXA25X 110 - static struct pxa2xx_udc_mach_info gumstix_udc_info __initdata = { 109 + static struct gpio_vbus_mach_info gumstix_udc_info = { 111 110 .gpio_vbus = GPIO_GUMSTIX_USB_GPIOn, 112 111 .gpio_pullup = GPIO_GUMSTIX_USB_GPIOx, 113 112 }; 114 113 114 + static struct platform_device gumstix_gpio_vbus = { 115 + .name = "gpio-vbus", 116 + .id = -1, 117 + .dev = { 118 + .platform_data = &gumstix_udc_info, 119 + }, 120 + }; 121 + 115 122 static void __init gumstix_udc_init(void) 116 123 { 117 - pxa_set_udc_info(&gumstix_udc_info); 124 + platform_device_register(&gumstix_gpio_vbus); 118 125 } 119 126 #else 120 127 static void gumstix_udc_init(void)
+1 -1
arch/arm/mach-pxa/idp.c
··· 167 167 168 168 platform_device_register(&smc91x_device); 169 169 //platform_device_register(&mst_audio_device); 170 - set_pxa_fb_info(&sharp_lm8v31); 170 + pxa_set_fb_info(NULL, &sharp_lm8v31); 171 171 pxa_set_mci_info(&idp_mci_platform_data); 172 172 } 173 173
+5
arch/arm/mach-pxa/include/mach/palmz72.h
··· 44 44 #define GPIO_NR_PALMZ72_BT_POWER 17 45 45 #define GPIO_NR_PALMZ72_BT_RESET 83 46 46 47 + /* Camera */ 48 + #define GPIO_NR_PALMZ72_CAM_PWDN 56 49 + #define GPIO_NR_PALMZ72_CAM_RESET 57 50 + #define GPIO_NR_PALMZ72_CAM_POWER 91 51 + 47 52 /** Initial values **/ 48 53 49 54 /* Battery */
+2 -2
arch/arm/mach-pxa/include/mach/pxafb.h
··· 154 154 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *); 155 155 void (*smart_update)(struct fb_info *); 156 156 }; 157 - void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info); 158 - void set_pxa_fb_parent(struct device *parent_dev); 157 + 158 + void pxa_set_fb_info(struct device *, struct pxafb_mach_info *); 159 159 unsigned long pxafb_get_hsync_time(struct device *dev); 160 160 161 161 extern int pxafb_smart_queue(struct fb_info *info, uint16_t *cmds, int);
+1 -2
arch/arm/mach-pxa/include/mach/z2.h
··· 25 25 #define GPIO98_ZIPITZ2_LID_BUTTON 98 26 26 27 27 /* Libertas GSPI8686 WiFi */ 28 - #define GPIO14_ZIPITZ2_WIFI_RESET 14 29 - #define GPIO15_ZIPITZ2_WIFI_POWER 15 28 + #define GPIO14_ZIPITZ2_WIFI_POWER 14 30 29 #define GPIO24_ZIPITZ2_WIFI_CS 24 31 30 #define GPIO36_ZIPITZ2_WIFI_IRQ 36 32 31
+1 -1
arch/arm/mach-pxa/littleton.c
··· 185 185 186 186 static void littleton_init_lcd(void) 187 187 { 188 - set_pxa_fb_info(&littleton_lcd_info); 188 + pxa_set_fb_info(NULL, &littleton_lcd_info); 189 189 } 190 190 #else 191 191 static inline void littleton_init_lcd(void) {};
+1 -1
arch/arm/mach-pxa/lpd270.c
··· 480 480 pxa_set_ac97_info(NULL); 481 481 482 482 if (lpd270_lcd_to_use != NULL) 483 - set_pxa_fb_info(lpd270_lcd_to_use); 483 + pxa_set_fb_info(NULL, lpd270_lcd_to_use); 484 484 485 485 pxa_set_ohci_info(&lpd270_ohci_platform_data); 486 486 }
+1 -1
arch/arm/mach-pxa/lubbock.c
··· 521 521 522 522 clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL); 523 523 pxa_set_udc_info(&udc_info); 524 - set_pxa_fb_info(&sharp_lm8v31); 524 + pxa_set_fb_info(NULL, &sharp_lm8v31); 525 525 pxa_set_mci_info(&lubbock_mci_platform_data); 526 526 pxa_set_ficp_info(&lubbock_ficp_platform_data); 527 527 pxa_set_ac97_info(NULL);
+1 -1
arch/arm/mach-pxa/magician.c
··· 757 757 gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); 758 758 gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); 759 759 gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); 760 - set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); 760 + pxa_set_fb_info(NULL, lcd_select ? &samsung_info : &toppoly_info); 761 761 } else 762 762 pr_err("LCD detection: CPLD mapping failed\n"); 763 763 }
+1 -1
arch/arm/mach-pxa/mainstone.c
··· 592 592 else 593 593 mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode; 594 594 595 - set_pxa_fb_info(&mainstone_pxafb_info); 595 + pxa_set_fb_info(NULL, &mainstone_pxafb_info); 596 596 mainstone_backlight_register(); 597 597 598 598 pxa_set_mci_info(&mainstone_mci_platform_data);
+1 -1
arch/arm/mach-pxa/mioa701.c
··· 795 795 pxa_set_stuart_info(NULL); 796 796 mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); 797 797 bootstrap_init(); 798 - set_pxa_fb_info(&mioa701_pxafb_info); 798 + pxa_set_fb_info(NULL, &mioa701_pxafb_info); 799 799 pxa_set_mci_info(&mioa701_mci_info); 800 800 pxa_set_keypad_info(&mioa701_keypad_info); 801 801 pxa_set_udc_info(&mioa701_udc_info);
+2 -3
arch/arm/mach-pxa/palm27x.c
··· 1 1 /* 2 2 * Common code for Palm LD, T5, TX, Z72 3 3 * 4 - * Copyright (C) 2010 5 - * Marek Vasut <marek.vasut@gmail.com> 4 + * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com> 6 5 * 7 6 * This program is free software; you can redistribute it and/or modify 8 7 * it under the terms of the GNU General Public License version 2 as ··· 157 158 palm27x_lcd_screen.pxafb_lcd_power = palm27x_lcd_ctl; 158 159 } 159 160 160 - set_pxa_fb_info(&palm27x_lcd_screen); 161 + pxa_set_fb_info(NULL, &palm27x_lcd_screen); 161 162 } 162 163 #endif 163 164
+1 -1
arch/arm/mach-pxa/palmtc.c
··· 507 507 508 508 static void __init palmtc_lcd_init(void) 509 509 { 510 - set_pxa_fb_info(&palmtc_lcd_screen); 510 + pxa_set_fb_info(NULL, &palmtc_lcd_screen); 511 511 } 512 512 #else 513 513 static inline void palmtc_lcd_init(void) {}
+8 -25
arch/arm/mach-pxa/palmte2.c
··· 136 136 /****************************************************************************** 137 137 * Backlight 138 138 ******************************************************************************/ 139 + static struct gpio palmte_bl_gpios[] = { 140 + { GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" }, 141 + { GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" }, 142 + }; 143 + 139 144 static int palmte2_backlight_init(struct device *dev) 140 145 { 141 - int ret; 142 - 143 - ret = gpio_request(GPIO_NR_PALMTE2_BL_POWER, "BL POWER"); 144 - if (ret) 145 - goto err; 146 - ret = gpio_direction_output(GPIO_NR_PALMTE2_BL_POWER, 0); 147 - if (ret) 148 - goto err2; 149 - ret = gpio_request(GPIO_NR_PALMTE2_LCD_POWER, "LCD POWER"); 150 - if (ret) 151 - goto err2; 152 - ret = gpio_direction_output(GPIO_NR_PALMTE2_LCD_POWER, 0); 153 - if (ret) 154 - goto err3; 155 - 156 - return 0; 157 - err3: 158 - gpio_free(GPIO_NR_PALMTE2_LCD_POWER); 159 - err2: 160 - gpio_free(GPIO_NR_PALMTE2_BL_POWER); 161 - err: 162 - return ret; 146 + return gpio_request_array(ARRAY_AND_SIZE(palmte_bl_gpios)); 163 147 } 164 148 165 149 static int palmte2_backlight_notify(struct device *dev, int brightness) ··· 155 171 156 172 static void palmte2_backlight_exit(struct device *dev) 157 173 { 158 - gpio_free(GPIO_NR_PALMTE2_BL_POWER); 159 - gpio_free(GPIO_NR_PALMTE2_LCD_POWER); 174 + gpio_free_array(ARRAY_AND_SIZE(palmte_bl_gpios)); 160 175 } 161 176 162 177 static struct platform_pwm_backlight_data palmte2_backlight_data = { ··· 346 363 pxa_set_btuart_info(NULL); 347 364 pxa_set_stuart_info(NULL); 348 365 349 - set_pxa_fb_info(&palmte2_lcd_screen); 366 + pxa_set_fb_info(NULL, &palmte2_lcd_screen); 350 367 pxa_set_mci_info(&palmte2_mci_platform_data); 351 368 palmte2_udc_init(); 352 369 pxa_set_ac97_info(&palmte2_ac97_pdata);
+127
arch/arm/mach-pxa/palmz72.c
··· 30 30 #include <linux/wm97xx.h> 31 31 #include <linux/power_supply.h> 32 32 #include <linux/usb/gpio_vbus.h> 33 + #include <linux/i2c-gpio.h> 33 34 34 35 #include <asm/mach-types.h> 35 36 #include <asm/mach/arch.h> ··· 48 47 #include <mach/palm27x.h> 49 48 50 49 #include <mach/pm.h> 50 + #include <mach/camera.h> 51 + 52 + #include <media/soc_camera.h> 51 53 52 54 #include "generic.h" 53 55 #include "devices.h" ··· 106 102 GPIO21_GPIO, /* LCD border switch */ 107 103 GPIO22_GPIO, /* LCD border color */ 108 104 GPIO96_GPIO, /* lcd power */ 105 + 106 + /* PXA Camera */ 107 + GPIO81_CIF_DD_0, 108 + GPIO48_CIF_DD_5, 109 + GPIO50_CIF_DD_3, 110 + GPIO51_CIF_DD_2, 111 + GPIO52_CIF_DD_4, 112 + GPIO53_CIF_MCLK, 113 + GPIO54_CIF_PCLK, 114 + GPIO55_CIF_DD_1, 115 + GPIO84_CIF_FV, 116 + GPIO85_CIF_LV, 117 + GPIO93_CIF_DD_6, 118 + GPIO108_CIF_DD_7, 119 + 120 + GPIO56_GPIO, /* OV9640 Powerdown */ 121 + GPIO57_GPIO, /* OV9640 Reset */ 122 + GPIO91_GPIO, /* OV9640 Power */ 123 + 124 + /* I2C */ 125 + GPIO117_GPIO, /* I2C_SCL */ 126 + GPIO118_GPIO, /* I2C_SDA */ 109 127 110 128 /* Misc. */ 111 129 GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* power detect */ ··· 280 254 #endif 281 255 282 256 /****************************************************************************** 257 + * SoC Camera 258 + ******************************************************************************/ 259 + #if defined(CONFIG_SOC_CAMERA_OV9640) || \ 260 + defined(CONFIG_SOC_CAMERA_OV9640_MODULE) 261 + static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { 262 + .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | 263 + PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, 264 + .mclk_10khz = 2600, 265 + }; 266 + 267 + /* Board I2C devices. */ 268 + static struct i2c_board_info palmz72_i2c_device[] = { 269 + { 270 + I2C_BOARD_INFO("ov9640", 0x30), 271 + } 272 + }; 273 + 274 + static int palmz72_camera_power(struct device *dev, int power) 275 + { 276 + gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); 277 + mdelay(50); 278 + return 0; 279 + } 280 + 281 + static int palmz72_camera_reset(struct device *dev) 282 + { 283 + gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); 284 + mdelay(50); 285 + gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); 286 + mdelay(50); 287 + return 0; 288 + } 289 + 290 + static struct soc_camera_link palmz72_iclink = { 291 + .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ 292 + .board_info = &palmz72_i2c_device[0], 293 + .i2c_adapter_id = 0, 294 + .module_name = "ov96xx", 295 + .power = &palmz72_camera_power, 296 + .reset = &palmz72_camera_reset, 297 + .flags = SOCAM_DATAWIDTH_8, 298 + }; 299 + 300 + static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { 301 + .sda_pin = 118, 302 + .scl_pin = 117, 303 + .udelay = 10, 304 + .timeout = 100, 305 + }; 306 + 307 + static struct platform_device palmz72_i2c_bus_device = { 308 + .name = "i2c-gpio", 309 + .id = 0, /* we use this as a replacement for i2c-pxa */ 310 + .dev = { 311 + .platform_data = &palmz72_i2c_bus_data, 312 + } 313 + }; 314 + 315 + static struct platform_device palmz72_camera = { 316 + .name = "soc-camera-pdrv", 317 + .id = -1, 318 + .dev = { 319 + .platform_data = &palmz72_iclink, 320 + }, 321 + }; 322 + 323 + /* Here we request the camera GPIOs and configure them. We power up the camera 324 + * module, deassert the reset pin, but put it into powerdown (low to no power 325 + * consumption) mode. This allows us to later bring the module up fast. */ 326 + static struct gpio palmz72_camera_gpios[] = { 327 + { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" }, 328 + { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" }, 329 + { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" }, 330 + }; 331 + 332 + static inline void __init palmz72_cam_gpio_init(void) 333 + { 334 + int ret; 335 + 336 + ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); 337 + if (!ret) 338 + gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); 339 + else 340 + printk(KERN_ERR "Camera GPIO init failed!\n"); 341 + 342 + return; 343 + } 344 + 345 + static void __init palmz72_camera_init(void) 346 + { 347 + palmz72_cam_gpio_init(); 348 + pxa_set_camera_info(&palmz72_pxacamera_platform_data); 349 + platform_device_register(&palmz72_i2c_bus_device); 350 + platform_device_register(&palmz72_camera); 351 + } 352 + #else 353 + static inline void palmz72_camera_init(void) {} 354 + #endif 355 + 356 + /****************************************************************************** 283 357 * Machine init 284 358 ******************************************************************************/ 285 359 static void __init palmz72_init(void) ··· 402 276 palm27x_pmic_init(); 403 277 palmz72_kpc_init(); 404 278 palmz72_leds_init(); 279 + palmz72_camera_init(); 405 280 } 406 281 407 282 MACHINE_START(PALMZ72, "Palm Zire72")
+1 -1
arch/arm/mach-pxa/pcm990-baseboard.c
··· 515 515 pcm990_init_irq(); 516 516 517 517 #ifndef CONFIG_PCM990_DISPLAY_NONE 518 - set_pxa_fb_info(&pcm990_fbinfo); 518 + pxa_set_fb_info(NULL, &pcm990_fbinfo); 519 519 #endif 520 520 platform_device_register(&pcm990_backlight_device); 521 521
+1 -2
arch/arm/mach-pxa/poodle.c
··· 445 445 if (ret) 446 446 pr_warning("poodle: Unable to register LoCoMo device\n"); 447 447 448 - set_pxa_fb_parent(&poodle_locomo_device.dev); 449 - set_pxa_fb_info(&poodle_fb_info); 448 + pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info); 450 449 pxa_set_udc_info(&udc_info); 451 450 pxa_set_mci_info(&poodle_mci_platform_data); 452 451 pxa_set_ficp_info(&poodle_ficp_platform_data);
+1 -1
arch/arm/mach-pxa/raumfeld.c
··· 597 597 { 598 598 int ret; 599 599 600 - set_pxa_fb_info(&raumfeld_sharp_lcd_info); 600 + pxa_set_fb_info(NULL, &raumfeld_sharp_lcd_info); 601 601 602 602 /* Earlier devices had the backlight regulator controlled 603 603 * via PWM, later versions use another controller for that */
+1 -1
arch/arm/mach-pxa/saar.c
··· 473 473 474 474 static void __init saar_init_lcd(void) 475 475 { 476 - set_pxa_fb_info(&saar_lcd_info); 476 + pxa_set_fb_info(NULL, &saar_lcd_info); 477 477 } 478 478 #else 479 479 static inline void saar_init_lcd(void) {}
+1 -1
arch/arm/mach-pxa/spitz.c
··· 724 724 725 725 static void __init spitz_lcd_init(void) 726 726 { 727 - set_pxa_fb_info(&spitz_pxafb_info); 727 + pxa_set_fb_info(NULL, &spitz_pxafb_info); 728 728 } 729 729 #else 730 730 static inline void spitz_lcd_init(void) {}
+1 -1
arch/arm/mach-pxa/tavorevb.c
··· 466 466 { 467 467 platform_device_register(&tavorevb_backlight_devices[0]); 468 468 platform_device_register(&tavorevb_backlight_devices[1]); 469 - set_pxa_fb_info(&tavorevb_lcd_info); 469 + pxa_set_fb_info(NULL, &tavorevb_lcd_info); 470 470 } 471 471 #else 472 472 static inline void tavorevb_init_lcd(void) {}
+2 -3
arch/arm/mach-pxa/time.c
··· 100 100 static struct clock_event_device ckevt_pxa_osmr0 = { 101 101 .name = "osmr0", 102 102 .features = CLOCK_EVT_FEAT_ONESHOT, 103 - .shift = 32, 104 103 .rating = 200, 105 104 .set_next_event = pxa_osmr0_set_next_event, 106 105 .set_mode = pxa_osmr0_set_mode, ··· 134 135 135 136 init_sched_clock(&cd, pxa_update_sched_clock, 32, clock_tick_rate); 136 137 137 - ckevt_pxa_osmr0.mult = 138 - div_sc(clock_tick_rate, NSEC_PER_SEC, ckevt_pxa_osmr0.shift); 138 + clocksource_calc_mult_shift(&cksrc_pxa_oscr0, clock_tick_rate, 4); 139 + clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4); 139 140 ckevt_pxa_osmr0.max_delta_ns = 140 141 clockevent_delta2ns(0x7fffffff, &ckevt_pxa_osmr0); 141 142 ckevt_pxa_osmr0.min_delta_ns =
+11 -2
arch/arm/mach-pxa/tosa.c
··· 35 35 #include <linux/spi/pxa2xx_spi.h> 36 36 #include <linux/input/matrix_keypad.h> 37 37 #include <linux/i2c/pxa-i2c.h> 38 + #include <linux/usb/gpio_vbus.h> 38 39 39 40 #include <asm/setup.h> 40 41 #include <asm/mach-types.h> ··· 241 240 /* 242 241 * USB Device Controller 243 242 */ 244 - static struct pxa2xx_udc_mach_info udc_info __initdata = { 243 + static struct gpio_vbus_mach_info tosa_udc_info = { 245 244 .gpio_pullup = TOSA_GPIO_USB_PULLUP, 246 245 .gpio_vbus = TOSA_GPIO_USB_IN, 247 246 .gpio_vbus_inverted = 1, 247 + }; 248 + 249 + static struct platform_device tosa_gpio_vbus = { 250 + .name = "gpio-vbus", 251 + .id = -1, 252 + .dev = { 253 + .platform_data = &tosa_udc_info, 254 + }, 248 255 }; 249 256 250 257 /* ··· 900 891 &tosa_bt_device, 901 892 &sharpsl_rom_device, 902 893 &wm9712_device, 894 + &tosa_gpio_vbus, 903 895 }; 904 896 905 897 static void tosa_poweroff(void) ··· 947 937 dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); 948 938 949 939 pxa_set_mci_info(&tosa_mci_platform_data); 950 - pxa_set_udc_info(&udc_info); 951 940 pxa_set_ficp_info(&tosa_ficp_platform_data); 952 941 pxa_set_i2c_info(NULL); 953 942 pxa_set_ac97_info(NULL);
+2 -2
arch/arm/mach-pxa/trizeps4.c
··· 516 516 pxa_set_stuart_info(NULL); 517 517 518 518 if (0) /* dont know how to determine LCD */ 519 - set_pxa_fb_info(&sharp_lcd); 519 + pxa_set_fb_info(NULL, &sharp_lcd); 520 520 else 521 - set_pxa_fb_info(&toshiba_lcd); 521 + pxa_set_fb_info(NULL, &toshiba_lcd); 522 522 523 523 pxa_set_mci_info(&trizeps4_mci_platform_data); 524 524 #ifndef STATUS_LEDS_ON_STUART_PINS
+1 -1
arch/arm/mach-pxa/viper.c
··· 932 932 /* Wake-up serial console */ 933 933 viper_init_serial_gpio(); 934 934 935 - set_pxa_fb_info(&fb_info); 935 + pxa_set_fb_info(NULL, &fb_info); 936 936 937 937 /* v1 hardware cannot use the datacs line */ 938 938 version = viper_hw_version();
+1 -1
arch/arm/mach-pxa/vpac270.c
··· 572 572 } 573 573 574 574 vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power; 575 - set_pxa_fb_info(&vpac270_lcd_screen); 575 + pxa_set_fb_info(NULL, &vpac270_lcd_screen); 576 576 return; 577 577 578 578 err2:
+38 -39
arch/arm/mach-pxa/z2.c
··· 91 91 GPIO47_STUART_TXD, 92 92 93 93 /* Keypad */ 94 - GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 95 - GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, 96 - GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, 97 - GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, 98 - GPIO38_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, 99 - GPIO16_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, 100 - GPIO17_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH, 94 + GPIO100_KP_MKIN_0, 95 + GPIO101_KP_MKIN_1, 96 + GPIO102_KP_MKIN_2, 97 + GPIO34_KP_MKIN_3, 98 + GPIO38_KP_MKIN_4, 99 + GPIO16_KP_MKIN_5, 100 + GPIO17_KP_MKIN_6, 101 101 GPIO103_KP_MKOUT_0, 102 102 GPIO104_KP_MKOUT_1, 103 103 GPIO105_KP_MKOUT_2, ··· 138 138 GPIO1_GPIO, /* Power button */ 139 139 GPIO37_GPIO, /* Headphone detect */ 140 140 GPIO98_GPIO, /* Lid switch */ 141 - GPIO14_GPIO, /* WiFi Reset */ 142 - GPIO15_GPIO, /* WiFi Power */ 141 + GPIO14_GPIO, /* WiFi Power */ 143 142 GPIO24_GPIO, /* WiFi CS */ 144 143 GPIO36_GPIO, /* WiFi IRQ */ 145 144 GPIO88_GPIO, /* LCD CS */ ··· 203 204 /* Keypad Backlight */ 204 205 .pwm_id = 1, 205 206 .max_brightness = 1023, 206 - .dft_brightness = 512, 207 + .dft_brightness = 0, 207 208 .pwm_period_ns = 1260320, 208 209 }, 209 210 [1] = { ··· 270 271 271 272 static void __init z2_lcd_init(void) 272 273 { 273 - set_pxa_fb_info(&z2_lcd_screen); 274 + pxa_set_fb_info(NULL, &z2_lcd_screen); 274 275 } 275 276 #else 276 277 static inline void z2_lcd_init(void) {} ··· 308 309 .active_low = 1, 309 310 }, { 310 311 .name = "z2:green:charged", 311 - .default_trigger = "none", 312 + .default_trigger = "mmc0", 312 313 .gpio = GPIO85_ZIPITZ2_LED_CHARGED, 313 314 .active_low = 1, 314 315 }, { 315 316 .name = "z2:amber:charging", 316 - .default_trigger = "none", 317 + .default_trigger = "Z2-charging-or-full", 317 318 .gpio = GPIO83_ZIPITZ2_LED_CHARGING, 318 319 .active_low = 1, 319 320 }, ··· 426 427 ******************************************************************************/ 427 428 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) 428 429 static struct gpio_keys_button z2_pxa_buttons[] = { 429 - {KEY_POWER, GPIO1_ZIPITZ2_POWER_BUTTON, 0, "Power Button" }, 430 - {KEY_CLOSE, GPIO98_ZIPITZ2_LID_BUTTON, 0, "Lid Button" }, 430 + { 431 + .code = KEY_POWER, 432 + .gpio = GPIO1_ZIPITZ2_POWER_BUTTON, 433 + .active_low = 0, 434 + .desc = "Power Button", 435 + .wakeup = 1, 436 + .type = EV_KEY, 437 + }, 438 + { 439 + .code = SW_LID, 440 + .gpio = GPIO98_ZIPITZ2_LID_BUTTON, 441 + .active_low = 1, 442 + .desc = "Lid Switch", 443 + .wakeup = 0, 444 + .type = EV_SW, 445 + }, 431 446 }; 432 447 433 448 static struct gpio_keys_platform_data z2_pxa_keys_data = { ··· 474 461 .batt_I2C_addr = 0x55, 475 462 .batt_I2C_reg = 2, 476 463 .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT, 477 - .min_voltage = 2400000, 478 - .max_voltage = 3700000, 479 - .batt_div = 69, 464 + .min_voltage = 3475000, 465 + .max_voltage = 4190000, 466 + .batt_div = 59, 480 467 .batt_mult = 1000000, 481 468 .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION, 482 469 .batt_name = "Z2", ··· 510 497 { 511 498 int ret = 0; 512 499 513 - ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power"); 500 + ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power"); 514 501 if (ret) 515 502 goto err; 516 503 517 - ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1); 504 + ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1); 518 505 if (ret) 519 506 goto err2; 520 507 521 - ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset"); 522 - if (ret) 523 - goto err2; 524 - 525 - ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0); 526 - if (ret) 527 - goto err3; 528 - 529 - /* Reset the card */ 508 + /* Wait until card is powered on */ 530 509 mdelay(180); 531 - gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1); 532 - mdelay(20); 533 510 534 511 spi->bits_per_word = 16; 535 512 spi->mode = SPI_MODE_2, ··· 528 525 529 526 return 0; 530 527 531 - err3: 532 - gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); 533 528 err2: 534 - gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); 529 + gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); 535 530 err: 536 531 return ret; 537 532 }; 538 533 539 534 static int z2_lbs_spi_teardown(struct spi_device *spi) 540 535 { 541 - gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 0); 542 - gpio_set_value(GPIO15_ZIPITZ2_WIFI_POWER, 0); 543 - gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); 544 - gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); 545 - return 0; 536 + gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0); 537 + gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); 546 538 539 + return 0; 547 540 }; 548 541 549 542 static struct pxa2xx_spi_chip z2_lbs_chip_info = {
+1 -1
arch/arm/mach-pxa/zeus.c
··· 846 846 if (zeus_setup_fb_gpios()) 847 847 pr_err("Failed to setup fb gpios\n"); 848 848 else 849 - set_pxa_fb_info(&zeus_fb_info); 849 + pxa_set_fb_info(NULL, &zeus_fb_info); 850 850 851 851 pxa_set_mci_info(&zeus_mci_platform_data); 852 852 pxa_set_udc_info(&zeus_udc_info);
+2 -2
arch/arm/mach-pxa/zylonite.c
··· 208 208 platform_device_register(&zylonite_backlight_device); 209 209 210 210 if (lcd_id & 0x20) { 211 - set_pxa_fb_info(&zylonite_sharp_lcd_info); 211 + pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info); 212 212 return; 213 213 } 214 214 ··· 220 220 else 221 221 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode; 222 222 223 - set_pxa_fb_info(&zylonite_toshiba_lcd_info); 223 + pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info); 224 224 } 225 225 #else 226 226 static inline void zylonite_init_lcd(void) {}
+1 -1
arch/arm/plat-mxc/devices/platform-fec.c
··· 53 53 struct resource res[] = { 54 54 { 55 55 .start = data->iobase, 56 - .end = data->iobase + SZ_4K, 56 + .end = data->iobase + SZ_4K - 1, 57 57 .flags = IORESOURCE_MEM, 58 58 }, { 59 59 .start = data->irq,
+1 -1
arch/arm/plat-mxc/devices/platform-imxdi_rtc.c
··· 27 27 struct resource res[] = { 28 28 { 29 29 .start = data->iobase, 30 - .end = data->iobase + SZ_16K, 30 + .end = data->iobase + SZ_16K - 1, 31 31 .flags = IORESOURCE_MEM, 32 32 }, { 33 33 .start = data->irq,
+9 -1
arch/arm/plat-mxc/include/mach/audmux.h
··· 15 15 #define MX31_AUDMUX_PORT5_SSI_PINS_5 4 16 16 #define MX31_AUDMUX_PORT6_SSI_PINS_6 5 17 17 18 + #define MX51_AUDMUX_PORT1_SSI0 0 19 + #define MX51_AUDMUX_PORT2_SSI1 1 20 + #define MX51_AUDMUX_PORT3 2 21 + #define MX51_AUDMUX_PORT4 3 22 + #define MX51_AUDMUX_PORT5 4 23 + #define MX51_AUDMUX_PORT6 5 24 + #define MX51_AUDMUX_PORT7 6 25 + 18 26 /* Register definitions for the i.MX21/27 Digital Audio Multiplexer */ 19 27 #define MXC_AUDMUX_V1_PCR_INMMASK(x) ((x) & 0xff) 20 28 #define MXC_AUDMUX_V1_PCR_INMEN (1 << 8) ··· 36 28 #define MXC_AUDMUX_V1_PCR_TCLKDIR (1 << 30) 37 29 #define MXC_AUDMUX_V1_PCR_TFSDIR (1 << 31) 38 30 39 - /* Register definitions for the i.MX25/31/35 Digital Audio Multiplexer */ 31 + /* Register definitions for the i.MX25/31/35/51 Digital Audio Multiplexer */ 40 32 #define MXC_AUDMUX_V2_PTCR_TFSDIR (1 << 31) 41 33 #define MXC_AUDMUX_V2_PTCR_TFSEL(x) (((x) & 0xf) << 27) 42 34 #define MXC_AUDMUX_V2_PTCR_TCLKDIR (1 << 26)
+6 -6
arch/arm/plat-mxc/include/mach/iomux-mx2x.h
··· 90 90 #define PC31_PF_SSI3_CLK (GPIO_PORTC | GPIO_PF | GPIO_IN | 31) 91 91 #define PD17_PF_I2C_DATA (GPIO_PORTD | GPIO_PF | GPIO_OUT | 17) 92 92 #define PD18_PF_I2C_CLK (GPIO_PORTD | GPIO_PF | GPIO_OUT | 18) 93 - #define PD19_PF_CSPI2_SS2 (GPIO_PORTD | GPIO_PF | 19) 94 - #define PD20_PF_CSPI2_SS1 (GPIO_PORTD | GPIO_PF | 20) 95 - #define PD21_PF_CSPI2_SS0 (GPIO_PORTD | GPIO_PF | 21) 96 - #define PD22_PF_CSPI2_SCLK (GPIO_PORTD | GPIO_PF | 22) 97 - #define PD23_PF_CSPI2_MISO (GPIO_PORTD | GPIO_PF | 23) 98 - #define PD24_PF_CSPI2_MOSI (GPIO_PORTD | GPIO_PF | 24) 93 + #define PD19_PF_CSPI2_SS2 (GPIO_PORTD | GPIO_PF | GPIO_OUT | 19) 94 + #define PD20_PF_CSPI2_SS1 (GPIO_PORTD | GPIO_PF | GPIO_OUT | 20) 95 + #define PD21_PF_CSPI2_SS0 (GPIO_PORTD | GPIO_PF | GPIO_OUT | 21) 96 + #define PD22_PF_CSPI2_SCLK (GPIO_PORTD | GPIO_PF | GPIO_OUT | 22) 97 + #define PD23_PF_CSPI2_MISO (GPIO_PORTD | GPIO_PF | GPIO_IN | 23) 98 + #define PD24_PF_CSPI2_MOSI (GPIO_PORTD | GPIO_PF | GPIO_OUT | 24) 99 99 #define PD25_PF_CSPI1_RDY (GPIO_PORTD | GPIO_PF | GPIO_OUT | 25) 100 100 #define PD26_PF_CSPI1_SS2 (GPIO_PORTD | GPIO_PF | GPIO_OUT | 26) 101 101 #define PD27_PF_CSPI1_SS1 (GPIO_PORTD | GPIO_PF | GPIO_OUT | 27)
+4
arch/arm/plat-mxc/include/mach/mx50.h
··· 282 282 #define MX50_INT_APBHDMA_CHAN6 116 283 283 #define MX50_INT_APBHDMA_CHAN7 117 284 284 285 + #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) 286 + extern int mx50_revision(void); 287 + #endif 288 + 285 289 #endif /* ifndef __MACH_MX50_H__ */
+1
arch/arm/plat-mxc/include/mach/mx51.h
··· 347 347 348 348 #if !defined(__ASSEMBLY__) && !defined(__MXC_BOOT_UNCOMPRESS) 349 349 extern int mx51_revision(void); 350 + extern void mx51_display_revision(void); 350 351 #endif 351 352 352 353 /* tape-out 1 defines */
+23
arch/arm/plat-mxc/include/mach/mxc.h
··· 51 51 #define IMX_CHIP_REVISION_3_3 0x33 52 52 #define IMX_CHIP_REVISION_UNKNOWN 0xff 53 53 54 + #define IMX_CHIP_REVISION_1_0_STRING "1.0" 55 + #define IMX_CHIP_REVISION_1_1_STRING "1.1" 56 + #define IMX_CHIP_REVISION_1_2_STRING "1.2" 57 + #define IMX_CHIP_REVISION_1_3_STRING "1.3" 58 + #define IMX_CHIP_REVISION_2_0_STRING "2.0" 59 + #define IMX_CHIP_REVISION_2_1_STRING "2.1" 60 + #define IMX_CHIP_REVISION_2_2_STRING "2.2" 61 + #define IMX_CHIP_REVISION_2_3_STRING "2.3" 62 + #define IMX_CHIP_REVISION_3_0_STRING "3.0" 63 + #define IMX_CHIP_REVISION_3_1_STRING "3.1" 64 + #define IMX_CHIP_REVISION_3_2_STRING "3.2" 65 + #define IMX_CHIP_REVISION_3_3_STRING "3.3" 66 + #define IMX_CHIP_REVISION_UNKNOWN_STRING "unknown" 67 + 54 68 #ifndef __ASSEMBLY__ 55 69 extern unsigned int __mxc_cpu_type; 56 70 #endif ··· 193 179 194 180 struct cpu_op { 195 181 u32 cpu_rate; 182 + }; 183 + 184 + int tzic_enable_wake(int is_idle); 185 + enum mxc_cpu_pwr_mode { 186 + WAIT_CLOCKED, /* wfi only */ 187 + WAIT_UNCLOCKED, /* WAIT */ 188 + WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */ 189 + STOP_POWER_ON, /* just STOP */ 190 + STOP_POWER_OFF, /* STOP + SRPG */ 196 191 }; 197 192 198 193 extern struct cpu_op *(*get_cpu_op)(int *op);
+5 -1
arch/arm/plat-mxc/include/mach/system.h
··· 20 20 #include <mach/hardware.h> 21 21 #include <mach/common.h> 22 22 23 + extern void mx5_cpu_lp_set(enum mxc_cpu_pwr_mode mode); 24 + 23 25 static inline void arch_idle(void) 24 26 { 25 27 #ifdef CONFIG_ARCH_MXC91231 ··· 56 54 "orr %0, %0, #0x00000004\n" 57 55 "mcr p15, 0, %0, c1, c0, 0\n" 58 56 : "=r" (reg)); 59 - } else 57 + } else if (cpu_is_mx51()) 58 + mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); 59 + else 60 60 cpu_do_idle(); 61 61 } 62 62
+24 -1
arch/arm/plat-mxc/time.c
··· 27 27 #include <linux/clk.h> 28 28 29 29 #include <mach/hardware.h> 30 + #include <asm/sched_clock.h> 30 31 #include <asm/mach/time.h> 31 32 #include <mach/common.h> 32 33 ··· 106 105 __raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT); 107 106 } 108 107 108 + static cycle_t dummy_get_cycles(struct clocksource *cs) 109 + { 110 + return 0; 111 + } 112 + 109 113 static cycle_t mx1_2_get_cycles(struct clocksource *cs) 110 114 { 111 115 return __raw_readl(timer_base + MX1_2_TCN); ··· 124 118 static struct clocksource clocksource_mxc = { 125 119 .name = "mxc_timer1", 126 120 .rating = 200, 127 - .read = mx1_2_get_cycles, 121 + .read = dummy_get_cycles, 128 122 .mask = CLOCKSOURCE_MASK(32), 129 123 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 130 124 }; 125 + 126 + static DEFINE_CLOCK_DATA(cd); 127 + unsigned long long notrace sched_clock(void) 128 + { 129 + cycle_t cyc = clocksource_mxc.read(&clocksource_mxc); 130 + 131 + return cyc_to_sched_clock(&cd, cyc, (u32)~0); 132 + } 133 + 134 + static void notrace mxc_update_sched_clock(void) 135 + { 136 + cycle_t cyc = clocksource_mxc.read(&clocksource_mxc); 137 + update_sched_clock(&cd, cyc, (u32)~0); 138 + } 131 139 132 140 static int __init mxc_clocksource_init(struct clk *timer_clk) 133 141 { ··· 149 129 150 130 if (timer_is_v2()) 151 131 clocksource_mxc.read = v2_get_cycles; 132 + else 133 + clocksource_mxc.read = mx1_2_get_cycles; 152 134 135 + init_sched_clock(&cd, mxc_update_sched_clock, 32, c); 153 136 clocksource_register_hz(&clocksource_mxc, c); 154 137 155 138 return 0;
+22 -21
drivers/ata/pata_palmld.c
··· 33 33 34 34 #define DRV_NAME "pata_palmld" 35 35 36 + static struct gpio palmld_hdd_gpios[] = { 37 + { GPIO_NR_PALMLD_IDE_PWEN, GPIOF_INIT_HIGH, "HDD Power" }, 38 + { GPIO_NR_PALMLD_IDE_RESET, GPIOF_INIT_LOW, "HDD Reset" }, 39 + }; 40 + 36 41 static struct scsi_host_template palmld_sht = { 37 42 ATA_PIO_SHT(DRV_NAME), 38 43 }; ··· 57 52 58 53 /* allocate host */ 59 54 host = ata_host_alloc(&pdev->dev, 1); 60 - if (!host) 61 - return -ENOMEM; 55 + if (!host) { 56 + ret = -ENOMEM; 57 + goto err1; 58 + } 62 59 63 60 /* remap drive's physical memory address */ 64 61 mem = devm_ioremap(&pdev->dev, PALMLD_IDE_PHYS, 0x1000); 65 - if (!mem) 66 - return -ENOMEM; 62 + if (!mem) { 63 + ret = -ENOMEM; 64 + goto err1; 65 + } 67 66 68 67 /* request and activate power GPIO, IRQ GPIO */ 69 - ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR"); 68 + ret = gpio_request_array(palmld_hdd_gpios, 69 + ARRAY_SIZE(palmld_hdd_gpios)); 70 70 if (ret) 71 71 goto err1; 72 - ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1); 73 - if (ret) 74 - goto err2; 75 - 76 - ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST"); 77 - if (ret) 78 - goto err2; 79 - ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0); 80 - if (ret) 81 - goto err3; 82 72 83 73 /* reset the drive */ 84 74 gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0); ··· 96 96 ata_sff_std_ports(&ap->ioaddr); 97 97 98 98 /* activate host */ 99 - return ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, 99 + ret = ata_host_activate(host, 0, NULL, IRQF_TRIGGER_RISING, 100 100 &palmld_sht); 101 + if (ret) 102 + goto err2; 101 103 102 - err3: 103 - gpio_free(GPIO_NR_PALMLD_IDE_RESET); 104 + return ret; 105 + 104 106 err2: 105 - gpio_free(GPIO_NR_PALMLD_IDE_PWEN); 107 + gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); 106 108 err1: 107 109 return ret; 108 110 } ··· 118 116 /* power down the HDD */ 119 117 gpio_set_value(GPIO_NR_PALMLD_IDE_PWEN, 0); 120 118 121 - gpio_free(GPIO_NR_PALMLD_IDE_RESET); 122 - gpio_free(GPIO_NR_PALMLD_IDE_PWEN); 119 + gpio_free_array(palmld_hdd_gpios, ARRAY_SIZE(palmld_hdd_gpios)); 123 120 124 121 return 0; 125 122 }
+50 -85
drivers/pcmcia/pxa2xx_colibri.c
··· 34 34 #define COLIBRI320_DETECT_GPIO 81 35 35 #define COLIBRI320_READY_GPIO 29 36 36 37 - static struct { 38 - int reset_gpio; 39 - int ppen_gpio; 40 - int bvd1_gpio; 41 - int bvd2_gpio; 42 - int detect_gpio; 43 - int ready_gpio; 44 - } colibri_pcmcia_gpio; 37 + enum { 38 + DETECT = 0, 39 + READY = 1, 40 + BVD1 = 2, 41 + BVD2 = 3, 42 + PPEN = 4, 43 + RESET = 5, 44 + }; 45 + 46 + /* Contents of this array are configured on-the-fly in init function */ 47 + static struct gpio colibri_pcmcia_gpios[] = { 48 + { 0, GPIOF_IN, "PCMCIA Detect" }, 49 + { 0, GPIOF_IN, "PCMCIA Ready" }, 50 + { 0, GPIOF_IN, "PCMCIA BVD1" }, 51 + { 0, GPIOF_IN, "PCMCIA BVD2" }, 52 + { 0, GPIOF_INIT_LOW, "PCMCIA PPEN" }, 53 + { 0, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 54 + }; 45 55 46 56 static struct pcmcia_irqs colibri_irqs[] = { 47 57 { ··· 64 54 { 65 55 int ret; 66 56 67 - ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT"); 57 + ret = gpio_request_array(colibri_pcmcia_gpios, 58 + ARRAY_SIZE(colibri_pcmcia_gpios)); 68 59 if (ret) 69 60 goto err1; 70 - ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio); 71 - if (ret) 72 - goto err2; 73 61 74 - ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY"); 75 - if (ret) 76 - goto err2; 77 - ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio); 78 - if (ret) 79 - goto err3; 62 + colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpios[DETECT].gpio); 63 + skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpios[READY].gpio); 80 64 81 - ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1"); 82 - if (ret) 83 - goto err3; 84 - ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio); 85 - if (ret) 86 - goto err4; 87 - 88 - ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2"); 89 - if (ret) 90 - goto err4; 91 - ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio); 92 - if (ret) 93 - goto err5; 94 - 95 - ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN"); 96 - if (ret) 97 - goto err5; 98 - ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0); 99 - if (ret) 100 - goto err6; 101 - 102 - ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET"); 103 - if (ret) 104 - goto err6; 105 - ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1); 106 - if (ret) 107 - goto err7; 108 - 109 - colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio); 110 - skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio); 111 - 112 - return soc_pcmcia_request_irqs(skt, colibri_irqs, 65 + ret = soc_pcmcia_request_irqs(skt, colibri_irqs, 113 66 ARRAY_SIZE(colibri_irqs)); 67 + if (ret) 68 + goto err2; 114 69 115 - err7: 116 - gpio_free(colibri_pcmcia_gpio.detect_gpio); 117 - err6: 118 - gpio_free(colibri_pcmcia_gpio.ready_gpio); 119 - err5: 120 - gpio_free(colibri_pcmcia_gpio.bvd1_gpio); 121 - err4: 122 - gpio_free(colibri_pcmcia_gpio.bvd2_gpio); 123 - err3: 124 - gpio_free(colibri_pcmcia_gpio.reset_gpio); 70 + return ret; 71 + 125 72 err2: 126 - gpio_free(colibri_pcmcia_gpio.ppen_gpio); 73 + gpio_free_array(colibri_pcmcia_gpios, 74 + ARRAY_SIZE(colibri_pcmcia_gpios)); 127 75 err1: 128 76 return ret; 129 77 } 130 78 131 79 static void colibri_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 132 80 { 133 - gpio_free(colibri_pcmcia_gpio.detect_gpio); 134 - gpio_free(colibri_pcmcia_gpio.ready_gpio); 135 - gpio_free(colibri_pcmcia_gpio.bvd1_gpio); 136 - gpio_free(colibri_pcmcia_gpio.bvd2_gpio); 137 - gpio_free(colibri_pcmcia_gpio.reset_gpio); 138 - gpio_free(colibri_pcmcia_gpio.ppen_gpio); 81 + gpio_free_array(colibri_pcmcia_gpios, 82 + ARRAY_SIZE(colibri_pcmcia_gpios)); 139 83 } 140 84 141 85 static void colibri_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 142 86 struct pcmcia_state *state) 143 87 { 144 88 145 - state->detect = !!gpio_get_value(colibri_pcmcia_gpio.detect_gpio); 146 - state->ready = !!gpio_get_value(colibri_pcmcia_gpio.ready_gpio); 147 - state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpio.bvd1_gpio); 148 - state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpio.bvd2_gpio); 89 + state->detect = !!gpio_get_value(colibri_pcmcia_gpios[DETECT].gpio); 90 + state->ready = !!gpio_get_value(colibri_pcmcia_gpios[READY].gpio); 91 + state->bvd1 = !!gpio_get_value(colibri_pcmcia_gpios[BVD1].gpio); 92 + state->bvd2 = !!gpio_get_value(colibri_pcmcia_gpios[BVD2].gpio); 149 93 state->wrprot = 0; 150 94 state->vs_3v = 1; 151 95 state->vs_Xv = 0; ··· 109 145 colibri_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, 110 146 const socket_state_t *state) 111 147 { 112 - gpio_set_value(colibri_pcmcia_gpio.ppen_gpio, 148 + gpio_set_value(colibri_pcmcia_gpios[PPEN].gpio, 113 149 !(state->Vcc == 33 && state->Vpp < 50)); 114 - gpio_set_value(colibri_pcmcia_gpio.reset_gpio, state->flags & SS_RESET); 150 + gpio_set_value(colibri_pcmcia_gpios[RESET].gpio, 151 + state->flags & SS_RESET); 115 152 return 0; 116 153 } 117 154 ··· 155 190 156 191 /* Colibri PXA270 */ 157 192 if (machine_is_colibri()) { 158 - colibri_pcmcia_gpio.reset_gpio = COLIBRI270_RESET_GPIO; 159 - colibri_pcmcia_gpio.ppen_gpio = COLIBRI270_PPEN_GPIO; 160 - colibri_pcmcia_gpio.bvd1_gpio = COLIBRI270_BVD1_GPIO; 161 - colibri_pcmcia_gpio.bvd2_gpio = COLIBRI270_BVD2_GPIO; 162 - colibri_pcmcia_gpio.detect_gpio = COLIBRI270_DETECT_GPIO; 163 - colibri_pcmcia_gpio.ready_gpio = COLIBRI270_READY_GPIO; 193 + colibri_pcmcia_gpios[RESET].gpio = COLIBRI270_RESET_GPIO; 194 + colibri_pcmcia_gpios[PPEN].gpio = COLIBRI270_PPEN_GPIO; 195 + colibri_pcmcia_gpios[BVD1].gpio = COLIBRI270_BVD1_GPIO; 196 + colibri_pcmcia_gpios[BVD2].gpio = COLIBRI270_BVD2_GPIO; 197 + colibri_pcmcia_gpios[DETECT].gpio = COLIBRI270_DETECT_GPIO; 198 + colibri_pcmcia_gpios[READY].gpio = COLIBRI270_READY_GPIO; 164 199 /* Colibri PXA320 */ 165 200 } else if (machine_is_colibri320()) { 166 - colibri_pcmcia_gpio.reset_gpio = COLIBRI320_RESET_GPIO; 167 - colibri_pcmcia_gpio.ppen_gpio = COLIBRI320_PPEN_GPIO; 168 - colibri_pcmcia_gpio.bvd1_gpio = COLIBRI320_BVD1_GPIO; 169 - colibri_pcmcia_gpio.bvd2_gpio = COLIBRI320_BVD2_GPIO; 170 - colibri_pcmcia_gpio.detect_gpio = COLIBRI320_DETECT_GPIO; 171 - colibri_pcmcia_gpio.ready_gpio = COLIBRI320_READY_GPIO; 201 + colibri_pcmcia_gpios[RESET].gpio = COLIBRI320_RESET_GPIO; 202 + colibri_pcmcia_gpios[PPEN].gpio = COLIBRI320_PPEN_GPIO; 203 + colibri_pcmcia_gpios[BVD1].gpio = COLIBRI320_BVD1_GPIO; 204 + colibri_pcmcia_gpios[BVD2].gpio = COLIBRI320_BVD2_GPIO; 205 + colibri_pcmcia_gpios[DETECT].gpio = COLIBRI320_DETECT_GPIO; 206 + colibri_pcmcia_gpios[READY].gpio = COLIBRI320_READY_GPIO; 172 207 } 173 208 174 209 ret = platform_device_add_data(colibri_pcmcia_device,
+10 -32
drivers/pcmcia/pxa2xx_palmld.c
··· 4 4 * Driver for Palm LifeDrive PCMCIA 5 5 * 6 6 * Copyright (C) 2006 Alex Osborne <ato@meshy.org> 7 - * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 7 + * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License version 2 as ··· 20 20 #include <mach/palmld.h> 21 21 #include "soc_common.h" 22 22 23 + static struct gpio palmld_pcmcia_gpios[] = { 24 + { GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" }, 25 + { GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 26 + { GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, 27 + }; 28 + 23 29 static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 24 30 { 25 31 int ret; 26 32 27 - ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR"); 28 - if (ret) 29 - goto err1; 30 - ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0); 31 - if (ret) 32 - goto err2; 33 - 34 - ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST"); 35 - if (ret) 36 - goto err2; 37 - ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1); 38 - if (ret) 39 - goto err3; 40 - 41 - ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY"); 42 - if (ret) 43 - goto err3; 44 - ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY); 45 - if (ret) 46 - goto err4; 33 + ret = gpio_request_array(palmld_pcmcia_gpios, 34 + ARRAY_SIZE(palmld_pcmcia_gpios)); 47 35 48 36 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY); 49 - return 0; 50 37 51 - err4: 52 - gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); 53 - err3: 54 - gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); 55 - err2: 56 - gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); 57 - err1: 58 38 return ret; 59 39 } 60 40 61 41 static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 62 42 { 63 - gpio_free(GPIO_NR_PALMLD_PCMCIA_READY); 64 - gpio_free(GPIO_NR_PALMLD_PCMCIA_RESET); 65 - gpio_free(GPIO_NR_PALMLD_PCMCIA_POWER); 43 + gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios)); 66 44 } 67 45 68 46 static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+13 -62
drivers/pcmcia/pxa2xx_palmtc.c
··· 4 4 * Driver for Palm Tungsten|C PCMCIA 5 5 * 6 6 * Copyright (C) 2008 Alex Osborne <ato@meshy.org> 7 - * Copyright (C) 2009 Marek Vasut <marek.vasut@gmail.com> 7 + * Copyright (C) 2009-2011 Marek Vasut <marek.vasut@gmail.com> 8 8 * 9 9 * This program is free software; you can redistribute it and/or modify 10 10 * it under the terms of the GNU General Public License version 2 as ··· 21 21 #include <mach/palmtc.h> 22 22 #include "soc_common.h" 23 23 24 + static struct gpio palmtc_pcmcia_gpios[] = { 25 + { GPIO_NR_PALMTC_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" }, 26 + { GPIO_NR_PALMTC_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, 27 + { GPIO_NR_PALMTC_PCMCIA_POWER3, GPIOF_INIT_LOW, "PCMCIA Power 3" }, 28 + { GPIO_NR_PALMTC_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 29 + { GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, 30 + { GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN, "PCMCIA Power Ready" }, 31 + }; 32 + 24 33 static int palmtc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25 34 { 26 35 int ret; 27 36 28 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1"); 29 - if (ret) 30 - goto err1; 31 - ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0); 32 - if (ret) 33 - goto err2; 34 - 35 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2"); 36 - if (ret) 37 - goto err2; 38 - ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0); 39 - if (ret) 40 - goto err3; 41 - 42 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3"); 43 - if (ret) 44 - goto err3; 45 - ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0); 46 - if (ret) 47 - goto err4; 48 - 49 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST"); 50 - if (ret) 51 - goto err4; 52 - ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1); 53 - if (ret) 54 - goto err5; 55 - 56 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY"); 57 - if (ret) 58 - goto err5; 59 - ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY); 60 - if (ret) 61 - goto err6; 62 - 63 - ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY"); 64 - if (ret) 65 - goto err6; 66 - ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY); 67 - if (ret) 68 - goto err7; 37 + ret = gpio_request_array(palmtc_pcmcia_gpios, 38 + ARRAY_SIZE(palmtc_pcmcia_gpios)); 69 39 70 40 skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY); 71 - return 0; 72 41 73 - err7: 74 - gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); 75 - err6: 76 - gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); 77 - err5: 78 - gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); 79 - err4: 80 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); 81 - err3: 82 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); 83 - err2: 84 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); 85 - err1: 86 42 return ret; 87 43 } 88 44 89 45 static void palmtc_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 90 46 { 91 - gpio_free(GPIO_NR_PALMTC_PCMCIA_PWRREADY); 92 - gpio_free(GPIO_NR_PALMTC_PCMCIA_READY); 93 - gpio_free(GPIO_NR_PALMTC_PCMCIA_RESET); 94 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER3); 95 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER2); 96 - gpio_free(GPIO_NR_PALMTC_PCMCIA_POWER1); 47 + gpio_free_array(palmtc_pcmcia_gpios, ARRAY_SIZE(palmtc_pcmcia_gpios)); 97 48 } 98 49 99 50 static void palmtc_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+12 -45
drivers/pcmcia/pxa2xx_palmtx.c
··· 3 3 * 4 4 * Driver for Palm T|X PCMCIA 5 5 * 6 - * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> 6 + * Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com> 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify 9 9 * it under the terms of the GNU General Public License version 2 as ··· 13 13 14 14 #include <linux/module.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/gpio.h> 16 17 17 18 #include <asm/mach-types.h> 18 - 19 - #include <mach/gpio.h> 20 19 #include <mach/palmtx.h> 21 - 22 20 #include "soc_common.h" 21 + 22 + static struct gpio palmtx_pcmcia_gpios[] = { 23 + { GPIO_NR_PALMTX_PCMCIA_POWER1, GPIOF_INIT_LOW, "PCMCIA Power 1" }, 24 + { GPIO_NR_PALMTX_PCMCIA_POWER2, GPIOF_INIT_LOW, "PCMCIA Power 2" }, 25 + { GPIO_NR_PALMTX_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" }, 26 + { GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" }, 27 + }; 23 28 24 29 static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 25 30 { 26 31 int ret; 27 32 28 - ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1"); 29 - if (ret) 30 - goto err1; 31 - ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0); 32 - if (ret) 33 - goto err2; 34 - 35 - ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2"); 36 - if (ret) 37 - goto err2; 38 - ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0); 39 - if (ret) 40 - goto err3; 41 - 42 - ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST"); 43 - if (ret) 44 - goto err3; 45 - ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1); 46 - if (ret) 47 - goto err4; 48 - 49 - ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY"); 50 - if (ret) 51 - goto err4; 52 - ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY); 53 - if (ret) 54 - goto err5; 33 + ret = gpio_request_array(palmtx_pcmcia_gpios, 34 + ARRAY_SIZE(palmtx_pcmcia_gpios)); 55 35 56 36 skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY); 57 - return 0; 58 37 59 - err5: 60 - gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); 61 - err4: 62 - gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); 63 - err3: 64 - gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); 65 - err2: 66 - gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); 67 - err1: 68 38 return ret; 69 39 } 70 40 71 41 static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 72 42 { 73 - gpio_free(GPIO_NR_PALMTX_PCMCIA_READY); 74 - gpio_free(GPIO_NR_PALMTX_PCMCIA_RESET); 75 - gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER2); 76 - gpio_free(GPIO_NR_PALMTX_PCMCIA_POWER1); 43 + gpio_free_array(palmtx_pcmcia_gpios, ARRAY_SIZE(palmtx_pcmcia_gpios)); 77 44 } 78 45 79 46 static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+30 -80
drivers/pcmcia/pxa2xx_vpac270.c
··· 3 3 * 4 4 * Driver for Voipac PXA270 PCMCIA and CF sockets 5 5 * 6 - * Copyright (C) 2010 7 - * Marek Vasut <marek.vasut@gmail.com> 6 + * Copyright (C) 2010-2011 Marek Vasut <marek.vasut@gmail.com> 8 7 * 9 8 * This program is free software; you can redistribute it and/or modify 10 9 * it under the terms of the GNU General Public License version 2 as ··· 20 21 #include <mach/vpac270.h> 21 22 22 23 #include "soc_common.h" 24 + 25 + static struct gpio vpac270_pcmcia_gpios[] = { 26 + { GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN, "PCMCIA Card Detect" }, 27 + { GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN, "PCMCIA Ready" }, 28 + { GPIO107_VPAC270_PCMCIA_PPEN, GPIOF_INIT_LOW, "PCMCIA PPEN" }, 29 + { GPIO11_VPAC270_PCMCIA_RESET, GPIOF_INIT_LOW, "PCMCIA Reset" }, 30 + }; 31 + 32 + static struct gpio vpac270_cf_gpios[] = { 33 + { GPIO17_VPAC270_CF_CD, GPIOF_IN, "CF Card Detect" }, 34 + { GPIO12_VPAC270_CF_RDY, GPIOF_IN, "CF Ready" }, 35 + { GPIO16_VPAC270_CF_RESET, GPIOF_INIT_LOW, "CF Reset" }, 36 + }; 23 37 24 38 static struct pcmcia_irqs cd_irqs[] = { 25 39 { ··· 52 40 int ret; 53 41 54 42 if (skt->nr == 0) { 55 - ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD"); 56 - if (ret) 57 - goto err1; 58 - ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD); 59 - if (ret) 60 - goto err2; 61 - 62 - ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY"); 63 - if (ret) 64 - goto err2; 65 - ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY); 66 - if (ret) 67 - goto err3; 68 - 69 - ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN"); 70 - if (ret) 71 - goto err3; 72 - ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0); 73 - if (ret) 74 - goto err4; 75 - 76 - ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET"); 77 - if (ret) 78 - goto err4; 79 - ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0); 80 - if (ret) 81 - goto err5; 43 + ret = gpio_request_array(vpac270_pcmcia_gpios, 44 + ARRAY_SIZE(vpac270_pcmcia_gpios)); 82 45 83 46 skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY); 84 47 85 - return soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); 86 - 87 - err5: 88 - gpio_free(GPIO11_VPAC270_PCMCIA_RESET); 89 - err4: 90 - gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); 91 - err3: 92 - gpio_free(GPIO35_VPAC270_PCMCIA_RDY); 93 - err2: 94 - gpio_free(GPIO84_VPAC270_PCMCIA_CD); 95 - err1: 96 - return ret; 97 - 48 + if (!ret) 49 + ret = soc_pcmcia_request_irqs(skt, &cd_irqs[0], 1); 98 50 } else { 99 - ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD"); 100 - if (ret) 101 - goto err6; 102 - ret = gpio_direction_input(GPIO17_VPAC270_CF_CD); 103 - if (ret) 104 - goto err7; 105 - 106 - ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY"); 107 - if (ret) 108 - goto err7; 109 - ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY); 110 - if (ret) 111 - goto err8; 112 - 113 - ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET"); 114 - if (ret) 115 - goto err8; 116 - ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0); 117 - if (ret) 118 - goto err9; 51 + ret = gpio_request_array(vpac270_cf_gpios, 52 + ARRAY_SIZE(vpac270_cf_gpios)); 119 53 120 54 skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY); 121 55 122 - return soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); 123 - 124 - err9: 125 - gpio_free(GPIO16_VPAC270_CF_RESET); 126 - err8: 127 - gpio_free(GPIO12_VPAC270_CF_RDY); 128 - err7: 129 - gpio_free(GPIO17_VPAC270_CF_CD); 130 - err6: 131 - return ret; 132 - 56 + if (!ret) 57 + ret = soc_pcmcia_request_irqs(skt, &cd_irqs[1], 1); 133 58 } 59 + 60 + return ret; 134 61 } 135 62 136 63 static void vpac270_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 137 64 { 138 - gpio_free(GPIO11_VPAC270_PCMCIA_RESET); 139 - gpio_free(GPIO107_VPAC270_PCMCIA_PPEN); 140 - gpio_free(GPIO35_VPAC270_PCMCIA_RDY); 141 - gpio_free(GPIO84_VPAC270_PCMCIA_CD); 142 - gpio_free(GPIO16_VPAC270_CF_RESET); 143 - gpio_free(GPIO12_VPAC270_CF_RDY); 144 - gpio_free(GPIO17_VPAC270_CF_CD); 65 + if (skt->nr == 0) 66 + gpio_request_array(vpac270_pcmcia_gpios, 67 + ARRAY_SIZE(vpac270_pcmcia_gpios)); 68 + else 69 + gpio_request_array(vpac270_cf_gpios, 70 + ARRAY_SIZE(vpac270_cf_gpios)); 145 71 } 146 72 147 73 static void vpac270_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
+7 -69
drivers/usb/gadget/pxa25x_udc.c
··· 139 139 static void pxa25x_ep_fifo_flush (struct usb_ep *ep); 140 140 static void nuke (struct pxa25x_ep *, int status); 141 141 142 - /* one GPIO should be used to detect VBUS from the host */ 143 - static int is_vbus_present(void) 144 - { 145 - struct pxa2xx_udc_mach_info *mach = the_controller->mach; 146 - 147 - if (gpio_is_valid(mach->gpio_vbus)) { 148 - int value = gpio_get_value(mach->gpio_vbus); 149 - 150 - if (mach->gpio_vbus_inverted) 151 - return !value; 152 - else 153 - return !!value; 154 - } 155 - if (mach->udc_is_connected) 156 - return mach->udc_is_connected(); 157 - return 1; 158 - } 159 - 160 142 /* one GPIO should control a D+ pullup, so host sees this device (or not) */ 161 143 static void pullup_off(void) 162 144 { ··· 1037 1055 "%s version: %s\nGadget driver: %s\nHost %s\n\n", 1038 1056 driver_name, DRIVER_VERSION SIZE_STR "(pio)", 1039 1057 dev->driver ? dev->driver->driver.name : "(none)", 1040 - is_vbus_present() ? "full speed" : "disconnected"); 1058 + dev->gadget.speed == USB_SPEED_FULL ? "full speed" : "disconnected"); 1041 1059 1042 1060 /* registers for device and ep0 */ 1043 1061 seq_printf(m, ··· 1076 1094 (tmp & UDCCFR_ACM) ? " acm" : ""); 1077 1095 } 1078 1096 1079 - if (!is_vbus_present() || !dev->driver) 1097 + if (dev->gadget.speed != USB_SPEED_FULL || !dev->driver) 1080 1098 goto done; 1081 1099 1082 1100 seq_printf(m, "ep0 IN %lu/%lu, OUT %lu/%lu\nirqs %lu\n\n", ··· 1417 1435 1418 1436 #endif 1419 1437 1420 - static irqreturn_t udc_vbus_irq(int irq, void *_dev) 1421 - { 1422 - struct pxa25x_udc *dev = _dev; 1423 - 1424 - pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present()); 1425 - return IRQ_HANDLED; 1426 - } 1427 - 1428 1438 1429 1439 /*-------------------------------------------------------------------------*/ 1430 1440 ··· 1740 1766 if (unlikely(udccr & UDCCR_SUSIR)) { 1741 1767 udc_ack_int_UDCCR(UDCCR_SUSIR); 1742 1768 handled = 1; 1743 - DBG(DBG_VERBOSE, "USB suspend%s\n", is_vbus_present() 1744 - ? "" : "+disconnect"); 1769 + DBG(DBG_VERBOSE, "USB suspend\n"); 1745 1770 1746 - if (!is_vbus_present()) 1747 - stop_activity(dev, dev->driver); 1748 - else if (dev->gadget.speed != USB_SPEED_UNKNOWN 1771 + if (dev->gadget.speed != USB_SPEED_UNKNOWN 1749 1772 && dev->driver 1750 1773 && dev->driver->suspend) 1751 1774 dev->driver->suspend(&dev->gadget); ··· 1757 1786 1758 1787 if (dev->gadget.speed != USB_SPEED_UNKNOWN 1759 1788 && dev->driver 1760 - && dev->driver->resume 1761 - && is_vbus_present()) 1789 + && dev->driver->resume) 1762 1790 dev->driver->resume(&dev->gadget); 1763 1791 } 1764 1792 ··· 2107 2137 static int __init pxa25x_udc_probe(struct platform_device *pdev) 2108 2138 { 2109 2139 struct pxa25x_udc *dev = &memory; 2110 - int retval, vbus_irq, irq; 2140 + int retval, irq; 2111 2141 u32 chiprev; 2112 2142 2113 2143 /* insist on Intel/ARM/XScale */ ··· 2169 2199 2170 2200 dev->transceiver = otg_get_transceiver(); 2171 2201 2172 - if (gpio_is_valid(dev->mach->gpio_vbus)) { 2173 - if ((retval = gpio_request(dev->mach->gpio_vbus, 2174 - "pxa25x_udc GPIO VBUS"))) { 2175 - dev_dbg(&pdev->dev, 2176 - "can't get vbus gpio %d, err: %d\n", 2177 - dev->mach->gpio_vbus, retval); 2178 - goto err_gpio_vbus; 2179 - } 2180 - gpio_direction_input(dev->mach->gpio_vbus); 2181 - vbus_irq = gpio_to_irq(dev->mach->gpio_vbus); 2182 - } else 2183 - vbus_irq = 0; 2184 - 2185 2202 if (gpio_is_valid(dev->mach->gpio_pullup)) { 2186 2203 if ((retval = gpio_request(dev->mach->gpio_pullup, 2187 2204 "pca25x_udc GPIO PULLUP"))) { ··· 2194 2237 udc_disable(dev); 2195 2238 udc_reinit(dev); 2196 2239 2197 - dev->vbus = !!is_vbus_present(); 2240 + dev->vbus = 0; 2198 2241 2199 2242 /* irq setup after old hardware state is cleaned up */ 2200 2243 retval = request_irq(irq, pxa25x_udc_irq, ··· 2230 2273 } 2231 2274 } else 2232 2275 #endif 2233 - if (vbus_irq) { 2234 - retval = request_irq(vbus_irq, udc_vbus_irq, 2235 - IRQF_DISABLED | IRQF_SAMPLE_RANDOM | 2236 - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 2237 - driver_name, dev); 2238 - if (retval != 0) { 2239 - pr_err("%s: can't get irq %i, err %d\n", 2240 - driver_name, vbus_irq, retval); 2241 - goto err_vbus_irq; 2242 - } 2243 - } 2244 2276 create_debug_files(dev); 2245 2277 2246 2278 return 0; 2247 2279 2248 - err_vbus_irq: 2249 2280 #ifdef CONFIG_ARCH_LUBBOCK 2250 2281 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2251 2282 err_irq_lub: ··· 2243 2298 if (gpio_is_valid(dev->mach->gpio_pullup)) 2244 2299 gpio_free(dev->mach->gpio_pullup); 2245 2300 err_gpio_pullup: 2246 - if (gpio_is_valid(dev->mach->gpio_vbus)) 2247 - gpio_free(dev->mach->gpio_vbus); 2248 - err_gpio_vbus: 2249 2301 if (dev->transceiver) { 2250 2302 otg_put_transceiver(dev->transceiver); 2251 2303 dev->transceiver = NULL; ··· 2279 2337 free_irq(LUBBOCK_USB_IRQ, dev); 2280 2338 } 2281 2339 #endif 2282 - if (gpio_is_valid(dev->mach->gpio_vbus)) { 2283 - free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); 2284 - gpio_free(dev->mach->gpio_vbus); 2285 - } 2286 2340 if (gpio_is_valid(dev->mach->gpio_pullup)) 2287 2341 gpio_free(dev->mach->gpio_pullup); 2288 2342
+89 -47
drivers/video/pxafb.c
··· 627 627 628 628 static void overlay1fb_disable(struct pxafb_layer *ofb) 629 629 { 630 - uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 630 + uint32_t lccr5; 631 + 632 + if (!(lcd_readl(ofb->fbi, OVL1C1) & OVLxC1_OEN)) 633 + return; 634 + 635 + lccr5 = lcd_readl(ofb->fbi, LCCR5); 631 636 632 637 lcd_writel(ofb->fbi, OVL1C1, ofb->control[0] & ~OVLxC1_OEN); 633 638 ··· 690 685 691 686 static void overlay2fb_disable(struct pxafb_layer *ofb) 692 687 { 693 - uint32_t lccr5 = lcd_readl(ofb->fbi, LCCR5); 688 + uint32_t lccr5; 689 + 690 + if (!(lcd_readl(ofb->fbi, OVL2C1) & OVLxC1_OEN)) 691 + return; 692 + 693 + lccr5 = lcd_readl(ofb->fbi, LCCR5); 694 694 695 695 lcd_writel(ofb->fbi, OVL2C1, ofb->control[0] & ~OVLxC1_OEN); 696 696 ··· 730 720 if (user == 0) 731 721 return -ENODEV; 732 722 733 - /* allow only one user at a time */ 734 - if (atomic_inc_and_test(&ofb->usage)) 735 - return -EBUSY; 723 + if (ofb->usage++ == 0) 724 + /* unblank the base framebuffer */ 725 + fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK); 736 726 737 - /* unblank the base framebuffer */ 738 - fb_blank(&ofb->fbi->fb, FB_BLANK_UNBLANK); 739 727 return 0; 740 728 } 741 729 ··· 741 733 { 742 734 struct pxafb_layer *ofb = (struct pxafb_layer*) info; 743 735 744 - atomic_dec(&ofb->usage); 745 - ofb->ops->disable(ofb); 736 + if (ofb->usage == 1) { 737 + ofb->ops->disable(ofb); 738 + ofb->fb.var.height = -1; 739 + ofb->fb.var.width = -1; 740 + ofb->fb.var.xres = ofb->fb.var.xres_virtual = 0; 741 + ofb->fb.var.yres = ofb->fb.var.yres_virtual = 0; 746 742 747 - free_pages_exact(ofb->video_mem, ofb->video_mem_size); 748 - ofb->video_mem = NULL; 749 - ofb->video_mem_size = 0; 743 + ofb->usage--; 744 + } 750 745 return 0; 751 746 } 752 747 ··· 761 750 int xpos, ypos, pfor, bpp; 762 751 763 752 xpos = NONSTD_TO_XPOS(var->nonstd); 764 - ypos = NONSTD_TO_XPOS(var->nonstd); 753 + ypos = NONSTD_TO_YPOS(var->nonstd); 765 754 pfor = NONSTD_TO_PFOR(var->nonstd); 766 755 767 756 bpp = pxafb_var_to_bpp(var); ··· 805 794 return 0; 806 795 } 807 796 808 - static int overlayfb_map_video_memory(struct pxafb_layer *ofb) 797 + static int overlayfb_check_video_memory(struct pxafb_layer *ofb) 809 798 { 810 799 struct fb_var_screeninfo *var = &ofb->fb.var; 811 800 int pfor = NONSTD_TO_PFOR(var->nonstd); ··· 823 812 824 813 size = PAGE_ALIGN(ofb->fb.fix.line_length * var->yres_virtual); 825 814 826 - /* don't re-allocate if the original video memory is enough */ 827 815 if (ofb->video_mem) { 828 816 if (ofb->video_mem_size >= size) 829 817 return 0; 830 - 831 - free_pages_exact(ofb->video_mem, ofb->video_mem_size); 832 818 } 833 - 834 - ofb->video_mem = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO); 835 - if (ofb->video_mem == NULL) 836 - return -ENOMEM; 837 - 838 - ofb->video_mem_phys = virt_to_phys(ofb->video_mem); 839 - ofb->video_mem_size = size; 840 - 841 - mutex_lock(&ofb->fb.mm_lock); 842 - ofb->fb.fix.smem_start = ofb->video_mem_phys; 843 - ofb->fb.fix.smem_len = ofb->fb.fix.line_length * var->yres_virtual; 844 - mutex_unlock(&ofb->fb.mm_lock); 845 - ofb->fb.screen_base = ofb->video_mem; 846 - return 0; 819 + return -EINVAL; 847 820 } 848 821 849 822 static int overlayfb_set_par(struct fb_info *info) ··· 836 841 struct fb_var_screeninfo *var = &info->var; 837 842 int xpos, ypos, pfor, bpp, ret; 838 843 839 - ret = overlayfb_map_video_memory(ofb); 844 + ret = overlayfb_check_video_memory(ofb); 840 845 if (ret) 841 846 return ret; 842 847 843 848 bpp = pxafb_var_to_bpp(var); 844 849 xpos = NONSTD_TO_XPOS(var->nonstd); 845 - ypos = NONSTD_TO_XPOS(var->nonstd); 850 + ypos = NONSTD_TO_YPOS(var->nonstd); 846 851 pfor = NONSTD_TO_PFOR(var->nonstd); 847 852 848 853 ofb->control[0] = OVLxC1_PPL(var->xres) | OVLxC1_LPO(var->yres) | ··· 886 891 887 892 ofb->id = id; 888 893 ofb->ops = &ofb_ops[id]; 889 - atomic_set(&ofb->usage, 0); 894 + ofb->usage = 0; 890 895 ofb->fbi = fbi; 891 896 init_completion(&ofb->branch_done); 892 897 } ··· 899 904 return 0; 900 905 } 901 906 902 - static int __devinit pxafb_overlay_init(struct pxafb_info *fbi) 907 + static int __devinit pxafb_overlay_map_video_memory(struct pxafb_info *pxafb, 908 + struct pxafb_layer *ofb) 909 + { 910 + /* We assume that user will use at most video_mem_size for overlay fb, 911 + * anyway, it's useless to use 16bpp main plane and 24bpp overlay 912 + */ 913 + ofb->video_mem = alloc_pages_exact(PAGE_ALIGN(pxafb->video_mem_size), 914 + GFP_KERNEL | __GFP_ZERO); 915 + if (ofb->video_mem == NULL) 916 + return -ENOMEM; 917 + 918 + ofb->video_mem_phys = virt_to_phys(ofb->video_mem); 919 + ofb->video_mem_size = PAGE_ALIGN(pxafb->video_mem_size); 920 + 921 + mutex_lock(&ofb->fb.mm_lock); 922 + ofb->fb.fix.smem_start = ofb->video_mem_phys; 923 + ofb->fb.fix.smem_len = pxafb->video_mem_size; 924 + mutex_unlock(&ofb->fb.mm_lock); 925 + 926 + ofb->fb.screen_base = ofb->video_mem; 927 + 928 + return 0; 929 + } 930 + 931 + static void __devinit pxafb_overlay_init(struct pxafb_info *fbi) 903 932 { 904 933 int i, ret; 905 934 906 935 if (!pxafb_overlay_supported()) 907 - return 0; 936 + return; 908 937 909 938 for (i = 0; i < 2; i++) { 910 - init_pxafb_overlay(fbi, &fbi->overlay[i], i); 911 - ret = register_framebuffer(&fbi->overlay[i].fb); 939 + struct pxafb_layer *ofb = &fbi->overlay[i]; 940 + init_pxafb_overlay(fbi, ofb, i); 941 + ret = register_framebuffer(&ofb->fb); 912 942 if (ret) { 913 943 dev_err(fbi->dev, "failed to register overlay %d\n", i); 914 - return ret; 944 + continue; 915 945 } 946 + ret = pxafb_overlay_map_video_memory(fbi, ofb); 947 + if (ret) { 948 + dev_err(fbi->dev, 949 + "failed to map video memory for overlay %d\n", 950 + i); 951 + unregister_framebuffer(&ofb->fb); 952 + continue; 953 + } 954 + ofb->registered = 1; 916 955 } 917 956 918 957 /* mask all IU/BS/EOF/SOF interrupts */ 919 958 lcd_writel(fbi, LCCR5, ~0); 920 959 921 - /* place overlay(s) on top of base */ 922 - fbi->lccr0 |= LCCR0_OUC; 923 960 pr_info("PXA Overlay driver loaded successfully!\n"); 924 - return 0; 925 961 } 926 962 927 963 static void __devexit pxafb_overlay_exit(struct pxafb_info *fbi) ··· 962 936 if (!pxafb_overlay_supported()) 963 937 return; 964 938 965 - for (i = 0; i < 2; i++) 966 - unregister_framebuffer(&fbi->overlay[i].fb); 939 + for (i = 0; i < 2; i++) { 940 + struct pxafb_layer *ofb = &fbi->overlay[i]; 941 + if (ofb->registered) { 942 + if (ofb->video_mem) 943 + free_pages_exact(ofb->video_mem, 944 + ofb->video_mem_size); 945 + unregister_framebuffer(&ofb->fb); 946 + } 947 + } 967 948 } 968 949 #else 969 950 static inline void pxafb_overlay_init(struct pxafb_info *fbi) {} ··· 1401 1368 (lcd_readl(fbi, LCCR3) != fbi->reg_lccr3) || 1402 1369 (lcd_readl(fbi, LCCR4) != fbi->reg_lccr4) || 1403 1370 (lcd_readl(fbi, FDADR0) != fbi->fdadr[0]) || 1404 - (lcd_readl(fbi, FDADR1) != fbi->fdadr[1])) 1371 + ((fbi->lccr0 & LCCR0_SDS) && 1372 + (lcd_readl(fbi, FDADR1) != fbi->fdadr[1]))) 1405 1373 pxafb_schedule_work(fbi, C_REENABLE); 1406 1374 1407 1375 return 0; ··· 1454 1420 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 & ~LCCR0_ENB); 1455 1421 1456 1422 lcd_writel(fbi, FDADR0, fbi->fdadr[0]); 1457 - lcd_writel(fbi, FDADR1, fbi->fdadr[1]); 1423 + if (fbi->lccr0 & LCCR0_SDS) 1424 + lcd_writel(fbi, FDADR1, fbi->fdadr[1]); 1458 1425 lcd_writel(fbi, LCCR0, fbi->reg_lccr0 | LCCR0_ENB); 1459 1426 } 1460 1427 ··· 1648 1613 1649 1614 switch (val) { 1650 1615 case CPUFREQ_PRECHANGE: 1651 - set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); 1616 + if (!fbi->overlay[0].usage && !fbi->overlay[1].usage) 1617 + set_ctrlr_state(fbi, C_DISABLE_CLKCHANGE); 1652 1618 break; 1653 1619 1654 1620 case CPUFREQ_POSTCHANGE: ··· 1841 1805 fbi->task_state = (u_char)-1; 1842 1806 1843 1807 pxafb_decode_mach_info(fbi, inf); 1808 + 1809 + #ifdef CONFIG_FB_PXA_OVERLAY 1810 + /* place overlay(s) on top of base */ 1811 + if (pxafb_overlay_supported()) 1812 + fbi->lccr0 |= LCCR0_OUC; 1813 + #endif 1844 1814 1845 1815 init_waitqueue_head(&fbi->ctrlr_wait); 1846 1816 INIT_WORK(&fbi->task, pxafb_task);
+2 -1
drivers/video/pxafb.h
··· 92 92 struct pxafb_layer { 93 93 struct fb_info fb; 94 94 int id; 95 - atomic_t usage; 95 + int registered; 96 + uint32_t usage; 96 97 uint32_t control[2]; 97 98 98 99 struct pxafb_layer_ops *ops;